diff --git a/scripts/install b/scripts/install index 5de2e25..d5082d3 100644 --- a/scripts/install +++ b/scripts/install @@ -48,14 +48,14 @@ if ! $upgrade; then echo "ERROR: Only printable ASCII characters are permitted in your password (WPA2 passphrase)" >&2 exit 1 fi - - # Check domain/path availability - sudo yunohost app checkurl ${domain}${url_path} -a hotspot - if [ ! $? -eq 0 ]; then - exit 1 - fi fi + +# Check domain/path availability +sudo yunohost app checkurl ${domain}${url_path} -a hotspot +if [ ! $? -eq 0 ]; then + exit 1 +fi # Install packages packages='php5-fpm sipcalc hostapd iptables iw dnsmasq' @@ -134,10 +134,6 @@ if ! $upgrade; then fi -# Save git commit -gitcommit=$(git rev-parse HEAD) -sudo yunohost app setting hotspot gitcommit -v "${gitcommit}" - # Install custom scripts sudo install -o root -g root -m 0755 ../conf/iw_multissid /usr/local/bin/ sudo install -o root -g root -m 0755 ../conf/iw_devices /usr/local/bin/ diff --git a/scripts/restore b/scripts/restore index cd6f18a..9e7d150 100644 --- a/scripts/restore +++ b/scripts/restore @@ -1,6 +1,6 @@ #!/bin/bash -gitcommit=$(sudo yunohost app setting hotspot gitcommit) +gitcommit=$(sudo grep revision /etc/yunohost/apps/hotspot/status.json | sed 's/.*"revision": "\([^"]\+\)".*/\1/') tmpdir=$(mktemp -dp /tmp/ hotspot-restore-XXXXX) git clone https://github.com/labriqueinternet/hotspot_ynh.git "${tmpdir}/" diff --git a/scripts/upgrade b/scripts/upgrade index 3125217..2f6aa8f 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -27,13 +27,9 @@ export HOTSPOT_UPGRADE=1 sudo bash /etc/yunohost/apps/hotspot/scripts/remove &> /dev/null bash ./install "${domain}" "${path}" "${wifi_ssid}" "${wifi_passphrase}" "${firmware_nonfree}" -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}" - # Changes if [ -z "$(ynh_setting hotspot ip6_firewall)" ]; then