summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2018-09-30 01:43:01 -0400
committerLuke Shumaker <lukeshu@lukeshu.com>2018-10-01 17:35:22 -0400
commit33cb6e9b2038b833d60668702fe194b9e352a3ab (patch)
treea576e479010306aa4fbc78ca1091ebbe0023e7c1 /test
parentf2fdb9a969c7caa9296ab4e3b252c883e90cace4 (diff)
test: testenv: Clean up the sudo hack
Diffstat (limited to 'test')
-rwxr-xr-xtest/testenv18
1 files changed, 6 insertions, 12 deletions
diff --git a/test/testenv b/test/testenv
index a2e1699..ca61225 100755
--- a/test/testenv
+++ b/test/testenv
@@ -61,26 +61,20 @@
"${_librelib_conf_sh_sysconfdir}/makepkg.d/librefetch.conf"
# Hack to respect our variables in sudo
- _sudo() {
- local vars=(
+ install -Dm755 /dev/stdin "$destdir/usr/bin/testsudo" <<-'eot'
+ #!/bin/bash
+ vars=(
TMPDIR
GNUPGHOME XDG_CACHE_HOME XDG_CONFIG_HOME
- PATH LIBRETOOLS_LIBDIR _librelib_conf_sh_sysconfdir
+ PATH LIBRETOOLS_LIBDIR _librelib_conf_sh_sysconfdir _librelib_conf_sh_pkgconfdir
GPGKEY
)
- local env=()
- local var
+ env=()
for var in "${vars[@]}"; do
env+=("$var=${!var}")
done
sudo "${env[@]}" "$@"
- }
- printf '%s\n' \
- '#!/bin/bash' \
- "$(declare -f _sudo)" \
- '_sudo "$@"' \
- > "$destdir/usr/bin/testsudo"
- chmod 755 "$destdir/usr/bin/testsudo"
+ eot
# Hack to work around GnuPG being stupid with locating gpg-agent's socket
install -Dm755 /dev/stdin "$destdir/usr/bin/gpg" <<-'eot'
#!/bin/bash