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 packaging_format = 2
id = "watchdog" id = "watchdog"
@ -16,7 +18,7 @@ license = "GPL-2.0-or-later"
code = "https://sourceforge.net/projects/watchdog/" code = "https://sourceforge.net/projects/watchdog/"
[integration] [integration]
yunohost = ">= 11.2" yunohost = ">=11.2"
architectures = "all" architectures = "all"
multi_instance = false multi_instance = false
ldap = "not_relevant" ldap = "not_relevant"
@ -30,4 +32,4 @@ ram.runtime = "50M"
[resources] [resources]
[resources.apt] [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" 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 # END OF SCRIPT
#================================================= #=================================================

View file

@ -1,7 +1,5 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#================================================= #=================================================
# IMPORT GENERIC HELPERS # 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 echo "dtparam=watchdog=on" >> /boot/config.txt
fi 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" ynh_add_config --template="watchdog.conf" --destination="/etc/watchdog.conf"
chmod 400 "/etc/watchdog.conf" chmod 400 "/etc/watchdog.conf"
chown root: "/etc/watchdog.conf" chown root: "/etc/watchdog.conf"
systemctl enable "$app.service" --quiet
yunohost service add "$app"
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Starting app's systemd service..." ynh_script_progression --message="Starting app's systemd service..."
# Enable and start a systemd service ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd"
systemctl enable $app.service --quiet
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

View file

@ -1,37 +1,27 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#================================================= #=================================================
# IMPORT GENERIC HELPERS # IMPORT GENERIC HELPERS
#================================================= #=================================================
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# REMOVE SYSTEM CONFIGURATIONS
#================================================= #=================================================
# REMOVE SYSTEMD SERVICE # REMOVE SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Removing system configurations related to $app..." 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`) # 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 if ynh_exec_warn_less yunohost service status $app >/dev/null; then
then yunohost service remove "$app"
ynh_script_progression --message="Removing $app service integration..."
yunohost service remove $app
fi fi
ynh_remove_systemd_config ynh_remove_systemd_config
ynh_remove_nginx_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 # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Removal of $app completed" --last ynh_script_progression --message="Removal of $app completed" --last

View file

@ -1,7 +1,5 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#================================================= #=================================================
# IMPORT GENERIC HELPERS # 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" 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 # RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
#================================================= #=================================================

View file

@ -1,7 +1,5 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#================================================= #=================================================
# IMPORT GENERIC HELPERS # 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..." 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" ynh_add_config --template="watchdog.conf" --destination="/etc/watchdog.conf"
chmod 400 "/etc/watchdog.conf" chmod 400 "/etc/watchdog.conf"
chown root: "/etc/watchdog.conf" chown root: "/etc/watchdog.conf"
systemctl enable "$app.service" --quiet
yunohost service add "$app"
#================================================= #=================================================
# START SYSTEMD SERVICE # 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 # END OF SCRIPT