#!/bin/bash toolName=openvpn toolDeps=openvpn toolDefaultConf="/etc/default/openvpn" toolUserScriptsLoc="/usr/lib/openvpn" # Get script working directory # (when called from a different directory) WDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >>/dev/null 2>&1 && pwd)" APTOPT= CONFIG=0 SCRIPT_FILE=$(basename -- $0) SCRIPT_NAME=${SCRIPT_FILE%%.*} CONFIG_FILE_NAME="${SCRIPT_NAME}.cfg" CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example" CONFIG_DIR="$WDIR/$SCRIPT_NAME" step_config() { #echo "Called once before executing steps." ## e.g. to source a config file manually: #. "$CONFIG_FILE" ## or to use sequencer api with global config file: #initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE" ## or to use sequencer api with profile config file support: #initSeqConfig -p "$SCRIPT_NAME" "$CONFIG_FILE_TEMPLATE" #if [ $? -eq 0 ] ; then # CONFIG=1 #else # # End if no configuration file exists # [ $DRY -eq 0 ] && return -1 #fi [ $QUIET -ne 0 ] && APTOPT="-y" return 0 } step_1_info() { echo "Install $toolName"; } step_1_alias() { ALIAS="install"; } step_1() { exe apt update exe apt install $toolDeps $APTOPT } step_2_info() { echo "Install customized helper scripts to $toolUserScriptsLoc"; } step_2() { exep "mkdir \"$toolUserScriptsLoc\" 2>>/dev/null" [ $? -ne 0 ] && \ echoseq " [W] $toolUserScriptsLoc already exists. Not overwriting existing files." exe cp -n "$CONFIG_DIR"/* "$toolUserScriptsLoc" } step_10_info() { echo "Open openvpn system start configuration"; } step_10_alias() { ALIAS="default"; } step_10() { exe vi "$toolDefaultConf" } VERSION_SEQREV=12 . /usr/local/bin/sequencer.sh