refactoring changes from sequpgrade (endReturn, ...) and some modernizations

This commit is contained in:
2023-01-03 15:49:08 +01:00
parent 215135e8aa
commit 3c22d5729f
69 changed files with 553 additions and 654 deletions

View File

@@ -39,14 +39,14 @@ seq_config() {
fi
}
step_1_info() {
step_1_info() {
echo "Downloading $toolName version ${toolVersion} to ${toolLoc} from:"
echoinfo "$toolDownload"
}
step_1_alias() { echo "install"; }
step_1() {
step upgrade
endReturn -o $? "Download failed"
endReturn "Download failed"
}
step_2_info() { echo "Create required directory structure"; }
@@ -65,13 +65,13 @@ step_3() {
step_4_info() { echo "Creating systemd service"; }
step_4() {
addConf -s "$toolService" "$toolServiceLoc"
endReturn -o $? "Creating service failed"
endReturn "Creating service failed"
}
step_5_info() { echo "Enable $toolName service"; }
step_5() {
exe systemctl enable ${toolName}
echo " [I] Before proceeding to run ${toolName} you need to modify ${toolConfigLoc} first"
info "Before proceeding to run ${toolName} you need to modify ${toolConfigLoc} first"
echo
}
@@ -105,10 +105,10 @@ step_10() {
}
versionNow=$([ -n "$(command -v ${toolName})" ] && ${toolName} --version | sed 's/.*version: \([0-9.]\+\).*/\1/')
step_12_info() {
if [ -n "${versionNow}" ] ; then
step_12_info() {
if [ -n "${versionNow}" ] ; then
if [ "$toolVersion" == "$versionNow" ] ; then
echo "No upgrade available. Already on latest: $versionNow"
echo "No upgrade available. Already on latest: $versionNow"
else
echo "Download new version $toolVersion to $toolDir"
echoinfo " - installed version: $versionNow -"
@@ -122,7 +122,7 @@ step_12_alias() { echo "upgrade"; }
step_12() {
step backup
exe wget -O "$toolLoc" "${toolDownload}"
endReturn -o $? "Download failed"
endReturn "Download failed"
exe chmod +x "$toolLoc"
exe service ${toolName} restart >>/dev/null 2>&1
return 0
@@ -151,14 +151,14 @@ step_30() {
esac
[[ "${goArch}" == "armhf" ]] && goArch="armv6l"
local goDownUrl="https://go.dev/dl/${goVer}.linux-${goArch}.tar.gz"
# Download latest go
if [ ! -e "${goDir}" ] ; then
info "Download go${goVer}: ${goDownUrl}"
exe wget -O "${goDownLoc}" "${goDownUrl}"
endReturn -o $? "Download ${goVer} failed"
endReturn "Download ${goVer} failed"
exe tar -C "$(dirname -- "${goDir}")" -xzf "${goDownLoc}"
endReturn -o $? "Extraction ${goVer} failed"
endReturn "Extraction ${goVer} failed"
fi
}