diff --git a/README.md b/README.md
index 18d7bf5..c46eb68 100644
--- a/README.md
+++ b/README.md
@@ -5,7 +5,8 @@ It shall NOT be edited by hand.
# Haste for YunoHost
-[](https://dash.yunohost.org/appci/app/haste)  
+[](https://dash.yunohost.org/appci/app/haste)  
+
[](https://install-app.yunohost.org/?app=haste)
*[Lire ce readme en français.](./README_fr.md)*
@@ -26,23 +27,6 @@ Haste is an open-source pastebin software written in node.js, which is easily in

-## Disclaimers / important information
-
-#### Multi-user support
-
-* Are LDAP and HTTP auth supported? **No**
-* Can the app be used by multiple users? **Yes**
-
-## `haste` command
-
-This Haste package for Yunohost includes the [`haste` command](https://github.com/diethnis/standalones/blob/master/hastebin.sh), allowing you to share content from terminal:
-
-```bash
-cat something | haste
-https://haste.example.com/zuyejeduzu
-```
-The [Haste-client](https://github.com/seejohnrun/haste-client) is a simple client for uploading data to you Haste server.
-
## Documentation and resources
* Official app website:
diff --git a/README_fr.md b/README_fr.md
index 0ca82a2..197cc42 100644
--- a/README_fr.md
+++ b/README_fr.md
@@ -5,15 +5,16 @@ It shall NOT be edited by hand.
# Haste pour YunoHost
-[](https://dash.yunohost.org/appci/app/haste)  
+[](https://dash.yunohost.org/appci/app/haste)  
+
[](https://install-app.yunohost.org/?app=haste)
*[Read this readme in english.](./README.md)*
-> *Ce package vous permet d'installer Haste rapidement et simplement sur un serveur YunoHost.
-Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
+> *Ce package vous permet d’installer Haste rapidement et simplement sur un serveur YunoHost.
+Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l’installer et en profiter.*
-## Vue d'ensemble
+## Vue d’ensemble
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/)
@@ -22,33 +23,15 @@ Haste est un logiciel pastebin open-source écrit en node.js, facilement install
**Démo :** http://hastebin.com/
-## Captures d'écran
+## Captures d’écran
-
-
-## Avertissements / informations importantes
-
-### Support multi-utilisateur
-
-* L'authentification LDAP et HTTP est-elle prise en charge ? **Non**
-* L'application peut-elle être utilisée par plusieurs utilisateurs ? **Oui**
-
-## `haste` command
-
-Ce paquet de Haste pour YunoHost comprend une commande [`haste`](https://github.com/diethnis/standalones/blob/master/hastebin.sh), vous permettant de partager du contenu avec le terminal :
-
-```bash
-cat something | haste
-https://haste.example.com/zuyejeduzu
-```
-
-Le [client Haste](https://github.com/seejohnrun/haste-client) est un client simple pour télécharger des données sur votre serveur Haste.
+
## Documentations et ressources
-* Site officiel de l'app :
+* Site officiel de l’app :
* Documentation officielle utilisateur :
-* Dépôt de code officiel de l'app :
+* Dépôt de code officiel de l’app :
* Documentation YunoHost pour cette app :
* Signaler un bug :
@@ -64,4 +47,4 @@ ou
sudo yunohost app upgrade haste -u https://github.com/YunoHost-Apps/haste_ynh/tree/testing --debug
```
-**Plus d'infos sur le packaging d'applications :**
+**Plus d’infos sur le packaging d’applications :**
\ No newline at end of file
diff --git a/conf/app.src b/conf/app.src
deleted file mode 100644
index 280fea2..0000000
--- a/conf/app.src
+++ /dev/null
@@ -1,5 +0,0 @@
-SOURCE_URL=https://github.com/seejohnrun/haste-server/archive/7c65fb2f9b2e4b292e03c5d70957431bcc27d2c0.tar.gz
-SOURCE_SUM=8d420e2b47a640b38230114551ddffe86489cb6607af0659740385e6a9e36ebd
-SOURCE_SUM_PRG=sha256sum
-SOURCE_FORMAT=tar.gz
-SOURCE_IN_SUBDIR=true
diff --git a/conf/config.js b/conf/config.js
index 6d07a95..16a5d10 100644
--- a/conf/config.js
+++ b/conf/config.js
@@ -25,7 +25,7 @@
},
"storage": {
"type": "file",
- "path": "__DATA_PATH__"
+ "path": "__DATA_DIR__"
},
"documents": {
"about": "./about.md"
diff --git a/conf/systemd.service b/conf/systemd.service
index 83e4dbe..ac28b34 100644
--- a/conf/systemd.service
+++ b/conf/systemd.service
@@ -6,7 +6,7 @@ After=network.target syslog.target
Type=simple
User=__APP__
Group=__APP__
-WorkingDirectory=__FINALPATH__
+WorkingDirectory=__INSTALL_DIR__
Environment="PATH=__ENV_PATH__"
ExecStart=__YNH_NPM__ start
StandardOutput=append:/var/log/__APP__/__APP__.log
diff --git a/doc/DISCLAIMER.md b/doc/ADMIN.md
similarity index 64%
rename from doc/DISCLAIMER.md
rename to doc/ADMIN.md
index 4fcef40..77c0e89 100644
--- a/doc/DISCLAIMER.md
+++ b/doc/ADMIN.md
@@ -1,11 +1,6 @@
-#### Multi-user support
-
-* Are LDAP and HTTP auth supported? **No**
-* Can the app be used by multiple users? **Yes**
-
## `haste` command
-This Haste package for Yunohost includes the [`haste` command](https://github.com/diethnis/standalones/blob/master/hastebin.sh), allowing you to share content from terminal:
+This Haste package for YunoHost includes the [`haste` command](https://github.com/diethnis/standalones/blob/master/hastebin.sh), allowing you to share content from terminal:
```bash
cat something | haste
diff --git a/doc/DISCLAIMER_fr.md b/doc/ADMIN_fr.md
similarity index 70%
rename from doc/DISCLAIMER_fr.md
rename to doc/ADMIN_fr.md
index caa910a..3852877 100644
--- a/doc/DISCLAIMER_fr.md
+++ b/doc/ADMIN_fr.md
@@ -1,8 +1,3 @@
-### Support multi-utilisateur
-
-* L'authentification LDAP et HTTP est-elle prise en charge ? **Non**
-* L'application peut-elle être utilisée par plusieurs utilisateurs ? **Oui**
-
## `haste` command
Ce paquet de Haste pour YunoHost comprend une commande [`haste`](https://github.com/diethnis/standalones/blob/master/hastebin.sh), vous permettant de partager du contenu avec le terminal :
diff --git a/manifest.json b/manifest.json
deleted file mode 100644
index e68fac5..0000000
--- a/manifest.json
+++ /dev/null
@@ -1,55 +0,0 @@
-{
- "name": "Haste",
- "id": "haste",
- "packaging_format": 1,
- "description": {
- "en": "Open-source pastebin allowing to upload texts",
- "fr": "Pastebin open-source permettant de mettre en ligne du texte"
- },
- "version": "0.1.0~ynh13",
- "url": "http://hastebin.com/",
- "upstream": {
- "license": "MIT",
- "website": "http://hastebin.com/",
- "demo": "http://hastebin.com/",
- "userdoc": "https://hastebin.com/about.md",
- "code": "https://github.com/seejohnrun/haste-server"
- },
- "license": "MIT",
- "maintainer": {
- "name": "eric_G",
- "email": ""
- },
- "previous_maintainers": [{
- "name": "mbugeia",
- "email": "maxime.bugeia@gmail.com"
- }],
- "requirements": {
- "yunohost": ">= 11.0.9"
- },
- "multi_instance": false,
- "services": [
- "nginx"
- ],
- "arguments": {
- "install" : [
- {
- "name": "domain",
- "type": "domain",
- "help": {
- "en": "Haste can only be installed in a root domain or subdomain",
- "fr": "Haste ne peut être installé que dans un domaine racine ou un sous-domaine"
- }
- },
- {
- "name": "is_public",
- "type": "boolean",
- "help": {
- "en": "If enabled, Haste will be accessible by people who do not have an account. This can be changed later via the webadmin.",
- "fr": "Si cette case est cochée, Haste sera accessible aux personnes n’ayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin."
- },
- "default": true
- }
- ]
- }
-}
diff --git a/manifest.toml b/manifest.toml
new file mode 100644
index 0000000..1bde19f
--- /dev/null
+++ b/manifest.toml
@@ -0,0 +1,58 @@
+packaging_format = 2
+
+id = "haste"
+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.0~ynh13"
+
+maintainers = ["eric_G"]
+
+[upstream]
+license = "MIT"
+website = "http://hastebin.com/"
+demo = "http://hastebin.com/"
+userdoc = "https://hastebin.com/about.md"
+code = "https://github.com/seejohnrun/haste-server"
+
+[integration]
+yunohost = ">= 11.1.16"
+architectures = "all"
+multi_instance = false
+ldap = false
+sso = true
+disk = "50M"
+ram.build = "50M"
+ram.runtime = "50M"
+
+[install]
+ [install.domain]
+ help.en = "Haste can only be installed in a root domain or subdomain"
+ help.fr = "Haste ne peut être installé que dans un domaine racine ou un sous-domaine"
+ type = "domain"
+ full_domain = true
+
+ [install.init_main_permission]
+ help.en = "If enabled, Haste will be accessible by people who do not have an account. This can be changed later via the webadmin."
+ help.fr = "Si cette case est cochée, Haste sera accessible aux personnes n’ayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin."
+ type = "group"
+ default = "visitors"
+
+[resources]
+ [resources.sources.main]
+ url = "https://github.com/seejohnrun/haste-server/archive/7c65fb2f9b2e4b292e03c5d70957431bcc27d2c0.tar.gz"
+ sha256 = "8d420e2b47a640b38230114551ddffe86489cb6607af0659740385e6a9e36ebd"
+ autoupdate.upstream = "https://github.com/seejohnrun/haste-server/"
+ autoupdate.strategy = "latest_github_commit"
+
+ [resources.ports]
+
+ [resources.system_user]
+
+ [resources.install_dir]
+
+ [resources.data_dir]
+
+ [resources.permissions]
+ main.url = "/"
diff --git a/scripts/backup b/scripts/backup
index bc99ca4..d45b6dc 100755
--- a/scripts/backup
+++ b/scripts/backup
@@ -10,24 +10,6 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
-#=================================================
-# MANAGE SCRIPT FAILURE
-#=================================================
-
-# Exit if an error occurs during the execution of the script
-ynh_abort_if_errors
-
-#=================================================
-# LOAD SETTINGS
-#=================================================
-ynh_print_info --message="Loading installation settings..."
-
-app=$YNH_APP_INSTANCE_NAME
-
-final_path=$(ynh_app_setting_get --app=$app --key=final_path)
-domain=$(ynh_app_setting_get --app=$app --key=domain)
-data_path=$(ynh_app_setting_get --app=$app --key=data_path)
-
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
@@ -37,7 +19,7 @@ ynh_print_info --message="Declaring files to be backed up..."
# BACKUP THE APP MAIN DIR
#=================================================
-ynh_backup --src_path="$final_path"
+ynh_backup --src_path="$install_dir"
#=================================================
# BACKUP THE NGINX CONFIGURATION
@@ -52,10 +34,10 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup --src_path="/etc/logrotate.d/$app"
#=================================================
-# BACKUP DATADIR DIRECTORY
+# BACKUP DATA_DIR DIRECTORY
#=================================================
-ynh_backup --src_path="$data_path" --is_big
+ynh_backup --src_path="$data_dir" --is_big
#=================================================
# BACKUP BINARY
diff --git a/scripts/change_url b/scripts/change_url
index b1655f3..88c026d 100644
--- a/scripts/change_url
+++ b/scripts/change_url
@@ -9,60 +9,6 @@
source _common.sh
source /usr/share/yunohost/helpers
-#=================================================
-# RETRIEVE ARGUMENTS
-#=================================================
-
-old_domain=$YNH_APP_OLD_DOMAIN
-old_path=$YNH_APP_OLD_PATH
-
-new_domain=$YNH_APP_NEW_DOMAIN
-new_path="/"
-
-app=$YNH_APP_INSTANCE_NAME
-
-#=================================================
-# LOAD SETTINGS
-#=================================================
-ynh_script_progression --message="Loading installation settings..." --weight=1
-
-# Needed for helper "ynh_add_nginx_config"
-final_path=$(ynh_app_setting_get --app=$app --key=final_path)
-port=$(ynh_app_setting_get --app=$app --key=port)
-
-#=================================================
-# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
-#=================================================
-ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1
-
-# Backup the current version of the app
-ynh_backup_before_upgrade
-ynh_clean_setup () {
- # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
- ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
-
- # restore it if the upgrade fails
- ynh_restore_upgradebackup
-}
-# Exit if an error occurs during the execution of the script
-ynh_abort_if_errors
-
-#=================================================
-# CHECK WHICH PARTS SHOULD BE CHANGED
-#=================================================
-
-change_domain=0
-if [ "$old_domain" != "$new_domain" ]
-then
- change_domain=1
-fi
-
-change_path=0
-if [ "$old_path" != "$new_path" ]
-then
- change_path=1
-fi
-
#=================================================
# STANDARD MODIFICATIONS
#=================================================
@@ -77,29 +23,7 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app
#=================================================
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=2
-nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
-
-# Change the path in the nginx config file
-if [ $change_path -eq 1 ]
-then
- # Make a backup of the original nginx config file if modified
- ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
- # Set global variables for nginx helper
- domain="$old_domain"
- path_url="$new_path"
- # Create a dedicated nginx config
- ynh_add_nginx_config
-fi
-
-# Change the domain for nginx
-if [ $change_domain -eq 1 ]
-then
- # Delete file checksum for the old conf file location
- ynh_delete_file_checksum --file="$nginx_conf_path"
- mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
- # Store file checksum for the new config file location
- ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
-fi
+ynh_change_url_nginx_config
#=================================================
# GENERIC FINALISATION
@@ -110,13 +34,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=2
ynh_systemd_action --service_name=$app --action=start --log_path="/var/log/$app/$app.log"
-#=================================================
-# RELOAD NGINX
-#=================================================
-ynh_script_progression --message="Reloading NGINX web server..." --weight=1
-
-ynh_systemd_action --service_name=nginx --action=reload
-
#=================================================
# END OF SCRIPT
#=================================================
diff --git a/scripts/install b/scripts/install
index aadca27..a12f48f 100755
--- a/scripts/install
+++ b/scripts/install
@@ -9,69 +9,13 @@
source _common.sh
source /usr/share/yunohost/helpers
-#=================================================
-# MANAGE FAILURE OF THE SCRIPT
-#=================================================
-
-# Exit if an error occurs during the execution of the script
-ynh_abort_if_errors
-
-#=================================================
-# RETRIEVE ARGUMENTS FROM THE MANIFEST
-#=================================================
-
-domain=$YNH_APP_ARG_DOMAIN
-path_url="/"
-is_public=$YNH_APP_ARG_IS_PUBLIC
-
-app=$YNH_APP_INSTANCE_NAME
-
-#=================================================
-# CHECK IF THE APP CAN BE INSTALLED WITH THIS ARGS
-#=================================================
-ynh_script_progression --message="Validating installation parameters..." --weight=1
-
-final_path=/var/www/$app
-test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
-
-# Register (book) web path
-ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
-
-#=================================================
-# STORE SETTINGS FROM MANIFEST
-#=================================================
-ynh_script_progression --message="Storing installation settings..." --weight=2
-
-ynh_app_setting_set --app=$app --key=domain --value=$domain
-ynh_app_setting_set --app=$app --key=path_url --value=$path_url
-
-#=================================================
-# STANDARD MODIFICATIONS
-#=================================================
-# FIND AND OPEN A PORT
-#=================================================
-ynh_script_progression --message="Finding an available port..." --weight=2
-
-# Find an available port
-port=$(ynh_find_port --port=7777)
-ynh_app_setting_set --app=$app --key=port --value=$port
-
-#=================================================
-# CREATE DEDICATED USER
-#=================================================
-ynh_script_progression --message="Configuring system user..." --weight=3
-
-# Create a system user
-ynh_system_user_create --username=$app --home_dir=$final_path
-
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=2
-ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src
-ynh_setup_source --dest_dir=$final_path
+ynh_setup_source --dest_dir=$install_dir
#=================================================
# NGINX CONFIGURATION
@@ -86,7 +30,7 @@ ynh_add_nginx_config
#=================================================
# INSTALL NODEJS
#=================================================
-ynh_script_progression --message="Installing dependencies..." --weight=10
+#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=10
# Install Nodejs
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
@@ -104,44 +48,28 @@ ynh_add_systemd_config
#=================================================
ynh_script_progression --message="Installing $app..." --weight=5
-pushd "$final_path"
+pushd "$install_dir"
ynh_use_nodejs
ynh_exec_warn_less $ynh_npm install
popd
-#=================================================
-# CREATE DIRECTORY FOR DATA
-#=================================================
-ynh_script_progression --message="Creating the data directory..." --weight=1
-
-# Define app's data directory
-data_path=/home/yunohost.app/$app
-ynh_app_setting_set --app=$app --key=data_path --value=$data_path
-
-# Create app folders
-mkdir -p "$data_path"
-
-chmod 750 "$data_path"
-chmod -R o-rwx "$data_path"
-chown -R $app:www-data "$data_path"
-
#=================================================
# CONFIGURE HASTE
#=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1
-ynh_add_config --template="../conf/config.js" --destination="$final_path/config.js"
+ynh_add_config --template="../conf/config.js" --destination="$install_dir/config.js"
# Replace ajax.googleapis by local file
-cp ../sources/jquery.min.js "$final_path/static/jquery.min.js"
+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="$final_path/static/index.html"
+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_url}"
+haste_url="${domain}${path}"
ynh_add_config --template="../conf/haste.sh" --destination="/usr/bin/$app"
#=================================================
@@ -150,9 +78,9 @@ ynh_add_config --template="../conf/haste.sh" --destination="/usr/bin/$app"
# SECURE FILES AND DIRECTORIES
#=================================================
-chmod 750 "$final_path"
-chmod -R o-rwx "$final_path"
-chown -R $app:www-data "$final_path"
+chmod 750 "$install_dir"
+chmod -R o-rwx "$install_dir"
+chown -R $app:www-data "$install_dir"
chmod +x /usr/bin/$app
#=================================================
@@ -182,23 +110,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=2
# Start a systemd service
ynh_systemd_action --service_name=$app --action=start --log_path="/var/log/$app/$app.log"
-#=================================================
-# SETUP SSOWAT
-#=================================================
-ynh_script_progression --message="Configuring permissions..." --weight=1
-
-if [ $is_public -eq 1 ]
-then
- ynh_permission_update --permission="main" --add="visitors"
-fi
-
-#=================================================
-# RELOAD NGINX
-#=================================================
-ynh_script_progression --message="Reloading NGINX web server..." --weight=1
-
-ynh_systemd_action --service_name=nginx --action=reload
-
#=================================================
# END OF SCRIPT
#=================================================
diff --git a/scripts/remove b/scripts/remove
index f79f779..2972035 100755
--- a/scripts/remove
+++ b/scripts/remove
@@ -9,17 +9,6 @@
source _common.sh
source /usr/share/yunohost/helpers
-#=================================================
-# LOAD SETTINGS
-#=================================================
-ynh_script_progression --message="Loading installation settings..." --weight=1
-
-app=$YNH_APP_INSTANCE_NAME
-
-domain=$(ynh_app_setting_get --app=$app --key=domain)
-final_path=$(ynh_app_setting_get --app=$app --key=final_path)
-data_path=$(ynh_app_setting_get --app=$app --key=data_path)
-
#=================================================
# STANDARD REMOVE
#=================================================
@@ -41,14 +30,6 @@ ynh_script_progression --message="Stopping and removing the systemd service..."
# Remove the dedicated systemd config
ynh_remove_systemd_config
-#=================================================
-# REMOVE APP MAIN DIR
-#=================================================
-ynh_script_progression --message="Removing app main directory..." --weight=2
-
-# Remove the app directory securely
-ynh_secure_remove --file="$final_path"
-
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
@@ -73,17 +54,6 @@ ynh_script_progression --message="Removing various files..." --weight=1
ynh_secure_remove --file="/usr/bin/$app"
-#=================================================
-# REMOVE DATA DIR
-#=================================================
-
-# Remove the data directory if --purge option is used
-if [ "${YNH_APP_PURGE:-0}" -eq 1 ]
-then
- ynh_script_progression --message="Removing app data directory..." --weight=1
- ynh_secure_remove --file="$data_path"
-fi
-
#=================================================
# REMOVE NODEJS
#=================================================
@@ -91,16 +61,6 @@ ynh_script_progression --message="Removing dependencies..." --weight=5
ynh_remove_nodejs
-#=================================================
-# GENERIC FINALIZATION
-#=================================================
-# REMOVE DEDICATED USER
-#=================================================
-ynh_script_progression --message="Removing the dedicated system user..." --weight=1
-
-# Delete a system user
-ynh_system_user_delete --username=$app
-
#=================================================
# END OF SCRIPT
#=================================================
diff --git a/scripts/restore b/scripts/restore
index 9fe4ea3..b4f893f 100755
--- a/scripts/restore
+++ b/scripts/restore
@@ -9,60 +9,15 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
-#=================================================
-# MANAGE SCRIPT FAILURE
-#=================================================
-
-# Exit if an error occurs during the execution of the script
-ynh_abort_if_errors
-
-#=================================================
-# LOAD SETTINGS
-#=================================================
-ynh_script_progression --message="Loading installation settings..." --weight=1
-
-app=$YNH_APP_INSTANCE_NAME
-
-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)
-data_path=$(ynh_app_setting_get --app=$app --key=data_path)
-
-#=================================================
-# CHECK IF THE APP CAN BE RESTORED
-#=================================================
-ynh_script_progression --message="Validating restoration parameters..." --weight=2
-
-test ! -d $final_path \
- || ynh_die --message="There is already a directory: $final_path "
-
-#=================================================
-# STANDARD RESTORATION STEPS
-#=================================================
-# RECREATE THE DEDICATED USER
-#=================================================
-ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
-
-# Create the dedicated user (if not existing)
-ynh_system_user_create --username=$app --home_dir=$final_path
-
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=6
-ynh_restore_file --origin_path="$final_path"
+ynh_restore_file --origin_path="$install_dir"
-chmod 750 "$final_path"
-chmod -R o-rwx "$final_path"
-chown -R $app:www-data "$final_path"
-
-#=================================================
-# RESTORE THE NGINX CONFIGURATION
-#=================================================
-ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1
-
-ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
+chmod -R o-rwx "$install_dir"
+chown -R $app:www-data "$install_dir"
#=================================================
# SPECIFIC RESTORE
@@ -78,14 +33,9 @@ ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
#=================================================
ynh_script_progression --message="Restoring the data directory..." --weight=1
-ynh_restore_file --origin_path="$data_path" --not_mandatory
+ynh_restore_file --origin_path="$data_dir" --not_mandatory
-# Create app folders
-mkdir -p "$data_path"
-
-chmod 750 "$data_path"
-chmod -R o-rwx "$data_path"
-chown -R $app:www-data "$data_path"
+chown -R $app:www-data "$data_dir"
#=================================================
# RESTORE BINARY
@@ -108,21 +58,13 @@ chown $app -R /var/log/$app
#=================================================
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"
+ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
-#=================================================
-# RESTORE SYSTEMD
-#=================================================
-ynh_script_progression --message="Restoring the systemd configuration..." --weight=2
+yunohost service add $app --description="Haste is a pastebin software" --log="/var/log/$app/$app.log"
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable $app.service --quiet
-#=================================================
-# RESTORE THE LOGROTATE CONFIGURATION
-#=================================================
-ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1
-
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#=================================================
@@ -132,13 +74,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action=start --log_path="/var/log/$app/$app.log"
-#=================================================
-# GENERIC FINALIZATION
-#=================================================
-# RELOAD NGINX
-#=================================================
-ynh_script_progression --message="Reloading NGINX web server..." --weight=1
-
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
diff --git a/scripts/upgrade b/scripts/upgrade
index 86f523a..54b12c9 100755
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -9,38 +9,12 @@
source _common.sh
source /usr/share/yunohost/helpers
-#=================================================
-# LOAD SETTINGS
-#=================================================
-
-app=$YNH_APP_INSTANCE_NAME
-
-domain=$(ynh_app_setting_get --app=$app --key=domain)
-path_url=$(ynh_app_setting_get --app=$app --key=path_url)
-final_path=$(ynh_app_setting_get --app=$app --key=final_path)
-port=$(ynh_app_setting_get --app=$app --key=port)
-data_path=$(ynh_app_setting_get --app=$app --key=data_path)
-
#=================================================
# CHECK VERSION
#=================================================
upgrade_type=$(ynh_check_app_version_changed)
-#=================================================
-# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
-#=================================================
-ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=4
-
-# Backup the current version of the app
-ynh_backup_before_upgrade
-ynh_clean_setup () {
- # restore it if the upgrade fails
- ynh_restore_upgradebackup
-}
-# Exit if an error occurs during the execution of the script
-ynh_abort_if_errors
-
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
@@ -48,41 +22,6 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
-#=================================================
-# ENSURE DOWNWARD COMPATIBILITY
-#=================================================
-ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
-
-# 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 data_path doesn't exist, create it
-if [ -z "$data_path" ]; then
- data_path="/home/yunohost.app/${app}"
- mkdir -p "$data_path"
- ynh_app_setting_set --app=$app --key=data_path --value=$data_path
-fi
-
-# Cleaning legacy permissions
-if ynh_legacy_permissions_exists; then
- ynh_legacy_permissions_delete_all
-
- ynh_app_setting_delete --app=$app --key=is_public
-fi
-
-#=================================================
-# STANDARD UPGRADE STEPS
-#=================================================
-# CREATE DEDICATED USER
-#=================================================
-ynh_script_progression --message="Making sure dedicated system user exists..." --weight=2
-
-# Create a dedicated user (if not existing)
-ynh_system_user_create --username=$app --home_dir="$final_path"
-
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
@@ -92,7 +31,7 @@ then
ynh_script_progression --message="Upgrading source files..." --weight=7
# Download, check integrity, uncompress and patch the source from app.src
- ynh_setup_source --dest_dir="$final_path" --keep="config.js"
+ ynh_setup_source --dest_dir="$install_dir" --keep="config.js"
fi
#=================================================
@@ -117,7 +56,7 @@ ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
#=================================================
ynh_script_progression --message="Installing $app..." --weight=8
-pushd "$final_path"
+pushd "$install_dir"
ynh_use_nodejs
ynh_exec_warn_less $ynh_npm install
popd
@@ -143,16 +82,16 @@ ynh_add_systemd_config
#=================================================
# Replace ajax.googleapis by local file
-cp ../sources/jquery.min.js "$final_path/static/jquery.min.js"
+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="$final_path/static/index.html"
+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"
#=================================================
# UPGRADE HASTE BINARY
#=================================================
ynh_script_progression --message="Updating a configuration file..." --weight=1
-haste_url="${domain}${path_url}"
+haste_url="${domain}${path}"
ynh_add_config --template="../conf/haste.sh" --destination="/usr/bin/$app"
#=================================================
@@ -161,9 +100,9 @@ ynh_add_config --template="../conf/haste.sh" --destination="/usr/bin/$app"
# SECURE FILES AND DIRECTORIES
#=================================================
-chmod 750 "$final_path"
-chmod -R o-rwx "$final_path"
-chown -R $app:www-data "$final_path"
+chmod 750 "$install_dir"
+chmod -R o-rwx "$install_dir"
+chown -R $app:www-data "$install_dir"
chmod +x /usr/bin/$app
#=================================================
@@ -180,13 +119,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action=start --log_path="/var/log/$app/$app.log"
-#=================================================
-# RELOAD NGINX
-#=================================================
-ynh_script_progression --message="Reloading NGINX web server..." --weight=1
-
-ynh_systemd_action --service_name=nginx --action=reload
-
#=================================================
# END OF SCRIPT
#=================================================
diff --git a/tests.toml b/tests.toml
new file mode 100644
index 0000000..307d66b
--- /dev/null
+++ b/tests.toml
@@ -0,0 +1,9 @@
+test_format = 1.0
+
+[default]
+
+ # -------------------------------
+ # Commits to test upgrade from
+ # -------------------------------
+
+ test_upgrade_from.0ea46c37.name = "Upgrade from #33"
\ No newline at end of file