From b909ba3b9b99ef5ba5ec8b9a5cba45da7726a917 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Tue, 12 Mar 2019 18:17:04 +0100 Subject: [PATCH 1/4] The script miserably crash if the command fails ... better to test the command in the if directly, no need to use $? --- scripts/install | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index c2493d4..059e1e3 100644 --- a/scripts/install +++ b/scripts/install @@ -293,8 +293,7 @@ systemctl reload nginx # Remove IPv6 address set if there is a VPN installed if [[ $ip6_addr != none ]]; then - ip -6 address show dev tun0 2> /dev/null | grep -q "${ip6_addr}/" - if [[ "$?" -eq 0 ]]; then + if ip -6 address show dev tun0 2> /dev/null | grep -q "${ip6_addr}/"; then ip address delete "${ip6_addr}/128" dev tun0 &> /dev/null fi fi From 2c877388778ef4cad21b644bd4307f70fdc9cb83 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Wed, 13 Mar 2019 13:27:34 +0100 Subject: [PATCH 2/4] Fix ifs related to ynh_service_enabled --- conf/ynh-hotspot | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/ynh-hotspot b/conf/ynh-hotspot index f6c6283..3de7726 100644 --- a/conf/ynh-hotspot +++ b/conf/ynh-hotspot @@ -320,7 +320,7 @@ case "$1" in start) if is_running; then echo "Already started" - elif [ "${ynh_service_enabled}" -eq 0 ]; then + elif [ "${ynh_service_enabled}" != "enabled" ]; then echo "Disabled service" else echo "[hotspot] Starting..." @@ -469,7 +469,7 @@ case "$1" in status) exitcode=0 - if [ "${ynh_service_enabled}" -eq 0 ]; then + if [ "${ynh_service_enabled}" != "enabled" ]; then echo "[ERR] Hotspot Service disabled" exitcode=1 fi From 9a68383abb3c664bd5fdd8bb9d4b53c997add2fe Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Thu, 14 Mar 2019 02:38:06 +0100 Subject: [PATCH 3/4] Unmask hostapd --- scripts/install | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/install b/scripts/install index 059e1e3..305d09f 100644 --- a/scripts/install +++ b/scripts/install @@ -287,6 +287,7 @@ yunohost firewall allow --no-upnp UDP 67 # and the ynh-hotspot service handles them. systemctl disable hostapd systemctl stop hostapd +systemctl unmask hostapd # On some system e.g. RPi, for some reason hostapd is masked after install ... systemctl enable php5-fpm systemctl restart php5-fpm systemctl reload nginx From e51559d856d5f29145f28d17aa0d402078218532 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Thu, 14 Mar 2019 02:39:00 +0100 Subject: [PATCH 4/4] Also set DAEMON_CONF in /etc/default/hostapd --- scripts/install | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/install b/scripts/install index 305d09f..a483aa0 100644 --- a/scripts/install +++ b/scripts/install @@ -259,6 +259,10 @@ find /var/www/wifiadmin/ -type d -exec chmod +x {} \; ## hostapd sed 's|^DAEMON_CONF=$|&/etc/hostapd/hostapd.conf|' -i /etc/init.d/hostapd +# We also need to put this in /etc/default/hostapd because on some setup +# like RPi, the version of hostapd is different and /etc/init.d/hostapd +# isnt used ... instead the service is "pure systemd" ... +echo "DAEMON_CONF=/etc/hostapd/hostapd.conf" > /etc/default/hostapd ## nginx sed "s||${path_url}|g" -i "/etc/nginx/conf.d/${domain}.d/wifiadmin.conf"