Adding upgrade step

This commit is contained in:
2019-06-19 16:12:27 +02:00
parent 4e8a3ddf9a
commit 57fba73e8a

View File

@@ -4,7 +4,9 @@
## Installation of self hosted git service Gitea ## Installation of self hosted git service Gitea
toolName="gitea" toolName="gitea"
giteaDownload="https://dl.gitea.io/gitea/1.8.1/gitea-1.8.1-linux-arm-6" giteaVersion="1.8.3"
giteaDownload="https://dl.gitea.io/gitea/${giteaVersion}/gitea-${giteaVersion}-linux-arm-6"
giteaLoc="/usr/local/bin/gitea"
giteaService="https://raw.githubusercontent.com/go-gitea/gitea/master/contrib/systemd/gitea.service" giteaService="https://raw.githubusercontent.com/go-gitea/gitea/master/contrib/systemd/gitea.service"
giteaServiceLoc="/etc/systemd/system/gitea.service" giteaServiceLoc="/etc/systemd/system/gitea.service"
@@ -15,8 +17,7 @@ step_1() {
step_2_info() { echo "Downloading $toolName to user home: $giteaDownload"; } step_2_info() { echo "Downloading $toolName to user home: $giteaDownload"; }
step_2() { step_2() {
exe cd ~ exe wget -O ~/gitea $giteaDownload
exe wget -O gitea $giteaDownload
saveReturn $? saveReturn $?
endReturn endReturn
} }
@@ -45,7 +46,7 @@ step_4() {
exe chmod 770 /etc/gitea exe chmod 770 /etc/gitea
echo "Copying gitea to global location and making it executable" echo "Copying gitea to global location and making it executable"
exe chmod +x ~/gitea exe chmod +x ~/gitea
exe cp ~/gitea /usr/local/bin/gitea exe cp ~/gitea "$giteaLoc"
saveReturn $? saveReturn $?
endReturn endReturn
} }
@@ -77,7 +78,7 @@ step_7() {
} }
CONFIG_NOTES="\ CONFIG_NOTES="\
[repository] [repository]
DEFAULT_CLOSE_ISSUES_VIA_COMMITS_IN_ANY_BRANCH = true DEFAULT_CLOSE_ISSUES_VIA_COMMITS_IN_ANY_BRANCH = true
[server] [server]
@@ -132,6 +133,17 @@ step_10() {
exe mysql -u root -e 'FLUSH PRIVILEGES;' exe mysql -u root -e 'FLUSH PRIVILEGES;'
} }
step_12_info() { echo "Download new version to /usr/local/bin"; }
step_12_alias() { ALIAS="upgrade"; }
step_12() {
if [ -f "$giteaLoc" ] ; then
echo "Backup existing executable first"
return 1;
fi
exe wget -O "$giteaLoc" $giteaDownload
exe chmod +x "$giteaLoc"
}
step_20_info() { echo "Secure settings after installation"; } step_20_info() { echo "Secure settings after installation"; }
step_20() { step_20() {
exe chmod 750 /etc/gitea exe chmod 750 /etc/gitea