summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2015-01-01 19:19:57 -0500
committerLuke Shumaker <lukeshu@sbcglobal.net>2015-01-01 19:19:57 -0500
commit6c23f9d00ac733779d9181fdfc0a789293ddb110 (patch)
treee387e86563ecac2f3d5e7094e542218c3158386c
parent896dd1f8c483282b02976d96da6aacf269032196 (diff)
librefetch: Adjust to makepkg now requiring $BUILDSCRIPT to be in $PWD
-rwxr-xr-xsrc/librefetch/librefetch16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/librefetch/librefetch b/src/librefetch/librefetch
index db996b7..8225fc6 100755
--- a/src/librefetch/librefetch
+++ b/src/librefetch/librefetch
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
# librefetch
#
-# Copyright (C) 2013-2014 Luke Shumaker <lukeshu@sbcglobal.net>
+# Copyright (C) 2013-2015 Luke Shumaker <lukeshu@sbcglobal.net>
#
# License: GNU GPLv3+
#
@@ -24,8 +24,8 @@
. "$(librelib messages)"
setup_traps
-declare -r tempdir="$(mktemp -d --tmpdir ${0##*/}.XXXXXXXXXXX)"
-trap "rm -rf -- $(printf '%q' "$tempdir")" EXIT
+tmpfiles=()
+trap "rm -f -- $(printf '%q ' "${tmpfiles[@]}")" EXIT
cmd=${0##*/}
usage() {
@@ -324,13 +324,15 @@ tidy_install_purge() {
modified_makepkg() {
local makepkg_orig=$1
local makepkg_mine="$tempdir/makepkg"
+ local makepkg_mine="$(mktemp "${0##*/}.XXXXXXXXXXX.makepkg")"
+ tmpfiles+=("$makepkg_mine")
{
echo '#!/bin/bash'
declare -f tidy_install_purge
sed -r "$makepkg_modify" < "$makepkg_orig"
} > "$makepkg_mine"
chmod 755 "$makepkg_mine"
- printf "%s\n" "$makepkg_mine"
+ realpath -es "$makepkg_mine"
}
# Modify PKGBUILD ##############################################################
@@ -376,7 +378,8 @@ package() { cp -a "$srcdir"/*/ "$pkgdir/"; }
modified_pkgbuild() {
local pkgbuild=$1
- local srcbuild="$tempdir/SRCBUILD"
+ local srcbuild="$(mktemp "${0##*/}.XXXXXXXXXXX.PKGBUILD.2.SRCBUILD")"
+ tmpfiles+=("$srcbuild")
printf '%s' "$pkgbuild_append" | cat "$pkgbuild" - > "$srcbuild"
printf '%s\n' "$srcbuild"
}
@@ -386,7 +389,8 @@ modified_pkgbuild() {
modified_srcbuild() {
local orig=$1
- local new="$tempdir/SRCBUILD"
+ local srcbuild="$(mktemp "${0##*/}.XXXXXXXXXXX.SRCBUILD.2.SRCBUILD")"
+ tmpfiles+=("$srcbuild")
sed -e '/PKGDEST=/d' -e '/PKGEXT=/d' < "$orig" > "$new"
printf '%s\n' "$new"
}