From 575858a3709d03b6348add5721cd02e320b424bf Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Wed, 13 Mar 2019 18:50:33 -0400 Subject: Protect against cmd operands beginning with "-" --- (limited to 'src/ob-gencontrol.sh') diff --git a/src/ob-gencontrol.sh b/src/ob-gencontrol.sh index 434e491..94c2471 100644 --- a/src/ob-gencontrol.sh +++ b/src/ob-gencontrol.sh @@ -58,7 +58,7 @@ gen_control() # patch opkg and submit a bug report. inst_size=$((($inst_size + 1023) / 1024)) - mkdir -p "${binary}.control" + mkdir -p -- "${binary}.control" cat >"${binary}.control/control" <<-EOF Package: ${binary} @@ -121,7 +121,7 @@ install_maintainer_scripts() if [ -L "../${binary}.pkg/${script}" ]; then target="$(ls -l "../${binary}.pkg/${script}")" target="${target#* -> }" - ln -s "${target}" "${binary}.control/${script}" + ln -s -- "${target}" "${binary}.control/${script}" elif [ -r "../${binary}.pkg/${script}" ]; then cp "../${binary}.pkg/${script}" "${binary}.control/${script}" chmod 755 "${binary}.control/${script}" @@ -139,7 +139,7 @@ gen_conffiles() find "${binary}.data/etc" -type f | sed "s@^${binary}.data@@" \ >"${binary}.control/conffiles" if [ -z "$(head -n 1 "${binary}.control/conffiles")" ]; then - rm -f "${binary}.control/conffiles" + rm -f -- "${binary}.control/conffiles" else chmod 644 "${binary}.control/conffiles" fi @@ -156,7 +156,7 @@ gen_md5sums() sed "s@ ${binary}.data@ @" \ >"${binary}.control/md5sums" if [ -z "$(head -n 1 "${binary}.control/md5sums")" ]; then - rm -f "${binary}.control/md5sums" + rm -f -- "${binary}.control/md5sums" else chmod 644 "${binary}.control/md5sums" fi -- cgit v0.9.1