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