diff options
author | Erich Eckner <git@eckner.net> | 2018-02-13 10:48:25 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-02-13 10:48:25 +0100 |
commit | a9f0449be9a12ffd6842671eee49fde40b3196f3 (patch) | |
tree | e9972f3749f295879294e9ce0333ed37a16e3271 | |
parent | 85e1b4ef9f0da06b6bcb2a3c8e550fdd1bb8b794 (diff) | |
download | builder-a9f0449be9a12ffd6842671eee49fde40b3196f3.tar.xz |
bin/get-package-updates: cleanup db in trap on exit
-rwxr-xr-x | bin/get-package-updates | 14 |
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). |