From 676e6d973399f1242491d3bc5462692f574df4f2 Mon Sep 17 00:00:00 2001 From: HgO Date: Mon, 21 Aug 2023 11:04:39 +0200 Subject: [PATCH] backup, restore & remove config files --- scripts/backup | 5 +++++ scripts/remove | 11 +++++++---- scripts/restore | 5 +++++ 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/scripts/backup b/scripts/backup index 793ab93..6dfa463 100644 --- a/scripts/backup +++ b/scripts/backup @@ -30,6 +30,7 @@ app=$YNH_APP_INSTANCE_NAME final_path=$(ynh_app_setting_get --app=$app --key=final_path) firmware_nonfree=$(ynh_app_setting_get --app=$app --key=firmware_nonfree) service_name=$(ynh_app_setting_get --app=$app --key=service_name) +wifi_device=$(ynh_app_setting_get --app=$app --key=wifi_device) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP @@ -41,9 +42,13 @@ ynh_print_info --message="Declaring files to be backed up..." #================================================= ynh_backup --src_path="/etc/hostapd/hostapd.conf" +ynh_backup --src_path="/etc/hostapd/hostapd-${wifi_device}.conf" ynh_backup --src_path="/etc/dnsmasq.dhcpd/dhcpdv6.conf.tpl" +ynh_backup --src_path="/etc/dnsmasq.dhcpd/dhcpdv6-ssid-${wifi_device}.conf" + ynh_backup --src_path="/etc/dnsmasq.dhcpd/dhcpdv4.conf.tpl" +ynh_backup --src_path="/etc/dnsmasq.dhcpd/dhcpdv4-ssid-${wifi_device}.conf" ynh_backup --src_path="/usr/local/bin/$service_name" diff --git a/scripts/remove b/scripts/remove index ae210dd..6510749 100644 --- a/scripts/remove +++ b/scripts/remove @@ -18,6 +18,7 @@ app=$YNH_APP_INSTANCE_NAME firmware_nonfree=$(ynh_app_setting_get --app=$app --key=firmware_nonfree) service_name=$(ynh_app_setting_get --app=$app --key=service_name) +wifi_device=$(ynh_app_setting_get --app=$app --key=wifi_device) #================================================= # STANDARD REMOVE @@ -67,11 +68,13 @@ done # Remove confs ynh_secure_remove --file="/etc/dnsmasq.dhcpd/dhcpdv6.conf.tpl" +ynh_secure_remove --file="/etc/dnsmasq.dhcpd/dhcpdv6-ssid-${wifi_device}.conf" + ynh_secure_remove --file="/etc/dnsmasq.dhcpd/dhcpdv4.conf.tpl" -for FILE in $(ls /etc/hostapd/hostapd.*.conf 2>/dev/null) -do - ynh_secure_remove --file="$FILE" -done +ynh_secure_remove --file="/etc/dnsmasq.dhcpd/dhcpdv4-ssid-${wifi_device}.conf" + +ynh_secure_remove --file="/etc/hostapd/hostapd.conf" +ynh_secure_remove --file="/etc/hostapd/hostapd-${wifi_device}.conf" #================================================= # CLOSE A PORT diff --git a/scripts/restore b/scripts/restore index 4c4ff7e..b4f5fe8 100644 --- a/scripts/restore +++ b/scripts/restore @@ -29,6 +29,7 @@ app=$YNH_APP_INSTANCE_NAME firmware_nonfree=$(ynh_app_setting_get --app=$app --key=firmware_nonfree) service_name=$(ynh_app_setting_get --app=$app --key=service_name) +wifi_device=$(ynh_app_setting_get --app=$app --key=wifi_device) #================================================= # CHECK IF THE APP CAN BE RESTORED @@ -62,9 +63,13 @@ else fi ynh_restore_file --origin_path="/etc/hostapd/hostapd.conf" +ynh_restore_file --origin_path="/etc/hostapd/hostapd-${wifi_device}.conf" ynh_restore_file --origin_path="/etc/dnsmasq.dhcpd/dhcpdv6.conf.tpl" +ynh_restore_file --origin_path="/etc/dnsmasq.dhcpd/dhcpdv6-ssid-${wifi_device}.conf" + ynh_restore_file --origin_path="/etc/dnsmasq.dhcpd/dhcpdv4.conf.tpl" +ynh_restore_file --origin_path="/etc/dnsmasq.dhcpd/dhcpdv4-ssid-${wifi_device}.conf" ynh_restore_file --origin_path="/usr/local/bin/$service_name"