Update restore procedure

This commit is contained in:
Julien Vaubourg 2016-05-14 16:08:22 +02:00
parent c08286273b
commit e5ce4acb6a
4 changed files with 6 additions and 19 deletions

View File

@ -1,7 +1,5 @@
#!/bin/bash
# The parameter $1 is the backup directory location
# which will be compressed afterward
backup_dir="${1}/apps/vpnclient"
mkdir -p "${backup_dir}/"

View File

@ -25,8 +25,8 @@ domain=${1}
url_path=${2}
if ! $upgrade; then
source ./prerequisites
fi
# Check domain/path availability
sudo yunohost app checkurl ${domain}${url_path} -a vpnclient
@ -34,8 +34,6 @@ if ! $upgrade; then
exit 1
fi
fi
# Install packages
packages='php5-fpm sipcalc dnsutils openvpn curl'
export DEBIAN_FRONTEND=noninteractive
@ -63,10 +61,6 @@ if ! $upgrade; then
fi
# Save git commit
gitcommit=$(git rev-parse HEAD)
sudo yunohost app setting vpnclient gitcommit -v "${gitcommit}"
# Install IPv6 scripts
sudo install -o root -g root -m 0755 ../conf/ipv6_expanded /usr/local/bin/
sudo install -o root -g root -m 0755 ../conf/ipv6_compressed /usr/local/bin/

View File

@ -1,12 +1,11 @@
#!/bin/bash
# The parameter $1 is the uncompressed restore directory location
backup_dir="${1}/apps/vpnclient"
mkdir -p /etc/openvpn/
cp -a "${backup_dir}/keys/" /etc/openvpn/
gitcommit=$(sudo yunohost app setting vpnclient gitcommit)
gitcommit=$(grep revision /etc/yunohost/apps/vpnclient/status.json | sed 's/.*"revision": "\([^"]\+\)".*/\1/')
tmpdir=$(mktemp -dp /tmp/ vpnclient-restore-XXXXX)
git clone https://github.com/labriqueinternet/vpnclient_ynh.git "${tmpdir}/"

View File

@ -21,14 +21,10 @@ export VPNCLIENT_UPGRADE=1
sudo bash /etc/yunohost/apps/vpnclient/scripts/remove &> /dev/null
bash ./install "${domain}" "${path}" "${server_name}"
gitcommit=$(ynh_setting vpnclient gitcommit)
sudo cp -a "${tmpdir}/settings.yml" /etc/yunohost/apps/vpnclient/
sudo cp -a "${tmpdir}/keys/"* /etc/openvpn/keys/ 2> /dev/null
sudo rm -r "${tmpdir}/"
sudo yunohost app setting vpnclient gitcommit -v "${gitcommit}"
# Changes
if [ -z "$(ynh_setting vpnclient dns0)" ]; then