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

handle upgrade from old package installation

This commit is contained in:
mbugeia 2016-10-11 22:11:21 +02:00
parent 1dc4613d8d
commit cfe643d9ac

View file

@ -24,11 +24,26 @@ is_public=$(ynh_app_setting_get "$app" is_public)
# Stop service
sudo systemctl stop gogs.service
# set directories variables
DESTDIR="/opt/$app"
# create needed directories
REPO_PATH=/home/gogs/repositories
DATA_PATH=/home/gogs/data
# 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
# move re
old_repo_path=$(ynh_app_setting_get "$app" repopath)
sudo mv "$old_repo_path"/* "$REPO_PATH"
sudo unlink /opt/gogs
sudo rm -rf /etc/gogs /opt/gogs_src
fi
# end of old package upgrade
# create needed directories and give correct acl
sudo mkdir -p "$DESTDIR"/custom/conf "$REPO_PATH" "$DATA_PATH"/avatars \
"$DATA_PATH"/avatars "$DATA_PATH"/attachments /var/log/gogs
sudo chown -R gogs:gogs /home/gogs /var/log/gogs