mirror of
https://github.com/YunoHost-Apps/syncthing_ynh.git
synced 2024-09-03 20:26:23 +02:00
Fix upgrade from previous version
This commit is contained in:
parent
1f063e245c
commit
4d1e103cc9
1 changed files with 41 additions and 0 deletions
|
@ -25,6 +25,39 @@ sync_home=$(ynh_app_setting_get $app sync_home)
|
||||||
sync_port=$(ynh_app_setting_get $app sync_port)
|
sync_port=$(ynh_app_setting_get $app sync_port)
|
||||||
gui_port=$(ynh_app_setting_get $app gui_port)
|
gui_port=$(ynh_app_setting_get $app gui_port)
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Ensuring downward compatibility..."
|
||||||
|
|
||||||
|
# If gui_port doesn't exist, create it
|
||||||
|
if [ -z $gui_port ]; then
|
||||||
|
|
||||||
|
OLD_SYNCHOME="/home/yunohost.app/syncthing"
|
||||||
|
OLD_SYNCUSER=debian-syncthing
|
||||||
|
OLD_SYNCPORT=22000
|
||||||
|
OLD_GUIPORT=8384
|
||||||
|
OLD_CONFIG="$OLD_SYNCHOME/.config/syncthing/config.xml"
|
||||||
|
|
||||||
|
admin=$(ynh_app_setting_get $app allowed_users)
|
||||||
|
ynh_app_setting_set $app admin $admin
|
||||||
|
ynh_app_setting_delete --app="$app" --key="allowed_users"
|
||||||
|
|
||||||
|
final_path=/var/www/$app
|
||||||
|
ynh_app_setting_set $app final_path $final_path
|
||||||
|
|
||||||
|
gui_port=$(grep -oP "<address>127.0.0.1:\K[^<]*" $OLD_CONFIG)
|
||||||
|
ynh_app_setting_set $app gui_port $gui_port
|
||||||
|
|
||||||
|
sync_home=$(grep -oP "<defaultFolderPath>\K[^<]*" $OLD_CONFIG)
|
||||||
|
ynh_app_setting_set $app sync_home $gui_port
|
||||||
|
|
||||||
|
sync_port=$(grep -oP "<defaultFolderPath>\K[^<]*" $OLD_CONFIG)
|
||||||
|
ynh_app_setting_set $app sync_port $gui_port
|
||||||
|
|
||||||
|
mkdir -p $final_path
|
||||||
|
cp -R $OLD_SYNCHOME/.config $final_path/.config
|
||||||
|
fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -65,6 +98,14 @@ ynh_print_info "Upgrading nginx web server configuration..."
|
||||||
# Create a dedicated nginx config
|
# Create a dedicated nginx config
|
||||||
ynh_add_nginx_config "gui_port"
|
ynh_add_nginx_config "gui_port"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# REMOVE DEPENDENCIES
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Removing dependencies"
|
||||||
|
|
||||||
|
# Remove metapackage and its dependencies
|
||||||
|
ynh_remove_app_dependencies
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Add table
Reference in a new issue