22 lines
629 B
Bash
22 lines
629 B
Bash
#!/bin/bash
|
|
|
|
backup_dir="${1}/apps/vpnclient"
|
|
|
|
sudo mkdir -p /etc/openvpn/
|
|
sudo cp -a "${backup_dir}/keys/" /etc/openvpn/
|
|
sudo cp -a "${backup_dir}/client.conf.tpl" /etc/openvpn/
|
|
sudo chown -R root:admins /etc/openvpn/keys/
|
|
|
|
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
|