diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..9a5a55d --- /dev/null +++ b/.editorconfig @@ -0,0 +1,6 @@ +root = true + +[*.{sh,cfg,example}] +charset = utf-8 +indent_style = space +indent_size = 2 diff --git a/seqs/backup.sh b/seqs/backup.sh index 105c466..3919270 100755 --- a/seqs/backup.sh +++ b/seqs/backup.sh @@ -108,7 +108,7 @@ step_3() { echoerr " [E] Nothing found to backup $1" exit 1 fi - + buLog=$(basename $1) if [ "$buLog" == "/" ] ; then buLog="root" @@ -119,7 +119,7 @@ step_3() { fi buLog="backup_${buLog}" shift - + if [ $configTarget -ne 0 ] && [ $CONFIG -ne 0 ] ; then # Taking target from config buTarget=$(echo "$BACKUP_TARGET" | sed 's:/*$::') @@ -140,7 +140,7 @@ step_3() { for exclu in "$@"; do buExcludes+=("--exclude='$exclu'") done - + echoseq " [I] Source : $buSource" echoseq " [I] Target : $buTarget" echoseq " [I] Excludes: $@" @@ -158,7 +158,7 @@ step_3() { exep "mount -o rw,remount '${buTarget}' >>/dev/null 2>&1" endReturn -o $? "Remount (${buTarget}) to be writable failed" fi - + if [ ! -w "${buTarget}" ] ; then echoerr " [E] Backup target (${buTarget}) is not writable" exit 1 diff --git a/seqs/certbot.sh b/seqs/certbot.sh index 17b80ed..a6744bb 100755 --- a/seqs/certbot.sh +++ b/seqs/certbot.sh @@ -40,7 +40,7 @@ step_1() { fi echo " [I] Detected OS: $osName $distName" - + local aptOption= if [ $QUIET -ne 0 ] ; then aptOption="-y" diff --git a/seqs/coturn.sh b/seqs/coturn.sh index c578178..17e75d9 100755 --- a/seqs/coturn.sh +++ b/seqs/coturn.sh @@ -61,7 +61,7 @@ step_10() { lecho="echo" shift fi - + local pubIp while [ $retryCount -gt 0 ]; do diff --git a/seqs/debianrpi.sh b/seqs/debianrpi.sh index 3334d58..95e564a 100755 --- a/seqs/debianrpi.sh +++ b/seqs/debianrpi.sh @@ -272,7 +272,7 @@ read_sd_dev() { SDDEV= return 1 fi - + if [[ "$SDDEV" =~ .*blk.* ]] ; then partExt="p" fi diff --git a/seqs/downloader.sh b/seqs/downloader.sh index 181067f..73b920a 100755 --- a/seqs/downloader.sh +++ b/seqs/downloader.sh @@ -12,7 +12,7 @@ CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example" step_config() { checkVpn - + initSeqConfig -t "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE" if [ $? -eq 0 ] ; then CONFIG=1 @@ -50,10 +50,11 @@ step_2() { step_3_info() { echo "Add system user"; } step_3() { - exe adduser --system $DLD_USER --group --home "${DLD_CONFDIR}" + exe adduser --system $DLD_USER --group --home "${DLD_CONFDIR}" } -step_4_info() { echo "Install sonarr" +step_4_info() { + echo "Install sonarr" echoinfo "Default port: 8989" } step_4() { @@ -121,7 +122,7 @@ step_7_info() { step_7() { local jTar="/tmp/Jackett.tgz" local jUrl="https://github.com/Jackett/Jackett/releases/latest/download/Jackett.Binaries.LinuxARM64.tar.gz" - + [ ! -e "$jTar" ] && exe curl -sL "$jUrl" -o "$jTar" exe tar xvzf "$jTar" -C "${DLD_DIR}" @@ -281,9 +282,9 @@ step_14() { local lService=`eval "echo \"$bazarrService\""` local bazarrVenv="${DLD_DIR}/bazarr" local bazarrDir="${bazarrVenv}/bazarr" - + local bazarrGitUrl="https://github.com/morpheus65535/bazarr.git" - + exe python3 -m venv "$bazarrVenv" endReturn -o $? "Creating virtual environment failed" @@ -348,7 +349,7 @@ step_16() { cat /etc/apt/sources.list | grep -E "^deb-src" >>/dev/null 2>&1 endReturn -o $? "No deb-src entry found in /etc/apt/sources.list" - + exe mkdir -p "$buildPath" exe cd "$buildPath" exe apt build-dep unrar-nonfree $APTOPT @@ -453,12 +454,12 @@ step_21() { [ ! -e "$pTar" ] && exe wget --content-disposition "$pUrl" -O "$pTar" if [ -e "$pInstallDir" ]; then - prowlarrUpgrade=1 - echoseq " [I] Stopping prowlarr service" - echoseq " Service will not be started automatically after update" - exe service prowlarr stop - echoseq " [I] Moving existing $pInstallDir as backup" - exe mv "$pInstallDir" "${pInstallDir}_bu_"`date +%Y%m%d-%H%M%S` + prowlarrUpgrade=1 + echoseq " [I] Stopping prowlarr service" + echoseq " Service will not be started automatically after update" + exe service prowlarr stop + echoseq " [I] Moving existing $pInstallDir as backup" + exe mv "$pInstallDir" "${pInstallDir}_bu_"`date +%Y%m%d-%H%M%S` fi exe tar xvzf "$pTar" -C "${DLD_DIR}" @@ -535,12 +536,12 @@ step_30() { [ ! -e "$readarrTar" ] && exe wget --content-disposition "$lUrl" -O "$readarrTar" if [ -e "$lInstallDir" ]; then - readarrUpgrade=1 - echoseq " [I] Stopping readarr service" - echoseq " Service will not be started automatically after update" - exe service readarr stop - echoseq " [I] Moving existing $lInstallDir as backup" - exe mv "$lInstallDir" "${lInstallDir}_bu_"`date +%Y%m%d-%H%M%S` + readarrUpgrade=1 + echoseq " [I] Stopping readarr service" + echoseq " Service will not be started automatically after update" + exe service readarr stop + echoseq " [I] Moving existing $lInstallDir as backup" + exe mv "$lInstallDir" "${lInstallDir}_bu_"`date +%Y%m%d-%H%M%S` fi exe tar xvf "$readarrTar" -C "${DLD_DIR}" @@ -600,9 +601,9 @@ step_50() { local lService=`eval "echo \"$bazarrService\""` local bazarrVenv="${DLD_DIR}/bazarr" local bazarrDir="${bazarrVenv}/bazarr" - + local bazarrGitUrl="https://github.com/morpheus65535/bazarr.git" - + exe sudo -u $DLD_USER ${bazarrVenv}/bin/pip install --upgrade pip exe sudo -u $DLD_USER ${bazarrVenv}/bin/pip install -r ${bazarrDir}/requirements.txt } diff --git a/seqs/ebackup.sh b/seqs/ebackup.sh index 65e55c9..5f98a4a 100755 --- a/seqs/ebackup.sh +++ b/seqs/ebackup.sh @@ -39,12 +39,12 @@ step_1_info() { step_1_alias() { ALIAS="backup"; } step_1() { shift - + local arg local retVal local dupArgs local purgeAfter=1 - + for arg in "$@" ; do case "$1" in --no-purge|-n) @@ -65,7 +65,7 @@ step_1() { echo " [W] $toolName command \"$1\" not recognized" return 1 fi - + echo " [I] Running backup profile [$SEQ_PROFILE_NAME]" if [ "${dupArgs[0]}" != "full" ] && [ ! -z "$EBU_MAX_FULLBKP_AGE" ] ; then @@ -114,10 +114,10 @@ step_5_info() { step_5_alias() { ALIAS="restore"; } step_5() { shift - + local arg local restoreOpt - + for arg in "$@" ; do case "$1" in --file-to-restore|-f) @@ -195,7 +195,7 @@ step_20() { if [ ! -z "$1" ] ; then ebuTarget="$1" fi - + checkInstalled exe $toolBin collection-status "$ebuTarget" } @@ -208,11 +208,11 @@ step_22() { if [ ! -z "$1" ] ; then ebuTarget="$1" fi - + checkInstalled exe $toolBin list-current-files "$ebuTarget" } - + step_70_info() { echo -n "Manage cron file for " @@ -233,7 +233,7 @@ step_70() { local cronScript="$toolCronDir/${toolPrefix}$SEQ_PROFILE_NAME" local cronLog='>/dev/null' local cronEntry="$EBU_CRONTIME $(whoami) $WDIR/$(basename -- $0) -qq -p $SEQ_PROFILE_NAME" - + for arg in "$@" ; do case "$1" in --remove|-r) @@ -248,9 +248,9 @@ step_70() { exe touch "$cronLog" exe chmod 600 "$cronLog" fi - + cronEntry+=" >$cronLog" - + if [ -z "$EBU_CRONTIME" ] || [ $cronRemove -ne 0 ] ; then echo " [I] Removing cron for profile $SEQ_PROFILE_NAME" exe rm -r "$cronScript" diff --git a/seqs/element-web.sh b/seqs/element-web.sh index 6082277..957a337 100755 --- a/seqs/element-web.sh +++ b/seqs/element-web.sh @@ -116,11 +116,11 @@ step_22() { echo " [I] Version $latestVersion is already installed" return 0 fi - + # Download local downUrl="https://github.com/vector-im/element-web/releases/download/v${latestVersion}/element-v${latestVersion}.tar.gz" local tempExtract="$tempDown/element-v$latestVersion" - + if [ ! -e "$tempExtract" ] ; then exe mkdir -p "$tempDown" exe wget -O "$tempLoc" $downUrl diff --git a/seqs/freeradius.sh b/seqs/freeradius.sh index 62041f8..0b7bab4 100755 --- a/seqs/freeradius.sh +++ b/seqs/freeradius.sh @@ -51,7 +51,7 @@ step_52_info() { echo "Reset freeradius and daloradius database"; } step_52_alias() { ALIAS="resetdb"; } step_52() { local lAnswer - + if [ $QUIET -eq 0 ]; then read -p "Do you really want to reset the database $FRAD_DB_NAME y/[n]? " lAnswer else diff --git a/seqs/friendica.sh b/seqs/friendica.sh index 99833d0..93b1955 100755 --- a/seqs/friendica.sh +++ b/seqs/friendica.sh @@ -103,14 +103,14 @@ step_22() { echoerr " [E] Version $latestVersion is already installed" return 2 fi - + # Download local downUrl="https://files.friendi.ca/friendica-full-${latestVersion}.tar.gz" local downUrlAddons="https://files.friendi.ca/friendica-addons-${latestVersion}.tar.gz" local tempExtract="$tempDown/friendica-full-$latestVersion" local tempExtractAddons="$tempDown/friendica-addons-$latestVersion" - + if [ ! -e "$tempExtract" ] ; then exe mkdir -p "$tempDown" exe wget -O "$tempLoc" $downUrl @@ -132,7 +132,7 @@ step_22() { else echo " [I] Found existing download: $tempExtractAddons" fi - + # Installation local tempBu="${FR_LOC}_bu_`date +%Y%m%d-%H%M%S`" local tempAddons="${FR_LOC}/addon" diff --git a/seqs/gitea.sh b/seqs/gitea.sh index ea69fea..a13775a 100755 --- a/seqs/gitea.sh +++ b/seqs/gitea.sh @@ -38,12 +38,12 @@ step_config() { ## Apt cmdline option to suppress user interaction [ $QUIET -ne 0 ] && APTOPT="-y" - + if [ -z $giteaVersion ] ; then echoerr " [E] Couldn't determine latest version of $toolName" fi [ ! -z "$(command -v gitea)" ] && versionNow=$(gitea --version | sed 's/.*version \([0-9.]\+\).*/\1/') - + checkArchitecture giteaIniLoc="${SEQ_GITEA_CONF_DIR}/app.ini" diff --git a/seqs/jitsi.sh b/seqs/jitsi.sh index 843f418..c275a12 100755 --- a/seqs/jitsi.sh +++ b/seqs/jitsi.sh @@ -26,7 +26,7 @@ step_1() { 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 \ curl ffmpeg ghostscript libfile-fcntllock-perl curl socat - } +} step_2_info() { echo "Add universe and official nginx apt repositories"; } step_2() { @@ -140,6 +140,6 @@ step_20() { echo " [I] Restart jitsi-meet components" exep "service prosody restart&& service jicofo restart && service jitsi-videobridge2 restart" } - + VERSION_SEQREV=10 . /usr/local/bin/sequencer.sh diff --git a/seqs/ldap.sh b/seqs/ldap.sh index fa1f673..f643528 100755 --- a/seqs/ldap.sh +++ b/seqs/ldap.sh @@ -143,7 +143,7 @@ step_80() { cat < "$mtaMysqlConfLoc/${mtaFile}.cf" done - + exe chown -R root:${mtaUser} "$mtaMysqlConfLoc" exe chmod 640 "${mtaMysqlConfLoc}"/* } @@ -249,7 +249,7 @@ step_22() { exe postconf -e "virtual_mailbox_maps = proxy:mysql:/etc/postfix/sql/mysql_virtual_mailbox_maps.cf, proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_domain_mailbox_maps.cf" exe postconf -e "virtual_alias_maps = proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_maps.cf, proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_domain_maps.cf, proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_domain_catchall_maps.cf" exe postconf -e "virtual_transport = lmtp:unix:private/dovecot-lmtp" - + # Apex domain removed, it is handled as virtual domain now exe postconf -e "mydestination = \$myhostname, localhost.\$mydomain, localhost" # Base location for the virtual maildirs diff --git a/seqs/matrix-commander.sh b/seqs/matrix-commander.sh index 6e5cab9..b6eb3df 100755 --- a/seqs/matrix-commander.sh +++ b/seqs/matrix-commander.sh @@ -20,7 +20,7 @@ CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example" step_config() { ## or to use sequencer api with global config file: initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE" - + if [ $? -eq 0 ] ; then CONFIG=1 else @@ -75,7 +75,7 @@ step_51() { step_52_info() { echo "Create venv and install $toolName"; } step_52() { [ -e "$MACO_BASE_DIR" ] && endReturn -o 1 "$toolName already installed" - + exe python3 -m venv "$MACO_BASE_DIR" endReturn -o $? "Creating virtual environment failed" diff --git a/seqs/matrix.sh b/seqs/matrix.sh index 0fd9c65..f83e810 100755 --- a/seqs/matrix.sh +++ b/seqs/matrix.sh @@ -78,7 +78,7 @@ step_2_info() { echo "Create postgres database for $toolName"; } step_2_alias() { ALIAS="createdb"; } step_2() { readDatabaseInfos - + exe cd ~postgres exe su -c "psql -c \"CREATE USER ${postgresUser} WITH ENCRYPTED password '${postgresPass}';\"" - postgres exe su -c "psql -c \"CREATE DATABASE ${postgresDb} ENCODING \"UTF8\" LC_COLLATE='C' LC_CTYPE='C' template=template0 OWNER ${postgresUser};\"" - postgres @@ -154,12 +154,13 @@ SyslogIdentifier=synapse [Install] WantedBy=multi-user.target" -step_10_info() { echo -n "Upgrade $toolName installation" - if [ $CONTEXT_HELP -eq 0 ] ; then - echo " at $MATRIX_HOME" - else - echo - fi +step_10_info() { + echo -n "Upgrade $toolName installation" + if [ $CONTEXT_HELP -eq 0 ] ; then + echo " at $MATRIX_HOME" + else + echo + fi } step_10_alias() { ALIAS="upgrade"; } step_10() { @@ -193,7 +194,7 @@ step_14() { local synapseIP=localhost shift if [ ! -z $1 ]; then - synapseIP="$1" + synapseIP="$1" fi local apiCall="http://${synapseIP}:8008/_synapse/admin/v1/server_version" @@ -215,7 +216,7 @@ step_16() { shift local synapseIP=localhost local grepOut=" | grep -E '(\"total\":|\"name\":)'" - + for arg in "$@" ; do case "$1" in -r) @@ -229,9 +230,9 @@ step_16() { done if [ ! -z $1 ]; then - synapseIP="$1" + synapseIP="$1" fi - + local apiCall="http://${synapseIP}:8008/_synapse/admin/v2/users" exep "curl -sS --header \"Authorization: Bearer $MATRIX_ACCESS\" \"$apiCall\" | python -m json.tool $grepOut" } @@ -285,7 +286,7 @@ step_22() { local arg local synapseIP=localhost local grepOut=" | grep -E '(\"total\":|\"name\":|\"room_id\":)'" - + for arg in "$@" ; do case "$1" in -r) @@ -299,9 +300,9 @@ step_22() { done if [ ! -z $1 ]; then - synapseIP="$1" + synapseIP="$1" fi - + local apiCall="http://${synapseIP}:8008/_synapse/admin/v1/rooms" exep "curl -sS --header \"Authorization: Bearer $MATRIX_ACCESS\" \"$apiCall\" | python -m json.tool $grepOut" } @@ -321,7 +322,7 @@ step_24() { local roomId="" local synapseIP=localhost local grepOut=" | grep -E '(\"total\":|\"members\":|\"@)'" - + for arg in "$@" ; do case "$1" in -r) @@ -340,9 +341,9 @@ step_24() { fi if [ ! -z $1 ]; then - synapseIP="$1" + synapseIP="$1" fi - + local apiCall="http://${synapseIP}:8008/_synapse/admin/v1/rooms/$roomId/members" exep "curl -sS --header \"Authorization: Bearer $MATRIX_ACCESS\" \"$apiCall\" | python -m json.tool $grepOut" } @@ -361,14 +362,14 @@ step_26() { local i local arg local synapseIP=localhost - + if [ ! -z $1 ]; then - synapseIP="$1" + synapseIP="$1" fi - + local apiCall="http://${synapseIP}:8008/_synapse/admin/v1/rooms" local arrRoom=( $(curl -sS --header "Authorization: Bearer $MATRIX_ACCESS" "$apiCall" | jq '.rooms[] | select(.joined_local_members == 0) | .room_id') ) - + for i in "${!arrRoom[@]}" ; do arrRoom[$i]="${arrRoom[$i]:1:${#arrRoom[$i]}-2}" done @@ -391,7 +392,7 @@ step_28() { shift local roomId="" local synapseIP=localhost - + if [ ! -z $1 ]; then roomId="$1" shift @@ -434,12 +435,12 @@ step_30() { shift local pgVerboseReId=" (VERBOSE) " local pgVerboseVac=" VERBOSE" - + if [ $VERBOSE == 0 ]; then pgVerboseReId=" " pgVerboseVac="" fi - + if [ -z $1 ]; then readDatabaseInfos else diff --git a/seqs/mayan-edms.sh b/seqs/mayan-edms.sh index c1b73de..fc2362c 100755 --- a/seqs/mayan-edms.sh +++ b/seqs/mayan-edms.sh @@ -72,7 +72,7 @@ step_4_info() { echo "Create postgres database for $toolName"; } step_4_alias() { ALIAS="createdb"; } step_4() { readDatabaseInfos - + exe cd ~postgres exe sudo -u postgres psql -c "CREATE USER ${postgresUser} WITH password '${postgresPass}';" # -O owner : Specifies the database user who will own the new database. @@ -101,7 +101,7 @@ supervisordConfLoc="/etc/supervisor/conf.d/mayan.conf" step_7_info() { echo "Redis configuration file"; } step_7() { addConf -a "$redisConf" "$redisConfLoc" - + exe systemctl restart redis } @@ -226,7 +226,7 @@ toolScript() { if [ ! -z "$1" ] ; then readDatabaseInfos fi - + exep "sudo -u mayan \ MAYAN_DATABASES=\"{'default':{'ENGINE':'django.db.backends.postgresql','NAME':'${postgresDb}','PASSWORD':'${postgresPass}','USER':'${postgresUser}','HOST':'127.0.0.1'}}\" \ MAYAN_MEDIA_ROOT=${toolMediaFolder} \ diff --git a/seqs/motioneye.sh b/seqs/motioneye.sh index f3177b3..007fb35 100755 --- a/seqs/motioneye.sh +++ b/seqs/motioneye.sh @@ -46,13 +46,13 @@ step_1_info() { echo "Install $toolName dependencies"; } step_1_alias() { ALIAS="install"; } step_1() { local aptOption= - + local pyVersion=$(python -V 2>&1) if [[ ! "$pyVersion" =~ \ 2\.[7-9]+ ]] ; then echoerr " [E] Motioneye requires python version 2.7 but $pyVersion was found." return 1 fi - + exe apt update endReturn -o $? "Updating apt repositories failed" @@ -94,7 +94,7 @@ step_3() { exe dpkg -i "$motionDownload" endReturn -o $? "Installing motion failed" } - + step_4_info() { echo "Upgrade python pip"; } step_4_alias() { ALIAS="upgradepip"; } step_4() @@ -128,11 +128,11 @@ motioneyeMediaDir="/var/lib/motioneye" step_8_info() { echo "Create $toolName service"; } step_8() { - exe cp "$motioneyeServiceSource" "$motioneyeServiceTarget" - endReturn -o $? "Creating service failed" - exe systemctl daemon-reload - exe systemctl enable motioneye - exe systemctl start motioneye + exe cp "$motioneyeServiceSource" "$motioneyeServiceTarget" + endReturn -o $? "Creating service failed" + exe systemctl daemon-reload + exe systemctl enable motioneye + exe systemctl start motioneye } motioneyeServiceSource="/usr/local/share/motioneye/extra/motioneye.systemd-unit-local" motioneyeServiceTarget="/etc/systemd/system/motioneye.service" diff --git a/seqs/mysql.sh b/seqs/mysql.sh index 63497c0..52ccfc2 100755 --- a/seqs/mysql.sh +++ b/seqs/mysql.sh @@ -68,7 +68,7 @@ step_10_alias() { ALIAS="createdb"; } step_10() { local arg local dbOption= - + shift for arg in "$@" ; do case "$1" in @@ -84,7 +84,7 @@ step_10() { --remote|-r) dbRemote="$2" shift 2 ;; - *) + *) break ;; esac done @@ -120,7 +120,7 @@ step_11_info() { step_11_alias() { ALIAS="createuser"; } step_11() { local arg - + shift for arg in "$@" ; do case "$1" in @@ -136,7 +136,7 @@ step_11() { --remote|-r) dbRemote="$2" shift 2 ;; - *) + *) break ;; esac done @@ -172,7 +172,7 @@ step_12_info() { step_12_alias() { ALIAS="grant"; } step_12() { local arg - + shift for arg in "$@" ; do case "$1" in @@ -188,7 +188,7 @@ step_12() { --remote|-r) dbRemote="$2" shift 2 ;; - *) + *) break ;; esac done @@ -209,7 +209,7 @@ step_14_info() { step_14_alias() { ALIAS="revokeall"; } step_14() { local arg - + shift for arg in "$@" ; do case "$1" in @@ -219,7 +219,7 @@ step_14() { --remote|-r) dbRemote="$2" shift 2 ;; - *) + *) break ;; esac done @@ -254,7 +254,7 @@ step_34_info() { step_34_alias() { ALIAS="listprivileges"; } step_34() { local arg - + shift for arg in "$@" ; do case "$1" in @@ -264,7 +264,7 @@ step_34() { --remote|-r) dbRemote="$2" shift 2 ;; - *) + *) break ;; esac done @@ -308,7 +308,7 @@ step_50() { elif [ ! -e "$2" ]; then endReturn -o 1 -f "$2 does not exist" fi - + echo " [I] Dumping database $dbName to $buTarget" exep "mysqldump --single-transaction $dbName > \"$(realpath $buTarget)/${dbName}_backup_$(date +%Y%m%d-%H%M%S).sql\"" endReturn -o $? "Error creating $dbName backup" diff --git a/seqs/nextcloud.sh b/seqs/nextcloud.sh index 4159ef5..101251c 100755 --- a/seqs/nextcloud.sh +++ b/seqs/nextcloud.sh @@ -41,7 +41,7 @@ step_100_info() { step_100_alias() { ALIAS="occ"; } step_100() { shift - + exe "${localOcc[@]}" "$@" } @@ -52,7 +52,7 @@ step_102() { local ncdb= local ip= 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 echoerr " [E] No database provided" if [ -f "${WDIR}/mysql.sh" ] ; then @@ -96,7 +96,7 @@ step_106_alias() { ALIAS="audioscan"; } step_106() { shift local ncUser=$1 - + if [ -z "$ncUser" ] ; then echoerr " [E] Reset only for single user" return 1 diff --git a/seqs/olivetin.sh b/seqs/olivetin.sh index d62e86c..c718d1b 100755 --- a/seqs/olivetin.sh +++ b/seqs/olivetin.sh @@ -19,7 +19,7 @@ CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example" step_config() { ## or to use sequencer api with global config file: #initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE" - + ## or to use sequencer api with profile config file support: #initSeqConfig -p "$SCRIPT_NAME" "$CONFIG_FILE_TEMPLATE" #if [ $? -eq 0 ] ; then diff --git a/seqs/onlyoffice.sh b/seqs/onlyoffice.sh index 8c80deb..d14f228 100755 --- a/seqs/onlyoffice.sh +++ b/seqs/onlyoffice.sh @@ -44,7 +44,7 @@ step_config() { ## Apt cmdline option to suppress user interaction [ $QUIET -ne 0 ] && APTOPT="-y" - + dockerDnsEntry="DOCKER_OPTS=\"--dns $dockerDns1 --dns $dockerDns2\"" ## Return of non zero value will abort the sequence @@ -119,10 +119,10 @@ step_5() { options="-e JWT_ENABLED=true -e JWT_SECRET=" # This is the only way to provide SECRET($2) to docker command line which handles all types of characters. exe docker run -i -t -d -p ${onlyOfficePort}:80 ${options}"$secret" --restart=always \ - -v /app/onlyoffice/DocumentServer/logs:/var/log/onlyoffice \ - -v /app/onlyoffice/DocumentServer/data:/var/www/onlyoffice/Data \ - -v /app/onlyoffice/DocumentServer/lib:/var/lib/onlyoffice \ - -v /app/onlyoffice/DocumentServer/db:/var/lib/postgresql "${dockerImageName}" + -v /app/onlyoffice/DocumentServer/logs:/var/log/onlyoffice \ + -v /app/onlyoffice/DocumentServer/data:/var/www/onlyoffice/Data \ + -v /app/onlyoffice/DocumentServer/lib:/var/lib/onlyoffice \ + -v /app/onlyoffice/DocumentServer/db:/var/lib/postgresql "${dockerImageName}" else echoerr " [W] Running $toolName without JWT (JSON Web Tokens)" exe docker run -i -t -d -p ${onlyOfficePort}:80 --restart=always "${dockerImageName}" diff --git a/seqs/postfixadmin.sh b/seqs/postfixadmin.sh index a1ade34..f17b763 100755 --- a/seqs/postfixadmin.sh +++ b/seqs/postfixadmin.sh @@ -248,11 +248,11 @@ step_22() { echoerr " [E] Version $latestVersion is already installed" return 2 fi - + # Download local downUrl="https://github.com/$toolName/$toolName/archive/postfixadmin-${latestVersion}.tar.gz" local tempExtract="$tempDown/postfixadmin-postfixadmin-$latestVersion" - + if [ ! -e "$tempExtract" ] ; then exe mkdir -p "$tempDown" exe wget -O "$tempLoc" $downUrl diff --git a/seqs/postgrey.sh b/seqs/postgrey.sh index 50a4e26..a45208e 100755 --- a/seqs/postgrey.sh +++ b/seqs/postgrey.sh @@ -49,7 +49,7 @@ postCron="# -q quiet -N timestamping (overwrite existing file) -O target file step_3_info() { echo "Configuration notes"; } step_3_alias() { ALIAS="notes"; } step_3() { - echo "$toolNotes" + echo "$toolNotes" } toolNotes=" # Reduce default message delay to 1 minute @@ -75,6 +75,6 @@ step_10_alias() { ALIAS="restart"; } step_10() { exe service $toolName restart } - + VERSION_SEQREV=11 . /usr/local/bin/sequencer.sh diff --git a/seqs/raspberry.sh b/seqs/raspberry.sh index 08a57ce..b8b894e 100755 --- a/seqs/raspberry.sh +++ b/seqs/raspberry.sh @@ -52,7 +52,7 @@ HDSWAPPUUID= evalArgs() { local argCount=0 - + for arg in "$@"; do case "$1" in -a|--arch) @@ -75,7 +75,7 @@ evalArgs() { step_1_info() { # Shift away args shift; local lArgs=( "$@" ); evalArgs "${lArgs[@]}"; shift $? - + echoinfoArgs "[OPTIONS] [SD CARD DEVICE] [HD DEVICE]" echo "Download latest Raspberry Pi OS lite image $PIARCH" if [ $CONTEXT_EXE -ne 0 ]; then @@ -89,7 +89,7 @@ step_1_alias() { ALIAS="setup"; } step_1() { # Shift away args shift; local lArgs=( "$@" ); evalArgs "${lArgs[@]}"; shift $? - + if [ ! -f "$downLoc" ] ; then exe wget "$PIDOWNURL" -O "$downLoc" echo -ne " [I] sha256 sum of download:\n " @@ -244,7 +244,7 @@ step_4() { else echo " Replace \"root=PARTUUID=******00-01\" manually" fi - + # Disable initial resizing of the second partition echo -n " [I] remove \"init=/usr/lib/raspi-config/init_resize.sh\"" exe sed -i -E "s/[ ]*init=.*\/init_resize\.sh//" "$SDBOOT/cmdline.txt" @@ -253,11 +253,11 @@ step_4() { else echo -e "\n Failed! Remove init=... manually" fi - + # Save modifications for HD boot exe cp -ar "$SDBOOT"/cmdline.txt "$SDBOOT"/cmdline.txt.hd echo - + # Resize second partition of SD to max. possible size echo " [I] Resize root partion of SD: ${SDROOT} " step resizesd "$SDDEV" @@ -357,7 +357,7 @@ read_sd_dev() { SDDEV= return 1 fi - + if [[ "$SDDEV" =~ .*blk.* ]] ; then partExt="p" fi @@ -451,7 +451,7 @@ step_22() { return 1 fi echo " [I] Device to be resized: $SDROOTDEV" - + exe umount -q "$SDROOT" exe parted -s "$SDDEV" "resizepart $SDROOTPARTNO -1" quit saveReturn $? @@ -530,7 +530,7 @@ step_31_alias() { ALIAS="disable_wifi"; } step_31() { checkBootConfig "$RPI_CONFIG_DTOVERLAY" "$RPI_CONF_DI_WIFI" [ $? -eq 0 ] && endReturn -o 1 "Wifi already disabled" - + addConf -a "${RPI_CONFIG_DTOVERLAY}=$RPI_CONF_DI_WIFI" "$RPI_BOOT_CONFIG" echoseq " [W] Reboot to make changes active" @@ -560,7 +560,7 @@ step_34() { exe sed -i "s/^exit 0/# Turn off tvservice/" "$startScript" exep "echo \"${tvserviceOffCmd}\" >> $startScript" exep "echo -e \"\nexit 0\" >> $startScript" - + echoseq " [W] Reboot to make changes active" } tvserviceBin="/usr/bin/tvservice" diff --git a/seqs/roundcube.sh b/seqs/roundcube.sh index fd6a767..515f691 100755 --- a/seqs/roundcube.sh +++ b/seqs/roundcube.sh @@ -74,7 +74,7 @@ step_3() { exe read -p "Copy the lines above and press Enter to continue." exe vi "$RC_LOC/composer.json" step postupgrade - + echo " [I] Generating mysql database $RC_DATABASE" echo exe $WDIR/mysql.sh createdb -c utf8mb4 @@ -115,7 +115,7 @@ step_10() { # Install pspell and aspell spell check engine apt install php7.x-pspell aspell-en aspell-de - + [$RC_LOC/config/config.inc.php] \$config['spellcheck_engine'] = 'pspell'; \$config['spellcheck_languages'] = array( @@ -239,7 +239,7 @@ downloadLatest() { local downUrl="https://github.com/roundcube/roundcubemail/releases/download/${latestVersion}/roundcubemail-${latestVersion}-complete.tar.gz" tempExtract="$tempDown/roundcubemail-$latestVersion" tempInstall="$tempExtract/bin/installto.sh" - + if [ ! -e "$tempExtract" ] ; then exe mkdir -p "$tempDown" exe wget -O "$tempLoc" $downUrl diff --git a/seqs/rsyslog.sh b/seqs/rsyslog.sh index 9ff14cc..e3613f4 100755 --- a/seqs/rsyslog.sh +++ b/seqs/rsyslog.sh @@ -35,7 +35,7 @@ step_10_alias() { ALIAS="snmpd"; } step_10() { addConf -s -f "$CONFIG_SNMP" "$CONFIG_SNMP_DEST" endReturn -o $? - + step checkconf exe service rsyslog restart } @@ -46,7 +46,7 @@ step_12_alias() { ALIAS="cron"; } step_12() { addConf -s -f "$CONFIG_CRON" "$CONFIG_CRON_DEST" endReturn -o $? - + step checkconf exe service rsyslog restart } @@ -57,7 +57,7 @@ step_14_alias() { ALIAS="rngd"; } step_14() { addConf -s -f "$CONFIG_RNGD" "$CONFIG_RNGD_DEST" endReturn -o $? - + step checkconf exe service rsyslog restart } diff --git a/seqs/snmp.sh b/seqs/snmp.sh index df714a0..d8a2c9b 100755 --- a/seqs/snmp.sh +++ b/seqs/snmp.sh @@ -122,10 +122,10 @@ step_20() { exe chmod +x "$rpiExtendLoc" addConf -a "extend raspberry /etc/snmp/raspberry.sh" "$toolConfig" - + # VCHI initialization failed fix exe usermod -aG video ${toolSysUser} - + addConf -s "$rpiSudoersContent" "$rpiSudoersLoc" exe service snmpd restart @@ -141,7 +141,7 @@ step_22() { if [ "$?" != "0" ]; then return 1 fi - + exe wget https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/osupdate -O "${osUpdateExtendLoc}" endReturn -o $? "Download failed" exe chmod +x "$osUpdateExtendLoc" @@ -383,11 +383,11 @@ step_40() { if [ $? -ne 0 ]; then return 0 fi - + exe wget https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/distro -O "${distroExtendLoc}" endReturn -o $? "Download distro detection script failed" exe chmod +x "$distroExtendLoc" - + echoseq " [I] Create distro extend" addConf -a "extend distro ${distroExtendLoc}" "$toolConfig" @@ -415,13 +415,13 @@ step_42() { exe wget $locExtUrl -O "${locExtLoc}" endReturn -o $? "Download $locExtName script failed" exe chmod +x "$locExtLoc" - + echoseq " [I] Create extend for $locExtName" addConf -a "extend $locExtName ${locExtLoc}" "$toolConfig" echoseq " [I] Create config for $locExtName" addConf -s "$dhcpExtendConfig" "$dhcpExtendConfigLoc" - + echo " [W] Adapt config $dhcpExtendConfigLoc manually and restart snmpd" } dhcpExtendConfigLoc="${toolConfigLoc}/dhcp.json" @@ -530,7 +530,7 @@ checkExtend() { if [ $? -eq 0 ] && [ $DRY -eq 0 ] ; then return 1 fi - + return 0 } diff --git a/seqs/spamass.sh b/seqs/spamass.sh index 3c975b4..8c21c44 100755 --- a/seqs/spamass.sh +++ b/seqs/spamass.sh @@ -110,7 +110,7 @@ notes=' imapsieve_mailbox2_from = Spam imapsieve_mailbox2_causes = COPY imapsieve_mailbox2_before = file:/usr/lib/dovecot/sieve-pipe/report-ham.sieve - + sieve_extensions = +notify +imapflags +vnd.dovecot.execute sieve_global_extensions = +vnd.dovecot.pipe +vnd.dovecot.environment @@ -123,7 +123,7 @@ notes=' if environment :matches "imap.user" "*" { set "username" "${1}"; pipe :copy "sa-learn-spam.sh" [ "${username}" ]; - + [/usr/lib/dovecot/sieve-pipe/report-ham.sieve] require ["vnd.dovecot.pipe", "copy", "imapsieve", "environment", "variables"]; if environment :matches "imap.mailbox" "*" { @@ -136,7 +136,7 @@ notes=' set "username" "${1}"; } pipe :copy "sa-learn-ham.sh" [ "${username}" ]; - + [/usr/lib/dovecot/sieve-pipe/sa-learn-spam.sh] #!/bin/sh # sa-learn is used in parallel. Be aware of system resources when diff --git a/seqs/ssh.sh b/seqs/ssh.sh index 6e34626..5fd71d5 100755 --- a/seqs/ssh.sh +++ b/seqs/ssh.sh @@ -189,7 +189,7 @@ parseList() { endReturn -f "Stop on first error" fi fi - + ((line++)) done 3<"$1" echoseq " [I] Parsed $((--line)) lines" diff --git a/seqs/torrentwatch.sh b/seqs/torrentwatch.sh index 1b4a362..cddea07 100755 --- a/seqs/torrentwatch.sh +++ b/seqs/torrentwatch.sh @@ -127,7 +127,7 @@ step_30() { echoerr " [E] Backup failed. Aborting upgrade." return 1 fi - + echo " [I] Upgrading data" exe mv "$toolConfigLoc/lib" "$toolConfigLoc/lib_bu" exe cp -ar "$gitLibLoc/lib" "$toolConfigLoc/" diff --git a/seqs/webserver.sh b/seqs/webserver.sh index 0d1bc72..cf37deb 100755 --- a/seqs/webserver.sh +++ b/seqs/webserver.sh @@ -24,7 +24,7 @@ step_1() { shift local osRelease=$1 endCheckEmpty osRelease "Debian release not provided" - + echoseq " [I] Setup apt source for $serverName $serverSourceUrl" local srvSource="deb $serverSourceUrl $osRelease nginx" addConf -s "$srvSource" "$serverSourceLoc" @@ -82,8 +82,10 @@ listen 80 default_server; include ${snippetLetsencryptLoc}; }" -step_4_info() { echo "Installation of $phpName packages:" - echoinfo "$phpPackages"; } +step_4_info() { + echo "Installation of $phpName packages:" + echoinfo "$phpPackages" +} step_4_alias() { ALIAS="php"; } step_4() { exe apt install $(eval echo $phpPackages) $aptOpt @@ -142,7 +144,7 @@ step_5() { exe sed -i "s|;emergency_restart_threshold.*|emergency_restart_threshold = 10|g" "$phpFpmIniLocation" exe sed -i "s|;emergency_restart_interval.*|emergency_restart_interval = 1m|g" "$phpFpmIniLocation" exe sed -i "s|;process_control_timeout.*|process_control_timeout = 10|g" "$phpFpmIniLocation" - + addConf -a "" "$phpPoolConfigLocation" exe sed -i "s/;env\[HOSTNAME\] = /env[HOSTNAME] = /" "$phpPoolConfigLocation" exe sed -i "s/;env\[TMP\] = /env[TMP] = /" "$phpPoolConfigLocation" diff --git a/seqs/webserverUbuntu.sh b/seqs/webserverUbuntu.sh index 517ab26..e028ffa 100755 --- a/seqs/webserverUbuntu.sh +++ b/seqs/webserverUbuntu.sh @@ -6,8 +6,10 @@ phpVersion="7.3" phpName="php$phpVersion" phpPackages="${phpName}-fpm ${phpName}-json ${phpName}-mysql ${phpName}-curl ${phpName}-intl ${phpName}-gd ${phpName}-zip ${phpName}-xml ${phpName}-mbstring php-imagick php-apcu" -step_1_info() { echo "Installation of $serverName packages:" - echoinfo "$serverPackages"; } +step_1_info() { + echo "Installation of $serverName packages:" + echoinfo "$serverPackages" +} step_1_alias() { ALIAS="install"; } step_1() { exe apt update @@ -19,16 +21,16 @@ step_2_info() { echo "Basic nginx configuration for initial letsencrypt certific step_2() { # Writing acme-challenge code snipped for certbot web root authentication addConf -c "$snippetLetsencrypt" "$snippetLetsencryptLoc" - + # Writing minimal default (see below) addConf -c "$siteDefaultIp4" "$siteDefaultLoc" - + # try fix errors on first install attempt # (possible missing ipv6 support on system) if [ $ERNO -ne 0 ] ; then exe apt install nginx fi - + # create webroot exe mkdir -p "$siteLetsencryptWww" @@ -50,8 +52,10 @@ siteDefaultIp4="server { include ${snippetLetsencryptLoc}; }" -step_3_info() { echo "Installation of $phpName packages:" - echoinfo "$phpPackages"; } +step_3_info() { + echo "Installation of $phpName packages:" + echoinfo "$phpPackages" +} step_3() { exe apt install $phpPackages endReturn -o $? "$phpName error during startup" diff --git a/seqs/wireguard.sh b/seqs/wireguard.sh index fc45759..d0ff4a0 100755 --- a/seqs/wireguard.sh +++ b/seqs/wireguard.sh @@ -13,14 +13,14 @@ CONFIG_FILE_NAME="${toolName}.cfg" CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example" #step_config() { - #echo "Called once before executing steps." - ## e.g. to source a config file manually: - #. "$CONFIG_FILE" - ## or to use sequencer api: - #initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE" - #if [ $? -eq 0 ] ; then - # CONFIG=1 - #fi +#echo "Called once before executing steps." +## e.g. to source a config file manually: +#. "$CONFIG_FILE" +## or to use sequencer api: +#initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE" +#if [ $? -eq 0 ] ; then +# CONFIG=1 +#fi #} step_1_info() { echo "Prepare installation of $toolName"; }