2015-07-13 15:59:05 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2015-07-24 19:09:56 +02:00
|
|
|
ynh_setting() {
|
|
|
|
app=${1}
|
|
|
|
setting=${2}
|
|
|
|
|
|
|
|
sudo grep "^${setting}:" "/etc/yunohost/apps/${app}/settings.yml" | sed s/^[^:]\\+:\\s*[\"\']\\?// | sed s/\\s*[\"\']\$//
|
2015-07-24 18:43:19 +02:00
|
|
|
}
|
2015-07-13 15:59:05 +02:00
|
|
|
|
2015-07-24 19:09:56 +02:00
|
|
|
domain=$(ynh_setting hotspot domain)
|
|
|
|
path=$(ynh_setting hotspot path)
|
|
|
|
wifi_ssid=$(ynh_setting hotspot wifi_ssid)
|
|
|
|
wifi_passphrase=$(ynh_setting hotspot wifi_passphrase)
|
2015-07-13 15:59:05 +02:00
|
|
|
|
|
|
|
if dpkg -l firmware-linux-nonfree &> /dev/null; then
|
2015-07-24 18:43:19 +02:00
|
|
|
firmware_nonfree=yes
|
2015-07-13 15:59:05 +02:00
|
|
|
else
|
2015-07-24 18:43:19 +02:00
|
|
|
firmware_nonfree=no
|
2015-07-13 15:59:05 +02:00
|
|
|
fi
|
|
|
|
|
2015-07-26 10:43:44 +02:00
|
|
|
tmpdir=$(mktemp -dp /tmp/ hotspot-upgrade-XXXXX)
|
|
|
|
sudo cp -a /etc/yunohost/apps/hotspot/settings.yml "${tmpdir}/"
|
|
|
|
|
2015-07-24 18:43:19 +02:00
|
|
|
export HOTSPOT_UPGRADE=1
|
2015-07-25 16:33:38 +02:00
|
|
|
sudo bash /etc/yunohost/apps/hotspot/scripts/remove &> /dev/null
|
2015-07-24 18:52:25 +02:00
|
|
|
bash ./install "${domain}" "${path}" "${wifi_ssid}" "${wifi_passphrase}" "${firmware_nonfree}"
|
2015-07-13 15:59:05 +02:00
|
|
|
|
2015-07-26 10:43:44 +02:00
|
|
|
gitcommit=$(ynh_setting hotspot gitcommit)
|
|
|
|
|
|
|
|
sudo cp -a "${tmpdir}/settings.yml" /etc/yunohost/apps/hotspot/
|
|
|
|
sudo rm -r "${tmpdir}/"
|
|
|
|
|
|
|
|
sudo yunohost app setting hotspot gitcommit -v "${gitcommit}"
|
|
|
|
|
2015-07-24 23:48:24 +02:00
|
|
|
# Changes
|
|
|
|
|
|
|
|
if [ "$(ynh_setting hotspot ip6_firewall)" == '' ]; then
|
|
|
|
multissid=$(ynh_setting hotspot multissid)
|
|
|
|
ip6_firewall=$(printf '1|%.0s' $(seq "${multissid}"))
|
|
|
|
ip6_firewall=$(echo "${ip6_firewall%?}")
|
|
|
|
|
|
|
|
sudo yunohost app setting hotspot ip6_firewall -v "${ip6_firewall}"
|
|
|
|
fi
|
|
|
|
|
2015-07-24 18:43:19 +02:00
|
|
|
sudo systemctl start ynh-hotspot
|
2015-07-13 15:59:05 +02:00
|
|
|
|
|
|
|
exit 0
|