From 14918e02092eda92c27613cf61efbcd592703e30 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 24 Jan 2022 23:05:47 +0100 Subject: [PATCH] Fix --- conf/app.src | 4 ++-- scripts/install | 18 +++++------------- scripts/restore | 3 +-- scripts/upgrade | 43 +++++++++++++++++++++++-------------------- 4 files changed, 31 insertions(+), 37 deletions(-) diff --git a/conf/app.src b/conf/app.src index b3e167c..d210988 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/Awesome-Technologies/synapse-admin/archive/refs/tags/0.8.3.tar.gz -SOURCE_SUM=10b8cebe45f3e5edc1817f67e57d9d59535a7aa17eb383b6d31eb2217dd5a898 +SOURCE_URL=https://github.com/Awesome-Technologies/synapse-admin/archive/refs/tags/0.8.4.tar.gz +SOURCE_SUM=5c49b539587bb58ccddf0aa102215dfb963b848cab9e8078f1ad5d626ffda98f SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true \ No newline at end of file diff --git a/scripts/install b/scripts/install index dd87b79..e8204ce 100644 --- a/scripts/install +++ b/scripts/install @@ -82,13 +82,13 @@ ynh_script_progression --message="Setting up source files..." --weight=2 ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src -#ynh_setup_source --dest_dir=$final_path +ynh_setup_source --dest_dir=$final_path -git clone --quiet https://github.com/Awesome-Technologies/synapse-admin.git -b master "$final_path" +#git clone --quiet https://github.com/Awesome-Technologies/synapse-admin.git -b master "$final_path" # Reset branch to the level of update we needed -pushd "$final_path" - git reset --hard --quiet $version_commit -popd +#pushd "$final_path" +# git reset --hard --quiet $version_commit +#popd chmod 750 "$final_path" chmod -R o-rwx "$final_path" @@ -150,14 +150,6 @@ ynh_script_progression --message="Securing files and directories..." # Set permissions to app files chown -R $app: $final_path -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Configuring log rotation..." --weight=1 - -# Use logrotate to manage application logfile(s) -ynh_use_logrotate - #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= diff --git a/scripts/restore b/scripts/restore index 7ca0d3b..e3da35e 100644 --- a/scripts/restore +++ b/scripts/restore @@ -32,8 +32,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= ynh_script_progression --message="Validating restoration parameters..." --weight=2 -test ! -d $final_path \ - || ynh_die --message="There is already a directory: $final_path " +test ! -d $final_path || ynh_die --message="There is already a directory: $final_path " #================================================= # STANDARD RESTORATION STEPS diff --git a/scripts/upgrade b/scripts/upgrade index 30efdf9..ee255c2 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -24,22 +24,9 @@ port=$(ynh_app_setting_get --app=$app --key=port) #================================================= # CHECK VERSION #================================================= -ynh_script_progression --message="Checking version..." upgrade_type=$(ynh_check_app_version_changed) -#================================================= -# ENSURE DOWNWARD COMPATIBILITY -#================================================= -ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 - -# Cleaning legacy permissions -if ynh_legacy_permissions_exists; then - ynh_legacy_permissions_delete_all - - ynh_app_setting_delete --app=$app --key=is_public -fi - #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -54,6 +41,18 @@ ynh_clean_setup () { # Exit if an error occurs during the execution of the script ynh_abort_if_errors +#================================================= +# ENSURE DOWNWARD COMPATIBILITY +#================================================= +ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 + +# Cleaning legacy permissions +if ynh_legacy_permissions_exists; then + ynh_legacy_permissions_delete_all + + ynh_app_setting_delete --app=$app --key=is_public +fi + #================================================= # STANDARD UPGRADE STEPS #================================================= @@ -79,12 +78,14 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading source files..." --weight=160 - pushd "$final_path" - git fetch --quiet - git checkout master --quiet - git pull --quiet - git reset --hard $version_commit --quiet - popd + ynh_setup_source --dest_dir="$final_path" --keep="$final_path/.env" + + #pushd "$final_path" + # git fetch --quiet + # git checkout master --quiet + # git pull --quiet + # git reset --hard $version_commit --quiet + #popd fi chmod 750 "$final_path" @@ -126,6 +127,8 @@ then popd fi +chown -R $app: $final_path + #================================================= # SETUP SYSTEMD #================================================= @@ -148,7 +151,7 @@ yunohost service add $app --description "UI admin for Synapse" --log="/var/log/$ #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="HTTP Server listening" +ynh_systemd_action --service_name=$app --action=start --log_path=systemd #--line_match="HTTP Server listening" #================================================= # RELOAD NGINX