jellyfin_new_version=$("${script_wd}"/releasetags "${jellyfin_repo_url}" | grep -vE -- '(dev|rc)' | head -n1 | sed 's/v//')
}
# }}}
main() { # {{{
## Define all vars according the selected options
define_vars
## Check if the current version is the last one {{{
if [ "${jellyfin_current_version}" != "${jellyfin_new_version}" ]; then
debug_message "Test Jellyfin version − \
Current version (${jellyfin_current_version}) and new one (${jellyfin_new_version}) seems to be different."
## Create a temp file to monitor
debug_message "Test Jellyfin version − \
Create ${jellyfin_new_version_file} temp file to monitore."
touch -- "${jellyfin_new_version_file}"
printf '\e[1;35m%-6s\e[m\n' "An upgrade is available for Jellyfin (current: ${jellyfin_current_version}): ${jellyfin_new_version}." >> "${jellyfin_new_version_file}"
else
debug_message "Test Jellyfin version − \
The current version is up-to-date."
rm -f -- "${jellyfin_new_version_file}"
fi
## }}}
}
# }}}
# Manage arguments # {{{
# This code can't be in a function due to arguments
if [ ! "${NBARGS}" -eq "0" ]; then
## If the first argument is not an option
if ! printf -- '%s' "${1}" | grep -q -E -- "^-+";
then
usage
error_message "Unknown argument (${1}), check the help." 2
fi
manage_arg="0"
# Parse all options (start with a "-") one by one
while printf -- '%s' "${1}" | grep -q -E -- "^-+"; do