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

[enh] #14: automatically retrieve last version

- retrive last version available for x64 or for armel architectures
- upgrade enable set -u
This commit is contained in:
Moul 2016-08-20 01:35:46 +02:00
parent ad0e6a8b78
commit 6f96db42ac
3 changed files with 13 additions and 9 deletions

View file

@ -1 +0,0 @@
v0.30.0

View file

@ -13,7 +13,6 @@ sync_port=$YNH_APP_ARG_SYNC_PORT
salt=$YNH_APP_ARG_SALT
password=$YNH_APP_ARG_PASSWORD
admin=$YNH_APP_ARG_ADMIN
version=$(cat ../conf/upstream_version)
# Source app helpers
source /usr/share/yunohost/helpers
@ -60,8 +59,12 @@ ynh_app_setting_set $app port $port
ynh_app_setting_set $app arch $arch
ynh_app_setting_set "$app" admin "$admin"
# Retrieve url of last version and version number
url=$(curl -s https://api.github.com/repos/duniter/duniter/releases | grep "browser_" | grep $arch | head -1 | cut -d\" -f4)
version=$(curl -s https://api.github.com/repos/duniter/duniter/releases | grep "browser_" | grep $arch | head -1 | cut -d/ -f8)
# Retrieve debian package and install it
wget -nc --quiet https://github.com/duniter/duniter/releases/download/$version/duniter-$version-linux-$arch.deb -P /tmp
wget -nc --quiet $url -P /tmp
sudo dpkg -i /tmp/duniter-$version-linux-$arch.deb
#sudo rm -f /tmp/duniter-$version-linux-$arch.deb

View file

@ -1,8 +1,7 @@
#!/bin/bash
# Exit on command errors and treat unset variables as an error
set -e
#u
set -eu
# Source app helpers
source /usr/share/yunohost/helpers
@ -14,7 +13,6 @@ path=$(ynh_app_setting_get "$app" path)
port=$(ynh_app_setting_get "$app" port)
arch=$(ynh_app_setting_get "$app" arch)
admin=$(ynh_app_setting_get "$app" admin)
version=$(cat ../conf/upstream_version)
# Check CPU arch
if [[ $arch != "x64" && $arch != "armv7l" ]]; then
@ -27,10 +25,14 @@ sudo $app stop
# Remove Duniter package
sudo dpkg -r duniter
# Retrive Duniter package and install it
wget -nc --quiet https://github.com/duniter/duniter/releases/download/$version/duniter-$version-linux-$arch.deb -P /tmp
# Retrieve url of latest version and number
url=$(curl -s https://api.github.com/repos/duniter/duniter/releases | grep "browser_" | grep $arch | head -1 | cut -d\" -f4)
version=$(curl -s https://api.github.com/repos/duniter/duniter/releases | grep "browser_" | grep $arch | head -1 | cut -d/ -f8)
# Retrieve Debian package and install it
wget -nc --quiet $url -P /tmp
sudo dpkg -i /tmp/duniter-$version-linux-$arch.deb
#sudo rm -f /tmp/duniter-$version-linux-$arch.deb
sudo rm -f /tmp/duniter-$version-linux-$arch.deb
# Start duniter daemon
sudo $app webstart