diff --git a/README.md b/README.md index f981532..daf61aa 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ It shall NOT be edited by hand. # Send for YunoHost -[![Integration level](https://dash.yunohost.org/integration/send.svg)](https://dash.yunohost.org/appci/app/send) ![](https://ci-apps.yunohost.org/ci/badges/send.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/send.maintain.svg) +[![Integration level](https://dash.yunohost.org/integration/send.svg)](https://dash.yunohost.org/appci/app/send) ![Working status](https://ci-apps.yunohost.org/ci/badges/send.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/send.maintain.svg) [![Install Send with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=send) *[Lire ce readme en français.](./README_fr.md)* @@ -19,13 +19,13 @@ A fork of Mozilla's Firefox Send. Mozilla discontinued Send, this fork is a comm Send is a file sharing experiment which allows you to send encrypted files to other users. -**Shipped version:** 3.4.18~ynh1 +**Shipped version:** 3.4.20~ynh2 **Demo:** https://send.vis.ee/ ## Screenshots -![](./doc/screenshots/screenshot.png) +![Screenshot of Send](./doc/screenshots/screenshot.png) ## Disclaimers / important information @@ -36,20 +36,21 @@ You can configure things such as the max file size, max downloads, or max file e ## Documentation and resources -* Official app website: https://send.vis.ee/ -* Upstream app code repository: https://github.com/timvisee/send -* YunoHost documentation for this app: https://yunohost.org/app_send -* Report a bug: https://github.com/YunoHost-Apps/send_ynh/issues +* Official app website: +* Upstream app code repository: +* YunoHost documentation for this app: +* Report a bug: ## Developer info Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/send_ynh/tree/testing). To try the testing branch, please proceed like that. -``` + +``` bash sudo yunohost app install https://github.com/YunoHost-Apps/send_ynh/tree/testing --debug or sudo yunohost app upgrade send -u https://github.com/YunoHost-Apps/send_ynh/tree/testing --debug ``` -**More info regarding app packaging:** https://yunohost.org/packaging_apps \ No newline at end of file +**More info regarding app packaging:** diff --git a/README_fr.md b/README_fr.md index 08699bc..5858fb4 100644 --- a/README_fr.md +++ b/README_fr.md @@ -1,10 +1,14 @@ + + # Send pour YunoHost -[![Niveau d'intégration](https://dash.yunohost.org/integration/send.svg)](https://dash.yunohost.org/appci/app/send) ![](https://ci-apps.yunohost.org/ci/badges/send.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/send.maintain.svg) +[![Niveau d'intégration](https://dash.yunohost.org/integration/send.svg)](https://dash.yunohost.org/appci/app/send) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/send.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/send.maintain.svg) [![Installer Send avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=send) *[Read this readme in english.](./README.md)* -*[Lire ce readme en français.](./README_fr.md)* > *Ce package vous permet d'installer Send 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.* @@ -15,13 +19,13 @@ Un fork du Firefox Send de Mozilla. Mozilla a arrêté Send, et ce fork est un e Send est une expérience de partage de fichiers qui permet d'envoyer des fichiers chiffrés à d'autres utilisateurs. -**Version incluse :** 3.4.18~ynh1 +**Version incluse :** 3.4.20~ynh2 **Démo :** https://send.vis.ee/ ## Captures d'écran -![](./doc/screenshots/screenshot.png) +![Capture d'écran de Send](./doc/screenshots/screenshot.png) ## Avertissements / informations importantes @@ -32,20 +36,21 @@ Vous pouvez configurer des paramètres tels que les taille de fichier, nombre de ## Documentations et ressources -* Site officiel de l'app : https://send.vis.ee/ -* Dépôt de code officiel de l'app : https://github.com/timvisee/send -* Documentation YunoHost pour cette app : https://yunohost.org/app_send -* Signaler un bug : https://github.com/YunoHost-Apps/send_ynh/issues +* Site officiel de l'app : +* Dépôt de code officiel de l'app : +* Documentation YunoHost pour cette app : +* Signaler un bug : ## Informations pour les développeurs Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/send_ynh/tree/testing). Pour essayer la branche testing, procédez comme suit. -``` + +``` bash sudo yunohost app install https://github.com/YunoHost-Apps/send_ynh/tree/testing --debug ou sudo yunohost app upgrade send -u https://github.com/YunoHost-Apps/send_ynh/tree/testing --debug ``` -**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps \ No newline at end of file +**Plus d'infos sur le packaging d'applications :** diff --git a/check_process b/check_process index d02340b..b1ea4c6 100644 --- a/check_process +++ b/check_process @@ -10,13 +10,14 @@ setup_private=1 setup_public=1 upgrade=1 + # 3.4.14~ynh1 upgrade=1 from_commit=6e2eba4a9b6b455b35ce9d8e558c454a001bfacf + # 3.4.18~ynh1 + upgrade=1 from_commit=674f8d3211ba98b10f169deea3127a8b378c6c3c backup_restore=1 multi_instance=1 + port_already_use=0 change_url=1 ;;; Options Email= -;;; Upgrade options - ; commit=6e2eba4a9b6b455b35ce9d8e558c454a001bfacf - name=3.4.14 - manifest_arg=domain=DOMAIN&is_public=1& \ No newline at end of file +Notification=none diff --git a/conf/app.src b/conf/app.src index df01f47..3541b63 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,7 @@ -SOURCE_URL=https://github.com/timvisee/send/archive/refs/tags/v3.4.18.tar.gz -SOURCE_SUM=6b7cf37a47a49a6b2518af8dec9d426f65fdd8bfdb27e72b11d5219cf198ae2e +SOURCE_URL=https://github.com/timvisee/send/archive/refs/tags/v3.4.20.tar.gz +SOURCE_SUM=d8b485383f5f2fdca98501e1abdacec158b2eb04a7a8a4dabae2a0d4f542c6e4 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true +SOURCE_FILENAME= +SOURCE_EXTRACT=true diff --git a/conf/config.js b/conf/config.js index f1e57bc..805dae7 100644 --- a/conf/config.js +++ b/conf/config.js @@ -1,8 +1,11 @@ const convict = require('convict'); +const convict_format_with_validator = require('convict-format-with-validator'); const { tmpdir } = require('os'); const path = require('path'); const { randomBytes } = require('crypto'); +convict.addFormats(convict_format_with_validator); + convict.addFormat({ name: 'positive-int-array', coerce: ints => { @@ -239,6 +242,68 @@ const conf = convict({ format: String, default: 'https://github.com/timvisee/send', env: 'SEND_FOOTER_SOURCE_URL' + }, + ui_color_primary: { + format: String, + default: '#0a84ff', + env: 'UI_COLOR_PRIMARY' + }, + ui_color_accent: { + format: String, + default: '#003eaa', + env: 'UI_COLOR_ACCENT' + }, + ui_custom_assets: { + android_chrome_192px: { + format: String, + default: '', + env: 'UI_CUSTOM_ASSETS_ANDROID_CHROME_192PX' + }, + android_chrome_512px: { + format: String, + default: '', + env: 'UI_CUSTOM_ASSETS_ANDROID_CHROME_512PX' + }, + apple_touch_icon: { + format: String, + default: '', + env: 'UI_CUSTOM_ASSETS_APPLE_TOUCH_ICON' + }, + favicon_16px: { + format: String, + default: '', + env: 'UI_CUSTOM_ASSETS_FAVICON_16PX' + }, + favicon_32px: { + format: String, + default: '', + env: 'UI_CUSTOM_ASSETS_FAVICON_32PX' + }, + icon: { + format: String, + default: '', + env: 'UI_CUSTOM_ASSETS_ICON' + }, + safari_pinned_tab: { + format: String, + default: '', + env: 'UI_CUSTOM_ASSETS_SAFARI_PINNED_TAB' + }, + facebook: { + format: String, + default: '', + env: 'UI_CUSTOM_ASSETS_FACEBOOK' + }, + twitter: { + format: String, + default: '', + env: 'UI_CUSTOM_ASSETS_TWITTER' + }, + wordmark: { + format: String, + default: '', + env: 'UI_CUSTOM_ASSETS_WORDMARK' + } } }); diff --git a/doc/.DS_Store b/doc/.DS_Store deleted file mode 100644 index 89d6be5..0000000 Binary files a/doc/.DS_Store and /dev/null differ diff --git a/manifest.json b/manifest.json index 2be226e..b1d7f08 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "File sharing which allows to send encrypted files", "fr": "Partage de fichiers qui permet d'envoyer des fichiers chiffrés" }, - "version": "3.4.18~ynh1", + "version": "3.4.20~ynh2", "url": "https://github.com/timvisee/send", "upstream": { "license": "MPL-2.0", @@ -26,7 +26,7 @@ "nginx" ], "arguments": { - "install" : [ + "install": [ { "name": "domain", "type": "domain" diff --git a/scripts/_common.sh b/scripts/_common.sh index 3dbfaac..a163d36 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,7 +4,10 @@ # COMMON VARIABLES #================================================= -nodejs_version=16 +# dependencies used by the app +pkg_dependencies="redis-server" + +nodejs_version=16.13 #================================================= # PERSONAL HELPERS diff --git a/scripts/backup b/scripts/backup index 09a69f4..65e96c1 100644 --- a/scripts/backup +++ b/scripts/backup @@ -6,6 +6,7 @@ # IMPORT GENERIC HELPERS #================================================= +# 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 @@ -14,7 +15,7 @@ source /usr/share/yunohost/helpers #================================================= ynh_clean_setup () { - ynh_clean_check_starting + true } # Exit if an error occurs during the execution of the script ynh_abort_if_errors @@ -46,12 +47,6 @@ ynh_backup --src_path="$final_path" ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# BACKUP LOGROTATE -#================================================= - -ynh_backup --src_path="/etc/logrotate.d/$app" - #================================================= # BACKUP SYSTEMD #================================================= diff --git a/scripts/change_url b/scripts/change_url index bcde61e..08e6228 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -32,9 +32,9 @@ port=$(ynh_app_setting_get --app=$app --key=port) redis_db=$(ynh_app_setting_get --app=$app --key=redis_db) #================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up $app before changing its URL (may take a while)..." --weight=1 +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 @@ -71,7 +71,7 @@ fi #================================================= 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" +ynh_systemd_action --service_name=$app --action="stop" #================================================= # MODIFY URL IN NGINX CONF @@ -102,6 +102,8 @@ then ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" fi +#================================================= +# SPECIFIC MODIFICATIONS #================================================= # ADD A CONFIGURATION #================================================= diff --git a/scripts/install b/scripts/install index f0d7fc4..5ccc2cd 100644 --- a/scripts/install +++ b/scripts/install @@ -56,7 +56,7 @@ ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_script_progression --message="Finding an available port..." --weight=2 # Find an available port -port=$(ynh_find_port --port=1443) +port=$(ynh_find_port --port=8095) ynh_app_setting_set --app=$app --key=port --value=$port #================================================= @@ -64,9 +64,17 @@ ynh_app_setting_set --app=$app --key=port --value=$port #================================================= ynh_script_progression --message="Installing dependencies..." --weight=20 -# Install Nodejs +ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version +#================================================= +# 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" + #================================================= # CREATE A REDIS DATABASE #================================================= @@ -76,14 +84,6 @@ ynh_script_progression --message="Creating a Redis database..." --weight=5 redis_db=$(ynh_redis_get_free_db) ynh_app_setting_set --app="$app" --key=redis_db --value="$redis_db" -#================================================= -# 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 #================================================= @@ -91,7 +91,7 @@ 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="$final_path" chmod 750 "$final_path" chmod -R o-rwx "$final_path" @@ -106,6 +106,19 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=2 # Create a dedicated NGINX config ynh_add_nginx_config +#================================================= +# SPECIFIC SETUP +#================================================= +# BUILD APP +#================================================= +ynh_script_progression --message="Building app... (this will take some time and resources!)" --weight=20 + +pushd "$final_path" + ynh_use_nodejs + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm run build +popd + #================================================= # ADD A CONFIGURATION #================================================= @@ -114,48 +127,22 @@ ynh_script_progression --message="Adding a configuration file..." --weight=2 ynh_add_config --template="../conf/config.js" --destination="$final_path/server/config.js" chmod 400 "$final_path/server/config.js" -chown $app "$final_path/server/config.js" - -#================================================= -# SPECIFIC SETUP -#============================================== -# INSTALL HEDGEDOC -#============================================== -ynh_script_progression --message="Building $app... (this will take some time and resources!)" --weight=20 - -#pushd "$final_path" -# ynh_use_nodejs -# ynh_exec_warn_less ynh_npm install -# ynh_exec_warn_less ynh_npm run build -#popd - -pushd "$final_path" - ynh_use_nodejs - ynh_exec_warn_less ynh_exec_as $app env "$ynh_node_load_PATH" npm install - ynh_exec_warn_less ynh_exec_as $app env "$ynh_node_load_PATH" npm run build -popd +chown $app: "$final_path/server/config.js" #================================================= # SETUP SYSTEMD #================================================= ynh_script_progression --message="Configuring a systemd service..." --weight=1 +# Create a dedicated systemd config 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 #================================================= ynh_script_progression --message="Integrating service in YunoHost..." -yunohost service add $app --description="Simple, private file sharing" --log="/var/log/$app/$app.log" +yunohost service add $app --description="Simple, private file sharing" #================================================= # START SYSTEMD SERVICE @@ -170,10 +157,12 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" #================================================= ynh_script_progression --message="Configuring permissions..." --weight=1 -# Make app public if necessary or protect it +# Make app public if necessary if [ $is_public -eq 1 ] then - ynh_permission_update --permission "main" --add "visitors" + # Everyone can access the app. + # The "main" permission is automatically created before the install script. + ynh_permission_update --permission="main" --add="visitors" fi ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --auth_header="false" --show_tile="false" --protected="true" diff --git a/scripts/remove b/scripts/remove index 8426f89..c9f2b99 100644 --- a/scripts/remove +++ b/scripts/remove @@ -26,10 +26,10 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) # REMOVE SERVICE INTEGRATION IN YUNOHOST #================================================= -# Remove the service from the list of services known by Yunohost (added from `yunohost service add`) +# Remove the service from the list of services known by YunoHost (added from `yunohost service add`) if ynh_exec_warn_less yunohost service status $app >/dev/null then - ynh_script_progression --message="Removing $app service..." --weight=1 + ynh_script_progression --message="Removing $app service integration..." --weight=1 yunohost service remove $app fi @@ -41,21 +41,6 @@ ynh_script_progression --message="Stopping and removing the systemd service..." # Remove the dedicated systemd config ynh_remove_systemd_config -#================================================= -# REMOVE LOGROTATE CONFIGURATION -#================================================= -ynh_script_progression --message="Removing logrotate configuration..." --weight=1 - -# Remove the app-specific logrotate config -ynh_remove_logrotate - -#================================================= -# REMOVE DEPENDENCIES -#================================================= -ynh_script_progression --message="Removing dependencies..." --weight=1 - -ynh_remove_nodejs - #================================================= # REMOVE THE REDIS DATABASE #================================================= @@ -76,9 +61,18 @@ ynh_secure_remove --file="$final_path" #================================================= ynh_script_progression --message="Removing NGINX web server configuration..." --weight=5 -# Remove the dedicated nginx config +# Remove the dedicated NGINX config ynh_remove_nginx_config +#================================================= +# REMOVE DEPENDENCIES +#================================================= +ynh_script_progression --message="Removing dependencies..." --weight=1 + +# Remove metapackage and its dependencies +ynh_remove_app_dependencies +ynh_remove_nodejs + #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/restore b/scripts/restore index 557566d..bcce26f 100644 --- a/scripts/restore +++ b/scripts/restore @@ -6,6 +6,7 @@ # IMPORT GENERIC HELPERS #================================================= +# 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 @@ -35,17 +36,11 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= ynh_script_progression --message="Validating restoration parameters..." --weight=2 -test ! -d $final_path || ynh_die --message="There is already a directory: $final_path " +test ! -d $final_path \ + || ynh_die --message="There is already a directory: $final_path " #================================================= # STANDARD RESTORATION STEPS -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the NGINX configuration..." - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" - #================================================= # RECREATE THE DEDICATED USER #================================================= @@ -73,9 +68,17 @@ chmod +x "$final_path/server/bin/prod.js" #================================================= ynh_script_progression --message="Reinstalling dependencies..." --weight=7 -# Install Nodejs +# Define and install dependencies +ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version +#================================================= +# RESTORE THE NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Restoring the NGINX configuration..." + +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" + #================================================= # RESTORE SYSTEMD #================================================= @@ -84,19 +87,12 @@ ynh_script_progression --message="Restoring the systemd configuration..." --weig 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" - #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= ynh_script_progression --message="Integrating service in YunoHost..." -yunohost service add $app --description="Simple, private file sharing" --log="/var/log/$app/$app.log" +yunohost service add $app --description="Simple, private file sharing" #================================================= # START SYSTEMD SERVICE diff --git a/scripts/upgrade b/scripts/upgrade index 051eb59..29a1208 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -20,22 +20,25 @@ 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) +redis_db=$(ynh_app_setting_get --app=$app --key=redis_db) #================================================= # CHECK VERSION #================================================= +ynh_script_progression --message="Checking version..." upgrade_type=$(ynh_check_app_version_changed) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up $app before upgrading (may take a while)..." --weight=10 +ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=10 # Backup the current version of the app ynh_backup_before_upgrade ynh_clean_setup () { - # restore it if the upgrade fails + ynh_clean_check_starting + # Restore it if the upgrade fails ynh_restore_upgradebackup } # Exit if an error occurs during the execution of the script @@ -50,6 +53,13 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" +#================================================= +# ENSURE DOWNWARD COMPATIBILITY +#================================================= +ynh_script_progression --message="Ensuring downward compatibility..." + +ynh_remove_logrotate + #================================================= # CREATE DEDICATED USER #================================================= @@ -90,6 +100,14 @@ chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" chmod +x "$final_path/server/bin/prod.js" +#================================================= +# UPGRADE DEPENDENCIES +#================================================= +ynh_script_progression --message="Upgrading dependencies..." --weight=18 + +ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies +ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version + #================================================= # NGINX CONFIGURATION #================================================= @@ -98,53 +116,49 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." - # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# UPGRADE DEPENDENCIES -#================================================= -ynh_script_progression --message="Upgrading dependencies..." --weight=18 - -# Install Nodejs -ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version - #================================================= # SPECIFIC UPGRADE -#================================================ -# INSTALL SEND -#================================================ +#================================================= +# BUILD APP +#================================================= if [ "$upgrade_type" == "UPGRADE_APP" ] then - ynh_script_progression --message="Building $app... (this will take some time and resources!)" --weight=16 + ynh_script_progression --message="Building app... (this will take some time and resources!)" --weight=16 pushd "$final_path" ynh_use_nodejs - ynh_exec_warn_less ynh_exec_as $app env "$ynh_node_load_PATH" npm install - ynh_exec_warn_less ynh_exec_as $app env "$ynh_node_load_PATH" npm run build + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm run build popd fi +#================================================= +# UPDATE A CONFIG FILE +#================================================= +ynh_script_progression --message="Updating a configuration file..." + +ynh_add_config --template="../conf/config.js" --destination="$final_path/server/config.js" + +chmod 400 "$final_path/server/config.js" +chown $app: "$final_path/server/config.js" + #================================================= # SETUP SYSTEMD #================================================= -ynh_script_progression --message="Configuring a systemd service..." --weight=2 +ynh_script_progression --message="Upgrading systemd configuration..." --weight=2 # Create a dedicated systemd config 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 - +# GENERIC FINALIZATION #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= ynh_script_progression --message="Integrating service in YunoHost..." -yunohost service add $app --description="Simple, private file sharing" --log="/var/log/$app/$app.log" +yunohost service add $app --description="Simple, private file sharing" #================================================= # START SYSTEMD SERVICE