mirror of
https://github.com/YunoHost-Apps/hotspot_ynh.git
synced 2024-09-03 19:25:53 +02:00
Fix #47
This commit is contained in:
parent
b1be389dd3
commit
212cd7ca18
4 changed files with 10 additions and 46 deletions
|
@ -15,7 +15,7 @@
|
||||||
"url": "http://julien.vaubourg.com"
|
"url": "http://julien.vaubourg.com"
|
||||||
},
|
},
|
||||||
"requirements": {
|
"requirements": {
|
||||||
"yunohost": ">= 2.2.0",
|
"yunohost": ">= 3.0.0",
|
||||||
"moulinette": ">= 2.4.0"
|
"moulinette": ">= 2.4.0"
|
||||||
},
|
},
|
||||||
"multi_instance": false,
|
"multi_instance": false,
|
||||||
|
|
|
@ -7,39 +7,3 @@
|
||||||
pkg_dependencies="php5-fpm sipcalc hostapd iptables iw dnsmasq"
|
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"
|
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"
|
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
|
|
||||||
}
|
|
||||||
|
|
|
@ -277,11 +277,11 @@ yunohost firewall allow --no-upnp UDP 67
|
||||||
# Set default inits
|
# Set default inits
|
||||||
# The boot order of these services are important, so they are disabled by default
|
# The boot order of these services are important, so they are disabled by default
|
||||||
# and the ynh-hotspot service handles them.
|
# and the ynh-hotspot service handles them.
|
||||||
systemctl disable hostapd
|
yunohost service disable hostapd
|
||||||
systemctl stop hostapd
|
yunohost service stop hostapd
|
||||||
systemctl enable php5-fpm
|
yunohost service enable php5-fpm
|
||||||
systemctl restart php5-fpm
|
yunohost service restart php5-fpm
|
||||||
systemctl reload nginx
|
yunohost service reload nginx
|
||||||
|
|
||||||
# Remove IPv6 address set if there is a VPN installed
|
# Remove IPv6 address set if there is a VPN installed
|
||||||
if [[ $ip6_addr != none ]]; then
|
if [[ $ip6_addr != none ]]; then
|
||||||
|
@ -292,14 +292,14 @@ if [[ $ip6_addr != none ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# register the service
|
# 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
|
# enable and start the service if device is present
|
||||||
if [[ $wifi_device == none ]]; then
|
if [[ $wifi_device == none ]]; then
|
||||||
echo "WARNING: Wifi Hotspot is not started because no wifi device was found (please, check the web admin)" >&2
|
echo "WARNING: Wifi Hotspot is not started because no wifi device was found (please, check the web admin)" >&2
|
||||||
else
|
else
|
||||||
ynh_systemctl enable $service_name
|
yunohost service enable $service_name
|
||||||
ynh_systemctl start $service_name
|
yunohost service start $service_name
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Reload SSOwat config
|
# Reload SSOwat config
|
||||||
|
|
|
@ -52,4 +52,4 @@ if [[ -z $(ynh_app_setting_get $app ip6_firewall) ]]; then
|
||||||
ynh_app_setting_set "${app}" ip6_firewall "${ip6_firewall}"
|
ynh_app_setting_set "${app}" ip6_firewall "${ip6_firewall}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ynh_systemctl start ynh-hotspot
|
yunohost service start ynh-hotspot
|
||||||
|
|
Loading…
Reference in a new issue