mirror of
https://github.com/YunoHost-Apps/mobilizon_ynh.git
synced 2024-09-03 19:46:19 +02:00
Missing ynh_package_version
This commit is contained in:
parent
95d2414c10
commit
19e4846c5a
2 changed files with 27 additions and 0 deletions
|
@ -7,6 +7,7 @@
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
|
source ynh_package_version
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
26
scripts/ynh_package_version
Normal file
26
scripts/ynh_package_version
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
read_json () {
|
||||||
|
sudo python3 -c "import sys, json;print(json.load(open('$1'))['$2'])"
|
||||||
|
}
|
||||||
|
|
||||||
|
read_manifest () {
|
||||||
|
if [ -f '../manifest.json' ] ; then
|
||||||
|
read_json '../manifest.json' "$1"
|
||||||
|
else
|
||||||
|
read_json '../settings/manifest.json' "$1"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
abort_if_up_to_date () {
|
||||||
|
version=$(read_json "/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json" 'version' 2> /dev/null || echo '20160501-7')
|
||||||
|
last_version=$(read_manifest 'version')
|
||||||
|
if [ "${version}" = "${last_version}" ]; then
|
||||||
|
ynh_print_info "Up-to-date, nothing to do"
|
||||||
|
ynh_die "" 0
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
ynh_version_gt ()
|
||||||
|
{
|
||||||
|
dpkg --compare-versions "$1" gt "$2"
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue