From 280704886c3abd60dc8bed89cb4222275d324c91 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Mon, 3 Apr 2023 19:25:41 +0200 Subject: [PATCH] Create the context root using the current user --- install.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/install.sh b/install.sh index 3b0a670..47fe488 100755 --- a/install.sh +++ b/install.sh @@ -1,17 +1,21 @@ #!/bin/bash +CONTEXT_ROOT="${CONTEXT_ROOT}"; + if [ ! "$UID" -eq 0 ] then - sudo bash "$BASH_SOURCE"; + CONTEXT_ROOT="$(mktemp -d)"; + sudo \ + CONTEXT_ROOT="${CONTEXT_ROOT}" \ + bash "$BASH_SOURCE"; else scriptRoot="$(realpath "${BASH_SOURCE%/*}")"; workingDir="$(pwd)"; - contextDir="$(mktemp -d)"; patchFile="allow_insecure_crypto.patch"; patchedConfig="openssl_insecure_crypto.cnf"; chmod a+rwx "$contextDir" - git clone https://aur.archlinux.org/networkmanager-openconnect-useragent-git.git "$contextDir"; - cd "$contextDir"; + git clone https://aur.archlinux.org/networkmanager-openconnect-useragent-git.git "$CONTEXT_ROOT"; + cd "$CONTEXT_ROOT"; cp "$scriptRoot/$patchFile" .; cp "$scriptRoot/$patchedConfig" .;