1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/duniter_ynh.git synced 2024-09-03 18:26:35 +02:00

[enh] store $arch and retrieve it in upgrade script.

This commit is contained in:
Moul 2016-06-23 10:05:02 +00:00
parent 34f9d6f821
commit 200e5b12d8
2 changed files with 13 additions and 8 deletions

View file

@ -37,17 +37,20 @@ else
ynh_die "Node $sync_node:$sync_port is not available" 2 ynh_die "Node $sync_node:$sync_port is not available" 2
fi fi
# Get CPU architecture
arch=$(uname -m)
if [ $arch == "x86_64" ]; then
arch="x64"
fi
# Open port on firewall # Open port on firewall
sudo yunohost firewall allow TCP $port > /dev/null 2>&1 sudo yunohost firewall allow TCP $port > /dev/null 2>&1
# Store config on YunoHost instance # Store config on YunoHost instance
ynh_app_setting_set $app port $port ynh_app_setting_set $app port $port
ynh_app_setting_set $app arch $arch
# Install Duniter # Install Duniter
arch=$(uname -m)
if [ $arch == "x86_64" ]; then
arch="x64"
fi
if [ $arch == "x64" ]; then #|| $arch == "armv7l" ] if [ $arch == "x64" ]; then #|| $arch == "armv7l" ]
wget -nc --quiet https://github.com/duniter/duniter/releases/download/$version/duniter-$version-linux-$arch.deb -P /tmp wget -nc --quiet https://github.com/duniter/duniter/releases/download/$version/duniter-$version-linux-$arch.deb -P /tmp
else else

View file

@ -3,7 +3,12 @@
# Exit on command errors and treat unset variables as an error # Exit on command errors and treat unset variables as an error
set -eu set -eu
# Source app helpers
source /usr/share/yunohost/helpers
# Retrive CPU architecure
app=duniter app=duniter
arch=$(ynh_app_setting_get "$app" arch)
version=$(cat ../conf/upstream_version) version=$(cat ../conf/upstream_version)
# Stop duniter daemon # Stop duniter daemon
@ -13,16 +18,13 @@ sudo $app stop
sudo dpkg -r duniter sudo dpkg -r duniter
# Retrive Duniter package and install it # Retrive Duniter package and install it
arch=$(uname -m)
if [ $arch == "x86_64" ]; then
arch="x64"
fi
if [ $arch == "x64" ]; then #|| $arch == "armv7l" ] if [ $arch == "x64" ]; then #|| $arch == "armv7l" ]
wget -nc --quiet https://github.com/duniter/duniter/releases/download/$version/duniter-$version-linux-$arch.deb -P /tmp wget -nc --quiet https://github.com/duniter/duniter/releases/download/$version/duniter-$version-linux-$arch.deb -P /tmp
else else
ynh_die "$arch is not currently supported." 2 ynh_die "$arch is not currently supported." 2
fi fi
sudo dpkg -i /tmp/duniter-$version-linux-$arch.deb sudo dpkg -i /tmp/duniter-$version-linux-$arch.deb
#sudo rm -f /tmp/duniter-$version-linux-$arch.deb
# Start duniter daemon # Start duniter daemon
sudo $app start sudo $app start