summaryrefslogtreecommitdiff
path: root/bin/delete-packages
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2020-01-30 14:02:59 +0100
committerErich Eckner <git@eckner.net>2020-01-30 14:02:59 +0100
commit25d948f14c5f69fe44ef97097528ae6a4d1e94f9 (patch)
tree58336feb78d7e5f66f390d3ccbfcb1e4bbbd11b2 /bin/delete-packages
parenta805783d94e20f492fa8b8a4281017f5a1b87576 (diff)
downloadbuilder-25d948f14c5f69fe44ef97097528ae6a4d1e94f9.tar.xz
bin/delete-packages: `-n` should work flawlessly again, now
Diffstat (limited to 'bin/delete-packages')
-rwxr-xr-xbin/delete-packages33
1 files changed, 14 insertions, 19 deletions
diff --git a/bin/delete-packages b/bin/delete-packages
index dddd5fa..7486644 100755
--- a/bin/delete-packages
+++ b/bin/delete-packages
@@ -57,7 +57,7 @@ block_flag='-n'
build_support=''
force_packages=''
ignore_insanity=false
-no_action=false
+no_action_option=''
while true
do
@@ -81,7 +81,7 @@ do
ignore_insanity=true
;;
-n|--no-action)
- no_action=true
+ no_action_option='-n'
;;
-w|--wait)
block_flag=''
@@ -113,7 +113,7 @@ fi
# Create a lock file and a trap.
-if ! ${no_action}; then
+if [ -z "${no_action_option}" ]; then
# exec 9> "${build_list_lock_file}"
# if ! verbose_flock ${block_flag} 9; then
@@ -358,14 +358,6 @@ fi
mkdir "${tmp_dir}/repos"
-if ${no_action}; then
- printf 'I would delete the following files from the master mirror:\n'
- sed '
- s,^, ,
- ' "${tmp_dir}/package-files"
- exit
-fi
-
while read -r arch repo; do
{
printf 'mkdir -p "%s/repos/%s"\n' "${tmp_dir}" "${arch}"
@@ -380,7 +372,7 @@ while read -r arch repo; do
done
printf ' "%s/repos/%s"\n' "${tmp_dir}" "${arch}"
} \
- | intent_something
+ | intent_something "${no_action_option}"
{
printf 'repo-remove "%s/repos/%s/%s.db.tar.gz" ' \
"${tmp_dir}" \
@@ -398,7 +390,7 @@ while read -r arch repo; do
done
printf '\n'
} \
- | intent_something
+ | intent_something "${no_action_option}"
{
printf 'failsafe_rsync'
for suffix in 'db' 'files'; do
@@ -413,7 +405,7 @@ while read -r arch repo; do
"${arch}" \
"${repo}"
} \
- | intent_something
+ | intent_something "${no_action_option}"
done \
<"${tmp_dir}/repositories"
@@ -455,7 +447,7 @@ done \
printf 'END_OF_MYSQL_QUERY\n'
} \
| sed 's/`/\\`/g' \
-| intent_something
+| intent_something "${no_action_option}"
{
printf 'failsafe_sftp <<END_OF_SFTP_COMMANDS\n'
@@ -465,11 +457,14 @@ done \
' "${tmp_dir}/package-files"
printf 'END_OF_SFTP_COMMANDS\n'
} \
-| intent_something
+| intent_something "${no_action_option}"
# cleanup is now handled by the intentions-queue
printf 'rm -rf --one-file-system "%s"\n' "${tmp_dir}" \
-| intent_something
-trap - EXIT
+| intent_something "${no_action_option}"
+# iff not `-n`
+if [ -z "${no_action_option}" ]; then
+ trap - EXIT
-execute_all_intentions
+ execute_all_intentions
+fi