diff --git a/manifest.json b/manifest.json index c22caff..26a2014 100644 --- a/manifest.json +++ b/manifest.json @@ -15,7 +15,7 @@ "url": "http://julien.vaubourg.com" }, "requirements": { - "yunohost": ">= 3.4" + "yunohost": ">= 3.2.0" }, "multi_instance": false, "services": [ 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 4cb54d9..adeba1e 100644 --- a/scripts/install +++ b/scripts/install @@ -297,14 +297,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 - systemctl enable $service_name - systemctl start $service_name + yunohost service enable $service_name + yunohost service start $service_name fi #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 1e7ec6f..f184588 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -127,7 +127,12 @@ ynh_store_file_checksum "$final_path/config.php" ynh_print_info "Upgrading systemd configuration..." # Create a dedicated systemd config -ynh_add_systemd_config +ynh_add_systemd_config $service_name + +# Make sure that the yunohost service has a description and need-lock enabled +yunohost service remove $service_name +yunohost service add $service_name --description "Creates a Wi-Fi access point" --need_lock +yunohost service start $service_name #================================================= # GENERIC FINALIZATION @@ -155,4 +160,4 @@ systemctl reload nginx # END OF SCRIPT #================================================= -ynh_print_info "Upgrade of $app completed" \ No newline at end of file +ynh_print_info "Upgrade of $app completed"