refactoring changes from sequpgrade (endReturn, ...) and some modernizations
This commit is contained in:
@@ -29,7 +29,7 @@ seq_config() {
|
||||
fi
|
||||
[ ! -z "$(command -v gitea)" ] && versionNow=$(gitea --version | sed 's/.*version \([0-9.]\+\).*/\1/')
|
||||
|
||||
checkArchitecture
|
||||
checkArchitecture
|
||||
giteaIniLoc="${SEQ_GITEA_CONF_DIR}/app.ini"
|
||||
|
||||
info "Gitea work: $SEQ_GITEA_WORK_DIR"
|
||||
@@ -61,7 +61,7 @@ step_1() {
|
||||
}
|
||||
|
||||
step_2_info() {
|
||||
checkArchitecture
|
||||
checkArchitecture
|
||||
echo "Downloading $toolName to user home from:"
|
||||
echoinfo "$giteaDownload"
|
||||
}
|
||||
@@ -92,7 +92,7 @@ step_4() {
|
||||
exe install -g $SEQ_GITEA_USER -m 770 -d "$giteaLogDir"
|
||||
info -n "Copying gitea to global location and making it executable..."
|
||||
exe install -b -m 755 -T "$giteaDownFile" "$SEQ_GITEA_BIN_LOC" && info -d "ok"
|
||||
endReturn -o $? "Failed to install $SEQ_GITEA_BIN_LOC"
|
||||
endReturn "Failed to install $SEQ_GITEA_BIN_LOC"
|
||||
}
|
||||
|
||||
step_5_info() { echo "Creating systemd service"; }
|
||||
@@ -143,10 +143,10 @@ step_10() {
|
||||
exe "${seq_origin}/mysql.sh" -qq createdb --charset utf8mb4
|
||||
}
|
||||
|
||||
step_12_info() {
|
||||
if [ ! -z "$versionNow" ] ; then
|
||||
step_12_info() {
|
||||
if [ ! -z "$versionNow" ] ; then
|
||||
if [ "$giteaVersion" == "$versionNow" ] ; then
|
||||
echo "No upgrade available. Already on latest: $versionNow"
|
||||
echo "No upgrade available. Already on latest: $versionNow"
|
||||
else
|
||||
echo "Download new version $giteaVersion to /usr/local/bin"
|
||||
echoinfo " - installed version: $versionNow -"
|
||||
@@ -159,7 +159,7 @@ step_12_alias() { echo "upgrade"; }
|
||||
step_12() {
|
||||
endIfEmpty versionNow "Please install $toolName first"
|
||||
exe wget -O "$giteaDownFile" $giteaDownload
|
||||
endReturn -o $? "Download failed"
|
||||
endReturn "Download failed"
|
||||
|
||||
if [ -f "$SEQ_GITEA_BIN_LOC" ] ; then
|
||||
local toolBackup="${SEQ_GITEA_BACKUP_DIR}/gitea_${versionNow}"
|
||||
@@ -167,10 +167,10 @@ step_12() {
|
||||
saveReturn $?
|
||||
endReturn
|
||||
sqr::echo -n "Backing up existing executable to ${toolBackup}..."
|
||||
exe cp -ar "$SEQ_GITEA_BIN_LOC" "$toolBackup" && sqr::echo "ok" || sqr::echo "nok"
|
||||
exe cp -ar "$SEQ_GITEA_BIN_LOC" "$toolBackup" && sqr::echo "ok" || sqr::echo "nok"
|
||||
fi
|
||||
exe install --backup=none -m 755 -T "$giteaDownFile" "$SEQ_GITEA_BIN_LOC"
|
||||
endReturn -o $? "Upgrade failed"
|
||||
endReturn "Upgrade failed"
|
||||
exe service gitea start
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user