Update IKEv2 script
- Make it easier for users to update Libreswan when the script is not running in auto mode
This commit is contained in:
parent
1972501725
commit
2e7b3f1bf4
@ -227,6 +227,30 @@ check_swan_ver() {
|
||||
swan_ver_latest=$(wget -t 3 -T 15 -qO- "$swan_ver_url")
|
||||
}
|
||||
|
||||
run_swan_update() {
|
||||
update_url=vpnupgrade
|
||||
if [ "$os_type" = "centos" ] || [ "$os_type" = "rhel" ]; then
|
||||
update_url=vpnupgrade-centos
|
||||
elif [ "$os_type" = "amzn" ]; then
|
||||
update_url=vpnupgrade-amzn
|
||||
fi
|
||||
TMPDIR=$(mktemp -d /tmp/vpnupg.XXX 2>/dev/null)
|
||||
if [ -d "$TMPDIR" ]; then
|
||||
set -x
|
||||
if wget -t 3 -T 30 -q -O "$TMPDIR/vpnupg.sh" "https://git.io/$update_url"; then
|
||||
/bin/sh "$TMPDIR/vpnupg.sh"
|
||||
fi
|
||||
{ set +x; } 2>&-
|
||||
[ ! -s "$TMPDIR/vpnupg.sh" ] && echo "Error: Could not download update script." >&2
|
||||
/bin/rm -f "$TMPDIR/vpnupg.sh"
|
||||
/bin/rmdir "$TMPDIR"
|
||||
else
|
||||
echo "Error: Could not create temporary directory." >&2
|
||||
fi
|
||||
read -n 1 -s -r -p "Press any key to continue IKEv2 setup..."
|
||||
echo
|
||||
}
|
||||
|
||||
select_swan_update() {
|
||||
if printf '%s' "$swan_ver_latest" | grep -Eq '^([3-9]|[1-9][0-9])\.([0-9]|[1-9][0-9])$' \
|
||||
&& [ "$swan_ver" != "$swan_ver_latest" ] \
|
||||
@ -234,18 +258,20 @@ select_swan_update() {
|
||||
echo "Note: A newer version of Libreswan ($swan_ver_latest) is available."
|
||||
echo " It is recommended to update Libreswan before setting up IKEv2."
|
||||
if [ "$in_container" = "0" ]; then
|
||||
echo " To update, exit this script and run:"
|
||||
update_url=vpnupgrade
|
||||
if [ "$os_type" = "centos" ] || [ "$os_type" = "rhel" ]; then
|
||||
update_url=vpnupgrade-centos
|
||||
elif [ "$os_type" = "amzn" ]; then
|
||||
update_url=vpnupgrade-amzn
|
||||
fi
|
||||
echo " wget https://git.io/$update_url -O vpnupgrade.sh"
|
||||
echo " sudo sh vpnupgrade.sh"
|
||||
echo
|
||||
printf "Do you want to update Libreswan? [Y/n] "
|
||||
read -r response
|
||||
case $response in
|
||||
[yY][eE][sS]|[yY]|'')
|
||||
echo
|
||||
run_swan_update
|
||||
;;
|
||||
*)
|
||||
echo
|
||||
;;
|
||||
esac
|
||||
else
|
||||
echo " To update this Docker image, see: https://git.io/updatedockervpn"
|
||||
fi
|
||||
echo
|
||||
printf "Do you want to continue anyway? [y/N] "
|
||||
read -r response
|
||||
@ -259,6 +285,7 @@ select_swan_update() {
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
show_welcome_message() {
|
||||
|
Loading…
Reference in New Issue
Block a user