Browse Source

Merge branch 'master' into update-scripts-to-the-new-standard

master
Kayou 3 years ago
committed by GitHub
parent
commit
e2e0c0bab7
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      manifest.json
  2. 36
      scripts/_common.sh
  3. 6
      scripts/install
  4. 9
      scripts/upgrade

2
manifest.json

@ -15,7 +15,7 @@
"url": "http://julien.vaubourg.com"
},
"requirements": {
"yunohost": ">= 3.4"
"yunohost": ">= 3.2.0"
},
"multi_instance": false,
"services": [

36
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
}

6
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
#=================================================

9
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"
ynh_print_info "Upgrade of $app completed"
Loading…
Cancel
Save