1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/watchdog_ynh.git synced 2024-06-22 05:42:53 +02:00

Coding style, apply template

This commit is contained in:
Salamandar 2024-06-20 23:46:10 +02:00
parent 8dfb567892
commit 495932cd93
6 changed files with 23 additions and 50 deletions

View file

@ -1,3 +1,5 @@
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json
packaging_format = 2
id = "watchdog"
@ -30,4 +32,4 @@ ram.runtime = "50M"
[resources]
[resources.apt]
packages = "watchdog"
packages = ["watchdog"]

View file

@ -18,6 +18,10 @@ ynh_print_info --message="Declaring files to be backed up..."
ynh_backup --src_path="/etc/watchdog.conf"
# Remove other various files specific to the app... such as :
ynh_backup --src_path="/var/log/$app"
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -1,7 +1,5 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
@ -28,28 +26,19 @@ if [[ $(grep -ic "Raspberry Pi" /proc/cpuinfo) -ge 1 && $(grep -ic "dtparam=watc
echo "dtparam=watchdog=on" >> /boot/config.txt
fi
yunohost service add $app
#=================================================
# APP INITIAL CONFIGURATION
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding app's configuration file..."
ynh_add_config --template="watchdog.conf" --destination="/etc/watchdog.conf"
chmod 400 "/etc/watchdog.conf"
chown root: "/etc/watchdog.conf"
systemctl enable "$app.service" --quiet
yunohost service add "$app"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting app's systemd service..."
# Enable and start a systemd service
systemctl enable $app.service --quiet
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd"
#=================================================
# END OF SCRIPT

View file

@ -1,35 +1,25 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# REMOVE SYSTEM CONFIGURATIONS
#=================================================
# REMOVE SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Removing system configurations related to $app..."
# 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 integration..."
yunohost service remove $app
if ynh_exec_warn_less yunohost service status $app >/dev/null; then
yunohost service remove "$app"
fi
ynh_remove_systemd_config
ynh_remove_nginx_config
# Remove other various files specific to the app... such as :
ynh_secure_remove --file="/var/log/$app"
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -1,7 +1,5 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
@ -17,12 +15,11 @@ ynh_script_progression --message="Restoring system configurations related to $ap
ynh_restore_file --origin_path="/etc/watchdog.conf"
systemctl enable $app.service --quiet
systemctl enable "$app.service" --quiet
yunohost service add "$app"
yunohost service add $app
ynh_restore_file --origin_path="/var/log/$app"
#=================================================
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
#=================================================

View file

@ -1,7 +1,5 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
@ -21,26 +19,19 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
#=================================================
ynh_script_progression --message="Upgrading system configurations related to $app..."
yunohost service add $app
#=================================================
# RECONFIGURE THE APP (UPDATE CONF, APPLY MIGRATIONS...)
#=================================================
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression --message="Updating a configuration file..."
ynh_add_config --template="watchdog.conf" --destination="/etc/watchdog.conf"
chmod 400 "/etc/watchdog.conf"
chown root: "/etc/watchdog.conf"
systemctl enable "$app.service" --quiet
yunohost service add "$app"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..."
ynh_script_progression --message="Starting $app's systemd service..."
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd"
#=================================================
# END OF SCRIPT