mirror of
https://github.com/YunoHost-Apps/hotspot_ynh.git
synced 2024-09-03 19:25:53 +02:00
46 lines
1.2 KiB
Bash
46 lines
1.2 KiB
Bash
#!/bin/bash
|
|
|
|
ynh_setting() {
|
|
app=${1}
|
|
setting=${2}
|
|
|
|
sudo grep "^${setting}:" "/etc/yunohost/apps/${app}/settings.yml" | sed s/^[^:]\\+:\\s*[\"\']\\?// | sed s/\\s*[\"\']\$//
|
|
}
|
|
|
|
domain=$(ynh_setting hotspot domain)
|
|
path=$(ynh_setting hotspot path)
|
|
wifi_ssid=$(ynh_setting hotspot wifi_ssid)
|
|
wifi_passphrase=$(ynh_setting hotspot wifi_passphrase)
|
|
|
|
source ./helpers
|
|
source ./prerequisites
|
|
|
|
if dpkg -l firmware-linux-nonfree &> /dev/null; then
|
|
firmware_nonfree=yes
|
|
else
|
|
firmware_nonfree=no
|
|
fi
|
|
|
|
tmpdir=$(mktemp -dp /tmp/ hotspot-upgrade-XXXXX)
|
|
sudo cp -a /etc/yunohost/apps/hotspot/settings.yml "${tmpdir}/"
|
|
|
|
export HOTSPOT_UPGRADE=1
|
|
sudo bash /etc/yunohost/apps/hotspot/scripts/remove &> /dev/null
|
|
bash ./install "${domain}" "${path}" "${wifi_ssid}" "${wifi_passphrase}" "${firmware_nonfree}"
|
|
|
|
sudo cp -a "${tmpdir}/settings.yml" /etc/yunohost/apps/hotspot/
|
|
sudo rm -r "${tmpdir}/"
|
|
|
|
# Changes
|
|
|
|
if [ -z "$(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
|
|
|
|
ynh_systemctl start ynh-hotspot
|
|
|
|
exit 0
|