1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/monica_ynh.git synced 2024-09-03 19:46:23 +02:00

Fix version check

This commit is contained in:
yalh76 2020-06-12 05:36:57 +02:00
parent 4f4cb7cd6b
commit 8301ab7d95
2 changed files with 36 additions and 1 deletions

View file

@ -62,6 +62,14 @@ if [ -z "$final_path" ]; then
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
fi
#=================================================
# CHECK VERSION NUMBER
#=================================================
abort_if_up_to_date
# previous function is what defines 'version', more precisely the 'previous version'
previous_version="${version}"
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
@ -186,7 +194,7 @@ else
popd
fi
if [ dpkg --compare-versions "$version" lt "2.15.0" ]; then
if ynh_version_gt "2.15.0" "${previous_version}" ; then
ynh_script_progression --message="Upgrading for 2.15.0..."
pushd "$final_path"
php$phpversion artisan monica:moveavatarstophotosdirectory

View file

@ -0,0 +1,27 @@
#!/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"
}