mirror of
https://github.com/YunoHost-Apps/distbin_ynh.git
synced 2024-09-03 18:26:10 +02:00
commit
0dda384e84
9 changed files with 114 additions and 74 deletions
|
@ -23,7 +23,7 @@ A networked place to store posted web documents. This is meant to allow for dist
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
No configuration parameter available for now.
|
No configuration parameters available for now.
|
||||||
|
|
||||||
## YunoHost specific features
|
## YunoHost specific features
|
||||||
|
|
||||||
|
@ -37,17 +37,16 @@ The app can be used by multiple users, anonymously.
|
||||||
|
|
||||||
* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/distbin%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/distbin/)
|
* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/distbin%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/distbin/)
|
||||||
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/distbin%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/distbin/)
|
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/distbin%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/distbin/)
|
||||||
* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/ci/logs/distbin%20%28Apps%29.svg)](https://ci-stretch.nohost.me/ci/apps/distbin/)
|
|
||||||
|
|
||||||
## Limitations
|
## Limitations
|
||||||
|
|
||||||
* No known limitations. But still developping.
|
* No known limitations.
|
||||||
|
|
||||||
## Links
|
## Links
|
||||||
|
|
||||||
* Report a bug: https://github.com/YunoHost-Apps/distbin_ynh/issues
|
* Report a bug: https://github.com/YunoHost-Apps/distbin_ynh/issues
|
||||||
* App website: https://distbin.com/about
|
* App website: https://distbin.com/about
|
||||||
* GitHub website: https://github.com/gobengo/distbin
|
* Upstream app repository: https://github.com/gobengo/distbin
|
||||||
* YunoHost website: https://yunohost.org/
|
* YunoHost website: https://yunohost.org/
|
||||||
|
|
||||||
---
|
---
|
||||||
|
@ -55,7 +54,6 @@ The app can be used by multiple users, anonymously.
|
||||||
Developers info
|
Developers info
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
**Only if you want to use a testing branch for coding, instead of merging directly into master.**
|
|
||||||
Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/distbin_ynh/tree/testing).
|
Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/distbin_ynh/tree/testing).
|
||||||
|
|
||||||
To try the testing branch, please proceed like that.
|
To try the testing branch, please proceed like that.
|
||||||
|
|
|
@ -19,23 +19,13 @@
|
||||||
upgrade=1 from_commit=b01da8e6f8d621a1b9c7aec4b82bbe96c0e7cc03
|
upgrade=1 from_commit=b01da8e6f8d621a1b9c7aec4b82bbe96c0e7cc03
|
||||||
backup_restore=1
|
backup_restore=1
|
||||||
multi_instance=1
|
multi_instance=1
|
||||||
incorrect_path=1
|
# This test is no longer necessary since the version 2.7 (PR: https://github.com/YunoHost/yunohost/pull/304), you can still do it if your app could be installed with this version.
|
||||||
|
# incorrect_path=1
|
||||||
port_already_use=0
|
port_already_use=0
|
||||||
change_url=1
|
change_url=1
|
||||||
;;; Levels
|
;;; Levels
|
||||||
Level 1=auto
|
# If the level 5 (Package linter) is forced to 1. Please add justifications here.
|
||||||
Level 2=auto
|
|
||||||
Level 3=auto
|
|
||||||
# Level 4: If the app supports LDAP and SSOwat, turn level 4 to '1' and add a link to an issue or a part of your code to show it.
|
|
||||||
# If the app does not use LDAP nor SSOwat, and can't use them, turn level 4 to 'na' and explain as well.
|
|
||||||
# https://github.com/YunoHost-Apps/distbin_ynh/issues/18
|
|
||||||
Level 4=na
|
|
||||||
Level 5=auto
|
Level 5=auto
|
||||||
Level 6=auto
|
|
||||||
Level 7=auto
|
|
||||||
Level 8=0
|
|
||||||
Level 9=0
|
|
||||||
Level 10=0
|
|
||||||
;;; Options
|
;;; Options
|
||||||
Email=yalh@yahoo.com
|
Email=yalh@yahoo.com
|
||||||
Notification=all
|
Notification=all
|
||||||
|
|
|
@ -11,13 +11,8 @@
|
||||||
- [ ] Upgrade from last version tested.
|
- [ ] Upgrade from last version tested.
|
||||||
- [ ] Can be reviewed and tested.
|
- [ ] Can be reviewed and tested.
|
||||||
|
|
||||||
## Validation
|
## Package_check results
|
||||||
---
|
---
|
||||||
- [ ] **Code review**
|
*If you have access to [App Continuous Integration for packagers](https://yunohost.org/#/packaging_apps_ci) you can provide a link to the package_check results like below, replacing '-NUM-' in this link by the PR number and USERNAME by your username on the ci-apps-dev. Or you provide a screenshot or a pastebin of the results*
|
||||||
- [ ] **Approval (LGTM)**
|
|
||||||
*Code review and approval have to be from a member of @YunoHost/apps group*
|
[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/distbin_ynh%20PR-NUM-%20(USERNAME)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/distbin_ynh%20PR-NUM-%20(USERNAME)/)
|
||||||
- **CI succeeded** :
|
|
||||||
[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/distbin_ynh%20-BRANCH-/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/distbin_ynh%20-BRANCH-/)
|
|
||||||
*Please replace '-BRANCH-' in this link by the name of the branch used.*
|
|
||||||
*If the PR is from a forked repository. Please provide public results from package_check.*
|
|
||||||
When the PR is marked as ready to merge, you have to wait for 3 days before really merging it.
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# MANAGE SCRIPT FAILURE
|
# MANAGE SCRIPT FAILURE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info --message="Managing script failure..."
|
||||||
|
|
||||||
ynh_clean_setup () {
|
ynh_clean_setup () {
|
||||||
ynh_clean_check_starting
|
ynh_clean_check_starting
|
||||||
|
@ -32,6 +33,13 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD BACKUP STEPS
|
# STANDARD BACKUP STEPS
|
||||||
|
#=================================================
|
||||||
|
# STOP SYSTEMD SERVICE
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info --message="Stopping a systemd service..."
|
||||||
|
|
||||||
|
ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped Distbin Service"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE APP MAIN DIR
|
# BACKUP THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -62,6 +70,16 @@ ynh_print_info --message="Backing up systemd configuration..."
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# START SYSTEMD SERVICE
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info --message="Starting a systemd service..."
|
||||||
|
|
||||||
|
ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Started Distbin Service"
|
||||||
|
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then
|
||||||
|
sleep 60
|
||||||
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -35,6 +35,23 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
#db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
|
#db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
|
||||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info --message="Backing up the app before changing its url (may take a while)..."
|
||||||
|
|
||||||
|
# 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
|
# CHECK WHICH PARTS SHOULD BE CHANGED
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -58,7 +75,7 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info --message="Stopping a systemd service..."
|
ynh_print_info --message="Stopping a systemd service..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action=stop --log_path=systemd --line_match="Stopped Distbin Service"
|
ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped Distbin Service"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY URL IN NGINX CONF
|
# MODIFY URL IN NGINX CONF
|
||||||
|
@ -96,6 +113,9 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info --message="Modifying config file..."
|
ynh_print_info --message="Modifying config file..."
|
||||||
|
|
||||||
|
config="$final_path/.env"
|
||||||
|
ynh_backup_if_checksum_is_different --file="$config"
|
||||||
|
|
||||||
# Change the URL in the configuration file
|
# Change the URL in the configuration file
|
||||||
|
|
||||||
if [ "$new_path" == "/" ]
|
if [ "$new_path" == "/" ]
|
||||||
|
@ -105,16 +125,16 @@ else
|
||||||
new_domain_uri="$new_domain$new_path"
|
new_domain_uri="$new_domain$new_path"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ynh_replace_string --match_string="EXTERNAL_URL=.*" --replace_string="EXTERNAL_URL=https://$new_domain_uri/" --target_file="$final_path/.env"
|
ynh_replace_string --match_string="EXTERNAL_URL=.*" --replace_string="EXTERNAL_URL=https://$new_domain_uri/" --target_file="$config"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE THE CONFIG FILE CHECKSUM
|
# STORE THE CONFIG FILE CHECKSUM
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info --message="Storing the config file checksum..."
|
ynh_print_info --message="Storing the config file checksum..."
|
||||||
|
|
||||||
ynh_backup_if_checksum_is_different --file="$final_path/.env"
|
|
||||||
# Recalculate and store the checksum of the file for the next upgrade.
|
# Recalculate and store the checksum of the file for the next upgrade.
|
||||||
ynh_store_file_checksum --file="$final_path/.env"
|
ynh_store_file_checksum --file="$config"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALISATION
|
# GENERIC FINALISATION
|
||||||
|
@ -123,15 +143,17 @@ ynh_store_file_checksum --file="$final_path/.env"
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info --message="Starting a systemd service..."
|
ynh_print_info --message="Starting a systemd service..."
|
||||||
|
|
||||||
ynh_systemd_action --action=start --service_name=$app --log_path=systemd --line_match="Started Distbin Service"
|
ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Started Distbin Service"
|
||||||
sleep 10
|
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then
|
||||||
|
sleep 60
|
||||||
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info --message="Reloading nginx web server..."
|
ynh_print_info --message="Reloading nginx web server..."
|
||||||
|
|
||||||
systemctl reload nginx
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
|
|
|
@ -12,6 +12,7 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# MANAGE SCRIPT FAILURE
|
# MANAGE SCRIPT FAILURE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info --message="Managing script failure..."
|
||||||
|
|
||||||
ynh_clean_setup () {
|
ynh_clean_setup () {
|
||||||
ynh_clean_check_starting
|
ynh_clean_check_starting
|
||||||
|
@ -22,6 +23,7 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info --message="Retrieving arguments from the manifest..."
|
||||||
|
|
||||||
domain=$YNH_APP_ARG_DOMAIN
|
domain=$YNH_APP_ARG_DOMAIN
|
||||||
path_url=$YNH_APP_ARG_PATH
|
path_url=$YNH_APP_ARG_PATH
|
||||||
|
@ -56,10 +58,17 @@ ynh_app_setting_set --app=$app --key=is_public --value=$is_public
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info --message="Configuring firewall..."
|
ynh_print_info --message="Configuring firewall..."
|
||||||
|
|
||||||
# Find a free port
|
# Find an available port
|
||||||
port=$(ynh_find_port --port=8095)
|
port=$(ynh_find_port --port=8095)
|
||||||
ynh_app_setting_set --app=$app --key=port --value=$port
|
ynh_app_setting_set --app=$app --key=port --value=$port
|
||||||
|
|
||||||
|
# Optional: Expose this port publicly
|
||||||
|
# (N.B. : you only need to do this if the app actually needs to expose the port publicly.
|
||||||
|
# If you do this and the app doesn't actually need you are CREATING SECURITY HOLES IN THE SERVER !)
|
||||||
|
|
||||||
|
# Open the port
|
||||||
|
# ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $port
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL DEPENDENCIES
|
# INSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -143,7 +152,8 @@ ynh_add_systemd_config
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info --message="Modifying a config file..."
|
ynh_print_info --message="Modifying a config file..."
|
||||||
|
|
||||||
cp "../conf/.env" "$final_path/.env"
|
config="$final_path/.env"
|
||||||
|
cp "../conf/.env" "$config"
|
||||||
|
|
||||||
if [ "$path_url" == "/" ]
|
if [ "$path_url" == "/" ]
|
||||||
then
|
then
|
||||||
|
@ -152,10 +162,10 @@ else
|
||||||
domain_uri="$domain$path_url"
|
domain_uri="$domain$path_url"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ynh_replace_string --match_string="__NODEJS_PATH__" --replace_string="$nodejs_path" --target_file="$final_path/.env"
|
ynh_replace_string --match_string="__NODEJS_PATH__" --replace_string="$nodejs_path" --target_file="$config"
|
||||||
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/.env"
|
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$config"
|
||||||
ynh_replace_string --match_string="__DOMAIN_URI__" --replace_string="$domain_uri" --target_file="$final_path/.env"
|
ynh_replace_string --match_string="__DOMAIN_URI__" --replace_string="$domain_uri" --target_file="$config"
|
||||||
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$final_path/.env"
|
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$config"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE THE CONFIG FILE CHECKSUM
|
# STORE THE CONFIG FILE CHECKSUM
|
||||||
|
@ -163,7 +173,7 @@ ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path"
|
||||||
ynh_print_info --message="Storing the config file checksum..."
|
ynh_print_info --message="Storing the config file checksum..."
|
||||||
|
|
||||||
# Calculate and store the config file checksum into the app settings
|
# Calculate and store the config file checksum into the app settings
|
||||||
ynh_store_file_checksum --file="$final_path/.env"
|
ynh_store_file_checksum --file="$config"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
|
@ -184,12 +194,10 @@ ynh_print_info --message="Configuring log rotation..."
|
||||||
ynh_use_logrotate
|
ynh_use_logrotate
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
# INTEGRATE SERVICE IN YUNOHOST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info --message="Advertising service in admin panel..."
|
ynh_print_info --message="Integrating service in YunoHost..."
|
||||||
|
|
||||||
#yunohost service add $app --log "/var/log/$app/$app.log"
|
|
||||||
# if using yunohost version 3.2 or more in the 'manifest.json', a description can be added
|
|
||||||
yunohost service add $app --description "$app daemon for distbin" --log "/var/log/$app/$app.log"
|
yunohost service add $app --description "$app daemon for distbin" --log "/var/log/$app/$app.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -197,8 +205,11 @@ yunohost service add $app --description "$app daemon for distbin" --log "/var/lo
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info --message="Starting a systemd service..."
|
ynh_print_info --message="Starting a systemd service..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="Started Distbin Service"
|
# Start a systemd service
|
||||||
sleep 10
|
ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Started Distbin Service"
|
||||||
|
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then
|
||||||
|
sleep 60
|
||||||
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
|
|
|
@ -23,11 +23,12 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD REMOVE
|
# STANDARD REMOVE
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE SERVICE FROM ADMIN PANEL
|
# REMOVE SERVICE INTEGRATION IN YUNOHOST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info --message="Removing service integration in YunoHost..."
|
||||||
|
|
||||||
# Remove a service from the admin panel, added by `yunohost service add`
|
# Remove the service from the list of services known by Yunohost (added from `yunohost service add`)
|
||||||
if yunohost service status $app >/dev/null 2>&1
|
if ynh_exec_warn_less yunohost service status $app >/dev/null
|
||||||
then
|
then
|
||||||
ynh_print_info --message="Removing $app service..."
|
ynh_print_info --message="Removing $app service..."
|
||||||
yunohost service remove $app
|
yunohost service remove $app
|
||||||
|
@ -87,7 +88,7 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC REMOVE
|
# SPECIFIC REMOVE
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE FILE
|
# REMOVE THE LOG FILES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Remove the log files
|
# Remove the log files
|
||||||
|
|
|
@ -8,12 +8,12 @@
|
||||||
|
|
||||||
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source ../settings/scripts/ynh_systemd_action
|
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MANAGE SCRIPT FAILURE
|
# MANAGE SCRIPT FAILURE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info --message="Managing script failure..."
|
||||||
|
|
||||||
ynh_clean_setup () {
|
ynh_clean_setup () {
|
||||||
ynh_clean_check_starting
|
ynh_clean_check_starting
|
||||||
|
@ -68,7 +68,7 @@ ynh_system_user_create --username=$app --home_dir=$final_path
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE USER RIGHTS
|
# RESTORE USER RIGHTS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info --message="Securing files and directories..."
|
ynh_print_info --message="Restoring user rights..."
|
||||||
|
|
||||||
# Restore permissions on app files
|
# Restore permissions on app files
|
||||||
chown -R "$app":"$app" "$final_path"
|
chown -R "$app":"$app" "$final_path"
|
||||||
|
@ -99,22 +99,23 @@ ynh_print_info --message="Restoring the systemd configuration..."
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
||||||
systemctl enable $app.service
|
systemctl enable $app.service
|
||||||
systemctl daemon-reload
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
# INTEGRATE SERVICE IN YUNOHOST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info --message="Advertising service in admin panel..."
|
ynh_print_info --message="Integrating service in YunoHost..."
|
||||||
|
|
||||||
yunohost service add $app --log "/var/log/$app/$app.log"
|
yunohost service add $app --description "$app daemon for distbin" --log "/var/log/$app/$app.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info --message="Starting a systemd service..."
|
ynh_print_info --message="Starting a systemd service..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="Started Distbin Service"
|
ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Started Distbin Service"
|
||||||
sleep 10
|
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then
|
||||||
|
sleep 60
|
||||||
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE LOGROTATE CONFIGURATION
|
# RESTORE THE LOGROTATE CONFIGURATION
|
||||||
|
|
|
@ -70,17 +70,16 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info --message="Stopping a systemd service..."
|
ynh_print_info --message="Stopping a systemd service..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action=stop
|
ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped Distbin Service"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info --message="Upgrading source files..."
|
ynh_print_info --message="Upgrading source files..."
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src#
|
|
||||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Upgrading source files..." --time --weight=1
|
ynh_print_info --message="Upgrading source files..."
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# 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"
|
||||||
|
@ -99,8 +98,9 @@ ynh_add_nginx_config
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info --message="Upgrading dependencies..."
|
ynh_print_info --message="Upgrading dependencies..."
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
ynh_remove_nodejs
|
||||||
ynh_install_nodejs --nodejs_version="10"
|
ynh_install_nodejs --nodejs_version="10"
|
||||||
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
|
@ -132,11 +132,12 @@ if [ -d "$DIRECTORY" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MAKE INSTALL
|
# MAKE UPGRADE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info --message="Making install..."
|
ynh_print_info --message="Making upgrade..."
|
||||||
|
|
||||||
chown -R "$app":"$app" "$final_path"
|
chown -R "$app":"$app" "$final_path"
|
||||||
|
|
||||||
pushd $final_path
|
pushd $final_path
|
||||||
ynh_use_nodejs
|
ynh_use_nodejs
|
||||||
sudo -u $app env PATH=$PATH npm install --ignore-scripts
|
sudo -u $app env PATH=$PATH npm install --ignore-scripts
|
||||||
|
@ -153,7 +154,9 @@ popd
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info --message="Modifying config file..."
|
ynh_print_info --message="Modifying config file..."
|
||||||
|
|
||||||
cp "../conf/.env" "$final_path/.env"
|
config="$final_path/.env"
|
||||||
|
ynh_backup_if_checksum_is_different --file="$config"
|
||||||
|
cp -f "../conf/.env" "$config"
|
||||||
|
|
||||||
if [ "$path_url" == "/" ]
|
if [ "$path_url" == "/" ]
|
||||||
then
|
then
|
||||||
|
@ -162,19 +165,18 @@ else
|
||||||
domain_uri="$domain$path_url"
|
domain_uri="$domain$path_url"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ynh_replace_string --match_string="__NODEJS_PATH__" --replace_string="$nodejs_path" --target_file="$final_path/.env"
|
ynh_replace_string --match_string="__NODEJS_PATH__" --replace_string="$nodejs_path" --target_file="$config"
|
||||||
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/.env"
|
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$config"
|
||||||
ynh_replace_string --match_string="__DOMAIN_URI__" --replace_string="$domain_uri" --target_file="$final_path/.env"
|
ynh_replace_string --match_string="__DOMAIN_URI__" --replace_string="$domain_uri" --target_file="$config"
|
||||||
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$final_path/.env"
|
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$config"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE THE CONFIG FILE CHECKSUM
|
# STORE THE CONFIG FILE CHECKSUM
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info --message="Storing the config file checksum..."
|
ynh_print_info --message="Storing the config file checksum..."
|
||||||
|
|
||||||
ynh_backup_if_checksum_is_different --file="$final_path/.env"
|
|
||||||
# Recalculate and store the checksum of the file for the next upgrade.
|
# Recalculate and store the checksum of the file for the next upgrade.
|
||||||
ynh_store_file_checksum --file="$final_path/.env"
|
ynh_store_file_checksum --file="$config"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP LOGROTATE
|
# SETUP LOGROTATE
|
||||||
|
@ -219,8 +221,10 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info --message="Starting a systemd service..."
|
ynh_print_info --message="Starting a systemd service..."
|
||||||
|
|
||||||
ynh_systemd_action --action=start --service_name=$app --log_path=systemd --line_match="Started Distbin Service"
|
ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Started Distbin Service"
|
||||||
sleep 10
|
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then
|
||||||
|
sleep 60
|
||||||
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
|
|
Loading…
Reference in a new issue