Used sequpgrade.sh to upgrade existing seqs

This commit is contained in:
2022-05-29 20:58:23 +02:00
parent 10ee4198f0
commit 6214493c18
57 changed files with 802 additions and 806 deletions

View File

@@ -6,7 +6,7 @@ toolUser=aria2
# Get script working directory # Get script working directory
# (when called from a different directory) # (when called from a different directory)
WDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >>/dev/null 2>&1 && pwd)" WDIR="$(cd "$(dirname -- "${BASH_SOURCE[0]}")" >>/dev/null 2>&1 && pwd)"
CONFIG=0 CONFIG=0
SCRIPT_NAME=$(basename -- $0) SCRIPT_NAME=$(basename -- $0)
SCRIPT_NAME=${SCRIPT_NAME%%.*} SCRIPT_NAME=${SCRIPT_NAME%%.*}
@@ -15,7 +15,7 @@ CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
aptOpt= aptOpt=
step_config() { seq_config() {
#echo "Called once before executing steps." #echo "Called once before executing steps."
## e.g. to source a config file manually: ## e.g. to source a config file manually:
#. "$CONFIG_FILE" #. "$CONFIG_FILE"
@@ -27,14 +27,14 @@ step_config() {
CONFIG=1 CONFIG=1
else else
# End if no configuration file exists # End if no configuration file exists
[ $DRY -eq 0 ] && return 1 dry || return 1
fi fi
[ $QUIET -ne 0 ] && aptOpt="-y" quiet && aptOpt="-y"
return 0 return 0
} }
step_1_info() { echo "Install $toolName"; } step_1_info() { echo "Install $toolName"; }
step_1_alias() { ALIAS="install"; } step_1_alias() { echo "install"; }
step_1() { step_1() {
exe apt update exe apt update
exe apt install $toolDeps $aptOpt exe apt install $toolDeps $aptOpt
@@ -54,11 +54,11 @@ ariaConfLoc="/etc/aria2/aria2.conf"
step_3_info() { echo "Create $toolName service"; } step_3_info() { echo "Create $toolName service"; }
step_3_alias() { ALIAS="service"; } step_3_alias() { echo "service"; }
step_3() { step_3() {
addConf -s "$ariaService" "$ariaServiceLoc" addConf -s "$ariaService" "$ariaServiceLoc"
exe systemctl daemon-reload exe systemctl daemon-reload
echoseq " [I] Serive not started or enabled" info "Service not started or enabled"
} }
ariaServiceLoc="/etc/systemd/system/aria2.service" ariaServiceLoc="/etc/systemd/system/aria2.service"
ariaService="[Unit] ariaService="[Unit]
@@ -76,10 +76,11 @@ Restart=on-failure
WantedBy=multi-user.target" WantedBy=multi-user.target"
step_10_info() { echo "Add ufw rule for rpc port 6800"; } step_10_info() { echo "Add ufw rule for rpc port 6800"; }
step_10_alias() { ALIAS="ufw"; } step_10_alias() { echo "ufw"; }
step_10() { step_10() {
exe ufw allow in on eth0 to any port 6800 proto tcp comment "Aria2 rpc" exe ufw allow in on eth0 to any port 6800 proto tcp comment "Aria2 rpc"
} }
VERSION_SEQREV=12 readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh

View File

@@ -11,17 +11,17 @@ CONFIG=0
CONFIG_FILE_NAME="${toolName}.cfg" CONFIG_FILE_NAME="${toolName}.cfg"
CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example" CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
step_config() { seq_config() {
initSeqConfig -t "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE" initSeqConfig -t "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE"
if [ $? -eq 0 ] ; then if [ $? -eq 0 ] ; then
CONFIG=1 CONFIG=1
else else
echoerr " [E] Check output for errors" error -e "Check output for errors"
# End if no configuration file exists # End if no configuration file exists
[ $DRY -eq 0 ] && return -1 dry || return -1
fi fi
[ $QUIET -ne 0 ] && APTOPT="-y" quiet && APTOPT="-y"
return 0 return 0
} }
@@ -31,12 +31,12 @@ step_1_info() {
echoinfo "Essential excludes are provided in the configuration template." echoinfo "Essential excludes are provided in the configuration template."
echoinfo "($CONFIG_FILE_TEMPLATE)" echoinfo "($CONFIG_FILE_TEMPLATE)"
} }
step_1_alias() { ALIAS="buroot"; } step_1_alias() { echo "buroot"; }
step_1() { step_1() {
local buTarget="/backup" local buTarget="/backup"
if [ $CONFIG -eq 0 ] ; then if [ $CONFIG -eq 0 ] ; then
echoerr " [E] Cannot backup root without properly configured excludes" error -e "Cannot backup root without properly configured excludes"
echoerr " (expected config: $SEQ_CONFIG_HOME/$CONFIG_FILE_NAME)" error -e " (expected config: $SEQ_CONFIG_HOME/$CONFIG_FILE_NAME)"
else else
buTarget="$BACKUP_TARGET" buTarget="$BACKUP_TARGET"
fi fi
@@ -81,7 +81,7 @@ step_3_info() {
echoinfo "e.g. to exclude $dir/a:" echoinfo "e.g. to exclude $dir/a:"
echoinfo " $0 budir $dir $tar /a" echoinfo " $0 budir $dir $tar /a"
} }
step_3_alias() { ALIAS="budir"; } step_3_alias() { echo "budir"; }
step_3() { step_3() {
local arg local arg
local configTarget=0 local configTarget=0
@@ -105,7 +105,7 @@ step_3() {
done done
if [ -z "$1" ] ; then if [ -z "$1" ] ; then
echoerr " [E] Nothing found to backup $1" error -e "Nothing found to backup $1"
exit 1 exit 1
fi fi
@@ -125,7 +125,7 @@ step_3() {
buTarget=$(echo "$BACKUP_TARGET" | sed 's:/*$::') buTarget=$(echo "$BACKUP_TARGET" | sed 's:/*$::')
else else
if [ -z "$1" ] ; then if [ -z "$1" ] ; then
echoerr " [E] No valid target found" error -e "No valid target found"
exit 1 exit 1
fi fi
buTarget=$(echo "$1" | sed 's:/*$::') buTarget=$(echo "$1" | sed 's:/*$::')
@@ -133,7 +133,7 @@ step_3() {
fi fi
if [ ! -d "${buTarget}" ] && [ ! -L "${buTarget}" ] if [ ! -d "${buTarget}" ] && [ ! -L "${buTarget}" ]
then then
echoerr " [E] Backup target (${buTarget}) doesn't exist" error -e "Backup target (${buTarget}) doesn't exist"
exit 1 exit 1
fi fi
@@ -141,9 +141,9 @@ step_3() {
buExcludes+=("--exclude='$exclu'") buExcludes+=("--exclude='$exclu'")
done done
echoseq " [I] Source : $buSource" info "Source : $buSource"
echoseq " [I] Target : $buTarget" info "Target : $buTarget"
echoseq " [I] Excludes: $@" info "Excludes: $@"
#fix doubling trailing slash on verbose output when backing up root #fix doubling trailing slash on verbose output when backing up root
local tmpSource="$buSource/" local tmpSource="$buSource/"
@@ -160,7 +160,7 @@ step_3() {
fi fi
if [ ! -w "${buTarget}" ] ; then if [ ! -w "${buTarget}" ] ; then
echoerr " [E] Backup target (${buTarget}) is not writable" error -e "Backup target (${buTarget}) is not writable"
exit 1 exit 1
fi fi
@@ -174,7 +174,7 @@ step_3() {
} }
step_100_info() { echo "Install $toolBin"; } step_100_info() { echo "Install $toolBin"; }
step_100_alias() { ALIAS="install"; } step_100_alias() { echo "install"; }
step_100() { step_100() {
exe apt update exe apt update
exe apt install $toolBin $APTOPT exe apt install $toolBin $APTOPT
@@ -188,6 +188,6 @@ checkInstalled() {
toolBin="$(command -v $toolBin)" toolBin="$(command -v $toolBin)"
} }
VERSION_SEQREV=14 readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh

View File

@@ -15,7 +15,7 @@ WSUBDIR="${WDIR}/basics"
#} #}
step_10_info() { echo "ssmtp installation"; } step_10_info() { echo "ssmtp installation"; }
step_10_alias() { ALIAS="ssmtp"; } step_10_alias() { echo "ssmtp"; }
step_10() { step_10() {
exe apt update && apt install "$SSMTP_DEPS" exe apt update && apt install "$SSMTP_DEPS"
endReturn -o $? "ssmtp installation failed" endReturn -o $? "ssmtp installation failed"
@@ -23,19 +23,19 @@ step_10() {
SSMTP_DEPS="ssmtp" SSMTP_DEPS="ssmtp"
step_11_info() { echo "ssmtp setup"; } step_11_info() { echo "ssmtp setup"; }
step_11_alias() { ALIAS="ssmtpSetup"; } step_11_alias() { echo "ssmtpSetup"; }
step_11() { step_11() {
if [ ! -f "$CONFIG_FILE_SSMTP" ] ; then if [ ! -f "$CONFIG_FILE_SSMTP" ] ; then
echoerr " [E] User config ($CONFIG_FILE_SSMTP) not found" error -e "User config ($CONFIG_FILE_SSMTP) not found"
echoerr " See $CONFIG_FILE_SSMTP_TEMPLATE" error -e " See $CONFIG_FILE_SSMTP_TEMPLATE"
return 1 return 1
fi fi
addConf -c -f "$CONFIG_FILE_SSMTP" "$CONFIG_LOC_SSMTP" addConf -c -f "$CONFIG_FILE_SSMTP" "$CONFIG_LOC_SSMTP"
endReturn -o $? "Could not write ssmtp configuration" endReturn -o $? "Could not write ssmtp configuration"
if [ ! -f "$CONFIG_FILE_SSMTP_AL" ] ; then if [ ! -f "$CONFIG_FILE_SSMTP_AL" ] ; then
echoerr " [W] User aliases ($CONFIG_FILE_SSMTP_AL) not found" warning -e "User aliases ($CONFIG_FILE_SSMTP_AL) not found"
echoerr " See $CONFIG_FILE_SSMTP_TEMPLATE or modify $CONFIG_LOC_SSMTP_AL directly" error -e " See $CONFIG_FILE_SSMTP_TEMPLATE or modify $CONFIG_LOC_SSMTP_AL directly"
return 1 return 1
fi fi
addConf -c -f "$CONFIG_FILE_SSMTP_AL" "$CONFIG_LOC_SSMTP_AL" addConf -c -f "$CONFIG_FILE_SSMTP_AL" "$CONFIG_LOC_SSMTP_AL"
@@ -52,17 +52,17 @@ step_13_info() {
echo -n "Send test E-Mail to " echo -n "Send test E-Mail to "
if [ -z $2 ] ; then echo "<MAILADDRESS>"; else echo "$2"; fi if [ -z $2 ] ; then echo "<MAILADDRESS>"; else echo "$2"; fi
} }
step_13_alias() { ALIAS="ssmtpTest"; } step_13_alias() { echo "ssmtpTest"; }
step_13() { step_13() {
if [ ! -z "$2" ] || [ "$2" == "" ] ; then if [ ! -z "$2" ] || [ "$2" == "" ] ; then
echoerr " [E] No mailaddress provided" error -e "No mailaddress provided"
fi fi
exep "echo \"Subject: sendmail test\" | sendmail -v $2" exep "echo \"Subject: sendmail test\" | sendmail -v $2"
} }
step_15_info() { echo "ssmtp help"; } step_15_info() { echo "ssmtp help"; }
step_15_alias() { ALIAS="ssmtpHelp"; } step_15_alias() { echo "ssmtpHelp"; }
step_15() { step_15() {
echo " Configuration files expected by this seq:" echo " Configuration files expected by this seq:"
echo echo
@@ -77,5 +77,5 @@ step_15() {
echo " - $CONFIG_LOC_SSMTP_AL" echo " - $CONFIG_LOC_SSMTP_AL"
} }
VERSION_SEQREV=9 readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh

View File

@@ -15,25 +15,25 @@ SCRIPT_NAME=${SCRIPT_FILE%%.*}
CONFIG_FILE_NAME="${SCRIPT_NAME}.cfg" CONFIG_FILE_NAME="${SCRIPT_NAME}.cfg"
CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example" CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
step_config() { seq_config() {
## or to use sequencer api with global config file: ## or to use sequencer api with global config file:
initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE" initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE"
if [ $? -eq 0 ] ; then if [ $? -eq 0 ] ; then
CONFIG=1 CONFIG=1
else else
# End if no configuration file exists # End if no configuration file exists
[ $DRY -eq 0 ] && return -1 dry || return -1
fi fi
## Apt cmdline option to suppress user interaction ## Apt cmdline option to suppress user interaction
[ $QUIET -ne 0 ] && APTOPT="-y" quiet && APTOPT="-y"
## Return of non zero value will abort the sequence ## Return of non zero value will abort the sequence
return 0 return 0
} }
step_1_info() { echo "Install dependencies"; } step_1_info() { echo "Install dependencies"; }
step_1_alias() { ALIAS="install"; } step_1_alias() { echo "install"; }
step_1() { step_1() {
exe apt install $toolDeps $APTOPT exe apt install $toolDeps $APTOPT
} }
@@ -44,14 +44,14 @@ step_2() {
exe adduser --disabled-password --disabled-login --home-dir "$CALWEB_USER_HOME" --gecos "" $CALWEB_USER exe adduser --disabled-password --disabled-login --home-dir "$CALWEB_USER_HOME" --gecos "" $CALWEB_USER
exe usermod -aG users $CALWEB_USER exe usermod -aG users $CALWEB_USER
else else
echoseq " [W] User $CALWEB_USER already exists" warning "User $CALWEB_USER already exists"
fi fi
if [ ! -e "$CALWEB_VENV_ROOT/bin" ]; then if [ ! -e "$CALWEB_VENV_ROOT/bin" ]; then
exe python3 -m venv "$CALWEB_VENV_ROOT" exe python3 -m venv "$CALWEB_VENV_ROOT"
endReturn -o $? "Creating virtual environment failed" endReturn -o $? "Creating virtual environment failed"
exe chown -R ${CALWEB_USER}: "$CALWEB_BASE" exe chown -R ${CALWEB_USER}: "$CALWEB_BASE"
else else
echoseq " [W] Virtual env. $CALWEB_VENV_ROOT already exists" warning "Virtual env. $CALWEB_VENV_ROOT already exists"
fi fi
} }
@@ -70,6 +70,8 @@ step_4() {
toolFeatures[$i]="$toolPipName[${toolFeatures[$i]}]" toolFeatures[$i]="$toolPipName[${toolFeatures[$i]}]"
done done
exe ${CALWEB_VENV_ROOT}/bin/pip install "${toolFeatures[@]}" exe ${CALWEB_VENV_ROOT}/bin/pip install "${toolFeatures[@]}"
# Needed for in-app update
exe chown -R "${CALWEB_USER}": "${CALWEB_VENV_ROOT}/lib/python*/site-packages/calibreweb"
} }
step_5_info() { echo "Install systemd service"; } step_5_info() { echo "Install systemd service"; }
@@ -86,16 +88,16 @@ step_6() {
} }
step_15_info() { echo "Upgrade python pip"; } step_15_info() { echo "Upgrade python pip"; }
step_15_alias() { ALIAS="upgradepip"; } step_15_alias() { echo "upgradepip"; }
step_15() step_15()
{ {
exe ${CALWEB_VENV_ROOT}/bin/pip install --upgrade pip exe ${CALWEB_VENV_ROOT}/bin/pip install --upgrade pip
} }
step_100_info() { echo "Setup notes"; } step_100_info() { echo "Setup notes"; }
step_100_alias() { ALIAS="notes"; } step_100_alias() { echo "notes"; }
step_100() { step_100() {
outColor green color green
cat <<NOTES_END cat <<NOTES_END
# Default admin login: # Default admin login:
@@ -127,5 +129,5 @@ proxy_set_header X-Script-Name /calibre; # IMPORTANT: path has NO trai
NOTES_END NOTES_END
} }
VERSION_SEQREV=15 readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh

View File

@@ -12,7 +12,7 @@ CONFIG=0
CONFIG_FILE_NAME="${toolName}.cfg" CONFIG_FILE_NAME="${toolName}.cfg"
CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example" CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
step_config() { seq_config() {
initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE" initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE"
local confReturn=$? local confReturn=$?
if [ $confReturn -eq 0 ] ; then if [ $confReturn -eq 0 ] ; then
@@ -21,13 +21,13 @@ step_config() {
} }
step_1_info() { echo "Install $toolName for letsencrypt"; } step_1_info() { echo "Install $toolName for letsencrypt"; }
step_1_alias() { ALIAS="install"; } step_1_alias() { echo "install"; }
step_1() { step_1() {
local osName= local osName=
local distName= local distName=
if [ "$(which lsb_release)" == "" ] ; then if [ "$(which lsb_release)" == "" ] ; then
echoerr " [W] Cannot detect OS. Assuming Ubuntu" warning -e "Cannot detect OS. Assuming Ubuntu"
osName="Ubuntu" osName="Ubuntu"
else else
osName=$(lsb_release -is) osName=$(lsb_release -is)
@@ -35,14 +35,14 @@ step_1() {
fi fi
if [ "$osName" == "" ] ; then if [ "$osName" == "" ] ; then
echoerr " [W] Error dedecting OS. Assuming Ubuntu" warning -e "Error dedecting OS. Assuming Ubuntu"
osName="Ubuntu" osName="Ubuntu"
fi fi
echo " [I] Detected OS: $osName $distName" echo " [I] Detected OS: $osName $distName"
local aptOption= local aptOption=
if [ $QUIET -ne 0 ] ; then if quiet ; then
aptOption="-y" aptOption="-y"
else else
aptOption="" aptOption=""
@@ -69,7 +69,7 @@ step_1() {
} }
step_2_info() { echo "Create or update letsencrypt certificate"; } step_2_info() { echo "Create or update letsencrypt certificate"; }
step_2_alias() { ALIAS="update"; } step_2_alias() { echo "update"; }
step_2() { step_2() {
endCheckEmpty CERTBOT_DOMAINS "No domain list found. Check configuration" endCheckEmpty CERTBOT_DOMAINS "No domain list found. Check configuration"
endCheckEmpty CERTBOT_WEBROOT "Invalid web root. Check configuration" endCheckEmpty CERTBOT_WEBROOT "Invalid web root. Check configuration"
@@ -79,5 +79,5 @@ step_2() {
-m "$CERTBOT_MAIL" ${CERTBOT_DOMAINS[@]/#/-d } -m "$CERTBOT_MAIL" ${CERTBOT_DOMAINS[@]/#/-d }
} }
VERSION_SEQREV=11 readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh

View File

@@ -16,7 +16,7 @@ SCRIPT_NAME=${SCRIPT_FILE%%.*}
CONFIG_FILE_NAME="${SCRIPT_NAME}.cfg" CONFIG_FILE_NAME="${SCRIPT_NAME}.cfg"
CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example" CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
step_config() { seq_config() {
#echo "Called once before executing steps." #echo "Called once before executing steps."
## e.g. to source a config file manually: ## e.g. to source a config file manually:
#. "$CONFIG_FILE" #. "$CONFIG_FILE"
@@ -28,14 +28,14 @@ step_config() {
# CONFIG=1 # CONFIG=1
#else #else
# # End if no configuration file exists # # End if no configuration file exists
# [ $DRY -eq 0 ] && return -1 # dry || return -1
#fi #fi
[ $QUIET -ne 0 ] && APTOPT="-y" quiet && APTOPT="-y"
return 0 return 0
} }
step_1_info() { echo "Install $toolName"; } step_1_info() { echo "Install $toolName"; }
step_1_alias() { ALIAS="install"; } step_1_alias() { echo "install"; }
step_1() { step_1() {
exe apt update exe apt update
exe apt install $toolDeps $APTOPT exe apt install $toolDeps $APTOPT
@@ -47,7 +47,7 @@ step_10_info() {
echoinfo " -l : Always output update required and error information" echoinfo " -l : Always output update required and error information"
echoinfo " (even with -qq)" echoinfo " (even with -qq)"
} }
step_10_alias() { ALIAS="updateip"; } step_10_alias() { echo "updateip"; }
step_10() { step_10() {
exitIfRunning exitIfRunning
shift shift
@@ -56,7 +56,7 @@ step_10() {
local ipRegex='^[0-2]*[0-9]{1,2}\.[0-2]*[0-9]{1,2}\.[0-2]*[0-9]{1,2}\.[0-2]*[0-9]{1,2}\/*[0-9]*$' local ipRegex='^[0-2]*[0-9]{1,2}\.[0-2]*[0-9]{1,2}\.[0-2]*[0-9]{1,2}\.[0-2]*[0-9]{1,2}\/*[0-9]*$'
local dnsUrl="46.182.19.48" #digitalcourage.de/support/zensurfreier-dns-server local dnsUrl="46.182.19.48" #digitalcourage.de/support/zensurfreier-dns-server
local dnsFallbackUrl="194.150.168.168" #dns.as250.net; Berlin/Frankfurt local dnsFallbackUrl="194.150.168.168" #dns.as250.net; Berlin/Frankfurt
local lecho="echoseq" local lecho="info"
if [ "$1" == "-l" ]; then if [ "$1" == "-l" ]; then
lecho="echo" lecho="echo"
shift shift
@@ -88,23 +88,23 @@ step_10() {
$lecho "[$(date)] [I] Restarting $toolName" $lecho "[$(date)] [I] Restarting $toolName"
exe /bin/systemctl restart $toolServiceName exe /bin/systemctl restart $toolServiceName
else else
echoseq "[$(date)] [I] No update required (via $ipUpdater). Current ip: $confIp" info "[$(date)] [I] No update required (via $ipUpdater). Current ip: $confIp"
fi fi
} }
step_12_info() { echo "Setup public ip update cron job every 5 minutes"; } step_12_info() { echo "Setup public ip update cron job every 5 minutes"; }
step_12_alias() { ALIAS="cronip"; } step_12_alias() { echo "cronip"; }
step_12() { step_12() {
echoseq " [I] Setup $ipCronLoc" info "Setup $ipCronLoc"
addConf -s "$ipCron" "$ipCronLoc" addConf -s "$ipCron" "$ipCronLoc"
} }
ipCronLoc="/etc/cron.d/update_public_ip" ipCronLoc="/etc/cron.d/update_public_ip"
ipCron="*/5 * * * * root $WDIR/$SCRIPT_FILE -qq updateip" ipCron="*/5 * * * * root $WDIR/$SCRIPT_FILE -qq updateip"
step_100_info() { echo "Installation notes"; } step_100_info() { echo "Installation notes"; }
step_100_alias() { ALIAS="notes"; } step_100_alias() { echo "notes"; }
step_100() { step_100() {
outColor green color green
cat <<COTURN_EOF cat <<COTURN_EOF
# Port forwarding # Port forwarding
@@ -130,5 +130,5 @@ chmod g+r /etc/letsencrypt/archive/\$LOC_DOMAIN/privkey*
COTURN_EOF COTURN_EOF
} }
VERSION_SEQREV=13 readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh

View File

@@ -14,14 +14,14 @@ SCRIPT_NAME=${SCRIPT_NAME%%.*}
CONFIG_FILE_NAME="${SCRIPT_NAME}.cfg" CONFIG_FILE_NAME="${SCRIPT_NAME}.cfg"
CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example" CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
step_config() { seq_config() {
initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE" initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE"
if [ $? -eq 0 ] ; then if [ $? -eq 0 ] ; then
CONFIG=1 CONFIG=1
else else
[ $DRY -eq 0 ] && return -1 dry || return -1
fi fi
[ $QUIET -ne 0 ] && APTOPT="-y" quiet && APTOPT="-y"
return 0 return 0
} }
@@ -29,7 +29,7 @@ step_1_info() {
echo "Install $toolName" echo "Install $toolName"
echoinfo "Default port: 5050" echoinfo "Default port: 5050"
} }
step_1_alias() { ALIAS="install"; } step_1_alias() { echo "install"; }
step_1() { step_1() {
exe apt update exe apt update
exe apt install $toolDeps $APTOPT exe apt install $toolDeps $APTOPT
@@ -56,10 +56,10 @@ step_4() {
} }
step_5_info() { echo "Add ufw rule for web interface"; } step_5_info() { echo "Add ufw rule for web interface"; }
step_5_alias() { ALIAS="ufw"; } step_5_alias() { echo "ufw"; }
step_5() { step_5() {
exe ufw allow in on eth0 to any port 5050 proto tcp comment "couchpotato" exe ufw allow in on eth0 to any port 5050 proto tcp comment "couchpotato"
} }
VERSION_SEQREV=12 readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh

View File

@@ -24,8 +24,8 @@ SCRIPT_NAME=${SCRIPT_NAME%%.*}
CONFIG_FILE_NAME="${SCRIPT_NAME}.cfg" CONFIG_FILE_NAME="${SCRIPT_NAME}.cfg"
CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example" CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
step_config() { seq_config() {
[ $QUIET -ne 0 ] && APTOPT="-y" quiet && APTOPT="-y"
return 0 return 0
} }
@@ -33,16 +33,16 @@ step_1_info() {
echo "Download latest xz-compressed image [IMAGE FILE URL] [SD CARD DEVICE]" echo "Download latest xz-compressed image [IMAGE FILE URL] [SD CARD DEVICE]"
echoinfo "$toolDownSite" echoinfo "$toolDownSite"
} }
step_1_alias() { ALIAS="install"; } step_1_alias() { echo "install"; }
step_1() { step_1() {
shift shift
SDDEV="$2" SDDEV="$2"
if [ -z "$1" ] && [ $QUIET -eq 0 ] ; then if [ -z "$1" ] && interactive ; then
read -p "Provide image download url from $toolDownSite: " toolDownUrl read -p "Provide image download url from $toolDownSite: " toolDownUrl
elif [ ! -z "$1" ] ; then elif [ ! -z "$1" ] ; then
toolDownUrl="$1" toolDownUrl="$1"
else else
echoerr " [E] No image file provided for download" error -e "No image file provided for download"
exit 1 exit 1
fi fi
@@ -65,7 +65,7 @@ step_1() {
endReturn -o $? "Error downloading $downDownFile" endReturn -o $? "Error downloading $downDownFile"
fi fi
echoseq " [I] Checking SHA256 checksum" info "Checking SHA256 checksum"
exe cd $(dirname "$toolDownFile") exe cd $(dirname "$toolDownFile")
exe sha256sum -c "$downShaFile" >>/dev/null exe sha256sum -c "$downShaFile" >>/dev/null
endReturn -o $? "SHA256 checksum error" endReturn -o $? "SHA256 checksum error"
@@ -81,14 +81,14 @@ step_2() {
# check if device was confirmed # check if device was confirmed
endReturn -o $? "SD card device not found" endReturn -o $? "SD card device not found"
echoseq " [I] Writing $(basename "$toolDownFile")" info "Writing $(basename "$toolDownFile")"
exep "xzcat \"$toolDownFile\" | dd of=$SDDEV bs=64k oflag=dsync status=progress" exep "xzcat \"$toolDownFile\" | dd of=$SDDEV bs=64k oflag=dsync status=progress"
exe sync exe sync
} }
step_3_info() { echo "Prepare SD card for first run"; } step_3_info() { echo "Prepare SD card for first run"; }
step_3() { step_3() {
outColor green color green
cat <<PREPARE_EOF cat <<PREPARE_EOF
[I] Setup static IP [I] Setup static IP
[etc/network/interfaces.d/eth0] [etc/network/interfaces.d/eth0]
@@ -122,10 +122,10 @@ PREPARE_EOF
} }
step_10_info() { echo "Essential debian setup"; } step_10_info() { echo "Essential debian setup"; }
step_10_alias() { ALIAS="setup"; } step_10_alias() { echo "setup"; }
step_10() { step_10() {
if [ -z "$(ls /etc/default | grep raspi)" ] ; then if [ -z "$(ls /etc/default | grep raspi)" ] ; then
echoerr " [E] Not on a Raspberry pi" error -e "Not on a Raspberry pi"
return 1 return 1
fi fi
@@ -144,7 +144,7 @@ step_12() {
local localUs="en_US.UTF-8" local localUs="en_US.UTF-8"
local localUsDefault="$localUs UTF-8" local localUsDefault="$localUs UTF-8"
if [ ! -f "$localesConfigLoc" ] ; then if [ ! -f "$localesConfigLoc" ] ; then
echoerr " [E] Install packages locales first" error -e "Install packages locales first"
exit 1 exit 1
fi fi
@@ -152,18 +152,18 @@ step_12() {
endReturn -o $? "Changing locales failed" endReturn -o $? "Changing locales failed"
exe locale-gen exe locale-gen
exe update-locale LANG=$localUs exe update-locale LANG=$localUs
echoseq " [I] Logout and login for changes to be active" info "Logout and login for changes to be active"
} }
localesConfigLoc="/etc/locale.gen" localesConfigLoc="/etc/locale.gen"
step_14_info() { echo "Change hostname [HOSTNAME]"; } step_14_info() { echo "Change hostname [HOSTNAME]"; }
step_14_alias() { ALIAS="hostname"; } step_14_alias() { echo "hostname"; }
step_14() { step_14() {
shift shift
local localHostname=$1 local localHostname=$1
endCheckEmpty localHostname "No hostname provided" endCheckEmpty localHostname "No hostname provided"
if [ $(grep -r "$localHostname" "$hostsLoc">>/dev/null; echo $?) -eq 0 ] ; then if [ $(grep -r "$localHostname" "$hostsLoc">>/dev/null; echo $?) -eq 0 ] ; then
echoseq " [I] Hostname $localHostname already defined" info "Hostname $localHostname already defined"
return 0 return 0
fi fi
exe hostnamectl set-hostname "$localHostname" exe hostnamectl set-hostname "$localHostname"
@@ -173,14 +173,14 @@ step_14() {
hostsLoc="/etc/hosts" hostsLoc="/etc/hosts"
step_16_info() { echo "Install cifs mounting requirements"; } step_16_info() { echo "Install cifs mounting requirements"; }
step_16_alias() { ALIAS="cifs"; } step_16_alias() { echo "cifs"; }
step_16() { step_16() {
exe apt install cifs-utils $APTOPT exe apt install cifs-utils $APTOPT
} }
step_17_info() { echo "Cifs notes"; } step_17_info() { echo "Cifs notes"; }
step_17() { step_17() {
outColor green color green
cat <<CIFS_EOF cat <<CIFS_EOF
# Example fstab entry # Example fstab entry
[/etc/fstab] [/etc/fstab]
@@ -203,9 +203,9 @@ CIFS_EOF
} }
step_19_info() { echo "Setup notes"; } step_19_info() { echo "Setup notes"; }
step_19_alias() { ALIAS="setupnotes"; } step_19_alias() { echo "setupnotes"; }
step_19() { step_19() {
outColor green color green
cat <<SETUPNOTES_EOF cat <<SETUPNOTES_EOF
# Secure root with a password # Secure root with a password
passwd passwd
@@ -217,9 +217,9 @@ SETUPNOTES_EOF
} }
step_40_info() { echo "Boot from HD notes"; } step_40_info() { echo "Boot from HD notes"; }
step_40_alias() { ALIAS="hdboot"; } step_40_alias() { echo "hdboot"; }
step_40() { step_40() {
outColor green color green
cat <<HDBOOT_EOF cat <<HDBOOT_EOF
[I] Raspberry pi 4 boots from USB automatically if there is no SD available [I] Raspberry pi 4 boots from USB automatically if there is no SD available
(needs boot loader version September 3rd) (needs boot loader version September 3rd)
@@ -268,7 +268,7 @@ read_sd_dev() {
fi fi
if [ ! -b "$SDDEV" ] ; then if [ ! -b "$SDDEV" ] ; then
echoerr " [I] $SDDEV not a block device" info -e "$SDDEV not a block device"
SDDEV= SDDEV=
return 1 return 1
fi fi
@@ -296,5 +296,5 @@ read_sd_dev() {
} }
SDBOOTPARTNO=1 SDBOOTPARTNO=1
SDROOTPARTNO=2 SDROOTPARTNO=2
VERSION_SEQREV=12 readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh

View File

@@ -10,7 +10,7 @@ SCRIPT_NAME=${SCRIPT_NAME%%.*}
CONFIG_FILE_NAME="${SCRIPT_NAME}.cfg" CONFIG_FILE_NAME="${SCRIPT_NAME}.cfg"
CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example" CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
step_config() { seq_config() {
checkVpn checkVpn
initSeqConfig -t "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE" initSeqConfig -t "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE"
@@ -18,14 +18,14 @@ step_config() {
CONFIG=1 CONFIG=1
else else
# End if no configuration file exists # End if no configuration file exists
[ $DRY -eq 0 ] && return -1 dry || return -1
fi fi
[ $QUIET -ne 0 ] && APTOPT="-y" quiet && APTOPT="-y"
return 0 return 0
} }
step_1_info() { echo "Install mono"; } step_1_info() { echo "Install mono"; }
step_1_alias() { ALIAS="install"; } step_1_alias() { echo "install"; }
step_1() { step_1() {
exe apt install apt-transport-https dirmngr gnupg ca-certificates exe apt install apt-transport-https dirmngr gnupg ca-certificates
exe apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF exe apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
@@ -319,17 +319,17 @@ WantedBy=multi-user.target
Alias=bazarr.service" Alias=bazarr.service"
step_15_info() { echo "Create ufw rules for default ports"; } step_15_info() { echo "Create ufw rules for default ports"; }
step_15_alias() { ALIAS="ufw"; } step_15_alias() { echo "ufw"; }
step_15() { step_15() {
exe ufw allow in on eth0 to any port 6789 proto tcp comment "NZBGet" exe ufw allow in on eth0 to any port 6789 proto tcp comment "NZBGet"
exe ufw allow in on eth0 to any port 9117 proto tcp comment "Jackett. Rules for Sonarr und Radarr in /etc/ufw/rules.before" exe ufw allow in on eth0 to any port 9117 proto tcp comment "Jackett. Rules for Sonarr und Radarr in /etc/ufw/rules.before"
outColor red color red
echo echo
echo "[W] Add the following lines before \"# drop INVALID packets\"" echo "[W] Add the following lines before \"# drop INVALID packets\""
echo " [/etc/ufw/before.rules]" echo " [/etc/ufw/before.rules]"
echo echo
outColor green color green
echo "# Allow all packages to sonarr and radarr" echo "# Allow all packages to sonarr and radarr"
echo "# ufw thinks that nzb360 sends messages after socket is closed" echo "# ufw thinks that nzb360 sends messages after socket is closed"
echo "-A ufw-before-input -i eth0 -p tcp --dport 7878 -j ACCEPT" echo "-A ufw-before-input -i eth0 -p tcp --dport 7878 -j ACCEPT"
@@ -362,11 +362,11 @@ step_16() {
} }
step_17_info() { echo "Install danted socks proxy"; } step_17_info() { echo "Install danted socks proxy"; }
step_17_alias() { ALIAS="danted"; } step_17_alias() { echo "danted"; }
step_17() { step_17() {
systemctl status danted.service >>/dev/null 2>&1 systemctl status danted.service >>/dev/null 2>&1
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echoseq " [I] Danted already installed" info "Danted already installed"
return 0 return 0
fi fi
exe apt update exe apt update
@@ -419,7 +419,7 @@ DANTED_EOF
} }
step_19_info() { echo "Disable apt-daily activities"; } step_19_info() { echo "Disable apt-daily activities"; }
step_19_alias() { ALIAS="aptdaily"; } step_19_alias() { echo "aptdaily"; }
step_19() { step_19() {
exe /usr/bin/systemctl stop apt-daily-upgrade.timer exe /usr/bin/systemctl stop apt-daily-upgrade.timer
exe /usr/bin/systemctl stop apt-daily.timer exe /usr/bin/systemctl stop apt-daily.timer
@@ -430,22 +430,18 @@ step_19() {
} }
step_21_info() { step_21_info() {
local pInstallDir="${DLD_DIR}/prowlarr" local pInstallDir="${DLD_DIR:-}/prowlarr"
case $CONTEXT_HELP in if contextHelp ; then
0) echo -n "Install/Update "
if [ -e "$pInstallDir" ]; then elif [ -e "$pInstallDir" ]; then
echo -n "Upgrade " echo -n "Upgrade "
else else
echo -n "Install " echo -n "Install "
fi fi
;;
*)
echo -n "Install/Update ";;
esac
echo "prowlarr for arm64" echo "prowlarr for arm64"
echoinfo "Default port: 9696" echoinfo "Default port: 9696"
} }
step_21_alias() { ALIAS="prowlarr"; } step_21_alias() { echo "prowlarr"; }
step_21() { step_21() {
# local pDownDir="/tmp" # local pDownDir="/tmp"
local pInstallDir="${DLD_DIR}/prowlarr" local pInstallDir="${DLD_DIR}/prowlarr"
@@ -455,10 +451,10 @@ step_21() {
if [ -e "$pInstallDir" ]; then if [ -e "$pInstallDir" ]; then
prowlarrUpgrade=1 prowlarrUpgrade=1
echoseq " [I] Stopping prowlarr service" info "Stopping prowlarr service"
echoseq " Service will not be started automatically after update" info " Service will not be started automatically after update"
exe service prowlarr stop exe service prowlarr stop
echoseq " [I] Moving existing $pInstallDir as backup" info "Moving existing $pInstallDir as backup"
exe mv "$pInstallDir" "${pInstallDir}_bu_"`date +%Y%m%d-%H%M%S` exe mv "$pInstallDir" "${pInstallDir}_bu_"`date +%Y%m%d-%H%M%S`
fi fi
@@ -470,12 +466,12 @@ pTar="/tmp/Prowlarr.tgz"
prowlarrUpgrade=0 prowlarrUpgrade=0
step_22_info() { echo "Clean prowlarr download"; } step_22_info() { echo "Clean prowlarr download"; }
step_22_alias() { ALIAS="prowlarrclean"; } step_22_alias() { echo "prowlarrclean"; }
step_22() { step_22() {
exe rm -rf "$pTar" exe rm -rf "$pTar"
if [ $prowlarrUpgrade -ne 0 ]; then if [ $prowlarrUpgrade -ne 0 ]; then
echoseq " [I] Stopping sequence here." info "Stopping sequence here."
echoseq " Following steps only exected for fresh installation." info " Following steps only exected for fresh installation."
exit 0 exit 0
fi fi
} }
@@ -512,22 +508,18 @@ step_24() {
} }
step_30_info() { step_30_info() {
local pInstallDir="${DLD_DIR}/readarr" local pInstallDir="${DLD_DIR:-}/readarr"
case $CONTEXT_HELP in if contextHelp ; then
0) echo -n "Install/Update "
if [ -e "$pInstallDir" ]; then elif [ -e "$pInstallDir" ]; then
echo -n "Upgrade " echo -n "Upgrade "
else else
echo -n "Install " echo -n "Install "
fi fi
;;
*)
echo -n "Install/Update ";;
esac
echo "readarr for arm64" echo "readarr for arm64"
echoinfo "Default port: 8787" echoinfo "Default port: 8787"
} }
step_30_alias() { ALIAS="readarr"; } step_30_alias() { echo "readarr"; }
step_30() { step_30() {
# local pDownDir="/tmp" # local pDownDir="/tmp"
local lInstallDir="${DLD_DIR}/readarr" local lInstallDir="${DLD_DIR}/readarr"
@@ -537,10 +529,10 @@ step_30() {
if [ -e "$lInstallDir" ]; then if [ -e "$lInstallDir" ]; then
readarrUpgrade=1 readarrUpgrade=1
echoseq " [I] Stopping readarr service" info "Stopping readarr service"
echoseq " Service will not be started automatically after update" info " Service will not be started automatically after update"
exe service readarr stop exe service readarr stop
echoseq " [I] Moving existing $lInstallDir as backup" info "Moving existing $lInstallDir as backup"
exe mv "$lInstallDir" "${lInstallDir}_bu_"`date +%Y%m%d-%H%M%S` exe mv "$lInstallDir" "${lInstallDir}_bu_"`date +%Y%m%d-%H%M%S`
fi fi
@@ -552,12 +544,12 @@ readarrTar="/tmp/Readarr.tar.gz"
readarrUpgrade=0 readarrUpgrade=0
step_31_info() { echo "Clean readarr download"; } step_31_info() { echo "Clean readarr download"; }
step_31_alias() { ALIAS="readarrclean"; } step_31_alias() { echo "readarrclean"; }
step_31() { step_31() {
exe rm -rf "$readarrTar" exe rm -rf "$readarrTar"
if [ $readarrUpgrade -ne 0 ]; then if [ $readarrUpgrade -ne 0 ]; then
echoseq " [I] Stopping sequence here." info "Stopping sequence here."
echoseq " Following steps only exected for fresh installation." info " Following steps only exected for fresh installation."
exit 0 exit 0
fi fi
} }
@@ -595,7 +587,7 @@ step_33() {
} }
step_50_info() { echo "Upgrade bazarr"; } step_50_info() { echo "Upgrade bazarr"; }
step_50_alias() { ALIAS="upgradebazarr"; } step_50_alias() { echo "upgradebazarr"; }
step_50() { step_50() {
local bazarrServiceLoc="/etc/systemd/system/bazarr.service" local bazarrServiceLoc="/etc/systemd/system/bazarr.service"
local lService=`eval "echo \"$bazarrService\""` local lService=`eval "echo \"$bazarrService\""`
@@ -610,8 +602,8 @@ step_50() {
checkVpn() { checkVpn() {
ip -br a | grep tun >>/dev/null 2>&1 ip -br a | grep tun >>/dev/null 2>&1
[ $? -eq 0 ] && echoseq " [W] A VPN connection is possibly active. Consider deactivating it befor any apt operation." [ $? -eq 0 ] && warning "A VPN connection is possibly active. Consider deactivating it befor any apt operation."
} }
VERSION_SEQREV=13 readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh

View File

@@ -15,19 +15,19 @@ SCRIPT_NAME=$(basename -- $0)
SCRIPT_NAME=${SCRIPT_NAME%%.*} SCRIPT_NAME=${SCRIPT_NAME%%.*}
CONFIG_FILE_TEMPLATE="$WDIR/${SCRIPT_NAME}.cfg.example" CONFIG_FILE_TEMPLATE="$WDIR/${SCRIPT_NAME}.cfg.example"
step_config() { seq_config() {
initSeqConfig -p "$SCRIPT_NAME" "$CONFIG_FILE_TEMPLATE" initSeqConfig -p "$SCRIPT_NAME" "$CONFIG_FILE_TEMPLATE"
if [ $? -eq 0 ] ; then if [ $? -eq 0 ] ; then
CONFIG=1 CONFIG=1
else else
[ $DRY -eq 0 ] && return 1 dry || return 1
fi fi
toolSyslogTag="${SCRIPT_NAME}-$SEQ_PROFILE_NAME" toolSyslogTag="${SCRIPT_NAME}-$SEQ_PROFILE_NAME"
} }
step_1_info() { step_1_info() {
echo -n "Backup " echo -n "Backup "
if [ $CONTEXT_HELP -ne 0 ] ; then if contextHelp ; then
echo -n "selected profile" echo -n "selected profile"
else else
echo -n "profile: $SEQ_PROFILE_NAME" echo -n "profile: $SEQ_PROFILE_NAME"
@@ -36,7 +36,7 @@ step_1_info() {
echoinfo " [OPTIONS]" echoinfo " [OPTIONS]"
echoinfo " --no-purge, -n : Do not purge old backups after backup" echoinfo " --no-purge, -n : Do not purge old backups after backup"
} }
step_1_alias() { ALIAS="backup"; } step_1_alias() { echo "backup"; }
step_1() { step_1() {
shift shift
@@ -89,7 +89,7 @@ step_1() {
} }
step_3_info() { echo "Verify selected backup"; } step_3_info() { echo "Verify selected backup"; }
step_3_alias() { ALIAS="verify"; } step_3_alias() { echo "verify"; }
step_3() { step_3() {
shift shift
@@ -111,7 +111,7 @@ step_5_info() {
echoinfo " (file or folder)" echoinfo " (file or folder)"
echoinfo " --time, -t <TIME> : Age of file to be restored" echoinfo " --time, -t <TIME> : Age of file to be restored"
} }
step_5_alias() { ALIAS="restore"; } step_5_alias() { echo "restore"; }
step_5() { step_5() {
shift shift
@@ -134,7 +134,7 @@ step_5() {
done done
if [ -z "$1" ] ; then if [ -z "$1" ] ; then
echoerr " [E] No target provided" error -e "No target provided"
return 1 return 1
fi fi
local ebuLocalTarget="$1" local ebuLocalTarget="$1"
@@ -150,7 +150,7 @@ step_5() {
} }
step_7_info() { echo "Purge old backups [TARGET]"; } step_7_info() { echo "Purge old backups [TARGET]"; }
step_7_alias() { ALIAS="purge"; } step_7_alias() { echo "purge"; }
step_7() { step_7() {
shift shift
local ebuTarget="$EBU_TARGET" local ebuTarget="$EBU_TARGET"
@@ -166,7 +166,7 @@ step_7() {
elif [ ! -z "$EBU_MAX_FULLS_WITH_INCRS" ] ; then elif [ ! -z "$EBU_MAX_FULLS_WITH_INCRS" ] ; then
dupCommand+="remove-all-inc-of-but-n-full $EBU_MAX_FULLS_WITH_INCRS " dupCommand+="remove-all-inc-of-but-n-full $EBU_MAX_FULLS_WITH_INCRS "
else else
if [ $QUIET -eq 0 ] ; then echoerr " [W] No purge option configured" ; fi if interactive ; then warning -e "No purge option configured" ; fi
return 1 return 1
fi fi
@@ -180,7 +180,7 @@ step_20_info() {
shift shift
local ebuTarget=$EBU_TARGET local ebuTarget=$EBU_TARGET
[ ! -z "$1" ] && ebuTarget="$1" [ ! -z "$1" ] && ebuTarget="$1"
if [ $CONTEXT_HELP -ne 0 ]; then if contextHelp; then
echo "Status of (profile) [TARGET]" echo "Status of (profile) [TARGET]"
elif [ ! -z "$1" ]; then elif [ ! -z "$1" ]; then
echo "Status of target: $ebuTarget" echo "Status of target: $ebuTarget"
@@ -188,7 +188,7 @@ step_20_info() {
echo "Status of profile \"$SEQ_PROFILE_NAME\" target: $ebuTarget" echo "Status of profile \"$SEQ_PROFILE_NAME\" target: $ebuTarget"
fi fi
} }
step_20_alias() { ALIAS='status'; } step_20_alias() { echo 'status'; }
step_20() { step_20() {
shift shift
local ebuTarget="$EBU_TARGET" local ebuTarget="$EBU_TARGET"
@@ -201,7 +201,7 @@ step_20() {
} }
step_22_info() { echo "List backup files [TARGET]"; } step_22_info() { echo "List backup files [TARGET]"; }
step_22_alias() { ALIAS='list'; } step_22_alias() { echo 'list'; }
step_22() { step_22() {
shift shift
local ebuTarget="$EBU_TARGET" local ebuTarget="$EBU_TARGET"
@@ -216,7 +216,7 @@ step_22() {
step_70_info() { step_70_info() {
echo -n "Manage cron file for " echo -n "Manage cron file for "
if [ $CONTEXT_HELP -ne 0 ] ; then if contextHelp ; then
echo -n "selected profile" echo -n "selected profile"
else else
echo -n "profile: $SEQ_PROFILE_NAME" echo -n "profile: $SEQ_PROFILE_NAME"
@@ -225,7 +225,7 @@ step_70_info() {
echoinfo " [OPTIONS]" echoinfo " [OPTIONS]"
echoinfo " --remove, -r : remove cron file" echoinfo " --remove, -r : remove cron file"
} }
step_70_alias() { ALIAS='cron'; } step_70_alias() { echo 'cron'; }
step_70() { step_70() {
shift shift
local arg local arg
@@ -267,7 +267,7 @@ step_70() {
} }
step_72_info() { echo "Update all profile cron files"; } step_72_info() { echo "Update all profile cron files"; }
step_72_alias() { ALIAS="reload"; } step_72_alias() { echo "reload"; }
step_72() { step_72() {
for seq in "$SEQ_CONFIG_HOME/"* ; do for seq in "$SEQ_CONFIG_HOME/"* ; do
seq=$(basename ${seq}) seq=$(basename ${seq})
@@ -276,10 +276,10 @@ step_72() {
} }
step_100_info() { echo "Install $toolName $toolPpa"; } step_100_info() { echo "Install $toolName $toolPpa"; }
step_100_alias() { ALIAS="install"; } step_100_alias() { echo "install"; }
step_100() { step_100() {
local aptOpt= local aptOpt=
if [ $QUIET -ne 0 ] ; then if quiet ; then
aptOpt="-y" aptOpt="-y"
fi fi
@@ -300,7 +300,7 @@ unsetPassphrase() {
checkFileHead() { checkFileHead() {
local readChar local readChar
if [ ! -e "$1" ] ; then if [ ! -e "$1" ] ; then
echoerr " [E] File $1 not found" error -e "File $1 not found"
return 1 return 1
fi fi
read -r -n ${#2} readChar < "$1" read -r -n ${#2} readChar < "$1"
@@ -326,5 +326,5 @@ checkInstalled() {
fi fi
} }
VERSION_SEQREV=12 readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh

View File

@@ -13,7 +13,7 @@ myUser=
myPass= myPass=
step_1_info() { echo "Install $toolName via apt"; } step_1_info() { echo "Install $toolName via apt"; }
step_1_alias() { ALIAS="install"; } step_1_alias() { echo "install"; }
step_1() { step_1() {
exe apt update exe apt update
exe apt install -y $toolName exe apt install -y $toolName
@@ -72,13 +72,13 @@ Some essential settings needed:
- Admin User" - Admin User"
step_4_info() { echo "Restart $toolName"; } step_4_info() { echo "Restart $toolName"; }
step_4_alias() { ALIAS="restart"; } step_4_alias() { echo "restart"; }
step_4() { step_4() {
exe service ejabberd restart exe service ejabberd restart
} }
step_5_info() { echo "Create new user"; } step_5_info() { echo "Create new user"; }
step_5_alias() { ALIAS="adduser"; } step_5_alias() { echo "adduser"; }
step_5() { step_5() {
readDomain readDomain
readUser readUser
@@ -87,14 +87,14 @@ step_5() {
} }
step_10_info() { echo "List existing user"; } step_10_info() { echo "List existing user"; }
step_10_alias() { ALIAS="listuser"; } step_10_alias() { echo "listuser"; }
step_10() { step_10() {
readDomain readDomain
exe ejabberdctl registered_users $myDomain exe ejabberdctl registered_users $myDomain
} }
step_12_info() { echo "Change password for existing user"; } step_12_info() { echo "Change password for existing user"; }
step_12_alias() { ALIAS="passwd"; } step_12_alias() { echo "passwd"; }
step_12() { step_12() {
readDomain readDomain
readUser readUser
@@ -103,7 +103,7 @@ step_12() {
} }
step_14_info() { echo "Remove registered user"; } step_14_info() { echo "Remove registered user"; }
step_14_alias() { ALIAS="deluser"; } step_14_alias() { echo "deluser"; }
step_14() { step_14() {
readDomain readDomain
readUser readUser
@@ -143,5 +143,5 @@ readUserPass() {
} }
SEQDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >>/dev/null 2>&1 && pwd )" SEQDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >>/dev/null 2>&1 && pwd )"
VERSION_SEQREV=4 readonly sqr_minVersion=16
. sequencer.sh . sequencer.sh

View File

@@ -10,7 +10,7 @@ CONFIG=0
CONFIG_FILE_NAME="${toolName}.cfg" CONFIG_FILE_NAME="${toolName}.cfg"
CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example" CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
step_config() { seq_config() {
initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE" initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE"
if [ $? -eq 0 ] ; then if [ $? -eq 0 ] ; then
echo " ${toolName} path: ${ELEMENT_WEB_LOC}" echo " ${toolName} path: ${ELEMENT_WEB_LOC}"
@@ -20,7 +20,7 @@ step_config() {
} }
step_18_info() { echo "Check for updates"; } step_18_info() { echo "Check for updates"; }
step_18_alias() { ALIAS="updatecheck"; } step_18_alias() { echo "updatecheck"; }
step_18() { step_18() {
shift shift
local latestVersion= local latestVersion=
@@ -49,12 +49,12 @@ step_20_info() {
echo echo
fi fi
} }
step_20_alias() { ALIAS="backup"; } step_20_alias() { echo "backup"; }
step_20() { step_20() {
shift shift
local tempRoot= local tempRoot=
if [ $CONFIG -eq 0 ] ; then if [ $CONFIG -eq 0 ] ; then
echoerr " [E] No configuration file found" error -e "No configuration file found"
return 1 return 1
fi fi
if [ ! -z $ELEMENT_WEB_BACKUP ] ; then if [ ! -z $ELEMENT_WEB_BACKUP ] ; then
@@ -76,7 +76,7 @@ step_22_info() {
shift shift
if [ -z $1 ] ; then if [ -z $1 ] ; then
echo -n "Get latest version from github" echo -n "Get latest version from github"
if [ $CONTEXT_HELP -eq 0 ] ; then if ! contextHelp ; then
echo ": $(curl --silent "$latestUrl" | grep -Po '"tag_name": "\K.*?(?=")')" echo ": $(curl --silent "$latestUrl" | grep -Po '"tag_name": "\K.*?(?=")')"
else else
echo " [CUSTOM VERSION]" echo " [CUSTOM VERSION]"
@@ -85,7 +85,7 @@ step_22_info() {
echo "Get version $1 from github" echo "Get version $1 from github"
fi fi
} }
step_22_alias() { ALIAS="upgrade"; } step_22_alias() { echo "upgrade"; }
step_22() { step_22() {
shift # don't need step number shift # don't need step number
local latestVersion= local latestVersion=
@@ -96,16 +96,16 @@ step_22() {
fi fi
if [ -z $latestVersion ] ; then if [ -z $latestVersion ] ; then
echoerr " [E] Cannot determine latest version from github repository" error -e "Cannot determine latest version from github repository"
return 1 return 1
elif [ $QUIET -eq 0 ] ; then elif interactive ; then
echo echo
exe read -p "Install $latestVersion to $ELEMENT_WEB_LOC [n]o/(y)es? " answer exe read -p "Install $latestVersion to $ELEMENT_WEB_LOC [n]o/(y)es? " answer
case $answer in case $answer in
[yY]) [yY])
;; ;;
*) *)
echoerr " [I] Upgrade aborted" info -e "Upgrade aborted"
return 1 return 1
;; ;;
esac esac
@@ -155,10 +155,10 @@ tempDown="/tmp/${toolName}"
tempLoc="$tempDown/${toolName}.tar.gz" tempLoc="$tempDown/${toolName}.tar.gz"
step_24_info() { echo "Clean temporary files: $tempDown"; } step_24_info() { echo "Clean temporary files: $tempDown"; }
step_24_alias() { ALIAS="clean"; } step_24_alias() { echo "clean"; }
step_24() { step_24() {
exe rm -rf "$tempDown" exe rm -rf "$tempDown"
} }
VERSION_SEQREV=11 readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh

View File

@@ -29,10 +29,10 @@ CONFIG_JAILS="$CONFIG_DIR/jail.d"
#} #}
step_1_info() { echo "Install $toolName"; } step_1_info() { echo "Install $toolName"; }
step_1_alias() { ALIAS="install"; } step_1_alias() { echo "install"; }
step_1() { step_1() {
local aptOpt= local aptOpt=
if [ $QUIET -ne 0 ];then if quiet;then
aptOpt="-y" aptOpt="-y"
fi fi
@@ -41,7 +41,7 @@ step_1() {
} }
step_2_info() { echo "Base jail configuration to use ufw"; } step_2_info() { echo "Base jail configuration to use ufw"; }
step_2_alias() { ALIAS="config"; } step_2_alias() { echo "config"; }
step_2() { step_2() {
echo " [I] Create local configuration"; echo " [I] Create local configuration";
addConf -f "$failConfLocal" "$toolConfLoc" addConf -f "$failConfLocal" "$toolConfLoc"
@@ -54,7 +54,7 @@ banaction_multiport = ufw
ignoreip = 127.0.0.1/8 ::1" ignoreip = 127.0.0.1/8 ::1"
step_3_info() { echo "Add basic ip-blacklist"; } step_3_info() { echo "Add basic ip-blacklist"; }
step_3_alias() { ALIAS="blacklist"; } step_3_alias() { echo "blacklist"; }
step_3() { step_3() {
echo " [I] Adding filter" echo " [I] Adding filter"
addConf -s -f "$ipBlackListFilter" "$toolFilter/$(basename $ipBlackListFilter)" addConf -s -f "$ipBlackListFilter" "$toolFilter/$(basename $ipBlackListFilter)"
@@ -67,7 +67,7 @@ ipBlackListJail="$CONFIG_JAILS/ip-blacklist.conf"
ipBlackListFilter="$CONFIG_FILTER/ip-blacklist.conf" ipBlackListFilter="$CONFIG_FILTER/ip-blacklist.conf"
step_4_info() { echo "$toolName notes"; } step_4_info() { echo "$toolName notes"; }
step_4_alias() { ALIAS="notes"; } step_4_alias() { echo "notes"; }
step_4() { step_4() {
cat <<NOTES_EOF cat <<NOTES_EOF
# Syslog not readable by librenms (https://github.com/fail2ban/fail2ban/issues/2734) # Syslog not readable by librenms (https://github.com/fail2ban/fail2ban/issues/2734)
@@ -78,12 +78,12 @@ NOTES_EOF
} }
step_20_info() { echo "Install mailserver jail"; } step_20_info() { echo "Install mailserver jail"; }
step_20_alias() { ALIAS="mail"; } step_20_alias() { echo "mail"; }
step_20() { step_20() {
addConf -s -f "$mailJail" "$toolJails/$(basename $mailJail)" addConf -s -f "$mailJail" "$toolJails/$(basename $mailJail)"
exe service $toolName restart exe service $toolName restart
} }
mailJail="$CONFIG_JAILS/mail.conf" mailJail="$CONFIG_JAILS/mail.conf"
VERSION_SEQREV=11 readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh

View File

@@ -32,10 +32,10 @@ WSUBDIR="${WDIR}/${toolName}"
#} #}
step_1_info() { echo "Install prerequisits for $toolName"; } step_1_info() { echo "Install prerequisits for $toolName"; }
step_1_alias() { ALIAS="install"; } step_1_alias() { echo "install"; }
step_1() { step_1() {
local aptOpt= local aptOpt=
if [ $QUIET != 0 ] ; then if quiet ; then
aptOpt="-y" aptOpt="-y"
fi fi
#exe apt update #exe apt update
@@ -59,7 +59,7 @@ step_3() {
} }
step_20_info() { echo "List $toolName prerequisits"; } step_20_info() { echo "List $toolName prerequisits"; }
step_20_alias() { ALIAS="listdeps"; } step_20_alias() { echo "listdeps"; }
step_20() { step_20() {
echo " [I] $toolName prerequisits:" echo " [I] $toolName prerequisits:"
echo "$toolDeps $toolDeps2" echo "$toolDeps $toolDeps2"
@@ -79,7 +79,7 @@ step_32() {
systemdConfigLoc="/etc/systemd/system" systemdConfigLoc="/etc/systemd/system"
step_34_info() { echo "Downgrade $toolName jabber dependencies (callbackIQ -> FHEM crash)"; } step_34_info() { echo "Downgrade $toolName jabber dependencies (callbackIQ -> FHEM crash)"; }
step_34_alias() { ALIAS="downgrade_xmpp"; } step_34_alias() { echo "downgrade_xmpp"; }
step_34() { step_34() {
if [ ! -f $libnetDown ]; then if [ ! -f $libnetDown ]; then
exe wget "$libnetUrl" -O "$libnetDown" exe wget "$libnetUrl" -O "$libnetDown"
@@ -91,7 +91,7 @@ step_34() {
fi fi
local aptOption= local aptOption=
if [ $QUIET -ne 0 ] ; then if quiet ; then
aptOption="-y" aptOption="-y"
else else
aptOption="" aptOption=""
@@ -136,7 +136,7 @@ Pin: version 1.23-2
Pin-Priority: 1000" Pin-Priority: 1000"
step_37_info() { echo "Download latest speedtest python script"; } step_37_info() { echo "Download latest speedtest python script"; }
step_37_alias() { ALIAS="speedtestdownload"; } step_37_alias() { echo "speedtestdownload"; }
step_37() { step_37() {
local lSpeedPath="/usr/local/bin/speedtest-cli" local lSpeedPath="/usr/local/bin/speedtest-cli"
exe wget -O "$lSpeedPath" https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py exe wget -O "$lSpeedPath" https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py
@@ -144,11 +144,11 @@ step_37() {
} }
step_40_info() { echo "Execute fhem [COMMAND]"; } step_40_info() { echo "Execute fhem [COMMAND]"; }
step_40_alias() { ALIAS="exe"; } step_40_alias() { echo "exe"; }
step_40() { step_40() {
shift shift
exe perl "${toolHome}/fhem.pl" 7072 "$1" exe perl "${toolHome}/fhem.pl" 7072 "$1"
} }
VERSION_SEQREV=11 readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh

View File

@@ -13,27 +13,27 @@ SCRIPT_NAME=${SCRIPT_FILE%%.*}
CONFIG_FILE_NAME="${SCRIPT_NAME}.cfg" CONFIG_FILE_NAME="${SCRIPT_NAME}.cfg"
CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example" CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
step_config() { seq_config() {
## or to use sequencer api with profile config file support: ## or to use sequencer api with profile config file support:
initSeqConfig "$SCRIPT_NAME" "$CONFIG_FILE_TEMPLATE" initSeqConfig "$SCRIPT_NAME" "$CONFIG_FILE_TEMPLATE"
if [ $? -eq 0 ] ; then if [ $? -eq 0 ] ; then
CONFIG=1 CONFIG=1
echoseq " [I] Freeradius DB: $FRAD_DB_NAME" info "Freeradius DB: $FRAD_DB_NAME"
echoseq " Daloradius home: $DRAD_HOME" info " Daloradius home: $DRAD_HOME"
else else
# End if no configuration file exists # End if no configuration file exists
[ $DRY -eq 0 ] && return -1 dry || return -1
fi fi
## Apt cmdline option to suppress user interaction ## Apt cmdline option to suppress user interaction
[ $QUIET -ne 0 ] && APTOPT="-y" quiet && APTOPT="-y"
## Return of non zero value will abort the sequence ## Return of non zero value will abort the sequence
return 0 return 0
} }
step_50_info() { echo "Init freeradius and daloradius database"; } step_50_info() { echo "Init freeradius and daloradius database"; }
step_50_alias() { ALIAS="initdb"; } step_50_alias() { echo "initdb"; }
step_50() { step_50() {
local drDbInit="$DRAD_HOME/contrib/db/mysql-daloradius.sql" local drDbInit="$DRAD_HOME/contrib/db/mysql-daloradius.sql"
local frDbSchema="$toolConfLoc/mods-config/sql/main/mysql/schema.sql" local frDbSchema="$toolConfLoc/mods-config/sql/main/mysql/schema.sql"
@@ -48,20 +48,20 @@ step_50() {
step_52_info() { echo "Reset freeradius and daloradius database"; } step_52_info() { echo "Reset freeradius and daloradius database"; }
step_52_alias() { ALIAS="resetdb"; } step_52_alias() { echo "resetdb"; }
step_52() { step_52() {
local lAnswer local lAnswer
if [ $QUIET -eq 0 ]; then if interactive; then
read -p "Do you really want to reset the database $FRAD_DB_NAME y/[n]? " lAnswer read -p "Do you really want to reset the database $FRAD_DB_NAME y/[n]? " lAnswer
else else
lAnswer=y lAnswer=y
fi fi
case "$lAnswer" in case "$lAnswer" in
[yY]) [yY])
echoseq -n " [I] Reseting DB...";; info -n " [I] Reseting DB...";;
*) *)
echoerr " [I] Abort reset" info -e "Abort reset"
return 1;; return 1;;
esac esac
@@ -69,5 +69,5 @@ step_52() {
step initdb step initdb
} }
VERSION_SEQREV=13 readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh

View File

@@ -10,7 +10,7 @@ CONFIG=0
CONFIG_FILE_NAME="${toolName}.cfg" CONFIG_FILE_NAME="${toolName}.cfg"
CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example" CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
step_config() { seq_config() {
initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE" initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE"
if [ $? -eq 0 ] ; then if [ $? -eq 0 ] ; then
CONFIG=1 CONFIG=1
@@ -27,12 +27,12 @@ step_20_info() {
echo echo
fi fi
} }
step_20_alias() { ALIAS="backup"; } step_20_alias() { echo "backup"; }
step_20() { step_20() {
shift shift
local tempRoot= local tempRoot=
if [ $CONFIG -eq 0 ] ; then if [ $CONFIG -eq 0 ] ; then
echoerr " [E] No configuration file found" error -e "No configuration file found"
return 1 return 1
fi fi
if [ ! -z $FR_BACKUP ] ; then if [ ! -z $FR_BACKUP ] ; then
@@ -63,7 +63,7 @@ step_22_info() {
shift shift
if [ -z $1 ] ; then if [ -z $1 ] ; then
echo -n "Get latest version from github" echo -n "Get latest version from github"
if [ $CONTEXT_HELP -eq 0 ] ; then if ! contextHelp ; then
echo ": $(curl --silent "$latestUrl" | grep -Po '"tag_name": "\K.*?(?=")')" echo ": $(curl --silent "$latestUrl" | grep -Po '"tag_name": "\K.*?(?=")')"
else else
echo " [CUSTOM VERSION]" echo " [CUSTOM VERSION]"
@@ -72,7 +72,7 @@ step_22_info() {
echo "Get version $1 from github" echo "Get version $1 from github"
fi fi
} }
step_22_alias() { ALIAS="upgrade"; } step_22_alias() { echo "upgrade"; }
step_22() { step_22() {
shift # don't need step number shift # don't need step number
local latestVersion= local latestVersion=
@@ -83,16 +83,16 @@ step_22() {
fi fi
if [ -z $latestVersion ] ; then if [ -z $latestVersion ] ; then
echoerr " [E] Cannot determine latest version from github repository" error -e "Cannot determine latest version from github repository"
return 1 return 1
elif [ $QUIET -eq 0 ] ; then elif interactive ; then
echo echo
exe read -p "Install $latestVersion to $FR_LOC [n]o/(y)es? " answer exe read -p "Install $latestVersion to $FR_LOC [n]o/(y)es? " answer
case $answer in case $answer in
[yY]) [yY])
;; ;;
*) *)
echoerr " [I] Upgrade aborted" info -e "Upgrade aborted"
return 1 return 1
;; ;;
esac esac
@@ -100,7 +100,7 @@ step_22() {
local isInstalled=$(grep -E "Version $latestVersion" "${FR_LOC}/CHANGELOG" >>/dev/null && echo "1" || echo "0") local isInstalled=$(grep -E "Version $latestVersion" "${FR_LOC}/CHANGELOG" >>/dev/null && echo "1" || echo "0")
if [ $isInstalled -eq 1 ] ; then if [ $isInstalled -eq 1 ] ; then
echoerr " [E] Version $latestVersion is already installed" error -e "Version $latestVersion is already installed"
return 2 return 2
fi fi
@@ -163,10 +163,10 @@ tempLoc="$tempDown/fr.tar.gz"
tempLocAddons="$tempDown/fradd.tar.gz" tempLocAddons="$tempDown/fradd.tar.gz"
step_24_info() { echo "Clean temporary files: $tempDown"; } step_24_info() { echo "Clean temporary files: $tempDown"; }
step_24_alias() { ALIAS="clean"; } step_24_alias() { echo "clean"; }
step_24() { step_24() {
exe rm -rf "$tempDown" exe rm -rf "$tempDown"
} }
VERSION_SEQREV=14 readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh

View File

@@ -12,25 +12,25 @@ SCRIPT_NAME=${SCRIPT_FILE%%.*}
CONFIG_FILE_NAME="${SCRIPT_NAME}.cfg" CONFIG_FILE_NAME="${SCRIPT_NAME}.cfg"
CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example" CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
step_config() { seq_config() {
## or to use sequencer api with global config file: ## or to use sequencer api with global config file:
#initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE" #initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE"
#if [ $? -eq 0 ] ; then #if [ $? -eq 0 ] ; then
# CONFIG=1 # CONFIG=1
#else #else
# # End if no configuration file exists # # End if no configuration file exists
# [ $DRY -eq 0 ] && return -1 # dry || return -1
#fi #fi
## Apt cmdline option to suppress user interaction ## Apt cmdline option to suppress user interaction
[ $QUIET -ne 0 ] && APTOPT="-y" quiet && APTOPT="-y"
## Return of non zero value will abort the sequence ## Return of non zero value will abort the sequence
return 0 return 0
} }
step_1_info() { echo "Setup global git aliases"; } step_1_info() { echo "Setup global git aliases"; }
step_1_alias() { ALIAS="alias"; } step_1_alias() { echo "alias"; }
step_1() { step_1() {
local brConf="branch \ local brConf="branch \
--format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - \ --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - \
@@ -48,5 +48,5 @@ step_1() {
exe git config --global alias.ll 'log' exe git config --global alias.ll 'log'
} }
VERSION_SEQREV=15 readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh

View File

@@ -27,33 +27,33 @@ giteaDownFile="/tmp/giteaDown"
giteaUser="git" giteaUser="git"
versionNow= versionNow=
step_config() { seq_config() {
initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE" initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE"
if [ $? -eq 0 ] ; then if [ $? -eq 0 ] ; then
CONFIG=1 CONFIG=1
else else
# End if no configuration file exists # End if no configuration file exists
[ $DRY -eq 0 ] && return -1 dry || return -1
fi fi
## Apt cmdline option to suppress user interaction ## Apt cmdline option to suppress user interaction
[ $QUIET -ne 0 ] && APTOPT="-y" quiet && APTOPT="-y"
if [ -z $giteaVersion ] ; then if [ -z $giteaVersion ] ; then
echoerr " [E] Couldn't determine latest version of $toolName" error -e "Couldn't determine latest version of $toolName"
fi fi
[ ! -z "$(command -v gitea)" ] && versionNow=$(gitea --version | sed 's/.*version \([0-9.]\+\).*/\1/') [ ! -z "$(command -v gitea)" ] && versionNow=$(gitea --version | sed 's/.*version \([0-9.]\+\).*/\1/')
checkArchitecture checkArchitecture
giteaIniLoc="${SEQ_GITEA_CONF_DIR}/app.ini" giteaIniLoc="${SEQ_GITEA_CONF_DIR}/app.ini"
echoseq " [I] Gitea work: $SEQ_GITEA_WORK_DIR" info "Gitea work: $SEQ_GITEA_WORK_DIR"
echoseq " Gitea config: $SEQ_GITEA_CONF_DIR" info " Gitea config: $SEQ_GITEA_CONF_DIR"
echoseq " Git user home: $SEQ_GITEA_HOME_DIR" info " Git user home: $SEQ_GITEA_HOME_DIR"
echoseq info
outColor yellow color yellow
echoseq " [W] Don't forget to adapt $SEQ_GITEA_CONF_DIR/app.ini" warning "Don't forget to adapt $SEQ_GITEA_CONF_DIR/app.ini"
outColor color
## Return of non zero value will abort the sequence ## Return of non zero value will abort the sequence
return 0 return 0
@@ -69,7 +69,7 @@ checkArchitecture() {
} }
step_1_info() { echo "Updating apt"; } step_1_info() { echo "Updating apt"; }
step_1_alias() { ALIAS="install"; } step_1_alias() { echo "install"; }
step_1() { step_1() {
exe apt update exe apt update
} }
@@ -106,9 +106,9 @@ step_4() {
"$SEQ_GITEA_HOME_DIR" "$SEQ_GITEA_WORK_DIR"/{custom,data,log} "$SEQ_GITEA_HOME_DIR" "$SEQ_GITEA_WORK_DIR"/{custom,data,log}
exe chown root:$SEQ_GITEA_USER "$SEQ_GITEA_CONF_DIR" exe chown root:$SEQ_GITEA_USER "$SEQ_GITEA_CONF_DIR"
exe chmod 770 $SEQ_GITEA_CONF_DIR exe chmod 770 $SEQ_GITEA_CONF_DIR
echoseq "Creating $giteaLogDir" info "Creating $giteaLogDir"
exe install -g $SEQ_GITEA_USER -m 770 -d "$giteaLogDir" exe install -g $SEQ_GITEA_USER -m 770 -d "$giteaLogDir"
echoseq -n "Copying gitea to global location and making it executable..." info -n "Copying gitea to global location and making it executable..."
exe install -b -m 755 -T "$giteaDownFile" "$SEQ_GITEA_BIN_LOC" && echo "ok" exe install -b -m 755 -T "$giteaDownFile" "$SEQ_GITEA_BIN_LOC" && echo "ok"
endReturn "Failed to install $SEQ_GITEA_BIN_LOC" endReturn "Failed to install $SEQ_GITEA_BIN_LOC"
} }
@@ -121,17 +121,17 @@ step_5() {
step_6_info() { echo "Starting $toolName service"; } step_6_info() { echo "Starting $toolName service"; }
step_6() { step_6() {
exe systemctl enable gitea --now exe systemctl enable gitea --now
echoseq "Before proceeding to installation you may need to create a database first with step 10" info "Before proceeding to installation you may need to create a database first with step 10"
echoseq info
echoseq "Goto http://[yourip]:3000/install and complete installation" info "Goto http://[yourip]:3000/install and complete installation"
echoseq info
echoseq "Afterwards please execute step 20 to secure configuration" info "Afterwards please execute step 20 to secure configuration"
} }
step_7_info() { echo "Show configuration notes"; } step_7_info() { echo "Show configuration notes"; }
step_7_alias() { ALIAS="notes"; } step_7_alias() { echo "notes"; }
step_7() { step_7() {
outColor green color green
cat <<NOTES_END cat <<NOTES_END
Final configuration notes for $giteaIniLoc: Final configuration notes for $giteaIniLoc:
@@ -173,7 +173,7 @@ step_12_info() {
echo "Upgrade existing $toolName installation" echo "Upgrade existing $toolName installation"
fi fi
} }
step_12_alias() { ALIAS="upgrade"; } step_12_alias() { echo "upgrade"; }
step_12() { step_12() {
endCheckEmpty versionNow "Please install $toolName first" endCheckEmpty versionNow "Please install $toolName first"
exe wget -O "$giteaDownFile" $giteaDownload exe wget -O "$giteaDownFile" $giteaDownload
@@ -184,8 +184,8 @@ step_12() {
exe service gitea stop exe service gitea stop
saveReturn $? saveReturn $?
endReturn endReturn
echoseq -n "Backing up existing executable to ${toolBackup}..." info -n "Backing up existing executable to ${toolBackup}..."
exe cp -ar "$SEQ_GITEA_BIN_LOC" "$toolBackup" && echoseq "ok" || echoseq "nok" exe cp -ar "$SEQ_GITEA_BIN_LOC" "$toolBackup" && info "ok" || info "nok"
fi fi
exe install --backup=none -m 755 -T "$giteaDownFile" "$SEQ_GITEA_BIN_LOC" exe install --backup=none -m 755 -T "$giteaDownFile" "$SEQ_GITEA_BIN_LOC"
endReturn -o $? "Upgrade failed" endReturn -o $? "Upgrade failed"
@@ -199,10 +199,10 @@ step_20() {
} }
step_22_info() { echo "Open $toolName config file"; } step_22_info() { echo "Open $toolName config file"; }
step_22_alias() { ALIAS="config"; } step_22_alias() { echo "config"; }
step_22() { step_22() {
exe vi "$giteaIniLoc" exe vi "$giteaIniLoc"
} }
VERSION_SEQREV=14 readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh

View File

@@ -25,19 +25,20 @@ readonly sq_configFileTemplate="$sq_dir/${sq_configFileName}.example"
sq_aptOpt= sq_aptOpt=
sq_config=0 sq_config=0
step_config() { seq_config() {
initSeqConfig -p "$sq_scriptName" "$sq_configFileTemplate" initSeqConfig -p "$sq_scriptName" "$sq_configFileTemplate"
if [ $? -eq 0 ] ; then if [ $? -eq 0 ] ; then
sq_config=1 sq_config=1
else else
# End if no configuration file exists # End if no configuration file exists
[ $DRY -eq 0 ] && return -1 dry || return -1
fi fi
sc_grocyConf="${sc_grocyDir}/data/config.php" # config not sourced if only profiles should be listed
sc_grocyConf="${sc_grocyDir:-}/data/config.php"
## Apt cmdline option to suppress user interaction ## Apt cmdline option to suppress user interaction
[ $QUIET -ne 0 ] && sq_aptOpt="-y" quiet && sq_aptOpt="-y"
## Return of non zero value will abort the sequence ## Return of non zero value will abort the sequence
return 0 return 0
@@ -52,7 +53,7 @@ step_1_info() {
echo "Check $toolName status" echo "Check $toolName status"
echoinfo "Returns 1 if update is available" echoinfo "Returns 1 if update is available"
} }
step_1_alias() { ALIAS="status"; } step_1_alias() { echo "status"; }
step_1() { step_1() {
getVersions getVersions
if [ -e "${sc_grocyDir}" ] ; then if [ -e "${sc_grocyDir}" ] ; then
@@ -77,7 +78,7 @@ step_1() {
} }
step_20_info() { echo "Backup ${toolName}"; } step_20_info() { echo "Backup ${toolName}"; }
step_20_alias() { ALIAS="backup"; } step_20_alias() { echo "backup"; }
step_20() { step_20() {
local lBu="${sc_grocyDir}/${sc_grocyBackup}/${toolName}_$(date +%Y%m%d-%H%M%S).tgz" local lBu="${sc_grocyDir}/${sc_grocyBackup}/${toolName}_$(date +%Y%m%d-%H%M%S).tgz"
exe cd ${sc_grocyDir}/.. exe cd ${sc_grocyDir}/..
@@ -89,16 +90,16 @@ step_20() {
} }
step_22_info() { echo "Install/upgrade ${toolName}"; } step_22_info() { echo "Install/upgrade ${toolName}"; }
step_22_alias() { ALIAS="install"; } step_22_alias() { echo "install"; }
step_22() { step_22() {
getVersions getVersions
if [[ ${versionNow} == ${versionNew} ]] ; then if [[ ${versionNow} == ${versionNew} ]] ; then
endReturn -o 1 "Latest version ${versionNow} already installed" endReturn -o 1 "Latest version ${versionNow} already installed"
else else
if [ -n "${versionNow}" ] ; then if [ -n "${versionNow}" ] ; then
echoseq " [I] Upgrading $toolName from ${versionNow} to ${versionNew}" info "Upgrading $toolName from ${versionNow} to ${versionNew}"
else else
echoseq " [I] Installing $toolName version ${versionNew}" info "Installing $toolName version ${versionNew}"
fi fi
fi fi
exe wget ${downUrl} -q -O "${grocyDownLoc}" exe wget ${downUrl} -q -O "${grocyDownLoc}"
@@ -113,16 +114,16 @@ step_22() {
# Populate first config # Populate first config
if [ ! -e "${sc_grocyConf}" ] ; then if [ ! -e "${sc_grocyConf}" ] ; then
exe cp "${sc_grocyDir}/config-dist.php" "${sc_grocyConf}" exe cp "${sc_grocyDir}/config-dist.php" "${sc_grocyConf}"
echoseq " [I] Please adjust the config: ${sc_grocyConf}" info "Please adjust the config: ${sc_grocyConf}"
else else
echoseq " [I] Please check ${sc_grocyDir}/config-dist.php" info "Please check ${sc_grocyDir}/config-dist.php"
echoseq " for new configuration options" info " for new configuration options"
fi fi
} }
step_30_alias() { ALIAS="notes"; } step_30_alias() { echo "notes"; }
step_30() { step_30() {
outColor green color green
cat <<NOTES_END cat <<NOTES_END
# Behind reverse proxy as subfolder # Behind reverse proxy as subfolder
@@ -162,5 +163,5 @@ server {
NOTES_END NOTES_END
} }
VERSION_SEQREV=15 readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh

View File

@@ -21,7 +21,7 @@ WDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >>/dev/null 2>&1 && pwd )"
#} #}
step_1_info() { echo "Installation of prerequisits"; } step_1_info() { echo "Installation of prerequisits"; }
step_1_alias() { ALIAS="prepare"; } step_1_alias() { echo "prepare"; }
step_1() { step_1() {
exe apt install gnupg2 git lsb-release ssl-cert ca-certificates apt-transport-https \ exe apt install gnupg2 git lsb-release ssl-cert ca-certificates apt-transport-https \
tree locate software-properties-common dirmngr screen htop nano net-tools zip unzip \ tree locate software-properties-common dirmngr screen htop nano net-tools zip unzip \
@@ -47,7 +47,7 @@ step_4() {
} }
step_5_info() { echo "Install nginx webserver"; } step_5_info() { echo "Install nginx webserver"; }
step_5_alias() { ALIAS="webserver"; } step_5_alias() { echo "webserver"; }
step_5() { step_5() {
exe apt install nginx exe apt install nginx
endReturn -o $? "Installation of webserver nginx failed" endReturn -o $? "Installation of webserver nginx failed"
@@ -58,7 +58,7 @@ step_5() {
} }
step_6_info() { echo "Install ufw firewall"; } step_6_info() { echo "Install ufw firewall"; }
step_6_alias() { ALIAS="firewall"; } step_6_alias() { echo "firewall"; }
step_6() { step_6() {
exe apt install ufw exe apt install ufw
endReturn -o $? "Installation of firewall ufw failed" endReturn -o $? "Installation of firewall ufw failed"
@@ -76,7 +76,7 @@ step_7() {
} }
step_8_info() { echo "Install $toolName"; } step_8_info() { echo "Install $toolName"; }
step_8_alias() { ALIAS="install"; } step_8_alias() { echo "install"; }
step_8() { step_8() {
exe read -p "Make sure SSL certificates are available. Enter to continue" exe read -p "Make sure SSL certificates are available. Enter to continue"
exe apt install jitsi-meet -y exe apt install jitsi-meet -y
@@ -135,11 +135,11 @@ step_10() {
} }
step_20_info() { echo "Restart all $toolName components"; } step_20_info() { echo "Restart all $toolName components"; }
step_20_alias() { ALIAS="restart"; } step_20_alias() { echo "restart"; }
step_20() { step_20() {
echo " [I] Restart jitsi-meet components" echo " [I] Restart jitsi-meet components"
exep "service prosody restart&& service jicofo restart && service jitsi-videobridge2 restart" exep "service prosody restart&& service jicofo restart && service jitsi-videobridge2 restart"
} }
VERSION_SEQREV=10 readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh

View File

@@ -10,7 +10,7 @@ toolServiceFile="/etc/systemd/system/kodi.service"
toolProfileDir="/home/kodi/.kodi" toolProfileDir="/home/kodi/.kodi"
step_1_info() { echo "Install $toolName via apt"; } step_1_info() { echo "Install $toolName via apt"; }
step_1_alias() { ALIAS="install"; } step_1_alias() { echo "install"; }
step_1() { step_1() {
exe apt update && apt install kodi exe apt update && apt install kodi
} }
@@ -111,7 +111,7 @@ gpu_mem=320"
step_7_info() { echo "Reboot is needed for all changes to take effect"; } step_7_info() { echo "Reboot is needed for all changes to take effect"; }
step_7() { step_7() {
if [ $QUIET -eq "1" ] ; then if quiet ; then
answer=n answer=n
else else
read -p "Reboot now? y/n(default)" answer read -p "Reboot now? y/n(default)" answer
@@ -128,7 +128,7 @@ step_7() {
} }
step_10_info() { echo "Send $toolName logs to syslog"; } step_10_info() { echo "Send $toolName logs to syslog"; }
step_10_alias() { ALIAS="syslog"; } step_10_alias() { echo "syslog"; }
step_10() { step_10() {
addConf -s "$kodiSyslog" "$kodiSyslogLoc" addConf -s "$kodiSyslog" "$kodiSyslogLoc"
exe chmod -f +x "$kodiSyslogLoc" exe chmod -f +x "$kodiSyslogLoc"
@@ -147,9 +147,9 @@ step_11() {
addConf -s "$kodiSyslogService" "$kodiSyslogServiceLoc" addConf -s "$kodiSyslogService" "$kodiSyslogServiceLoc"
echoseq " [I] Consider limiting systemd journal size" info "Consider limiting systemd journal size"
echoseq " [/etc/systemd/journald.conf]" info " [/etc/systemd/journald.conf]"
echoseq " SystemMaxUse=50M" info " SystemMaxUse=50M"
} }
kodiSyslogServiceLoc="/etc/systemd/system/kodisyslog.service" kodiSyslogServiceLoc="/etc/systemd/system/kodisyslog.service"
kodiSyslogService="[Unit] kodiSyslogService="[Unit]
@@ -173,24 +173,24 @@ step_12() {
} }
step_40_info() { echo "Reset music database"; } step_40_info() { echo "Reset music database"; }
step_40_alias() { ALIAS="resetmusic"; } step_40_alias() { echo "resetmusic"; }
step_40() { step_40() {
local i local i
local answer="y" local answer="y"
local musicDb=( "$toolProfileDir/userdata/Database/MyMusic"*.db ) local musicDb=( "$toolProfileDir/userdata/Database/MyMusic"*.db )
echoseq " [W] Erasing:" warning "Erasing:"
for i in ${musicDb[@]}; do for i in ${musicDb[@]}; do
echoseq $i info $i
done done
[ $QUIET -eq 0 ] && read -p "Are you sure? (y)/[n] " answer interactive && read -p "Are you sure? (y)/[n] " answer
case "$answer" in case "$answer" in
y|Y) y|Y)
exe rm ${musicDb[@]};; exe rm ${musicDb[@]};;
*) *)
echoseq " [I] Abort reset" info "Abort reset"
return 1; return 1;
esac esac
} }
VERSION_SEQREV=12 readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh

View File

@@ -12,7 +12,7 @@ CONFIG=0
CONFIG_FILE_NAME="${toolName}.cfg" CONFIG_FILE_NAME="${toolName}.cfg"
CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example" CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
step_config() { seq_config() {
initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE" initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE"
if [ $? -eq 0 ] ; then if [ $? -eq 0 ] ; then
CONFIG=1 CONFIG=1
@@ -20,7 +20,7 @@ step_config() {
} }
step_1_info() { echo "$toolName installation"; } step_1_info() { echo "$toolName installation"; }
step_1_alias() { ALIAS="install"; } step_1_alias() { echo "install"; }
step_1() { step_1() {
exe apt update exe apt update
exe apt install $toolDeps exe apt install $toolDeps
@@ -137,9 +137,9 @@ step_20() {
} }
step_80_info() { echo -e "Some ldap command notes\n"; } step_80_info() { echo -e "Some ldap command notes\n"; }
step_80_alias() { ALIAS="notes"; } step_80_alias() { echo "notes"; }
step_80() { step_80() {
outColor green color green
cat <<NOTES_EOF cat <<NOTES_EOF
# You can also check LDAP Base DN using the ldapsearch command as shown below # You can also check LDAP Base DN using the ldapsearch command as shown below
ldapsearch -H ldapi:/// -x -LLL -s base -b "" namingContexts ldapsearch -H ldapi:/// -x -LLL -s base -b "" namingContexts
@@ -162,7 +162,7 @@ NOTES_EOF
} }
step_100_info() { echo "Add group <GROUP NAME> <USER ID>"; } step_100_info() { echo "Add group <GROUP NAME> <USER ID>"; }
step_100_alias() { ALIAS="addgroup"; } step_100_alias() { echo "addgroup"; }
step_100() { step_100() {
shift shift
local groupName=$1 local groupName=$1
@@ -178,7 +178,7 @@ member: \${memberDn}
" "
step_102_info() { echo "Add user <USER ID> <USER NAME> <USER LASTNAME> <UIDNUMBER> <USER EMAIL> [USER GID]"; } step_102_info() { echo "Add user <USER ID> <USER NAME> <USER LASTNAME> <UIDNUMBER> <USER EMAIL> [USER GID]"; }
step_102_alias() { ALIAS="adduser"; } step_102_alias() { echo "adduser"; }
step_102() { step_102() {
shift shift
userId="$1" userId="$1"
@@ -215,7 +215,7 @@ loginShell: /bin/bash
" "
step_103_info() { echo "(re)Set passwort for <USER>"; } step_103_info() { echo "(re)Set passwort for <USER>"; }
step_103_alias() { ALIAS="passwd"; } step_103_alias() { echo "passwd"; }
step_103() { step_103() {
shift shift
if [ ! -z $1 ] ; then if [ ! -z $1 ] ; then
@@ -224,14 +224,14 @@ step_103() {
elif [ ! -z $userId ] ; then elif [ ! -z $userId ] ; then
echo " [I] Password operation for $userId" echo " [I] Password operation for $userId"
else else
echoerr " [E] No user id provided" error -e "No user id provided"
return 1 return 1
fi fi
exe ldappasswd -H ldapi:/// -x -D "cn=admin,$LDAP_DC" -W -S "uid=$userId,$LDAP_OU_USERS,$LDAP_DC" exe ldappasswd -H ldapi:/// -x -D "cn=admin,$LDAP_DC" -W -S "uid=$userId,$LDAP_OU_USERS,$LDAP_DC"
} }
step_105_info() { echo "Adding <USER ID> to existing group <GROUP NAME>"; } step_105_info() { echo "Adding <USER ID> to existing group <GROUP NAME>"; }
step_105_alias() { ALIAS="user2group"; } step_105_alias() { echo "user2group"; }
step_105() { step_105() {
shift shift
if [ ! -z $1 ] ; then if [ ! -z $1 ] ; then
@@ -240,11 +240,11 @@ step_105() {
elif [ ! -z $userId ] ; then elif [ ! -z $userId ] ; then
echo " [I] User operation for $userId" echo " [I] User operation for $userId"
else else
echoerr " [E] No user id provided" error -e "No user id provided"
return 1 return 1
fi fi
if [ -z $2 ] ; then if [ -z $2 ] ; then
echoerr " [E] No group name provided" error -e "No group name provided"
return 2 return 2
fi fi
local groupName="$2" local groupName="$2"
@@ -266,7 +266,7 @@ member:
" "
step_107_info() { echo "Removing <USER ID> from existing group <GROUP NAME>"; } step_107_info() { echo "Removing <USER ID> from existing group <GROUP NAME>"; }
step_107_alias() { ALIAS="rmusergroup"; } step_107_alias() { echo "rmusergroup"; }
step_107() { step_107() {
shift shift
if [ ! -z $1 ] ; then if [ ! -z $1 ] ; then
@@ -275,11 +275,11 @@ step_107() {
elif [ ! -z $userId ] ; then elif [ ! -z $userId ] ; then
echo " [I] User operation for $userId" echo " [I] User operation for $userId"
else else
echoerr " [E] No user id provided" error -e "No user id provided"
return 1 return 1
fi fi
if [ -z $2 ] ; then if [ -z $2 ] ; then
echoerr " [E] No group name provided" error -e "No group name provided"
return 2 return 2
fi fi
local groupName="$2" local groupName="$2"
@@ -300,11 +300,11 @@ member: uid=\$userId,\$LDAP_OU_USERS,\$LDAP_DC
" "
step_110_info() { echo "Remove group <GROUP NAME>"; } step_110_info() { echo "Remove group <GROUP NAME>"; }
step_110_alias() { ALIAS="rmgroup"; } step_110_alias() { echo "rmgroup"; }
step_110() { step_110() {
shift shift
if [ -z $1 ] ; then if [ -z $1 ] ; then
echoerr " [E] No group name provided" error -e "No group name provided"
return 1 return 1
fi fi
local groupName=$1 local groupName=$1
@@ -315,11 +315,11 @@ changetype: delete
" "
step_112_info() { echo "Remove user <USER ID>"; } step_112_info() { echo "Remove user <USER ID>"; }
step_112_alias() { ALIAS="rmuser"; } step_112_alias() { echo "rmuser"; }
step_112() { step_112() {
shift shift
if [ -z $1 ] ; then if [ -z $1 ] ; then
echoerr " [E] No user id provided" error -e "No user id provided"
return 1 return 1
fi fi
local userName=$1 local userName=$1
@@ -330,7 +330,7 @@ changetype: delete
" "
step_200_info() { echo "List available groups <ADDITONAL ATTRIBUTES...>"; } step_200_info() { echo "List available groups <ADDITONAL ATTRIBUTES...>"; }
step_200_alias() { ALIAS="listgroups"; } step_200_alias() { echo "listgroups"; }
step_200() { step_200() {
shift shift
echo " [I] Available groups:" echo " [I] Available groups:"
@@ -338,7 +338,7 @@ step_200() {
} }
step_202_info() { echo "List available users <ADDITONAL ATTRIBUTES...>"; } step_202_info() { echo "List available users <ADDITONAL ATTRIBUTES...>"; }
step_202_alias() { ALIAS="listusers"; } step_202_alias() { echo "listusers"; }
step_202() { step_202() {
shift shift
echo " [I] Available user:" echo " [I] Available user:"
@@ -364,5 +364,5 @@ variable2LdifEcho() {
echo "$tempLdif" echo "$tempLdif"
} }
VERSION_SEQREV=10 readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh

View File

@@ -23,19 +23,19 @@ SCRIPT_NAME=${SCRIPT_NAME%%.*}
CONFIG_FILE_NAME="${SCRIPT_NAME}.cfg" CONFIG_FILE_NAME="${SCRIPT_NAME}.cfg"
CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example" CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
step_config() { seq_config() {
initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE" initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE"
if [ $? -eq 0 ] ; then if [ $? -eq 0 ] ; then
CONFIG=1 CONFIG=1
echoseq " Install: $LNMS_DIR" info " Install: $LNMS_DIR"
echoseq " Backup: $LNMS_BU_DIR" info " Backup: $LNMS_BU_DIR"
else else
[ $DRY -eq 0 ] && return 1 dry || return 1
fi fi
} }
step_1_info() { echo "Updating apt"; } step_1_info() { echo "Updating apt"; }
step_1_alias() { ALIAS="install"; } step_1_alias() { echo "install"; }
step_1() { step_1() {
exe apt update exe apt update
} }
@@ -94,7 +94,7 @@ step_10() {
step_11_info() { echo "MariaDB configuration"; } step_11_info() { echo "MariaDB configuration"; }
step_11() { step_11() {
outColor green color green
cat << SQLCONF_END cat << SQLCONF_END
Edit or create /etc/mysql/mariadb.conf.d/90-myconfig.cnf and add: Edit or create /etc/mysql/mariadb.conf.d/90-myconfig.cnf and add:
@@ -112,7 +112,7 @@ SQLCONF_END
step_12_info() { echo "PHP fpm/cli timezone configuration"; } step_12_info() { echo "PHP fpm/cli timezone configuration"; }
step_12() { step_12() {
outColor green color green
cat << PHPCONF_END cat << PHPCONF_END
Ensure date.timezone is set in php.ini to your preferred time zone. See http://php.net/manual/en/timezones.php for a list of supported timezones. Valid examples are: "America/New_York", "Europe/Berlin", "Etc/UTC". Ensure date.timezone is set in php.ini to your preferred time zone. See http://php.net/manual/en/timezones.php for a list of supported timezones. Valid examples are: "America/New_York", "Europe/Berlin", "Etc/UTC".
@@ -131,7 +131,7 @@ PHPCONF_END
step_13_info() { echo "PHP fpm configuration"; } step_13_info() { echo "PHP fpm configuration"; }
step_13() { step_13() {
outColor green color green
cat << FPMCONF_END cat << FPMCONF_END
cp /etc/php/7.3/fpm/pool.d/www.conf /etc/php/7.3/fpm/pool.d/librenms.conf cp /etc/php/7.3/fpm/pool.d/www.conf /etc/php/7.3/fpm/pool.d/librenms.conf
@@ -154,7 +154,7 @@ FPMCONF_END
step_14_info() { echo "Nginx configuration"; } step_14_info() { echo "Nginx configuration"; }
step_14() { step_14() {
outColor green color green
cat << NGINXCONF_END cat << NGINXCONF_END
server { server {
@@ -182,15 +182,15 @@ NGINXCONF_END
} }
step_20_info() { echo "Create $toolName cron job"; } step_20_info() { echo "Create $toolName cron job"; }
step_20_alias() { ALIAS="cron"; } step_20_alias() { echo "cron"; }
step_20() { step_20() {
echoseq -n " [I] Creating $lnmsCronLoc ... " info -n " [I] Creating $lnmsCronLoc ... "
exe cp "${LNMS_DIR}/librenms.nonroot.cron" "$lnmsCronLoc" && echoseq "Ok" || echoseq "Nok" exe cp "${LNMS_DIR}/librenms.nonroot.cron" "$lnmsCronLoc" && info "Ok" || info "Nok"
} }
lnmsCronLoc="/etc/cron.d/librenms" lnmsCronLoc="/etc/cron.d/librenms"
step_22_info() { echo "Enable lnms command completion"; } step_22_info() { echo "Enable lnms command completion"; }
step_22_alias() { ALIAS="cmdcompletion"; } step_22_alias() { echo "cmdcompletion"; }
step_22() { step_22() {
exep 'echo -e "#!/bin/bash\nsudo -u '$toolUser' \"'$LNMS_DIR'/lnms\" \"\$@\"" > '"$lnmsLocalBin" exep 'echo -e "#!/bin/bash\nsudo -u '$toolUser' \"'$LNMS_DIR'/lnms\" \"\$@\"" > '"$lnmsLocalBin"
exe chmod 744 "$lnmsLocalBin" exe chmod 744 "$lnmsLocalBin"
@@ -199,44 +199,44 @@ step_22() {
lnmsLocalBin="/usr/local/bin/lnms" lnmsLocalBin="/usr/local/bin/lnms"
step_24_info() { echo "Copy logrotate config"; } step_24_info() { echo "Copy logrotate config"; }
step_24_alias() { ALIAS="logrotate"; } step_24_alias() { echo "logrotate"; }
step_24() { step_24() {
echoseq -n " [I] Creating $lnmsLogrotLoc ... " info -n " [I] Creating $lnmsLogrotLoc ... "
exe cp "${LNMS_DIR}/misc/librenms.logrotate" "$lnmsLogrotLoc" && echoseq "Ok" || echoseq "Nok" exe cp "${LNMS_DIR}/misc/librenms.logrotate" "$lnmsLogrotLoc" && info "Ok" || info "Nok"
} }
lnmsLogrotLoc="/etc/logrotate.d/librenms" lnmsLogrotLoc="/etc/logrotate.d/librenms"
step_26_info() { echo "Install nagios plugin to enable services"; } step_26_info() { echo "Install nagios plugin to enable services"; }
step_26_alias() { ALIAS="services"; } step_26_alias() { echo "services"; }
step_26() { step_26() {
exe apt install monitoring-plugins exe apt install monitoring-plugins
echoseq info
echoseq " [$LNMS_DIR/config.php]" info " [$LNMS_DIR/config.php]"
echoseq "\$config['show_services'] = 1;" info "\$config['show_services'] = 1;"
echoseq info
echoseq " [/etc/cron.d/librenms]" info " [/etc/cron.d/librenms]"
echoseq " */5 * * * * librenms /opt/librenms/services-wrapper.py 1" info " */5 * * * * librenms /opt/librenms/services-wrapper.py 1"
} }
step_30_info() { echo "Backup ${toolName} web direcotry"; } step_30_info() { echo "Backup ${toolName} web direcotry"; }
step_30_alias() { ALIAS="backup"; } step_30_alias() { echo "backup"; }
step_30() { step_30() {
echoseq " [I] Backup install directory to ${LNMS_BU_DIR}" info "Backup install directory to ${LNMS_BU_DIR}"
exe mkdir -p "$LNMS_BU_DIR" exe mkdir -p "$LNMS_BU_DIR"
exep "cd \"${LNMS_DIR}\"/.. && tar czf \"${LNMS_BU_DIR}/\`date +%Y%m%d\`_${toolName}_web.tar.gz\" \"$(basename "$LNMS_DIR")\"" exep "cd \"${LNMS_DIR}\"/.. && tar czf \"${LNMS_BU_DIR}/\`date +%Y%m%d\`_${toolName}_web.tar.gz\" \"$(basename "$LNMS_DIR")\""
} }
step_31_info() { echo "Backup ${toolName} database [daily|monthly(default)]"; } step_31_info() { echo "Backup ${toolName} database [daily|monthly(default)]"; }
step_31_alias() { ALIAS="backupdb"; } step_31_alias() { echo "backupdb"; }
step_31() { step_31() {
case "$2" in case "$2" in
daily|Daily|DAILY) daily|Daily|DAILY)
echoseq " [I] Daily backup..." info "Daily backup..."
exep "mysqldump --single-transaction -u root ${LNMS_DB_NAME} | bzip2 -c > \"${LNMS_BU_DIR}/${toolName}_daily.sql.bz2\"" exep "mysqldump --single-transaction -u root ${LNMS_DB_NAME} | bzip2 -c > \"${LNMS_BU_DIR}/${toolName}_daily.sql.bz2\""
;; ;;
*) *)
exe mkdir -p "$LNMS_BU_DIR/monthly" exe mkdir -p "$LNMS_BU_DIR/monthly"
echoseq " [I] Monthly backup..." info "Monthly backup..."
exep "mysqldump --single-transaction -u root ${LNMS_DB_NAME} | bzip2 -c > \"${LNMS_BU_DIR}/monthly/\`date +%Y%m%d\`_${toolName}.sql.bz2\"" exep "mysqldump --single-transaction -u root ${LNMS_DB_NAME} | bzip2 -c > \"${LNMS_BU_DIR}/monthly/\`date +%Y%m%d\`_${toolName}.sql.bz2\""
;; ;;
esac esac
@@ -258,7 +258,7 @@ STABLE_EOF
} }
step_42_info() { echo "Fix librenms permission"; } step_42_info() { echo "Fix librenms permission"; }
step_42_alias() { ALIAS="fix"; } step_42_alias() { echo "fix"; }
step_42() { step_42() {
exe chown -R ${toolUser}: "$LNMS_DIR" exe chown -R ${toolUser}: "$LNMS_DIR"
exe chmod 771 "${LNMS_DIR}" exe chmod 771 "${LNMS_DIR}"
@@ -275,5 +275,5 @@ fetchPhpVersion() {
} }
# Sequence Revision # Sequence Revision
VERSION_SEQREV=12 readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh

View File

@@ -24,23 +24,23 @@ CONFIG=0
CONFIG_FILE_NAME="${toolName}.cfg" CONFIG_FILE_NAME="${toolName}.cfg"
CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example" CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
step_config() { seq_config() {
if [ $(id -u) -ne 0 ] ; then if [ $(id -u) -ne 0 ] ; then
endReturn -o 1 "No root" endReturn -o 1 "No root"
fi fi
initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE" initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE"
if [ $? -eq 0 ] ; then if [ $? -eq 0 ] ; then
CONFIG=1 CONFIG=1
echoseq " Domain: $MAS_DOMAIN" info " Domain: $MAS_DOMAIN"
elif [ $? -eq 1 ] ; then elif [ $? -eq 1 ] ; then
# Config $CONFIG_FILE_NAME created. Needs modification first # Config $CONFIG_FILE_NAME created. Needs modification first
[ $DRY -eq 0 ] && return -1 dry || return -1
fi fi
return 0 return 0
} }
step_1_info() { echo "Update apt repositories"; } step_1_info() { echo "Update apt repositories"; }
step_1_alias() { ALIAS="install"; } step_1_alias() { echo "install"; }
step_1() { step_1() {
exe apt update exe apt update
} }
@@ -48,7 +48,7 @@ step_1() {
step_2_info() { echo "Install $mtaName"; } step_2_info() { echo "Install $mtaName"; }
step_2() { step_2() {
local aptOpt= local aptOpt=
if [ $QUIET -ne 0 ];then if quiet;then
aptOpt="-y" aptOpt="-y"
else else
read -p "In the following dialog chose \"Internet site\" and enter $MAS_DOMAIN as your domain. Enter to continue..." read -p "In the following dialog chose \"Internet site\" and enter $MAS_DOMAIN as your domain. Enter to continue..."
@@ -74,11 +74,11 @@ step_4() {
step_5_info() { echo "$mtaName enable submission service"; } step_5_info() { echo "$mtaName enable submission service"; }
step_5() { step_5() {
echoseq -e " [I] Copy following lines...\n" info -e " [I] Copy following lines...\n"
exe cat "$mtaConfSubmission" exe cat "$mtaConfSubmission"
exe read -rep $'\nPress Enter to open the '$mtaConfLoc'/master.cf' exe read -rep $'\nPress Enter to open the '$mtaConfLoc'/master.cf'
exe vi $mtaConfLoc/master.cf exe vi $mtaConfLoc/master.cf
exe echoseq exe info
exe cat "$mtaConfSmtps" exe cat "$mtaConfSmtps"
exe read -rep $'\nPress Enter to open the '$mtaConfLoc'/master.cf' exe read -rep $'\nPress Enter to open the '$mtaConfLoc'/master.cf'
exe vi $mtaConfLoc/master.cf exe vi $mtaConfLoc/master.cf
@@ -97,7 +97,7 @@ step_6() {
exe postconf "smtp_tls_mandatory_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1" exe postconf "smtp_tls_mandatory_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1"
exe postconf "smtp_tls_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1" exe postconf "smtp_tls_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1"
echoseq " [I] Restarting $mtaName" info "Restarting $mtaName"
exe service $mtaName restart exe service $mtaName restart
} }
@@ -112,14 +112,14 @@ step_7() {
step_8_info() { echo "Install $mdaName"; } step_8_info() { echo "Install $mdaName"; }
step_8() { step_8() {
exe apt install $mdaDeps exe apt install $mdaDeps
echoseq -e "\n [I] Installed version: $(dovecot --version)" info -e "\n [I] Installed version: $(dovecot --version)"
} }
step_9_info() { step_9_info() {
echo "Configure $mdaName" echo "Configure $mdaName"
} }
step_9() { step_9() {
outColor green color green
cat <<MDA_EOF cat <<MDA_EOF
# Configuring Mailbox Location # Configuring Mailbox Location
[/etc/dovecot/conf.d/10-mail.conf] [/etc/dovecot/conf.d/10-mail.conf]
@@ -205,10 +205,10 @@ step_20_info() {
echo "Install postfixadmin and create mysql database" echo "Install postfixadmin and create mysql database"
echoinfo "Virtualize mailboxes, domains and aliases by using a mysql database" echoinfo "Virtualize mailboxes, domains and aliases by using a mysql database"
} }
step_20_alias() { ALIAS="virtual"; } step_20_alias() { echo "virtual"; }
step_20() { step_20() {
local qOpt= local qOpt=
if [ $QUIET -ne 0 ] ; then if quiet ; then
qOpt="-q" qOpt="-q"
fi fi
exe $WDIR/postfixadmin.sh ${qOpt} install exe $WDIR/postfixadmin.sh ${qOpt} install
@@ -235,7 +235,7 @@ step_21() {
for mtaFile in ${mtaMysqlFiles[@]} for mtaFile in ${mtaMysqlFiles[@]}
do do
eval 'mtaVar=$MAS_'${mtaFile} eval 'mtaVar=$MAS_'${mtaFile}
echoseq " [I] creating ${mtaFile}.cf" info "creating ${mtaFile}.cf"
exe echo -e "$localMysqlUser\n$mtaVar" > "$mtaMysqlConfLoc/${mtaFile}.cf" exe echo -e "$localMysqlUser\n$mtaVar" > "$mtaMysqlConfLoc/${mtaFile}.cf"
done done
@@ -259,7 +259,7 @@ step_22() {
exe postconf -e "virtual_gid_maps = static:$MAS_VIRTUAL_USER_ID" exe postconf -e "virtual_gid_maps = static:$MAS_VIRTUAL_USER_ID"
} }
step_23_info() { echo "Create virtual user $MAS_VIRTUAL_USER and folder $MAS_VIRTUAL_FOLDER_BASE"; } step_23_info() { echo "Create virtual user ${MAS_VIRTUAL_USER:-} and folder ${MAS_VIRTUAL_FOLDER_BASE:-}"; }
step_23() { step_23() {
exe mkdir -p "$MAS_VIRTUAL_FOLDER_BASE" exe mkdir -p "$MAS_VIRTUAL_FOLDER_BASE"
exe groupadd --gid $MAS_VIRTUAL_USER_ID $MAS_VIRTUAL_USER exe groupadd --gid $MAS_VIRTUAL_USER_ID $MAS_VIRTUAL_USER
@@ -267,7 +267,7 @@ step_23() {
exe chown -R ${MAS_VIRTUAL_USER}: "$MAS_VIRTUAL_FOLDER_BASE" exe chown -R ${MAS_VIRTUAL_USER}: "$MAS_VIRTUAL_FOLDER_BASE"
exe chmod -R 770 "$MAS_VIRTUAL_FOLDER_BASE" exe chmod -R 770 "$MAS_VIRTUAL_FOLDER_BASE"
echoseq " [I] Restarting $mtaName" info "Restarting $mtaName"
exe service $mtaName restart exe service $mtaName restart
} }
@@ -335,7 +335,7 @@ step_25() {
} }
step_50_info() { echo "Adding default relay host for sending mails"; } step_50_info() { echo "Adding default relay host for sending mails"; }
step_50_alias() { ALIAS="default_relay"; } step_50_alias() { echo "default_relay"; }
step_50() { step_50() {
if [ ! -f "$saslPassFile" ] ; then if [ ! -f "$saslPassFile" ] ; then
exe postconf -e "relayhost = $MAS_RELAYHOST" exe postconf -e "relayhost = $MAS_RELAYHOST"
@@ -343,7 +343,7 @@ step_50() {
exe postconf -e "smtp_sasl_password_maps = hash:$saslPassFile" exe postconf -e "smtp_sasl_password_maps = hash:$saslPassFile"
addConf -s "$MAS_RELAYHOST $MAS_RELAYUSER:$MAS_RELAYPASS" "$saslPassFile" addConf -s "$MAS_RELAYHOST $MAS_RELAYUSER:$MAS_RELAYPASS" "$saslPassFile"
fi fi
echoseq " [I] Updating $saslPassFile" info "Updating $saslPassFile"
exe postmap "$saslPassFile" exe postmap "$saslPassFile"
} }
saslPassFile="$mtaConfLoc/sasl_password" saslPassFile="$mtaConfLoc/sasl_password"
@@ -352,7 +352,7 @@ step_52_info() {
echo "Grant access for specific (local) hostnames" echo "Grant access for specific (local) hostnames"
echoinfo "Workaround when local clients connect to 25 with different ips (v6)" echoinfo "Workaround when local clients connect to 25 with different ips (v6)"
} }
step_52_alias() { ALIAS="client_access"; } step_52_alias() { echo "client_access"; }
step_52() { step_52() {
if [ ! -f "$mtaClientAccessLoc" ] ; then if [ ! -f "$mtaClientAccessLoc" ] ; then
echo " [I] Generating $mtaClientAccessLoc" echo " [I] Generating $mtaClientAccessLoc"
@@ -362,7 +362,7 @@ step_52() {
echo " smtpd_relay_restrictions =" echo " smtpd_relay_restrictions ="
echo " check_client_access hash:$mtaClientAccessLoc" echo " check_client_access hash:$mtaClientAccessLoc"
fi fi
echoseq " [I] Updating $mtaClientAccessLoc" info "Updating $mtaClientAccessLoc"
exe postmap "$mtaClientAccessLoc" exe postmap "$mtaClientAccessLoc"
} }
mtaClientAccessLoc="$mtaConfLoc/client_access" mtaClientAccessLoc="$mtaConfLoc/client_access"
@@ -370,26 +370,26 @@ mtaClientAccessLoc="$mtaConfLoc/client_access"
step_54_info() { step_54_info() {
echo "Deny recipient access for listed mail addresses" echo "Deny recipient access for listed mail addresses"
} }
step_54_alias() { ALIAS="recipient_access"; } step_54_alias() { echo "recipient_access"; }
step_54() { step_54() {
if [ ! -f "$mtaRecipientAccessLoc" ] ; then if [ ! -f "$mtaRecipientAccessLoc" ] ; then
echoseq " [I] Generating $mtaRecipientAccessLoc" info "Generating $mtaRecipientAccessLoc"
exep "echo \"# unwanted@${MAS_DOMAIN} 550 No mailbox. Nothing to see here.\" > \"$mtaRecipientAccessLoc\"" exep "echo \"# unwanted@${MAS_DOMAIN} 550 No mailbox. Nothing to see here.\" > \"$mtaRecipientAccessLoc\""
echo " [I] Don't forget to add the following" echo " [I] Don't forget to add the following"
echo " [$mtaConfLoc/main.cf]" echo " [$mtaConfLoc/main.cf]"
echo " smtpd_recipient_restrictions =" echo " smtpd_recipient_restrictions ="
echo " check_recipient_access hash:$mtaRecipientAccessLoc" echo " check_recipient_access hash:$mtaRecipientAccessLoc"
fi fi
echoseq " [I] Updating $mtaRecipientAccessLoc" info "Updating $mtaRecipientAccessLoc"
exe postmap "$mtaRecipientAccessLoc" exe postmap "$mtaRecipientAccessLoc"
} }
mtaRecipientAccessLoc="$mtaConfLoc/recipient_access" mtaRecipientAccessLoc="$mtaConfLoc/recipient_access"
step_56_info() { echo "Add sender dependant relay with authentication"; } step_56_info() { echo "Add sender dependant relay with authentication"; }
step_56_alias() { ALIAS="sender_relay"; } step_56_alias() { echo "sender_relay"; }
step_56() { step_56() {
if [ ! -f "$mtaSenderRelayLoc" ] ; then if [ ! -f "$mtaSenderRelayLoc" ] ; then
echoseq " [I] Generating $mtaSenderRelayLoc" info "Generating $mtaSenderRelayLoc"
exep "echo \"# user@extern.com smtp:[mail.extern.com]:587\" > \"$mtaSenderRelayLoc\"" exep "echo \"# user@extern.com smtp:[mail.extern.com]:587\" > \"$mtaSenderRelayLoc\""
exe postconf -e "smtp_sender_dependent_authentication = yes" exe postconf -e "smtp_sender_dependent_authentication = yes"
exe postconf -e "sender_dependent_relayhost_maps = hash:$mtaSenderRelayLoc" exe postconf -e "sender_dependent_relayhost_maps = hash:$mtaSenderRelayLoc"
@@ -402,7 +402,7 @@ step_56() {
echo " user@extern.com username:passwort" echo " user@extern.com username:passwort"
echo " postmap $saslPassFile" echo " postmap $saslPassFile"
fi fi
echoseq " [I] Updating $mtaSenderRelayLoc" info "Updating $mtaSenderRelayLoc"
exe postmap "$mtaSenderRelayLoc" exe postmap "$mtaSenderRelayLoc"
exe postmap "$saslPassFile" exe postmap "$saslPassFile"
} }
@@ -412,7 +412,7 @@ step_100_info() {
echo "Send testmail [-u SYSTEMUSER | -f FROM] [TO]" echo "Send testmail [-u SYSTEMUSER | -f FROM] [TO]"
echoinfo "Send as current user to postmaster@\$MAS_DOMAIN by default" echoinfo "Send as current user to postmaster@\$MAS_DOMAIN by default"
} }
step_100_alias() { ALIAS="test"; } step_100_alias() { echo "test"; }
step_100() { step_100() {
shift shift
local arg local arg
@@ -443,7 +443,7 @@ step_100() {
} }
step_102_info() { echo "Show mail queue"; } step_102_info() { echo "Show mail queue"; }
step_102_alias() { ALIAS="showqueue"; } step_102_alias() { echo "showqueue"; }
step_102() { step_102() {
exe sendmail -bp exe sendmail -bp
} }
@@ -452,7 +452,7 @@ step_104_info() {
echo "Delete mail queue [ID]" echo "Delete mail queue [ID]"
echoinfo "Delete all queued mails if [ID] is empty" echoinfo "Delete all queued mails if [ID] is empty"
} }
step_104_alias() { ALIAS="delqueue"; } step_104_alias() { echo "delqueue"; }
step_104() { step_104() {
shift shift
local msgId="ALL" local msgId="ALL"
@@ -462,5 +462,5 @@ step_104() {
exe postsuper -d "$msgId" exe postsuper -d "$msgId"
} }
VERSION_SEQREV=12 readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh

View File

@@ -17,7 +17,7 @@ SCRIPT_NAME=${SCRIPT_FILE%%.*}
CONFIG_FILE_NAME="${SCRIPT_NAME}.cfg" CONFIG_FILE_NAME="${SCRIPT_NAME}.cfg"
CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example" CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
step_config() { seq_config() {
## or to use sequencer api with global config file: ## or to use sequencer api with global config file:
initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE" initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE"
@@ -25,21 +25,21 @@ step_config() {
CONFIG=1 CONFIG=1
else else
# End if no configuration file exists # End if no configuration file exists
[ $DRY -eq 0 ] && return -1 dry || return -1
fi fi
toolCredentialDir="$MACO_BASE_DIR/.config/matrix-commander" toolCredentialDir="$MACO_BASE_DIR/.config/matrix-commander"
toolEncStoreDir="$MACO_BASE_DIR/.local/share/matrix-commander" toolEncStoreDir="$MACO_BASE_DIR/.local/share/matrix-commander"
## Apt cmdline option to suppress user interaction ## Apt cmdline option to suppress user interaction
[ $QUIET -ne 0 ] && APTOPT="-y" quiet && APTOPT="-y"
## Return of non zero value will abort the sequence ## Return of non zero value will abort the sequence
return 0 return 0
} }
step_1_info() { echo "Run $toolName"; } step_1_info() { echo "Run $toolName"; }
step_1_alias() { ALIAS="run"; } step_1_alias() { echo "run"; }
step_1() { step_1() {
shift shift
exe "$MACO_BASE_DIR/bin/python3" "$MACO_DIR/matrix-commander.py" "$@" exe "$MACO_BASE_DIR/bin/python3" "$MACO_DIR/matrix-commander.py" "$@"
@@ -50,14 +50,14 @@ step_3_info() {
echo "Send message" echo "Send message"
echoinfo "Each string ([MESSAGE]) is send as separate message" echoinfo "Each string ([MESSAGE]) is send as separate message"
} }
step_3_alias() { ALIAS="message"; } step_3_alias() { echo "message"; }
step_3() { step_3() {
shift shift
step run -m "$@" step run -m "$@"
} }
step_50_info() { echo "Install $toolName dependencies"; } step_50_info() { echo "Install $toolName dependencies"; }
step_50_alias() { ALIAS="install"; } step_50_alias() { echo "install"; }
step_50() { step_50() {
apt install $toolDeps $APTOPT apt install $toolDeps $APTOPT
} }
@@ -91,7 +91,7 @@ dbus-python
notify2 notify2
NOTES_END NOTES_END
exe read -p "Enter to continue..." exe read -p "Enter to continue..."
exe "$DEFAULT_EDITOR_SYSTEM" "$MACO_DIR/requirements.txt" exe editor "$MACO_DIR/requirements.txt"
exe sudo -u $MACO_USER ${MACO_BASE_DIR}/bin/pip install -r ${MACO_DIR}/requirements.txt exe sudo -u $MACO_USER ${MACO_BASE_DIR}/bin/pip install -r ${MACO_DIR}/requirements.txt
} }
@@ -99,7 +99,7 @@ step_55_info() {
echo "Create systemd service for $toolName" echo "Create systemd service for $toolName"
echoinfo "(Make sure to modify the service content in the step configuration)" echoinfo "(Make sure to modify the service content in the step configuration)"
} }
step_55_alias() { ALIAS="service"; } step_55_alias() { echo "service"; }
step_55() { step_55() {
local macommanderServiceLoc="/etc/systemd/system/matrix-commander.service" local macommanderServiceLoc="/etc/systemd/system/matrix-commander.service"
addConf -s "$MACO_SERVICE" "$macommanderServiceLoc" addConf -s "$MACO_SERVICE" "$macommanderServiceLoc"
@@ -107,19 +107,19 @@ step_55() {
} }
step_57_info() { echo "First run to create credential file and encryption store"; } step_57_info() { echo "First run to create credential file and encryption store"; }
step_57_alias() { ALIAS="firstrun"; } step_57_alias() { echo "firstrun"; }
step_57() { step_57() {
exe sudo -u "$MACO_USER" mkdir -p "$toolCredentialDir" "$toolEncStoreDir" exe sudo -u "$MACO_USER" mkdir -p "$toolCredentialDir" "$toolEncStoreDir"
exe cd "$toolCredentialDir" exe cd "$toolCredentialDir"
step run step run
[ -e ./store ] && exe mv store "$toolEncStoreDir" [ -e ./store ] && exe mv store "$toolEncStoreDir"
echoseq " [I] use \"$SEQ_NAME run --verify\" to verify against an existing session (like Element)" info "use \"$SEQ_NAME run --verify\" to verify against an existing session (like Element)"
} }
step_60_alias() { ALIAS="notes"; } step_60_alias() { echo "notes"; }
step_60() { step_60() {
outColor green color green
cat <<NOTES_EOF cat <<NOTES_EOF
# Verify matrix-commander "device" # Verify matrix-commander "device"
@@ -140,5 +140,5 @@ credentials.json - $MACO_BASE_DIR/.config/matrix-commander/credentials.json
NOTES_EOF NOTES_EOF
} }
VERSION_SEQREV=15 readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh

View File

@@ -14,36 +14,36 @@ SCRIPT_NAME=${SCRIPT_FILE%%.*}
CONFIG_FILE_NAME="${SCRIPT_NAME}.cfg" CONFIG_FILE_NAME="${SCRIPT_NAME}.cfg"
CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example" CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
step_config() { seq_config() {
## or to use sequencer api with global config file: ## or to use sequencer api with global config file:
initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE" initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE"
if [ $? -eq 0 ] ; then if [ $? -eq 0 ] ; then
CONFIG=1 CONFIG=1
else else
# End if no configuration file exists # End if no configuration file exists
[ $DRY -eq 0 ] && return -1 dry || return -1
fi fi
## Apt cmdline option to suppress user interaction ## Apt cmdline option to suppress user interaction
[ $QUIET -ne 0 ] && APTOPT="-y" quiet && APTOPT="-y"
echoerr " [W] $SCRIPT_NAME is still in alpha stage" warning -e "$SCRIPT_NAME is still in alpha stage"
echoerr " TODO: - systemd script" error -e " TODO: - systemd script"
echoerr " - initial config creation" error -e " - initial config creation"
## Return of non zero value will abort the sequence ## Return of non zero value will abort the sequence
return 0 return 0
} }
step_1_info() { echo "Install $toolName dependencies"; } step_1_info() { echo "Install $toolName dependencies"; }
step_1_alias() { ALIAS="install"; } step_1_alias() { echo "install"; }
step_1() { step_1() {
exep curl -sL https://deb.nodesource.com/setup_12.x \| bash - exep curl -sL https://deb.nodesource.com/setup_12.x \| bash -
exe apt install $toolAptDeps $APTOPT exe apt install $toolAptDeps $APTOPT
} }
step_2_info() { echo "Setup and build"; } step_2_info() { echo "Setup and build"; }
step_2_alias() { ALIAS="setup"; } step_2_alias() { echo "setup"; }
step_2() { step_2() {
if [ ! -e "$SEQ_DIMENSION_DIR" ]; then if [ ! -e "$SEQ_DIMENSION_DIR" ]; then
exe mkdir -p "$SEQ_DIMENSION_DIR" exe mkdir -p "$SEQ_DIMENSION_DIR"
@@ -62,10 +62,10 @@ step_2() {
} }
step_10_info() { echo "Start $toolName"; } step_10_info() { echo "Start $toolName"; }
step_10_alias() { ALIAS="start"; } step_10_alias() { echo "start"; }
step_10() { step_10() {
if [ ! -e "$SEQ_DIMENSION_DIR" ]; then if [ ! -e "$SEQ_DIMENSION_DIR" ]; then
echoerr " [E] $toolName not found ad $SEQ_DIMENSION_DIR" error -e "$toolName not found ad $SEQ_DIMENSION_DIR"
return 1; return 1;
fi fi
exe cd "$SEQ_DIMENSION_DIR" exe cd "$SEQ_DIMENSION_DIR"
@@ -75,5 +75,5 @@ step_10() {
exep NODE_ENV=production node build/app/index.js exep NODE_ENV=production node build/app/index.js
} }
VERSION_SEQREV=15 readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh

View File

@@ -25,9 +25,9 @@ CONFIG=0
CONFIG_FILE_NAME="matrix.cfg" CONFIG_FILE_NAME="matrix.cfg"
CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example" CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
step_config() { seq_config() {
if [ "$(which lsb_release)" == "" ] ; then if [ "$(which lsb_release)" == "" ] ; then
echoerr " [W] Cannot detect OS. Assuming Raspberry Pi OS" warning -e "Cannot detect OS. Assuming Raspberry Pi OS"
osName="Raspbian" osName="Raspbian"
else else
osName=$(lsb_release -is) osName=$(lsb_release -is)
@@ -35,7 +35,7 @@ step_config() {
fi fi
if [ "$osName" == "" ] ; then if [ "$osName" == "" ] ; then
echoerr " [W] Error dedecting OS. Assuming Raspberry Pi OS" warning -e "Error dedecting OS. Assuming Raspberry Pi OS"
osName="Raspbian" osName="Raspbian"
fi fi
@@ -55,14 +55,14 @@ step_config() {
} }
step_1_info() { echo "Installing $toolName dependencies"; } step_1_info() { echo "Installing $toolName dependencies"; }
step_1_alias() { ALIAS="install"; } step_1_alias() { echo "install"; }
step_1() { step_1() {
local aptOption= local aptOption=
exe apt update exe apt update
endReturn -o $? "Updating apt repositories failed" endReturn -o $? "Updating apt repositories failed"
if [ $QUIET -ne 0 ] ; then if quiet ; then
aptOption="-y" aptOption="-y"
else else
aptOption="" aptOption=""
@@ -75,7 +75,7 @@ step_1() {
} }
step_2_info() { echo "Create postgres database for $toolName"; } step_2_info() { echo "Create postgres database for $toolName"; }
step_2_alias() { ALIAS="createdb"; } step_2_alias() { echo "createdb"; }
step_2() { step_2() {
readDatabaseInfos readDatabaseInfos
@@ -92,7 +92,7 @@ step_3() {
} }
step_4_info() { echo "Install $toolName"; } step_4_info() { echo "Install $toolName"; }
step_4_alias() { ALIAS="virtualenv"; } step_4_alias() { echo "virtualenv"; }
step_4() { step_4() {
exe mkdir -p "$MATRIX_HOME" exe mkdir -p "$MATRIX_HOME"
exe virtualenv -p python3 "${MATRIX_HOME}/env" exe virtualenv -p python3 "${MATRIX_HOME}/env"
@@ -104,7 +104,7 @@ step_4() {
} }
step_5_info() { echo "Create default configuration and folder structure"; } step_5_info() { echo "Create default configuration and folder structure"; }
step_5_alias() { ALIAS="defaultconfig"; } step_5_alias() { echo "defaultconfig"; }
step_5() { step_5() {
# Create default configuration # Create default configuration
exe python3 -m synapse.app.homeserver --server-name "$MATRIX_DOMAIN" --config-path homeserver.yaml --generate-config --report-stats=no exe python3 -m synapse.app.homeserver --server-name "$MATRIX_DOMAIN" --config-path homeserver.yaml --generate-config --report-stats=no
@@ -124,7 +124,7 @@ step_6() {
} }
step_7_info() { echo "Create $toolName systemd service"; } step_7_info() { echo "Create $toolName systemd service"; }
step_7_alias() { ALIAS="systemd"; } step_7_alias() { echo "systemd"; }
step_7() { step_7() {
# eval needed to expand sourced configuration variables # eval needed to expand sourced configuration variables
local localService=`eval "echo \"$toolService\""` local localService=`eval "echo \"$toolService\""`
@@ -156,13 +156,13 @@ WantedBy=multi-user.target"
step_10_info() { step_10_info() {
echo -n "Upgrade $toolName installation" echo -n "Upgrade $toolName installation"
if [ $CONTEXT_HELP -eq 0 ] ; then if ! contextHelp ; then
echo " at $MATRIX_HOME" echo " at $MATRIX_HOME"
else else
echo echo
fi fi
} }
step_10_alias() { ALIAS="upgrade"; } step_10_alias() { echo "upgrade"; }
step_10() { step_10() {
echo " [I] Upgrading $toolName" echo " [I] Upgrading $toolName"
exe source "${MATRIX_HOME}/env/bin/activate" exe source "${MATRIX_HOME}/env/bin/activate"
@@ -180,7 +180,7 @@ step_10() {
} }
step_12_info() { echo "Restart $toolName systemd service"; echo; } step_12_info() { echo "Restart $toolName systemd service"; echo; }
step_12_alias() { ALIAS="restart"; } step_12_alias() { echo "restart"; }
step_12() { step_12() {
exe service ${toolServiceName} restart exe service ${toolServiceName} restart
} }
@@ -189,7 +189,7 @@ step_14_info() {
echoinfoArgs "[IP]:8008" echoinfoArgs "[IP]:8008"
echo "Show $toolName version" echo "Show $toolName version"
} }
step_14_alias() { ALIAS="version"; } step_14_alias() { echo "version"; }
step_14() { step_14() {
local synapseIP=localhost local synapseIP=localhost
shift shift
@@ -208,7 +208,7 @@ step_16_info() {
echoinfo "[OPTION]" echoinfo "[OPTION]"
echoinfo " -r : Raw json output" echoinfo " -r : Raw json output"
} }
step_16_alias() { ALIAS="listuser"; } step_16_alias() { echo "listuser"; }
step_16() { step_16() {
adminTokenCheck adminTokenCheck
endReturn -o $? "Admin token needed. Check $SEQ_CONFIG_FILE" endReturn -o $? "Admin token needed. Check $SEQ_CONFIG_FILE"
@@ -238,7 +238,7 @@ step_16() {
} }
step_18_info() { echo "Create new user"; } step_18_info() { echo "Create new user"; }
step_18_alias() { ALIAS="adduser"; } step_18_alias() { echo "adduser"; }
step_18() { step_18() {
exe /opt/synapse/env/bin/register_new_matrix_user -c "$MATRIX_HOME/homeserver.yaml" $toolUrlLocal exe /opt/synapse/env/bin/register_new_matrix_user -c "$MATRIX_HOME/homeserver.yaml" $toolUrlLocal
} }
@@ -247,9 +247,9 @@ step_20_info() {
shift shift
echoinfoArgs "[USER NAME]" echoinfoArgs "[USER NAME]"
echo -n "Reset user password" echo -n "Reset user password"
[ $CONTEXT_EXE -ne 0 ] && echoinfo " for $1" || echo contextExe && echoinfo " for $1" || echo
} }
step_20_alias() { ALIAS="resetpw"; } step_20_alias() { echo "resetpw"; }
step_20() { step_20() {
shift shift
local user= local user=
@@ -261,7 +261,7 @@ step_20() {
fi fi
if [ -z $user ]; then if [ -z $user ]; then
echoerr "No user name provided" error -e "No user name provided"
return 1 return 1
fi fi
local pw="$("${MATRIX_HOME}/${synapseHashTool}")" local pw="$("${MATRIX_HOME}/${synapseHashTool}")"
@@ -277,7 +277,7 @@ step_22_info() {
echoinfo "[OPTION]" echoinfo "[OPTION]"
echoinfo " -r : Raw json output" echoinfo " -r : Raw json output"
} }
step_22_alias() { ALIAS="listrooms"; } step_22_alias() { echo "listrooms"; }
step_22() { step_22() {
adminTokenCheck adminTokenCheck
endReturn -o $? "Admin token needed. Check $SEQ_CONFIG_FILE" endReturn -o $? "Admin token needed. Check $SEQ_CONFIG_FILE"
@@ -313,7 +313,7 @@ step_24_info() {
echoinfo "[OPTION]" echoinfo "[OPTION]"
echoinfo " -r : Raw json output" echoinfo " -r : Raw json output"
} }
step_24_alias() { ALIAS="listmember"; } step_24_alias() { echo "listmember"; }
step_24() { step_24() {
adminTokenCheck adminTokenCheck
endReturn -o $? "Admin token needed. Check $SEQ_CONFIG_FILE" endReturn -o $? "Admin token needed. Check $SEQ_CONFIG_FILE"
@@ -353,7 +353,7 @@ step_26_info() {
echo "Delete rooms without local users" echo "Delete rooms without local users"
echoinfo " [IP] : default is localhost" echoinfo " [IP] : default is localhost"
} }
step_26_alias() { ALIAS="purge"; } step_26_alias() { echo "purge"; }
step_26() { step_26() {
adminTokenCheck adminTokenCheck
endReturn -o $? "Admin token needed. Check $SEQ_CONFIG_FILE" endReturn -o $? "Admin token needed. Check $SEQ_CONFIG_FILE"
@@ -384,7 +384,7 @@ step_28_info() {
echoinfoArgs "<ROOM ID> [IP]:8008" echoinfoArgs "<ROOM ID> [IP]:8008"
echo "Delete room" echo "Delete room"
} }
step_28_alias() { ALIAS="deleteroom"; } step_28_alias() { echo "deleteroom"; }
step_28() { step_28() {
adminTokenCheck adminTokenCheck
endReturn -o $? "Admin token needed. Check $SEQ_CONFIG_FILE" endReturn -o $? "Admin token needed. Check $SEQ_CONFIG_FILE"
@@ -430,13 +430,13 @@ EOF
} }
step_30_info() { echoinfoArgs "[DATABASE]"; echo "Debloat postgres"; echo; } step_30_info() { echoinfoArgs "[DATABASE]"; echo "Debloat postgres"; echo; }
step_30_alias() { ALIAS="debloat"; } step_30_alias() { echo "debloat"; }
step_30() { step_30() {
shift shift
local pgVerboseReId=" (VERBOSE) " local pgVerboseReId=" (VERBOSE) "
local pgVerboseVac=" VERBOSE" local pgVerboseVac=" VERBOSE"
if [ $VERBOSE == 0 ]; then if ! verbose; then
pgVerboseReId=" " pgVerboseReId=" "
pgVerboseVac="" pgVerboseVac=""
fi fi
@@ -460,7 +460,7 @@ step_30() {
} }
step_50_info() { echo "Drop postgres database for $toolName"; } step_50_info() { echo "Drop postgres database for $toolName"; }
step_50_alias() { ALIAS="dropdb"; } step_50_alias() { echo "dropdb"; }
step_50() { step_50() {
readDatabaseInfos readDatabaseInfos
@@ -469,7 +469,7 @@ step_50() {
} }
step_52_info() { echo "Backup postgres database"; } step_52_info() { echo "Backup postgres database"; }
step_52_alias() { ALIAS="backupdb"; } step_52_alias() { echo "backupdb"; }
step_52() { step_52() {
local DELYEAR=$(($(date +%Y)-2)) local DELYEAR=$(($(date +%Y)-2))
if [ ! -s ~/.pgpass ] ; then if [ ! -s ~/.pgpass ] ; then
@@ -484,7 +484,7 @@ toolDbBackupFolder=/root/backupdb
step_54_info() { echo "Postgres database restore"; } step_54_info() { echo "Postgres database restore"; }
step_54_alias() { ALIAS="restoredb"; } step_54_alias() { echo "restoredb"; }
step_54() { step_54() {
echo " [I] Postgres database restore procedure" echo " [I] Postgres database restore procedure"
echo "1. Create a empty postgres database first (step 4)" echo "1. Create a empty postgres database first (step 4)"
@@ -502,7 +502,7 @@ step_54() {
} }
step_56_info() { echo "$toolName migration notes"; } step_56_info() { echo "$toolName migration notes"; }
step_56_alias() { ALIAS="migrate"; } step_56_alias() { echo "migrate"; }
step_56() { step_56() {
echo " [I] Backup database" echo " [I] Backup database"
echo " ./postgres.sh backupdb synapse" echo " ./postgres.sh backupdb synapse"
@@ -552,12 +552,12 @@ toolScript() {
# End step if no admin access token is configured # End step if no admin access token is configured
adminTokenCheck() { adminTokenCheck() {
if [ -z "$MATRIX_ACCESS" ] ; then if [ -z "$MATRIX_ACCESS" ] ; then
[ $QUIET -eq 0 ] && read -s -p "Please enter admin access tocken: " MATRIX_ACCESS interactive && read -s -p "Please enter admin access tocken: " MATRIX_ACCESS
# return 1 if it is still empty # return 1 if it is still empty
[ -z "$MATRIX_ACCESS" ] && return 1 [ -z "$MATRIX_ACCESS" ] && return 1
fi fi
return 0 return 0
} }
VERSION_SEQREV=15 readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh

View File

@@ -36,9 +36,9 @@ toolServiceLoc="/etc/systemd/system/${toolName}.service"
readonly goDir="/usr/local/go" readonly goDir="/usr/local/go"
readonly goDownLoc="/tmp/go.tar.gz" readonly goDownLoc="/tmp/go.tar.gz"
step_config() { seq_config() {
if [ -z $toolVersion ] ; then if [ -z $toolVersion ] ; then
echoerr " [E] Couldn't determine latest version of $toolName" error -e "Couldn't determine latest version of $toolName"
fi fi
} }
@@ -46,7 +46,7 @@ step_1_info() {
echo "Downloading $toolName version ${toolVersion} to ${toolLoc} from:" echo "Downloading $toolName version ${toolVersion} to ${toolLoc} from:"
echoinfo "$toolDownload" echoinfo "$toolDownload"
} }
step_1_alias() { ALIAS="install"; } step_1_alias() { echo "install"; }
step_1() { step_1() {
step upgrade step upgrade
endReturn -o $? "Download failed" endReturn -o $? "Download failed"
@@ -74,9 +74,9 @@ step_4() {
} }
step_5_info() { echo "Show configuration notes"; } step_5_info() { echo "Show configuration notes"; }
step_5_alias() { ALIAS="notes"; } step_5_alias() { echo "notes"; }
step_5() { step_5() {
outColor green color green
cat <<NOTES_END cat <<NOTES_END
# Sample configuration # Sample configuration
@@ -87,7 +87,7 @@ NOTES_END
} }
step_10_info() { echo "Backup existing executable"; } step_10_info() { echo "Backup existing executable"; }
step_10_alias() { ALIAS="backup"; } step_10_alias() { echo "backup"; }
step_10() { step_10() {
if [ -f "$toolLoc" ] ; then if [ -f "$toolLoc" ] ; then
local toolBackup= local toolBackup=
@@ -97,8 +97,8 @@ step_10() {
toolBackup="${toolDir}/${toolName}_bu" toolBackup="${toolDir}/${toolName}_bu"
fi fi
exe service ${toolName} stop >>/dev/null 2>&1 exe service ${toolName} stop >>/dev/null 2>&1
echoseq -n " [I] Backing up existing executable to ${toolBackup}..." info -n " [I] Backing up existing executable to ${toolBackup}..."
exe cp -ar "$toolLoc" "$toolBackup" && echoseq "ok" exe cp -ar "$toolLoc" "$toolBackup" && info "ok"
fi fi
} }
versionNow=$([ ! -z $(which ${toolName}) ] && ${toolName} --version | sed 's/.*version: \([0-9.]\+\).*/\1/') versionNow=$([ ! -z $(which ${toolName}) ] && ${toolName} --version | sed 's/.*version: \([0-9.]\+\).*/\1/')
@@ -116,7 +116,7 @@ step_12_info() {
fi fi
echo echo
} }
step_12_alias() { ALIAS="upgrade"; } step_12_alias() { echo "upgrade"; }
step_12() { step_12() {
step backup step backup
exe wget -O "$toolLoc" $toolDownload exe wget -O "$toolLoc" $toolDownload
@@ -134,7 +134,7 @@ step_30_info() {
echoinfo " --arch, -a : armhf(default), arm64" echoinfo " --arch, -a : armhf(default), arm64"
echoinfo " CPU architecture for downloading go sources" echoinfo " CPU architecture for downloading go sources"
} }
step_30_alias() { ALIAS="build"; } step_30_alias() { echo "build"; }
step_30() { step_30() {
shift shift
local goVer="$(curl --silent -L https://go.dev/doc/devel/release | \ local goVer="$(curl --silent -L https://go.dev/doc/devel/release | \
@@ -151,7 +151,7 @@ step_30() {
# Download latest go # Download latest go
if [ ! -e "${goDir}" ] ; then if [ ! -e "${goDir}" ] ; then
echoseq "Download go${goVer}: ${goDownUrl}" info "Download go${goVer}: ${goDownUrl}"
exe wget -O "${goDownLoc}" ${goDownUrl} exe wget -O "${goDownLoc}" ${goDownUrl}
endReturn -o $? "Download ${goVer} failed" endReturn -o $? "Download ${goVer} failed"
exe tar -C "$(dirname -- "${goDir}")" -xzf "${goDownLoc}" exe tar -C "$(dirname -- "${goDir}")" -xzf "${goDownLoc}"
@@ -193,7 +193,7 @@ step_32() {
} }
# Sequence Revision # Sequence Revision
VERSION_SEQREV=15 readonly sqr_minVersion=16
# Path to sequencer # Path to sequencer
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh

View File

@@ -20,7 +20,7 @@ SCRIPT_NAME=${SCRIPT_FILE%%.*}
CONFIG_FILE_NAME="${SCRIPT_NAME}.cfg" CONFIG_FILE_NAME="${SCRIPT_NAME}.cfg"
CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example" CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
step_config() { seq_config() {
## or to use sequencer api with global config file: ## or to use sequencer api with global config file:
initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE" initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE"
if [ $? -eq 0 ] ; then if [ $? -eq 0 ] ; then
@@ -30,18 +30,18 @@ step_config() {
postgresPass="$MAYAN_DBPASS" postgresPass="$MAYAN_DBPASS"
else else
# End if no configuration file exists # End if no configuration file exists
[ $DRY -eq 0 ] && return -1 dry || return -1
fi fi
## Apt cmdline option to suppress user interaction ## Apt cmdline option to suppress user interaction
[ $QUIET -ne 0 ] && APTOPT="-y" quiet && APTOPT="-y"
## Return of non zero value will abort the sequence ## Return of non zero value will abort the sequence
return 0 return 0
} }
step_1_info() { echo "Install libreoffice without gui"; } step_1_info() { echo "Install libreoffice without gui"; }
step_1_alias() { ALIAS="install"; } step_1_alias() { echo "install"; }
step_1() { step_1() {
exe apt update exe apt update
exe apt --no-install-recommends install libreoffice -y exe apt --no-install-recommends install libreoffice -y
@@ -69,7 +69,7 @@ step_3() {
} }
step_4_info() { echo "Create postgres database for $toolName"; } step_4_info() { echo "Create postgres database for $toolName"; }
step_4_alias() { ALIAS="createdb"; } step_4_alias() { echo "createdb"; }
step_4() { step_4() {
readDatabaseInfos readDatabaseInfos
@@ -91,7 +91,7 @@ step_5() {
} }
step_6_info() { echo "Supervisord configuration for $toolName"; } step_6_info() { echo "Supervisord configuration for $toolName"; }
step_6_alias() { ALIAS="supervisorconf"; } step_6_alias() { echo "supervisorconf"; }
step_6() { step_6() {
addConf -c "" "$supervisordConfLoc" addConf -c "" "$supervisordConfLoc"
toolScript "platformtemplate supervisord > ${supervisordConfLoc}" toolScript "platformtemplate supervisord > ${supervisordConfLoc}"
@@ -126,7 +126,7 @@ step_10_info() {
echoinfo " super : update also supervisor configuration" echoinfo " super : update also supervisor configuration"
echoinfo " (manual redis password update may be needed)" echoinfo " (manual redis password update may be needed)"
} }
step_10_alias() { ALIAS="upgrade"; } step_10_alias() { echo "upgrade"; }
step_10() { step_10() {
shift # don't need the step number shift # don't need the step number
step upgradepip step upgradepip
@@ -149,12 +149,12 @@ uninstallRemovalsLoc="/tmp/removals.txt"
step_13_info() { echo "$toolName management script"; } step_13_info() { echo "$toolName management script"; }
step_13_alias() { ALIAS="manage"; } step_13_alias() { echo "manage"; }
step_13() { step_13() {
shift shift
if [ -z "$1" ] || [ "$1" == "" ] ; then if [ -z "$1" ] || [ "$1" == "" ] ; then
echo -n "Command (empty for help): " echo -n "Command (empty for help): "
if [ $DRY != 0 ]; then if dry; then
echo " dryrun" echo " dryrun"
else else
read command read command
@@ -166,14 +166,14 @@ step_13() {
} }
step_15_info() { echo "Upgrade python pip"; } step_15_info() { echo "Upgrade python pip"; }
step_15_alias() { ALIAS="upgradepip"; } step_15_alias() { echo "upgradepip"; }
step_15() step_15()
{ {
exe ${toolRoot}/bin/pip install --upgrade pip exe ${toolRoot}/bin/pip install --upgrade pip
} }
step_20_info() { echo "Backup postgres database to media folder"; } step_20_info() { echo "Backup postgres database to media folder"; }
step_20_alias() { ALIAS="backupdb"; } step_20_alias() { echo "backupdb"; }
step_20() { step_20() {
local DELYEAR=$(($(date +%Y)-2)) local DELYEAR=$(($(date +%Y)-2))
if [ ! -s ~/.pgpass ] ; then if [ ! -s ~/.pgpass ] ; then
@@ -188,7 +188,7 @@ toolDbBackupFolder=${toolMediaFolder}/backupdb
step_22_info() { echo "Postgres database restore"; } step_22_info() { echo "Postgres database restore"; }
step_22_alias() { ALIAS="restoredb"; } step_22_alias() { echo "restoredb"; }
step_22() { step_22() {
echo " [I] Postgres database restore procedure" echo " [I] Postgres database restore procedure"
echo "1. Create a empty postgres database first (step 4)" echo "1. Create a empty postgres database first (step 4)"
@@ -218,7 +218,7 @@ readDatabaseInfos() {
read -s -p "Enter postgres password: " postgresPass read -s -p "Enter postgres password: " postgresPass
endCheckEmpty postgresPass "password" endCheckEmpty postgresPass "password"
fi fi
echoseq info
} }
# Needs readDatabaseInfos() to execute some commands # Needs readDatabaseInfos() to execute some commands
@@ -233,5 +233,5 @@ toolScript() {
${toolRoot}/bin/mayan-edms.py $*" ${toolRoot}/bin/mayan-edms.py $*"
} }
VERSION_SEQREV=15 readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh

View File

@@ -18,7 +18,7 @@ CONFIG=0
#CONFIG_FILE_NAME="${toolName}.cfg" #CONFIG_FILE_NAME="${toolName}.cfg"
#CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example" #CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
step_config() { seq_config() {
## e.g. to source a config file manually: ## e.g. to source a config file manually:
#. "$CONFIG_FILE" #. "$CONFIG_FILE"
## or to use sequencer api: ## or to use sequencer api:
@@ -27,7 +27,7 @@ step_config() {
# CONFIG=1 # CONFIG=1
#fi #fi
if [ "$(which lsb_release)" == "" ] ; then if [ "$(which lsb_release)" == "" ] ; then
echoerr " [W] Cannot detect OS. Assuming Ubuntu" warning -e "Cannot detect OS. Assuming Ubuntu"
SEQ_OSNAME="Ubuntu" SEQ_OSNAME="Ubuntu"
else else
SEQ_OSNAME=$(lsb_release -is) SEQ_OSNAME=$(lsb_release -is)
@@ -35,7 +35,7 @@ step_config() {
fi fi
if [ "$SEQ_OSNAME" == "" ] ; then if [ "$SEQ_OSNAME" == "" ] ; then
echoerr " [W] Error dedecting OS. Assuming Ubuntu" warning -e "Error dedecting OS. Assuming Ubuntu"
SEQ_OSNAME="Ubuntu" SEQ_OSNAME="Ubuntu"
fi fi
@@ -43,20 +43,20 @@ step_config() {
} }
step_1_info() { echo "Install $toolName dependencies"; } step_1_info() { echo "Install $toolName dependencies"; }
step_1_alias() { ALIAS="install"; } step_1_alias() { echo "install"; }
step_1() { step_1() {
local aptOption= local aptOption=
local pyVersion=$(python -V 2>&1) local pyVersion=$(python -V 2>&1)
if [[ ! "$pyVersion" =~ \ 2\.[7-9]+ ]] ; then if [[ ! "$pyVersion" =~ \ 2\.[7-9]+ ]] ; then
echoerr " [E] Motioneye requires python version 2.7 but $pyVersion was found." error -e "Motioneye requires python version 2.7 but $pyVersion was found."
return 1 return 1
fi fi
exe apt update exe apt update
endReturn -o $? "Updating apt repositories failed" endReturn -o $? "Updating apt repositories failed"
if [ $QUIET -ne 0 ] ; then if quiet ; then
aptOption="-y" aptOption="-y"
else else
aptOption="" aptOption=""
@@ -96,7 +96,7 @@ step_3() {
} }
step_4_info() { echo "Upgrade python pip"; } step_4_info() { echo "Upgrade python pip"; }
step_4_alias() { ALIAS="upgradepip"; } step_4_alias() { echo "upgradepip"; }
step_4() step_4()
{ {
exe pip install --upgrade pip exe pip install --upgrade pip
@@ -138,7 +138,7 @@ motioneyeServiceSource="/usr/local/share/motioneye/extra/motioneye.systemd-unit-
motioneyeServiceTarget="/etc/systemd/system/motioneye.service" motioneyeServiceTarget="/etc/systemd/system/motioneye.service"
step_20_info() { echo "Upgrade $toolName"; } step_20_info() { echo "Upgrade $toolName"; }
step_20_alias() { ALIAS="upgrade"; } step_20_alias() { echo "upgrade"; }
step_20() { step_20() {
step "upgradepip" step "upgradepip"
exe pip install motioneye --upgrade exe pip install motioneye --upgrade
@@ -146,5 +146,5 @@ step_20() {
exe systemctl restart motioneye exe systemctl restart motioneye
} }
VERSION_SEQREV=11 readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh

View File

@@ -14,7 +14,7 @@ step_1_info() {
echoinfo "$databasePackages" echoinfo "$databasePackages"
echoinfo "(Consider step \"latest\" first to setup official repository with the latest version)" echoinfo "(Consider step \"latest\" first to setup official repository with the latest version)"
} }
step_1_alias() { ALIAS=install; } step_1_alias() { echo install; }
step_1() { step_1() {
exe apt update exe apt update
exe apt install $databasePackages exe apt install $databasePackages
@@ -47,7 +47,7 @@ table_definition_cache=1400
#innodb_force_recovery=6" #innodb_force_recovery=6"
step_8_info() { echo "Setup ubuntu $databaseName repository"; } step_8_info() { echo "Setup ubuntu $databaseName repository"; }
step_8_alias() { ALIAS="latest"; } step_8_alias() { echo "latest"; }
step_8() { step_8() {
exe apt install curl exe apt install curl
exep "curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash -s -- --skip-maxscale --skip-tools" exep "curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash -s -- --skip-maxscale --skip-tools"
@@ -64,7 +64,7 @@ step_10_info() {
echoinfo " Manual password entry for non existing user" echoinfo " Manual password entry for non existing user"
echoinfo " --remote, -r : ip of allowed remote host" echoinfo " --remote, -r : ip of allowed remote host"
} }
step_10_alias() { ALIAS="createdb"; } step_10_alias() { echo "createdb"; }
step_10() { step_10() {
local arg local arg
local dbOption= local dbOption=
@@ -117,7 +117,7 @@ step_11_info() {
echoinfo " with manual password entry for non existing user" echoinfo " with manual password entry for non existing user"
echoinfo " --remote, -r : ip of allowed remote host" echoinfo " --remote, -r : ip of allowed remote host"
} }
step_11_alias() { ALIAS="createuser"; } step_11_alias() { echo "createuser"; }
step_11() { step_11() {
local arg local arg
@@ -150,11 +150,11 @@ step_11() {
if ! echo "SELECT COUNT(*) FROM mysql.user WHERE user = '$dbUser' AND host = '$dbRemote';" | mysql | grep 1 &>/dev/null; then if ! echo "SELECT COUNT(*) FROM mysql.user WHERE user = '$dbUser' AND host = '$dbRemote';" | mysql | grep 1 &>/dev/null; then
# User does not exist # User does not exist
if [ $DRY -eq 0 ]; then if ! dry; then
read -s -p "Enter mysql user password: " dbPass read -s -p "Enter mysql user password: " dbPass
endCheckEmpty dbPass "password" endCheckEmpty dbPass "password"
else else
echoseq "Enter mysql password: ...skipped..." info "Enter mysql password: ...skipped..."
fi fi
exe mysql -u root -e 'CREATE USER '"'"$dbUser"'"'@'"'"$dbRemote"'"' IDENTIFIED BY '"'"$dbPass"'"';' exe mysql -u root -e 'CREATE USER '"'"$dbUser"'"'@'"'"$dbRemote"'"' IDENTIFIED BY '"'"$dbPass"'"';'
endReturn -o $? "Error creating mysql user" endReturn -o $? "Error creating mysql user"
@@ -169,7 +169,7 @@ step_12_info() {
echoinfo " --user, -u : user name" echoinfo " --user, -u : user name"
echoinfo " --remote, -r : ip of allowed remote host" echoinfo " --remote, -r : ip of allowed remote host"
} }
step_12_alias() { ALIAS="grant"; } step_12_alias() { echo "grant"; }
step_12() { step_12() {
local arg local arg
@@ -206,7 +206,7 @@ step_14_info() {
echoinfo " --user, -u : user name" echoinfo " --user, -u : user name"
echoinfo " --remote, -r : ip of allowed remote host" echoinfo " --remote, -r : ip of allowed remote host"
} }
step_14_alias() { ALIAS="revokeall"; } step_14_alias() { echo "revokeall"; }
step_14() { step_14() {
local arg local arg
@@ -231,14 +231,14 @@ step_14() {
} }
step_30_info() { echo "List mysql databases"; } step_30_info() { echo "List mysql databases"; }
step_30_alias() { ALIAS="listdb"; } step_30_alias() { echo "listdb"; }
step_30() { step_30() {
exe mysql -u root -e 'SHOW DATABASES;' exe mysql -u root -e 'SHOW DATABASES;'
echo -e "\nDrop userdb by: mysql -u root -e 'DROP DATABASE userdb;'" echo -e "\nDrop userdb by: mysql -u root -e 'DROP DATABASE userdb;'"
} }
step_32_info() { echo "List mysql user"; } step_32_info() { echo "List mysql user"; }
step_32_alias() { ALIAS="listuser"; } step_32_alias() { echo "listuser"; }
step_32() { step_32() {
exe mysql -u root -e 'SELECT User, Host FROM mysql.user;' exe mysql -u root -e 'SELECT User, Host FROM mysql.user;'
echo -e "\nDrop dbuser by: mysql -u root -e 'DROP USER dbuser@localhost;'" echo -e "\nDrop dbuser by: mysql -u root -e 'DROP USER dbuser@localhost;'"
@@ -251,7 +251,7 @@ step_34_info() {
echoinfo " --user, -u : user name" echoinfo " --user, -u : user name"
echoinfo " --remote, -r : ip of allowed remote host" echoinfo " --remote, -r : ip of allowed remote host"
} }
step_34_alias() { ALIAS="listprivileges"; } step_34_alias() { echo "listprivileges"; }
step_34() { step_34() {
local arg local arg
@@ -276,7 +276,7 @@ step_36_info() {
echoinfoArgs "[DATABASE_NAME]" echoinfoArgs "[DATABASE_NAME]"
echo "Size of database" echo "Size of database"
} }
step_36_alias() { ALIAS="sizedb"; } step_36_alias() { echo "sizedb"; }
step_36() { step_36() {
if [ -z "$2" ]; then if [ -z "$2" ]; then
echo "Please provide a database name. e.g. $0 sizedb mydb_db" echo "Please provide a database name. e.g. $0 sizedb mydb_db"
@@ -293,17 +293,17 @@ step_50_info() {
echoinfoArgs "<DATABASE NAME> <TARGET DIR>" echoinfoArgs "<DATABASE NAME> <TARGET DIR>"
echo "Backup (dump) a mysql database" echo "Backup (dump) a mysql database"
} }
step_50_alias() { ALIAS="backup"; } step_50_alias() { echo "backup"; }
step_50() { step_50() {
shift # step number not used shift # step number not used
if [ -z $1 ] ; then if [ -z $1 ] ; then
echoerr " [E] No database name provided" error -e "No database name provided"
return 1 return 1
fi fi
local dbName="$1" local dbName="$1"
local buTarget="$2" local buTarget="$2"
if [ -z "$2" ] ; then if [ -z "$2" ] ; then
echoerr " [W] No target directory provided. Using home of current user" warning -e "No target directory provided. Using home of current user"
buTarget="$HOME" buTarget="$HOME"
elif [ ! -e "$2" ]; then elif [ ! -e "$2" ]; then
endReturn -o 1 -f "$2 does not exist" endReturn -o 1 -f "$2 does not exist"
@@ -315,7 +315,7 @@ step_50() {
} }
step_52_info() { echo "Restore a mysql database"; } step_52_info() { echo "Restore a mysql database"; }
step_52_alias() { ALIAS="restore"; } step_52_alias() { echo "restore"; }
step_52() { step_52() {
echo "Restore with:" echo "Restore with:"
echo " mysql -e \"DROP DATABASE nextcloud_db\"" echo " mysql -e \"DROP DATABASE nextcloud_db\""
@@ -340,5 +340,5 @@ readDatabaseInfos() {
echo echo
} }
VERSION_SEQREV=14 readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh

View File

@@ -13,7 +13,7 @@ sq_config=0
sq_configFileName="${toolName}.cfg" sq_configFileName="${toolName}.cfg"
sq_configFileTemplate="$sq_dir/${sq_configFileName}.example" sq_configFileTemplate="$sq_dir/${sq_configFileName}.example"
step_config() { seq_config() {
## or to use sequencer api: ## or to use sequencer api:
initSeqConfig "$sq_configFileName" "$sq_configFileTemplate" initSeqConfig "$sq_configFileName" "$sq_configFileTemplate"
if [ $? -eq 0 ] ; then if [ $? -eq 0 ] ; then
@@ -26,7 +26,7 @@ step_1_info() {
echoinfoArgs "[OCC ARGS]" echoinfoArgs "[OCC ARGS]"
echo "Execute occ command" echo "Execute occ command"
} }
step_1_alias() { ALIAS="occ"; } step_1_alias() { echo "occ"; }
step_1() { step_1() {
shift shift
@@ -34,10 +34,10 @@ step_1() {
} }
step_20_info() { echo "Upgrade $toolName on command line to latest version of selected release channel"; } step_20_info() { echo "Upgrade $toolName on command line to latest version of selected release channel"; }
step_20_alias() { ALIAS="upgrade"; } step_20_alias() { echo "upgrade"; }
step_20() { step_20() {
if [ $sq_config -eq 0 ] ; then if [ $sq_config -eq 0 ] ; then
echoerr " [E] No configuration found to determine installation directory" error -e "No configuration found to determine installation directory"
return 1 return 1
fi fi
exe cd "$sc_ncInstallDir" exe cd "$sc_ncInstallDir"
@@ -46,7 +46,7 @@ step_20() {
ncInstaller="updater/updater.phar" ncInstaller="updater/updater.phar"
step_102_info() { echoinfoArgs "<NC DATABASE> <IPV4 ADDRESS>"; echo "Delete IP from bruteforce table"; } step_102_info() { echoinfoArgs "<NC DATABASE> <IPV4 ADDRESS>"; echo "Delete IP from bruteforce table"; }
step_102_alias() { ALIAS="bruteforceRemoveIP"; } step_102_alias() { echo "bruteforceRemoveIP"; }
step_102() { step_102() {
shift shift
local ncdb= local ncdb=
@@ -54,7 +54,7 @@ step_102() {
local ipregex='^[0-2]*[0-9]{1,2}\.[0-2]*[0-9]{1,2}\.[0-2]*[0-9]{1,2}\.[0-2]*[0-9]{1,2}$' local ipregex='^[0-2]*[0-9]{1,2}\.[0-2]*[0-9]{1,2}\.[0-2]*[0-9]{1,2}\.[0-2]*[0-9]{1,2}$'
if [ -z $1 ] ; then if [ -z $1 ] ; then
echoerr " [E] No database provided" error -e "No database provided"
if [ -f "${sq_dir}/mysql.sh" ] ; then if [ -f "${sq_dir}/mysql.sh" ] ; then
echo " [I] Available mysql databases:" echo " [I] Available mysql databases:"
"${sq_dir}/mysql.sh" -qq listdb "${sq_dir}/mysql.sh" -qq listdb
@@ -67,7 +67,7 @@ step_102() {
if [[ "$2" =~ $ipregex ]] ; then if [[ "$2" =~ $ipregex ]] ; then
ip="$2" ip="$2"
else else
echoerr " [E] No valid IP:PORT detected: $2" error -e "No valid IP:PORT detected: $2"
return 1 return 1
fi fi
@@ -76,29 +76,29 @@ step_102() {
} }
step_104_info() { echoinfoArgs "<USER>"; echo "Reset and rescan the music library in the background for one user"; } step_104_info() { echoinfoArgs "<USER>"; echo "Reset and rescan the music library in the background for one user"; }
step_104_alias() { ALIAS="audioreset"; } step_104_alias() { echo "audioreset"; }
step_104() { step_104() {
shift shift
local ncUser=$1 local ncUser=$1
if [ -z "$ncUser" ] ; then if [ -z "$ncUser" ] ; then
echoerr " [E] Reset only for single user" error -e "Reset only for single user"
return 1 return 1
fi fi
exep "${localOcc[@]} audioplayer:reset $ncUser > /var/log/ncAudioRescan.log" exep "${localOcc[@]} audioplayer:reset $ncUser > /var/log/ncAudioRescan.log"
echoseq " [I] Rescan audioplayer database for user $ncUser" info "Rescan audioplayer database for user $ncUser"
exep "${localOcc[@]} audioplayer:scan -vvvv $ncUser >> /var/log/ncAudioRescan.log &" exep "${localOcc[@]} audioplayer:scan -vvvv $ncUser >> /var/log/ncAudioRescan.log &"
} }
step_106_info() { echoinfoArgs "<USER>"; echo "Scan the music library"; } step_106_info() { echoinfoArgs "<USER>"; echo "Scan the music library"; }
step_106_alias() { ALIAS="audioscan"; } step_106_alias() { echo "audioscan"; }
step_106() { step_106() {
shift shift
local ncUser=$1 local ncUser=$1
if [ -z "$ncUser" ] ; then if [ -z "$ncUser" ] ; then
echoerr " [E] Reset only for single user" error -e "Reset only for single user"
return 1 return 1
fi fi
@@ -106,22 +106,22 @@ step_106() {
} }
step_110_info() { echo "Reset picture preview folder"; } step_110_info() { echo "Reset picture preview folder"; }
step_110_alias() { ALIAS="resetpreview"; } step_110_alias() { echo "resetpreview"; }
step_110() { step_110() {
if [ -e "${sc_ncDataDir}" ]; then if [ -e "${sc_ncDataDir}" ]; then
exe rm -rf "${sc_ncDataDir}/appdata_"*"/preview/"* exe rm -rf "${sc_ncDataDir}/appdata_"*"/preview/"*
echoseq " [I] Rescan app data folder" info "Rescan app data folder"
exep "${localOcc[@]} files:scan-app-data &" exep "${localOcc[@]} files:scan-app-data &"
else else
echoerr " [E] Nextcloud data direcotry $sc_ncDataDir not found" error -e "Nextcloud data direcotry $sc_ncDataDir not found"
return 1 return 1
fi fi
} }
step_200_alias() { ALIAS="notes"; } step_200_alias() { echo "notes"; }
step_200() { step_200() {
outColor green color green
cat<<NOTES_END cat<<NOTES_END
# Recommended preview settings # Recommended preview settings
[$sc_ncInstallDir/config/config.php] [$sc_ncInstallDir/config/config.php]
@@ -136,5 +136,5 @@ occ config:app:set preview jpeg_quality --value="60"
NOTES_END NOTES_END
} }
VERSION_SEQREV=15 readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh

View File

@@ -16,7 +16,7 @@ SCRIPT_NAME=${SCRIPT_FILE%%.*}
CONFIG_FILE_NAME="${SCRIPT_NAME}.cfg" CONFIG_FILE_NAME="${SCRIPT_NAME}.cfg"
CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example" CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
step_config() { seq_config() {
## or to use sequencer api with global config file: ## or to use sequencer api with global config file:
#initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE" #initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE"
@@ -26,18 +26,18 @@ step_config() {
# CONFIG=1 # CONFIG=1
#else #else
# # End if no configuration file exists # # End if no configuration file exists
# [ $DRY -eq 0 ] && return -1 # dry || return -1
#fi #fi
## Apt cmdline option to suppress user interaction ## Apt cmdline option to suppress user interaction
[ $QUIET -ne 0 ] && APTOPT="-y" quiet && APTOPT="-y"
## Return of non zero value will abort the sequence ## Return of non zero value will abort the sequence
return 0 return 0
} }
step_1_info() { echo "Install $toolName"; } step_1_info() { echo "Install $toolName"; }
step_1_alias() { ALIAS="install"; } step_1_alias() { echo "install"; }
step_1() { step_1() {
downloadLatest downloadLatest
@@ -72,5 +72,5 @@ tempDown="/tmp/olivetin"
tempInstall="$tempDown/olivetin.deb" tempInstall="$tempDown/olivetin.deb"
VERSION_SEQREV=13 readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh

View File

@@ -25,7 +25,7 @@ SCRIPT_NAME=${SCRIPT_FILE%%.*}
CONFIG_FILE_NAME="${SCRIPT_NAME}.cfg" CONFIG_FILE_NAME="${SCRIPT_NAME}.cfg"
CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example" CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
step_config() { seq_config() {
## Called once before executing steps. ## Called once before executing steps.
## e.g. to source a config file manually: ## e.g. to source a config file manually:
#. "$CONFIG_FILE" #. "$CONFIG_FILE"
@@ -39,11 +39,11 @@ step_config() {
CONFIG=1 CONFIG=1
else else
# End if no configuration file exists # End if no configuration file exists
[ $DRY -eq 0 ] && return -1 dry || return -1
fi fi
## Apt cmdline option to suppress user interaction ## Apt cmdline option to suppress user interaction
[ $QUIET -ne 0 ] && APTOPT="-y" quiet && APTOPT="-y"
dockerDnsEntry="DOCKER_OPTS=\"--dns $dockerDns1 --dns $dockerDns2\"" dockerDnsEntry="DOCKER_OPTS=\"--dns $dockerDns1 --dns $dockerDns2\""
@@ -52,7 +52,7 @@ step_config() {
} }
step_1_info() { echo "Install Docker dependencies"; } step_1_info() { echo "Install Docker dependencies"; }
step_1_alias() { ALIAS="install"; } step_1_alias() { echo "install"; }
step_1() { step_1() {
exe apt update exe apt update
exe apt install $dockerDeps $APTOPT exe apt install $dockerDeps $APTOPT
@@ -74,7 +74,7 @@ step_2() {
step_3_info() { echo "Install latest Docker version"; } step_3_info() { echo "Install latest Docker version"; }
step_3() { step_3() {
# Install the latest version # Install the latest version
if [ $QUIET -ne 0 ] ; then if quiet ; then
aptOption="-y" aptOption="-y"
else else
aptOption="" aptOption=""
@@ -90,7 +90,7 @@ step_4() {
exe sed -i "s/\(^#DOCKER_OPTS=.*\)$/#\1\n${dockerDnsEntry}/" "$dockerDefaultConf" exe sed -i "s/\(^#DOCKER_OPTS=.*\)$/#\1\n${dockerDnsEntry}/" "$dockerDefaultConf"
exep "grep \"${dockerDns1}\" \"$dockerDefaultConf\" >>/dev/null" exep "grep \"${dockerDns1}\" \"$dockerDefaultConf\" >>/dev/null"
if [ $? -ne 0 ] ; then if [ $? -ne 0 ] ; then
echoerr " [W] Docker dns entry could not be changed" warning -e "Docker dns entry could not be changed"
fi fi
} }
@@ -100,7 +100,7 @@ step_5_info() {
echoinfo "If [SECRET] is empty, user input will be available if not run --quiet." echoinfo "If [SECRET] is empty, user input will be available if not run --quiet."
echoinfo "$toolName will be run unsecured if no secret was provied." echoinfo "$toolName will be run unsecured if no secret was provied."
} }
step_5_alias() { ALIAS="startoo"; } step_5_alias() { echo "startoo"; }
step_5() { step_5() {
local options= local options=
local secret= local secret=
@@ -109,7 +109,7 @@ step_5() {
secret="$2" secret="$2"
elif [ ! -z "$dockerSecret" ]; then elif [ ! -z "$dockerSecret" ]; then
secret="$dockerSecret" secret="$dockerSecret"
elif [ $QUIET -eq 0 ] ; then elif interactive ; then
exe read -s -p "JWT Secret: " secret exe read -s -p "JWT Secret: " secret
fi fi
@@ -124,7 +124,7 @@ step_5() {
-v /app/onlyoffice/DocumentServer/lib:/var/lib/onlyoffice \ -v /app/onlyoffice/DocumentServer/lib:/var/lib/onlyoffice \
-v /app/onlyoffice/DocumentServer/db:/var/lib/postgresql "${dockerImageName}" -v /app/onlyoffice/DocumentServer/db:/var/lib/postgresql "${dockerImageName}"
else else
echoerr " [W] Running $toolName without JWT (JSON Web Tokens)" warning -e "Running $toolName without JWT (JSON Web Tokens)"
exe docker run -i -t -d -p ${onlyOfficePort}:80 --restart=always "${dockerImageName}" exe docker run -i -t -d -p ${onlyOfficePort}:80 --restart=always "${dockerImageName}"
fi fi
@@ -132,7 +132,7 @@ step_5() {
} }
step_7_info() { echo "Upgrade $toolName to latest version"; } step_7_info() { echo "Upgrade $toolName to latest version"; }
step_7_alias() { ALIAS="upgrade"; } step_7_alias() { echo "upgrade"; }
step_7() { step_7() {
# get container ID # get container ID
local containerId=$(docker ps -aqf ancestor="$dockerImageName") local containerId=$(docker ps -aqf ancestor="$dockerImageName")
@@ -140,7 +140,7 @@ step_7() {
exe docker stop $containerId exe docker stop $containerId
exe docker rm $containerId exe docker rm $containerId
else else
echoerr " [W] No $toolName Docker container found" warning -e "No $toolName Docker container found"
fi fi
exe docker pull $dockerImageName exe docker pull $dockerImageName
endReturn -o $? "Error getting $toolName Docker update" endReturn -o $? "Error getting $toolName Docker update"
@@ -149,7 +149,7 @@ step_7() {
} }
step_10_info() { echo "List running Docker container"; } step_10_info() { echo "List running Docker container"; }
step_10_alias() { ALIAS="ls"; } step_10_alias() { echo "ls"; }
step_10() { step_10() {
exe docker container ls exe docker container ls
echo echo
@@ -162,7 +162,7 @@ step_12_info() {
echo "Clean unused Docker data" echo "Clean unused Docker data"
echoinfo "(unused containers, dangling images, networks, build cache and volumes)" echoinfo "(unused containers, dangling images, networks, build cache and volumes)"
} }
step_12_alias() { ALIAS="prune"; } step_12_alias() { echo "prune"; }
step_12() { step_12() {
exe docker system df exe docker system df
exe docker system prune exe docker system prune
@@ -170,13 +170,13 @@ step_12() {
} }
step_100_info() { echo "Uninstall Docker"; } step_100_info() { echo "Uninstall Docker"; }
step_100_alias() { ALIAS="uninstall"; } step_100_alias() { echo "uninstall"; }
step_100() { step_100() {
exe apt-get purge docker-ce exe apt-get purge docker-ce
} }
step_102_info() { echo "Purge images, containers, volumes, or customized configuration files"; } step_102_info() { echo "Purge images, containers, volumes, or customized configuration files"; }
step_102_alias() { ALIAS="purge"; } step_102_alias() { echo "purge"; }
step_102() { step_102() {
exe read -p "Are you sure y/[n]? " answer exe read -p "Are you sure y/[n]? " answer
case $answer in case $answer in
@@ -190,5 +190,5 @@ step_102() {
esac esac
} }
VERSION_SEQREV=15 readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh

View File

@@ -16,7 +16,7 @@ CONFIG_FILE_NAME="${SCRIPT_NAME}.cfg"
CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example" CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
CONFIG_DIR="$WDIR/$SCRIPT_NAME" CONFIG_DIR="$WDIR/$SCRIPT_NAME"
step_config() { seq_config() {
#echo "Called once before executing steps." #echo "Called once before executing steps."
## e.g. to source a config file manually: ## e.g. to source a config file manually:
#. "$CONFIG_FILE" #. "$CONFIG_FILE"
@@ -28,14 +28,14 @@ step_config() {
# CONFIG=1 # CONFIG=1
#else #else
# # End if no configuration file exists # # End if no configuration file exists
# [ $DRY -eq 0 ] && return -1 # dry || return -1
#fi #fi
[ $QUIET -ne 0 ] && APTOPT="-y" quiet && APTOPT="-y"
return 0 return 0
} }
step_1_info() { echo "Install $toolName"; } step_1_info() { echo "Install $toolName"; }
step_1_alias() { ALIAS="install"; } step_1_alias() { echo "install"; }
step_1() { step_1() {
exe apt update exe apt update
exe apt install $toolDeps $APTOPT exe apt install $toolDeps $APTOPT
@@ -45,15 +45,15 @@ step_2_info() { echo "Install customized helper scripts to $toolUserScriptsLoc";
step_2() { step_2() {
exep "mkdir \"$toolUserScriptsLoc\" 2>>/dev/null" exep "mkdir \"$toolUserScriptsLoc\" 2>>/dev/null"
[ $? -ne 0 ] && \ [ $? -ne 0 ] && \
echoseq " [W] $toolUserScriptsLoc already exists. Not overwriting existing files." warning "$toolUserScriptsLoc already exists. Not overwriting existing files."
exe cp -n "$CONFIG_DIR"/* "$toolUserScriptsLoc" exe cp -n "$CONFIG_DIR"/* "$toolUserScriptsLoc"
} }
step_10_info() { echo "Open openvpn system start configuration"; } step_10_info() { echo "Open openvpn system start configuration"; }
step_10_alias() { ALIAS="default"; } step_10_alias() { echo "default"; }
step_10() { step_10() {
exe vi "$toolDefaultConf" exe vi "$toolDefaultConf"
} }
VERSION_SEQREV=12 readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh

View File

@@ -27,6 +27,6 @@ step_4() {
fi fi
} }
VERSION_SEQREV=3 readonly sqr_minVersion=16
. sequencer.sh . sequencer.sh

View File

@@ -15,17 +15,17 @@ SCRIPT_NAME=${SCRIPT_NAME%%.*}
CONFIG_FILE_NAME="${SCRIPT_NAME}.cfg" CONFIG_FILE_NAME="${SCRIPT_NAME}.cfg"
CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example" CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
step_config() { seq_config() {
initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE" initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE"
if [ $? -eq 0 ] ; then if [ $? -eq 0 ] ; then
CONFIG=1 CONFIG=1
else else
[ $DRY -eq 0 ] && return 1 dry || return 1
fi fi
} }
step_30_info() { echo "Backup ${toolName} web direcotry"; } step_30_info() { echo "Backup ${toolName} web direcotry"; }
step_30_alias() { ALIAS="backup"; } step_30_alias() { echo "backup"; }
step_30() { step_30() {
exep "cd \"${PIWI_DIR}\"/.. && tar czf \"${PIWI_BU_DIR}/\`date +%Y%m%d\`_${toolName}_web.tar.gz\" --exclude=\"${toolName}/network/*\" --exclude=\"${toolName}/_data/i/*\" \"$(basename "$PIWI_DIR")\"" exep "cd \"${PIWI_DIR}\"/.. && tar czf \"${PIWI_BU_DIR}/\`date +%Y%m%d\`_${toolName}_web.tar.gz\" --exclude=\"${toolName}/network/*\" --exclude=\"${toolName}/_data/i/*\" \"$(basename "$PIWI_DIR")\""
} }
@@ -34,19 +34,19 @@ step_31_info() {
echoinfoArgs "[daily|monthly(default]" echoinfoArgs "[daily|monthly(default]"
echo "Backup ${toolName} database" echo "Backup ${toolName} database"
} }
step_31_alias() { ALIAS="backupdb"; } step_31_alias() { echo "backupdb"; }
step_31() { step_31() {
case "$2" in case "$2" in
daily|Daily|DAILY) daily|Daily|DAILY)
[ $QUIET -ne 2 ] && echo " [I] Daily backup..." silent || echo " [I] Daily backup..."
exep "mysqldump --single-transaction -u root ${PIWI_DB_NAME} | bzip2 -c > \"${PIWI_BU_DIR}/${toolName}_daily.sql.bz2\"" exep "mysqldump --single-transaction -u root ${PIWI_DB_NAME} | bzip2 -c > \"${PIWI_BU_DIR}/${toolName}_daily.sql.bz2\""
;; ;;
*) *)
[ $QUIET -ne 2 ] && echo " [I] Monthly backup..." silent || echo " [I] Monthly backup..."
exep "mysqldump --single-transaction -u root ${PIWI_DB_NAME} | bzip2 -c > \"${PIWI_BU_DIR}/monthly/\`date +%Y%m%d\`_${toolName}.sql.bz2\"" exep "mysqldump --single-transaction -u root ${PIWI_DB_NAME} | bzip2 -c > \"${PIWI_BU_DIR}/monthly/\`date +%Y%m%d\`_${toolName}.sql.bz2\""
;; ;;
esac esac
} }
VERSION_SEQREV=14 readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh

View File

@@ -6,7 +6,7 @@ toolDeps="composer jpegoptim php7.3-bcmath php-imagick"
toolPath="/var/www/pixelfed" toolPath="/var/www/pixelfed"
step_1_info() { echo "Updating apt"; } step_1_info() { echo "Updating apt"; }
step_1_alias() { ALIAS="install"; } step_1_alias() { echo "install"; }
step_1() { step_1() {
exe apt update exe apt update
} }
@@ -126,7 +126,7 @@ Environment=
WantedBy=multi-user.target" WantedBy=multi-user.target"
step_8_info() { echo "Create scheduler cron job"; } step_8_info() { echo "Create scheduler cron job"; }
step_8_alias() { ALIAS="scheduler"; } step_8_alias() { echo "scheduler"; }
step_8() { step_8() {
addConf -s "$schedulerCmd" "$schedulerCron" addConf -s "$schedulerCmd" "$schedulerCron"
} }
@@ -197,7 +197,7 @@ location ~ /\\.(?!well-known).* {
}" }"
step_20_info() { echo "Reload configuration (.env)"; } step_20_info() { echo "Reload configuration (.env)"; }
step_20_alias() { ALIAS="newenv"; } step_20_alias() { echo "newenv"; }
step_20() { step_20() {
exe cd $toolPath exe cd $toolPath
exe php artisan config:cache exe php artisan config:cache
@@ -205,17 +205,17 @@ step_20() {
} }
step_22_info() { echo "Create new user"; } step_22_info() { echo "Create new user"; }
step_22_alias() { ALIAS="createuser"; } step_22_alias() { echo "createuser"; }
step_22() { step_22() {
exe cd $toolPath exe cd $toolPath
exe php artisan user:create exe php artisan user:create
} }
step_24_info() { echo "Checkout to dev branch. Losing local changes!"; } step_24_info() { echo "Checkout to dev branch. Losing local changes!"; }
step_24_alias() { ALIAS="forcedev"; } step_24_alias() { echo "forcedev"; }
step_24() { step_24() {
exe read -p "Are you sure: y/[n]? " answer exe read -p "Are you sure: y/[n]? " answer
if [ $DRY -eq 0 ] ; then if ! dry ; then
case $answer in case $answer in
[yY]) [yY])
;; ;;
@@ -232,7 +232,7 @@ step_24() {
} }
step_100_info() { echo "Upgrade \"${toolPath}\" to supported tag $toolTag"; } step_100_info() { echo "Upgrade \"${toolPath}\" to supported tag $toolTag"; }
step_100_alias() { ALIAS="upgrade"; } step_100_alias() { echo "upgrade"; }
step_100() { step_100() {
exe cd $toolPath exe cd $toolPath
exe git pull origin $toolTag exe git pull origin $toolTag
@@ -242,7 +242,7 @@ step_100() {
} }
step_101_info() { echo "Recommended post update procedure"; } step_101_info() { echo "Recommended post update procedure"; }
step_101_alias() { ALIAS="postupdate"; } step_101_alias() { echo "postupdate"; }
step_101() { step_101() {
exe cd $toolPath exe cd $toolPath
exe composer install exe composer install
@@ -261,7 +261,7 @@ step_101() {
# Src: https://docs.pixelfed.org/running-pixelfed/troubleshooting.html # Src: https://docs.pixelfed.org/running-pixelfed/troubleshooting.html
step_102_info() { echo "Fix if horizon services is running but not showing the administration interface"; } step_102_info() { echo "Fix if horizon services is running but not showing the administration interface"; }
step_102_alias() { ALIAS="fixhorizon"; } step_102_alias() { echo "fixhorizon"; }
step_102() { step_102() {
exe cd $toolPath exe cd $toolPath
exe php artisan package:discover exe php artisan package:discover
@@ -272,7 +272,7 @@ step_102() {
} }
# Sequence Revision # Sequence Revision
VERSION_SEQREV=7 readonly sqr_minVersion=16
# Path to sequencer # Path to sequencer
. sequencer.sh . sequencer.sh

View File

@@ -17,7 +17,7 @@ CONFIG=0
CONFIG_FILE_NAME="${toolName}.cfg" CONFIG_FILE_NAME="${toolName}.cfg"
CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example" CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
step_config() { seq_config() {
initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE" initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE"
if [ $? -eq 0 ] ; then if [ $? -eq 0 ] ; then
echo " ${toolName} path: ${PFA_WEB_LOC}" echo " ${toolName} path: ${PFA_WEB_LOC}"
@@ -33,12 +33,12 @@ step_1_info() {
echo "Install $toolName dependencies:" echo "Install $toolName dependencies:"
echoinfo "$localDeps" echoinfo "$localDeps"
} }
step_1_alias() { ALIAS="install"; } step_1_alias() { echo "install"; }
step_1() { step_1() {
# eval needed to expand sourced configuration variables # eval needed to expand sourced configuration variables
local localDeps=`eval "echo \"$toolPhpDeps\""` local localDeps=`eval "echo \"$toolPhpDeps\""`
local aptOpt= local aptOpt=
if [ $QUIET -ne 0 ];then if quiet;then
aptOpt="-y" aptOpt="-y"
fi fi
exe apt update exe apt update
@@ -51,10 +51,10 @@ step_2() {
} }
step_3_info() { echo "Install fetchmail"; } step_3_info() { echo "Install fetchmail"; }
step_3_alias() { ALIAS="install_fetchmail"; } step_3_alias() { echo "install_fetchmail"; }
step_3() { step_3() {
local aptOpt= local aptOpt=
if [ $QUIET -ne 0 ];then if quiet;then
aptOpt="-y" aptOpt="-y"
fi fi
exe apt install $fetchmailDeps $aptOpt exe apt install $fetchmailDeps $aptOpt
@@ -81,7 +81,7 @@ step_6_info() {
echo "Create postfixadmin fetchmail systemd timer and reduce syslog entries" echo "Create postfixadmin fetchmail systemd timer and reduce syslog entries"
echoinfo "Needs to start after the mysql service" echoinfo "Needs to start after the mysql service"
} }
step_6_alias() { ALIAS="timer"; } step_6_alias() { echo "timer"; }
step_6() { step_6() {
# eval needed to expand sourced configuration variables # eval needed to expand sourced configuration variables
local localService=`eval "echo \"$fetchPluginService\""` local localService=`eval "echo \"$fetchPluginService\""`
@@ -123,7 +123,7 @@ fetchPluginRsyslog="if \$programname == 'systemd' and re_match(\$msg, \"Started.
if \$programname == 'systemd' and re_match(\$msg, \"fetchmail.*Succeeded\") then stop" if \$programname == 'systemd' and re_match(\$msg, \"fetchmail.*Succeeded\") then stop"
step_7_info() { echo "Create separate log file for fetchmail using rsyslog"; } step_7_info() { echo "Create separate log file for fetchmail using rsyslog"; }
step_7_alias() { ALIAS="newlog"; } step_7_alias() { echo "newlog"; }
step_7() { step_7() {
addConf -f "$fetchmailRsyslog" "$fetchmailRsyslogLoc" addConf -f "$fetchmailRsyslog" "$fetchmailRsyslogLoc"
addConf -f "$fetchmailRotate" "$fetchmailRotateLoc" addConf -f "$fetchmailRotate" "$fetchmailRotateLoc"
@@ -144,7 +144,7 @@ fetchmailRsyslog="if \$programname == 'fetchmail' or \$programname == 'fetchmail
& stop" & stop"
step_18_info() { echoinfoArgs "[NEW VERSION]"; echo "Check for updates"; } step_18_info() { echoinfoArgs "[NEW VERSION]"; echo "Check for updates"; }
step_18_alias() { ALIAS="updatecheck"; } step_18_alias() { echo "updatecheck"; }
step_18() { step_18() {
shift shift
local isInstalled= local isInstalled=
@@ -175,12 +175,12 @@ step_20_info() {
echo echo
fi fi
} }
step_20_alias() { ALIAS="backup"; } step_20_alias() { echo "backup"; }
step_20() { step_20() {
shift shift
local tempRoot= local tempRoot=
if [ $CONFIG -eq 0 ] ; then if [ $CONFIG -eq 0 ] ; then
echoerr " [E] No configuration file found" error -e "No configuration file found"
return 1 return 1
fi fi
if [ ! -z $PFA_BACKUP ] ; then if [ ! -z $PFA_BACKUP ] ; then
@@ -203,7 +203,7 @@ step_20() {
step_22_info() { step_22_info() {
echoinfoArgs "[CUSTOM VERSION]" echoinfoArgs "[CUSTOM VERSION]"
shift shift
if [ $CONTEXT_EXE -ne 0 ]; then if contextExe; then
echoinfo -n "Upgrade to version " echoinfo -n "Upgrade to version "
if [ -z "$1" ]; then if [ -z "$1" ]; then
echo -n "$(curl --silent "$latestUrl" | grep -Po '"tag_name": "postfixadmin-\K.*?(?=")')" echo -n "$(curl --silent "$latestUrl" | grep -Po '"tag_name": "postfixadmin-\K.*?(?=")')"
@@ -215,7 +215,7 @@ step_22_info() {
echo "Upgrade to latest or a custom version from github" echo "Upgrade to latest or a custom version from github"
fi fi
} }
step_22_alias() { ALIAS="upgrade"; } step_22_alias() { echo "upgrade"; }
step_22() { step_22() {
shift # don't need step number shift # don't need step number
local latestVersion= local latestVersion=
@@ -226,16 +226,16 @@ step_22() {
fi fi
if [ -z $latestVersion ] ; then if [ -z $latestVersion ] ; then
echoerr " [E] Cannot determine latest version from github repository" error -e "Cannot determine latest version from github repository"
return 1 return 1
elif [ $QUIET -eq 0 ] ; then elif interactive ; then
echo echo
exe read -p "Install $latestVersion to $PFA_SRV_LOC [n]o/(y)es? " answer exe read -p "Install $latestVersion to $PFA_SRV_LOC [n]o/(y)es? " answer
case $answer in case $answer in
[yY]) [yY])
;; ;;
*) *)
echoerr " [I] Upgrade aborted" info -e "Upgrade aborted"
return 1 return 1
;; ;;
esac esac
@@ -245,7 +245,7 @@ step_22() {
# Trailing ".0" is removed if exists # Trailing ".0" is removed if exists
local isInstalled=$(grep -E "Version ${latestVersion%.0} " "${PFA_SRV_LOC}/CHANGELOG.TXT" >>/dev/null 2>&1 && echo "1" || echo "0") local isInstalled=$(grep -E "Version ${latestVersion%.0} " "${PFA_SRV_LOC}/CHANGELOG.TXT" >>/dev/null 2>&1 && echo "1" || echo "0")
if [ $isInstalled -eq 1 ] ; then if [ $isInstalled -eq 1 ] ; then
echoerr " [E] Version $latestVersion is already installed" error -e "Version $latestVersion is already installed"
return 2 return 2
fi fi
@@ -308,7 +308,7 @@ tempDown="/tmp/${toolName}"
tempLoc="$tempDown/${toolName}.tar.gz" tempLoc="$tempDown/${toolName}.tar.gz"
step_23_info() { echo "Clean temporary files: $tempDown"; } step_23_info() { echo "Clean temporary files: $tempDown"; }
step_23_alias() { ALIAS="clean"; } step_23_alias() { echo "clean"; }
step_23() { step_23() {
exe rm -rf "$tempDown" exe rm -rf "$tempDown"
} }
@@ -318,11 +318,11 @@ step_100_info() {
echo "Execute $toolName client script" echo "Execute $toolName client script"
echoinfo "[OPTIONS] are passed on to $toolName-cli unmodified" echoinfo "[OPTIONS] are passed on to $toolName-cli unmodified"
} }
step_100_alias() { ALIAS="cli"; } step_100_alias() { echo "cli"; }
step_100() { step_100() {
shift shift
exe ${PFA_SRV_LOC}/scripts/$toolName-cli $@ exe ${PFA_SRV_LOC}/scripts/$toolName-cli $@
} }
VERSION_SEQREV=14 readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh

View File

@@ -16,7 +16,7 @@ CONFIG=0
CONFIG_FILE_NAME="postgres.cfg" CONFIG_FILE_NAME="postgres.cfg"
CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example" CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
step_config() { seq_config() {
initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE" initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE"
if [ $? -eq 0 ] ; then if [ $? -eq 0 ] ; then
CONFIG=1 CONFIG=1
@@ -24,14 +24,14 @@ step_config() {
} }
step_1_info() { echo "Installing $toolName dependencies"; } step_1_info() { echo "Installing $toolName dependencies"; }
step_1_alias() { ALIAS="install"; } step_1_alias() { echo "install"; }
step_1() { step_1() {
local aptOption= local aptOption=
exe apt update exe apt update
endReturn -o $? "Updating apt repositories failed" endReturn -o $? "Updating apt repositories failed"
if [ $QUIET -ne 0 ] ; then if quiet ; then
aptOption="-y" aptOption="-y"
else else
aptOption="" aptOption=""
@@ -41,7 +41,7 @@ step_1() {
} }
step_2_info() { echo "Create postgres database"; } step_2_info() { echo "Create postgres database"; }
step_2_alias() { ALIAS="createdb"; } step_2_alias() { echo "createdb"; }
step_2() { step_2() {
readDatabaseInfos readDatabaseInfos
@@ -52,7 +52,7 @@ step_2() {
} }
step_4_info() { echoinfoArgs "[DATABASE]"; echo "Drop a postgres database"; } step_4_info() { echoinfoArgs "[DATABASE]"; echo "Drop a postgres database"; }
step_4_alias() { ALIAS="dropdb"; } step_4_alias() { echo "dropdb"; }
step_4() { step_4() {
shift shift
local dbname=$1 local dbname=$1
@@ -65,7 +65,7 @@ step_4() {
} }
step_6_info() { echoinfoArgs "[DATABASE]"; echo "Size of a postgres database"; } step_6_info() { echoinfoArgs "[DATABASE]"; echo "Size of a postgres database"; }
step_6_alias() { ALIAS="sizedb"; } step_6_alias() { echo "sizedb"; }
step_6() { step_6() {
shift shift
local dbname=$1 local dbname=$1
@@ -78,14 +78,14 @@ step_6() {
} }
step_8_info() { echo "List available databases"; } step_8_info() { echo "List available databases"; }
step_8_alias() { ALIAS="listdb"; } step_8_alias() { echo "listdb"; }
step_8() { step_8() {
exe cd ~postgres exe cd ~postgres
exe su ${toolUser} -c "psql -c '\l'" exe su ${toolUser} -c "psql -c '\l'"
} }
step_10_info() { echoinfoArgs "[DATABASE]"; echo "List all tables of a postgres database"; } step_10_info() { echoinfoArgs "[DATABASE]"; echo "List all tables of a postgres database"; }
step_10_alias() { ALIAS="listtables"; } step_10_alias() { echo "listtables"; }
step_10() { step_10() {
shift shift
local dbname=$1 local dbname=$1
@@ -98,7 +98,7 @@ step_10() {
} }
step_20_info() { echoinfoArgs "[DATABASE]"; echo "Backup ${toolName} database"; } step_20_info() { echoinfoArgs "[DATABASE]"; echo "Backup ${toolName} database"; }
step_20_alias() { ALIAS="backupdb"; } step_20_alias() { echo "backupdb"; }
step_20() { step_20() {
shift shift
local dbname=$1 local dbname=$1
@@ -118,7 +118,7 @@ step_20() {
} }
step_22_info() { echo "Postgres database restore"; } step_22_info() { echo "Postgres database restore"; }
step_22_alias() { ALIAS="restoredb"; } step_22_alias() { echo "restoredb"; }
step_22() { step_22() {
echo " [I] Postgres database restore procedure" echo " [I] Postgres database restore procedure"
echo "1. Create a empty postgres database first (step 4)" echo "1. Create a empty postgres database first (step 4)"
@@ -140,7 +140,7 @@ step_24_info() {
echoinfoArgs "[DATABASE]" echoinfoArgs "[DATABASE]"
echo "Clean all ${DELYEAR} backups of a database"; echo "Clean all ${DELYEAR} backups of a database";
} }
step_24_alias() { ALIAS="backupclean"; } step_24_alias() { echo "backupclean"; }
step_24() { step_24() {
shift shift
local DELYEAR=$(($(date +%Y)-2)) local DELYEAR=$(($(date +%Y)-2))
@@ -169,5 +169,5 @@ readDatabaseInfos() {
echo echo
} }
VERSION_SEQREV=14 readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh

View File

@@ -24,10 +24,10 @@ CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
#} #}
step_1_info() { echo "Install $toolDeps"; } step_1_info() { echo "Install $toolDeps"; }
step_1_alias() { ALIAS="install"; } step_1_alias() { echo "install"; }
step_1() { step_1() {
local aptOpt= local aptOpt=
if [ $QUIET -ne 0 ];then if quiet;then
aptOpt="-y" aptOpt="-y"
fi fi
exe apt update exe apt update
@@ -38,7 +38,7 @@ step_2_info() {
echo "Add cron to update whitelist_clients from" echo "Add cron to update whitelist_clients from"
echoinfo "$updateUrl" echoinfo "$updateUrl"
} }
step_2_alias() { ALIAS="cron"; } step_2_alias() { echo "cron"; }
step_2() { step_2() {
addConf -s "$postCron" "$postCronLoc" addConf -s "$postCron" "$postCronLoc"
} }
@@ -47,7 +47,7 @@ postCron="# -q quiet -N timestamping (overwrite existing file) -O target file
01 23 5 * * root /usr/bin/wget -qNO \"$toolWhitelistLoc\" $updateUrl && /usr/sbin/service postgrey restart" 01 23 5 * * root /usr/bin/wget -qNO \"$toolWhitelistLoc\" $updateUrl && /usr/sbin/service postgrey restart"
step_3_info() { echo "Configuration notes"; } step_3_info() { echo "Configuration notes"; }
step_3_alias() { ALIAS="notes"; } step_3_alias() { echo "notes"; }
step_3() { step_3() {
echo "$toolNotes" echo "$toolNotes"
} }
@@ -71,10 +71,10 @@ toolNotes="
" "
step_10_info() { echo "Restart $toolName"; } step_10_info() { echo "Restart $toolName"; }
step_10_alias() { ALIAS="restart"; } step_10_alias() { echo "restart"; }
step_10() { step_10() {
exe service $toolName restart exe service $toolName restart
} }
VERSION_SEQREV=11 readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh

View File

@@ -17,20 +17,20 @@ SCRIPT_NAME=${SCRIPT_NAME%%.*}
CONFIG_FILE_NAME="${SCRIPT_NAME}.cfg" CONFIG_FILE_NAME="${SCRIPT_NAME}.cfg"
CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example" CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
step_config() { seq_config() {
initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE" initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE"
if [ $? -eq 0 ] ; then if [ $? -eq 0 ] ; then
CONFIG=1 CONFIG=1
else else
# End if no configuration file exists # End if no configuration file exists
[ $DRY -eq 0 ] && return 1 dry || return 1
fi fi
[ $QUIET -ne 0 ] && APTOPT="-y" quiet && APTOPT="-y"
return 0 return 0
} }
step_1_info() { echo "Apt sources.list check and update"; } step_1_info() { echo "Apt sources.list check and update"; }
step_1_alias() { ALIAS="install"; } step_1_alias() { echo "install"; }
step_1() { step_1() {
echo "Make sure you have the \"deb-src\" entry active in your /etc/apt/sources.list" echo "Make sure you have the \"deb-src\" entry active in your /etc/apt/sources.list"
echo "Especially check for \"non-free\"" echo "Especially check for \"non-free\""
@@ -57,7 +57,7 @@ step_3_info() {
echoinfo " raspi: Raspberry Pi OS" echoinfo " raspi: Raspberry Pi OS"
echoinfo " debian: Debian" echoinfo " debian: Debian"
} }
step_3_alias() { ALIAS="deps"; } step_3_alias() { echo "deps"; }
step_3() { step_3() {
shift shift
local lDeps="$toolDeps" local lDeps="$toolDeps"
@@ -66,7 +66,7 @@ step_3() {
lDeps="$toolDepsDebian";; lDeps="$toolDepsDebian";;
raspi);; raspi);;
*) *)
echoerr " [E] Unrecognized target" error -e "Unrecognized target"
return 1;; return 1;;
esac esac
exe apt-get install ${lDeps} $APTOPT exe apt-get install ${lDeps} $APTOPT
@@ -115,17 +115,17 @@ ExecStart=/usr/bin/python \${PYL_INSTALL_DIR}/pyLoadCore.py
WantedBy=multi-user.target" WantedBy=multi-user.target"
step_7_info() { echo "Add ufw rules"; } step_7_info() { echo "Add ufw rules"; }
step_7_alias() { ALIAS="ufw"; } step_7_alias() { echo "ufw"; }
step_7() { step_7() {
echoseq " [I] Port 9666 needs to be forwarded to the target machine with ssh" info "Port 9666 needs to be forwarded to the target machine with ssh"
echoseq " ssh -L 9666:localhost:9666 user@host -N" info " ssh -L 9666:localhost:9666 user@host -N"
exe ufw allow in on eth0 to any port 8000 proto tcp comment "pyload webinterface" exe ufw allow in on eth0 to any port 8000 proto tcp comment "pyload webinterface"
exe ufw allow in on eth0 to any port 7227 proto tcp comment "pyload remotes" exe ufw allow in on eth0 to any port 7227 proto tcp comment "pyload remotes"
exe ufw allow out on eth0 to 192.168.23.20 port 5222 proto tcp comment "XMPP Connection" exe ufw allow out on eth0 to 192.168.23.20 port 5222 proto tcp comment "XMPP Connection"
} }
step_10_info() { echo "Upgrade to latest version of branch $toolBranch"; } step_10_info() { echo "Upgrade to latest version of branch $toolBranch"; }
step_10_alias() { ALIAS="upgrade"; } step_10_alias() { echo "upgrade"; }
step_10() { step_10() {
exe service $toolName stop exe service $toolName stop
exe cd "$PYL_INSTALL_DIR" exe cd "$PYL_INSTALL_DIR"
@@ -134,5 +134,5 @@ step_10() {
echo " Do so manually with: service $toolName start" echo " Do so manually with: service $toolName start"
} }
VERSION_SEQREV=14 readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh

View File

@@ -13,14 +13,14 @@ osName=
distName= distName=
RPI_BOOT_CONFIG="/boot/config.txt" RPI_BOOT_CONFIG="/boot/config.txt"
step_config() { seq_config() {
# Shift away args # Shift away args
local lArgs=( "$@" ); evalArgs "${lArgs[@]}"; shift $? local lArgs=( "$@" ); evalArgs "${lArgs[@]}"; shift $?
# Set download url with specified CPU architecture # Set download url with specified CPU architecture
PIDOWNURL="https://downloads.raspberrypi.org/raspios_lite_${PIARCH}_latest" PIDOWNURL="https://downloads.raspberrypi.org/raspios_lite_${PIARCH}_latest"
if [ "$(which lsb_release)" == "" ] ; then if [ "$(which lsb_release)" == "" ] ; then
echoerr " [W] Cannot detect OS. Assuming Ubuntu" warning -e "Cannot detect OS. Assuming Ubuntu"
osName="Ubuntu" osName="Ubuntu"
else else
osName=$(lsb_release -is) osName=$(lsb_release -is)
@@ -28,12 +28,12 @@ step_config() {
fi fi
if [ "$osName" == "" ] ; then if [ "$osName" == "" ] ; then
echoerr " [W] Error dedecting OS. Assuming Ubuntu" warning -e "Error dedecting OS. Assuming Ubuntu"
osName="Ubuntu" osName="Ubuntu"
fi fi
echoseq " Detected OS: $osName $distName" info " Detected OS: $osName $distName"
echoseq " Requested CPU Architecture: $PIARCH" info " Requested CPU Architecture: $PIARCH"
return 0 return 0
} }
@@ -80,14 +80,14 @@ step_1_info() {
echoinfoArgs "[OPTIONS] [SD CARD DEVICE] [HD DEVICE]" echoinfoArgs "[OPTIONS] [SD CARD DEVICE] [HD DEVICE]"
echo "Download latest Raspberry Pi OS lite image $PIARCH" echo "Download latest Raspberry Pi OS lite image $PIARCH"
if [ $CONTEXT_EXE -ne 0 ]; then if contextExe; then
echoinfo "Download URL: $PIDOWNURL" echoinfo "Download URL: $PIDOWNURL"
else else
echoinfo " [OPTIONS]" echoinfo " [OPTIONS]"
echoinfo " -a, --arch : armhf (default), arm64" echoinfo " -a, --arch : armhf (default), arm64"
fi fi
} }
step_1_alias() { ALIAS="setup"; } step_1_alias() { echo "setup"; }
step_1() { step_1() {
# Shift away args # Shift away args
shift; local lArgs=( "$@" ); evalArgs "${lArgs[@]}"; shift $? shift; local lArgs=( "$@" ); evalArgs "${lArgs[@]}"; shift $?
@@ -115,9 +115,9 @@ step_2_info() {
echoinfoArgs "[OPTIONS] [SD CARD DEVICE]" echoinfoArgs "[OPTIONS] [SD CARD DEVICE]"
echo "Write Raspberry Pi OS image to SD card" echo "Write Raspberry Pi OS image to SD card"
echoinfo "This operation will delete all data previously on the SD card!" echoinfo "This operation will delete all data previously on the SD card!"
[ $CONTEXT_EXE -ne 0 ] && [ ! -z $1 ] && echoinfo " [SD CARD DEVICE]: $1" contextExe && [ ! -z $1 ] && echoinfo " [SD CARD DEVICE]: $1"
} }
step_2_alias() { ALIAS="writesd"; } step_2_alias() { echo "writesd"; }
step_2() { step_2() {
# Shift away args # Shift away args
shift; local lArgs=( "$@" ); evalArgs "${lArgs[@]}"; shift $? shift; local lArgs=( "$@" ); evalArgs "${lArgs[@]}"; shift $?
@@ -151,7 +151,7 @@ step_2() {
SDROOT="" SDROOT=""
# TODO ? automatic remount # TODO ? automatic remount
echoerr " [W] Please remove SD now and plug it back in." warning -e "Please remove SD now and plug it back in."
exe read -p " Press enter to contiue." exe read -p " Press enter to contiue."
} }
@@ -161,7 +161,7 @@ step_3_info() {
echoinfoArgs "[SD CARD DEVICE]" echoinfoArgs "[SD CARD DEVICE]"
echo "Prepare SD for first run" echo "Prepare SD for first run"
if [ $CONTEXT_EXE -ne 0 ]; then if contextExe; then
[ ! -z $1 ] && echoinfo " [SD CARD DEVICE]: $1" [ ! -z $1 ] && echoinfo " [SD CARD DEVICE]: $1"
fi fi
} }
@@ -170,7 +170,7 @@ step_3() {
shift; local lArgs=( "$@" ); evalArgs "${lArgs[@]}"; shift $? shift; local lArgs=( "$@" ); evalArgs "${lArgs[@]}"; shift $?
if [ -z $1 ] && [ ! -z $SDDEV ] ; then if [ -z $1 ] && [ ! -z $SDDEV ] ; then
if [ $QUIET -ne 0 ] ; then if quiet ; then
answer="n" answer="n"
else else
exe lsblk -p "$SDDEV" exe lsblk -p "$SDDEV"
@@ -192,7 +192,7 @@ step_3() {
endReturn -o $? "SD card device not found" endReturn -o $? "SD card device not found"
if [ ! -w "$SDBOOT" ] ; then if [ ! -w "$SDBOOT" ] ; then
echoerr " [E] SD card boot partion not writeable" error -e "SD card boot partion not writeable"
return 1 return 1
fi fi
@@ -212,12 +212,12 @@ step_4_info() {
echoinfoArgs "[SD CARD DEVICE] [HD DEVICE]" echoinfoArgs "[SD CARD DEVICE] [HD DEVICE]"
echo "Prepare SD card to boot from hard disk" echo "Prepare SD card to boot from hard disk"
if [ $CONTEXT_EXE -ne 0 ]; then if contextExe; then
[ ! -z $1 ] && echoinfo " [SD CARD DEVICE]: $1" [ ! -z $1 ] && echoinfo " [SD CARD DEVICE]: $1"
[ ! -z $2 ] && echoinfo " [HD DEVICE]: $2" [ ! -z $2 ] && echoinfo " [HD DEVICE]: $2"
fi fi
} }
step_4_alias() { ALIAS="hdboot"; } step_4_alias() { echo "hdboot"; }
step_4() { step_4() {
# Shift away args # Shift away args
shift; local lArgs=( "$@" ); evalArgs "${lArgs[@]}"; shift $? shift; local lArgs=( "$@" ); evalArgs "${lArgs[@]}"; shift $?
@@ -264,7 +264,7 @@ step_4() {
echo " [I] Resize root partion of SD: ${SDROOT} " echo " [I] Resize root partion of SD: ${SDROOT} "
step resizesd "$SDDEV" step resizesd "$SDDEV"
if [ $? -ne 0 ] ; then if [ $? -ne 0 ] ; then
echoerr " [W] Something seems to have failed during resize" warning -e "Something seems to have failed during resize"
else else
# Disable init script to resize SD # Disable init script to resize SD
echo -n " [I] remove \"init=\" part from $SDBOOT/cmdline.txt.sd" echo -n " [I] remove \"init=\" part from $SDBOOT/cmdline.txt.sd"
@@ -284,7 +284,7 @@ step_5_info() {
echoinfoArgs "[SD CARD DEVICE] [HD DEVICE]" echoinfoArgs "[SD CARD DEVICE] [HD DEVICE]"
echo "Prepare HD for boot (TODO)" echo "Prepare HD for boot (TODO)"
if [ $CONTEXT_EXE -ne 0 ]; then if contextExe; then
[ ! -z $1 ] && echoinfo " [SD CARD DEVICE]: $1" [ ! -z $1 ] && echoinfo " [SD CARD DEVICE]: $1"
[ ! -z $2 ] && echoinfo " [HD DEVICE]: $2" [ ! -z $2 ] && echoinfo " [HD DEVICE]: $2"
fi fi
@@ -294,7 +294,7 @@ step_5() {
shift; local lArgs=( "$@" ); evalArgs "${lArgs[@]}"; shift $? shift; local lArgs=( "$@" ); evalArgs "${lArgs[@]}"; shift $?
#TODO #TODO
echoerr " [E] Not ready yet...TODO" error -e "Not ready yet...TODO"
#return 1 #return 1
read_sd_dev "$1" read_sd_dev "$1"
endReturn -o $? "SD detection error $?" endReturn -o $? "SD detection error $?"
@@ -355,7 +355,7 @@ read_sd_dev() {
fi fi
if [ ! -b "$SDDEV" ] ; then if [ ! -b "$SDDEV" ] ; then
echoerr " [I] $SDDEV not a block device" info -e "$SDDEV not a block device"
SDDEV= SDDEV=
return 1 return 1
fi fi
@@ -423,17 +423,17 @@ read_hd_dev() {
} }
step_20_info() { echo "Disable swap file and remove it"; } step_20_info() { echo "Disable swap file and remove it"; }
step_20_alias() { ALIAS="disable_swap"; } step_20_alias() { echo "disable_swap"; }
step_20() { step_20() {
exe swapoff -a exe swapoff -a
exe systemctl disable dphys-swapfile exe systemctl disable dphys-swapfile
exe rm -rf "$rpiSwapFile" exe rm -rf "$rpiSwapFile"
echoerr " [W] Reboot to apply changes" warning -e "Reboot to apply changes"
if [ $QUIET -eq 0 ] ; then if interactive ; then
exe read -p " Reboot now ([n]/y)? " answer exe read -p " Reboot now ([n]/y)? " answer
case $answer in case $answer in
[yY]) [yY])
echoerr " [I] Rebooting now ..." info -e "Rebooting now ..."
exe reboot exe reboot
;; ;;
*) *)
@@ -444,12 +444,12 @@ step_20() {
rpiSwapFile="/var/swap" rpiSwapFile="/var/swap"
step_22_info() { echoinfoArgs "[SD CARD DEVICE]"; echo "Resize second SD card partition"; } step_22_info() { echoinfoArgs "[SD CARD DEVICE]"; echo "Resize second SD card partition"; }
step_22_alias() { ALIAS="resizesd"; } step_22_alias() { echo "resizesd"; }
step_22() { step_22() {
shift shift
read_sd_dev "$1" read_sd_dev "$1"
if [ -z $SDDEV ] || [ "$SDDEV" = "" ] || [ "$SDROOT" == "/" ] ; then if [ -z $SDDEV ] || [ "$SDDEV" = "" ] || [ "$SDROOT" == "/" ] ; then
echoerr " [E] No SD found" error -e "No SD found"
return 1 return 1
fi fi
echo " [I] Device to be resized: $SDROOTDEV" echo " [I] Device to be resized: $SDROOTDEV"
@@ -477,7 +477,7 @@ step_24_info() {
echoinfo " [OPTION]" echoinfo " [OPTION]"
echoinfo " -p : Turn off permanentely (/etc/rc.local)" echoinfo " -p : Turn off permanentely (/etc/rc.local)"
} }
step_24_alias() { ALIAS="disable_powerled"; } step_24_alias() { echo "disable_powerled"; }
step_24() { step_24() {
exep "${ledOffCmd}" exep "${ledOffCmd}"
if [ ! -z "$2" ] && [ "$2" == "-p" ] ; then if [ ! -z "$2" ] && [ "$2" == "-p" ] ; then
@@ -497,13 +497,13 @@ ledPowerBright="/sys/class/leds/led1/brightness"
ledOffCmd="sudo sh -c 'echo 0 > ${ledPowerBright}'" ledOffCmd="sudo sh -c 'echo 0 > ${ledPowerBright}'"
step_26_info() { echo "Restart network without reboot"; } step_26_info() { echo "Restart network without reboot"; }
step_26_alias() { ALIAS="netrestart"; } step_26_alias() { echo "netrestart"; }
step_26() { step_26() {
exep "sudo ip link set eth0 down && sudo ip link set eth0 up" exep "sudo ip link set eth0 down && sudo ip link set eth0 up"
} }
step_28_info() { echo "Disable bluetooth"; } step_28_info() { echo "Disable bluetooth"; }
step_28_alias() { ALIAS="disable_bluetooth"; } step_28_alias() { echo "disable_bluetooth"; }
step_28() { step_28() {
checkBootConfig "$RPI_CONFIG_DTOVERLAY" "$RPI_CONF_DI_BLUETOOTH" checkBootConfig "$RPI_CONFIG_DTOVERLAY" "$RPI_CONF_DI_BLUETOOTH"
[ $? -eq 0 ] && endReturn -o 1 "Bluetooth already disabled" [ $? -eq 0 ] && endReturn -o 1 "Bluetooth already disabled"
@@ -520,26 +520,26 @@ step_29() {
exe systemctl disable bluealsa.service exe systemctl disable bluealsa.service
exe systemctl disable bluetooth.service exe systemctl disable bluetooth.service
echoseq " [I] Consider uninstalling bluetooth software:" info "Consider uninstalling bluetooth software:"
echoseq "apt purge --autoremove -y bluez" info "apt purge --autoremove -y bluez"
echoseq info
echoseq " [W] Reboot to make changes active" warning "Reboot to make changes active"
} }
step_31_info() { echo "Disable Wifi"; } step_31_info() { echo "Disable Wifi"; }
step_31_alias() { ALIAS="disable_wifi"; } step_31_alias() { echo "disable_wifi"; }
step_31() { step_31() {
checkBootConfig "$RPI_CONFIG_DTOVERLAY" "$RPI_CONF_DI_WIFI" checkBootConfig "$RPI_CONFIG_DTOVERLAY" "$RPI_CONF_DI_WIFI"
[ $? -eq 0 ] && endReturn -o 1 "Wifi already disabled" [ $? -eq 0 ] && endReturn -o 1 "Wifi already disabled"
addConf -a "${RPI_CONFIG_DTOVERLAY}=$RPI_CONF_DI_WIFI" "$RPI_BOOT_CONFIG" addConf -a "${RPI_CONFIG_DTOVERLAY}=$RPI_CONF_DI_WIFI" "$RPI_BOOT_CONFIG"
echoseq " [W] Reboot to make changes active" warning "Reboot to make changes active"
} }
step_33_info() { echo "Disable HDMI"; } step_33_info() { echo "Disable HDMI"; }
step_33_alias() { ALIAS="disable_hdmi"; } step_33_alias() { echo "disable_hdmi"; }
step_33() { step_33() {
checkBootConfig "$RPI_CONFIG_HDMI_BLANK" "$RPI_CONF_DI_HDMI" checkBootConfig "$RPI_CONFIG_HDMI_BLANK" "$RPI_CONF_DI_HDMI"
[ $? -eq 0 ] && endReturn -o 1 "HDMI already disabled" [ $? -eq 0 ] && endReturn -o 1 "HDMI already disabled"
@@ -563,7 +563,7 @@ step_34() {
exep "echo \"${tvserviceOffCmd}\" >> $startScript" exep "echo \"${tvserviceOffCmd}\" >> $startScript"
exep "echo -e \"\nexit 0\" >> $startScript" exep "echo -e \"\nexit 0\" >> $startScript"
echoseq " [W] Reboot to make changes active" warning "Reboot to make changes active"
} }
tvserviceBin="/usr/bin/tvservice" tvserviceBin="/usr/bin/tvservice"
tvserviceOffCmd="${tvserviceBin} -o'" tvserviceOffCmd="${tvserviceBin} -o'"
@@ -577,9 +577,9 @@ checkBootConfig() {
return $? return $?
} }
step_100_alias() { ALIAS="notes"; } step_100_alias() { echo "notes"; }
step_100() { step_100() {
outColor green color green
cat <<NOTES_EOF cat <<NOTES_EOF
# Initial configuration steps # Initial configuration steps
@@ -614,5 +614,5 @@ step_100() {
NOTES_EOF NOTES_EOF
} }
VERSION_SEQREV=15 readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh

View File

@@ -12,7 +12,7 @@ SCRIPT_NAME=${SCRIPT_NAME%%.*}
CONFIG_FILE_NAME="${SCRIPT_NAME}.cfg" CONFIG_FILE_NAME="${SCRIPT_NAME}.cfg"
CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example" CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
step_config() { seq_config() {
initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE" initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE"
if [ $? -eq 0 ] ; then if [ $? -eq 0 ] ; then
CONFIG=1 CONFIG=1
@@ -20,10 +20,10 @@ step_config() {
} }
step_1_info() { echo "Install $toolName"; } step_1_info() { echo "Install $toolName"; }
step_1_alias() { ALIAS="install"; } step_1_alias() { echo "install"; }
step_1() { step_1() {
local aptOpt= local aptOpt=
if [ $QUIET -ne 0 ];then if quiet;then
aptOpt="-y" aptOpt="-y"
fi fi
@@ -32,7 +32,7 @@ step_1() {
} }
step_2_info() { echo "Installation notes"; } step_2_info() { echo "Installation notes"; }
step_2_alias() { ALIAS="notes"; } step_2_alias() { echo "notes"; }
step_2() { step_2() {
cat <<NOTES_EOF cat <<NOTES_EOF
# For php applications make sure php-redis is installed # For php applications make sure php-redis is installed
@@ -70,7 +70,7 @@ step_10_info() {
echoinfo " [CLI COMMAND]" echoinfo " [CLI COMMAND]"
echoinfo " e.g. info" echoinfo " e.g. info"
} }
step_10_alias() { ALIAS="cli"; } step_10_alias() { echo "cli"; }
step_10() { step_10() {
shift shift
local cliCmd="$@" local cliCmd="$@"
@@ -82,5 +82,5 @@ step_10() {
fi fi
} }
VERSION_SEQREV=14 readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh

View File

@@ -16,7 +16,7 @@ CONFIG=0
CONFIG_FILE_NAME="${toolName}.cfg" CONFIG_FILE_NAME="${toolName}.cfg"
CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example" CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
step_config() { seq_config() {
## use sequencer api: ## use sequencer api:
initSeqConfig -t "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE" initSeqConfig -t "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE"
if [ $CONFIG -eq 0 ] ; then if [ $CONFIG -eq 0 ] ; then
@@ -25,10 +25,10 @@ step_config() {
} }
step_1_info() { echo "Install $toolName"; } step_1_info() { echo "Install $toolName"; }
step_1_alias() { ALIAS="install"; } step_1_alias() { echo "install"; }
step_1() { step_1() {
local aptOpt= local aptOpt=
if [ $QUIET -ne 0 ];then if quiet;then
aptOpt="-y" aptOpt="-y"
fi fi
@@ -53,7 +53,7 @@ step_2() {
if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ] if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]
then then
echoerr ' [E] Invalid installer checksum' error -e ' [E] Invalid installer checksum'
exe rm composer-setup.php exe rm composer-setup.php
return 1 return 1
fi fi
@@ -65,7 +65,7 @@ step_2() {
} }
step_3_info() { echo "Configure $toolName"; } step_3_info() { echo "Configure $toolName"; }
step_3_alias() { ALIAS="config"; } step_3_alias() { echo "config"; }
step_3() { step_3() {
echo " [I] Recommended composer packages to be added to \"require\" section:" echo " [I] Recommended composer packages to be added to \"require\" section:"
echo ' "melanie2/mobile": "*",' echo ' "melanie2/mobile": "*",'
@@ -89,9 +89,9 @@ step_3() {
} }
step_10_info() { echo "Configuration notes"; } step_10_info() { echo "Configuration notes"; }
step_10_alias() { ALIAS="notes"; } step_10_alias() { echo "notes"; }
step_10() { step_10() {
outColor green color green
cat <<NOTES_END cat <<NOTES_END
# smtp port if missing after installation # smtp port if missing after installation
[$RC_LOC/config/config.inc.php] [$RC_LOC/config/config.inc.php]
@@ -126,9 +126,9 @@ NOTES_END
} }
step_12_info() { echo "Troubleshooting"; } step_12_info() { echo "Troubleshooting"; }
step_12_alias() { ALIAS="trouble"; } step_12_alias() { echo "trouble"; }
step_12() { step_12() {
outColor green color green
cat <<TROUBLE_END cat <<TROUBLE_END
# On composer update errors. # On composer update errors.
@@ -148,10 +148,10 @@ step_20_info() {
echo echo
fi fi
} }
step_20_alias() { ALIAS="backup"; } step_20_alias() { echo "backup"; }
step_20() { step_20() {
if [ $CONFIG -eq 0 ] ; then if [ $CONFIG -eq 0 ] ; then
echoerr " [E] No configuration file found" error -e "No configuration file found"
return 1 return 1
fi fi
if [ ! -z $RC_BACKUP ] ; then if [ ! -z $RC_BACKUP ] ; then
@@ -168,7 +168,7 @@ step_22_info() {
echoinfoArgs "[CUSTOM VERSION]" echoinfoArgs "[CUSTOM VERSION]"
echo "Upgrade installation to \"latest\" from github if [CUSTOM_VERSION] is empty" echo "Upgrade installation to \"latest\" from github if [CUSTOM_VERSION] is empty"
} }
step_22_alias() { ALIAS="upgrade"; } step_22_alias() { echo "upgrade"; }
step_22() { step_22() {
shift # don't need step number shift # don't need step number
local currentVersion= local currentVersion=
@@ -180,9 +180,9 @@ step_22() {
fi fi
if [ -z $latestVersion ] ; then if [ -z $latestVersion ] ; then
echoerr " [E] Cannot determine latest version from github repository" error -e "Cannot determine latest version from github repository"
return 1 return 1
elif [ $QUIET -eq 0 ] ; then elif interactive ; then
echo echo
currentVersion="$(grep -Po ' \| Version \K.*?(?= )' $RC_LOC/index.php)" currentVersion="$(grep -Po ' \| Version \K.*?(?= )' $RC_LOC/index.php)"
exe read -p "Install $latestVersion over $currentVersion to $RC_LOC [n]o/(y)es? " answer exe read -p "Install $latestVersion over $currentVersion to $RC_LOC [n]o/(y)es? " answer
@@ -190,7 +190,7 @@ step_22() {
[yY]) [yY])
;; ;;
*) *)
echoerr " [I] Upgrade aborted" info -e "Upgrade aborted"
return 1 return 1
;; ;;
esac esac
@@ -198,7 +198,7 @@ step_22() {
local isInstalled=$(grep -E "RELEASE $latestVersion" "${RC_LOC}/CHANGELOG" >>/dev/null && echo "1" || echo "0") local isInstalled=$(grep -E "RELEASE $latestVersion" "${RC_LOC}/CHANGELOG" >>/dev/null && echo "1" || echo "0")
if [ $isInstalled -eq 1 ] ; then if [ $isInstalled -eq 1 ] ; then
echoerr " [E] Version $latestVersion is already installed" error -e "Version $latestVersion is already installed"
return 2 return 2
fi fi
@@ -211,7 +211,7 @@ step_22() {
} }
step_23_info() { echo "Post upgrade procedure"; } step_23_info() { echo "Post upgrade procedure"; }
step_23_alias() { ALIAS="postupgrade"; } step_23_alias() { echo "postupgrade"; }
step_23() { step_23() {
exe cd "$RC_LOC" exe cd "$RC_LOC"
echo " [I] Starting post update procedure" echo " [I] Starting post update procedure"
@@ -254,5 +254,5 @@ downloadLatest() {
tempDown="/tmp/roundcube" tempDown="/tmp/roundcube"
tempLoc="$tempDown/rc.tar.gz" tempLoc="$tempDown/rc.tar.gz"
VERSION_SEQREV=14 readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh

View File

@@ -17,21 +17,21 @@ CONFIG_RNGD="$WDIR/${toolName}/10-rngd.conf"
CONFIG_REMOTE="$WDIR/${toolName}/90-remote.conf" CONFIG_REMOTE="$WDIR/${toolName}/90-remote.conf"
step_1_info() { echo "Install $toolName"; } step_1_info() { echo "Install $toolName"; }
step_1_alias() { ALIAS="install"; } step_1_alias() { echo "install"; }
step_1() { step_1() {
exe apt update exe apt update
exe apt install "$toolName" exe apt install "$toolName"
} }
step_2_info() { echo "Check configuration"; } step_2_info() { echo "Check configuration"; }
step_2_alias() { ALIAS="checkconf"; } step_2_alias() { echo "checkconf"; }
step_2() { step_2() {
exe rsyslogd -N 1 -f "$toolConfig" exe rsyslogd -N 1 -f "$toolConfig"
endReturn -o $? "Invalid $toolName configuration" endReturn -o $? "Invalid $toolName configuration"
} }
step_10_info() { echo "Reduce snmpd syslog messages"; } step_10_info() { echo "Reduce snmpd syslog messages"; }
step_10_alias() { ALIAS="snmpd"; } step_10_alias() { echo "snmpd"; }
step_10() { step_10() {
addConf -s -f "$CONFIG_SNMP" "$CONFIG_SNMP_DEST" addConf -s -f "$CONFIG_SNMP" "$CONFIG_SNMP_DEST"
endReturn -o $? endReturn -o $?
@@ -42,7 +42,7 @@ step_10() {
CONFIG_SNMP_DEST="/etc/rsyslog.d/$(basename $CONFIG_SNMP)" CONFIG_SNMP_DEST="/etc/rsyslog.d/$(basename $CONFIG_SNMP)"
step_12_info() { echo "Reduce cron syslog messages"; } step_12_info() { echo "Reduce cron syslog messages"; }
step_12_alias() { ALIAS="cron"; } step_12_alias() { echo "cron"; }
step_12() { step_12() {
addConf -s -f "$CONFIG_CRON" "$CONFIG_CRON_DEST" addConf -s -f "$CONFIG_CRON" "$CONFIG_CRON_DEST"
endReturn -o $? endReturn -o $?
@@ -53,7 +53,7 @@ step_12() {
CONFIG_CRON_DEST="/etc/rsyslog.d/$(basename $CONFIG_CRON)" CONFIG_CRON_DEST="/etc/rsyslog.d/$(basename $CONFIG_CRON)"
step_14_info() { echo "Reduce rngd syslog messages"; } step_14_info() { echo "Reduce rngd syslog messages"; }
step_14_alias() { ALIAS="rngd"; } step_14_alias() { echo "rngd"; }
step_14() { step_14() {
addConf -s -f "$CONFIG_RNGD" "$CONFIG_RNGD_DEST" addConf -s -f "$CONFIG_RNGD" "$CONFIG_RNGD_DEST"
endReturn -o $? endReturn -o $?
@@ -67,7 +67,7 @@ step_16_info() {
echoinfoArgs "<REMOTE_IP:PORT>" echoinfoArgs "<REMOTE_IP:PORT>"
echo "Send syslog messages to remote syslog server" echo "Send syslog messages to remote syslog server"
} }
step_16_alias() { ALIAS="remote"; } step_16_alias() { echo "remote"; }
step_16() { step_16() {
local rex='^[0-9\.]+\:[0-9]+$' local rex='^[0-9\.]+\:[0-9]+$'
local remoteHost="" local remoteHost=""
@@ -75,7 +75,7 @@ step_16() {
if [[ "$2" =~ $rex ]] ; then if [[ "$2" =~ $rex ]] ; then
remoteHost=$2 remoteHost=$2
else else
echoerr " [E] No valid IP:PORT detected: $2" error -e "No valid IP:PORT detected: $2"
return 1 return 1
fi fi
addConf -s -f "$CONFIG_REMOTE" "$CONFIG_REMOTE_DEST" addConf -s -f "$CONFIG_REMOTE" "$CONFIG_REMOTE_DEST"
@@ -89,15 +89,15 @@ step_16() {
CONFIG_REMOTE_DEST="/etc/rsyslog.d/$(basename $CONFIG_REMOTE)" CONFIG_REMOTE_DEST="/etc/rsyslog.d/$(basename $CONFIG_REMOTE)"
step_17_info() { echo "Add ufw rules for sending to remote syslog. Port 514/tcp"; } step_17_info() { echo "Add ufw rules for sending to remote syslog. Port 514/tcp"; }
step_17_alias() { ALIAS="ufw"; } step_17_alias() { echo "ufw"; }
step_17() { step_17() {
exe ufw allow out on eth0 to any port 514 proto tcp comment "syslog remote" exe ufw allow out on eth0 to any port 514 proto tcp comment "syslog remote"
} }
step_30_info() { echo "Activating syslog server"; } step_30_info() { echo "Activating syslog server"; }
step_30_alias() { ALIAS="server"; } step_30_alias() { echo "server"; }
step_30() { step_30() {
outColor green color green
cat << SERVER_EOF cat << SERVER_EOF
# Uncomment the chapter # Uncomment the chapter
@@ -106,5 +106,5 @@ step_30() {
SERVER_EOF SERVER_EOF
} }
VERSION_SEQREV=14 readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh

View File

@@ -6,9 +6,9 @@ toolConfigLoc="/etc/snmp"
toolConfig="${toolConfigLoc}/snmpd.conf" toolConfig="${toolConfigLoc}/snmpd.conf"
toolSysUser="Debian-snmp" toolSysUser="Debian-snmp"
step_config() { seq_config() {
## Apt cmdline option to suppress user interaction ## Apt cmdline option to suppress user interaction
[ $QUIET -ne 0 ] && APTOPT="-y" quiet && APTOPT="-y"
## Return of non zero value will abort the sequence ## Return of non zero value will abort the sequence
return 0 return 0
@@ -16,10 +16,10 @@ step_config() {
step_1_info() { echo "Install packages for $toolName"; } step_1_info() { echo "Install packages for $toolName"; }
step_1_alias() { ALIAS="install"; } step_1_alias() { echo "install"; }
step_1() { step_1() {
exe apt update exe apt update
if [ $QUIET != 0 ]; then if quiet; then
exe apt-get -qq install $toolName exe apt-get -qq install $toolName
else else
exe apt install $toolName exe apt install $toolName
@@ -32,23 +32,23 @@ step_2_info() {
echo "Setup snmp v3 access" echo "Setup snmp v3 access"
echoinfo " -s : Stop after creating authentication entry" echoinfo " -s : Stop after creating authentication entry"
} }
step_2_alias() { ALIAS="v3access"; } step_2_alias() { echo "v3access"; }
step_2() { step_2() {
# #
## Create authentication entry ## Create authentication entry
exep "cat \"$v3AuthLoc\" | grep -e '^\s*usmUser'" exep "cat \"$v3AuthLoc\" | grep -e '^\s*usmUser'"
if [ "$?" == "0" ]; then if [ "$?" == "0" ]; then
echoseq info
exe read -p "User entry found. Continue: y/n(default)? " answer exe read -p "User entry found. Continue: y/n(default)? " answer
case $answer in case $answer in
[yY]) [yY])
echoseq info
echoseq "Continuing installation..." info "Continuing installation..."
;; ;;
*) *)
echoseq info
echoseq "Installation aborted" info "Installation aborted"
return 1; return 1;
;; ;;
esac esac
@@ -56,14 +56,14 @@ step_2() {
read -p "SNMPv3 Username: " v3User read -p "SNMPv3 Username: " v3User
read -p "SNMPv3 Password: " v3Pass read -p "SNMPv3 Password: " v3Pass
echoseq info
read -p "Repeat Password: " v3Pass2 read -p "Repeat Password: " v3Pass2
if [ "$v3Pass" != "$v3Pass2" ] ; then if [ "$v3Pass" != "$v3Pass2" ] ; then
echoerr " [E] Password mismatch" error -e "Password mismatch"
return 1 return 1
fi fi
echoseq info
exe service snmpd stop exe service snmpd stop
@@ -74,7 +74,7 @@ step_2() {
shift shift
if [ ! -z $1 ] && [ "$1" == "-s" ] ; then if [ ! -z $1 ] && [ "$1" == "-s" ] ; then
echoseq " [I] Stop after creating authentication config" info "Stop after creating authentication config"
exe service snmpd start exe service snmpd start
return 0 return 0
fi fi
@@ -105,7 +105,7 @@ step_5_info() {
echo "Add ufw rules for port 161 udp" echo "Add ufw rules for port 161 udp"
echoinfo " [INTERFACE] (default: eth0)" echoinfo " [INTERFACE] (default: eth0)"
} }
step_5_alias() { ALIAS="ufw"; } step_5_alias() { echo "ufw"; }
step_5() { step_5() {
shift shift
local lInterface="eth0" local lInterface="eth0"
@@ -118,7 +118,7 @@ step_5() {
} }
step_20_info() { echo "Extend $toolName for Raspberry Pi"; } step_20_info() { echo "Extend $toolName for Raspberry Pi"; }
step_20_alias() { ALIAS="raspberry"; } step_20_alias() { echo "raspberry"; }
step_20() { step_20() {
checkExtend raspberry checkExtend raspberry
if [ "$?" != "0" ]; then if [ "$?" != "0" ]; then
@@ -143,7 +143,7 @@ rpiSudoersLoc="/etc/sudoers.d/snmprpi"
rpiSudoersContent="${toolSysUser} ALL=(ALL) NOPASSWD: /etc/snmp/raspberry.sh, /usr/bin/vcgencmd*" rpiSudoersContent="${toolSysUser} ALL=(ALL) NOPASSWD: /etc/snmp/raspberry.sh, /usr/bin/vcgencmd*"
step_22_info() { echo "Extend $toolName with OS update availablity"; } step_22_info() { echo "Extend $toolName with OS update availablity"; }
step_22_alias() { ALIAS="osupdate"; } step_22_alias() { echo "osupdate"; }
step_22() { step_22() {
checkExtend osupdate checkExtend osupdate
if [ "$?" != "0" ]; then if [ "$?" != "0" ]; then
@@ -167,21 +167,21 @@ osUpdateCron="/etc/cron.d/aptUpdate"
osUpdateCronContent="22 */6 * * * root /usr/bin/apt-get -qq update" osUpdateCronContent="22 */6 * * * root /usr/bin/apt-get -qq update"
step_25_info() { echo "Prepare nginx to provide php-fpm status to $toolName"; } step_25_info() { echo "Prepare nginx to provide php-fpm status to $toolName"; }
step_25_alias() { ALIAS="phpfpm"; } step_25_alias() { echo "phpfpm"; }
step_25() { step_25() {
echo -e "\n [!] Please add the following to your default server:\n" echo -e "\n [!] Please add the following to your default server:\n"
echo "$phpFpmStatusNginx" echo "$phpFpmStatusNginx"
echo echo
if [ $QUIET -ne 0 ] ; then if quiet ; then
answer=n answer=n
else else
exe read -p "Open new shell to configure y/[n]? " answer exe read -p "Open new shell to configure y/[n]? " answer
fi fi
case $answer in case $answer in
[yY]) [yY])
echoseq " [I] Opening interactive shell. Type \"exit\" to return to this script." info "Opening interactive shell. Type \"exit\" to return to this script."
exe bash -i exe bash -i
echoseq " [I] Interactive shell ended. Continuing with $0." info "Interactive shell ended. Continuing with $0."
exe nginx -t exe nginx -t
endReturn -o $? "Nginx configuration error" endReturn -o $? "Nginx configuration error"
@@ -206,7 +206,7 @@ fastcgi_pass unix:/var/run/php/php${phpVersionStr}-fpm.sock;
}" }"
step_26_info() { echo "Prepare php config for php-fpm status"; } step_26_info() { echo "Prepare php config for php-fpm status"; }
step_26_alias() { ALIAS="phpfpm_config"; } step_26_alias() { echo "phpfpm_config"; }
step_26() { step_26() {
exe sed -i "s/^;\(pm\.status_path\)/\1/" "$phpPoolConfigLoc" exe sed -i "s/^;\(pm\.status_path\)/\1/" "$phpPoolConfigLoc"
exe php-fpm${phpVersionStr} -t exe php-fpm${phpVersionStr} -t
@@ -218,7 +218,7 @@ phpConfigDir="/etc/php/${phpVersionStr}"
phpPoolConfigLoc="${phpConfigDir}/fpm/pool.d/www.conf" phpPoolConfigLoc="${phpConfigDir}/fpm/pool.d/www.conf"
step_27_info() { echo "Extend $toolName with parsing of php-fpm status"; } step_27_info() { echo "Extend $toolName with parsing of php-fpm status"; }
step_27_alias() { ALIAS="phpfpm_extend"; } step_27_alias() { echo "phpfpm_extend"; }
step_27() { step_27() {
checkExtend phpfpmsp checkExtend phpfpmsp
if [ "$?" != "0" ]; then if [ "$?" != "0" ]; then
@@ -236,21 +236,21 @@ step_27() {
phpfpmExtendLoc="${toolConfigLoc}/phpfpmsp" phpfpmExtendLoc="${toolConfigLoc}/phpfpmsp"
step_29_info() { echo "Prepare nginx to provide status to $toolName"; } step_29_info() { echo "Prepare nginx to provide status to $toolName"; }
step_29_alias() { ALIAS="nginx"; } step_29_alias() { echo "nginx"; }
step_29() { step_29() {
echoseq -e "\n [!] Please add the following to your default server:\n" info -e "\n [!] Please add the following to your default server:\n"
echoseq "$nginxStatus" info "$nginxStatus"
echoseq info
if [ $QUIET -ne 0 ] ; then if quiet ; then
answer=n answer=n
else else
exe read -p "Open new shell to configure y/[n]? " answer exe read -p "Open new shell to configure y/[n]? " answer
fi fi
case $answer in case $answer in
[yY]) [yY])
echoseq " [I] Opening interactive shell. Type \"exit\" to return to this script." info "Opening interactive shell. Type \"exit\" to return to this script."
exe bash -i exe bash -i
echoseq " [I] Interactive shell ended. Continuing with $0." info "Interactive shell ended. Continuing with $0."
exe nginx -t exe nginx -t
endReturn -o $? "Nginx configuration error" endReturn -o $? "Nginx configuration error"
@@ -270,7 +270,7 @@ deny all;
} }
" "
step_30_info() { echo "Extend $toolName with parsing of nginx status"; } step_30_info() { echo "Extend $toolName with parsing of nginx status"; }
step_30_alias() { ALIAS="nginx_extend"; } step_30_alias() { echo "nginx_extend"; }
step_30() { step_30() {
checkExtend nginx checkExtend nginx
if [ "$?" != "0" ]; then if [ "$?" != "0" ]; then
@@ -289,10 +289,10 @@ nginxExtendLoc="${toolConfigLoc}/nginx"
# postfix # postfix
step_32_info() { echo "Extend for postfix detailed and queue"; } step_32_info() { echo "Extend for postfix detailed and queue"; }
step_32_alias() { ALIAS="postfix"; } step_32_alias() { echo "postfix"; }
step_32() { step_32() {
local aptOpt= local aptOpt=
if [ $QUIET -ne 0 ];then if quiet;then
aptOpt="-y" aptOpt="-y"
fi fi
@@ -314,11 +314,11 @@ step_33() {
exe chown root:$toolSysUser "$postfixCacheLoc" exe chown root:$toolSysUser "$postfixCacheLoc"
exe chmod 770 "$postfixCacheLoc" exe chmod 770 "$postfixCacheLoc"
echoseq " [I] Create symlink /var/log/maillog which is used by postfixdetailed" info "Create symlink /var/log/maillog which is used by postfixdetailed"
exe ln -fs /var/log/mail.log /var/log/maillog exe ln -fs /var/log/mail.log /var/log/maillog
echoseq " [I] Run /etc/snmp/postfixdetailed to create the initial cache file" info "Run /etc/snmp/postfixdetailed to create the initial cache file"
echoseq " so you don't end up with some crazy initial starting value." info " so you don't end up with some crazy initial starting value."
exe sudo -u $toolSysUser "$postfixScript" exe sudo -u $toolSysUser "$postfixScript"
} }
postfixCacheLoc="/var/cache/postfixdetailed" postfixCacheLoc="/var/cache/postfixdetailed"
@@ -328,9 +328,9 @@ postfixQueuesExtendLoc="${toolConfigLoc}/postfix-queues"
step_34_info() { echo "Create sudoers file for postfix scripts"; } step_34_info() { echo "Create sudoers file for postfix scripts"; }
step_34() { step_34() {
addConf -s "$postfixSudoersContent" "$postfixSudoersLoc" addConf -s "$postfixSudoersContent" "$postfixSudoersLoc"
echoseq " [I] Changing ${postfixQueuesExtendLoc} to add sudo for qshape" info "Changing ${postfixQueuesExtendLoc} to add sudo for qshape"
exe sed -i -E "s/\`qshape/\`sudo qshape/" "${postfixQueuesExtendLoc}" exe sed -i -E "s/\`qshape/\`sudo qshape/" "${postfixQueuesExtendLoc}"
echoseq " [W] Reboot may be required to make these changes active" warning "Reboot may be required to make these changes active"
} }
postfixSudoersLoc="/etc/sudoers.d/snmppostfix" postfixSudoersLoc="/etc/sudoers.d/snmppostfix"
postfixSudoersContent="${toolSysUser} ALL=(ALL) NOPASSWD: /usr/sbin/qshape" postfixSudoersContent="${toolSysUser} ALL=(ALL) NOPASSWD: /usr/sbin/qshape"
@@ -339,12 +339,12 @@ step_35_info() { echo "Create postfix extends (postfixdetailed and postfix-queue
step_35() { step_35() {
checkExtend postfix-queues checkExtend postfix-queues
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echoseq " [I] Create postfix-queues extend" info "Create postfix-queues extend"
addConf -a "extend mailq ${postfixQueuesExtendLoc}" "$toolConfig" addConf -a "extend mailq ${postfixQueuesExtendLoc}" "$toolConfig"
fi fi
checkExtend postfixdetailed checkExtend postfixdetailed
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echoseq " [I] Create postfixdetailed extend" info "Create postfixdetailed extend"
addConf -a "extend postfixdetailed ${postfixScript}" "$toolConfig" addConf -a "extend postfixdetailed ${postfixScript}" "$toolConfig"
fi fi
@@ -353,10 +353,10 @@ step_35() {
#fail2ban #fail2ban
step_37_info() { echo "Extend for fail2ban jail information"; } step_37_info() { echo "Extend for fail2ban jail information"; }
step_37_alias() { ALIAS="fail2ban"; } step_37_alias() { echo "fail2ban"; }
step_37(){ step_37(){
local aptOpt= local aptOpt=
if [ $QUIET -ne 0 ];then if quiet;then
aptOpt="-y" aptOpt="-y"
fi fi
@@ -367,7 +367,7 @@ step_37(){
checkExtend fail2ban checkExtend fail2ban
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echoseq " [I] Create fail2ban extend" info "Create fail2ban extend"
addConf -a "extend fail2ban ${fail2banExtendLoc} -c" "$toolConfig" addConf -a "extend fail2ban ${fail2banExtendLoc} -c" "$toolConfig"
fi fi
@@ -385,7 +385,7 @@ fail2banCron="# Update cache for faster fail2ban polling
*/3 * * * * root ${fail2banExtendLoc} -u" */3 * * * * root ${fail2banExtendLoc} -u"
step_40_info() { echo "Create linux distribution detection extend (distro)"; } step_40_info() { echo "Create linux distribution detection extend (distro)"; }
step_40_alias() { ALIAS="distro"; } step_40_alias() { echo "distro"; }
step_40() { step_40() {
checkExtend distro checkExtend distro
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
@@ -396,7 +396,7 @@ step_40() {
endReturn -o $? "Download distro detection script failed" endReturn -o $? "Download distro detection script failed"
exe chmod +x "$distroExtendLoc" exe chmod +x "$distroExtendLoc"
echoseq " [I] Create distro extend" info "Create distro extend"
addConf -a "extend distro ${distroExtendLoc}" "$toolConfig" addConf -a "extend distro ${distroExtendLoc}" "$toolConfig"
exe service snmpd restart exe service snmpd restart
@@ -408,7 +408,7 @@ step_42_info() {
echo "Gather dhcp information from a dhcpd lease file" echo "Gather dhcp information from a dhcpd lease file"
echoinfo "pi-hole lease file not supported" echoinfo "pi-hole lease file not supported"
} }
step_42_alias() { ALIAS="dhcp"; } step_42_alias() { echo "dhcp"; }
step_42() { step_42() {
local locExtName="dhcpstats" local locExtName="dhcpstats"
local locExtUrl="https://github.com/librenms/librenms-agent/raw/master/snmp/dhcp.py" local locExtUrl="https://github.com/librenms/librenms-agent/raw/master/snmp/dhcp.py"
@@ -424,10 +424,10 @@ step_42() {
endReturn -o $? "Download $locExtName script failed" endReturn -o $? "Download $locExtName script failed"
exe chmod +x "$locExtLoc" exe chmod +x "$locExtLoc"
echoseq " [I] Create extend for $locExtName" info "Create extend for $locExtName"
addConf -a "extend $locExtName ${locExtLoc}" "$toolConfig" addConf -a "extend $locExtName ${locExtLoc}" "$toolConfig"
echoseq " [I] Create config for $locExtName" info "Create config for $locExtName"
addConf -s "$dhcpExtendConfig" "$dhcpExtendConfigLoc" addConf -s "$dhcpExtendConfig" "$dhcpExtendConfigLoc"
echo " [W] Adapt config $dhcpExtendConfigLoc manually and restart snmpd" echo " [W] Adapt config $dhcpExtendConfigLoc manually and restart snmpd"
@@ -437,7 +437,7 @@ dhcpExtendConfig="{\"leasefile\": \"/var/lib/dhcp/dhcpd.leases\"
}" }"
step_44_info() { echo "Extend unbound stats"; } step_44_info() { echo "Extend unbound stats"; }
step_44_alias() { ALIAS="unbound"; } step_44_alias() { echo "unbound"; }
step_44() { step_44() {
local locExtName="unbound" local locExtName="unbound"
local locExtUrl="https://github.com/librenms/librenms-agent/raw/master/snmp/unbound" local locExtUrl="https://github.com/librenms/librenms-agent/raw/master/snmp/unbound"
@@ -450,10 +450,10 @@ step_44() {
endReturn -o $? "Download $locExtName script failed" endReturn -o $? "Download $locExtName script failed"
exe chmod +x "$locExtLoc" exe chmod +x "$locExtLoc"
echoseq " [I] Create extend for $locExtName" info "Create extend for $locExtName"
addConf -a "extend $locExtName /usr/bin/sudo ${locExtLoc}" "$toolConfig" addConf -a "extend $locExtName /usr/bin/sudo ${locExtLoc}" "$toolConfig"
echoseq " [I] Create config for $locExtName" info "Create config for $locExtName"
addConf -s "$unboundExtendConfig" "$unboundExtendConfigLoc" addConf -s "$unboundExtendConfig" "$unboundExtendConfigLoc"
exe systemctl restart unbound.service exe systemctl restart unbound.service
@@ -480,7 +480,7 @@ unboundSudoerLoc="/etc/sudoers.d/snmpunbound"
unboundSudoer="Debian-snmp ALL=(ALL) NOPASSWD: /usr/sbin/unbound-control, ${toolConfigLoc}/unbound" unboundSudoer="Debian-snmp ALL=(ALL) NOPASSWD: /usr/sbin/unbound-control, ${toolConfigLoc}/unbound"
step_46_info() { echo "Extend pi-hole stats"; } step_46_info() { echo "Extend pi-hole stats"; }
step_46_alias() { ALIAS="pihole"; } step_46_alias() { echo "pihole"; }
step_46() { step_46() {
local locExtName="pi-hole" local locExtName="pi-hole"
local locExtUrl="https://github.com/librenms/librenms-agent/raw/master/snmp/pi-hole" local locExtUrl="https://github.com/librenms/librenms-agent/raw/master/snmp/pi-hole"
@@ -495,19 +495,19 @@ step_46() {
endReturn -o $? "Download $locExtName script failed" endReturn -o $? "Download $locExtName script failed"
exe chmod +x "$locExtLoc" exe chmod +x "$locExtLoc"
echoseq " [I] Create extend for $locExtName" info "Create extend for $locExtName"
addConf -a "extend $locExtName ${locExtLoc}" "$toolConfig" addConf -a "extend $locExtName ${locExtLoc}" "$toolConfig"
if [ $QUIET -ne 0 ]; then if quiet; then
outColor red color red
echo -e " [W] Check the following in the extend script and restart snmpd:\n" echo -e " [W] Check the following in the extend script and restart snmpd:\n"
else else
echo " [I] Check the follwing in the extend script:" echo " [I] Check the follwing in the extend script:"
fi fi
echo "(API_AUTH_KEY) Add your pi-hole API key" echo "(API_AUTH_KEY) Add your pi-hole API key"
echo " (API_URL) and check the API URL" echo " (API_URL) and check the API URL"
outColor color
if [ $QUIET -eq 0 ]; then if interactive; then
exe read -p "Hit Enter to continue..." exe read -p "Hit Enter to continue..."
exe vi "$locExtLoc" exe vi "$locExtLoc"
exe systemctl restart snmpd.service exe systemctl restart snmpd.service
@@ -516,9 +516,9 @@ step_46() {
piholeDeps="jq" piholeDeps="jq"
step_100_info() { echo "Notes"; } step_100_info() { echo "Notes"; }
step_100_alias() { ALIAS="notes"; } step_100_alias() { echo "notes"; }
step_100() { step_100() {
outColor green color green
cat <<NOTES_END cat <<NOTES_END
# Reduce log level of snmpd # Reduce log level of snmpd
@@ -565,18 +565,18 @@ NOTES_END
checkExtend() { checkExtend() {
# adding dry run output for clarification # adding dry run output for clarification
if [ $DRY -ne 0 ] ; then if dry ; then
echoseq " [I] check if \"extend ${1}\" exists..dry-run" info "check if \"extend ${1}\" exists..dry-run"
fi fi
exep "cat \"$toolConfig\" | grep -e '^\s*extend\s\+${1}' >>/dev/null 2>&1" exep "cat \"$toolConfig\" | grep -e '^\s*extend\s\+${1}' >>/dev/null 2>&1"
# Only warn if entry exists and dry-run is not seleted # Only warn if entry exists and dry-run is not seleted
if [ $? -eq 0 ] && [ $DRY -eq 0 ] ; then if [ $? -eq 0 ] && ! dry ; then
return 1 return 1
fi fi
return 0 return 0
} }
VERSION_SEQREV=15 readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh

View File

@@ -26,10 +26,10 @@ step_1_info() {
echo "Install packages: $toolDeps" echo "Install packages: $toolDeps"
echoinfo "May take a long time" echoinfo "May take a long time"
} }
step_1_alias() { ALIAS="install"; } step_1_alias() { echo "install"; }
step_1() { step_1() {
local aptOpt= local aptOpt=
if [ $QUIET -ne 0 ];then if quiet;then
aptOpt="-y" aptOpt="-y"
fi fi
exe apt update exe apt update
@@ -37,16 +37,16 @@ step_1() {
} }
step_20_info() { echo "List spam/ham counts"; } step_20_info() { echo "List spam/ham counts"; }
step_20_alias() { ALIAS="list"; } step_20_alias() { echo "list"; }
step_20() { step_20() {
exe mysql -D $SA_BAYES_DBNAME -e 'select username,spam_count,ham_count from bayes_vars;' exe mysql -D $SA_BAYES_DBNAME -e 'select username,spam_count,ham_count from bayes_vars;'
} }
SA_BAYES_DBNAME='spambayes_db' SA_BAYES_DBNAME='spambayes_db'
step_50_info() { echo "Notes"; } step_50_info() { echo "Notes"; }
step_50_alias() { ALIAS="notes"; } step_50_alias() { echo "notes"; }
step_50() { step_50() {
outColor green color green
echo "$notes" echo "$notes"
} }
notes=' notes='
@@ -150,5 +150,5 @@ notes='
saNewHam=$(cat);( echo "$saNewHam" | /usr/bin/sa-learn -u ${1} --ham ) & saNewHam=$(cat);( echo "$saNewHam" | /usr/bin/sa-learn -u ${1} --ham ) &
' '
VERSION_SEQREV=14 readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh

View File

@@ -9,14 +9,14 @@ aHost=""
aPort="22" aPort="22"
step_1_info() { echo "Install $toolName"; } step_1_info() { echo "Install $toolName"; }
step_1_alias() { ALIAS="install"; } step_1_alias() { echo "install"; }
step_1() { step_1() {
exe apt update exe apt update
exe apt install ssh exe apt install ssh
} }
step_3_info() { echo "Create $toolName authentication keys"; } step_3_info() { echo "Create $toolName authentication keys"; }
step_3_alias() { ALIAS="create"; } step_3_alias() { echo "create"; }
step_3() { step_3() {
exep "ssh-keygen -l -f $toolIdentity 2>>/dev/null" exep "ssh-keygen -l -f $toolIdentity 2>>/dev/null"
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
@@ -32,7 +32,7 @@ step_5_info() {
echoinfo "[OPTIONS]" echoinfo "[OPTIONS]"
echoinfo " -4 : Force Ipv4" echoinfo " -4 : Force Ipv4"
} }
step_5_alias() { ALIAS="sendkey"; } step_5_alias() { echo "sendkey"; }
step_5() { step_5() {
shift shift
local arg local arg
@@ -53,7 +53,7 @@ step_5() {
done done
if [ -z "$1" ] || [ "$1" == "" ] ; then if [ -z "$1" ] || [ "$1" == "" ] ; then
echoerr " [E] Host not provided." error -e "Host not provided."
return 1 return 1
else else
sshHost="$1" sshHost="$1"
@@ -75,7 +75,7 @@ step_10_info() {
echo "Send command(ssh)/file(scp) list to remote(s)" echo "Send command(ssh)/file(scp) list to remote(s)"
echoinfo "[USER:HOST] and [PORT] are overwritten by \"host\" command from <CMDLIST>" echoinfo "[USER:HOST] and [PORT] are overwritten by \"host\" command from <CMDLIST>"
} }
step_10_alias() { ALIAS="sendlist"; } step_10_alias() { echo "sendlist"; }
step_10() { step_10() {
shift shift
aList=$1 aList=$1
@@ -115,11 +115,11 @@ parseList() {
if [ -z "$1" ] || [ ! -f "$1" ]; then if [ -z "$1" ] || [ ! -f "$1" ]; then
if [ -z "$1" ]; then if [ -z "$1" ]; then
echoerr " [E] No Command list found" error -e "No Command list found"
else else
echoerr " [E] Command list not found: $1" error -e "Command list not found: $1"
fi fi
if [ ! -z "$1" ] && [ $DRY == 0 ] && [ $QUIET == 0 ] ; then if [ ! -z "$1" ] && dry || interactive ; then
read -p " Create template there y/[n]? " answer read -p " Create template there y/[n]? " answer
case "$answer" in case "$answer" in
y|Y) y|Y)
@@ -132,7 +132,7 @@ parseList() {
return 1 return 1
fi fi
echoseq " [I] Parsing $(realpath $1) ..." info "Parsing $(realpath $1) ..."
local line=1 local line=1
# Working loop without ssh "stealing standard input" by # Working loop without ssh "stealing standard input" by
# https://unix.stackexchange.com/questions/24260/reading-lines-from-a-file-with-bash-for-vs-while # https://unix.stackexchange.com/questions/24260/reading-lines-from-a-file-with-bash-for-vs-while
@@ -184,15 +184,15 @@ parseList() {
esac esac
getReturn getReturn
if [ $? -ne 0 ] ; then if [ $? -ne 0 ] ; then
echoerr -e " [E] $line:$errorMsg" error -e -e " [E] $line:$errorMsg"
if [ $QUIET -eq 0 ] ; then if interactive ; then
endReturn -f "Stop on first error" endReturn -f "Stop on first error"
fi fi
fi fi
((line++)) ((line++))
done 3<"$1" done 3<"$1"
echoseq " [I] Parsed $((--line)) lines" info "Parsed $((--line)) lines"
} }
listFileTemplate="# following files are send to host given on command line listFileTemplate="# following files are send to host given on command line
@@ -210,5 +210,5 @@ f|/sourcedir/sourcefile|/destdir/destfile
f|/sourcedir/sourcefile|/destdir/destfile f|/sourcedir/sourcefile|/destdir/destfile
c|/destdir2/update.sh" c|/destdir2/update.sh"
VERSION_SEQREV=14 readonly sqr_minVersion=16
. sequencer.sh . sequencer.sh

View File

@@ -18,12 +18,12 @@ CONFIG=0
CONFIG_FILE_NAME="${toolName}.cfg" CONFIG_FILE_NAME="${toolName}.cfg"
CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example" CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
step_config() { seq_config() {
initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE" initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE"
if [ $? -eq 0 ] ; then if [ $? -eq 0 ] ; then
CONFIG=1 CONFIG=1
else else
[ $DRY -eq 0 ] && return 1 dry || return 1
fi fi
toolConfigLoc=`eval echo "$TWXA_CONFIG_LOC"` toolConfigLoc=`eval echo "$TWXA_CONFIG_LOC"`
toolConfig="$toolConfigLoc/config_cache/$toolConfigName" toolConfig="$toolConfigLoc/config_cache/$toolConfigName"
@@ -39,7 +39,7 @@ step_config() {
} }
step_1_info() { echo "Install $toolName [VERSION]"; } step_1_info() { echo "Install $toolName [VERSION]"; }
step_1_alias() { ALIAS="install"; } step_1_alias() { echo "install"; }
step_1() { step_1() {
shift shift
if [ ! -z $1 ] ; then if [ ! -z $1 ] ; then
@@ -49,7 +49,7 @@ step_1() {
} }
step_2_info() { echo "Setup git repository at $toolGitLoc [VERSION e.g. 1.4.1]"; } step_2_info() { echo "Setup git repository at $toolGitLoc [VERSION e.g. 1.4.1]"; }
step_2_alias() { ALIAS="git"; } step_2_alias() { echo "git"; }
step_2() { step_2() {
shift shift
if [ ! -e "$toolGitLoc/.git" ] ; then if [ ! -e "$toolGitLoc/.git" ] ; then
@@ -67,11 +67,11 @@ step_2() {
} }
step_20_info() { echo "Backup $toolName"; } step_20_info() { echo "Backup $toolName"; }
step_20_alias() { ALIAS="backup"; } step_20_alias() { echo "backup"; }
step_20() { step_20() {
shift shift
if [ ! -e "$toolConfigLoc" ] ; then if [ ! -e "$toolConfigLoc" ] ; then
echoerr " [E] No installation found" error -e "No installation found"
return 1 return 1
fi fi
@@ -115,7 +115,7 @@ step_20() {
} }
step_30_info() { echo "Upgrade $toolName [VERSION]"; } step_30_info() { echo "Upgrade $toolName [VERSION]"; }
step_30_alias() { ALIAS="upgrade"; } step_30_alias() { echo "upgrade"; }
step_30() { step_30() {
shift shift
if [ ! -z $1 ] ; then if [ ! -z $1 ] ; then
@@ -124,7 +124,7 @@ step_30() {
#step backup #step backup
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echoerr " [E] Backup failed. Aborting upgrade." error -e "Backup failed. Aborting upgrade."
return 1 return 1
fi fi
@@ -143,5 +143,5 @@ step_30() {
exe chown -R www-data: "$toolConfigLoc/*_cache" exe chown -R www-data: "$toolConfigLoc/*_cache"
} }
VERSION_SEQREV=11 readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh

View File

@@ -17,20 +17,20 @@ SCRIPT_NAME=${SCRIPT_NAME%%.*}
CONFIG_FILE_NAME="${SCRIPT_NAME}.cfg" CONFIG_FILE_NAME="${SCRIPT_NAME}.cfg"
CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example" CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
step_config() { seq_config() {
initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE" initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE"
if [ $? -eq 0 ] ; then if [ $? -eq 0 ] ; then
CONFIG=1 CONFIG=1
else else
# End if no configuration file exists # End if no configuration file exists
[ $DRY -eq 0 ] && return 1 dry || return 1
fi fi
[ $QUIET -ne 0 ] && APTOPT="-y" quiet && APTOPT="-y"
return 0 return 0
} }
step_1_info() { echo "Install $toolName"; } step_1_info() { echo "Install $toolName"; }
step_1_alias() { ALIAS="install"; } step_1_alias() { echo "install"; }
step_1() { step_1() {
exe apt update exe apt update
exe apt install $toolDeps $APTOPT exe apt install $toolDeps $APTOPT
@@ -42,7 +42,7 @@ step_1() {
} }
step_10_info() { echo "Setup blocklist update cron job"; } step_10_info() { echo "Setup blocklist update cron job"; }
step_10_alias() { ALIAS="bllupdate"; } step_10_alias() { echo "bllupdate"; }
step_10() { step_10() {
addConf -s "$TRDA_REMOTE_AUTH" "$TRDA_REMOTE_AUTH_LOC" addConf -s "$TRDA_REMOTE_AUTH" "$TRDA_REMOTE_AUTH_LOC"
[ $? -eq 0 ] && exe chmod 600 "$TRDA_REMOTE_AUTH_LOC" [ $? -eq 0 ] && exe chmod 600 "$TRDA_REMOTE_AUTH_LOC"
@@ -51,7 +51,7 @@ step_10() {
} }
step_11_info() { echo "Setup remote authentication for current user (~/.netrc)"; } step_11_info() { echo "Setup remote authentication for current user (~/.netrc)"; }
step_11_alias() { ALIAS="netrcauth"; } step_11_alias() { echo "netrcauth"; }
step_11() { step_11() {
local lRemoteAuth="$(realpath ~/.netrc)" local lRemoteAuth="$(realpath ~/.netrc)"
if [ ! -f "$lRemoteAuth" ]; then if [ ! -f "$lRemoteAuth" ]; then
@@ -61,7 +61,7 @@ step_11() {
} }
step_12_info() { echo "Add ufw rules for rpc and peer port (default 9091 and 51413)"; } step_12_info() { echo "Add ufw rules for rpc and peer port (default 9091 and 51413)"; }
step_12_alias() { ALIAS="ufw"; } step_12_alias() { echo "ufw"; }
step_12() { step_12() {
local trdaRpcPort=9091 local trdaRpcPort=9091
exe ufw allow in on eth0 to any port $trdaRpcPort proto tcp comment "Transmission rpc" exe ufw allow in on eth0 to any port $trdaRpcPort proto tcp comment "Transmission rpc"
@@ -70,9 +70,9 @@ step_12() {
} }
step_20_info() { echo "Configuration notes"; } step_20_info() { echo "Configuration notes"; }
step_20_alias() { ALIAS="notes"; } step_20_alias() { echo "notes"; }
step_20() { step_20() {
outColor green color green
cat <<NOTES_EOF cat <<NOTES_EOF
[I] Change rpc password [I] Change rpc password
1) Make sure $toolName service is stopped before editing the configuration file. 1) Make sure $toolName service is stopped before editing the configuration file.
@@ -112,32 +112,32 @@ NOTES_EOF
} }
step_50_info() { echo "List all available torrents"; } step_50_info() { echo "List all available torrents"; }
step_50_alias() { ALIAS="list"; } step_50_alias() { echo "list"; }
step_50() { step_50() {
step netrcauth step netrcauth
outColor green color green
exe "$toolRemote" -l exe "$toolRemote" -l
} }
step_52_info() { echoinfoArgs "<TORRENT ID>"; echo "List information about a torrent"; } step_52_info() { echoinfoArgs "<TORRENT ID>"; echo "List information about a torrent"; }
step_52_alias() { ALIAS="info"; } step_52_alias() { echo "info"; }
step_52() { step_52() {
shift shift
endCheckEmpty 1 "Id must not be empty" endCheckEmpty 1 "Id must not be empty"
step netrcauth step netrcauth
outColor green color green
exep "\"$toolRemote\" -t$1 -i | less" exep "\"$toolRemote\" -t$1 -i | less"
} }
step_54_info() { echo "$toolName status"; } step_54_info() { echo "$toolName status"; }
step_54_alias() { ALIAS="status"; } step_54_alias() { echo "status"; }
step_54() { step_54() {
step netrcauth step netrcauth
outColor green color green
exe "$toolRemote" -si exe "$toolRemote" -si
exe "$toolRemote" -st exe "$toolRemote" -st
} }
VERSION_SEQREV=13 readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh

View File

@@ -3,7 +3,7 @@
toolName="Tvheadend" toolName="Tvheadend"
step_1_info() { echo "Apt - setup $toolName repository"; } step_1_info() { echo "Apt - setup $toolName repository"; }
step_1_alias() { ALIAS="install"; } step_1_alias() { echo "install"; }
step_1() { step_1() {
local sourceList="/etc/apt/sources.list.d/tvheadend.list" local sourceList="/etc/apt/sources.list.d/tvheadend.list"
local sourceEntry="deb https://apt.tvheadend.org/stable raspbian-stretch main" local sourceEntry="deb https://apt.tvheadend.org/stable raspbian-stretch main"
@@ -47,6 +47,6 @@ step_99() {
endReturn endReturn
} }
VERSION_SEQREV=8 readonly sqr_minVersion=16
. sequencer.sh . sequencer.sh

View File

@@ -18,10 +18,10 @@ CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
#} #}
step_1_info() { echo "Install $toolName and allow ssh access"; } step_1_info() { echo "Install $toolName and allow ssh access"; }
step_1_alias() { ALIAS="install"; } step_1_alias() { echo "install"; }
step_1() { step_1() {
local aptOpt= local aptOpt=
if [ $QUIET -ne 0 ];then if quiet;then
aptOpt="-y" aptOpt="-y"
fi fi
exe apt install $toolDeps $aptOpt exe apt install $toolDeps $aptOpt
@@ -34,7 +34,7 @@ step_2() {
} }
step_20_info() { echo "Enable mail server essentials"; } step_20_info() { echo "Enable mail server essentials"; }
step_20_alias() { ALIAS="mailserver"; } step_20_alias() { echo "mailserver"; }
step_20() { step_20() {
exe ufw allow "Postfix" exe ufw allow "Postfix"
exe ufw allow "Postfix SMTPS" exe ufw allow "Postfix SMTPS"
@@ -45,11 +45,11 @@ step_20() {
} }
step_22_info() { echoinfoArgs "[IP]"; echo "Deny multicast from gateway"; } step_22_info() { echoinfoArgs "[IP]"; echo "Deny multicast from gateway"; }
step_22_alias() { ALIAS="multicast"; } step_22_alias() { echo "multicast"; }
step_22() { step_22() {
shift shift
if [ -z $1 ] ; then if [ -z $1 ] ; then
echoerr " [E] No [IP} specified" error -e "No [IP} specified"
return 1 return 1
fi fi
@@ -64,14 +64,14 @@ step_24_info() {
echoinfo " 139 : Cifs version 1.0" echoinfo " 139 : Cifs version 1.0"
echoinfo " 445 : Cifs version 2.0+" echoinfo " 445 : Cifs version 2.0+"
} }
step_24_alias() { ALIAS="cifs"; } step_24_alias() { echo "cifs"; }
step_24() { step_24() {
shift shift
local destIp=$1 local destIp=$1
local ipregex='^[0-2]*[0-9]{1,2}\.[0-2]*[0-9]{1,2}\.[0-2]*[0-9]{1,2}\.[0-2]*[0-9]{1,2}\/*[0-9]*$' local ipregex='^[0-2]*[0-9]{1,2}\.[0-2]*[0-9]{1,2}\.[0-2]*[0-9]{1,2}\.[0-2]*[0-9]{1,2}\/*[0-9]*$'
endCheckEmpty destIp "No IP provided" endCheckEmpty destIp "No IP provided"
if [[ ! $1 =~ $ipregex ]]; then if [[ ! $1 =~ $ipregex ]]; then
echoseq " [E] No valid IP provided" error "No valid IP provided"
return 1 return 1
fi fi
local destPort=445 local destPort=445
@@ -80,7 +80,7 @@ step_24() {
destPort=$2;; destPort=$2;;
"");; # Set default "");; # Set default
*) *)
echoerr " [E] Invalid port." error -e "Invalid port."
return 1;; return 1;;
esac esac
@@ -88,7 +88,7 @@ step_24() {
} }
step_26_info() { echo "Basic secure VPN setup"; } step_26_info() { echo "Basic secure VPN setup"; }
step_26_alias() { ALIAS="vpn"; } step_26_alias() { echo "vpn"; }
step_26() { step_26() {
exe ufw --force reset exe ufw --force reset
exe ufw allow in on eth0 to any port 22 comment "ssh" exe ufw allow in on eth0 to any port 22 comment "ssh"
@@ -107,5 +107,5 @@ step_26() {
exe ufw status verbose exe ufw status verbose
} }
VERSION_SEQREV=14 readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh

View File

@@ -14,31 +14,31 @@ SCRIPT_NAME=${SCRIPT_FILE%%.*}
CONFIG_FILE_NAME="${SCRIPT_NAME}.cfg" CONFIG_FILE_NAME="${SCRIPT_NAME}.cfg"
CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example" CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
step_config() { seq_config() {
## or to use sequencer api with global config file: ## or to use sequencer api with global config file:
#initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE" #initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE"
#if [ $? -eq 0 ] ; then #if [ $? -eq 0 ] ; then
# CONFIG=1 # CONFIG=1
#else #else
# # End if no configuration file exists # # End if no configuration file exists
# [ $DRY -eq 0 ] && return -1 # dry || return -1
#fi #fi
## Apt cmdline option to suppress user interaction ## Apt cmdline option to suppress user interaction
[ $QUIET -ne 0 ] && APTOPT="-y" quiet && APTOPT="-y"
## Return of non zero value will abort the sequence ## Return of non zero value will abort the sequence
return 0 return 0
} }
step_1_info() { echo "Install $toolName"; } step_1_info() { echo "Install $toolName"; }
step_1_alias() { ALIAS="install"; } step_1_alias() { echo "install"; }
step_1() { step_1() {
exe apt install vim $APTOPT exe apt install vim $APTOPT
} }
step_2_info() { echo "Installing indentation script $seqVimIndentLoc"; } step_2_info() { echo "Installing indentation script $seqVimIndentLoc"; }
step_2_alias() { ALIAS="setup"; } step_2_alias() { echo "setup"; }
step_2() { step_2() {
if [ ! -e "$seqVimIndentLoc" ]; then if [ ! -e "$seqVimIndentLoc" ]; then
exe mkdir -p $(dirname "$seqVimIndentLoc") exe mkdir -p $(dirname "$seqVimIndentLoc")
@@ -46,7 +46,7 @@ step_2() {
wget --content-disposition $indentDownUrl wget --content-disposition $indentDownUrl
fi fi
echoseq " [I] Installing indentation rules" info "Installing indentation rules"
addConf -c "$seqVimConfigBasic" "$seqVimConfigLoc" addConf -c "$seqVimConfigBasic" "$seqVimConfigLoc"
} }
seqVimIndentLoc="$HOME/.vim/indent/sh.vim" seqVimIndentLoc="$HOME/.vim/indent/sh.vim"
@@ -55,17 +55,17 @@ filetype plugin indent on
syntax on" syntax on"
step_3_info() { echo "Install editorconfig as vim 8 plugin"; } step_3_info() { echo "Install editorconfig as vim 8 plugin"; }
step_3_alias() { ALIAS="editorconfig"; } step_3_alias() { echo "editorconfig"; }
step_3() { step_3() {
local ecDir="$HOME/.vim/pack/editorconfig/start" local ecDir="$HOME/.vim/pack/editorconfig/start"
local ecUrl='https://github.com/editorconfig/editorconfig-vim.git' local ecUrl='https://github.com/editorconfig/editorconfig-vim.git'
if [ ! -e "$ecDir" ]; then if [ ! -e "$ecDir" ]; then
echoseq " [I] Installing editorconfig plugin" info "Installing editorconfig plugin"
exe mkdir -p "$ecDir" exe mkdir -p "$ecDir"
exe cd "$ecDir" exe cd "$ecDir"
exe git clone "$ecUrl" exe git clone "$ecUrl"
else else
echoseq " [I] Upgrading editorconfig plugin" info "Upgrading editorconfig plugin"
exe cd "$ecDir" exe cd "$ecDir"
exe git pull exe git pull
fi fi
@@ -73,7 +73,7 @@ step_3() {
step_10_info() { echo "Setup $HOME/.vimrc globaly to use spaces and indent 2"; } step_10_info() { echo "Setup $HOME/.vimrc globaly to use spaces and indent 2"; }
step_10() { step_10() {
echoseq " [I] Installing formating rules" info "Installing formating rules"
addConf -a "$seqVimConfig" "$seqVimConfigLoc" addConf -a "$seqVimConfig" "$seqVimConfigLoc"
} }
seqVimConfig="set expandtab seqVimConfig="set expandtab
@@ -81,5 +81,5 @@ set tabstop=2
set softtabstop=2 set softtabstop=2
set shiftwidth=2" set shiftwidth=2"
VERSION_SEQREV=15 readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh

View File

@@ -8,8 +8,8 @@ phpName="php${phpVersion}"
phpPackages="${phpName}-{fpm,gd,mysql,curl,xml,zip,intl,mbstring,bz2,ldap,apcu,bcmath,gmp,imagick,igbinary,redis,smbclient,cli,common,opcache,readline} imagemagick" phpPackages="${phpName}-{fpm,gd,mysql,curl,xml,zip,intl,mbstring,bz2,ldap,apcu,bcmath,gmp,imagick,igbinary,redis,smbclient,cli,common,opcache,readline} imagemagick"
aptOpt= aptOpt=
step_config() { seq_config() {
if [ $QUIET -ne 0 ] ; then if quiet ; then
aptOpt="-y" aptOpt="-y"
fi fi
} }
@@ -19,17 +19,17 @@ step_1_info() {
echo "Setup latest apt source list for $serverName" echo "Setup latest apt source list for $serverName"
echoinfo "$serverSourceUrl" echoinfo "$serverSourceUrl"
} }
step_1_alias() { ALIAS="setup"; } step_1_alias() { echo "setup"; }
step_1() { step_1() {
shift shift
local osRelease=$1 local osRelease=$1
endCheckEmpty osRelease "Debian release not provided" endCheckEmpty osRelease "Debian release not provided"
echoseq " [I] Setup apt source for $serverName $serverSourceUrl" info "Setup apt source for $serverName $serverSourceUrl"
local srvSource="deb $serverSourceUrl $osRelease nginx" local srvSource="deb $serverSourceUrl $osRelease nginx"
addConf -s "$srvSource" "$serverSourceLoc" addConf -s "$srvSource" "$serverSourceLoc"
if [ $? -eq 0 ] ; then if [ $? -eq 0 ] ; then
echoseq " [I] Get repository key for $serverSourceUrl"Y info "Get repository key for $serverSourceUrl"Y
exe apt install gnupg $aptOpt exe apt install gnupg $aptOpt
exe apt-key adv --keyserver keyserver.ubuntu.com --recv-keys ABF5BD827BD9BF62 exe apt-key adv --keyserver keyserver.ubuntu.com --recv-keys ABF5BD827BD9BF62
fi fi
@@ -40,7 +40,7 @@ step_2_info() {
echo "Installation of $serverName packages:" echo "Installation of $serverName packages:"
echoinfo "$serverPackages" echoinfo "$serverPackages"
} }
step_2_alias() { ALIAS=install; } step_2_alias() { echo install; }
step_2() { step_2() {
exe apt update exe apt update
exe apt install $serverPackages $aptOpt exe apt install $serverPackages $aptOpt
@@ -64,8 +64,8 @@ step_3() {
# create webroot # create webroot
exe mkdir -p "$siteLetsencryptWww" exe mkdir -p "$siteLetsencryptWww"
echoseq -n "Restarting Nginx..." info -n "Restarting Nginx..."
exe service nginx restart && echoseq "ok" exe service nginx restart && info "ok"
endReturn -o $? "Failed to install $serverName" endReturn -o $? "Failed to install $serverName"
} }
snippetLetsencryptLoc="/etc/nginx/snippets/letsencrypt.conf" snippetLetsencryptLoc="/etc/nginx/snippets/letsencrypt.conf"
@@ -86,7 +86,7 @@ step_4_info() {
echo "Installation of $phpName packages:" echo "Installation of $phpName packages:"
echoinfo "$phpPackages" echoinfo "$phpPackages"
} }
step_4_alias() { ALIAS="php"; } step_4_alias() { echo "php"; }
step_4() { step_4() {
exe apt install $(eval echo $phpPackages) $aptOpt exe apt install $(eval echo $phpPackages) $aptOpt
} }
@@ -157,12 +157,12 @@ step_5() {
exe sed -i 's/pm.max_spare_servers =.*/pm.max_spare_servers = '$PMaxSS'/' "$phpPoolConfigLocation" exe sed -i 's/pm.max_spare_servers =.*/pm.max_spare_servers = '$PMaxSS'/' "$phpPoolConfigLocation"
exe sed -i "s/;pm.max_requests =.*/pm.max_requests = 1000/" "$phpPoolConfigLocation" exe sed -i "s/;pm.max_requests =.*/pm.max_requests = 1000/" "$phpPoolConfigLocation"
echoseq -n "Restarting ${phpName} ... " info -n "Restarting ${phpName} ... "
exe service ${phpName}-fpm restart && echoseq "ok" exe service ${phpName}-fpm restart && info "ok"
} }
step_6_info() { echo "Installation notes"; } step_6_info() { echo "Installation notes"; }
step_6_alias() { ALIAS="notes"; } step_6_alias() { echo "notes"; }
step_6() { step_6() {
cat <<NOTES_EOF cat <<NOTES_EOF
# Set user to www-data on debian an tune performance a bit # Set user to www-data on debian an tune performance a bit
@@ -179,5 +179,5 @@ events {
NOTES_EOF NOTES_EOF
} }
VERSION_SEQREV=14 readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh

View File

@@ -10,7 +10,7 @@ step_1_info() {
echo "Installation of $serverName packages:" echo "Installation of $serverName packages:"
echoinfo "$serverPackages" echoinfo "$serverPackages"
} }
step_1_alias() { ALIAS="install"; } step_1_alias() { echo "install"; }
step_1() { step_1() {
exe apt update exe apt update
exe apt install $serverPackages exe apt install $serverPackages
@@ -92,5 +92,5 @@ step_4() {
echo "ok" echo "ok"
} }
VERSION_SEQREV=10 readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh

View File

@@ -24,7 +24,7 @@ CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
#} #}
step_1_info() { echo "Prepare installation of $toolName"; } step_1_info() { echo "Prepare installation of $toolName"; }
step_1_alias() { ALIAS="install"; } step_1_alias() { echo "install"; }
step_1() { step_1() {
exe apt install raspberrypi-kernel-headers exe apt install raspberrypi-kernel-headers
endReturn -o $? "Installation of kernel headers failed" endReturn -o $? "Installation of kernel headers failed"
@@ -40,7 +40,7 @@ Pin-Priority: 150"
step_2_info() { echo "Installing $toolName"; } step_2_info() { echo "Installing $toolName"; }
step_2() { step_2() {
local aptOpt="" local aptOpt=""
if [ $QUIET -ne 0 ] ; then if quiet ; then
aptOpt="-y" aptOpt="-y"
fi fi
exe apt install $toolName $aptOpt exe apt install $toolName $aptOpt
@@ -50,7 +50,7 @@ step_3_info() {
echo "Enable ipv4 forwarding to allow local access via VPN" echo "Enable ipv4 forwarding to allow local access via VPN"
echoinfo "(may be skipped)" echoinfo "(may be skipped)"
} }
step_3_alias() { ALIAS="ipv4"; } step_3_alias() { echo "ipv4"; }
step_3() { step_3() {
exe perl -pi -e 's/#{1,}?net.ipv4.ip_forward ?= ?(0|1)/net.ipv4.ip_forward = 1/g' /etc/sysctl.conf exe perl -pi -e 's/#{1,}?net.ipv4.ip_forward ?= ?(0|1)/net.ipv4.ip_forward = 1/g' /etc/sysctl.conf
} }
@@ -61,19 +61,19 @@ step_4() {
} }
step_10_info() { echo "Start default configuration $toolDefaultConf"; } step_10_info() { echo "Start default configuration $toolDefaultConf"; }
step_10_alias() { ALIAS="start"; } step_10_alias() { echo "start"; }
step_10() { step_10() {
exe wg-quick up wg0 exe wg-quick up wg0
} }
step_12_info() { echo "Stop default configuration $toolDefaultConf"; } step_12_info() { echo "Stop default configuration $toolDefaultConf"; }
step_12_alias() { ALIAS="stop"; } step_12_alias() { echo "stop"; }
step_12() { step_12() {
exe wg-quick down wg0 exe wg-quick down wg0
} }
step_14_info() { echo "Enable default configuration $defaultConfLoc"; } step_14_info() { echo "Enable default configuration $defaultConfLoc"; }
step_14_alias() { ALIAS="enable"; } step_14_alias() { echo "enable"; }
step_14() { step_14() {
if [ ! -r "$defaultConfLoc" ] ; then if [ ! -r "$defaultConfLoc" ] ; then
endReturn -o 1 "Default configuration \"$defaultConfLoc\" not found" endReturn -o 1 "Default configuration \"$defaultConfLoc\" not found"
@@ -89,5 +89,5 @@ step_20() {
} }
VERSION_SEQREV=11 readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh