1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/snweb_ynh.git synced 2024-09-03 20:26:22 +02:00

Fix: install, upgrade script

This commit is contained in:
Fabian Wilkens 2022-10-06 07:38:13 +02:00
parent 76393b0f6d
commit 071f0043a4
No known key found for this signature in database
GPG key ID: 23DFA025BB4E9FAB
2 changed files with 21 additions and 3 deletions

View file

@ -123,7 +123,7 @@ fi
# Modify Config
index_file="$final_path/live/packages/web/dist/index.html"
ynh_replace_string --match_string="\(defaultSyncServer = \).*" --replace_string="\1\"$snserver_domain\"" --target_file="$index_file"
ynh_replace_string --match_string="\(defaultSyncServer = \).*" --replace_string="\1\"https://$snserver_domain\"" --target_file="$index_file"
ynh_replace_string --match_string="\(defaultFilesHost = \).*" --replace_string="\1\"\"" --target_file="$index_file"
ynh_replace_string --match_string="\(enabledUnfinishedFeatures = \).*" --replace_string="\1false" --target_file="$index_file"
ynh_replace_string --match_string="\(websocketUrl = \).*" --replace_string="\1\"\"" --target_file="$index_file"

View file

@ -68,6 +68,22 @@ if [ -z "$snserver_domain" ]; then
snserver_domain="api.standardnotes.com"
fi
if ynh_compare_current_package_version --comparison lt --version 3.66.0~ynh1
then
# Remove old service
ynh_script_progression --message="Removing $app service..." --weight=1
yunohost service remove "$app"
# Remove the dedicated systemd config
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1
ynh_remove_systemd_config --service="$app"
# Remove unneeded ruby
ynh_remove_ruby
ynh_secure_remove --file="$final_path/.bundle"
ynh_secure_remove --file="$final_path/.ruby-version"
fi
#=================================================
# CREATE DEDICATED USER
#=================================================
@ -84,6 +100,8 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..." --weight=17
ynh_secure_remove --file="$final_path/live"
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path/live"
fi
@ -106,7 +124,7 @@ ynh_add_nginx_config
#=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=37
ynh_install_app_dependencies $pkg_dependencies $build_pkg_dependencies
ynh_install_app_dependencies $pkg_dependencie
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
@ -143,7 +161,7 @@ fi
# Modify Config
index_file="$final_path/live/packages/web/dist/index.html"
ynh_replace_string --match_string="\(defaultSyncServer = \).*" --replace_string="\1\"$snserver_domain\"" --target_file="$index_file"
ynh_replace_string --match_string="\(defaultSyncServer = \).*" --replace_string="\1\"https://$snserver_domain\"" --target_file="$index_file"
ynh_replace_string --match_string="\(defaultFilesHost = \).*" --replace_string="\1\"\"" --target_file="$index_file"
ynh_replace_string --match_string="\(enabledUnfinishedFeatures = \).*" --replace_string="\1false" --target_file="$index_file"
ynh_replace_string --match_string="\(websocketUrl = \).*" --replace_string="\1\"\"" --target_file="$index_file"