refactor(mainsail/fluidd): allow reading of version from release_info.json

Signed-off-by: Dominik Willner <th33xitus@gmail.com>
This commit is contained in:
th33xitus
2023-07-01 20:59:46 +02:00
parent 197058bd00
commit 979c39dc02
2 changed files with 19 additions and 7 deletions

View File

@@ -317,10 +317,16 @@ function get_fluidd_status() {
}
function get_local_fluidd_version() {
[[ ! -f "${FLUIDD_DIR}/.version" ]] && return
local versionfile="${FLUIDD_DIR}/.version"
local relinfofile="${FLUIDD_DIR}/release_info.json"
local version
version=$(head -n 1 "${FLUIDD_DIR}/.version")
if [[ -f ${relinfofile} ]]; then
version=$(grep -o '"version":"[^"]*' "${relinfofile}" | grep -o '[^"]*$')
elif [[ -f ${versionfile} ]]; then
version=$(head -n 1 "${versionfile}")
fi
echo "${version}"
}