From 200e5b12d8346d14f1f77cdcb8820e7adbc15af3 Mon Sep 17 00:00:00 2001 From: Moul Date: Thu, 23 Jun 2016 10:05:02 +0000 Subject: [PATCH] [enh] store $arch and retrieve it in upgrade script. --- scripts/install | 11 +++++++---- scripts/upgrade | 10 ++++++---- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/scripts/install b/scripts/install index cd87d6d..ff4ba24 100755 --- a/scripts/install +++ b/scripts/install @@ -37,17 +37,20 @@ else ynh_die "Node $sync_node:$sync_port is not available" 2 fi +# Get CPU architecture +arch=$(uname -m) +if [ $arch == "x86_64" ]; then + arch="x64" +fi + # Open port on firewall sudo yunohost firewall allow TCP $port > /dev/null 2>&1 # Store config on YunoHost instance ynh_app_setting_set $app port $port +ynh_app_setting_set $app arch $arch # Install Duniter -arch=$(uname -m) -if [ $arch == "x86_64" ]; then - arch="x64" -fi if [ $arch == "x64" ]; then #|| $arch == "armv7l" ] wget -nc --quiet https://github.com/duniter/duniter/releases/download/$version/duniter-$version-linux-$arch.deb -P /tmp else diff --git a/scripts/upgrade b/scripts/upgrade index 0a8c035..4115370 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -3,7 +3,12 @@ # Exit on command errors and treat unset variables as an error set -eu +# Source app helpers +source /usr/share/yunohost/helpers + +# Retrive CPU architecure app=duniter +arch=$(ynh_app_setting_get "$app" arch) version=$(cat ../conf/upstream_version) # Stop duniter daemon @@ -13,16 +18,13 @@ sudo $app stop sudo dpkg -r duniter # Retrive Duniter package and install it -arch=$(uname -m) -if [ $arch == "x86_64" ]; then - arch="x64" -fi if [ $arch == "x64" ]; then #|| $arch == "armv7l" ] wget -nc --quiet https://github.com/duniter/duniter/releases/download/$version/duniter-$version-linux-$arch.deb -P /tmp else ynh_die "$arch is not currently supported." 2 fi sudo dpkg -i /tmp/duniter-$version-linux-$arch.deb +#sudo rm -f /tmp/duniter-$version-linux-$arch.deb # Start duniter daemon sudo $app start