diff --git a/manifest.json b/manifest.json index 3511c0b..181479d 100644 --- a/manifest.json +++ b/manifest.json @@ -3,8 +3,8 @@ "id": "bookwyrm", "packaging_format": 1, "description": { - "en": "$app is a platform for social reading.", - "fr": "$app est une plateforme de lecture sociale." + "en": "Platform for social reading", + "fr": "Plateforme de lecture sociale" }, "version": "0.5.3~ynh1", "url": "https://github.com/bookwyrm-social/bookwyrm", @@ -20,7 +20,7 @@ "name": "oufmilo" }, "requirements": { - "yunohost": ">= 4.3.0" + "yunohost": ">= 11.0.9" }, "services": [ "nginx", diff --git a/scripts/backup b/scripts/backup index c09de5e..cea1313 100755 --- a/scripts/backup +++ b/scripts/backup @@ -39,11 +39,6 @@ datadir=$(ynh_app_setting_get --app=$app --key=datadir) #================================================= ynh_print_info --message="Declaring files to be backed up..." -### N.B. : the following 'ynh_backup' calls are only a *declaration* of what needs -### to be backuped and not an actual copy of any file. The actual backup that -### creates and fill the archive with the files happens in the core after this -### script is called. Hence ynh_backups calls takes basically 0 seconds to run. - #================================================= # BACKUP THE APP MAIN DIR #================================================= @@ -62,12 +57,6 @@ ynh_backup --src_path="$datadir" --is_big ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" - -#================================================= -# SPECIFIC BACKUP -#================================================= - - #================================================= # BACKUP SYSTEMD #================================================= @@ -77,7 +66,6 @@ ynh_backup --src_path="/etc/systemd/system/${app}-server.service" ynh_backup --src_path="/etc/systemd/system/${app}-worker.service" ynh_backup --src_path="/etc/systemd/system/$app.target" - #================================================= # BACKUP THE POSTGRESQL DATABASE #================================================= diff --git a/scripts/install b/scripts/install index 29a9382..3baf557 100755 --- a/scripts/install +++ b/scripts/install @@ -63,7 +63,6 @@ ynh_app_setting_set --app=$app --key=admin --value=$admin #================================================= ynh_script_progression --message="Finding an available port..." --weight=1 - port=$(ynh_find_port --port=8000) ynh_app_setting_set --app=$app --key=port --value=$port @@ -72,7 +71,7 @@ ynh_app_setting_set --app=$app --key=port --value=$port #================================================= ynh_script_progression --message="Installing dependencies..." --weight=1 -ynh_install_app_dependencies $pkg_dependencies +ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies #================================================= # CREATE DEDICATED USER @@ -87,14 +86,11 @@ ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= ynh_script_progression --message="Creating a PostgreSQL database..." --weight=1 -db_name=$(ynh_sanitize_dbid --db_name="${app}") -db_user=$(ynh_sanitize_dbid --db_name=$app) +db_name=$(ynh_sanitize_dbid --db_name=$app) +db_user=$db_name ynh_app_setting_set --app=$app --key=db_name --value=$db_name -ynh_app_setting_set --app=$app --key=db_user --value=$db_user ynh_psql_test_if_first_run ynh_psql_setup_db --db_user=$db_user --db_name=$db_name -ynh_psql_execute_as_root --sql="ALTER USER $db_user CREATEDB;" -db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -146,13 +142,11 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Creating a data directory..." --weight=1 - datadir=/home/yunohost.app/$app ynh_app_setting_set --app=$app --key=datadir --value=$datadir mkdir -p $datadir - chmod 750 "$datadir" chmod -R o-rwx "$datadir" chown -R $app:www-data "$datadir" @@ -169,11 +163,8 @@ ynh_add_systemd_config --service="${app}-server" --template="${app}-server.servi ynh_add_systemd_config --service="${app}-worker" --template="${app}-worker.service" ynh_add_systemd_config --service="${app}-beat" --template="${app}-beat.service" - #================================================= # GENERIC FINALIZATION -#================================================= - #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= @@ -193,7 +184,6 @@ ynh_systemd_action --service_name="${app}-beat" --action="start" --log_path="sys ynh_systemd_action --service_name="${app}-server" --action="start" --log_path="systemd" --line_match="Booting worker with pid" ynh_systemd_action --service_name="${app}-worker" --action="start" --log_path="systemd" --line_match="ready" - #================================================= # SETUP SSOWAT #================================================= diff --git a/scripts/remove b/scripts/remove old mode 100755 new mode 100644 index 50177c2..3f2e27b --- a/scripts/remove +++ b/scripts/remove @@ -103,16 +103,6 @@ ynh_script_progression --message="Removing dependencies..." --weight=1 # Remove metapackage and its dependencies ynh_remove_app_dependencies -#================================================= -# CLOSE A PORT -#================================================= - -if yunohost firewall list | grep -q "\- $port$" -then - ynh_script_progression --message="Closing port $port..." --weight=1 - ynh_exec_warn_less yunohost firewall disallow TCP $port -fi - #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/restore b/scripts/restore old mode 100755 new mode 100644 index bec82ea..ac84191 --- a/scripts/restore +++ b/scripts/restore @@ -80,7 +80,6 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$final_path" - chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" @@ -106,7 +105,7 @@ chown -R $app:www-data "$datadir" ynh_script_progression --message="Reinstalling dependencies..." --weight=1 # Define and install dependencies -ynh_install_app_dependencies $pkg_dependencies +ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies #================================================= # RESTORE THE POSTGRESQL DATABASE @@ -114,10 +113,8 @@ ynh_install_app_dependencies $pkg_dependencies ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=1 ynh_psql_test_if_first_run -db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd -ynh_psql_execute_as_root --sql="ALTER USER $db_user CREATEDB;" -ynh_psql_execute_file_as_root --file="./db.sql" --database="$db_name" +ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name #================================================= # RESTORE SYSTEMD diff --git a/scripts/upgrade b/scripts/upgrade index fc36670..c6c6072 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -32,12 +32,6 @@ admin_mail=$(ynh_user_get_info --username=$admin --key=username) # CHECK VERSION #================================================= -### This helper will compare the version of the currently installed app and the version of the upstream package. -### $upgrade_type can have 2 different values -### - UPGRADE_APP if the upstream app version has changed -### - UPGRADE_PACKAGE if only the YunoHost package has changed -### ynh_check_app_version_changed will stop the upgrade if the app is up to date. -### UPGRADE_APP should be used to upgrade the core app only if there's an upgrade to do. upgrade_type=$(ynh_check_app_version_changed) #================================================= @@ -65,49 +59,6 @@ ynh_systemd_action --action="stop" --service_name="${app}-beat" --log_path="syst ynh_systemd_action --action="stop" --service_name="${app}-server" --log_path="systemd" --line_match="Stopped" ynh_systemd_action --action="stop" --service_name="${app}-worker" --log_path="systemd" --line_match="Stopped" -#================================================= -# ENSURE DOWNWARD COMPATIBILITY -#================================================= -ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 - -# -# N.B. : the followings setting migrations snippets are provided as *EXAMPLES* -# of what you may want to do in some cases (e.g. a setting was not defined on -# some legacy installs and you therefore want to initiaze stuff during upgrade) -# - -# If db_name doesn't exist, create it -#if [ -z "$db_name" ]; then -# db_name=$(ynh_sanitize_dbid --db_name=$app) -# ynh_app_setting_set --app=$app --key=db_name --value=$db_name -#fi - -# If final_path doesn't exist, create it -#if [ -z "$final_path" ]; then -# final_path=/var/www/$app -# ynh_app_setting_set --app=$app --key=final_path --value=$final_path -#fi - -### If nobody installed your app before 4.1, -### then you may safely remove these lines - -# Cleaning legacy permissions -if ynh_legacy_permissions_exists; then - ynh_legacy_permissions_delete_all - - ynh_app_setting_delete --app=$app --key=is_public -fi - -if ! ynh_permission_exists --permission="admin"; then - # Create the required permissions - ynh_permission_create --permission="admin" --url="/admin" --allowed=$admin -fi - -# Create a permission if needed -if ! ynh_permission_exists --permission="api"; then - ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --show_tile="false" --protected="true" -fi - #================================================= # CREATE DEDICATED USER #================================================= @@ -128,12 +79,6 @@ then ynh_setup_source --dest_dir="$final_path" fi -# FIXME: this should be managed by the core in the future -# Here, as a packager, you may have to tweak the ownerhsip/permissions -# such that the appropriate users (e.g. maybe www-data) can access -# files in some cases. -# But FOR THE LOVE OF GOD, do not allow r/x for "others" on the entire folder - -# this will be treated as a security issue. chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" @@ -149,7 +94,6 @@ chown $app:www-data "$final_path/.env" set -a; source "$final_path/.env"; set +a - ynh_secure_remove --file="$final_path/venv" mkdir "$final_path/venv" python3 -m venv "$final_path/venv" @@ -168,8 +112,7 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Upgrading dependencies..." --weight=1 -ynh_install_app_dependencies $pkg_dependencies - +ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies #================================================= # SETUP SYSTEMD @@ -185,7 +128,6 @@ ynh_add_systemd_config --service="${app}-beat" --template="${app}-beat.service #================================================= # GENERIC FINALIZATION - #================================================= # INTEGRATE SERVICE IN YUNOHOST #=================================================