Parcourir la source

Update restore procedure

Julien Vaubourg il y a 9 ans
Parent
commit
e5ce4acb6a
4 fichiers modifiés avec 6 ajouts et 19 suppressions
  1. 0 2
      scripts/backup
  2. 5 11
      scripts/install
  3. 1 2
      scripts/restore
  4. 0 4
      scripts/upgrade

+ 0 - 2
scripts/backup

@@ -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}/"
 

+ 5 - 11
scripts/install

@@ -25,15 +25,13 @@ domain=${1}
 url_path=${2}
 
 if ! $upgrade; then
- 
   source ./prerequisites
+fi
 
-  # Check domain/path availability
-  sudo yunohost app checkurl ${domain}${url_path} -a vpnclient
-  if [ ! $? -eq 0 ]; then
-    exit 1
-  fi
-
+# Check domain/path availability
+sudo yunohost app checkurl ${domain}${url_path} -a vpnclient
+if [ ! $? -eq 0 ]; then
+  exit 1
 fi
 
 # Install packages
@@ -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/

+ 1 - 2
scripts/restore

@@ -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}/"

+ 0 - 4
scripts/upgrade

@@ -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