mirror of
https://github.com/YunoHost-Apps/hotspot_ynh.git
synced 2024-09-03 19:25:53 +02:00
Add backup/restore scripts
This commit is contained in:
parent
40ba05ad1b
commit
1a9ef49ea5
4 changed files with 26 additions and 3 deletions
5
scripts/backup
Normal file
5
scripts/backup
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# nothing to do...
|
||||||
|
|
||||||
|
exit 0
|
|
@ -18,7 +18,7 @@
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# This is an upgrade?
|
# This is an upgrade?
|
||||||
upgrade=$([ "$HOTSPOT_UPGRADE" == 1 ] && echo true || echo false)
|
upgrade=$([ "${HOTSPOT_UPGRADE}" == 1 ] && echo true || echo false)
|
||||||
|
|
||||||
# Retrieve arguments
|
# Retrieve arguments
|
||||||
domain=${1}
|
domain=${1}
|
||||||
|
@ -140,6 +140,10 @@ if ! $upgrade; then
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Save git commit
|
||||||
|
gitcommit=$(git rev-parse HEAD)
|
||||||
|
sudo yunohost app setting hotspot gitcommit -v "${gitcommit}"
|
||||||
|
|
||||||
# Install custom scripts
|
# 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_multissid /usr/local/bin/
|
||||||
sudo install -o root -g root -m 0755 ../conf/iw_devices /usr/local/bin/
|
sudo install -o root -g root -m 0755 ../conf/iw_devices /usr/local/bin/
|
||||||
|
|
14
scripts/restore
Normal file
14
scripts/restore
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
gitcommit=$(sudo yunohost app setting hotspot gitcommit)
|
||||||
|
tmpdir=$(mktemp -dp /tmp/ hotspot-restore-XXXXX)
|
||||||
|
|
||||||
|
git clone https://github.com/labriqueinternet/hotspot_ynh.git "${tmpdir}/"
|
||||||
|
git --work-tree "${tmpdir}/" --git-dir "${tmpdir}/.git/" reset --hard "${gitcommit}"
|
||||||
|
|
||||||
|
cd "${tmpdir}/scripts/"
|
||||||
|
./upgrade
|
||||||
|
|
||||||
|
sudo rm -r "${tmpdir}/"
|
||||||
|
|
||||||
|
exit 0
|
|
@ -19,7 +19,7 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export HOTSPOT_UPGRADE=1
|
export HOTSPOT_UPGRADE=1
|
||||||
sudo bash /etc/yunohost/apps/hotspot/scripts/remove
|
sudo bash /etc/yunohost/apps/hotspot/scripts/remove &> /dev/null
|
||||||
bash ./install "${domain}" "${path}" "${wifi_ssid}" "${wifi_passphrase}" "${firmware_nonfree}"
|
bash ./install "${domain}" "${path}" "${wifi_ssid}" "${wifi_passphrase}" "${firmware_nonfree}"
|
||||||
|
|
||||||
# Changes
|
# Changes
|
||||||
|
|
Loading…
Add table
Reference in a new issue