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

[fix] scripts: check CPU arch before doing modifications on the system.

This commit is contained in:
Moul 2016-06-24 11:49:05 +02:00
parent 6cca02f01c
commit 38dddb4bba
2 changed files with 12 additions and 12 deletions

View file

@ -35,11 +35,14 @@ else
ynh_die "Node $sync_node:$sync_port is not available" 2
fi
# Get CPU architecture
# Get CPU architecture and check it
arch=$(uname -m)
if [ $arch == "x86_64" ]; then
arch="x64"
fi
if [ $arch != "x64" ]; then #&& $arch != "armv7l" ]; then
ynh_die "$arch is not currently supported." 2
fi
# Open port on firewall
sudo yunohost firewall allow TCP $port > /dev/null 2>&1
@ -48,12 +51,8 @@ sudo yunohost firewall allow TCP $port > /dev/null 2>&1
ynh_app_setting_set $app port $port
ynh_app_setting_set $app arch $arch
# Install Duniter
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
# Retrieve debian package and install it
wget -nc --quiet https://github.com/duniter/duniter/releases/download/$version/duniter-$version-linux-$arch.deb -P /tmp
sudo dpkg -i /tmp/duniter-$version-linux-$arch.deb
#sudo rm -f /tmp/duniter-$version-linux-$arch.deb

View file

@ -15,6 +15,11 @@ port=$(ynh_app_setting_get "$app" port)
arch=$(ynh_app_setting_get "$app" arch)
version=$(cat ../conf/upstream_version)
# Check CPU arch
if [ $arch != "x64" ]; then #&& $arch != "armv7l" ], then
ynh_die "$arch is not currently supported." 2
fi
# Stop duniter daemon
sudo $app stop
@ -22,11 +27,7 @@ sudo $app stop
sudo dpkg -r duniter
# Retrive Duniter package and install it
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
wget -nc --quiet https://github.com/duniter/duniter/releases/download/$version/duniter-$version-linux-$arch.deb -P /tmp
sudo dpkg -i /tmp/duniter-$version-linux-$arch.deb
#sudo rm -f /tmp/duniter-$version-linux-$arch.deb