modernize multiple seqs and fix deprecated use of endCheckEmpty
This commit is contained in:
@@ -1,42 +1,36 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
toolName=backup
|
readonly toolName=backup
|
||||||
toolBin=rsync
|
readonly toolBin=rsync
|
||||||
|
|
||||||
# Get script working directory
|
sq_aptOpt=
|
||||||
# (when called from a different directory)
|
sq_config=0
|
||||||
WDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >>/dev/null 2>&1 && pwd )"
|
|
||||||
APTOPT=
|
|
||||||
CONFIG=0
|
|
||||||
CONFIG_FILE_NAME="${toolName}.cfg"
|
|
||||||
CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
|
|
||||||
|
|
||||||
seq_config() {
|
seq_config() {
|
||||||
initSeqConfig -t "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE"
|
if initSeqConfig -t "${seq_configName:?}" "${seq_configTemplate:?}" ; then
|
||||||
if [ $? -eq 0 ] ; then
|
sq_config=1
|
||||||
CONFIG=1
|
|
||||||
else
|
else
|
||||||
error -e "Check output for errors"
|
error -e "Check output for errors"
|
||||||
# End if no configuration file exists
|
# End if no configuration file exists
|
||||||
dry || return -1
|
dry || return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
quiet && APTOPT="-y"
|
interactive || sq_aptOpt="-y"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
step_1_info() {
|
step_1_info() {
|
||||||
echo "Backup root"
|
echo "Backup root"
|
||||||
echoinfo "Essential excludes are provided in the configuration template."
|
echoinfo "Essential excludes are provided in the configuration template."
|
||||||
echoinfo "($CONFIG_FILE_TEMPLATE)"
|
echoinfo "(${seq_configTemplate})"
|
||||||
}
|
}
|
||||||
step_1_options() { echo "[ADDITIONAL_EXCLUDES...]"; }
|
step_1_options() { echo "[ADDITIONAL_EXCLUDES...]"; }
|
||||||
step_1_alias() { echo "buroot"; }
|
step_1_alias() { echo "buroot"; }
|
||||||
step_1() {
|
step_1() {
|
||||||
local buTarget="/backup"
|
local buTarget="/backup"
|
||||||
if [ $CONFIG -eq 0 ] ; then
|
if (( ! sq_config )) ; then
|
||||||
error -e "Cannot backup root without properly configured excludes"
|
error -e "Cannot backup root without properly configured excludes"
|
||||||
error -e " (expected config: $seq_configRoot/$CONFIG_FILE_NAME)"
|
error -e " (expected config: ${seq_configFile})"
|
||||||
else
|
else
|
||||||
buTarget="$BACKUP_TARGET"
|
buTarget="$BACKUP_TARGET"
|
||||||
fi
|
fi
|
||||||
@@ -49,20 +43,19 @@ step_1() {
|
|||||||
|
|
||||||
step_3_info() {
|
step_3_info() {
|
||||||
# Backup single directory recursively
|
# Backup single directory recursively
|
||||||
local opt="[OPTION]"
|
local opt=
|
||||||
local dir="<DIRECTORY>"
|
local dir=
|
||||||
local tar="<TARGET>"
|
local tar=
|
||||||
local exc="[EXCLUDES...]"
|
local exc=
|
||||||
shift
|
shift
|
||||||
if [ "${1:-}" == "-t" ] ; then
|
if [ "${1:-}" == "-t" ] ; then
|
||||||
opt=" -t "
|
opt=" -t "
|
||||||
tar=
|
|
||||||
shift
|
shift
|
||||||
fi
|
fi
|
||||||
if [ -n "${1:-}" ] ; then
|
if [ -n "${1:-}" ] ; then
|
||||||
dir="$1"
|
dir="$1"
|
||||||
shift
|
shift
|
||||||
if [ -n $tar ] && [ -n "$1" ] ; then
|
if [ -z $opt ] && [ -n "$1" ] ; then
|
||||||
tar="$1"
|
tar="$1"
|
||||||
shift
|
shift
|
||||||
else
|
else
|
||||||
@@ -81,6 +74,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_options() { echo "[OPTION] <DIRECTORY> [TARGET] [EXCLUDES...]"; }
|
||||||
step_3_alias() { echo "budir"; }
|
step_3_alias() { echo "budir"; }
|
||||||
step_3() {
|
step_3() {
|
||||||
local configTarget=0
|
local configTarget=0
|
||||||
@@ -119,7 +113,7 @@ step_3() {
|
|||||||
buLog="backup_${buLog}"
|
buLog="backup_${buLog}"
|
||||||
shift
|
shift
|
||||||
|
|
||||||
if [ $configTarget -ne 0 ] && [ $CONFIG -ne 0 ] ; then
|
if [ $configTarget -ne 0 ] && (( sq_config )) ; then
|
||||||
# Taking target from config
|
# Taking target from config
|
||||||
buTarget=$(echo "$BACKUP_TARGET" | sed 's:/*$::')
|
buTarget=$(echo "$BACKUP_TARGET" | sed 's:/*$::')
|
||||||
else
|
else
|
||||||
@@ -176,7 +170,7 @@ step_100_info() { echo "Install $toolBin"; }
|
|||||||
step_100_alias() { echo "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 ${sq_aptOpt}
|
||||||
}
|
}
|
||||||
|
|
||||||
checkInstalled() {
|
checkInstalled() {
|
||||||
@@ -187,6 +181,7 @@ checkInstalled() {
|
|||||||
toolBin="$(command -v $toolBin)"
|
toolBin="$(command -v $toolBin)"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# shellcheck disable=SC2034 # Appears unused
|
||||||
readonly sqr_minVersion=16
|
readonly sqr_minVersion=16
|
||||||
|
# shellcheck disable=SC1091 # Don't follow this source
|
||||||
. /usr/local/bin/sequencer.sh
|
. /usr/local/bin/sequencer.sh
|
||||||
|
|
||||||
|
@@ -3,21 +3,20 @@
|
|||||||
# Certbot installation and creation supporting Raspbian and Ubuntu.
|
# Certbot installation and creation supporting Raspbian and Ubuntu.
|
||||||
# Certificate can be created/updated as "certonly" only.
|
# Certificate can be created/updated as "certonly" only.
|
||||||
|
|
||||||
toolName=certbot
|
readonly toolName=certbot
|
||||||
|
|
||||||
# Get script working directory
|
sq_aptOpt=
|
||||||
# (when called from a different directory)
|
|
||||||
WDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >>/dev/null 2>&1 && pwd )"
|
|
||||||
CONFIG=0
|
|
||||||
CONFIG_FILE_NAME="${toolName}.cfg"
|
|
||||||
CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
|
|
||||||
|
|
||||||
seq_config() {
|
seq_config() {
|
||||||
initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE"
|
if ! initSeqConfig "${seq_configName:?}" "${seq_configTemplate:?}" ; then
|
||||||
local confReturn=$?
|
# End if no configuration file exists
|
||||||
if [ $confReturn -eq 0 ] ; then
|
dry || return 1
|
||||||
CONFIG=1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
## Apt cmdline option to suppress user interaction
|
||||||
|
interactive || sq_aptOpt="-y"
|
||||||
|
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
step_1_info() { echo "Install $toolName for letsencrypt"; }
|
step_1_info() { echo "Install $toolName for letsencrypt"; }
|
||||||
@@ -41,24 +40,17 @@ step_1() {
|
|||||||
|
|
||||||
echo " [I] Detected OS: $osName $distName"
|
echo " [I] Detected OS: $osName $distName"
|
||||||
|
|
||||||
local aptOption=
|
|
||||||
if quiet ; then
|
|
||||||
aptOption="-y"
|
|
||||||
else
|
|
||||||
aptOption=""
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$osName" == "Ubuntu" ] ; then
|
if [ "$osName" == "Ubuntu" ] ; then
|
||||||
exe apt-get update
|
exe apt-get update
|
||||||
exe apt-get install software-properties-common $aptOption
|
exe apt-get install software-properties-common ${sq_aptOpt}
|
||||||
saveReturn $?
|
saveReturn $?
|
||||||
exe add-apt-repository universe $aptOption
|
exe add-apt-repository universe ${sq_aptOpt}
|
||||||
saveReturn $?
|
saveReturn $?
|
||||||
exe add-apt-repository ppa:certbot/certbot $aptOption
|
exe add-apt-repository ppa:certbot/certbot ${sq_aptOpt}
|
||||||
saveReturn $?
|
saveReturn $?
|
||||||
exe apt-get update
|
exe apt-get update
|
||||||
|
|
||||||
exe apt-get install $toolName $aptOption
|
exe apt-get install $toolName ${sq_aptOpt}
|
||||||
saveReturn $?
|
saveReturn $?
|
||||||
endReturn "$toolName installation for $osName failed"
|
endReturn "$toolName installation for $osName failed"
|
||||||
elif [ "$osName" == "Raspbian" ] ; then
|
elif [ "$osName" == "Raspbian" ] ; then
|
||||||
@@ -71,13 +63,15 @@ step_1() {
|
|||||||
step_2_info() { echo "Create or update letsencrypt certificate"; }
|
step_2_info() { echo "Create or update letsencrypt certificate"; }
|
||||||
step_2_alias() { echo "update"; }
|
step_2_alias() { echo "update"; }
|
||||||
step_2() {
|
step_2() {
|
||||||
endCheckEmpty CERTBOT_DOMAINS "No domain list found. Check configuration"
|
endIfEmpty CERTBOT_DOMAINS "No domain list found. Check configuration"
|
||||||
endCheckEmpty CERTBOT_WEBROOT "Invalid web root. Check configuration"
|
endIfEmpty CERTBOT_WEBROOT "Invalid web root. Check configuration"
|
||||||
endCheckEmpty CERTBOT_MAIL "Invalid mail address. Check configuration"
|
endIfEmpty CERTBOT_MAIL "Invalid mail address. Check configuration"
|
||||||
|
|
||||||
exe certbot certonly --webroot -w "$CERTBOT_WEBROOT" --rsa-key-size 4096 --expand --agree-tos \
|
exe certbot certonly --webroot -w "$CERTBOT_WEBROOT" --rsa-key-size 4096 --expand --agree-tos \
|
||||||
-m "$CERTBOT_MAIL" ${CERTBOT_DOMAINS[@]/#/-d }
|
-m "$CERTBOT_MAIL" ${CERTBOT_DOMAINS[@]/#/-d }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# shellcheck disable=SC2034 # Appears unused
|
||||||
readonly sqr_minVersion=16
|
readonly sqr_minVersion=16
|
||||||
|
# shellcheck disable=SC1091 # Don't follow this source
|
||||||
. /usr/local/bin/sequencer.sh
|
. /usr/local/bin/sequencer.sh
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#toolName=mytool
|
#toolName=mytool
|
||||||
toolDownSite="https://raspi.debian.net/tested-images"
|
readonly toolDownSite="https://raspi.debian.net/tested-images"
|
||||||
toolDownUrl=
|
toolDownUrl=
|
||||||
toolDownFile=
|
toolDownFile=
|
||||||
|
|
||||||
toolEssentialDeps="vim bash-completion man-db locales wget"
|
readonly toolEssentialDeps="vim bash-completion man-db locales wget"
|
||||||
|
|
||||||
SDDEV=
|
SDDEV=
|
||||||
SDBOOT=
|
SDBOOT=
|
||||||
@@ -14,25 +14,18 @@ SDROOT=
|
|||||||
SDROOTDEV=
|
SDROOTDEV=
|
||||||
SDROOTPUUID=
|
SDROOTPUUID=
|
||||||
|
|
||||||
# Get script working directory
|
sq_aptOpt=
|
||||||
# (when called from a different directory)
|
|
||||||
WDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >>/dev/null 2>&1 && pwd )"
|
|
||||||
APTOPT=
|
|
||||||
CONFIG=0
|
|
||||||
SCRIPT_NAME=$(basename -- $0)
|
|
||||||
SCRIPT_NAME=${SCRIPT_NAME%%.*}
|
|
||||||
CONFIG_FILE_NAME="${SCRIPT_NAME}.cfg"
|
|
||||||
CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
|
|
||||||
|
|
||||||
seq_config() {
|
seq_config() {
|
||||||
quiet && APTOPT="-y"
|
interactive || sq_aptOpt="-y"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
step_1_info() {
|
step_1_info() {
|
||||||
echo "Download latest xz-compressed image [IMAGE FILE URL] [SD CARD DEVICE]"
|
echo "Download latest xz-compressed image"
|
||||||
echoinfo "$toolDownSite"
|
echoinfo "$toolDownSite"
|
||||||
}
|
}
|
||||||
|
step_1_options() { echo "[IMAGE FILE URL] [SD CARD DEVICE]"; }
|
||||||
step_1_alias() { echo "install"; }
|
step_1_alias() { echo "install"; }
|
||||||
step_1() {
|
step_1() {
|
||||||
shift
|
shift
|
||||||
@@ -71,7 +64,8 @@ step_1() {
|
|||||||
endReturn -o $? "SHA256 checksum error"
|
endReturn -o $? "SHA256 checksum error"
|
||||||
}
|
}
|
||||||
|
|
||||||
step_2_info() { echo "Write image to device [DEVICE]"; }
|
step_2_info() { echo "Write image to device"; }
|
||||||
|
step_2_options() { echo "[DEVICE]"; }
|
||||||
step_2() {
|
step_2() {
|
||||||
shift
|
shift
|
||||||
if [ -z "$SDDEV" ] ; then
|
if [ -z "$SDDEV" ] ; then
|
||||||
@@ -130,8 +124,8 @@ step_10() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
exe apt update
|
exe apt update
|
||||||
exe apt full-upgrade $APTOPT
|
exe apt full-upgrade ${sq_aptOpt}
|
||||||
exe apt install $toolEssentialDeps $APTOPT
|
exe apt install $toolEssentialDeps ${sq_aptOpt}
|
||||||
}
|
}
|
||||||
|
|
||||||
step_11_info() { echo "Set timezone"; }
|
step_11_info() { echo "Set timezone"; }
|
||||||
@@ -156,12 +150,13 @@ step_12() {
|
|||||||
}
|
}
|
||||||
localesConfigLoc="/etc/locale.gen"
|
localesConfigLoc="/etc/locale.gen"
|
||||||
|
|
||||||
step_14_info() { echo "Change hostname [HOSTNAME]"; }
|
step_14_info() { echo "Change hostname"; }
|
||||||
|
step_14_options() { echo "[HOSTNAME]"; }
|
||||||
step_14_alias() { echo "hostname"; }
|
step_14_alias() { echo "hostname"; }
|
||||||
step_14() {
|
step_14() {
|
||||||
shift
|
shift
|
||||||
local localHostname=$1
|
local localHostname=$1
|
||||||
endCheckEmpty localHostname "No hostname provided"
|
endIfEmpty 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
|
||||||
info "Hostname $localHostname already defined"
|
info "Hostname $localHostname already defined"
|
||||||
return 0
|
return 0
|
||||||
@@ -175,7 +170,7 @@ hostsLoc="/etc/hosts"
|
|||||||
step_16_info() { echo "Install cifs mounting requirements"; }
|
step_16_info() { echo "Install cifs mounting requirements"; }
|
||||||
step_16_alias() { echo "cifs"; }
|
step_16_alias() { echo "cifs"; }
|
||||||
step_16() {
|
step_16() {
|
||||||
exe apt install cifs-utils $APTOPT
|
exe apt install cifs-utils ${sq_aptOpt}
|
||||||
}
|
}
|
||||||
|
|
||||||
step_17_info() { echo "Cifs notes"; }
|
step_17_info() { echo "Cifs notes"; }
|
||||||
@@ -296,5 +291,8 @@ read_sd_dev() {
|
|||||||
}
|
}
|
||||||
SDBOOTPARTNO=1
|
SDBOOTPARTNO=1
|
||||||
SDROOTPARTNO=2
|
SDROOTPARTNO=2
|
||||||
|
|
||||||
|
# shellcheck disable=SC2034 # Appears unused
|
||||||
readonly sqr_minVersion=16
|
readonly sqr_minVersion=16
|
||||||
|
# shellcheck disable=SC1091 # Don't follow this source
|
||||||
. /usr/local/bin/sequencer.sh
|
. /usr/local/bin/sequencer.sh
|
||||||
|
@@ -1,26 +1,18 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Get script working directory
|
sq_aptOpt=
|
||||||
# (when called from a different directory)
|
|
||||||
WDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >>/dev/null 2>&1 && pwd)"
|
|
||||||
APTOPT=
|
|
||||||
CONFIG=0
|
|
||||||
SCRIPT_NAME=$(basename -- $0)
|
|
||||||
SCRIPT_NAME=${SCRIPT_NAME%%.*}
|
|
||||||
CONFIG_FILE_NAME="${SCRIPT_NAME}.cfg"
|
|
||||||
CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
|
|
||||||
|
|
||||||
seq_config() {
|
seq_config() {
|
||||||
checkVpn
|
checkVpn
|
||||||
|
|
||||||
initSeqConfig -t "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE"
|
if ! initSeqConfig -t "${seq_configName:?}" "${seq_configTemplate:?}" ; then
|
||||||
if [ $? -eq 0 ] ; then
|
|
||||||
CONFIG=1
|
|
||||||
else
|
|
||||||
# End if no configuration file exists
|
# End if no configuration file exists
|
||||||
dry || return -1
|
dry || return 1
|
||||||
fi
|
fi
|
||||||
quiet && APTOPT="-y"
|
|
||||||
|
## Apt cmdline option to suppress user interaction
|
||||||
|
interactive || sq_aptOpt="-y"
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -227,7 +219,7 @@ step_11() {
|
|||||||
exe curl -sL "$lidarrUrl" -o /tmp/Lidarr.tgz
|
exe curl -sL "$lidarrUrl" -o /tmp/Lidarr.tgz
|
||||||
endReturn -o "Download failed"
|
endReturn -o "Download failed"
|
||||||
|
|
||||||
exe apt install $lidarrDeps $APTOPT
|
exe apt install $lidarrDeps ${sq_aptOpt}
|
||||||
|
|
||||||
exe tar xvzf /tmp/Lidarr.tgz -C "${DLD_DIR}/"
|
exe tar xvzf /tmp/Lidarr.tgz -C "${DLD_DIR}/"
|
||||||
exe mv "${DLD_DIR}/Lidarr" "${DLD_DIR}/lidarr"
|
exe mv "${DLD_DIR}/Lidarr" "${DLD_DIR}/lidarr"
|
||||||
@@ -273,7 +265,7 @@ step_13() {
|
|||||||
local bazarrDeps="python3-pip python3-distutils python3-venv ffmpeg"
|
local bazarrDeps="python3-pip python3-distutils python3-venv ffmpeg"
|
||||||
#local bazarrDeps+=" libxml2-dev libxslt1-dev python3-libxml2 python3-lxml libatlas-base-dev"
|
#local bazarrDeps+=" libxml2-dev libxslt1-dev python3-libxml2 python3-lxml libatlas-base-dev"
|
||||||
|
|
||||||
exe apt install $bazarrDeps $APTOPT
|
exe apt install $bazarrDeps ${sq_aptOpt}
|
||||||
}
|
}
|
||||||
|
|
||||||
step_14_info() { echo "Install bazarr"; }
|
step_14_info() { echo "Install bazarr"; }
|
||||||
@@ -352,8 +344,8 @@ step_16() {
|
|||||||
|
|
||||||
exe mkdir -p "$buildPath"
|
exe mkdir -p "$buildPath"
|
||||||
exe cd "$buildPath"
|
exe cd "$buildPath"
|
||||||
exe apt build-dep unrar-nonfree $APTOPT
|
exe apt build-dep unrar-nonfree ${sq_aptOpt}
|
||||||
exe apt source -b unrar-nonfree $APTOPT
|
exe apt source -b unrar-nonfree ${sq_aptOpt}
|
||||||
endReturn -o $? "unrar-nonfree build failed ($buildPath left untouched)"
|
endReturn -o $? "unrar-nonfree build failed ($buildPath left untouched)"
|
||||||
exe dpkg -i unrar*.deb
|
exe dpkg -i unrar*.deb
|
||||||
endReturn -o $? "unrar-nonfree install failed ($buildPath left untouched)"
|
endReturn -o $? "unrar-nonfree install failed ($buildPath left untouched)"
|
||||||
@@ -370,7 +362,7 @@ step_17() {
|
|||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
exe apt update
|
exe apt update
|
||||||
exe apt install dante-server $APTOPT
|
exe apt install dante-server ${sq_aptOpt}
|
||||||
exe systemctl stop danted.service
|
exe systemctl stop danted.service
|
||||||
exe systemctl disable danted.service
|
exe systemctl disable danted.service
|
||||||
}
|
}
|
||||||
@@ -606,5 +598,7 @@ checkVpn() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# shellcheck disable=SC2034 # Appears unused
|
||||||
readonly sqr_minVersion=16
|
readonly sqr_minVersion=16
|
||||||
|
# shellcheck disable=SC1091 # Don't follow this source
|
||||||
. /usr/local/bin/sequencer.sh
|
. /usr/local/bin/sequencer.sh
|
||||||
|
@@ -27,16 +27,15 @@ seq_config() {
|
|||||||
step_1_info() {
|
step_1_info() {
|
||||||
echo -n "Backup "
|
echo -n "Backup "
|
||||||
if contextHelp ; then
|
if contextHelp ; then
|
||||||
echo -n "selected profile"
|
echo "selected profile"
|
||||||
else
|
else
|
||||||
echo -n "profile: $seq_profileName"
|
echo "profile: $seq_profileName"
|
||||||
fi
|
fi
|
||||||
echo " [OPTIONS] [full|incremental]"
|
|
||||||
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"
|
||||||
echoinfo " --allow-source-mismatch, -a : see ${toolName:-} help"
|
echoinfo " --allow-source-mismatch, -a : see ${toolName:-} help"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
step_1_options() { echo '[OPTIONS] [full|incremental]'; }
|
||||||
step_1_alias() { echo "backup"; }
|
step_1_alias() { echo "backup"; }
|
||||||
step_1() {
|
step_1() {
|
||||||
shift
|
shift
|
||||||
@@ -109,12 +108,13 @@ step_3() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
step_5_info() {
|
step_5_info() {
|
||||||
echo "Restore [OPTIONS] <LOCAL TARGET> [TARGET]"
|
echo "Restore files from backup"
|
||||||
echoinfo " [OPTIONS]"
|
echoinfo " [OPTIONS]"
|
||||||
echoinfo " --file-to-restore, -f <RELPATH> : Relative path within backup"
|
echoinfo " --file-to-restore, -f <RELPATH> : Relative path within backup"
|
||||||
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_options() { echo '[OPTIONS] <LOCAL TARGET> [TARGET]'; }
|
||||||
step_5_alias() { echo "restore"; }
|
step_5_alias() { echo "restore"; }
|
||||||
step_5() {
|
step_5() {
|
||||||
shift
|
shift
|
||||||
@@ -153,7 +153,8 @@ step_5() {
|
|||||||
unsetPassphrase
|
unsetPassphrase
|
||||||
}
|
}
|
||||||
|
|
||||||
step_7_info() { echo "Purge old backups [TARGET]"; }
|
step_7_info() { echo "Purge old backups"; }
|
||||||
|
step_7_options() { echo '[TARGET]'; }
|
||||||
step_7_alias() { echo "purge"; }
|
step_7_alias() { echo "purge"; }
|
||||||
step_7() {
|
step_7() {
|
||||||
shift
|
shift
|
||||||
@@ -185,13 +186,14 @@ step_20_info() {
|
|||||||
local ebuTarget="${EBU_TARGET:-}"
|
local ebuTarget="${EBU_TARGET:-}"
|
||||||
[ ! -z "${1:-}" ] && ebuTarget="$1"
|
[ ! -z "${1:-}" ] && ebuTarget="$1"
|
||||||
if contextHelp; then
|
if contextHelp; then
|
||||||
echo "Status of (profile) [TARGET]"
|
echo "Status of (profile)"
|
||||||
elif [ -n "${1:-}" ]; then
|
elif [ -n "${1:-}" ]; then
|
||||||
echo "Status of target: $ebuTarget"
|
echo "Status of target: $ebuTarget"
|
||||||
else
|
else
|
||||||
echo "Status of profile \"$seq_profileName\" target: $ebuTarget"
|
echo "Status of profile \"$seq_profileName\" target: $ebuTarget"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
step_20_options() { echo '[TARGET]'; }
|
||||||
step_20_alias() { echo 'status'; }
|
step_20_alias() { echo 'status'; }
|
||||||
step_20() {
|
step_20() {
|
||||||
shift
|
shift
|
||||||
@@ -202,7 +204,8 @@ step_20() {
|
|||||||
exe $toolBin collection-status "$ebuTarget"
|
exe $toolBin collection-status "$ebuTarget"
|
||||||
}
|
}
|
||||||
|
|
||||||
step_22_info() { echo "List backup files [TARGET]"; }
|
step_22_info() { echo "List backup files"; }
|
||||||
|
step_22_options() { echo '[TARGET]'; }
|
||||||
step_22_alias() { echo 'list'; }
|
step_22_alias() { echo 'list'; }
|
||||||
step_22() {
|
step_22() {
|
||||||
shift
|
shift
|
||||||
@@ -230,6 +233,7 @@ step_70_info() {
|
|||||||
echoinfo " --remove, -r : remove cron file"
|
echoinfo " --remove, -r : remove cron file"
|
||||||
}
|
}
|
||||||
step_70_alias() { echo 'cron'; }
|
step_70_alias() { echo 'cron'; }
|
||||||
|
step_70_options() { echo '[OPTIONS]'; }
|
||||||
step_70() {
|
step_70() {
|
||||||
shift
|
shift
|
||||||
local arg
|
local arg
|
||||||
|
@@ -114,7 +114,7 @@ step_14() {
|
|||||||
readDomain() {
|
readDomain() {
|
||||||
if [ "$myDomain" == "" ] ; then
|
if [ "$myDomain" == "" ] ; then
|
||||||
read -p "Enter your domain: " myDomain
|
read -p "Enter your domain: " myDomain
|
||||||
endCheckEmpty myDomain "$toolName domain"
|
endIfEmpty myDomain "$toolName domain"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,7 +123,7 @@ readUser() {
|
|||||||
if [ "$myUser" == "" ] ; then
|
if [ "$myUser" == "" ] ; then
|
||||||
read -p "Enter user name: " myUser
|
read -p "Enter user name: " myUser
|
||||||
echo
|
echo
|
||||||
endCheckEmpty myUser "$toolName user name"
|
endIfEmpty myUser "$toolName user name"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,7 +138,7 @@ readUserPass() {
|
|||||||
echo "[ERROR] Passwords don't match"
|
echo "[ERROR] Passwords don't match"
|
||||||
return 1;
|
return 1;
|
||||||
fi
|
fi
|
||||||
endCheckEmpty myPass "$toolName user password"
|
endIfEmpty myPass "$toolName user password"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,27 +1,21 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
toolName=element-web
|
readonly toolName=element-web
|
||||||
latestUrl="https://api.github.com/repos/vector-im/element-web/releases/latest"
|
readonly latestUrl="https://api.github.com/repos/vector-im/element-web/releases/latest"
|
||||||
|
|
||||||
# Get script working directory
|
sq_config=0
|
||||||
# (when called from a different directory)
|
|
||||||
WDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >>/dev/null 2>&1 && pwd )"
|
|
||||||
CONFIG=0
|
|
||||||
CONFIG_FILE_NAME="${toolName}.cfg"
|
|
||||||
CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
|
|
||||||
|
|
||||||
seq_config() {
|
seq_config() {
|
||||||
initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE"
|
if initSeqConfig "${seq_configName:?}" "${seq_configTemplate:?}" ; then
|
||||||
if [ $? -eq 0 ] ; then
|
|
||||||
echo " ${toolName} path: ${ELEMENT_WEB_LOC}"
|
echo " ${toolName} path: ${ELEMENT_WEB_LOC}"
|
||||||
echo " ${toolName} backup: ${ELEMENT_WEB_BACKUP}"
|
echo " ${toolName} backup: ${ELEMENT_WEB_BACKUP}"
|
||||||
CONFIG=1
|
sq_config=1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
step_18_info() { echo "Check for updates"; }
|
step_1_info() { echo "Check for updates"; }
|
||||||
step_18_alias() { echo "updatecheck"; }
|
step_1_alias() { echo "updatecheck"; }
|
||||||
step_18() {
|
step_1() {
|
||||||
shift
|
shift
|
||||||
local latestVersion=
|
local latestVersion=
|
||||||
if [ ! -z "${1:-}" ] ; then
|
if [ ! -z "${1:-}" ] ; then
|
||||||
@@ -30,8 +24,8 @@ step_18() {
|
|||||||
latestVersion=$(curl --silent "$latestUrl" | grep -Po '"tag_name": "v\K.*?(?=")')
|
latestVersion=$(curl --silent "$latestUrl" | grep -Po '"tag_name": "v\K.*?(?=")')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local isInstalled=$(grep -E "${latestVersion}" "${ELEMENT_WEB_LOC}/version" >>/dev/null && echo "1" || echo "0")
|
local isInstalled=$(grep -E "${latestVersion}" "${ELEMENT_WEB_LOC:-}/version" >>/dev/null 2>&1 && echo "1" || echo "0")
|
||||||
if [ $isInstalled -eq 1 ] ; then
|
if (( isInstalled )) ; then
|
||||||
echo " [I] Version $latestVersion is already installed"
|
echo " [I] Version $latestVersion is already installed"
|
||||||
return 1
|
return 1
|
||||||
else
|
else
|
||||||
@@ -42,18 +36,19 @@ step_18() {
|
|||||||
|
|
||||||
|
|
||||||
step_20_info() {
|
step_20_info() {
|
||||||
echo -n "Create a backup [ELEMENT WEB ROOT]"
|
echo -n "Create a backup"
|
||||||
if [ $CONFIG -ne 0 ] ; then
|
if (( sq_config )) ; then
|
||||||
echo " at $ELEMENT_WEB_BACKUP"
|
echo " at $ELEMENT_WEB_BACKUP"
|
||||||
else
|
else
|
||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
step_20_options() { echo "[ELEMENT WEB ROOT]"; }
|
||||||
step_20_alias() { echo "backup"; }
|
step_20_alias() { echo "backup"; }
|
||||||
step_20() {
|
step_20() {
|
||||||
shift
|
shift
|
||||||
local tempRoot=
|
local tempRoot=
|
||||||
if [ $CONFIG -eq 0 ] ; then
|
if (( ! sq_config )) ; then
|
||||||
error -e "No configuration file found"
|
error -e "No configuration file found"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
@@ -79,12 +74,13 @@ step_22_info() {
|
|||||||
if ! contextHelp ; 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
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "Get version $1 from github"
|
echo "Get version $1 from github"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
step_22_options() { echo "[CUSTOM VERSION]"; }
|
||||||
step_22_alias() { echo "upgrade"; }
|
step_22_alias() { echo "upgrade"; }
|
||||||
step_22() {
|
step_22() {
|
||||||
shift # don't need step number
|
shift # don't need step number
|
||||||
@@ -160,5 +156,7 @@ step_24() {
|
|||||||
exe rm -rf "$tempDown"
|
exe rm -rf "$tempDown"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# shellcheck disable=SC2034 # Appears unused
|
||||||
readonly sqr_minVersion=16
|
readonly sqr_minVersion=16
|
||||||
|
# shellcheck disable=SC1091 # Don't follow this source
|
||||||
. /usr/local/bin/sequencer.sh
|
. /usr/local/bin/sequencer.sh
|
||||||
|
@@ -15,7 +15,7 @@ seq_config() {
|
|||||||
step_20_info() {
|
step_20_info() {
|
||||||
shift
|
shift
|
||||||
echo -n "Create a backup"
|
echo -n "Create a backup"
|
||||||
if [ $sq_config -ne 0 ] ; then
|
if (( sq_config )) ; then
|
||||||
echo " at $FR_BACKUP"
|
echo " at $FR_BACKUP"
|
||||||
else
|
else
|
||||||
echo
|
echo
|
||||||
@@ -26,7 +26,7 @@ step_20_alias() { echo "backup"; }
|
|||||||
step_20() {
|
step_20() {
|
||||||
shift
|
shift
|
||||||
local tempRoot=
|
local tempRoot=
|
||||||
if [ $sq_config -eq 0 ] ; then
|
if (( ! sq_config )) ; then
|
||||||
error -e "No configuration file found"
|
error -e "No configuration file found"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
@@ -61,12 +61,13 @@ step_22_info() {
|
|||||||
if ! contextHelp ; 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
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "Get version $1 from github"
|
echo "Get version $1 from github"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
step_22_options() { echo "[CUSTOM VERSION]"; }
|
||||||
step_22_alias() { echo "upgrade"; }
|
step_22_alias() { echo "upgrade"; }
|
||||||
step_22() {
|
step_22() {
|
||||||
shift # don't need step number
|
shift # don't need step number
|
||||||
|
@@ -3,42 +3,27 @@
|
|||||||
#
|
#
|
||||||
## Installation of self hosted git service Gitea
|
## Installation of self hosted git service Gitea
|
||||||
|
|
||||||
toolName="gitea"
|
readonly toolName="gitea"
|
||||||
# Get script working directory
|
readonly giteaLatestUrl="https://api.github.com/repos/go-gitea/gitea/releases/latest"
|
||||||
# (when called from a different directory)
|
readonly giteaVersion=$(curl --silent "$giteaLatestUrl" | grep -Po '"tag_name": "v\K.*?(?=")')
|
||||||
WDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >>/dev/null 2>&1 && pwd)"
|
readonly giteaDir="/usr/local/bin"
|
||||||
APTOPT=
|
readonly giteaServiceLoc="/etc/systemd/system/gitea.service"
|
||||||
CONFIG=0
|
readonly giteaLogDir="/var/log/gitea"
|
||||||
SCRIPT_FILE=$(basename -- $0)
|
readonly giteaDownFile="/tmp/giteaDown"
|
||||||
SCRIPT_NAME=${SCRIPT_FILE%%.*}
|
readonly giteaUser="git"
|
||||||
CONFIG_FILE_NAME="${SCRIPT_NAME}.cfg"
|
|
||||||
CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
|
|
||||||
|
|
||||||
giteaLatestUrl="https://api.github.com/repos/go-gitea/gitea/releases/latest"
|
|
||||||
giteaVersion=$(curl --silent "$giteaLatestUrl" | grep -Po '"tag_name": "v\K.*?(?=")')
|
|
||||||
giteaArch=
|
giteaArch=
|
||||||
giteaDownloadEval='https://dl.gitea.io/gitea/${giteaVersion}/gitea-${giteaVersion}-linux-${giteaArch}'
|
giteaDownloadEval='https://dl.gitea.io/gitea/${giteaVersion}/gitea-${giteaVersion}-linux-${giteaArch}'
|
||||||
giteaDownload=$(eval echo $giteaDownloadEval)
|
giteaDownload=$(eval echo $giteaDownloadEval)
|
||||||
giteaDir="/usr/local/bin"
|
|
||||||
giteaServiceLoc="/etc/systemd/system/gitea.service"
|
|
||||||
giteaLogDir="/var/log/gitea"
|
|
||||||
giteaIniLoc=
|
giteaIniLoc=
|
||||||
giteaDownFile="/tmp/giteaDown"
|
|
||||||
giteaUser="git"
|
|
||||||
versionNow=
|
versionNow=
|
||||||
|
|
||||||
seq_config() {
|
seq_config() {
|
||||||
initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE"
|
if ! initSeqConfig "${seq_configName:?}" "${seq_configTemplate:?}" ; then
|
||||||
if [ $? -eq 0 ] ; then
|
|
||||||
CONFIG=1
|
|
||||||
else
|
|
||||||
# End if no configuration file exists
|
# End if no configuration file exists
|
||||||
dry || return -1
|
dry || return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## Apt cmdline option to suppress user interaction
|
|
||||||
quiet && APTOPT="-y"
|
|
||||||
|
|
||||||
if [ -z $giteaVersion ] ; then
|
if [ -z $giteaVersion ] ; then
|
||||||
error -e "Couldn't determine latest version of $toolName"
|
error -e "Couldn't determine latest version of $toolName"
|
||||||
fi
|
fi
|
||||||
@@ -60,12 +45,13 @@ seq_config() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
checkArchitecture() {
|
checkArchitecture() {
|
||||||
|
[ -n "$giteaArch" ] && return 0
|
||||||
[ ! -z "$(command -v dpkg)" ] && giteaArch=$(dpkg --print-architecture)
|
[ ! -z "$(command -v dpkg)" ] && giteaArch=$(dpkg --print-architecture)
|
||||||
case $giteaArch in
|
case $giteaArch in
|
||||||
armhf)
|
armhf)
|
||||||
giteaArch="arm-6";;
|
giteaArch="arm-6";;
|
||||||
esac
|
esac
|
||||||
giteaDownload=$(eval echo $giteaDownloadEval)
|
giteaDownload="$(eval echo $giteaDownloadEval)"
|
||||||
}
|
}
|
||||||
|
|
||||||
step_1_info() { echo "Updating apt"; }
|
step_1_info() { echo "Updating apt"; }
|
||||||
@@ -75,14 +61,12 @@ step_1() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
step_2_info() {
|
step_2_info() {
|
||||||
[ -z "$giteaArch" ] && checkArchitecture
|
checkArchitecture
|
||||||
echo "Downloading $toolName to user home from:"
|
echo "Downloading $toolName to user home from:"
|
||||||
echoinfo "$giteaDownload"
|
echoinfo "$giteaDownload"
|
||||||
}
|
}
|
||||||
step_2() {
|
step_2() {
|
||||||
exe wget -O "$giteaDownFile" $giteaDownload
|
exe wget -O "$giteaDownFile" $giteaDownload
|
||||||
saveReturn $?
|
|
||||||
endReturn
|
|
||||||
}
|
}
|
||||||
|
|
||||||
step_3_info() { echo "Adding user for $toolName ($giteaUser)"; }
|
step_3_info() { echo "Adding user for $toolName ($giteaUser)"; }
|
||||||
@@ -95,8 +79,6 @@ step_3() {
|
|||||||
--disabled-password \
|
--disabled-password \
|
||||||
--home "$SEQ_GITEA_HOME_DIR" \
|
--home "$SEQ_GITEA_HOME_DIR" \
|
||||||
"$SEQ_GITEA_USER"
|
"$SEQ_GITEA_USER"
|
||||||
saveReturn $?
|
|
||||||
endReturn
|
|
||||||
}
|
}
|
||||||
|
|
||||||
step_4_info() { echo "Create required directory structure"; }
|
step_4_info() { echo "Create required directory structure"; }
|
||||||
@@ -108,9 +90,9 @@ step_4() {
|
|||||||
exe chmod 770 $SEQ_GITEA_CONF_DIR
|
exe chmod 770 $SEQ_GITEA_CONF_DIR
|
||||||
info "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"
|
||||||
sqr::echo -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" && sqr::echo "ok"
|
exe install -b -m 755 -T "$giteaDownFile" "$SEQ_GITEA_BIN_LOC" && info -d "ok"
|
||||||
endReturn "Failed to install $SEQ_GITEA_BIN_LOC"
|
endReturn -o $? "Failed to install $SEQ_GITEA_BIN_LOC"
|
||||||
}
|
}
|
||||||
|
|
||||||
step_5_info() { echo "Creating systemd service"; }
|
step_5_info() { echo "Creating systemd service"; }
|
||||||
@@ -158,7 +140,7 @@ NOTES_END
|
|||||||
|
|
||||||
step_10_info() { echo "Create mysql database for $toolName"; }
|
step_10_info() { echo "Create mysql database for $toolName"; }
|
||||||
step_10() {
|
step_10() {
|
||||||
exe "$WDIR/mysql.sh" -qq createdb --charset utf8mb4
|
exe "${seq_origin}/mysql.sh" -qq createdb --charset utf8mb4
|
||||||
}
|
}
|
||||||
|
|
||||||
step_12_info() {
|
step_12_info() {
|
||||||
@@ -175,7 +157,7 @@ step_12_info() {
|
|||||||
}
|
}
|
||||||
step_12_alias() { echo "upgrade"; }
|
step_12_alias() { echo "upgrade"; }
|
||||||
step_12() {
|
step_12() {
|
||||||
endCheckEmpty versionNow "Please install $toolName first"
|
endIfEmpty versionNow "Please install $toolName first"
|
||||||
exe wget -O "$giteaDownFile" $giteaDownload
|
exe wget -O "$giteaDownFile" $giteaDownload
|
||||||
endReturn -o $? "Download failed"
|
endReturn -o $? "Download failed"
|
||||||
|
|
||||||
@@ -204,5 +186,7 @@ step_22() {
|
|||||||
exe vi "$giteaIniLoc"
|
exe vi "$giteaIniLoc"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# shellcheck disable=SC2034 # Appears unused
|
||||||
readonly sqr_minVersion=16
|
readonly sqr_minVersion=16
|
||||||
|
# shellcheck disable=SC1091 # Don't follow this source
|
||||||
. /usr/local/bin/sequencer.sh
|
. /usr/local/bin/sequencer.sh
|
||||||
|
57
seqs/ldap.sh
57
seqs/ldap.sh
@@ -1,29 +1,29 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
toolName="ldap"
|
readonly toolName="ldap"
|
||||||
toolDaemon="slapd"
|
readonly toolDaemon="slapd"
|
||||||
toolDeps="$toolDaemon ldap-utils"
|
readonly toolDeps="$toolDaemon ldap-utils"
|
||||||
toolUser="openldap"
|
readonly toolUser="openldap"
|
||||||
|
|
||||||
# Get script working directory
|
sq_aptOpt=
|
||||||
# (when called from a different directory)
|
|
||||||
WDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >>/dev/null 2>&1 && pwd )"
|
|
||||||
CONFIG=0
|
|
||||||
CONFIG_FILE_NAME="${toolName}.cfg"
|
|
||||||
CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
|
|
||||||
|
|
||||||
seq_config() {
|
seq_config() {
|
||||||
initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE"
|
if ! initSeqConfig "${seq_configName:?}" "${seq_configTemplate:?}" ; then
|
||||||
if [ $? -eq 0 ] ; then
|
# End if no configuration file exists
|
||||||
CONFIG=1
|
dry || return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
## Apt cmdline option to suppress user interaction
|
||||||
|
interactive || sq_aptOpt="-y"
|
||||||
|
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
step_1_info() { echo "$toolName installation"; }
|
step_1_info() { echo "$toolName installation"; }
|
||||||
step_1_alias() { echo "install"; }
|
step_1_alias() { echo "install"; }
|
||||||
step_1() {
|
step_1() {
|
||||||
exe apt update
|
exe apt update
|
||||||
exe apt install $toolDeps
|
exe apt install $toolDeps ${sq_aptOpt}
|
||||||
}
|
}
|
||||||
|
|
||||||
step_2_info() { echo "Configuration of $toolName"; }
|
step_2_info() { echo "Configuration of $toolName"; }
|
||||||
@@ -161,7 +161,8 @@ E0F
|
|||||||
NOTES_EOF
|
NOTES_EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
step_100_info() { echo "Add group <GROUP NAME> <USER ID>"; }
|
step_100_info() { echo "Add group"; }
|
||||||
|
step_100_options() { echo "<GROUP NAME> <USER ID>"; }
|
||||||
step_100_alias() { echo "addgroup"; }
|
step_100_alias() { echo "addgroup"; }
|
||||||
step_100() {
|
step_100() {
|
||||||
shift
|
shift
|
||||||
@@ -177,7 +178,8 @@ description: Created by $0
|
|||||||
member: \${memberDn}
|
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"; }
|
||||||
|
step_102_options() { echo "<USER ID> <USER NAME> <USER LASTNAME> <UIDNUMBER> <USER EMAIL> [USER GID]"; }
|
||||||
step_102_alias() { echo "adduser"; }
|
step_102_alias() { echo "adduser"; }
|
||||||
step_102() {
|
step_102() {
|
||||||
shift
|
shift
|
||||||
@@ -214,7 +216,8 @@ objectClass: person
|
|||||||
loginShell: /bin/bash
|
loginShell: /bin/bash
|
||||||
"
|
"
|
||||||
|
|
||||||
step_103_info() { echo "(re)Set passwort for <USER>"; }
|
step_103_info() { echo "(re)Set passwort for user"; }
|
||||||
|
step_103_options() { echo "<USER>"; }
|
||||||
step_103_alias() { echo "passwd"; }
|
step_103_alias() { echo "passwd"; }
|
||||||
step_103() {
|
step_103() {
|
||||||
shift
|
shift
|
||||||
@@ -230,7 +233,8 @@ step_103() {
|
|||||||
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 to existing group"; }
|
||||||
|
step_105_options() { echo "<USER ID> <GROUP NAME>"; }
|
||||||
step_105_alias() { echo "user2group"; }
|
step_105_alias() { echo "user2group"; }
|
||||||
step_105() {
|
step_105() {
|
||||||
shift
|
shift
|
||||||
@@ -265,7 +269,8 @@ delete: member
|
|||||||
member:
|
member:
|
||||||
"
|
"
|
||||||
|
|
||||||
step_107_info() { echo "Removing <USER ID> from existing group <GROUP NAME>"; }
|
step_107_info() { echo "Removing user from existing group"; }
|
||||||
|
step_107_options() { echo "<USER ID> <GROUP NAME>"; }
|
||||||
step_107_alias() { echo "rmusergroup"; }
|
step_107_alias() { echo "rmusergroup"; }
|
||||||
step_107() {
|
step_107() {
|
||||||
shift
|
shift
|
||||||
@@ -299,7 +304,8 @@ delete: member
|
|||||||
member: uid=\$userId,\$LDAP_OU_USERS,\$LDAP_DC
|
member: uid=\$userId,\$LDAP_OU_USERS,\$LDAP_DC
|
||||||
"
|
"
|
||||||
|
|
||||||
step_110_info() { echo "Remove group <GROUP NAME>"; }
|
step_110_info() { echo "Remove group"; }
|
||||||
|
step_110_options() { echo "<GROUP NAME>"; }
|
||||||
step_110_alias() { echo "rmgroup"; }
|
step_110_alias() { echo "rmgroup"; }
|
||||||
step_110() {
|
step_110() {
|
||||||
shift
|
shift
|
||||||
@@ -314,7 +320,8 @@ rmGroup="dn: cn=\${groupName},\${LDAP_OU_GROUPS},\${LDAP_DC}
|
|||||||
changetype: delete
|
changetype: delete
|
||||||
"
|
"
|
||||||
|
|
||||||
step_112_info() { echo "Remove user <USER ID>"; }
|
step_112_info() { echo "Remove user"; }
|
||||||
|
step_112_options() { echo "<USER ID>"; }
|
||||||
step_112_alias() { echo "rmuser"; }
|
step_112_alias() { echo "rmuser"; }
|
||||||
step_112() {
|
step_112() {
|
||||||
shift
|
shift
|
||||||
@@ -329,7 +336,8 @@ rmUser="dn: uid=\${userName},\${LDAP_OU_USERS},\${LDAP_DC}
|
|||||||
changetype: delete
|
changetype: delete
|
||||||
"
|
"
|
||||||
|
|
||||||
step_200_info() { echo "List available groups <ADDITONAL ATTRIBUTES...>"; }
|
step_200_info() { echo "List available groups"; }
|
||||||
|
step_200_options() { echo "<ADDITONAL ATTRIBUTES...>"; }
|
||||||
step_200_alias() { echo "listgroups"; }
|
step_200_alias() { echo "listgroups"; }
|
||||||
step_200() {
|
step_200() {
|
||||||
shift
|
shift
|
||||||
@@ -337,7 +345,8 @@ step_200() {
|
|||||||
exe ldapsearch -x -LLL -H ldap:/// -b ${LDAP_OU_GROUPS},${LDAP_DC} dn gidNumber $*
|
exe ldapsearch -x -LLL -H ldap:/// -b ${LDAP_OU_GROUPS},${LDAP_DC} dn gidNumber $*
|
||||||
}
|
}
|
||||||
|
|
||||||
step_202_info() { echo "List available users <ADDITONAL ATTRIBUTES...>"; }
|
step_202_info() { echo "List available users"; }
|
||||||
|
step_200_options() { echo "<ADDITONAL ATTRIBUTES...>"; }
|
||||||
step_202_alias() { echo "listusers"; }
|
step_202_alias() { echo "listusers"; }
|
||||||
step_202() {
|
step_202() {
|
||||||
shift
|
shift
|
||||||
@@ -364,5 +373,7 @@ variable2LdifEcho() {
|
|||||||
echo "$tempLdif"
|
echo "$tempLdif"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# shellcheck disable=SC2034 # Appears unused
|
||||||
readonly sqr_minVersion=16
|
readonly sqr_minVersion=16
|
||||||
|
# shellcheck disable=SC1091 # Don't follow this source
|
||||||
. /usr/local/bin/sequencer.sh
|
. /usr/local/bin/sequencer.sh
|
||||||
|
@@ -525,15 +525,15 @@ MIGRATE_END
|
|||||||
readDatabaseInfos() {
|
readDatabaseInfos() {
|
||||||
if [ "$postgresDb" == "" ] ; then
|
if [ "$postgresDb" == "" ] ; then
|
||||||
read -p "Enter postgres database name: " postgresDb
|
read -p "Enter postgres database name: " postgresDb
|
||||||
endCheckEmpty postgresDb "database"
|
endIfEmpty postgresDb "database"
|
||||||
fi
|
fi
|
||||||
if [ "$postgresUser" == "" ] ; then
|
if [ "$postgresUser" == "" ] ; then
|
||||||
read -p "Enter postgres user name: " postgresUser
|
read -p "Enter postgres user name: " postgresUser
|
||||||
endCheckEmpty postgresUser "user name"
|
endIfEmpty postgresUser "user name"
|
||||||
fi
|
fi
|
||||||
if [ "$postgresPass" == "" ] ; then
|
if [ "$postgresPass" == "" ] ; then
|
||||||
read -s -p "Enter postgres password: " postgresPass
|
read -s -p "Enter postgres password: " postgresPass
|
||||||
endCheckEmpty postgresPass "password"
|
endIfEmpty postgresPass "password"
|
||||||
fi
|
fi
|
||||||
echo
|
echo
|
||||||
}
|
}
|
||||||
|
@@ -209,15 +209,15 @@ step_22() {
|
|||||||
readDatabaseInfos() {
|
readDatabaseInfos() {
|
||||||
if [ -z "$postgresDb" ] ; then
|
if [ -z "$postgresDb" ] ; then
|
||||||
read -p "Enter postgres database name: " postgresDb
|
read -p "Enter postgres database name: " postgresDb
|
||||||
endCheckEmpty postgresDb "database"
|
endIfEmpty postgresDb "database"
|
||||||
fi
|
fi
|
||||||
if [ -z "$postgresUser" ] ; then
|
if [ -z "$postgresUser" ] ; then
|
||||||
read -p "Enter postgres user name: " postgresUser
|
read -p "Enter postgres user name: " postgresUser
|
||||||
endCheckEmpty postgresUser "user name"
|
endIfEmpty postgresUser "user name"
|
||||||
fi
|
fi
|
||||||
if [ -z "$postgresPass" ] ; then
|
if [ -z "$postgresPass" ] ; then
|
||||||
read -s -p "Enter postgres password: " postgresPass
|
read -s -p "Enter postgres password: " postgresPass
|
||||||
endCheckEmpty postgresPass "password"
|
endIfEmpty postgresPass "password"
|
||||||
fi
|
fi
|
||||||
info
|
info
|
||||||
}
|
}
|
||||||
|
@@ -3,20 +3,12 @@
|
|||||||
# Dependency to other seqs
|
# Dependency to other seqs
|
||||||
# - mysql.sh (soft; Missing informational output)
|
# - mysql.sh (soft; Missing informational output)
|
||||||
|
|
||||||
toolName="nextcloud"
|
readonly toolName="nextcloud"
|
||||||
localOcc=("echo" "occ not found!")
|
localOcc=("echo" "occ not found!")
|
||||||
|
|
||||||
# Get script working directory
|
|
||||||
# (when called from a different directory)
|
|
||||||
sq_dir="$( cd "$( dirname -- "$(realpath "${BASH_SOURCE[0]}")")" >>/dev/null 2>&1 && pwd )"
|
|
||||||
sq_config=0
|
sq_config=0
|
||||||
sq_configFileName="${toolName}.cfg"
|
|
||||||
sq_configFileTemplate="$sq_dir/${sq_configFileName}.example"
|
|
||||||
|
|
||||||
seq_config() {
|
seq_config() {
|
||||||
## or to use sequencer api:
|
if initSeqConfig "${seq_configName:?}" "${seq_configTemplate:?}" ; then
|
||||||
initSeqConfig "$sq_configFileName" "$sq_configFileTemplate"
|
|
||||||
if [ $? -eq 0 ] ; then
|
|
||||||
sq_config=1
|
sq_config=1
|
||||||
fi
|
fi
|
||||||
localOcc=( sudo -u $sc_ncServerUser php "$(escpath "$sc_ncInstallDir/occ")" )
|
localOcc=( sudo -u $sc_ncServerUser php "$(escpath "$sc_ncInstallDir/occ")" )
|
||||||
@@ -34,7 +26,7 @@ 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() { echo "upgrade"; }
|
step_20_alias() { echo "upgrade"; }
|
||||||
step_20() {
|
step_20() {
|
||||||
if [ $sq_config -eq 0 ] ; then
|
if (( ! sq_config )) ; then
|
||||||
error -e "No configuration found to determine installation directory"
|
error -e "No configuration found to determine installation directory"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
@@ -64,9 +56,9 @@ step_102() {
|
|||||||
|
|
||||||
if [ -z $1 ] ; then
|
if [ -z $1 ] ; then
|
||||||
error -e "No database provided"
|
error -e "No database provided"
|
||||||
if [ -f "${sq_dir}/mysql.sh" ] ; then
|
if [ -f "${seq_origin}/mysql.sh" ] ; then
|
||||||
echo " [I] Available mysql databases:"
|
echo " [I] Available mysql databases:"
|
||||||
"${sq_dir}/mysql.sh" -qq listdb
|
"${seq_origin}/mysql.sh" -qq listdb
|
||||||
fi
|
fi
|
||||||
return 1
|
return 1
|
||||||
else
|
else
|
||||||
@@ -147,5 +139,7 @@ occ config:app:set preview jpeg_quality --value="60"
|
|||||||
NOTES_END
|
NOTES_END
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# shellcheck disable=SC2034 # Appears unused
|
||||||
readonly sqr_minVersion=16
|
readonly sqr_minVersion=16
|
||||||
|
# shellcheck disable=SC1091 # Don't follow this source
|
||||||
. /usr/local/bin/sequencer.sh
|
. /usr/local/bin/sequencer.sh
|
||||||
|
@@ -160,15 +160,15 @@ step_24() {
|
|||||||
readDatabaseInfos() {
|
readDatabaseInfos() {
|
||||||
if [ "$postgresDb" == "" ] ; then
|
if [ "$postgresDb" == "" ] ; then
|
||||||
read -p "Enter postgres database name: " postgresDb
|
read -p "Enter postgres database name: " postgresDb
|
||||||
endCheckEmpty postgresDb "database"
|
endIfEmpty postgresDb "database"
|
||||||
fi
|
fi
|
||||||
if [ "$postgresUser" == "" ] ; then
|
if [ "$postgresUser" == "" ] ; then
|
||||||
read -p "Enter postgres user name: " postgresUser
|
read -p "Enter postgres user name: " postgresUser
|
||||||
endCheckEmpty postgresUser "user name"
|
endIfEmpty postgresUser "user name"
|
||||||
fi
|
fi
|
||||||
if [ "$postgresPass" == "" ] ; then
|
if [ "$postgresPass" == "" ] ; then
|
||||||
read -s -p "Enter postgres password: " postgresPass
|
read -s -p "Enter postgres password: " postgresPass
|
||||||
endCheckEmpty postgresPass "password"
|
endIfEmpty postgresPass "password"
|
||||||
fi
|
fi
|
||||||
echo
|
echo
|
||||||
}
|
}
|
||||||
|
@@ -1,31 +1,22 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
toolName="pyload"
|
readonly toolName="pyload"
|
||||||
toolBranch="stable"
|
readonly toolBranch="stable"
|
||||||
toolDownload="https://github.com/pyload/pyload.git"
|
readonly toolDownload="https://github.com/pyload/pyload.git"
|
||||||
toolDeps="git liblept5 python python-crypto python-pycurl python-imaging python-sleekxmpp tesseract-ocr zip unzip python-openssl libmozjs-24-bin"
|
readonly toolDeps="git liblept5 python python-crypto python-pycurl python-imaging python-sleekxmpp tesseract-ocr zip unzip python-openssl libmozjs-24-bin"
|
||||||
# python-cryptography shall be implemented in future releases and replace pyhton-crypto
|
# python-cryptography shall be implemented in future releases and replace pyhton-crypto
|
||||||
toolDepsDebian="sudo git python-crypto python-pycurl python-pil python-sleekxmpp tesseract-ocr zip unzip pyhton-openssl libmozjs-60-dev"
|
readonly toolDepsDebian="sudo git python-crypto python-pycurl python-pil python-sleekxmpp tesseract-ocr zip unzip pyhton-openssl libmozjs-60-dev"
|
||||||
toolBuildDeps="rar unrar-nonfree"
|
readonly toolBuildDeps="rar unrar-nonfree"
|
||||||
|
|
||||||
# Get script working directory
|
sq_aptOpt=
|
||||||
# (when called from a different directory)
|
|
||||||
WDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >>/dev/null 2>&1 && pwd)"
|
|
||||||
APTOPT=
|
|
||||||
CONFIG=0
|
|
||||||
SCRIPT_NAME=$(basename -- $0)
|
|
||||||
SCRIPT_NAME=${SCRIPT_NAME%%.*}
|
|
||||||
CONFIG_FILE_NAME="${SCRIPT_NAME}.cfg"
|
|
||||||
CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
|
|
||||||
|
|
||||||
seq_config() {
|
seq_config() {
|
||||||
initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE"
|
if ! initSeqConfig "${seq_configName:?}" "${seq_configTemplate:?}" ; then
|
||||||
if [ $? -eq 0 ] ; then
|
|
||||||
CONFIG=1
|
|
||||||
else
|
|
||||||
# End if no configuration file exists
|
# End if no configuration file exists
|
||||||
dry || return 1
|
dry || return 1
|
||||||
fi
|
fi
|
||||||
quiet && APTOPT="-y"
|
|
||||||
|
interactive || sq_aptOpt="-y"
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,7 +32,7 @@ step_1() {
|
|||||||
|
|
||||||
step_2_info() { echo "Install unrar-nonfree from source"; }
|
step_2_info() { echo "Install unrar-nonfree from source"; }
|
||||||
step_2() {
|
step_2() {
|
||||||
exe apt-get build-dep ${toolBuildDeps} $APTOPT
|
exe apt-get build-dep ${toolBuildDeps} ${sq_aptOpt}
|
||||||
exe cd /tmp
|
exe cd /tmp
|
||||||
exe apt-get source -b unrar-nonfree
|
exe apt-get source -b unrar-nonfree
|
||||||
saveReturn $?
|
saveReturn $?
|
||||||
@@ -69,7 +60,7 @@ step_3() {
|
|||||||
error -e "Unrecognized target"
|
error -e "Unrecognized target"
|
||||||
return 1;;
|
return 1;;
|
||||||
esac
|
esac
|
||||||
exe apt-get install ${lDeps} $APTOPT
|
exe apt-get install ${lDeps} ${sq_aptOpt}
|
||||||
saveReturn $?
|
saveReturn $?
|
||||||
endReturn
|
endReturn
|
||||||
case "${1:-}" in
|
case "${1:-}" in
|
||||||
@@ -134,5 +125,7 @@ step_10() {
|
|||||||
echo " Do so manually with: service $toolName start"
|
echo " Do so manually with: service $toolName start"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# shellcheck disable=SC2034 # Appears unused
|
||||||
readonly sqr_minVersion=16
|
readonly sqr_minVersion=16
|
||||||
|
# shellcheck disable=SC1091 # Don't follow this source
|
||||||
. /usr/local/bin/sequencer.sh
|
. /usr/local/bin/sequencer.sh
|
||||||
|
@@ -124,7 +124,7 @@ step_52_options() { echo "<TORRENT ID>"; }
|
|||||||
step_52_alias() { echo "info"; }
|
step_52_alias() { echo "info"; }
|
||||||
step_52() {
|
step_52() {
|
||||||
shift
|
shift
|
||||||
endCheckEmpty 1 "Id must not be empty"
|
endIfEmpty 1 "Id must not be empty"
|
||||||
|
|
||||||
step netrcauth
|
step netrcauth
|
||||||
color green
|
color green
|
||||||
|
@@ -73,7 +73,7 @@ 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"
|
endIfEmpty destIp "No IP provided"
|
||||||
if [[ ! ${1:-} =~ $ipregex ]]; then
|
if [[ ! ${1:-} =~ $ipregex ]]; then
|
||||||
error "No valid IP provided"
|
error "No valid IP provided"
|
||||||
return 1
|
return 1
|
||||||
|
@@ -74,6 +74,7 @@ makechanges() {
|
|||||||
|
|
||||||
exe sed ${inplace} 's/"*${*DEFAULT_EDITOR_SYSTEM}*"*/editor/'${sedprint} "${file}"
|
exe sed ${inplace} 's/"*${*DEFAULT_EDITOR_SYSTEM}*"*/editor/'${sedprint} "${file}"
|
||||||
|
|
||||||
|
exe sed ${inplace} 's/endCheckEmpty/endIfEmpty/'${sedprint} "${file}"
|
||||||
exe sed ${inplace} 's/^[[:space:]]*step_config/seq_config/'${sedprint} "${file}"
|
exe sed ${inplace} 's/^[[:space:]]*step_config/seq_config/'${sedprint} "${file}"
|
||||||
exe sed ${inplace} 's/^\(step_.*_alias\)()[[:space:]]*{[[:space:]]*ALIAS=/\1() { echo /'${sedprint} "${file}"
|
exe sed ${inplace} 's/^\(step_.*_alias\)()[[:space:]]*{[[:space:]]*ALIAS=/\1() { echo /'${sedprint} "${file}"
|
||||||
exe sed ${inplace} 's/SEQUENCER_ARGS/sqr_args/'${sedprint} "${file}"
|
exe sed ${inplace} 's/SEQUENCER_ARGS/sqr_args/'${sedprint} "${file}"
|
||||||
|
Reference in New Issue
Block a user