summaryrefslogtreecommitdiff
path: root/src/librefetch
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2015-01-05 20:28:36 -0500
committerLuke Shumaker <lukeshu@sbcglobal.net>2015-01-05 20:28:36 -0500
commit9c33131ece34a52341b1a31606d56329371fcce8 (patch)
treeeb9b94f19670f42ae8b661b4839234484c1f61bb /src/librefetch
parent1b74c4c87cc1a268d3a9cae14335101dff25161f (diff)
librefetch: wasn't cleaning up temp filesv20150105.1
Diffstat (limited to 'src/librefetch')
-rwxr-xr-xsrc/librefetch/librefetch13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/librefetch/librefetch b/src/librefetch/librefetch
index e2300e0..45df21b 100755
--- a/src/librefetch/librefetch
+++ b/src/librefetch/librefetch
@@ -25,7 +25,7 @@
setup_traps
tmpfiles=()
-trap "rm -f -- $(printf '%q ' "${tmpfiles[@]}")" EXIT
+trap 'rm -f -- "${tmpfiles[@]}"' EXIT
cmd=${0##*/}
usage() {
@@ -93,6 +93,7 @@ main() {
########################################################################
makepkg="$(modified_makepkg "$(which makepkg)")"
+ tmpfiles+=("$makepkg")
# Mode: makepkg ########################################################
@@ -115,6 +116,7 @@ main() {
*/SRCBUILD) srcbuild="$(modified_srcbuild "$BUILDFILE")";;
*) srcbuild="$(modified_pkgbuild "$BUILDFILE")";;
esac
+ tmpfiles+=("$srcbuild")
# Mode: checksums ######################################################
@@ -323,8 +325,7 @@ tidy_install_purge() {
modified_makepkg() {
local makepkg_orig=$1
- local makepkg_mine="$(mktemp --tmpdir "${0##*/}.XXXXXXXXXXX.makepkg")"
- tmpfiles+=("$makepkg_mine")
+ local makepkg_mine="$(mktemp --tmpdir "${cmd}.XXXXXXXXXXX.makepkg")"
{
echo '#!/bin/bash'
declare -f tidy_install_purge
@@ -377,8 +378,7 @@ package() { cp -a "$srcdir"/*/ "$pkgdir/"; }
modified_pkgbuild() {
local pkgbuild=$1
- local srcbuild="$(mktemp "${pkgbuild%/*}/${0##*/}.XXXXXXXXXXX.PKGBUILD.2.SRCBUILD")"
- tmpfiles+=("$srcbuild")
+ local srcbuild="$(mktemp "${pkgbuild%/*}/${cmd}.XXXXXXXXXXX.PKGBUILD.2.SRCBUILD")"
printf '%s' "$pkgbuild_append" | cat "$pkgbuild" - > "$srcbuild"
printf '%s\n' "$srcbuild"
}
@@ -388,8 +388,7 @@ modified_pkgbuild() {
modified_srcbuild() {
local orig=$1
- local srcbuild="$(mktemp "${orig%/*}/${0##*/}.XXXXXXXXXXX.SRCBUILD.2.SRCBUILD")"
- tmpfiles+=("$srcbuild")
+ local srcbuild="$(mktemp "${orig%/*}/${cmd}.XXXXXXXXXXX.SRCBUILD.2.SRCBUILD")"
sed -e '/PKGDEST=/d' -e '/PKGEXT=/d' < "$orig" > "$new"
printf '%s\n' "$new"
}