mirror of
https://github.com/dw-0/kiauh.git
synced 2025-12-14 02:54:28 +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
|
||||
echo -e "${red}"
|
||||
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 "${default}"
|
||||
fi
|
||||
if [ "$CONFIRM_MSG" != "" ]; then
|
||||
echo -e "${green}"
|
||||
echo -e "#########################################################"
|
||||
echo -e "$CONFIRM_MSG "
|
||||
echo -e " $CONFIRM_MSG "
|
||||
echo -e "#########################################################"
|
||||
echo -e "${default}"
|
||||
fi
|
||||
@@ -102,7 +109,7 @@ main_menu(){
|
||||
0)
|
||||
clear
|
||||
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=""
|
||||
main_ui;;
|
||||
1)
|
||||
@@ -186,10 +193,10 @@ install_menu(){
|
||||
|
||||
update_menu(){
|
||||
print_header
|
||||
print_msg && CONFIRM_MSG="" && ERROR_MSG=""
|
||||
read_bb4u_stat
|
||||
#compare versions
|
||||
ui_print_versions
|
||||
print_msg && CONFIRM_MSG="" && HINT_MSG="" && ERROR_MSG=""
|
||||
read_bb4u_stat
|
||||
update_ui
|
||||
while true; do
|
||||
echo -e "${cyan}"
|
||||
@@ -425,7 +432,7 @@ switch_menu(){
|
||||
esac
|
||||
done
|
||||
else
|
||||
ERROR_MSG=" No Klipper directory found! Download Klipper first!"
|
||||
ERROR_MSG="No Klipper directory found! Download Klipper first!"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#TODO:
|
||||
# - check for existing/running octoprint service
|
||||
# - ask for permission to disable octoprint service
|
||||
|
||||
dwc2_install_routine(){
|
||||
@@ -134,8 +133,24 @@ DWC2
|
||||
}
|
||||
|
||||
install_dwc2(){
|
||||
#the update_dwc2 function does the same as installing dwc2
|
||||
update_dwc2 && ok_msg "DWC2 Web UI installed!"
|
||||
#check dependencies
|
||||
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(){
|
||||
|
||||
@@ -134,7 +134,7 @@ read_local_klipper_commit(){
|
||||
cd $KLIPPER_DIR
|
||||
LOCAL_COMMIT=$(git rev-parse --short=8 HEAD)
|
||||
else
|
||||
LOCAL_COMMIT=""
|
||||
LOCAL_COMMIT="${red}--------${default}"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -148,7 +148,8 @@ read_remote_klipper_commit(){
|
||||
fi
|
||||
REMOTE_COMMIT=$(git rev-parse --short=8 $GET_BRANCH)
|
||||
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
|
||||
}
|
||||
|
||||
@@ -175,6 +176,7 @@ read_dwc2fk_versions(){
|
||||
else
|
||||
LOCAL_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
|
||||
}
|
||||
|
||||
@@ -200,7 +202,13 @@ read_local_dwc2_version(){
|
||||
}
|
||||
|
||||
read_remote_dwc2_version(){
|
||||
DWC2_REMOTE_VER=$(curl -s https://api.github.com/repositories/28820678/releases/latest | grep tag_name | cut -d'"' -f4)
|
||||
#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)
|
||||
fi
|
||||
}
|
||||
|
||||
compare_dwc2_versions(){
|
||||
@@ -226,8 +234,14 @@ read_local_mainsail_version(){
|
||||
}
|
||||
|
||||
read_remote_mainsail_version(){
|
||||
get_mainsail_ver
|
||||
MAINSAIL_REMOTE_VER=$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
|
||||
MAINSAIL_REMOTE_VER=$MAINSAIL_VERSION
|
||||
fi
|
||||
}
|
||||
|
||||
compare_mainsail_versions(){
|
||||
|
||||
Reference in New Issue
Block a user