mirror of
https://github.com/dw-0/kiauh.git
synced 2025-12-14 11:04:29 +05:00
Fix UI stuff
This commit is contained in:
19
kiauh.sh
19
kiauh.sh
@@ -71,14 +71,21 @@ print_msg(){
|
|||||||
if [[ "$ERROR_MSG" != "" ]]; then
|
if [[ "$ERROR_MSG" != "" ]]; then
|
||||||
echo -e "${red}"
|
echo -e "${red}"
|
||||||
echo -e "#########################################################"
|
echo -e "#########################################################"
|
||||||
echo -e "$ERROR_MSG "
|
echo -e " $ERROR_MSG "
|
||||||
|
echo -e "#########################################################"
|
||||||
|
echo -e "${default}"
|
||||||
|
fi
|
||||||
|
if [[ "$HINT_MSG" != "" ]]; then
|
||||||
|
echo -e "${yellow}"
|
||||||
|
echo -e "#########################################################"
|
||||||
|
echo -e " $HINT_MSG "
|
||||||
echo -e "#########################################################"
|
echo -e "#########################################################"
|
||||||
echo -e "${default}"
|
echo -e "${default}"
|
||||||
fi
|
fi
|
||||||
if [ "$CONFIRM_MSG" != "" ]; then
|
if [ "$CONFIRM_MSG" != "" ]; then
|
||||||
echo -e "${green}"
|
echo -e "${green}"
|
||||||
echo -e "#########################################################"
|
echo -e "#########################################################"
|
||||||
echo -e "$CONFIRM_MSG "
|
echo -e " $CONFIRM_MSG "
|
||||||
echo -e "#########################################################"
|
echo -e "#########################################################"
|
||||||
echo -e "${default}"
|
echo -e "${default}"
|
||||||
fi
|
fi
|
||||||
@@ -102,7 +109,7 @@ main_menu(){
|
|||||||
0)
|
0)
|
||||||
clear
|
clear
|
||||||
print_header
|
print_header
|
||||||
ERROR_MSG=" Sorry this function is not implemented yet!"
|
ERROR_MSG="Sorry this function is not implemented yet!"
|
||||||
print_msg && CONFIRM_MSG="" && ERROR_MSG=""
|
print_msg && CONFIRM_MSG="" && ERROR_MSG=""
|
||||||
main_ui;;
|
main_ui;;
|
||||||
1)
|
1)
|
||||||
@@ -186,10 +193,10 @@ install_menu(){
|
|||||||
|
|
||||||
update_menu(){
|
update_menu(){
|
||||||
print_header
|
print_header
|
||||||
print_msg && CONFIRM_MSG="" && ERROR_MSG=""
|
|
||||||
read_bb4u_stat
|
|
||||||
#compare versions
|
#compare versions
|
||||||
ui_print_versions
|
ui_print_versions
|
||||||
|
print_msg && CONFIRM_MSG="" && HINT_MSG="" && ERROR_MSG=""
|
||||||
|
read_bb4u_stat
|
||||||
update_ui
|
update_ui
|
||||||
while true; do
|
while true; do
|
||||||
echo -e "${cyan}"
|
echo -e "${cyan}"
|
||||||
@@ -425,7 +432,7 @@ switch_menu(){
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
ERROR_MSG=" No Klipper directory found! Download Klipper first!"
|
ERROR_MSG="No Klipper directory found! Download Klipper first!"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#TODO:
|
#TODO:
|
||||||
# - check for existing/running octoprint service
|
|
||||||
# - ask for permission to disable octoprint service
|
# - ask for permission to disable octoprint service
|
||||||
|
|
||||||
dwc2_install_routine(){
|
dwc2_install_routine(){
|
||||||
@@ -134,8 +133,24 @@ DWC2
|
|||||||
}
|
}
|
||||||
|
|
||||||
install_dwc2(){
|
install_dwc2(){
|
||||||
#the update_dwc2 function does the same as installing dwc2
|
#check dependencies
|
||||||
update_dwc2 && ok_msg "DWC2 Web UI installed!"
|
dep=(wget gzip tar curl)
|
||||||
|
dependency_check
|
||||||
|
#execute operation
|
||||||
|
GET_DWC2_URL=`curl -s https://api.github.com/repositories/28820678/releases/latest | grep browser_download_url | cut -d'"' -f4`
|
||||||
|
if [ ! -d $DWC2_DIR/web ]; then
|
||||||
|
mkdir -p $DWC2_DIR/web
|
||||||
|
fi
|
||||||
|
cd $DWC2_DIR/web
|
||||||
|
status_msg "Downloading DWC2 Web UI ..."
|
||||||
|
wget -q $GET_DWC2_URL && ok_msg "Download complete!"
|
||||||
|
status_msg "Unzipping archive ..."
|
||||||
|
unzip -q -o *.zip && for f_ in $(find . | grep '.gz');do gunzip -f ${f_};done && ok_msg "Done!"
|
||||||
|
status_msg "Writing version to file ..."
|
||||||
|
echo $GET_DWC2_URL | cut -d/ -f8 > $DWC2_DIR/web/version && ok_msg "Done!"
|
||||||
|
status_msg "Do a little cleanup ..."
|
||||||
|
rm -rf DuetWebControl-SD.zip && ok_msg "Done!"
|
||||||
|
ok_msg "DWC2 Web UI installed!"
|
||||||
}
|
}
|
||||||
|
|
||||||
dwc2_reverse_proxy_dialog(){
|
dwc2_reverse_proxy_dialog(){
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ read_local_klipper_commit(){
|
|||||||
cd $KLIPPER_DIR
|
cd $KLIPPER_DIR
|
||||||
LOCAL_COMMIT=$(git rev-parse --short=8 HEAD)
|
LOCAL_COMMIT=$(git rev-parse --short=8 HEAD)
|
||||||
else
|
else
|
||||||
LOCAL_COMMIT=""
|
LOCAL_COMMIT="${red}--------${default}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,7 +148,8 @@ read_remote_klipper_commit(){
|
|||||||
fi
|
fi
|
||||||
REMOTE_COMMIT=$(git rev-parse --short=8 $GET_BRANCH)
|
REMOTE_COMMIT=$(git rev-parse --short=8 $GET_BRANCH)
|
||||||
else
|
else
|
||||||
REMOTE_COMMIT=""
|
REMOTE_COMMIT="${red}--------${default}"
|
||||||
|
HINT_MSG="Can't fetch all remote versions!\n No git repo available or curl not installed!"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,6 +176,7 @@ read_dwc2fk_versions(){
|
|||||||
else
|
else
|
||||||
LOCAL_DWC2FK_COMMIT="${red}--------${default}"
|
LOCAL_DWC2FK_COMMIT="${red}--------${default}"
|
||||||
REMOTE_DWC2FK_COMMIT="${red}--------${default}"
|
REMOTE_DWC2FK_COMMIT="${red}--------${default}"
|
||||||
|
HINT_MSG="Can't fetch all remote versions!\n No git repo available or curl not installed!"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -200,7 +202,13 @@ read_local_dwc2_version(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
read_remote_dwc2_version(){
|
read_remote_dwc2_version(){
|
||||||
|
#remote checks don't work without curl installed!
|
||||||
|
if [[ ! $(dpkg-query -f'${Status}' --show curl 2>/dev/null) = *\ installed ]]; then
|
||||||
|
DWC2_REMOTE_VER="${red}-----${default}"
|
||||||
|
HINT_MSG="Can't fetch all remote versions!\n No git repo available or curl not installed!"
|
||||||
|
else
|
||||||
DWC2_REMOTE_VER=$(curl -s https://api.github.com/repositories/28820678/releases/latest | grep tag_name | cut -d'"' -f4)
|
DWC2_REMOTE_VER=$(curl -s https://api.github.com/repositories/28820678/releases/latest | grep tag_name | cut -d'"' -f4)
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
compare_dwc2_versions(){
|
compare_dwc2_versions(){
|
||||||
@@ -226,8 +234,14 @@ read_local_mainsail_version(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
read_remote_mainsail_version(){
|
read_remote_mainsail_version(){
|
||||||
|
#remote checks don't work without curl installed!
|
||||||
|
if [[ ! $(dpkg-query -f'${Status}' --show curl 2>/dev/null) = *\ installed ]]; then
|
||||||
|
MAINSAIL_REMOTE_VER="${red}------${default}"
|
||||||
|
HINT_MSG="Can't fetch all remote versions!\n No git repo available or curl not installed!"
|
||||||
|
else
|
||||||
get_mainsail_ver
|
get_mainsail_ver
|
||||||
MAINSAIL_REMOTE_VER=$MAINSAIL_VERSION
|
MAINSAIL_REMOTE_VER=$MAINSAIL_VERSION
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
compare_mainsail_versions(){
|
compare_mainsail_versions(){
|
||||||
|
|||||||
Reference in New Issue
Block a user