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:
parent
ad0e6a8b78
commit
6f96db42ac
3 changed files with 13 additions and 9 deletions
|
@ -1 +0,0 @@
|
||||||
v0.30.0
|
|
|
@ -13,7 +13,6 @@ sync_port=$YNH_APP_ARG_SYNC_PORT
|
||||||
salt=$YNH_APP_ARG_SALT
|
salt=$YNH_APP_ARG_SALT
|
||||||
password=$YNH_APP_ARG_PASSWORD
|
password=$YNH_APP_ARG_PASSWORD
|
||||||
admin=$YNH_APP_ARG_ADMIN
|
admin=$YNH_APP_ARG_ADMIN
|
||||||
version=$(cat ../conf/upstream_version)
|
|
||||||
|
|
||||||
# Source app helpers
|
# Source app helpers
|
||||||
source /usr/share/yunohost/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 arch $arch
|
||||||
ynh_app_setting_set "$app" admin "$admin"
|
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
|
# 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 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
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Exit on command errors and treat unset variables as an error
|
# Exit on command errors and treat unset variables as an error
|
||||||
set -e
|
set -eu
|
||||||
#u
|
|
||||||
|
|
||||||
# Source app helpers
|
# Source app helpers
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
@ -14,7 +13,6 @@ path=$(ynh_app_setting_get "$app" path)
|
||||||
port=$(ynh_app_setting_get "$app" port)
|
port=$(ynh_app_setting_get "$app" port)
|
||||||
arch=$(ynh_app_setting_get "$app" arch)
|
arch=$(ynh_app_setting_get "$app" arch)
|
||||||
admin=$(ynh_app_setting_get "$app" admin)
|
admin=$(ynh_app_setting_get "$app" admin)
|
||||||
version=$(cat ../conf/upstream_version)
|
|
||||||
|
|
||||||
# Check CPU arch
|
# Check CPU arch
|
||||||
if [[ $arch != "x64" && $arch != "armv7l" ]]; then
|
if [[ $arch != "x64" && $arch != "armv7l" ]]; then
|
||||||
|
@ -27,10 +25,14 @@ sudo $app stop
|
||||||
# Remove Duniter package
|
# Remove Duniter package
|
||||||
sudo dpkg -r duniter
|
sudo dpkg -r duniter
|
||||||
|
|
||||||
# Retrive Duniter package and install it
|
# Retrieve url of latest version and number
|
||||||
wget -nc --quiet https://github.com/duniter/duniter/releases/download/$version/duniter-$version-linux-$arch.deb -P /tmp
|
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 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
|
# Start duniter daemon
|
||||||
sudo $app webstart
|
sudo $app webstart
|
||||||
|
|
Loading…
Add table
Reference in a new issue