1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/distbin_ynh.git synced 2024-09-03 18:26:10 +02:00

Applying example_ynh

This commit is contained in:
yalh76 2019-12-29 22:58:21 +01:00
parent 9c37d1d8de
commit 00d62f1424
6 changed files with 16 additions and 8 deletions

View file

@ -13,6 +13,7 @@ source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_print_info --message="Managing script failure..."
ynh_clean_setup () {
ynh_clean_check_starting

View file

@ -33,7 +33,6 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#db_user=$db_name
#db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
port=$(ynh_app_setting_get --app=$app --key=port)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
@ -143,8 +142,10 @@ ynh_store_file_checksum --file="$config"
#=================================================
ynh_print_info --message="Starting a systemd service..."
ynh_systemd_action --action=start --service_name=$app --log_path=systemd --line_match="Started Distbin 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
#=================================================
# RELOAD NGINX

View file

@ -12,6 +12,7 @@ source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_print_info --message="Managing script failure..."
ynh_clean_setup () {
ynh_clean_check_starting
@ -22,6 +23,7 @@ ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
ynh_print_info --message="Retrieving arguments from the manifest..."
domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
@ -194,7 +196,7 @@ ynh_use_logrotate
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_print_info --message="Integrate service in YunoHost..."
ynh_print_info --message="Integrating service in YunoHost..."
yunohost service add $app --description "$app daemon for distbin" --log "/var/log/$app/$app.log"

View file

@ -25,6 +25,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
# REMOVE SERVICE INTEGRATION IN YUNOHOST
#=================================================
ynh_print_info --message="Removing service integration in YunoHost..."
# 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

View file

@ -13,6 +13,7 @@ source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_print_info --message="Managing script failure..."
ynh_clean_setup () {
ynh_clean_check_starting
@ -67,7 +68,7 @@ ynh_system_user_create --username=$app --home_dir=$final_path
#=================================================
# RESTORE USER RIGHTS
#=================================================
ynh_print_info --message="Securing files and directories..."
ynh_print_info --message="Restoring user rights..."
# Restore permissions on app files
chown -R "$app":"$app" "$final_path"
@ -102,9 +103,9 @@ systemctl enable $app.service
#=================================================
# 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

View file

@ -98,8 +98,9 @@ ynh_add_nginx_config
#=================================================
ynh_print_info --message="Upgrading dependencies..."
ynh_install_app_dependencies $pkg_dependencies
ynh_remove_nodejs
ynh_install_nodejs --nodejs_version="10"
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE DEDICATED USER
@ -136,6 +137,7 @@ fi
ynh_print_info --message="Making upgrade..."
chown -R "$app":"$app" "$final_path"
pushd $final_path
ynh_use_nodejs
sudo -u $app env PATH=$PATH npm install --ignore-scripts