From 33cb6e9b2038b833d60668702fe194b9e352a3ab Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 30 Sep 2018 01:43:01 -0400 Subject: test: testenv: Clean up the sudo hack --- test/testenv | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'test') 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 -- cgit v1.2.2