diff --git a/README.md b/README.md index 35a2593..1cd399b 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Haste is an open-source pastebin software written in node.js, which is easily installable in any network. YunoHost Project uses Haste as pastebin for log sharing: [paste.yunohost.org](https://paste.yunohost.org/) -**Shipped version:** 0.1.2023.09.21~ynh1 +**Shipped version:** 0.1.2023.09.21~ynh2 **Demo:** http://hastebin.com/ diff --git a/README_fr.md b/README_fr.md index b04b184..cd74234 100644 --- a/README_fr.md +++ b/README_fr.md @@ -19,7 +19,7 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po Haste est un logiciel pastebin open-source écrit en node.js, facilement installable sur n'importe quel réseau. Le projet YunoHost utilise Haste comme pastebin pour le partage de log : [paste.yunohost.org](https://paste.yunohost.org/) -**Version incluse :** 0.1.2023.09.21~ynh1 +**Version incluse :** 0.1.2023.09.21~ynh2 **Démo :** http://hastebin.com/ 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..aa2fdab 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "Haste" description.en = "Open-source pastebin allowing to upload texts" description.fr = "Pastebin open-source permettant de mettre en ligne du texte" -version = "0.1.2023.09.21~ynh1" +version = "0.1.2023.09.21~ynh2" maintainers = ["eric_G"] @@ -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 #=================================================