1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/hotspot_ynh.git synced 2024-09-03 19:25:53 +02:00

backup, restore & remove config files

This commit is contained in:
HgO 2023-08-21 11:04:39 +02:00
parent ee1f3cd176
commit 676e6d9733
3 changed files with 17 additions and 4 deletions

View file

@ -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"

View file

@ -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

View file

@ -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"