added systemd upgrade script which stops service, call upgrade script and restarts after binary upgrade
parent
b4f1093b03
commit
9755e5d08e
|
@ -159,8 +159,6 @@ function download_bin () {
|
||||||
declare OPTION
|
declare OPTION
|
||||||
declare OPTIND=0
|
declare OPTIND=0
|
||||||
|
|
||||||
echo passed stuff: $@
|
|
||||||
|
|
||||||
while getopts 'fg:itud:' OPTION; do
|
while getopts 'fg:itud:' OPTION; do
|
||||||
case "$OPTION" in
|
case "$OPTION" in
|
||||||
g) TokenFile=$OPTARG ;;
|
g) TokenFile=$OPTARG ;;
|
||||||
|
@ -212,18 +210,20 @@ function download_bin () {
|
||||||
if [[ $GITHUB_TOKEN ]]; then
|
if [[ $GITHUB_TOKEN ]]; then
|
||||||
echo "using access github token with script >>> $GITHUB_USER:$GITHUB_TOKEN"
|
echo "using access github token with script >>> $GITHUB_USER:$GITHUB_TOKEN"
|
||||||
fi
|
fi
|
||||||
|
# URL=""
|
||||||
if [ $URL ]; then
|
if [ $URL ]; then
|
||||||
echo "Downloading Gitea Binary at $URL"
|
echo "Downloading Gitea Binary at $URL"
|
||||||
wget --user=-u $GITHUB_USER --password=$GITHUB_TOKEN -q --show-progress -O $GITEA_BIN $URL
|
# wget --user=-u $GITHUB_USER --password=$GITHUB_TOKEN -q --show-progress -O $GITEA_BIN $URL
|
||||||
if ( [[ $? -eq 0 ]] && [[ "$NEW_VER" == *"$(version)"* ]] ); then
|
if ( [[ $? -eq 0 ]] && [[ "$NEW_VER" == *"$(version)"* ]] ); then
|
||||||
chmod +x $GITEA_BIN
|
chmod +x $GITEA_BIN
|
||||||
echo upgrade succeeded, $GITEA_BIN version is $(version)
|
echo upgrade succeeded, $GITEA_BIN version is $(version)
|
||||||
else
|
else
|
||||||
echo upgrade from $URL failed
|
echo upgrade from $URL failed
|
||||||
|
return 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo unabled to determine download url
|
echo unabled to determine download url
|
||||||
|
return 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,23 @@
|
||||||
ServiceName=gitea
|
#!/bin/bash
|
||||||
|
declare OPTARG
|
||||||
|
declare OPTION
|
||||||
|
declare OPTIND=0
|
||||||
|
|
||||||
|
Saved=("$*")
|
||||||
|
|
||||||
|
while getopts 'fg:itud:' OPTION; do
|
||||||
|
case "$OPTION" in
|
||||||
|
*) ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
shift $(( $OPTIND - 1 ))
|
||||||
|
|
||||||
Instance=$1
|
Instance=$1
|
||||||
[[ ! $1 ]] && echo warning no instance supplied using default && Instance=default
|
[[ ! $1 ]] && echo warning no instance supplied using default && Instance=default
|
||||||
Service=$ServiceName@$Instance
|
DIR="$(dirname "$BASH_SOURCE")"
|
||||||
|
$DIR/stop $Instance
|
||||||
|
|
||||||
|
echo saved opts $Saved
|
||||||
|
$(dirname "$DIR")/upgrade $Saved
|
||||||
|
[[ $? -eq 0 ]] && $DIR/start $Instance || echo Upgrade failed not restarting gitea@$Instance service
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
[[ ! $GITEA_DIR ]] && export GITEA_DIR="$(dirname "$(cd "$(readlink -f "$BASH_SOURCE")"; pwd -P)")"
|
[[ ! $GITEA_DIR ]] && export GITEA_DIR="$(dirname "$(cd "$(dirname "$BASH_SOURCE")"; pwd -P)")"
|
||||||
source $GITEA_DIR/scripts/library
|
source $GITEA_DIR/scripts/library
|
||||||
|
|
||||||
download_bin "$@"
|
download_bin "$@"
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
DEBOUNCE=1.0
|
DEBOUNCE=1.0
|
||||||
DIR="$(dirname "$(cd "$(dirname "$(readlink -f "$0")")";pwd -P)")" || exit
|
[[ ! $GITEA_DIR ]] && export GITEA_DIR="$(dirname "$(cd "$(readlink -f "$BASH_SOURCE")"; pwd -P)")"
|
||||||
# export WATCH_DIR="$DIR/frontend/"
|
# export WATCH_DIR="$DIR/frontend/"
|
||||||
# export WATCH_VERBOSE=1
|
# export WATCH_VERBOSE=1
|
||||||
COMMAND=$DIR/scripts/restart "$@"
|
COMMAND=$GITEA_DIR/scripts/restart "$@"
|
||||||
# LOGFILE="$DIR/watch.log"
|
# LOGFILE="$DIR/watch.log"
|
||||||
echo "watching $DIR/frontend/ $DIR/config/$1.ini with $COMMAND"
|
echo "watching $DIR/frontend/ $DIR/config/$1.ini with $COMMAND"
|
||||||
inotifywait -mqr -e MODIFY $DIR/frontend/ $DIR/config/$1.ini |
|
inotifywait -mqr -e MODIFY $DIR/frontend/ $DIR/config/$1.ini |
|
||||||
|
|
Loading…
Reference in New Issue