2023-04-03 17:11:10 +00:00
|
|
|
#!/bin/bash
|
2023-04-03 17:25:41 +00:00
|
|
|
CONTEXT_ROOT="${CONTEXT_ROOT}";
|
|
|
|
|
2023-04-03 17:11:10 +00:00
|
|
|
if [ ! "$UID" -eq 0 ]
|
|
|
|
then
|
2023-04-03 17:25:41 +00:00
|
|
|
CONTEXT_ROOT="$(mktemp -d)";
|
2023-04-03 17:28:33 +00:00
|
|
|
workingDir="$(pwd)";
|
|
|
|
|
2023-04-03 17:25:41 +00:00
|
|
|
sudo \
|
|
|
|
CONTEXT_ROOT="${CONTEXT_ROOT}" \
|
|
|
|
bash "$BASH_SOURCE";
|
2023-04-03 17:26:34 +00:00
|
|
|
|
|
|
|
cd "$CONTEXT_ROOT";
|
|
|
|
makepkg -si;
|
2023-04-03 17:28:33 +00:00
|
|
|
cd "$workingDir";
|
2023-04-03 17:11:10 +00:00
|
|
|
else
|
|
|
|
scriptRoot="$(realpath "${BASH_SOURCE%/*}")";
|
|
|
|
patchFile="allow_insecure_crypto.patch";
|
|
|
|
patchedConfig="openssl_insecure_crypto.cnf";
|
|
|
|
chmod a+rwx "$contextDir"
|
|
|
|
|
2023-04-03 17:25:41 +00:00
|
|
|
git clone https://aur.archlinux.org/networkmanager-openconnect-useragent-git.git "$CONTEXT_ROOT";
|
|
|
|
cd "$CONTEXT_ROOT";
|
2023-04-03 17:11:10 +00:00
|
|
|
cp "$scriptRoot/$patchFile" .;
|
|
|
|
cp "$scriptRoot/$patchedConfig" .;
|
|
|
|
|
|
|
|
sed -i \
|
|
|
|
-e "s/^\(source=(.*\)\()\)/\1 \"local:\/\/$patchFile\" \"local:\/\/$patchedConfig\"\2/" \
|
|
|
|
-e "s/^\(sha256sums=(.*\)\()\)/\1 'SKIP' 'SKIP'\2/" \
|
|
|
|
-e "/^build() {/{" \
|
|
|
|
-e 'a\' \
|
|
|
|
-e ' cd NetworkManager-openconnect\' \
|
|
|
|
-e ' git apply "${srcdir}/'"$patchFile"'"\' \
|
|
|
|
-e " cd .." \
|
|
|
|
-e "}" \
|
|
|
|
-e "/^package() {/{" \
|
|
|
|
-e 'a mkdir -p "${pkgdir}/usr/local/etc/ssl"' \
|
|
|
|
-e 'a cp "${srcdir}/'"$patchedConfig"'" "${pkgdir}/usr/local/etc/ssl/openssl_insecure_crypto.cnf"' \
|
|
|
|
-e "}" \
|
|
|
|
PKGBUILD
|
|
|
|
fi;
|