1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/minetest_ynh.git synced 2024-09-03 20:36:00 +02:00
minetest_ynh/scripts/_common.sh

73 lines
2.6 KiB
Bash
Raw Normal View History

2019-04-21 15:32:30 +02:00
2017-06-09 14:03:32 +02:00
#!/bin/bash
#=================================================
2019-04-21 15:32:30 +02:00
# COMMON VARIABLES
2017-06-09 14:03:32 +02:00
#=================================================
2019-04-21 15:32:30 +02:00
# dependencies used by the app
2019-10-22 17:52:18 +02:00
pkg_dependencies="build-essential libirrlicht-dev cmake libbz2-dev libpng-dev libjpeg-dev libxxf86vm-dev libgl1-mesa-dev libsqlite3-dev libogg-dev libvorbis-dev libopenal-dev libcurl4-gnutls-dev libfreetype6-dev zlib1g-dev libgmp-dev libjsoncpp-dev libluajit-5.1-dev"
2017-06-09 14:03:32 +02:00
#=================================================
2019-04-21 15:32:30 +02:00
# PERSONAL HELPERS
2017-06-09 14:03:32 +02:00
#=================================================
#=================================================
2019-04-21 15:32:30 +02:00
# EXPERIMENTAL HELPERS
2017-06-09 14:03:32 +02:00
#=================================================
2019-10-23 18:15:07 +02:00
# Need also the helper https://github.com/YunoHost-Apps/Experimental_helpers/blob/master/ynh_handle_getopts_args/ynh_handle_getopts_args
# Read the value of a key in a ynh manifest file
#
# usage: ynh_read_manifest manifest key
# | arg: -m, --manifest= - Path of the manifest to read
# | arg: -k, --key= - Name of the key to find
ynh_read_manifest () {
# Declare an array to define the options of this helper.
declare -Ar args_array=( [m]=manifest= [k]=key= )
local manifest
local key
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
python3 -c "import sys, json;print(json.load(open('$manifest', encoding='utf-8'))['$key'])"
}
# Read the upstream version from the manifest
# The version number in the manifest is defined by <upstreamversion>~ynh<packageversion>
# For example : 4.3-2~ynh3
# This include the number before ~ynh
# In the last example it return 4.3-2
#
# usage: ynh_app_upstream_version
ynh_app_upstream_version () {
manifest_path="../manifest.json"
if [ ! -e "$manifest_path" ]; then
manifest_path="../settings/manifest.json" # Into the restore script, the manifest is not at the same place
fi
version_key=$(ynh_read_manifest --manifest="$manifest_path" --key="version")
echo "${version_key/~ynh*/}"
}
# Read package version from the manifest
# The version number in the manifest is defined by <upstreamversion>~ynh<packageversion>
# For example : 4.3-2~ynh3
# This include the number after ~ynh
# In the last example it return 3
#
# usage: ynh_app_package_version
ynh_app_package_version () {
manifest_path="../manifest.json"
if [ ! -e "$manifest_path" ]; then
manifest_path="../settings/manifest.json" # Into the restore script, the manifest is not at the same place
fi
version_key=$(ynh_read_manifest --manifest="$manifest_path" --key="version")
echo "${version_key/*~ynh/}"
}
2017-06-09 14:03:32 +02:00
2019-04-21 15:32:30 +02:00
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================
2019-08-15 14:21:00 +02:00