Create the context root using the current user

This commit is contained in:
Manuel Thalmann 2023-04-03 19:25:41 +02:00
parent baca906ad5
commit 280704886c

View file

@ -1,17 +1,21 @@
#!/bin/bash #!/bin/bash
CONTEXT_ROOT="${CONTEXT_ROOT}";
if [ ! "$UID" -eq 0 ] if [ ! "$UID" -eq 0 ]
then then
sudo bash "$BASH_SOURCE"; CONTEXT_ROOT="$(mktemp -d)";
sudo \
CONTEXT_ROOT="${CONTEXT_ROOT}" \
bash "$BASH_SOURCE";
else else
scriptRoot="$(realpath "${BASH_SOURCE%/*}")"; scriptRoot="$(realpath "${BASH_SOURCE%/*}")";
workingDir="$(pwd)"; workingDir="$(pwd)";
contextDir="$(mktemp -d)";
patchFile="allow_insecure_crypto.patch"; patchFile="allow_insecure_crypto.patch";
patchedConfig="openssl_insecure_crypto.cnf"; patchedConfig="openssl_insecure_crypto.cnf";
chmod a+rwx "$contextDir" chmod a+rwx "$contextDir"
git clone https://aur.archlinux.org/networkmanager-openconnect-useragent-git.git "$contextDir"; git clone https://aur.archlinux.org/networkmanager-openconnect-useragent-git.git "$CONTEXT_ROOT";
cd "$contextDir"; cd "$CONTEXT_ROOT";
cp "$scriptRoot/$patchFile" .; cp "$scriptRoot/$patchFile" .;
cp "$scriptRoot/$patchedConfig" .; cp "$scriptRoot/$patchedConfig" .;