From 2d6bfe2af7dc0ff91f602b65e28d7aa2a51b8d66 Mon Sep 17 00:00:00 2001 From: Lionel Coupouchetty-Ramouchetty Date: Sun, 23 Feb 2020 17:16:39 +0100 Subject: [PATCH 1/4] feature: control sum check restic binary --- scripts/_common.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 4a902e2..cc3724c 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -14,8 +14,18 @@ install_restic () { if [ ! -f /usr/local/bin/restic ];then pushd /tmp wget https://github.com/restic/restic/releases/download/v${RESTIC_VERSION}/restic_${RESTIC_VERSION}_linux_amd64.bz2 -O /tmp/restic.bz2 - bunzip2 restic.bz2 -c > /usr/local/bin/restic - chmod +x /usr/local/bin/restic + wget https://github.com/restic/restic/releases/download/v${RESTIC_VERSION}/SHA256SUMS -O /tmp/restic-sha256sums + expected_sum=$(grep restic_${RESTIC_VERSION}_linux_amd64.bz2 /tmp/restic-sha256sums | awk '{print $1}') + sum=$(sha256sum /tmp/restic.bz2 | awk '{print $1}') + if [ "$sum" == "$expected_sum" ];then + bunzip2 restic.bz2 -c > /usr/local/bin/restic + chmod +x /usr/local/bin/restic + else + echo -e "\e[91m \e[1m" + echo -e "\nDownloaded file does not match expected sha256 sum, aborting" + echo -e "\e[22m" + exit 1 + fi fi } From 759841b45d7fbf4c4c1b613b66734019b01631ba Mon Sep 17 00:00:00 2001 From: Lionel Coupouchetty-Ramouchetty Date: Sun, 23 Feb 2020 17:23:13 +0100 Subject: [PATCH 2/4] fix: force restic binary replacement while installing --- scripts/_common.sh | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index cc3724c..e28b399 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -11,21 +11,19 @@ pkg_dependencies="expect" # Install restic if restic is not here install_restic () { - if [ ! -f /usr/local/bin/restic ];then - pushd /tmp - wget https://github.com/restic/restic/releases/download/v${RESTIC_VERSION}/restic_${RESTIC_VERSION}_linux_amd64.bz2 -O /tmp/restic.bz2 - wget https://github.com/restic/restic/releases/download/v${RESTIC_VERSION}/SHA256SUMS -O /tmp/restic-sha256sums - expected_sum=$(grep restic_${RESTIC_VERSION}_linux_amd64.bz2 /tmp/restic-sha256sums | awk '{print $1}') - sum=$(sha256sum /tmp/restic.bz2 | awk '{print $1}') - if [ "$sum" == "$expected_sum" ];then - bunzip2 restic.bz2 -c > /usr/local/bin/restic - chmod +x /usr/local/bin/restic - else - echo -e "\e[91m \e[1m" - echo -e "\nDownloaded file does not match expected sha256 sum, aborting" - echo -e "\e[22m" - exit 1 - fi + pushd /tmp + wget https://github.com/restic/restic/releases/download/v${RESTIC_VERSION}/restic_${RESTIC_VERSION}_linux_amd64.bz2 -O /tmp/restic.bz2 + wget https://github.com/restic/restic/releases/download/v${RESTIC_VERSION}/SHA256SUMS -O /tmp/restic-sha256sums + expected_sum=$(grep restic_${RESTIC_VERSION}_linux_amd64.bz2 /tmp/restic-sha256sums | awk '{print $1}') + sum=$(sha256sum /tmp/restic.bz2 | awk '{print $1}') + if [ "$sum" == "$expected_sum" ];then + bunzip2 restic.bz2 -f -c > /usr/local/bin/restic + chmod +x /usr/local/bin/restic + else + echo -e "\e[91m \e[1m" + echo -e "\nDownloaded file does not match expected sha256 sum, aborting" + echo -e "\e[22m" + exit 1 fi } From 2957197e0ce0b1eb4883a42b55cb5c49f79f51f3 Mon Sep 17 00:00:00 2001 From: Lionel Coupouchetty-Ramouchetty Date: Sun, 23 Feb 2020 17:25:13 +0100 Subject: [PATCH 3/4] fix: remove trailing slash from default backup_path --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index cb9857a..280e2a1 100644 --- a/manifest.json +++ b/manifest.json @@ -57,7 +57,7 @@ "fr": "Un chemin complet ou relatif vers un répertoire existant sur le serveur distant et accessible en écriture au compte utilisé pour la sauvegarde. Répertoire d'accueil par défaut" }, "example": "./backups", - "default": "./" + "default": "." }, { "name": "ssh_user", From 036994e684e6372ec7a05a771e7ec664d4119c69 Mon Sep 17 00:00:00 2001 From: Lionel Coupouchetty-Ramouchetty Date: Sun, 23 Feb 2020 17:32:35 +0100 Subject: [PATCH 4/4] fix: do not move to /tmp to install application --- scripts/_common.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index e28b399..201a02d 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -11,13 +11,12 @@ pkg_dependencies="expect" # Install restic if restic is not here install_restic () { - pushd /tmp wget https://github.com/restic/restic/releases/download/v${RESTIC_VERSION}/restic_${RESTIC_VERSION}_linux_amd64.bz2 -O /tmp/restic.bz2 wget https://github.com/restic/restic/releases/download/v${RESTIC_VERSION}/SHA256SUMS -O /tmp/restic-sha256sums expected_sum=$(grep restic_${RESTIC_VERSION}_linux_amd64.bz2 /tmp/restic-sha256sums | awk '{print $1}') sum=$(sha256sum /tmp/restic.bz2 | awk '{print $1}') if [ "$sum" == "$expected_sum" ];then - bunzip2 restic.bz2 -f -c > /usr/local/bin/restic + bunzip2 /tmp/restic.bz2 -f -c > /usr/local/bin/restic chmod +x /usr/local/bin/restic else echo -e "\e[91m \e[1m"