From 7c9d3e52f52d15ec48b8ff0247c539bb0d334695 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 9 Dec 2023 21:49:43 +0100 Subject: [PATCH] cleaning --- check_process | 25 ---------------- manifest.toml | 3 ++ scripts/install | 77 +++++++++++++++++++------------------------------ scripts/remove | 27 ----------------- scripts/restore | 16 +++++----- scripts/upgrade | 45 +++++++++-------------------- 6 files changed, 54 insertions(+), 139 deletions(-) delete mode 100644 check_process diff --git a/check_process b/check_process deleted file mode 100644 index 3554c31..0000000 --- a/check_process +++ /dev/null @@ -1,25 +0,0 @@ -;; Test complet - ; Manifest - domain="domain.tld" - path="/" - is_public=1 - port="7777" - ; Checks - pkg_linter=1 - setup_sub_dir=0 - setup_root=1 - setup_nourl=0 - setup_private=1 - setup_public=1 - upgrade=1 - upgrade=1 from_commit=0ea46c375b775316cec39a96fa917ec240e45970 - backup_restore=1 - multi_instance=0 - change_url=1 -;;; Options -Email= -Notification=none -;;; Upgrade options - ; commit=0ea46c375b775316cec39a96fa917ec240e45970 - name=Testing (#33) - manifest_arg=domain=DOMAIN&path=PATH&is_public=1&language=fr&admin=USER&password=pass&port=666& diff --git a/manifest.toml b/manifest.toml index a3f308e..5322f7d 100644 --- a/manifest.toml +++ b/manifest.toml @@ -20,8 +20,11 @@ code = "https://github.com/seejohnrun/haste-server" yunohost = ">= 11.2" architectures = "all" multi_instance = false + ldap = false + sso = true + disk = "50M" ram.build = "50M" ram.runtime = "50M" diff --git a/scripts/install b/scripts/install index 3de9d32..615d5d3 100755 --- a/scripts/install +++ b/scripts/install @@ -9,6 +9,14 @@ source _common.sh source /usr/share/yunohost/helpers +#================================================= +# INSTALL NODEJS +#================================================= +ynh_script_progression --message="Installing dependencies..." --weight=10 + +# Install Nodejs +ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -25,24 +33,30 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=2 # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# SPECIFIC SETUP -#================================================= -# INSTALL NODEJS -#================================================= -ynh_script_progression --message="Installing dependencies..." --weight=10 - -# Install Nodejs -ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version - -#================================================= -# ADD SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Configuring a systemd service..." --weight=1 - env_path="$PATH" ynh_add_systemd_config +# FIXME Currently, the log is only redirected to syslog. +mkdir -p /var/log/$app +touch /var/log/$app/$app.log +chown $app -R /var/log/$app + +ynh_use_logrotate + +yunohost service add $app --description="Haste is a pastebin software" --log="/var/log/$app/$app.log" + +#================================================= +# CONFIGURE HASTE +#================================================= +ynh_script_progression --message="Adding a configuration file..." --weight=1 + +ynh_add_config --template="config.js" --destination="$install_dir/config.js" + +# Replace ajax.googleapis by local file +cp ../sources/jquery.min.js "$install_dir/static/jquery.min.js" + +ynh_replace_string --match_string="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" --replace_string="jquery.min.js" --target_file="$install_dir/static/index.html" + #================================================= # INSTALL HASTEBIN #================================================= @@ -53,24 +67,12 @@ pushd "$install_dir" ynh_exec_warn_less $ynh_npm install popd -#================================================= -# CONFIGURE HASTE -#================================================= -ynh_script_progression --message="Adding a configuration file..." --weight=1 - -ynh_add_config --template="../conf/config.js" --destination="$install_dir/config.js" - -# Replace ajax.googleapis by local file -cp ../sources/jquery.min.js "$install_dir/static/jquery.min.js" - -ynh_replace_string --match_string="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" --replace_string="jquery.min.js" --target_file="$install_dir/static/index.html" - #================================================= # ADD HASTE AS A BINARY FILE #================================================= haste_url="${domain}${path}" -ynh_add_config --template="../conf/haste.sh" --destination="/usr/bin/$app" +ynh_add_config --template="haste.sh" --destination="/usr/bin/$app" #================================================= # GENERIC FINALIZATION @@ -83,25 +85,6 @@ chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" chmod +x /usr/bin/$app -#================================================= -# HANDLE LOG FILES AND SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Configuring log rotation..." --weight=1 - -# FIXME Currently, the log is only redirected to syslog. -mkdir -p /var/log/$app -touch /var/log/$app/$app.log -chown $app -R /var/log/$app - -ynh_use_logrotate - -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - -yunohost service add $app --description="Haste is a pastebin software" --log="/var/log/$app/$app.log" - #================================================= # START SYSTEMD SERVICE #================================================= diff --git a/scripts/remove b/scripts/remove index 2972035..9434ca3 100755 --- a/scripts/remove +++ b/scripts/remove @@ -22,43 +22,16 @@ then yunohost service remove $app fi -#================================================= -# STOP AND REMOVE SERVICE -#================================================= -ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1 - # Remove the dedicated systemd config ynh_remove_systemd_config -#================================================= -# REMOVE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 - # Remove the dedicated NGINX config ynh_remove_nginx_config -#================================================= -# REMOVE LOGROTATE CONFIGURATION -#================================================= -ynh_script_progression --message="Removing logrotate configuration..." --weight=1 - ynh_remove_logrotate -#================================================= -# SPECIFIC REMOVE -#================================================= -# REMOVE HASTE BINARY -#================================================= -ynh_script_progression --message="Removing various files..." --weight=1 - ynh_secure_remove --file="/usr/bin/$app" -#================================================= -# REMOVE NODEJS -#================================================= -ynh_script_progression --message="Removing dependencies..." --weight=5 - ynh_remove_nodejs #================================================= diff --git a/scripts/restore b/scripts/restore index b4f893f..2dccb71 100755 --- a/scripts/restore +++ b/scripts/restore @@ -9,6 +9,13 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers +#================================================= +# INSTALL NODEJS +#================================================= +ynh_script_progression --message="Reinstalling dependencies..." --weight=1 + +ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version + #================================================= # RESTORE THE APP MAIN DIR #================================================= @@ -19,15 +26,6 @@ ynh_restore_file --origin_path="$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" -#================================================= -# SPECIFIC RESTORE -#================================================= -# INSTALL NODEJS -#================================================= -ynh_script_progression --message="Reinstalling dependencies..." --weight=1 - -ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version - #================================================= # RESTORE VARIOUS FILES #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 54b12c9..45bdbce 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -34,6 +34,13 @@ then ynh_setup_source --dest_dir="$install_dir" --keep="config.js" fi +#================================================= +# UPGRADE NODEJS +#================================================= +ynh_script_progression --message="Upgrading dependencies..." --weight=8 + +ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version + #================================================= # NGINX CONFIGURATION #================================================= @@ -42,14 +49,13 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." - # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# SPECIFIC UPGRADE -#================================================= -# UPGRADE NODEJS -#================================================= -ynh_script_progression --message="Upgrading dependencies..." --weight=8 +# FIXME Currently, the log is only redirected to syslog. +ynh_use_logrotate --non-append -ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version +env_path="$PATH" +ynh_add_systemd_config + +yunohost service add $app --description="Haste is a pastebin software" --log="/var/log/$app/$app.log" #================================================= # UPGRADE NPM MODULES @@ -61,22 +67,6 @@ pushd "$install_dir" ynh_exec_warn_less $ynh_npm install popd -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1 - -# FIXME Currently, the log is only redirected to syslog. -ynh_use_logrotate --non-append - -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Upgrading systemd configuration..." --weight=1 - -env_path="$PATH" -ynh_add_systemd_config - #================================================= # UPGRADE HASTE CONFIGURATION #================================================= @@ -92,7 +82,7 @@ ynh_replace_string --match_string="https://ajax.googleapis.com/ajax/libs/jquery/ ynh_script_progression --message="Updating a configuration file..." --weight=1 haste_url="${domain}${path}" -ynh_add_config --template="../conf/haste.sh" --destination="/usr/bin/$app" +ynh_add_config --template="haste.sh" --destination="/usr/bin/$app" #================================================= # GENERIC FINALIZATION @@ -105,13 +95,6 @@ chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" chmod +x /usr/bin/$app -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - -yunohost service add $app --description="Haste is a pastebin software" --log="/var/log/$app/$app.log" - #================================================= # START SYSTEMD SERVICE #=================================================