From 08a9db3fb5a5d5a46978c23afc191ba7c0e77ea1 Mon Sep 17 00:00:00 2001 From: Kayou Date: Mon, 18 Feb 2019 12:55:42 +0100 Subject: [PATCH 1/6] Fix restore --- scripts/restore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/restore b/scripts/restore index a3e9ef8..dd29d1f 100644 --- a/scripts/restore +++ b/scripts/restore @@ -6,7 +6,7 @@ # IMPORT GENERIC HELPERS #================================================= -source _common.sh +source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers #================================================= From 212cd7ca181c143addb354448e64167b8eee5272 Mon Sep 17 00:00:00 2001 From: keoma Date: Sun, 17 Feb 2019 22:25:04 +0100 Subject: [PATCH 2/6] Fix #47 --- manifest.json | 2 +- scripts/_common.sh | 36 ------------------------------------ scripts/install | 16 ++++++++-------- scripts/upgrade | 2 +- 4 files changed, 10 insertions(+), 46 deletions(-) diff --git a/manifest.json b/manifest.json index 768e335..4803263 100644 --- a/manifest.json +++ b/manifest.json @@ -15,7 +15,7 @@ "url": "http://julien.vaubourg.com" }, "requirements": { - "yunohost": ">= 2.2.0", + "yunohost": ">= 3.0.0", "moulinette": ">= 2.4.0" }, "multi_instance": false, diff --git a/scripts/_common.sh b/scripts/_common.sh index a3841d6..d1c83ef 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -7,39 +7,3 @@ pkg_dependencies="php5-fpm sipcalc hostapd iptables iw dnsmasq" nonfree_packages="firmware-linux-free firmware-linux-nonfree firmware-atheros firmware-realtek firmware-ralink firmware-libertas atmel-firmware zd1211-firmware" free_packages="firmware-linux-free" - -# -# Helper to start/stop/.. a systemd service from a yunohost context, -# *and* the systemd service itself needs to be able to run yunohost -# commands. -# -# Hence the need to release the lock during the operation -# -# usage : ynh_systemctl yolo restart -# -function ynh_systemctl() -{ - local ACTION="$1" - local SERVICE="$2" - local LOCKFILE="/var/run/moulinette_yunohost.lock" - - # Launch the action - systemctl "$ACTION" "$SERVICE" & - local SYSCTLACTION=$! - - # Save and release the lock... - cp $LOCKFILE $LOCKFILE.bkp.$$ - ynh_secure_remove $LOCKFILE - - # Wait for the end of the action - wait $SYSCTLACTION - - # Make sure the lock is released... - while [ -f $LOCKFILE ] - do - sleep 0.1 - done - - # Restore the old lock - mv $LOCKFILE.bkp.$$ $LOCKFILE -} diff --git a/scripts/install b/scripts/install index 9deeb7b..e0b8a74 100644 --- a/scripts/install +++ b/scripts/install @@ -277,11 +277,11 @@ yunohost firewall allow --no-upnp UDP 67 # Set default inits # The boot order of these services are important, so they are disabled by default # and the ynh-hotspot service handles them. -systemctl disable hostapd -systemctl stop hostapd -systemctl enable php5-fpm -systemctl restart php5-fpm -systemctl reload nginx +yunohost service disable hostapd +yunohost service stop hostapd +yunohost service enable php5-fpm +yunohost service restart php5-fpm +yunohost service reload nginx # Remove IPv6 address set if there is a VPN installed if [[ $ip6_addr != none ]]; then @@ -292,14 +292,14 @@ if [[ $ip6_addr != none ]]; then fi # register the service -yunohost service add $service_name --description "creates a Wi-Fi access point" +yunohost service add $service_name --description "creates a Wi-Fi access point" --need_lock # enable and start the service if device is present if [[ $wifi_device == none ]]; then echo "WARNING: Wifi Hotspot is not started because no wifi device was found (please, check the web admin)" >&2 else - ynh_systemctl enable $service_name - ynh_systemctl start $service_name + yunohost service enable $service_name + yunohost service start $service_name fi # Reload SSOwat config diff --git a/scripts/upgrade b/scripts/upgrade index ffad59c..ac93d75 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -52,4 +52,4 @@ if [[ -z $(ynh_app_setting_get $app ip6_firewall) ]]; then ynh_app_setting_set "${app}" ip6_firewall "${ip6_firewall}" fi -ynh_systemctl start ynh-hotspot +yunohost service start ynh-hotspot From b9bce541d1015523f6c5489df5dc0f2159fedf27 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 18 Feb 2019 00:55:10 +0100 Subject: [PATCH 3/6] Systemctl is fine with regular services ;) --- scripts/install | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/install b/scripts/install index e0b8a74..5510ea9 100644 --- a/scripts/install +++ b/scripts/install @@ -277,11 +277,11 @@ yunohost firewall allow --no-upnp UDP 67 # Set default inits # The boot order of these services are important, so they are disabled by default # and the ynh-hotspot service handles them. -yunohost service disable hostapd -yunohost service stop hostapd -yunohost service enable php5-fpm -yunohost service restart php5-fpm -yunohost service reload nginx +systemctl disable hostapd +systemctl stop hostapd +systemctl enable php5-fpm +systemctl restart php5-fpm +systemctl reload nginx # Remove IPv6 address set if there is a VPN installed if [[ $ip6_addr != none ]]; then From 3a9ade4d986a2237b759d1af018775f2a88106c5 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 18 Feb 2019 00:55:33 +0100 Subject: [PATCH 4/6] Use 'yunohost service' in remove script --- scripts/remove | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/remove b/scripts/remove index a57cde7..7eed1e9 100644 --- a/scripts/remove +++ b/scripts/remove @@ -36,8 +36,8 @@ domain=$(ynh_app_setting_get $app domain) firmware_nonfree=$(ynh_app_setting_get $app firmware_nonfree) # The End -systemctl stop ynh-hotspot -systemctl disable ynh-hotspot +yunohost service stop ynh-hotspot +yunohost service disable ynh-hotspot yunohost service remove ynh-hotspot ynh_secure_remove /etc/systemd/system/ynh-hotspot.service ynh_secure_remove /usr/local/bin/ynh-hotspot From a3536a3845b8ff928429696038e635cca3768d07 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 18 Feb 2019 00:57:31 +0100 Subject: [PATCH 5/6] --need_lock requires 3.2.x --- manifest.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index 4803263..fefa3d2 100644 --- a/manifest.json +++ b/manifest.json @@ -15,8 +15,7 @@ "url": "http://julien.vaubourg.com" }, "requirements": { - "yunohost": ">= 3.0.0", - "moulinette": ">= 2.4.0" + "yunohost": ">= 3.2.0" }, "multi_instance": false, "services": [ From 440662a956ed7af0eacfadde823ca37144778494 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 18 Feb 2019 01:07:31 +0100 Subject: [PATCH 6/6] During upgrade : make sure that the yunohost service has a description and need-lock enabled --- scripts/upgrade | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index ac93d75..b4be8dc 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -52,4 +52,7 @@ if [[ -z $(ynh_app_setting_get $app ip6_firewall) ]]; then ynh_app_setting_set "${app}" ip6_firewall "${ip6_firewall}" fi +# Make sure that the yunohost service has a description and need-lock enabled +yunohost service remove ynh-hotspot +yunohost service add ynh-hotspot --description "creates a Wi-Fi access point" --need_lock yunohost service start ynh-hotspot