refactoring changes from sequpgrade (endReturn, ...) and some modernizations
This commit is contained in:
@@ -1,33 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
toolName=wireguard
|
||||
toolBin=wg
|
||||
toolDefaultConf=wg0
|
||||
toolService=wg-quick@$toolDefaultConf
|
||||
|
||||
# Get script working directory
|
||||
# (when called from a different directory)
|
||||
WDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >>/dev/null 2>&1 && pwd )"
|
||||
CONFIG=0
|
||||
CONFIG_FILE_NAME="${toolName}.cfg"
|
||||
CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
|
||||
|
||||
#step_config() {
|
||||
#echo "Called once before executing steps."
|
||||
## e.g. to source a config file manually:
|
||||
#. "$CONFIG_FILE"
|
||||
## or to use sequencer api:
|
||||
#initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE"
|
||||
#if [ $? -eq 0 ] ; then
|
||||
# CONFIG=1
|
||||
#fi
|
||||
#}
|
||||
readonly toolName=wireguard
|
||||
readonly toolDefaultConf=wg0
|
||||
readonly toolService=wg-quick@$toolDefaultConf
|
||||
|
||||
step_1_info() { echo "Prepare installation of $toolName"; }
|
||||
step_1_alias() { echo "install"; }
|
||||
step_1_alias() { echo "setup"; }
|
||||
step_1() {
|
||||
exe apt install raspberrypi-kernel-headers
|
||||
endReturn -o $? "Installation of kernel headers failed"
|
||||
endReturn "Installation of kernel headers failed"
|
||||
addConf -s "deb http://deb.debian.org/debian/ unstable main" "/etc/apt/sources.list.d/unstable.list"
|
||||
exep "wget -O - https://ftp-master.debian.org/keys/archive-key-$(lsb_release -sr).asc | sudo apt-key add -"
|
||||
addConf -s "$pinEntry" "/etc/apt/preferences.d/limit-unstable"
|
||||
@@ -38,6 +19,7 @@ Pin: release a=unstable
|
||||
Pin-Priority: 150"
|
||||
|
||||
step_2_info() { echo "Installing $toolName"; }
|
||||
step_2_alias() { echo "install"; }
|
||||
step_2() {
|
||||
local aptOpt=""
|
||||
if quiet ; then
|
||||
@@ -46,7 +28,7 @@ step_2() {
|
||||
exe apt install $toolName $aptOpt
|
||||
}
|
||||
|
||||
step_3_info() {
|
||||
step_3_info() {
|
||||
echo "Enable ipv4 forwarding to allow local access via VPN"
|
||||
echoinfo "(may be skipped)"
|
||||
}
|
||||
@@ -82,12 +64,7 @@ step_14() {
|
||||
}
|
||||
defaultConfLoc="/etc/$toolName/$toolDefaultConf.conf"
|
||||
|
||||
|
||||
step_20_info() { echo "Usage notes"; }
|
||||
step_20() {
|
||||
echo " [I] Some usage Notes"
|
||||
}
|
||||
|
||||
|
||||
# shellcheck disable=SC2034 # Appears unused
|
||||
readonly sqr_minVersion=16
|
||||
# shellcheck disable=SC1091 # Don't follow this source
|
||||
. /usr/local/bin/sequencer.sh
|
||||
|
Reference in New Issue
Block a user