1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/ztncui_ynh.git synced 2024-09-03 18:06:05 +02:00

[enh] prepare systemd conf and check for zerotier app or die

Co-Authored-By: Kayou <kay0u@users.noreply.github.com>
This commit is contained in:
tituspijean 2020-04-18 12:42:51 +02:00
parent 04bdc45749
commit 772480a9af
3 changed files with 13 additions and 15 deletions

View file

@ -6,8 +6,8 @@ After=network.target
Type=simple
User=ztncui
Group=ztncui
Environment="PATH=__ENV_PATH__"
WorkingDirectory=__FINALPATH__/src/
Environment="PATH=__PATH__"
WorkingDirectory=__FINAL_PATH__/src/
ExecStart=__NODEJS_PATH__/npm start
[Install]

View file

@ -54,7 +54,7 @@ app=$YNH_APP_INSTANCE_NAME
ynh_script_progression --message="Validating installation parameters..." --time --weight=1
# Testing if ZeroTier is installed
type zerotier > /dev/null || echo "ZeroTier is needed, but it is not installed. There is a package for that!"
yunohost app list | grep "id: zerotier" || ynh_die "ZeroTier is needed, but it is not installed. There is a package for that!"
### If the app uses nginx as web server (written in HTML/PHP in most cases), the final path should be "/var/www/$app".
### If the app provides an internal web server (or uses another application server such as uwsgi), the final path should be "/opt/yunohost/$app"
@ -202,14 +202,13 @@ ynh_script_progression --message="Configuring a systemd service..." --time --wei
### - As well as the section "RESTORE SYSTEMD" in the restore script
### - And the section "SETUP SYSTEMD" in the upgrade script
# Set the systemd service settings
ynh_replace_string "__PATH__" "$PATH" "../conf/systemd.service"
ynh_replace_string "__NODEJS_PATH__" "$nodejs_path" "../conf/systemd.service"
ynh_replace_string "__FINAL_PATH__" "$final_path" "../conf/systemd.service"
# Create a dedicated systemd config
ynh_add_systemd_config
ynh_replace_string "__ENV_PATH__" "$PATH" "$finalsystemdconf"
ynh_replace_string "__NODEJS_PATH__" "$nodejs_path" "$finalsystemdconf"
ynh_replace_string "__FINALPATH__" "$final_path" "$finalsystemdconf"
ynh_store_file_checksum --file="$finalsystemdconf"
systemctl daemon-reload
#=================================================
# GENERIC FINALIZATION

View file

@ -188,14 +188,13 @@ ynh_use_logrotate --non-append
#=================================================
ynh_script_progression --message="Upgrading systemd configuration..." --time --weight=1
# Set the systemd service settings
ynh_replace_string "__PATH__" "$PATH" "../conf/systemd.service"
ynh_replace_string "__NODEJS_PATH__" "$nodejs_path" "../conf/systemd.service"
ynh_replace_string "__FINAL_PATH__" "$final_path" "../conf/systemd.service"
# Create a dedicated systemd config
ynh_add_systemd_config
ynh_replace_string "__ENV_PATH__" "$PATH" "$finalsystemdconf"
ynh_replace_string "__NODEJS_PATH__" "$nodejs_path" "$finalsystemdconf"
ynh_replace_string "__FINALPATH__" "$final_path" "$finalsystemdconf"
ynh_store_file_checksum --file="$finalsystemdconf"
systemctl daemon-reload
#=================================================
# GENERIC FINALIZATION