123456789101112131415161718192021222324 |
- #!/bin/bash
- # The parameter $1 is the uncompressed restore directory location
- backup_dir="${1}/apps/piratebox"
- sudo rm -f /etc/nginx/conf.d/captive-piratebox.conf
- sudo mkdir -p /var/www/piratebox/public/
- sudo mv "${backup_dir}/uploads/" /var/www/piratebox/public/
- sudo chown -R www-data: /var/www/piratebox/public/uploads/
- gitcommit=$(sudo grep revision /etc/yunohost/apps/piratebox/status.json | sed 's/.*"revision": "\([^"]\+\)".*/\1/')
- gitcommit_upstream=$(sudo yunohost app setting piratebox gitcommit_upstream)
- tmpdir=$(mktemp -dp /tmp/ piratebox-restore-XXXXX)
- git clone https://github.com/labriqueinternet/piratebox_ynh.git "${tmpdir}/"
- git --work-tree "${tmpdir}/" --git-dir "${tmpdir}/.git/" reset --hard "${gitcommit}"
- export PIRATEBOX_GITCOMMIT_UPSTREAM=$gitcommit_upstream
- cd "${tmpdir}/scripts/"
- bash ./upgrade
- sudo rm -r "${tmpdir}/"
- exit 0
|