20 lines
517 B
Bash
20 lines
517 B
Bash
#!/bin/bash
|
|
|
|
backup_dir="${1}/apps/vpnclient"
|
|
|
|
mkdir -p /etc/openvpn/
|
|
cp -a "${backup_dir}/keys/" /etc/openvpn/
|
|
|
|
gitcommit=$(sudo 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}/"
|
|
git --work-tree "${tmpdir}/" --git-dir "${tmpdir}/.git/" reset --hard "${gitcommit}"
|
|
|
|
cd "${tmpdir}/scripts/"
|
|
bash ./upgrade
|
|
|
|
sudo rm -r "${tmpdir}/"
|
|
|
|
exit 0
|