diff --git a/manifest.toml b/manifest.toml index f19f4b0..e2c2e91 100644 --- a/manifest.toml +++ b/manifest.toml @@ -17,7 +17,7 @@ admindoc = "https://join-lemmy.org/docs/en/" code = "https://github.com/LemmyNet/lemmy" [integration] -yunohost = ">= 11.2.18" +yunohost = ">= 11.2.29" helpers_version = "2.1" architectures = ["amd64"] multi_instance = false diff --git a/scripts/backup b/scripts/backup index 8840e15..3fb3575 100755 --- a/scripts/backup +++ b/scripts/backup @@ -1,6 +1,5 @@ #!/bin/bash -# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers @@ -24,18 +23,8 @@ ynh_backup "$data_dir" ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# SPECIFIC BACKUP -#================================================= -# BACKUP LOGROTATE -#================================================= - ynh_backup "/etc/logrotate.d/$app" -#================================================= -# BACKUP SYSTEMD -#================================================= - ynh_backup "/etc/systemd/system/$app.service" ynh_backup "/etc/systemd/system/$app-ui.service" ynh_backup "/etc/systemd/system/$app-pict-rs.service" diff --git a/scripts/change_url b/scripts/change_url index eac4140..0bbe7a3 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -27,9 +27,6 @@ ynh_script_progression "Adding $app's configuration..." mkdir -p "$install_dir/config/" ynh_config_add --template="lemmy.hjson" --destination="$install_dir/config/config.hjson" -#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/config/config.hjson" -#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app:$app "$install_dir/config/config.hjson" - #================================================= # START SYSTEMD SERVICE #================================================= diff --git a/scripts/install b/scripts/install index 17c0cd1..c6f9eb0 100755 --- a/scripts/install +++ b/scripts/install @@ -24,14 +24,11 @@ ynh_psql_db_shell <<< "CREATE EXTENSION IF NOT EXISTS pgcrypto;" #================================================= ynh_script_progression "Setting up source files..." -# Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir/build-lemmy/" ynh_setup_source --dest_dir="$install_dir/build-lemmy-ui/" ynh_setup_source --dest_dir="$install_dir/lemmy-ui/lemmy-translations/" --source_id="lemmy-translations" ynh_setup_source --dest_dir="$install_dir/build-pict-rs/" -#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir" -#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:$app "$install_dir" #================================================= # NGINX CONFIGURATION #================================================= @@ -45,8 +42,7 @@ ynh_config_add_nginx #================================================= pushd $install_dir/lemmy-ui - - ynh_hide_warnings ynh_exec_as_app node_load_PATH yarn add sharp + ynh_hide_warnings ynh_exec_as_app yarn add sharp popd #================================================= @@ -78,9 +74,6 @@ mkdir -p "$install_dir/pict-rs/" mv -f "$install_dir/build-pict-rs/output/usr/local/bin/pict-rs" "$install_dir/pict-rs/pict-rs" ynh_safe_rm "$install_dir/build-pict-rs" -#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 750 "$install_dir" -#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir" -#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:$app "$install_dir" # (Dirty) Install ImageMagick # Requires 'libfuse2' and 'libimage-exiftool-perl' apt dependencies ynh_script_progression "Downloading and installing ImageMagick..." @@ -94,8 +87,6 @@ ynh_script_progression "Adding $app's configuration..." # Lemmy configuration mkdir -p "$install_dir/config/" ynh_config_add --template="lemmy.hjson" --destination="$install_dir/config/config.hjson" -#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/config/config.hjson" -#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app:$app "$install_dir/config/config.hjson" # Pict-RS configuration ynh_config_add --template="pict-rs.toml" --destination="$install_dir/pict-rs/pict-rs.toml" @@ -127,11 +118,7 @@ ynh_config_add_systemd --service="$app-pict-rs" --template="pict-rs.service" ynh_script_progression "Configuring log rotation..." mkdir -p "/var/log/$app" -#REMOVEME? Assuming ynh_config_add_logrotate is called, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 750 "/var/log/$app" -#REMOVEME? Assuming ynh_config_add_logrotate is called, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "/var/log/$app" -#REMOVEME? Assuming ynh_config_add_logrotate is called, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:$app "/var/log/$app" -# Use logrotate to manage application logfile(s) ynh_config_add_logrotate #================================================= @@ -149,8 +136,7 @@ yunohost service add $app-pict-rs --description="Simple image hosting service fo # TMP rebuild sharp pushd $install_dir/lemmy-ui - - ynh_hide_warnings ynh_exec_as_app node_load_PATH npm rebuild sharp + ynh_hide_warnings ynh_exec_as_app npm rebuild sharp popd ynh_script_progression "Starting $app's systemd service..." diff --git a/scripts/remove b/scripts/remove index d2a3877..318f04c 100755 --- a/scripts/remove +++ b/scripts/remove @@ -3,14 +3,11 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# STANDARD REMOVE #================================================= # REMOVE SERVICE INTEGRATION IN YUNOHOST #================================================= ynh_script_progression "Removing system configurations related to $app..." -# Remove the service from the list of services known by YunoHost (added from `yunohost service add`) if ynh_hide_warnings yunohost service status $app >/dev/null then ynh_script_progression "Removing $app service integration..." @@ -27,22 +24,15 @@ then yunohost service remove $app-pict-rs fi -# Remove the dedicated systemd config ynh_config_remove_systemd ynh_config_remove_systemd$app-ui ynh_config_remove_systemd$app-pict-rs -# Remove the app-specific logrotate config ynh_config_remove_logrotate -# Remove the dedicated NGINX config ynh_config_remove_nginx -# Remove metapackage and its dependencies ynh_nodejs_remove -#ynh_safe_rm "/lib/libc.musl-x86_64.so.1" - -# Remove the log files #================================================= # END OF SCRIPT diff --git a/scripts/restore b/scripts/restore index 359e1a7..48e310a 100755 --- a/scripts/restore +++ b/scripts/restore @@ -1,6 +1,5 @@ #!/bin/bash -# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers @@ -11,8 +10,6 @@ ynh_script_progression "Restoring the app main directory..." ynh_restore "$install_dir" -#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir" -#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:$app "$install_dir" #================================================= # RESTORE THE DATA DIRECTORY #================================================= @@ -29,7 +26,6 @@ chown -R $app:$app "$data_dir" #================================================= ynh_script_progression "Reinstalling dependencies..." -# Define and install dependencies ynh_nodejs_install ln -fs /usr/lib/x86_64-linux-musl/libc.so /lib/libc.musl-x86_64.so.1 @@ -56,8 +52,10 @@ ynh_script_progression "Restoring $app's systemd service..." ynh_restore "/etc/systemd/system/$app.service" systemctl enable $app.service --quiet + ynh_restore "/etc/systemd/system/$app-ui.service" systemctl enable $app-ui.service --quiet + ynh_restore "/etc/systemd/system/$app-pict-rs.service" systemctl enable $app-pict-rs.service --quiet @@ -67,9 +65,6 @@ systemctl enable $app-pict-rs.service --quiet ynh_script_progression "Restoring the logrotate configuration..." mkdir -p "/var/log/$app" -#REMOVEME? Assuming ynh_config_add_logrotate is called, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 750 "/var/log/$app" -#REMOVEME? Assuming ynh_config_add_logrotate is called, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "/var/log/$app" -#REMOVEME? Assuming ynh_config_add_logrotate is called, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:$app "/var/log/$app" ynh_restore "/etc/logrotate.d/$app" diff --git a/scripts/upgrade b/scripts/upgrade index 04288d4..87919b4 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,7 +9,6 @@ source /usr/share/yunohost/helpers ynh_script_progression "Stopping $app's systemd service..." ynh_systemctl --service=$app --action="stop" --wait_until="Stopped" - ynh_systemctl --service=$app-ui --action="stop" --wait_until="Stopped" --log_path="/var/log/$app/$app-ui.log" ynh_systemctl --service=$app-pict-rs --action="stop" --wait_until="Stopped" --log_path="/var/log/$app/$app-pict-rs.log" @@ -31,21 +30,13 @@ fi #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= +ynh_script_progression "Upgrading source files..." -# FIXME: this is still supported but the recommendation is now to *always* re-setup the app sources wether or not the upstream sources changed -if ynh_app_upstream_version_changed -then - ynh_script_progression "Upgrading source files..." +ynh_setup_source --dest_dir="$install_dir/build-lemmy/" +ynh_setup_source --dest_dir="$install_dir/build-lemmy-ui/" +ynh_setup_source --dest_dir="$install_dir/lemmy-ui/lemmy-translations/" --source_id="lemmy-translations" +ynh_setup_source --dest_dir="$install_dir/build-pict-rs/" - # Download, check integrity, uncompress the source of lemmy from app.src to his build directory - ynh_setup_source --dest_dir="$install_dir/build-lemmy/" - ynh_setup_source --dest_dir="$install_dir/build-lemmy-ui/" - ynh_setup_source --dest_dir="$install_dir/lemmy-ui/lemmy-translations/" --source_id="lemmy-translations" - ynh_setup_source --dest_dir="$install_dir/build-pict-rs/" -fi - -#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir" -#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:$app "$install_dir" #================================================= # UPGRADE DEPENDENCIES #================================================= @@ -60,7 +51,6 @@ ln -fs /usr/lib/x86_64-linux-musl/libc.so /lib/libc.musl-x86_64.so.1 #================================================= ynh_script_progression "Upgrading NGINX web server configuration..." -# Create a dedicated NGINX config ynh_config_add_nginx #================================================= @@ -68,8 +58,7 @@ ynh_config_add_nginx #================================================= pushd $install_dir/lemmy-ui - - ynh_hide_warnings ynh_exec_as_app node_load_PATH yarn add sharp + ynh_hide_warnings ynh_exec_as_app yarn add sharp popd #================================================= @@ -110,9 +99,6 @@ then download_and_install_appimage --name="magick" --url="https://imagemagick.org/archive/binaries/magick" --directory="$install_dir/pict-rs" --symlink="$install_dir/pict-rs/magick" fi -#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 750 "$install_dir" -#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir" -#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:$app "$install_dir" #================================================= # UPDATE A CONFIG FILE #================================================= @@ -122,8 +108,6 @@ ynh_script_progression "Updating configuration..." mkdir -p "$install_dir/lemmy/" chown $app:$app "$install_dir/lemmy" ynh_config_add --template="lemmy.hjson" --destination="$install_dir/config/config.hjson" -#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/config/config.hjson" -#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app:$app "$install_dir/config/config.hjson" # Pict-RS configuration mkdir -p "$install_dir/pict-rs" @@ -165,11 +149,7 @@ ynh_config_add_systemd --service="$app-pict-rs" --template="pict-rs.service" ynh_script_progression "Upgrading logrotate configuration..." mkdir -p "/var/log/$app" -#REMOVEME? Assuming ynh_config_add_logrotate is called, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 750 "/var/log/$app" -#REMOVEME? Assuming ynh_config_add_logrotate is called, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "/var/log/$app" -#REMOVEME? Assuming ynh_config_add_logrotate is called, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:$app "/var/log/$app" -# Use logrotate to manage app-specific logfile(s) ynh_config_add_logrotate #=================================================