From b80ee8b347bd0f723e7aa63574e4d30618cb605f Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Thu, 5 Oct 2023 19:00:56 +0200 Subject: [PATCH] Cleanup the whole stuff with .tpl file ... we don't need to copy them to intermediate locations, nor to backup/restore them... --- conf/{dnsmasq_dhcpdv4.conf.tpl => dnsmasq_dhcpdv4.conf} | 0 conf/{dnsmasq_dhcpdv6.conf.tpl => dnsmasq_dhcpdv6.conf} | 0 conf/{hostapd.conf.tpl => hostapd.conf} | 0 scripts/_common.sh | 6 +++--- scripts/backup | 7 ------- scripts/install | 4 ---- scripts/restore | 5 ----- scripts/upgrade | 4 ---- 8 files changed, 3 insertions(+), 23 deletions(-) rename conf/{dnsmasq_dhcpdv4.conf.tpl => dnsmasq_dhcpdv4.conf} (100%) rename conf/{dnsmasq_dhcpdv6.conf.tpl => dnsmasq_dhcpdv6.conf} (100%) rename conf/{hostapd.conf.tpl => hostapd.conf} (100%) diff --git a/conf/dnsmasq_dhcpdv4.conf.tpl b/conf/dnsmasq_dhcpdv4.conf similarity index 100% rename from conf/dnsmasq_dhcpdv4.conf.tpl rename to conf/dnsmasq_dhcpdv4.conf diff --git a/conf/dnsmasq_dhcpdv6.conf.tpl b/conf/dnsmasq_dhcpdv6.conf similarity index 100% rename from conf/dnsmasq_dhcpdv6.conf.tpl rename to conf/dnsmasq_dhcpdv6.conf diff --git a/conf/hostapd.conf.tpl b/conf/hostapd.conf similarity index 100% rename from conf/hostapd.conf.tpl rename to conf/hostapd.conf diff --git a/scripts/_common.sh b/scripts/_common.sh index 8d1c20d..c67cc0e 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -80,14 +80,14 @@ function configure_hostapd() sec_comment="#" fi - ynh_add_config --template="/etc/hostapd/$app/hostapd.conf.tpl" --destination="/etc/hostapd/$app/hostapd.conf" + ynh_add_config --template="../conf/hostapd.conf" --destination="/etc/hostapd/$app/hostapd.conf" } function configure_dhcp() { - ynh_add_config --template="/etc/dnsmasq.$app/dhcpdv4.conf.tpl" --destination="/etc/dnsmasq.$app/dhcpdv4.conf" + ynh_add_config --template="../conf/dhcpdv4.conf" --destination="/etc/dnsmasq.$app/dhcpdv4.conf" if [[ -n "${ip6_net}" ]] && [[ "${ip6_net}" != "none" ]]; then - ynh_add_config --template="/etc/dnsmasq.$app/dhcpdv6.conf.tpl" --destination="/etc/dnsmasq.$app/dhcpdv6.conf" + ynh_add_config --template="../conf/dhcpdv6.conf" --destination="/etc/dnsmasq.$app/dhcpdv6.conf" fi } diff --git a/scripts/backup b/scripts/backup index a3dbd5e..ce94889 100644 --- a/scripts/backup +++ b/scripts/backup @@ -40,15 +40,8 @@ ynh_print_info --message="Declaring files to be backed up..." # BACKUP THE APP MAIN DIR #================================================= -ynh_backup --src_path="/etc/hostapd/$app/hostapd.conf.tpl" ynh_backup --src_path="/etc/hostapd/$app/hostapd.conf" --not_mandatory - -ynh_backup --src_path="/etc/dnsmasq.d/$app.conf" --not_mandatory - -ynh_backup --src_path="/etc/dnsmasq.$app/dhcpdv6.conf.tpl" ynh_backup --src_path="/etc/dnsmasq.$app/dhcpdv6.conf" --not_mandatory - -ynh_backup --src_path="/etc/dnsmasq.$app/dhcpdv4.conf.tpl" ynh_backup --src_path="/etc/dnsmasq.$app/dhcpdv4.conf" --not_mandatory ynh_backup --src_path="/usr/local/bin/$service_name" diff --git a/scripts/install b/scripts/install index 8dfe28a..ff45235 100644 --- a/scripts/install +++ b/scripts/install @@ -161,10 +161,6 @@ chown root: /etc/hostapd/$app/ mkdir -pm 0755 /etc/dnsmasq.$app/ chown root: /etc/dnsmasq.$app/ -install -b -o root -g root -m 0644 ../conf/hostapd.conf.tpl /etc/hostapd/$app/hostapd.conf.tpl -install -b -o root -g root -m 0644 ../conf/dnsmasq_dhcpdv6.conf.tpl /etc/dnsmasq.$app/dhcpdv6.conf.tpl -install -b -o root -g root -m 0644 ../conf/dnsmasq_dhcpdv4.conf.tpl /etc/dnsmasq.$app/dhcpdv4.conf.tpl - # Copy init script ynh_add_config --template="../conf/ynh-hotspot" --destination="/usr/local/bin/$service_name" chmod 0755 "/usr/local/bin/$service_name" diff --git a/scripts/restore b/scripts/restore index 807a336..8510bc7 100644 --- a/scripts/restore +++ b/scripts/restore @@ -71,13 +71,8 @@ else pkg_dependencies="$pkg_dependencies $free_firmware_packages" fi -ynh_restore_file --origin_path="/etc/hostapd/$app/hostapd.conf.tpl" ynh_restore_file --origin_path="/etc/hostapd/$app/hostapd.conf" --not_mandatory - -ynh_restore_file --origin_path="/etc/dnsmasq.$app/dhcpdv6.conf.tpl" ynh_restore_file --origin_path="/etc/dnsmasq.$app/dhcpdv6.conf" --not_mandatory - -ynh_restore_file --origin_path="/etc/dnsmasq.$app/dhcpdv4.conf.tpl" ynh_restore_file --origin_path="/etc/dnsmasq.$app/dhcpdv4.conf" --not_mandatory ynh_restore_file --origin_path="/usr/local/bin/$service_name" diff --git a/scripts/upgrade b/scripts/upgrade index 8826961..a64ab4d 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -213,10 +213,6 @@ chown root: /etc/hostapd/$app/ mkdir -pm 0755 /etc/dnsmasq.$app/ chown root: /etc/dnsmasq.$app/ -install -b -o root -g root -m 0644 ../conf/hostapd.conf.tpl /etc/hostapd/$app/hostapd.conf.tpl -install -b -o root -g root -m 0644 ../conf/dnsmasq_dhcpdv6.conf.tpl /etc/dnsmasq.$app/dhcpdv6.conf.tpl -install -b -o root -g root -m 0644 ../conf/dnsmasq_dhcpdv4.conf.tpl /etc/dnsmasq.$app/dhcpdv4.conf.tpl - if [[ -n "${wifi_device}" ]]; then configure_hostapd configure_dhcp