Fix UI stuff

This commit is contained in:
th33xitus
2020-07-25 13:16:37 +02:00
parent a76cab0fe6
commit 64a7dec09d
3 changed files with 50 additions and 14 deletions

View File

@@ -75,6 +75,13 @@ print_msg(){
echo -e "#########################################################" echo -e "#########################################################"
echo -e "${default}" echo -e "${default}"
fi fi
if [[ "$HINT_MSG" != "" ]]; then
echo -e "${yellow}"
echo -e "#########################################################"
echo -e " $HINT_MSG "
echo -e "#########################################################"
echo -e "${default}"
fi
if [ "$CONFIRM_MSG" != "" ]; then if [ "$CONFIRM_MSG" != "" ]; then
echo -e "${green}" echo -e "${green}"
echo -e "#########################################################" echo -e "#########################################################"
@@ -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}"

View File

@@ -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(){

View File

@@ -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(){