diff options
author | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2020-12-08 01:29:23 (EST) |
---|---|---|
committer | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2020-12-08 01:29:23 (EST) |
commit | 824797b55596d45589e5ca49ac906639f6e49f53 (patch) | |
tree | 1ca445d370cb40727f78b408a9883c5902efc722 /src | |
parent | 1d2257483965af5e75d4cd631a079930648dcb59 (diff) |
ob-gencontrol: Use an FD for control files
Diffstat (limited to 'src')
-rw-r--r-- | src/ob-gencontrol.sh | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/src/ob-gencontrol.sh b/src/ob-gencontrol.sh index b54c4b3..5a8aa40 100644 --- a/src/ob-gencontrol.sh +++ b/src/ob-gencontrol.sh @@ -72,8 +72,9 @@ gen_control_src() binary="src:${OPK_SOURCE}" mkdir -p -- "${binary}.control" + exec 3>"${binary}.control/control" - cat >"${binary}.control/control" <<-EOF + cat >&3 <<-EOF Package: src:${OPK_SOURCE} Source: ${OPK_SOURCE} Binary:$(printf '%s\n' $(ob_get_binary_packages) | \ @@ -91,12 +92,10 @@ gen_control_src() continue fi value="$(ob_substvars "${value}")" - printf '%s: %s\n' "${name}" "${value}" | \ - sed 's/[, ]*$//' \ - >>"${binary}.control/control" + printf '%s: %s\n' "${name}" "${value}" | sed 's/[, ]*$//' >&3 done - cat >>"${binary}.control/control" <<-EOF + cat >&3 <<-EOF Installed-Size: $(calc_inst_size "src:${OPK_SOURCE}") Format: $(ob_get_source_parameter 'Format') Description: ${OPK_SOURCE} source package @@ -104,10 +103,11 @@ gen_control_src() homepage="$(ob_get_source_parameter 'Homepage')" if [ -n "${homepage}" ]; then - printf '%s: %s\n' 'Homepage' "${homepage}" \ - >>"${binary}.control/control" + printf '%s: %s\n' 'Homepage' "${homepage}" >&3 fi + exec 3>&- + return 0 } @@ -124,8 +124,9 @@ gen_control_bin() local homepage= mkdir -p -- "${binary}.control" + exec 3>"${binary}.control/control" - cat >"${binary}.control/control" <<-EOF + cat >&3 <<-EOF Package: $(ob_qualify_package_name "${binary}" \ "${OPK_HOST_ARCH}") Source: ${OPK_SOURCE} @@ -135,11 +136,11 @@ gen_control_bin() EOF value="$(ob_get_binary_parameter "${binary}" 'Section')" if [ -n "${value}" ]; then - cat >>"${binary}.control/control" <<-EOF + cat >&3 <<-EOF Section: ${value} EOF fi - cat >>"${binary}.control/control" <<-EOF + cat >&3 <<-EOF Maintainer: $(ob_get_source_parameter 'Maintainer' | \ tr '\n' ' ') EOF @@ -168,21 +169,21 @@ gen_control_bin() value="$(ob_substvars "${value}" "${binary}")" ;; esac - printf '%s: %s\n' "${name}" "${value}" | sed 's/[, ]*$//' \ - >>"${binary}.control/control" + printf '%s: %s\n' "${name}" "${value}" | sed 's/[, ]*$//' >&3 done - cat >>"${binary}.control/control" <<-EOF + cat >&3 <<-EOF Installed-Size: $(calc_inst_size "${binary}") Description:$(printf '%s' "${desc}" | sed 's/^/ /') EOF homepage="$(ob_get_source_parameter 'Homepage')" if [ -n "${homepage}" ]; then - printf '%s: %s\n' 'Homepage' "${homepage}" \ - >>"${binary}.control/control" + printf '%s: %s\n' 'Homepage' "${homepage}" >&3 fi + exec 3>&- + return 0 } |