diff --git a/check_process b/check_process index 97a4fbd..f203cb1 100644 --- a/check_process +++ b/check_process @@ -21,7 +21,7 @@ setup_public=1 upgrade=1 # latest published in community.json - upgrade=1 from_commit=58c98267fa4c3ea5c1ff8fd4c63655a3230a2134 + upgrade=1 from_commit=74f93c22e57e0174f67b570875c9e10bbca0a6c8 backup_restore=1 multi_instance=1 incorrect_path=1 diff --git a/scripts/backup b/scripts/backup index 074e25f..04a961c 100755 --- a/scripts/backup +++ b/scripts/backup @@ -64,3 +64,9 @@ ynh_backup "/etc/cron.d/$app" ynh_backup "/etc/uwsgi/apps-available/$app.ini" ynh_backup "/etc/systemd/system/uwsgi-app@.socket" ynh_backup "/etc/systemd/system/uwsgi-app@.service" + +#================================================= +# BACKUP THE hub binary file +#================================================= + +ynh_backup /usr/bin/hub diff --git a/scripts/install b/scripts/install index f8e19f6..9780f50 100755 --- a/scripts/install +++ b/scripts/install @@ -156,8 +156,7 @@ esac [[ $(sha256sum "$file_bin" | cut -d' ' -f1) = "$sha256sum" ]] || ynh_die "Hub's sha256sum failed (arch: ${arch})" tar --extract --file "$file_bin" "$version/bin/hub" -mkdir "$final_path/bin/" -mv "$version/bin/hub" "$final_path/bin/" +mv "$version/bin/hub" /usr/bin/ mkdir "$final_path/.config/" cp ../conf/hub_config "$final_path/.config/hub" @@ -166,7 +165,6 @@ ynh_replace_string "__GITHUBTOKEN__" "$github_token" "$final_path/.config/hub" cat < "$final_path/.bashrc" alias git=hub -PATH="\$PATH:$final_path/bin" EOF #================================================= diff --git a/scripts/restore b/scripts/restore index 505f851..c43630c 100755 --- a/scripts/restore +++ b/scripts/restore @@ -12,9 +12,14 @@ if [ ! -e _common.sh ]; then chmod a+rx _common.sh fi +if [ ! -e _future.sh ]; then + # Get the _common.sh file if it's not in the current directory + cp ../settings/scripts/_future.sh ./_future.sh + chmod a+rx _future.sh +fi + source _common.sh source /usr/share/yunohost/helpers -source _future.sh ynh_abort_if_errors @@ -125,6 +130,12 @@ yunohost service add "uwsgi-app@$app.socket" --log "/var/log/uwsgi/app/$app" ynh_restore_file "/etc/cron.d/$app" +#================================================= +# RESTORE THE HUB BINARY FILE +#================================================= + +ynh_restore_file "/usr/bin/hub" + #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 1367678..08482ba 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -57,12 +57,13 @@ elif [ "$is_public" = "No" ]; then is_public=0 fi +# (<2.17) if [ -z "$db_name" ]; then # If db_name doesn't exist, create it db_name=$(ynh_sanitize_dbid "$app") ynh_app_setting_set "$app" db_name "$db_name" fi -# handle python3 migration (because of django 2.0) +# (<2.18) handle python3 migration (because of django 2.0) if [[ -e "$final_path/venv/lib/python2.7/site-packages/weblate/settings.py" ]] then settings="$final_path/venv/lib/python2.7/site-packages/weblate/settings.py" @@ -72,7 +73,7 @@ else migrate_py2to3=false fi -# save memc_port if it doesn't exist +# (<2.17) save memc_port if it doesn't exist if [[ -z "$memc_port" ]] then memc_port=$(cat "$settings" \ @@ -81,7 +82,7 @@ then ynh_app_setting_set "$app" memc_port "$memc_port" fi -# migrade old uwsgi files if existing +# (<2.18) migrade old uwsgi files if existing if [ -e "/etc/systemd/system/$app.service" ] then systemctl stop "$app.service" @@ -91,6 +92,18 @@ then ynh_secure_remove "/etc/systemd/system/$app.service" fi +# (<2.18) move hub to the correct folder +if [ -e "$final_path/bin/hub" ] +then + mv "$final_path/bin/hub" /usr/bin/ + chown root:root /usr/bin/hub +fi + +if [[ -d "$final_path/bin/" ]] +then + ynh_secure_remove "$final_path/bin/" +fi + #================================================= # CHECK THE PATH #================================================= @@ -146,7 +159,8 @@ ynh_add_uwsgi_service # save old settings file cp "$settings" "$final_path/settings.$previous_version.old.py" -# handle python3 migration + +# (<2.18) handle python3 migration if [[ "$migrate_py2to3" = true ]] then ynh_secure_remove "$final_path/venv"