refactor: update update_menu.sh and update functions

Signed-off-by: Dominik Willner th33xitus@gmail.com
This commit is contained in:
th33xitus
2022-04-12 16:02:48 +02:00
parent acd53953ae
commit 63ef9a07db
10 changed files with 207 additions and 181 deletions

View File

@@ -452,23 +452,18 @@ function get_moonraker_status(){
}
function get_local_moonraker_commit(){
if [ -d "${MOONRAKER_DIR}" ] && [ -d "${MOONRAKER_DIR}"/.git ]; then
cd "${MOONRAKER_DIR}"
commit="$(git describe HEAD --always --tags | cut -d "-" -f 1,2)"
else
commit="${NONE}"
fi
local commit
[ ! -d "${MOONRAKER_DIR}" ] || [ ! -d "${MOONRAKER_DIR}"/.git ] && return
cd "${MOONRAKER_DIR}"
commit="$(git describe HEAD --always --tags | cut -d "-" -f 1,2)"
echo "${commit}"
}
function get_remote_moonraker_commit(){
if [ -d "${MOONRAKER_DIR}" ] && [ -d "${MOONRAKER_DIR}"/.git ]; then
cd "${MOONRAKER_DIR}"
git fetch origin -q
commit=$(git describe origin/master --always --tags | cut -d "-" -f 1,2)
else
commit="${NONE}"
fi
local commit
[ ! -d "${MOONRAKER_DIR}" ] || [ ! -d "${MOONRAKER_DIR}"/.git ] && return
cd "${MOONRAKER_DIR}" && git fetch origin -q
commit=$(git describe origin/master --always --tags | cut -d "-" -f 1,2)
echo "${commit}"
}
@@ -480,7 +475,7 @@ function compare_moonraker_versions(){
if [ "${local_ver}" != "${remote_ver}" ]; then
versions="${yellow}$(printf " %-14s" "${local_ver}")${white}"
versions+="|${green}$(printf " %-13s" "${remote_ver}")${white}"
# add klipper to the update all array for the update all function in the updater
# add moonraker to the update all array for the update all function in the updater
MOONRAKER_UPDATE_AVAIL="true" && update_arr+=(update_moonraker)
else
versions="${green}$(printf " %-14s" "${local_ver}")${white}"