From fe4c3af4251e96b497869fd4c486173ce4caa0e3 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 16 Nov 2021 20:34:36 +0100 Subject: [PATCH] 4.3 --- conf/arm5.src | 6 ------ conf/arm6.src | 6 ------ conf/{arm7.src => armhf.src} | 0 manifest.json | 2 +- scripts/_common.sh | 28 ---------------------------- scripts/backup | 6 ++++++ scripts/install | 11 ++++++++++- scripts/remove | 8 ++++++++ scripts/restore | 7 +++++++ scripts/upgrade | 16 +++++++++++++++- 10 files changed, 47 insertions(+), 43 deletions(-) delete mode 100644 conf/arm5.src delete mode 100644 conf/arm6.src rename conf/{arm7.src => armhf.src} (100%) diff --git a/conf/arm5.src b/conf/arm5.src deleted file mode 100644 index cf88e5f..0000000 --- a/conf/arm5.src +++ /dev/null @@ -1,6 +0,0 @@ -SOURCE_URL=https://github.com/miniflux/v2/releases/download/2.0.33/miniflux-linux-armv5 -SOURCE_SUM=f0e11903bb3688ab4aa08746b4f904c9a71c94d5f005cc4f5d3fdbb58745c3de -SOURCE_SUM_PRG=sha256sum -SOURCE_IN_SUBDIR=false -SOURCE_FILENAME=miniflux -SOURCE_EXTRACT=false \ No newline at end of file diff --git a/conf/arm6.src b/conf/arm6.src deleted file mode 100644 index d800dcd..0000000 --- a/conf/arm6.src +++ /dev/null @@ -1,6 +0,0 @@ -SOURCE_URL=https://github.com/miniflux/v2/releases/download/2.0.33/miniflux-linux-armv6 -SOURCE_SUM=7aa84c40f3b272cd67c1a599710e8979e08bb715360d065b4578fc5c6a97d9c3 -SOURCE_SUM_PRG=sha256sum -SOURCE_IN_SUBDIR=false -SOURCE_FILENAME=miniflux -SOURCE_EXTRACT=false \ No newline at end of file diff --git a/conf/arm7.src b/conf/armhf.src similarity index 100% rename from conf/arm7.src rename to conf/armhf.src diff --git a/manifest.json b/manifest.json index f001844..34da818 100644 --- a/manifest.json +++ b/manifest.json @@ -19,7 +19,7 @@ "name": "eric_G" }, "requirements": { - "yunohost": ">= 4.2.4" + "yunohost": ">= 4.3.0" }, "multi_instance": true, "services": [ diff --git a/scripts/_common.sh b/scripts/_common.sh index 637d1d0..52491aa 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -18,31 +18,3 @@ pkg_dependencies="postgresql apt-transport-https" #================================================= # FUTURE OFFICIAL HELPERS #================================================= - -# Check the architecture -# -# example: architecture=$(ynh_detect_arch) -# -# usage: ynh_detect_arch -# -# Requires YunoHost version 2.2.4 or higher. - -ynh_detect_arch(){ - local architecture - if [ -n "$(uname -m | grep arm64)" ] || [ -n "$(uname -m | grep aarch64)" ]; then - architecture="arm64" - elif [ -n "$(uname -m | grep 64)" ]; then - architecture="amd64" - elif [ -n "$(uname -m | grep 86)" ]; then - architecture="386" - elif [ -n "$(uname -m | grep armv7)" ]; then - architecture="arm7" - elif [ -n "$(uname -m | grep armv6)" ]; then - architecture="arm6" - elif [ -n "$(uname -m | grep armv5)" ]; then - architecture="arm5" - else - architecture="unknown" - fi - echo $architecture -} diff --git a/scripts/backup b/scripts/backup index 2eaa6b2..5e97511 100644 --- a/scripts/backup +++ b/scripts/backup @@ -50,6 +50,12 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup --src_path="/etc/systemd/system/$app.service" +#================================================= +# BACKUP LOGROTATE +#================================================= + +ynh_backup --src_path="/etc/logrotate.d/$app" + #================================================= # BACKUP THE POSTGRESQL DATABASE #================================================= diff --git a/scripts/install b/scripts/install index c7a7c73..3e98d1d 100644 --- a/scripts/install +++ b/scripts/install @@ -23,7 +23,7 @@ ynh_abort_if_errors domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH is_public=$YNH_APP_ARG_IS_PUBLIC -architecture=$(ynh_detect_arch) +architecture=$YNH_ARCH password=$YNH_APP_ARG_PASSWORD admin=$YNH_APP_ARG_ADMIN @@ -49,6 +49,7 @@ ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=admin --value=$admin ynh_app_setting_set --app=$app --key=password --value=$password +ynh_app_setting_set --app=$app --key=architecture --value=$architecture #================================================= # STANDARD MODIFICATIONS @@ -126,6 +127,14 @@ ynh_script_progression --message="Configuring a systemd service..." --weight=1 ynh_add_systemd_config +#================================================= +# 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/remove b/scripts/remove index 2dd7723..d7b5848 100644 --- a/scripts/remove +++ b/scripts/remove @@ -75,6 +75,14 @@ ynh_script_progression --message="Removing NGINX web server configuration..." -- # Remove the dedicated NGINX config ynh_remove_nginx_config +#================================================= +# REMOVE LOGROTATE CONFIGURATION +#================================================= +ynh_script_progression --message="Removing logrotate configuration..." --weight=1 + +# Remove the app-specific logrotate config +ynh_remove_logrotate + #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/restore b/scripts/restore index 084d5fb..929e0ef 100644 --- a/scripts/restore +++ b/scripts/restore @@ -99,6 +99,13 @@ ynh_script_progression --message="Integrating service in YunoHost..." yunohost service add $app --description="Minimalist feed reader" --log="/var/log/$app/$app.log" +#================================================= +# RESTORE THE LOGROTATE CONFIGURATION +#================================================= +ynh_script_progression --message="Restoring the logrotate configuration..." ---weight=1 + +ynh_restore_file --origin_path="/etc/logrotate.d/$app" + #================================================= # START SYSTEMD SERVICE #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 5ee34e0..f916b9f 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -20,7 +20,7 @@ domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) port=$(ynh_app_setting_get --app=$app --key=port) -architecture=$(ynh_detect_arch) +architecture=$(ynh_app_setting_get --app=$app --key=architecture) db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) @@ -51,6 +51,12 @@ ynh_abort_if_errors #================================================= ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 +# If architecture doesn't exist, create it +if [ -z "$architecture" ]; then + architecture="dpkg --print-architecture" + architecture=$(ynh_app_setting_get --app=$app --key=architecture) +fi + # Cleaning legacy permissions if ynh_legacy_permissions_exists; then ynh_legacy_permissions_delete_all @@ -114,6 +120,14 @@ ynh_script_progression --message="Configuring a systemd service..." --weight=2 ynh_add_systemd_config +#================================================= +# SETUP LOGROTATE +#================================================= +ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1 + +# Use logrotate to manage app-specific logfile(s) +ynh_use_logrotate --non-append + #================================================= # INTEGRATE SERVICE IN YUNOHOST #=================================================