Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/bin/get-package-updates
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-02-13 10:48:25 +0100
committerErich Eckner <git@eckner.net>2018-02-13 10:48:25 +0100
commita9f0449be9a12ffd6842671eee49fde40b3196f3 (patch)
treee9972f3749f295879294e9ce0333ed37a16e3271 /bin/get-package-updates
parent85e1b4ef9f0da06b6bcb2a3c8e550fdd1bb8b794 (diff)
bin/get-package-updates: cleanup db in trap on exit
Diffstat (limited to 'bin/get-package-updates')
-rwxr-xr-xbin/get-package-updates14
1 files changed, 13 insertions, 1 deletions
diff --git a/bin/get-package-updates b/bin/get-package-updates
index 465f896..abd380e 100755
--- a/bin/get-package-updates
+++ b/bin/get-package-updates
@@ -135,8 +135,20 @@ delete_package() {
}
# create tmp_dir and trap
+clean_up() {
+ rm -rf --one-file-system "${tmp_dir}"
+ # shellcheck disable=SC2016
+ {
+ printf 'DELETE FROM `binary_packages`'
+ printf ' WHERE `binary_packages`.`repository`=('
+ printf 'SELECT `repositories`.`id` FROM `repositories`'
+ printf ' WHERE `repositories`.`name`="to-be-decided"'
+ printf ');\n'
+ } | \
+ ${mysql_command}
+}
tmp_dir=$(mktemp -d 'tmp.get-package-updates.XXXXXXXXXX' --tmpdir)
-trap 'rm -rf --one-file-system "${tmp_dir}"' EXIT
+trap 'clean_up' EXIT
# Update git repositories (official packages, community packages and the repository of package customizations).