Remove unnecessary process elevation

This commit is contained in:
Manuel Thalmann 2023-04-03 19:41:03 +02:00
parent a5725b341c
commit 1ace953e8a

View file

@ -1,26 +1,12 @@
#!/bin/bash
CONTEXT_ROOT="${CONTEXT_ROOT}";
if [ ! "$UID" -eq 0 ]
then
CONTEXT_ROOT="$(mktemp -d)";
contextRoot="$(mktemp -d)";
workingDir="$(pwd)";
sudo \
CONTEXT_ROOT="${CONTEXT_ROOT}" \
bash "$BASH_SOURCE";
cd "$CONTEXT_ROOT";
makepkg -si;
cd "$workingDir";
rm -rf "$CONTEXT_ROOT";
else
scriptRoot="$(realpath "${BASH_SOURCE%/*}")";
patchFile="allow_insecure_crypto.patch";
patchedConfig="openssl_insecure_crypto.cnf";
git clone https://aur.archlinux.org/networkmanager-openconnect-useragent-git.git "$CONTEXT_ROOT";
cd "$CONTEXT_ROOT";
git clone https://aur.archlinux.org/networkmanager-openconnect-useragent-git.git "$contextRoot";
cd "$contextRoot";
cp "$scriptRoot/$patchFile" .;
cp "$scriptRoot/$patchedConfig" .;
@ -39,4 +25,7 @@ else
-e 'a cp "${srcdir}/'"$patchedConfig"'" "${pkgdir}/usr/local/etc/ssl/openssl_insecure_crypto.cnf"' \
-e "}" \
PKGBUILD
fi;
makepkg -si;
cd "$workingDir";
rm -rf "$contextRoot";