feat: KIAUH v4.0.0 #191
33
kiauh.sh
33
kiauh.sh
@@ -38,6 +38,37 @@ DMBUTYUGIN_REPO=https://github.com/dmbutyugin/klipper.git
|
||||
BRANCH_SCURVE_SMOOTHING=dmbutyugin/scurve-smoothing
|
||||
BRANCH_SCURVE_SHAPING=dmbutyugin/scurve-shaping
|
||||
|
||||
#===================================================#
|
||||
#=================== UPDATE KIAUH ==================#
|
||||
#===================================================#
|
||||
|
||||
function update_kiauh(){
|
||||
status_msg "Updating KIAUH ..."
|
||||
cd "${SRCDIR}/kiauh"
|
||||
git reset --hard && git pull
|
||||
ok_msg "Update complete! Please restart KIAUH."
|
||||
exit 0
|
||||
}
|
||||
|
||||
#===================================================#
|
||||
#=================== KIAUH STATUS ==================#
|
||||
#===================================================#
|
||||
|
||||
function kiauh_update_avail(){
|
||||
[ ! -d "${SRCDIR}/kiauh/.git" ] && return
|
||||
local origin head
|
||||
cd "${SRCDIR}/kiauh"
|
||||
### abort if not on master branch
|
||||
! git branch -a | grep -q "\* master" && return
|
||||
### compare commit hash
|
||||
git fetch -q
|
||||
origin=$(git rev-parse --short=8 origin/master)
|
||||
head=$(git rev-parse --short=8 HEAD)
|
||||
if [ "${origin}" != "${head}" ]; then
|
||||
echo "true"
|
||||
fi
|
||||
}
|
||||
|
||||
### format some default message types
|
||||
select_msg() {
|
||||
echo -e "${white}>>>>>> $1"
|
||||
@@ -113,5 +144,5 @@ clear_msg(){
|
||||
|
||||
check_euid
|
||||
init_ini
|
||||
kiauh_status
|
||||
kiauh_update_avail
|
||||
main_menu
|
||||
|
||||
@@ -1,15 +1,3 @@
|
||||
kiauh_status(){
|
||||
if [ -d "${SRCDIR}/kiauh/.git" ]; then
|
||||
cd ${SRCDIR}/kiauh
|
||||
if git branch -a | grep "* master" -q; then
|
||||
git fetch -q
|
||||
if [[ "$(git rev-parse --short=8 origin/master)" != "$(git rev-parse --short=8 HEAD)" ]]; then
|
||||
KIAUH_UPDATE_AVAIL="true"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
check_system_updates(){
|
||||
SYS_UPDATE=$(apt list --upgradeable 2>/dev/null | sed "1d")
|
||||
if [ ! -z "$SYS_UPDATE" ]; then
|
||||
|
||||
@@ -54,18 +54,6 @@ print_header(){
|
||||
bottom_border
|
||||
}
|
||||
|
||||
kiauh_update_msg(){
|
||||
top_border
|
||||
echo -e "|${green} New KIAUH update available! ${default}| "
|
||||
hr
|
||||
echo -e "|${green} View Changelog: https://git.io/JnmlX ${default}| "
|
||||
blank_line
|
||||
echo -e "|${yellow} It is recommended to keep KIAUH up to date. Updates ${default}| "
|
||||
echo -e "|${yellow} usually contain bugfixes, important changes or new ${default}| "
|
||||
echo -e "|${yellow} features. Please consider updating! ${default}| "
|
||||
bottom_border
|
||||
}
|
||||
|
||||
################################################################################
|
||||
#******************************************************************************#
|
||||
################################################################################
|
||||
|
||||
@@ -12,13 +12,12 @@
|
||||
set -e
|
||||
|
||||
main_ui(){
|
||||
#[ $KIAUH_UPDATE_REMIND="true" ] && kiauh_update_reminder
|
||||
top_border
|
||||
echo -e "| $(title_msg "~~~~~~~~~~~~~~~ [ Main Menu ] ~~~~~~~~~~~~~~~") |"
|
||||
hr
|
||||
echo -e "| 0) [Upload Log] | Klipper: $(get_klipper_status)|"
|
||||
echo -e "| | |"
|
||||
echo -e "| 1) [Install] |--------------------------------|"
|
||||
echo -e "| 1) [Install] | |"
|
||||
echo -e "| 2) [Update] | Moonraker: $(get_moonraker_status)|"
|
||||
echo -e "| 3) [Remove] | |"
|
||||
echo -e "| 4) [Advanced] | Mainsail: $MAINSAIL_STATUS|"
|
||||
@@ -26,21 +25,31 @@ main_ui(){
|
||||
echo -e "| | KlipperScreen: $KLIPPERSCREEN_STATUS|"
|
||||
echo -e "| 6) [Settings] | Telegram Bot: $MOONRAKER_TELEGRAM_BOT_STATUS|"
|
||||
echo -e "| | |"
|
||||
echo -e "| ${cyan}${KIAUH_VER}${white}| Octoprint: $OCTOPRINT_STATUS|"
|
||||
echo -e "| $(get_kiauh_version)| Octoprint: $OCTOPRINT_STATUS|"
|
||||
quit_footer
|
||||
}
|
||||
|
||||
print_kiauh_version(){
|
||||
cd ${SRCDIR}/kiauh
|
||||
KIAUH_VER=$(git describe HEAD --always --tags | cut -d "-" -f 1,2)
|
||||
KIAUH_VER="$(printf "%-20s" "$KIAUH_VER")"
|
||||
get_kiauh_version(){
|
||||
local version
|
||||
cd "${SRCDIR}/kiauh"
|
||||
version="$(printf "%-20s" "$(git describe HEAD --always --tags | cut -d "-" -f 1,2)")"
|
||||
echo "${cyan}${version}${white}"
|
||||
}
|
||||
|
||||
kiauh_update_dialog(){
|
||||
kiauh_update_msg
|
||||
read -p "${cyan}Do you want to update now? (Y/n):${default} " yn
|
||||
[ ! "$(kiauh_update_avail)" == "true" ] && return
|
||||
top_border
|
||||
echo -e "|${green} New KIAUH update available! ${white}| "
|
||||
hr
|
||||
echo -e "|${green} View Changelog: https://git.io/JnmlX ${white}| "
|
||||
blank_line
|
||||
echo -e "|${yellow} It is recommended to keep KIAUH up to date. Updates ${white}| "
|
||||
echo -e "|${yellow} usually contain bugfixes, important changes or new ${white}| "
|
||||
echo -e "|${yellow} features. Please consider updating! ${white}| "
|
||||
bottom_border
|
||||
read -p "${cyan}Do you want to update now? (Y/n):${white} " yn
|
||||
while true; do
|
||||
case "$yn" in
|
||||
case "${yn}" in
|
||||
Y|y|Yes|yes|"")
|
||||
do_action "update_kiauh"
|
||||
break;;
|
||||
@@ -53,24 +62,18 @@ kiauh_update_dialog(){
|
||||
|
||||
main_menu(){
|
||||
print_header
|
||||
#print KIAUH update msg if update available
|
||||
if [ "$KIAUH_UPDATE_AVAIL" = "true" ]; then
|
||||
kiauh_update_dialog
|
||||
fi
|
||||
#prompt for KIAUH update if update available
|
||||
kiauh_update_dialog
|
||||
#check install status
|
||||
print_kiauh_version
|
||||
# klipper_status
|
||||
# moonraker_status
|
||||
fluidd_status
|
||||
mainsail_status
|
||||
octoprint_status
|
||||
klipperscreen_status
|
||||
MoonrakerTelegramBot_status
|
||||
# print_branch
|
||||
print_msg && clear_msg
|
||||
main_ui
|
||||
while true; do
|
||||
read -p "${cyan}Perform action:${default} " action; echo
|
||||
read -p "${cyan}Perform action:${white} " action; echo
|
||||
case "${action}" in
|
||||
"start klipper") do_action_service "start" "klipper"; main_ui;;
|
||||
"stop klipper") do_action_service "stop" "klipper"; main_ui;;
|
||||
@@ -90,7 +93,7 @@ main_menu(){
|
||||
5) clear && backup_menu && break;;
|
||||
6) clear && settings_menu && break;;
|
||||
Q|q)
|
||||
echo -e "${green}###### Happy printing! ######${default}"; echo
|
||||
echo -e "${green}###### Happy printing! ######${white}"; echo
|
||||
exit 0;;
|
||||
*)
|
||||
deny_action "main_ui";;
|
||||
|
||||
@@ -1,14 +1,3 @@
|
||||
update_kiauh(){
|
||||
if [ "$KIAUH_UPDATE_AVAIL" = "true" ]; then
|
||||
status_msg "Updating KIAUH ..."
|
||||
cd ${SRCDIR}/kiauh
|
||||
### force reset kiauh before updating
|
||||
git reset --hard
|
||||
git pull && ok_msg "Update complete! Please restart KIAUH."
|
||||
exit -1
|
||||
fi
|
||||
}
|
||||
|
||||
update_all(){
|
||||
while true; do
|
||||
if [ "${#update_arr[@]}" = "0" ]; then
|
||||
|
||||
Reference in New Issue
Block a user