mirror of
https://github.com/YunoHost-Apps/hotspot_ynh.git
synced 2024-09-03 19:25:53 +02:00
Merge branch 'master' into update-scripts-to-the-new-standard
This commit is contained in:
commit
e2e0c0bab7
4 changed files with 11 additions and 42 deletions
|
@ -15,7 +15,7 @@
|
|||
"url": "http://julien.vaubourg.com"
|
||||
},
|
||||
"requirements": {
|
||||
"yunohost": ">= 3.4"
|
||||
"yunohost": ">= 3.2.0"
|
||||
},
|
||||
"multi_instance": false,
|
||||
"services": [
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -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"
|
||||
ynh_print_info "Upgrade of $app completed"
|
||||
|
|
Loading…
Add table
Reference in a new issue