Cleanup
This commit is contained in:
parent
17c429b2fb
commit
e5703d8aaa
@ -90,7 +90,7 @@ EOF
|
||||
check_libreswan() {
|
||||
ipsec_ver=$(ipsec --version 2>/dev/null)
|
||||
if ( ! grep -qs "hwdsl2 VPN script" /etc/sysctl.conf && ! grep -qs "hwdsl2" /opt/src/run.sh ) \
|
||||
|| ! printf '%s' "$ipsec_ver" | grep -q "Libreswan"; then
|
||||
|| ! printf '%s' "$ipsec_ver" | grep -qi 'libreswan'; then
|
||||
cat 1>&2 <<'EOF'
|
||||
Error: This script can only be used with an IPsec server created using:
|
||||
https://github.com/hwdsl2/setup-ipsec-vpn
|
||||
|
@ -49,7 +49,7 @@ check_libreswan() {
|
||||
swan_ver=$(printf '%s' "$ipsec_ver" | sed -e 's/.*Libreswan U\?//' -e 's/\( (\|\/K\).*//')
|
||||
if ! grep -qs "hwdsl2 VPN script" /etc/sysctl.conf \
|
||||
|| ! grep -qs "config setup" /etc/ipsec.conf \
|
||||
|| ! printf '%s' "$ipsec_ver" | grep -q "Libreswan"; then
|
||||
|| ! printf '%s' "$ipsec_ver" | grep -qi 'libreswan'; then
|
||||
cat 1>&2 <<'EOF'
|
||||
Error: Your must first set up the IPsec VPN server before selecting IKEv2-only mode.
|
||||
See: https://github.com/hwdsl2/setup-ipsec-vpn
|
||||
|
@ -101,7 +101,7 @@ EOF
|
||||
check_libreswan() {
|
||||
ipsec_ver=$(ipsec --version 2>/dev/null)
|
||||
if ( ! grep -qs "hwdsl2 VPN script" /etc/sysctl.conf && ! grep -qs "hwdsl2" /opt/src/run.sh ) \
|
||||
|| ! printf '%s' "$ipsec_ver" | grep -q "Libreswan"; then
|
||||
|| ! printf '%s' "$ipsec_ver" | grep -qi 'libreswan'; then
|
||||
cat 1>&2 <<'EOF'
|
||||
Error: Your must first set up the IPsec VPN server before setting up IKEv2.
|
||||
See: https://github.com/hwdsl2/setup-ipsec-vpn
|
||||
|
@ -71,7 +71,7 @@ EOF
|
||||
check_libreswan() {
|
||||
ipsec_ver=$(ipsec --version 2>/dev/null)
|
||||
if ! grep -qs "hwdsl2 VPN script" /etc/sysctl.conf \
|
||||
|| ! printf '%s' "$ipsec_ver" | grep -q "Libreswan"; then
|
||||
|| ! printf '%s' "$ipsec_ver" | grep -qi 'libreswan'; then
|
||||
exiterr "Cannot remove IPsec VPN because it has not been set up on this server."
|
||||
fi
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ EOF
|
||||
|
||||
check_libreswan() {
|
||||
ipsec_ver=$(/usr/local/sbin/ipsec --version 2>/dev/null)
|
||||
if ! printf '%s' "$ipsec_ver" | grep -q "Libreswan"; then
|
||||
if ! printf '%s' "$ipsec_ver" | grep -qi 'libreswan'; then
|
||||
cat 1>&2 <<'EOF'
|
||||
Error: This script requires Libreswan already installed.
|
||||
See: https://github.com/hwdsl2/setup-ipsec-vpn
|
||||
|
@ -59,7 +59,7 @@ check_os() {
|
||||
check_libreswan() {
|
||||
ipsec_ver=$(/usr/local/sbin/ipsec --version 2>/dev/null)
|
||||
swan_ver_old=$(printf '%s' "$ipsec_ver" | sed -e 's/.*Libreswan U\?//' -e 's/\( (\|\/K\).*//')
|
||||
if ! printf '%s' "$ipsec_ver" | grep -q "Libreswan"; then
|
||||
if ! printf '%s' "$ipsec_ver" | grep -qi 'libreswan'; then
|
||||
cat 1>&2 <<'EOF'
|
||||
Error: This script requires Libreswan already installed.
|
||||
See: https://github.com/hwdsl2/setup-ipsec-vpn
|
||||
|
@ -42,7 +42,7 @@ check_os() {
|
||||
check_libreswan() {
|
||||
ipsec_ver=$(/usr/local/sbin/ipsec --version 2>/dev/null)
|
||||
swan_ver_old=$(printf '%s' "$ipsec_ver" | sed -e 's/.*Libreswan U\?//' -e 's/\( (\|\/K\).*//')
|
||||
if ! printf '%s' "$ipsec_ver" | grep -q "Libreswan"; then
|
||||
if ! printf '%s' "$ipsec_ver" | grep -qi 'libreswan'; then
|
||||
cat 1>&2 <<'EOF'
|
||||
Error: This script requires Libreswan already installed.
|
||||
See: https://github.com/hwdsl2/setup-ipsec-vpn
|
||||
|
@ -60,7 +60,7 @@ check_os() {
|
||||
check_libreswan() {
|
||||
ipsec_ver=$(/usr/local/sbin/ipsec --version 2>/dev/null)
|
||||
swan_ver_old=$(printf '%s' "$ipsec_ver" | sed -e 's/.*Libreswan U\?//' -e 's/\( (\|\/K\).*//')
|
||||
if ! printf '%s' "$ipsec_ver" | grep -q "Libreswan"; then
|
||||
if ! printf '%s' "$ipsec_ver" | grep -qi 'libreswan'; then
|
||||
cat 1>&2 <<'EOF'
|
||||
Error: This script requires Libreswan already installed.
|
||||
See: https://github.com/hwdsl2/setup-ipsec-vpn
|
||||
|
@ -65,7 +65,7 @@ check_os() {
|
||||
check_libreswan() {
|
||||
ipsec_ver=$(/usr/local/sbin/ipsec --version 2>/dev/null)
|
||||
swan_ver_old=$(printf '%s' "$ipsec_ver" | sed -e 's/.*Libreswan U\?//' -e 's/\( (\|\/K\).*//')
|
||||
if ! printf '%s' "$ipsec_ver" | grep -q "Libreswan"; then
|
||||
if ! printf '%s' "$ipsec_ver" | grep -qi 'libreswan'; then
|
||||
cat 1>&2 <<'EOF'
|
||||
Error: This script requires Libreswan already installed.
|
||||
See: https://github.com/hwdsl2/setup-ipsec-vpn
|
||||
|
@ -202,11 +202,14 @@ get_swan_ver() {
|
||||
}
|
||||
|
||||
check_libreswan() {
|
||||
ipsec_bin="/usr/local/sbin/ipsec"
|
||||
ipsec_ver=$(/usr/local/sbin/ipsec --version 2>/dev/null)
|
||||
swan_ver_old=$(printf '%s' "$ipsec_ver" | sed -e 's/.*Libreswan U\?//' -e 's/\( (\|\/K\).*//')
|
||||
if [ -n "$swan_ver_old" ] && [ "$(find /usr/local/sbin/ipsec -mmin -10080)" ]; then
|
||||
if [ -n "$swan_ver_old" ] && printf '%s' "$ipsec_ver" | grep -qi 'libreswan' \
|
||||
&& [ "$(find "$ipsec_bin" -mmin -10080)" ]; then
|
||||
return 0
|
||||
fi
|
||||
[ -s "$ipsec_bin" ] && touch "$ipsec_bin"
|
||||
get_swan_ver
|
||||
[ "$swan_ver_old" = "$SWAN_VER" ]
|
||||
}
|
||||
|
@ -202,11 +202,14 @@ get_swan_ver() {
|
||||
}
|
||||
|
||||
check_libreswan() {
|
||||
ipsec_bin="/usr/local/sbin/ipsec"
|
||||
ipsec_ver=$(/usr/local/sbin/ipsec --version 2>/dev/null)
|
||||
swan_ver_old=$(printf '%s' "$ipsec_ver" | sed -e 's/.*Libreswan U\?//' -e 's/\( (\|\/K\).*//')
|
||||
if [ -n "$swan_ver_old" ] && [ "$(find /usr/local/sbin/ipsec -mmin -10080)" ]; then
|
||||
if [ -n "$swan_ver_old" ] && printf '%s' "$ipsec_ver" | grep -qi 'libreswan' \
|
||||
&& [ "$(find "$ipsec_bin" -mmin -10080)" ]; then
|
||||
return 0
|
||||
fi
|
||||
[ -s "$ipsec_bin" ] && touch "$ipsec_bin"
|
||||
get_swan_ver
|
||||
[ "$swan_ver_old" = "$SWAN_VER" ]
|
||||
}
|
||||
|
@ -259,11 +259,14 @@ get_swan_ver() {
|
||||
}
|
||||
|
||||
check_libreswan() {
|
||||
ipsec_bin="/usr/local/sbin/ipsec"
|
||||
ipsec_ver=$(/usr/local/sbin/ipsec --version 2>/dev/null)
|
||||
swan_ver_old=$(printf '%s' "$ipsec_ver" | sed -e 's/.*Libreswan U\?//' -e 's/\( (\|\/K\).*//')
|
||||
if [ -n "$swan_ver_old" ] && [ "$(find /usr/local/sbin/ipsec -mmin -10080)" ]; then
|
||||
if [ -n "$swan_ver_old" ] && printf '%s' "$ipsec_ver" | grep -qi 'libreswan' \
|
||||
&& [ "$(find "$ipsec_bin" -mmin -10080)" ]; then
|
||||
return 0
|
||||
fi
|
||||
[ -s "$ipsec_bin" ] && touch "$ipsec_bin"
|
||||
get_swan_ver
|
||||
[ "$swan_ver_old" = "$SWAN_VER" ]
|
||||
}
|
||||
|
@ -242,11 +242,14 @@ get_swan_ver() {
|
||||
}
|
||||
|
||||
check_libreswan() {
|
||||
ipsec_bin="/usr/local/sbin/ipsec"
|
||||
ipsec_ver=$(/usr/local/sbin/ipsec --version 2>/dev/null)
|
||||
swan_ver_old=$(printf '%s' "$ipsec_ver" | sed -e 's/.*Libreswan U\?//' -e 's/\( (\|\/K\).*//')
|
||||
if [ -n "$swan_ver_old" ] && [ "$(find /usr/local/sbin/ipsec -mmin -10080)" ]; then
|
||||
if [ -n "$swan_ver_old" ] && printf '%s' "$ipsec_ver" | grep -qi 'libreswan' \
|
||||
&& [ "$(find "$ipsec_bin" -mmin -10080)" ]; then
|
||||
return 0
|
||||
fi
|
||||
[ -s "$ipsec_bin" ] && touch "$ipsec_bin"
|
||||
get_swan_ver
|
||||
[ "$swan_ver_old" = "$SWAN_VER" ]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user