1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/gogs_ynh.git synced 2024-09-03 20:36:23 +02:00

Fix upgrade from previous version

This commit is contained in:
Josué Tille 2018-02-08 15:06:12 +01:00
parent f62931350d
commit 45281436e3
5 changed files with 20 additions and 18 deletions

View file

@ -82,9 +82,6 @@ sudo yunohost app upgrade -f /home/admin/gogs_ynh gogs
## Todo
- Big comment
- Restore cassé
- Test multi instance
- check migration
- change-url

View file

@ -12,8 +12,9 @@
setup_private=1
setup_public=1
upgrade=1
upgrade=1 from_commit=a790f67c69906743eda5c3a7b74ee51d4bb8f6bd
upgrade=1 from_commit=1f3515ca87f79081093d86b65ab4eaefa72e38e4
upgrade=1 from_commit=aa075b2051ffad7b0b6fef3a9c767376d5bdbfab
upgrade=1 from_commit=1cbec051e1171de5a8ed1e850eb4fb3506114da5
upgrade=1 from_commit=5a706ed246392c1ce39c47a648cb93e2996e80d3
backup_restore=1
multi_instance=1
incorrect_path=0
@ -32,7 +33,9 @@
Level 9=0
Level 10=0
;;; Upgrade options
; commit=a790f67c69906743eda5c3a7b74ee51d4bb8f6bd
; commit=aa075b2051ffad7b0b6fef3a9c767376d5bdbfab
name=Before multi_instance and refactoring
; commit=1f3515ca87f79081093d86b65ab4eaefa72e38e4
; commit=1cbec051e1171de5a8ed1e850eb4fb3506114da5
name=From V0.10.18
; commit=5a706ed246392c1ce39c47a648cb93e2996e80d3
name=The oldest package

View file

@ -43,7 +43,7 @@ config_nginx() {
config_gogs() {
ynh_backup_if_checksum_is_different "$final_path/custom/conf/app.ini"
cp ../conf/app.ini "$final_path"/custom/conf
cp ../conf/app.ini "$final_path/custom/conf"
if [ "$path_url" = "/" ]
then

View file

@ -51,4 +51,5 @@ yunohost service add "$app" --log /var/log/"$app"/"$app".log
# Reload services
systemctl reload nginx.service
systemctl start "$app".service
ynh_check_starting "INFO] Listen: http://0.0.0.0:" "/var/log/$app/gogs.log"
sleep 1

View file

@ -43,22 +43,25 @@ then
ynh_app_setting_set $app web_port $port
fi
# create needed directories if not already created
create_dir
# handle upgrade from old package installation
# this test that /etc/gogs exist since this was used in the old package
# but not in the new
# this code will be removed in the future
if [ -d "/etc/gogs" ]
then
# create needed directories if not already created
create_dir
# move repositories to new dir
old_repo_path=$(ynh_app_setting_get "$app" repopath)
mv "${old_repo_path:-/home/yunohost.app/gogs}"/* "$REPO_PATH"
mv "${old_repo_path:-/home/yunohost.app/gogs}"/* "$REPO_PATH" || true # Avoid if the directory is empty
# cleanup old dir and conf
unlink /opt/gogs
ynh_secure_remove /opt/gogs
ynh_secure_remove /etc/gogs
ynh_secure_remove /opt/gogs_src
# create needed directories if not already created
create_dir
fi
# end of old package upgrade
@ -94,7 +97,5 @@ then
fi
# Reload services
systemctl restart "$app".service
sleep 10
ynh_check_starting "INFO] Listen: http://0.0.0.0:" "/var/log/$app/gogs.log"
sleep 1