mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
helpers: Simplify manifest path / parsing
This commit is contained in:
parent
61feb39c96
commit
ce04570bfd
2 changed files with 4 additions and 7 deletions
|
@ -224,13 +224,10 @@ ynh_install_app_dependencies () {
|
||||||
# Add a comma for each space between packages. But not add a comma if the space separate a version specification. (See below)
|
# Add a comma for each space between packages. But not add a comma if the space separate a version specification. (See below)
|
||||||
dependencies="$(echo "$dependencies" | sed 's/\([^\<=\>]\)\ \([^(]\)/\1, \2/g')"
|
dependencies="$(echo "$dependencies" | sed 's/\([^\<=\>]\)\ \([^(]\)/\1, \2/g')"
|
||||||
local dependencies=${dependencies//|/ | }
|
local dependencies=${dependencies//|/ | }
|
||||||
local manifest_path="../manifest.json"
|
local manifest_path="$YNH_APP_BASEDIR/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
|
|
||||||
|
|
||||||
local version=$(grep '\"version\": ' "$manifest_path" | cut --delimiter='"' --fields=4) # Retrieve the version number in the manifest file.
|
local version=$(jq -r '.version' "$manifest_path")
|
||||||
if [ ${#version} -eq 0 ]; then
|
if [ -z "${version}" ] || [ "$version" == "null" ]; then
|
||||||
version="1.0"
|
version="1.0"
|
||||||
fi
|
fi
|
||||||
local dep_app=${app//_/-} # Replace all '_' by '-'
|
local dep_app=${app//_/-} # Replace all '_' by '-'
|
||||||
|
|
|
@ -553,7 +553,7 @@ ynh_read_manifest () {
|
||||||
|
|
||||||
if [ ! -e "$manifest" ]; then
|
if [ ! -e "$manifest" ]; then
|
||||||
# If the manifest isn't found, try the common place for backup and restore script.
|
# If the manifest isn't found, try the common place for backup and restore script.
|
||||||
manifest="../settings/manifest.json"
|
manifest="$YNH_APP_BASEDIR/manifest.json"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
jq ".$manifest_key" "$manifest" --raw-output
|
jq ".$manifest_key" "$manifest" --raw-output
|
||||||
|
|
Loading…
Add table
Reference in a new issue