From 1eecf3e1395f3357866b206a4bb8d1999697ac4c Mon Sep 17 00:00:00 2001 From: th33xitus <31533186+th33xitus@users.noreply.github.com> Date: Mon, 13 Jul 2020 16:50:53 +0200 Subject: [PATCH 01/64] Update README.md wip message --- README.md | 44 ++------------------------------------------ 1 file changed, 2 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index cf2953b..b0a76b8 100644 --- a/README.md +++ b/README.md @@ -8,45 +8,5 @@ There are also functions for updating your current installations or removing the ## First things first: When you decide to use this script, you use it at your own risk! -Although i implemented backup-functions for pretty much everything and tested this script extensively with my available (yet limited) hardware before releasing it, it doesn't mean that it will work 100% perfect for everyone out there. Please keep that in mind! - -Give it a try if you want and if you have suggestions or encounter any problems, please report them. But i can't guarantee that i will fix them immediately (or at all). - -[![kiauh](https://abload.de/img/putty_20-05-22_18-49-1nkaa.png)](https://abload.de/image.php?img=putty_20-05-22_18-49-1nkaa.png) - -## Instructions: -In order to run this script you have to make it executable. Use the following commands in the given order to download and execute the script. -``` -cd ~ -git clone https://github.com/th33xitus/KIAUH.git -cd ~/KIAUH -chmod +x kiauh.sh -./kiauh.sh -``` - -## Restrictions: -* Tested only on Raspbian Buster Lite - -## Functions and features: -* Install Klipper + DWC2-for-klipper + DWC2 from scratch -* Check the status of your installations -* Update, backup and remove existing installations -* Building firmware -* Flashing firmware to your MCU -* Grabbing the printer-ID of your connected printer -* Writing the printer-ID to your printer.cfg -* Writing the DWC2-for-Klipper example config to your printer.cfg - - - -## Q&A - -__*Q: Can i install octoprint with this script?*__ - -**A:** No, and i don't plan to implement this function - - -__*Q: Can i use this script to install multiple instancec of Klipper on the same Pi? (Multisession?)*__ - - **A:** No, and at the moment i don't plan to implement this function. For multisession installations take a look at this script manu7irl created: https://github.com/manu7irl/klipper-DWC2-installer - +# THIS VERSION IS WORK IN PROGRESS!!! +# BUGS MAY BE STILL PRESENT!!! From d7ff3f86755a9498fe520990ba9ba147c8c1243e Mon Sep 17 00:00:00 2001 From: th33xitus <31533186+th33xitus@users.noreply.github.com> Date: Mon, 13 Jul 2020 16:59:40 +0200 Subject: [PATCH 02/64] Upload v2.0 Uploading a complete rewrite of the original script. --- kiauh.ini | 1 + kiauh.sh | 1137 +++++++++++------------------------ scripts/backup.sh | 74 +++ scripts/functions.sh | 185 ++++++ scripts/install_dwc2.sh | 166 +++++ scripts/install_klipper.sh | 30 + scripts/install_mainsail.sh | 349 +++++++++++ scripts/remove.sh | 145 +++++ scripts/status.sh | 226 +++++++ scripts/switch_branch.sh | 41 ++ scripts/ui.sh | 154 +++++ scripts/update.sh | 77 +++ 12 files changed, 1811 insertions(+), 774 deletions(-) create mode 100644 kiauh.ini create mode 100644 scripts/backup.sh create mode 100644 scripts/functions.sh create mode 100644 scripts/install_dwc2.sh create mode 100644 scripts/install_klipper.sh create mode 100644 scripts/install_mainsail.sh create mode 100644 scripts/remove.sh create mode 100644 scripts/status.sh create mode 100644 scripts/switch_branch.sh create mode 100644 scripts/ui.sh create mode 100644 scripts/update.sh diff --git a/kiauh.ini b/kiauh.ini new file mode 100644 index 0000000..984cb48 --- /dev/null +++ b/kiauh.ini @@ -0,0 +1 @@ +backup_before_update=false \ No newline at end of file diff --git a/kiauh.sh b/kiauh.sh index 52304bf..57fdc79 100644 --- a/kiauh.sh +++ b/kiauh.sh @@ -2,797 +2,386 @@ clear set -e -### init color variables +### set some variables +ERROR_MSG="" green="\e[92m" yellow="\e[93m" red="\e[91m" cyan="\e[96m" default="\e[39m" -### setup repos -KLIPPER_REPO=https://github.com/KevinOConnor/klipper.git -DWC2FK_REPO=https://github.com/Stephan3/dwc2-for-klipper.git -#DWC2FK_REPO=https://github.com/pluuuk/dwc2-for-klipper.git -#DWC2FK_REPO=https://github.com/th33xitus/dwc2-for-klipper.git +### set some messages +warn_msg(){ + echo -e "${red} $1${default}" +} +status_msg(){ + echo; echo -e "${yellow}###### $1${default}" +} +ok_msg(){ + echo -e "${green}>>>>>> $1${default}" +} +title_msg(){ + echo -e "${cyan}$1${default}" +} +get_date(){ + current_date=`date +"%Y-%m-%d_%H%M%S"` +} -## setup some file and folder paths +### sourcing all additional scripts +for script in ${HOME}/kiauh/scripts/*; do . $script; done + +### set important directories +#klipper KLIPPER_DIR=${HOME}/klipper +KLIPPY_ENV_DIR=${HOME}/klippy-env +KLIPPER_SERVICE1=/etc/init.d/klipper +KLIPPER_SERVICE2=/etc/default/klipper +#dwc2 DWC2FK_DIR=${HOME}/dwc2-for-klipper -DWC2FK_SYSDIR=${HOME}/klippy-env/lib/python2.7/site-packages/tornado DWC2_DIR=${HOME}/sdcard/dwc2 -BACKUP_DIR=${HOME}/backup -CFG_FILE=${HOME}/printer.cfg -KLIPPER_SYSFILE1=/etc/init.d/klipper -KLIPPER_SYSFILE2=/etc/default/klipper +WEB_DWC2=${HOME}/klipper/klippy/extras/web_dwc2.py +TORNADO_DIR1=${HOME}/klippy-env/lib/python2.7/site-packages/tornado +TORNADO_DIR2=${HOME}/klippy-env/lib/python2.7/site-packages/tornado-5.1.1.dist-info +#mainsail/moonraker +MAINSAIL_DIR=${HOME}/mainsail +MAINSAIL_SERVICE1=/etc/init.d/moonraker +MAINSAIL_SERVICE2=/etc/default/moonraker +#misc +BACKUP_DIR=${HOME}/kiauh-backups +PRINTER_CFG=${HOME}/printer.cfg -print_header(){ - echo -e "###################################################" - echo -e "## $(title_msg "> > > > > > > > > KIAUH < < < < < < < < <") ##" - echo -e "## $(title_msg "Klipper Installation And Update Helper") ##" - echo -e "## --------------------------------------------- ##" - echo -e "## Install, update and backup: ##" - echo -e "## Klipper | DWC2-for-Klipper | DWC2 web UI ##" - echo -e "## --------------------------------------------- ##" - echo -e "## by th33xitus ##" - echo -e "## credits to: lixxbox ##" - echo -e "###################################################" +### set github repos +KLIPPER_REPO=https://github.com/KevinOConnor/klipper.git +ARKSINE_REPO=https://github.com/Arksine/klipper.git +DMBUTYUGIN_REPO=https://github.com/dmbutyugin/klipper.git +DWC2FK_REPO=https://github.com/Stephan3/dwc2-for-klipper.git +#branches +BRANCH_MOONRAKER=Arksine/work-web_server-20200131 +BRANCH_DEV_MOONRAKER=Arksine/dev-moonraker-testing +BRANCH_SCURVE_SMOOTHING=dmbutyugin/scurve-smoothing +BRANCH_SCURVE_SHAPING=dmbutyugin/scurve-shaping + +print_error_msg(){ + if [[ "$ERROR_MSG" != "" ]]; then + echo -e "${red}" + echo -e "#########################################################" + echo -e "$ERROR_MSG " + echo -e "#########################################################" + echo -e "${default}" + fi } main_menu(){ - echo - echo -e "/=================================================\ " - echo -e "| $(title_msg "Please choose the action you want to perform:") |" - echo -e "|-------------------------------------------------|" - echo -e "| 0) Check system status |" - echo -e "| |" - echo -e "| 1) ${green}[Install]${default} 2) ${yellow}[Advanced]${default} 3) ${red}[Uninstall]${default} |" - echo -e "|------------------------+------------------------|" - echo -e "| Update | Backup |" - echo -e "|------------------------+------------------------|" - echo -e "| 4) Update all | 8) Backup all |" - echo -e "| 5) Klipper | 9) Klipper |" - echo -e "| 6) dwc2-for-klipper | 10) dwc2-for-klipper |" - echo -e "| 7) DWC2 | 11) DWC2 |" - echo -e "|------------------------+------------------------|" - echo -e "| $(warn_msg "Q) Quit") |" - echo -e "\=================================================/" + print_header + print_error_msg && ERROR_MSG="" + #check install status + klipper_status + dwc2_status + mainsail_status + print_branch + main_ui + while true; do read -p "Perform action: " action; echo - action -} - -### declare some functions -warn_msg(){ - echo -e "${red}$1${default}" -} -status_msg(){ - echo -e "${yellow}## $1${default}" -} -confirm_msg(){ - echo -e "${green}>> $1${default}" -} -title_msg(){ - echo -e "${cyan}$1${default}" -} -get_date(){ - current_date=`date +"%Y-%m-%d_%H%M%S"` -} - -### checking for root -check_euid(){ - if [ "$EUID" -eq 0 ] - then - echo -e "/=================================================\ " - echo -e "| $(warn_msg "DON'T RUN THIS SCRIPT AS ROOT!") |" - echo -e "\=================================================/ "; exit 1 - fi -} - -### check for package dependencies -dependency_check(){ - package=(curl wget virtualenv unzip git) - - for pkg in "${package[@]}"; do - if ! command -v $pkg >&/dev/null 2>&1 - then - install+=($package) - fi - done - - if ! [ ${#install[@]} -eq 0 ] - then - status_msg "The following packages are missing:" - echo -e "${red}${install[@]}${default}" - status_msg "They are necessary for this script to work." - status_msg "Please install them now or do it manually!" - echo - while true; do - read -p "Do you want to install them now? (Y/n): " yn - case "$yn" in - Y|y|Yes|yes|"") - echo; status_msg "Installing dependencies ..." - sudo apt install ${install[@]} -y && echo && confirm_msg "Dependencies successfully installed!"; echo; break;; - N|n|No|no) break;; - *) warn_msg "Unknown parameter: $yn"; echo;; - esac - done - fi -} - -### checking for existing installations on startup -start_check(){ - check_files - echo; status_msg "Klipper installation: $klipper_status" - echo; status_msg "DWC2 web UI installation: $dwc2_status" - echo; status_msg "DWC2-for-Klipper installation: $dwc2fk_status" -} -check_files(){ - if [[ -f $KLIPPER_SYSFILE1 && -f $KLIPPER_SYSFILE2 ]] - then - if [ -d $KLIPPER_DIR ] - then - klipper_status="${green}Found!${default}" - else - klipper_status="${yellow}Incomplete!${default}" - fi - else - klipper_status="${red}Not found!${default}" - fi - if [ -d $DWC2FK_SYSDIR ] - then - if [ -d $DWC2FK_DIR ] - then - dwc2fk_status="${green}Found!${default}" - else - dwc2fk_status="${yellow}Incomplete!${default}" - fi - else - dwc2fk_status="${red}Not found!${default}" - fi - if [ -d $DWC2_DIR/web ] - then - dwc2_status="${green}Found!${default}" - else - dwc2_status="${red}Not found!${default}" - fi -} - -### functions for writing to printer.cfg -write_printid_cfg(){ - echo - while true; do - read -p "Do you want to write this ID to your printer.cfg now? (Y/n): " yn - case "$yn" in - Y|y|Yes|yes|"") - backup_cfg - echo -e "\n#############################\n### AUTO CREATED by KIAUH ###\n#############################\n[mcu]\nserial: $usb_id" >> $CFG_FILE - echo; confirm_msg "Config written!" - break - ;; - N|n|No|no) - break - ;; - *) - echo; warn_msg "Unknown parameter: $yn" - esac - done -} -write_dwc2fk_cfg(){ - echo - while true; do - echo -n -e "Do you want to write the configuration example\nto your printer.cfg? (Y/n): " - read yn - case "$yn" in - Y|y|Yes|yes|"") - backup_cfg - echo -e "\n#############################\n### AUTO CREATED by KIAUH ###\n#############################\n[virtual_sdcard]\npath: ~/sdcard\n\n[web_dwc2]\n# optional - defaulting to Klipper\nprinter_name: Reiner Calmund\n# optional - defaulting to 127.0.0.1\nlisten_adress: 0.0.0.0\n# needed - use above 1024 as nonroot\nlisten_port: 4750\n#optional defaulting to dwc2/web. Its a folder relative to your virtual sdcard.\nweb_path: dwc2/web" >> $CFG_FILE - echo; confirm_msg "Config written!"; echo; break - ;; - N|n|No|no) - break - ;; - *) - warn_msg "Unknown parameter: $yn"; echo - esac - done -} - -### grab the printers id -get_usb_id(){ - echo; status_msg "Identifying the correct USB port ..." - warn_msg "Make sure your printer is the only USB device connected!" - usb_id=`ls /dev/serial/by-id/*` - if [ -L /dev/serial/by-id/* ] - then - echo; status_msg "The ID of your printer is:" - title_msg "$usb_id"; echo - else - echo; warn_msg "Could not retrieve ID!" - fi -} - -build_fw(){ - status_msg "--- Starting Klipper Firmware Configuration ---" - if [ -d $KLIPPER_DIR ] - then - cd $KLIPPER_DIR && make menuconfig - status_msg "Building firmware ..." - make clean && make && confirm_msg "Firmware built!" - else - warn_msg "Can not build firmware without a Klipper directory!" - fi -} - -flash_routine(){ - echo; status_msg "--- Flashing MCU ---" - echo - echo -e "/=================================================\ " - echo -e "| $(warn_msg "WARNING!") |" - echo -e "| $(warn_msg "Flashing a Smoothie based board for the first") |" - echo -e "| $(warn_msg "time with this script will certainly fail".) |" - echo -e "| This applies to boards like the BTT SKR V1.3 or |" - echo -e "| the newer SKR V1.4 and SKR V1.4 Turbo. You have |" - echo -e "| to copy the firmware file to the microSD card |" - echo -e "| manually and rename it to 'firmware.bin'. |" - echo -e "| You find the file in: ~/klipper/out/klipper.bin |" - echo -e "\=================================================/ " - echo - while true; do - read -p "Do you want to continue? (Y/n): " yn - case "$yn" in - Y|y|Yes|yes|"") - get_usb_id - write_printid_cfg - flash_mcu - break - ;; - N|n|No|no) break;; - *) warn_msg "Unknown parameter: $yn"; echo;; - esac - done -} - -flash_mcu(){ - echo; status_msg "Stopping Klipper service ..." - sudo service klipper stop && confirm_msg "Klipper service stopped!"; echo - if ! make flash FLASH_DEVICE="$usb_id"; - then - echo; warn_msg "Flashing failed!" - warn_msg "Please read the log above!" - else - echo; confirm_msg "Flashing successfull!" - fi - echo; status_msg "Starting Klipper service ..." - sudo service klipper start && confirm_msg "Klipper service started!"; echo -} - -### check system for service, dirs, files and updates -system_check(){ - echo - status_msg "--- Klipper service status:" - if systemctl is-active -q klipper - then - confirm_msg "Klipper service running!" - else - if [ ! -f $KLIPPER_SYSFILE1 ] - then - warn_msg "Klipper service not installed!" - else - warn_msg "Klipper service inactive!" - fi - fi - echo; status_msg "--- Klipper system files:" - if [[ -f $KLIPPER_SYSFILE1 && -f $KLIPPER_SYSFILE2 ]] - then - confirm_msg "Klipper system files found!" - else - warn_msg "No Klipper system files were found!" - warn_msg "Run the installer to create them." - fi - echo; status_msg "--- DWC2-for-Klipper system files:" - if [ -d $DWC2FK_SYSDIR ] - then - confirm_msg "DWC2-for-Klipper system files found!" - else - warn_msg "No DWC2-for-Klipper system files (Tornado 5.1.1)\nwere found! Run the installer to create them." - fi - echo; status_msg "--- Klipper update check:" - check_klipper_ver - if [ -d $KLIPPER_DIR ] - then - if [ "$klipper_local_ver" == "$klipper_remote_ver" ] - then - confirm_msg "Klipper is up to date!" - else - warn_msg "Klipper is outdated!" - fi - fi - echo; status_msg "--- DWC2-for-Klipper update check:" - check_dwc2fk_ver - if [ -d $DWC2FK_DIR ] - then - if [ "$dwc2fk_local_ver" == "$dwc2fk_remote_ver" ] - then - confirm_msg "DWC2-for-Klipper is up to date!" - else - warn_msg "DWC2-for-Klipper is outdated!" - fi - fi - echo; status_msg "--- DWC2 update check:" - check_dwc2_ver - if [ -d $DWC2_DIR ] - then - if [ "$dwc2_remote_ver" == "$dwc2_local_ver" ] - then - confirm_msg "DWC2 is up to date!" - else - warn_msg "DWC2 is outdated!" - fi - fi -} -### version checks -check_klipper_ver(){ - if [ -d $KLIPPER_DIR ] - then - cd $KLIPPER_DIR - git fetch -q - klipper_local_ver=`git rev-parse --short=8 HEAD` - klipper_remote_ver=`git rev-parse --short=8 origin/master` - echo -e "Local : $klipper_local_ver" - echo -e "Remote: $klipper_remote_ver" - else - warn_msg "No Klipper directory found!" - warn_msg "Run Klipper update to create it." - fi -} -check_dwc2fk_ver(){ - if [ -d $DWC2FK_DIR ] - then - cd $DWC2FK_DIR - git fetch -q - dwc2fk_local_ver=`git rev-parse --short=8 HEAD` - dwc2fk_remote_ver=`git rev-parse --short=8 origin/master` - echo -e "Local : $dwc2fk_local_ver" - echo -e "Remote: $dwc2fk_remote_ver" - else - warn_msg "No DWC2-for-Klipper directory found!" - warn_msg "Run DWC2-for-Klipper update to create it." - fi -} -check_dwc2_ver(){ - if [ -d $DWC2_DIR/web ] - then - if [ -f $DWC2_DIR/web/version ] - then - dwc2_local_ver=`head -n 1 $DWC2_DIR/web/version` - echo -e "Local : $dwc2_local_ver" - else - echo -e "Local : Can't read current version. Please update!" - fi - dwc2_remote_ver=`curl -s https://api.github.com/repositories/28820678/releases/latest | grep tag_name | cut -d'"' -f4` - echo -e "Remote: $dwc2_remote_ver" - else - warn_msg "No DWC2 directory found!" - warn_msg "Run DWC2 update to create it." - fi -} - -### install functions -inst_klipper(){ - if [[ -f $KLIPPER_SYSFILE1 || -f $KLIPPER_SYSFILE2 ]] - then - confirm_msg "Klipper is already installed!" - else - status_msg "--- Installing dependencies ---" - sudo apt update && sudo apt install git wget gzip tar build-essential libjpeg8-dev imagemagick libv4l-dev cmake -y - confirm_msg "Dependencies installed!" - echo; status_msg "--- Installing Klipper ---" - update_klipper - cd $KLIPPER_DIR/scripts - ./install-octopi.sh - if systemctl is-active -q klipper - then - confirm_msg "Klipper service running!" && confirm_msg "Klipper successfully installed!" - fi - echo - while true; do - read -p "Do you want to flash your MCU now? (Y/n): " yn; echo - case "$yn" in - Y|y|Yes|yes|"") - build_fw - flash_routine - break - ;; - N|n|No|no) break;; - *) warn_msg "Unknown parameter: $yn"; echo;; - esac - done - fi -} -inst_dwc2fk(){ - if [ -d $DWC2FK_SYSDIR ] - then - echo; confirm_msg "DWC2-for-Klipper system files (Tornado 5.1.1)\nare already installed!" - else - echo; status_msg "--- Installing DWC2-for-Klipper ---" - if [ $(systemctl is-active klipper) = "active" ] - then - echo; status_msg "Stopping Klipper service ..." - sudo systemctl stop klipper && confirm_msg "Klipper service stopped!"; echo - fi - echo; status_msg "Installing Tornado 5.1.1 ..." - cd ${HOME} - PYTHONDIR="${HOME}/klippy-env" - virtualenv ${PYTHONDIR} - ${PYTHONDIR}/bin/pip install tornado==5.1.1 && confirm_msg "Tornado 5.1.1 installed!" - update_dwc2fk && confirm_msg "DWC2-for-Klipper installed!" - write_dwc2fk_cfg - if [ $(systemctl is-active klipper) = "inactive" ] - then - echo; status_msg "Starting Klipper service ..." - sudo systemctl start klipper && confirm_msg "Klipper service running!" - fi - fi -} -inst_dwc2(){ - if [ -d $DWC2_DIR ] - then - echo; confirm_msg "DWC2 web UI is already installed!" - else - echo; status_msg "--- Installing DWC2 web UI ---" - update_dwc2 && confirm_msg "DWC2 web UI installed!" - fi -} -### update functions -update_full(){ - status_msg "Full update ..." - update_klipper && confirm_msg "Klipper updated!" - update_dwc2fk && confirm_msg "DWC2-for-Klipper updated!" - update_dwc2 && confirm_msg "DWC2 web UI updated!" -} -update_klipper(){ - echo; status_msg "--- Klipper Update ---" - if [ -f $KLIPPER_SYSFILE1 ] - then - echo; status_msg "Stopping Klipper service ..." - sudo systemctl stop klipper && confirm_msg "Klipper service stopped!";echo - fi - if [ -d $KLIPPER_DIR ] - then - get_date - mkdir -p $BACKUP_DIR/klipper-backup/"$current_date" - mv $KLIPPER_DIR $_ - fi - cd ${HOME} && git clone $KLIPPER_REPO - if [ -f $DWC2FK_DIR/web_dwc2.py ] - then - echo; status_msg "Creating necessary symlink ..." - ln -s $DWC2FK_DIR/web_dwc2.py $KLIPPER_DIR/klippy/extras/web_dwc2.py && confirm_msg "Symlink created!" - fi - if [ -f $KLIPPER_SYSFILE1 ] - then - echo; status_msg "Starting Klipper service ..." - sudo systemctl start klipper && confirm_msg "Klipper service started!" - fi -} -update_dwc2fk(){ - echo; status_msg "--- DWC2-for-Klipper Update ---" - if [ -d $DWC2FK_DIR ] - then - get_date - mkdir -p $BACKUP_DIR/dwc2fk-backup/"$current_date" - mv $DWC2FK_DIR $_ - fi - cd ${HOME} && git clone $DWC2FK_REPO - if [[ -d $KLIPPER_DIR/klippy/extras && ! -f $KLIPPER_DIR/klippy/extras/web_dwc2.py ]] - then - echo; status_msg "Creating necessary symlink ..." - ln -s $DWC2FK_DIR/web_dwc2.py $KLIPPER_DIR/klippy/extras/web_dwc2.py && confirm_msg "Symlink created!" - fi -} -update_dwc2(){ - echo; status_msg "--- DWC2 web UI Update ---" - get_url=`curl -s https://api.github.com/repositories/28820678/releases/latest | grep browser_download_url | cut -d'"' -f4` - if [ -d $DWC2_DIR/web ] - then - get_date - mkdir -p $BACKUP_DIR/dwc2-backup/"$current_date"/sdcard/dwc2/web/ - mv $DWC2_DIR/web/* $_ - else - mkdir -p $DWC2_DIR/web - fi - cd $DWC2_DIR/web - wget -q $get_url - unzip -q *.zip && for f_ in $(find . | grep '.gz');do gunzip ${f_};done - echo $get_url | cut -d/ -f8 > $DWC2_DIR/web/version - rm -rf DuetWebControl-SD.zip -} - -### backup functions -backup_msg(){ - status_msg "Running $1 backup ..." -} -backup_cfg(){ - if [ ! -d $BACKUP_DIR ] - then - mkdir -p ${HOME}/backup - fi - if [ -f $CFG_FILE ] - then - get_date - cp $CFG_FILE $BACKUP_DIR/printer.cfg."$current_date".backup - fi -} -backup_full(){ - if [[ -d $KLIPPER_DIR && -d $DWC2FK_DIR && -d $DWC2_DIR ]] - then - backup_klipper_only && confirm_msg "Klipper done ..." - backup_dwc2fk_only && confirm_msg "dwc2-for-klipper done ..." - backup_dwc2_only && confirm_msg "DWC2 done ..." - else - warn_msg "Can not create full backup." - warn_msg "One or more directories not found!" - fi -} -backup_klipper_only(){ - if [ -d $KLIPPER_DIR ] - then - get_date - mkdir -p $BACKUP_DIR/klipper-backup/"$current_date" && cp -rf $KLIPPER_DIR $_ - else - warn_msg "Can not backup Klipper." - warn_msg "No Klipper directory found!" - fi -} -backup_dwc2fk_only(){ - if [ -d $DWC2FK_DIR ] - then - get_date - mkdir -p $BACKUP_DIR/dwc2fk-backup/"$current_date" && cp -rf $DWC2FK_DIR $_ - else - warn_msg "Can not backup dwc2-for-klipper." - warn_msg "No dwc2-for-klipper directory found!" - fi -} -backup_dwc2_only(){ - if [ -d $DWC2_DIR ] - then - get_date - mkdir -p $BACKUP_DIR/dwc2-backup/"$current_date" && cp -rf $DWC2_DIR $_ - else - warn_msg "Can not backup DWC2." - warn_msg "No DWC2 directory found!" - fi -} - -### remove functions -rm_klipper(){ - echo; warn_msg "Removing Klipper + klippy-env will make any\nDWC2-for-Klipper installation inoperable!" - while true; do - read -p "Do you really want to continue? (Y/n): " yn - case "$yn" in - Y|y|Yes|yes|"") - echo; status_msg "Removing Klipper ..." - echo; status_msg "Stopping Klipper service ..." - sudo service klipper stop && confirm_msg "Klipper service stopped!" - echo; status_msg "Removing Klipper from startup ..." - sudo update-rc.d -f klipper remove && confirm_msg "Removed!" - echo; status_msg "Removing Klipper service ..." - sudo rm -rf $KLIPPER_SYSFILE1 $KLIPPER_SYSFILE2 && confirm_msg "Removed!" - echo; status_msg "Removing Klipper files from system ..." - rm -rf $KLIPPER_DIR ${HOME}/klippy-env && confirm_msg "Removed!"; echo - break - ;; - N|n|No|no) break;; - *) warn_msg "Unknown parameter: $yn"; echo;; - esac - done -} -rm_dwc2fk(){ - echo; status_msg "Removing DWC2-for-Klipper..." - rm -rf $DWC2FK_DIR $DWC2_DIR $DWC2FK_SYSDIR && confirm_msg "Removed!" -} -rm_dwc2(){ - echo; status_msg "Removing DWC2 web UI..." - rm -rf $DWC2_DIR && confirm_msg "Removed!" -} - -### install menu -inst_menu(){ - echo - echo -e "/=================================================\ " - echo -e "| ${green} Welcome to the installation menu!${default} | " - echo -e "|-------------------------------------------------| " - echo -e "| You need this menu usually only for installing | " - echo -e "| to a completely fresh system or if you used the | " - echo -e "| uninstaller for Klipper or DWC2-for-Klipper. | " - echo -e "\=================================================/ " - echo - echo -e "What do you want to install?"; echo - echo "1) Install all" - echo "2) Klipper" - echo "3) DWC2-for-Klipper" - echo "4) DWC2 web UI" - echo - warn_msg "Q) Exit" - echo - while true; do - read -p "Please select: " choice; echo - case "$choice" in - 1) inst_klipper && inst_dwc2fk && inst_dwc2; break;; - 2) inst_klipper; break;; - 3) inst_dwc2fk; break;; - 4) inst_dwc2; break;; - Q|q) main_menu;; - *) warn_msg "Unknown parameter: $choice"; echo;; - esac - done - inst_menu -} - -### advanced menu -adv_menu(){ - echo - echo -e "/=================================================\ " - echo -e "| ${yellow}Welcome to the advanced menu!${default} | " - echo -e "|-------------------------------------------------| " - echo -e "| Before flashing or getting the printer ID make | " - echo -e "| sure that the printer is the only USB device | " - echo -e "| connected to your Raspberry Pi. | " - echo -e "\=================================================/ " - echo - echo -e "What do you want to do?"; echo - echo "1) Build Firmware" - echo "2) Flash MCU" - echo "3) Get printer ID" - echo "4) Write printer ID to printer.cfg" - echo -e "5) Write DWC2-for-klipper configuration\n example to printer.cfg" - echo - warn_msg "Q) Exit" - echo - while true; do - read -p "Please select: " choice; echo - case "$choice" in - 1) build_fw; break;; - 2) flash_routine; break;; - 3) get_usb_id; break;; - 4) get_usb_id && write_printid_cfg; break;; - 5) write_dwc2fk_cfg; break;; - Q|q) main_menu;; - *) warn_msg "Unknown parameter: $choice"; echo;; - esac - done - adv_menu -} - -### remove menu -rm_menu(){ - echo - echo -e "/=================================================\ " - echo -e "| ${red}Welcome to the uninstallation menu!${default} | " - echo -e "|-------------------------------------------------| " - echo -e "| $(warn_msg ">>> Warning <<<") | " - echo -e "| $(warn_msg "You are about to remove Klipper, all of its") | " - echo -e "| $(warn_msg "components and/or extensions!") | " - echo -e "| | " - echo -e "| Files and directories which remain untouched: | " - echo -e "| --> ~/printer.cfg | " - echo -e "| --> ~/backup | " - echo -e "| You need remove them manually if you wish so. | " - echo -e "\=================================================/ " - echo - echo -e "What do you want to remove?"; echo - echo "1) Remove all" - echo "2) Klipper (incl. klippy-env)" - echo "3) DWC2-for-Klipper" - echo "4) DWC2 web UI" - echo - warn_msg "Q) Exit" - echo - while true; do - read -p "Please select: " choice - case "$choice" in - 1) rm_klipper && rm_dwc2fk && rm_dwc2; break;; - 2) rm_klipper; break;; - 3) rm_dwc2fk; break;; - 4) rm_dwc2; break;; - Q|q) main_menu;; - *) warn_msg "Unknown parameter: $choice"; echo;; - esac - done - rm_menu -} - -action(){ case "$action" in - 0) - clear - print_header - system_check - main_menu - ;; - 1) - clear - print_header - inst_menu - main_menu - ;; - 2) - clear - print_header - adv_menu - ;; - 3) - clear - print_header - rm_menu - ;; - 4) - clear - print_header - update_full - main_menu - ;; - 5) - clear - print_header - update_klipper - confirm_msg "Klipper updated!" - main_menu - ;; - 6) - clear - print_header - update_dwc2fk - confirm_msg "DWC2-for-Klipper updated!" - main_menu - ;; - 7) - clear - print_header - update_dwc2 - confirm_msg "DWC2 web UI updated!" - main_menu - ;; - 8) - clear - print_header - backup_msg "Full" - backup_full - main_menu - ;; - 9) - clear - print_header - backup_msg "Klipper" - backup_klipper_only - main_menu - ;; - 10) - clear - print_header - backup_msg "dwc2-for-klipper" - backup_dwc2fk_only - main_menu - ;; - 11) - clear - print_header - backup_msg "DWC2" - backup_dwc2_only - main_menu - ;; - Q|q) - confirm_msg "Happy printing! ...\n"; exit 1 - ;; - *) - warn_msg "Unknown parameter: $action" - main_menu - ;; + 0) + clear + print_header + ERROR_MSG=" Sorry this function is not implemented yet!" + print_error_msg && ERROR_MSG="" + main_ui;; + 1) + clear + install_menu + break;; + 2) + clear + update_menu + break;; + 3) + clear + remove_menu + break;; + 4) + clear + advanced_menu + break;; + 5) + clear + backup_menu + break;; + Q|q) + exit -1;; + *) + clear + print_header + ERROR_MSG=" Unknown command '$action'" + print_error_msg && ERROR_MSG="" + main_ui;; esac + done + clear; main_menu +} + +install_menu(){ + print_header + install_ui + while true; do + read -p "Perform action: " action; echo + case "$action" in + 1) + clear + print_header + install_klipper + print_error_msg && ERROR_MSG="" + install_ui;; + 2) + clear + print_header + dwc2_install_routine + print_error_msg && ERROR_MSG="" + install_ui;; + 3) + clear + print_header + mainsail_install_routine + print_error_msg && ERROR_MSG="" + install_ui;; + Q|q) + clear; main_menu; break;; + *) + clear + print_header + ERROR_MSG=" Unknown command '$action'" + print_error_msg && ERROR_MSG="" + install_ui;; + esac + done + install_menu +} + +update_menu(){ + print_header + read_bb4u_stat + #compare versions + ui_print_versions + update_ui + while true; do + read -p "Perform action: " action; echo + case "$action" in + 0) + clear + print_header + toggle_backups + print_error_msg && ERROR_MSG="" + update_ui;; + 1) + clear + print_header + update_klipper && ui_print_versions + print_error_msg && ERROR_MSG="" + update_ui;; + 2) + clear + print_header + update_dwc2fk && ui_print_versions + print_error_msg && ERROR_MSG="" + update_ui;; + 3) + clear + print_header + update_dwc2 && ui_print_versions + print_error_msg && ERROR_MSG="" + update_ui;; + 4) + clear + print_header + update_mainsail && ui_print_versions + print_error_msg && ERROR_MSG="" + update_ui;; + Q|q) + clear; main_menu; break;; + *) + clear + print_header + ERROR_MSG=" Unknown command '$action'" + print_error_msg && ERROR_MSG="" + ui_print_versions + update_ui;; + esac + done + update_menu +} + +remove_menu(){ + print_header + remove_ui + while true; do + read -p "Perform action: " action; echo + case "$action" in + 1) + clear + print_header + remove_klipper + print_error_msg && ERROR_MSG="" + remove_ui;; + 2) + clear + print_header + remove_dwc2 + print_error_msg && ERROR_MSG="" + remove_ui;; + 3) + clear + print_header + remove_mainsail + print_error_msg && ERROR_MSG="" + remove_ui;; + Q|q) + clear; main_menu; break;; + *) + clear + print_header + ERROR_MSG=" Unknown command '$action'" + print_error_msg && ERROR_MSG="" + remove_ui;; + esac + done + remove_menu +} + +advanced_menu(){ + print_header + print_error_msg && ERROR_MSG="" + advanced_ui + while true; do + read -p "Perform action: " action; echo + case "$action" in + 1) + clear + switch_menu + print_error_msg && ERROR_MSG="" + advanced_ui;; + 2) + clear + print_header + build_fw + print_error_msg && ERROR_MSG="" + advanced_ui;; + 3) + clear + print_header + flash_routine + print_error_msg && ERROR_MSG="" + advanced_ui;; + 4) + clear + print_header + get_usb_id + print_error_msg && ERROR_MSG="" + advanced_ui;; + 5) + clear + print_header + get_usb_id && write_printer_id + print_error_msg && ERROR_MSG="" + advanced_ui;; + 6) + clear + print_header + create_dwc2fk_cfg + print_error_msg && ERROR_MSG="" + advanced_ui;; + Q|q) + clear; main_menu; break;; + *) + clear + print_header + ERROR_MSG=" Unknown command '$action'" + print_error_msg && ERROR_MSG="" + advanced_ui;; + esac + done + advanced_menu +} + +switch_menu(){ + print_header + if [ -d $KLIPPER_DIR ]; then + read_branch + print_error_msg && ERROR_MSG="" + switch_ui + while true; do + read -p "Perform action: " action; echo + case "$action" in + 1) + clear + print_header + switch_to_origin + read_branch + print_error_msg && ERROR_MSG="" + switch_ui;; + 2) + clear + print_header + switch_to_scurve_shaping + read_branch + print_error_msg && ERROR_MSG="" + switch_ui;; + 3) + clear + print_header + switch_to_scurve_smoothing + read_branch + print_error_msg && ERROR_MSG="" + switch_ui;; + 4) + clear + print_header + switch_to_moonraker + read_branch + print_error_msg && ERROR_MSG="" + switch_ui;; + 5) + clear + print_header + switch_to_dev_moonraker + read_branch + print_error_msg && ERROR_MSG="" + switch_ui;; + Q|q) + clear; advanced_menu; break;; + esac + done + else + ERROR_MSG=" No klipper directory found! Download klipper first!" + fi +} + +backup_menu(){ + print_header + print_error_msg && ERROR_MSG="" + backup_ui + while true; do + read -p "Perform action: " action; echo + case "$action" in + 1) + clear + print_header + #function goes here + print_error_msg && ERROR_MSG="" + backup_ui;; + Q|q) + clear; main_menu; break;; + *) + clear + print_header + ERROR_MSG=" Unknown command '$action'" + print_error_msg && ERROR_MSG="" + backup_ui;; + esac + done + backup_menu } -print_header check_euid -dependency_check -start_check -main_menu +main_menu \ No newline at end of file diff --git a/scripts/backup.sh b/scripts/backup.sh new file mode 100644 index 0000000..3d689e0 --- /dev/null +++ b/scripts/backup.sh @@ -0,0 +1,74 @@ +backup_printer_cfg(){ + if [ ! -d $BACKUP_DIR ]; then + status_msg "Create backup directory ..." + mkdir -p $BACKUP_DIR && ok_msg "Directory created!" + fi + if [ -f $PRINTER_CFG ]; then + get_date + status_msg "Create backup of printer.cfg ..." + cp $PRINTER_CFG $BACKUP_DIR/printer.cfg."$current_date".backup && ok_msg "Backup created!" + else + ok_msg "No printer.cfg found! Skipping backup ..." + fi +} + +read_bb4u_stat(){ + source_ini + if [ ! "$backup_before_update" = "true" ]; then + BB4U_STATUS="${green}[Enable]${default} backups before updating " + else + BB4U_STATUS="${red}[Disable]${default} backups before updating " + fi +} + +toggle_backups(){ + source_ini + if [ "$backup_before_update" = "true" ]; then + sed -i '/backup_before_update=/s/true/false/' ${HOME}/kiauh2/kiauh.ini + BB4U_STATUS="${green}[Enable]${default} backups before updating " + fi + if [ "$backup_before_update" = "false" ]; then + sed -i '/backup_before_update=/s/false/true/' ${HOME}/kiauh2/kiauh.ini + BB4U_STATUS="${red}[Disable]${default} backups before updating " + fi +} + +bb4u_klipper(){ + source_ini + if [ -d $KLIPPER_DIR ] && [ "$backup_before_update" = "true" ]; then + get_date + status_msg "Creating Klipper backup ..." + mkdir -p $BACKUP_DIR/klipper-backups/"$current_date" + cp -r $KLIPPER_DIR $_ && cp -r $KLIPPY_ENV_DIR $_ && ok_msg "Backup complete!" + fi +} + +bb4u_dwc2fk(){ + source_ini + if [ -d $DWC2FK_DIR ] && [ "$backup_before_update" = "true" ]; then + get_date + status_msg "Creating DWC2-for-Klipper backup ..." + mkdir -p $BACKUP_DIR/dwc2-for-klipper-backups/"$current_date" + cp -r $DWC2FK_DIR $_ && ok_msg "Backup complete!" + fi +} + +bb4u_dwc2(){ + source_ini + if [ -d $DWC2_DIR ] && [ "$backup_before_update" = "true" ]; then + get_date + status_msg "Creating DWC2 Web UI backup ..." + mkdir -p $BACKUP_DIR/dwc2-backups/"$current_date" + cp -r $DWC2_DIR $_ && ok_msg "Backup complete!" + fi +} + +bb4u_mainsail(){ + source_ini + if [ -d $MAINSAIL_DIR ] && [ "$backup_before_update" = "true" ]; then + get_date + status_msg "Creating Mainsail backup ..." + mkdir -p $BACKUP_DIR/mainsail-backups/"$current_date" + cp -r $MAINSAIL_DIR $_ && ok_msg "Backup complete!" + fi +} \ No newline at end of file diff --git a/scripts/functions.sh b/scripts/functions.sh new file mode 100644 index 0000000..3f2eaa7 --- /dev/null +++ b/scripts/functions.sh @@ -0,0 +1,185 @@ +# setting up some frequently used functions +check_euid(){ + if [ "$EUID" -eq 0 ] + then + echo -e "${red}" + echo -e "/=================================================\ " + echo -e "| !!! THIS SCRIPT MUST NOT RAN AS ROOT !!! |" + echo -e "\=================================================/ " + echo -e "${default}" + exit 1 + fi +} + +source_ini(){ + source ${HOME}/kiauh2/kiauh.ini +} + +start_klipper(){ + if [ -e /etc/init.d/klipper ]; then + status_msg "Starting klipper service ..." + sudo /etc/init.d/klipper start && sleep 2 && ok_msg "Klipper service started!" + fi +} +stop_klipper(){ + if [ -e /etc/init.d/klipper ]; then + status_msg "Stopping klipper service ..." + sudo /etc/init.d/klipper stop && sleep 2 && ok_msg "Klipper service stopped!" + fi +} + +start_moonraker(){ + if [ -e /etc/init.d/moonraker ]; then + status_msg "Starting moonraker service ..." + sudo /etc/init.d/moonraker start && sleep 2 && ok_msg "Moonraker service started!" + fi +} + +stop_moonraker(){ + if [ -e /etc/init.d/moonraker ]; then + status_msg "Stopping moonraker service ..." + sudo /etc/init.d/moonraker stop && sleep 2 && ok_msg "Moonraker service stopped!" + fi +} + +dep_check(){ + for package in "${dep[@]}" + do + ! command -v $package >&/dev/null 2>&1 && install+=($package) + done + if ! [ ${#install[@]} -eq 0 ]; then + warn_msg "The following packages are missing but necessary:" + echo ${install[@]} + while true; do + read -p "Do you want to install them now? (Y/n): " yn + case "$yn" in + Y|y|Yes|yes|"") + status_msg "Installing dependencies ..." + sudo apt-get install ${install[@]} -y && ok_msg "Dependencies installed!" + break;; + N|n|No|no) break;; + *) echo "Unknown parameter: $yn"; echo;; + esac + done + fi +} + +print_error(){ + for data in "${data_arr[@]}" + do + if [ ! -e $data ]; then + data_count+=(0) + else + data_count+=(1) + fi + done + sum=$(IFS=+; echo "$((${data_count[*]}))") + if [ $sum -eq 0 ]; then + ERROR_MSG=" Looks like $1 was already removed!\n Skipping..." + else + ERROR_MSG="" + fi +} + +pkg_check(){ + status_msg "Checking if nginx is installed" + if [[ $(dpkg-query -f'${Status}' --show nginx 2>/dev/null) = *\ installed ]]; then +echo "nginx found!" +else +echo "nginx was not found, installing..." 2>&1 +sudo apt-get -y install nginx 2>/dev/null +fi +} + +build_fw(){ + if [ -d $KLIPPER_DIR ]; then + cd $KLIPPER_DIR && make menuconfig + status_msg "Building firmware ..." + make clean && make && ok_msg "Firmware built!" + else + warn_msg "Can not build firmware without a Klipper directory!" + fi +} + +### grab the printers id +get_usb_id(){ + warn_msg "Make sure your printer is the only USB device connected!" + while true; do + echo -e "${cyan}" + read -p "###### Press any key to continue ... " yn + echo -e "${default}" + case "$yn" in + *) break;; + esac + done + status_msg "Identifying the correct USB port ..." + USB_ID=$(ls /dev/serial/by-id/*) + if [ -e /dev/serial/by-id/* ]; then + status_msg "The ID of your printer is:" + title_msg "$USB_ID" + else + warn_msg "Could not retrieve ID!" + return 1 + fi +} + +write_printer_id(){ + while true; do + echo -e "${cyan}" + read -p "###### Do you want to write the ID to your printer.cfg? (Y/n): " yn + echo -e "${default}" + case "$yn" in + Y|y|Yes|yes|"") + backup_printer_cfg +cat <> $PRINTER_CFG + +########################## +### CREATED WITH KIAUH ### +########################## +[mcu] +serial: $USB_ID +########################## +########################## +PRINTERID + ok_msg "Config written!" + break;; + N|n|No|no) break;; + esac + done +} + +flash_routine(){ + echo -e "/=================================================\ " + echo -e "| ATTENTION! |" + echo -e "| Flashing a Smoothie based board for the first |" + echo -e "| time with this script will certainly fail. |" + echo -e "| This applies to boards like the BTT SKR V1.3 or |" + echo -e "| the newer SKR V1.4 (Turbo). You have to copy |" + echo -e "| the firmware file to the microSD card manually |" + echo -e "| and rename it to 'firmware.bin'. |" + echo -e "| |" + echo -e "| You find the file in: ~/klipper/out/klipper.bin |" + echo -e "\=================================================/ " + echo + while true; do + echo -e "${cyan}" + read -p "###### Do you want to continue? (Y/n): " yn + echo -e "${default}" + case "$yn" in + Y|y|Yes|yes|"") + get_usb_id && flash_mcu && write_printer_id; break;; + N|n|No|no) break;; + esac + done +} + +flash_mcu(){ + stop_klipper + if ! make flash FLASH_DEVICE="$USB_ID" ; then + warn_msg "Flashing failed!" + warn_msg "Please read the log above!" + else + ok_msg "Flashing successfull!" + fi + start_klipper +} \ No newline at end of file diff --git a/scripts/install_dwc2.sh b/scripts/install_dwc2.sh new file mode 100644 index 0000000..632f166 --- /dev/null +++ b/scripts/install_dwc2.sh @@ -0,0 +1,166 @@ +#TODO: +# - check for existing/running octoprint service +# - ask for permission to disable octoprint service + +dwc2_install_routine(){ + if [ -d $KLIPPER_DIR ]; then + # check for existing installation + if [ -d ${HOME}/klippy-env/lib/python2.7/site-packages/tornado ]; then + ERROR_MSG=" Looks like DWC2 is already installed!\n Skipping..." + return + fi + stop_klipper + install_tornado + install_dwc2fk && dwc2fk_cfg + install_dwc2 + start_klipper + else + ERROR_MSG=" Please install Klipper first!\n Skipping..." + fi +} + +install_tornado(){ + #check for dependencies + dep=(virtualenv) + dep_check + #execute operation + status_msg "Installing Tornado 5.1.1 ..." + cd ${HOME} + PYTHONDIR="${HOME}/klippy-env" + virtualenv ${PYTHONDIR} + ${PYTHONDIR}/bin/pip install tornado==5.1.1 && ok_msg "Tornado 5.1.1 successfully installed!" +} + +install_dwc2fk(){ + cd ${HOME} + status_msg "Cloning dwc2-for-klipper repository ..." + git clone $DWC2FK_REPO && ok_msg "dwc2-for-klipper successfully cloned!" + #create a web_dwc2.py symlink if not already existing + if [ -d $KLIPPER_DIR/klippy/extras ] && [ ! -e $KLIPPER_DIR/klippy/extras/web_dwc2.py ]; then + status_msg "Creating web_dwc2.py symlink ..." + ln -s $DWC2FK_DIR/web_dwc2.py $KLIPPER_DIR/klippy/extras/web_dwc2.py && ok_msg "Symlink created!" + fi +} + +dwc2fk_cfg(){ + while true; do + echo -e "${cyan}" + read -p "###### Do you want to create the config now? (Y/n): " yn + echo -e "${default}" + case "$yn" in + Y|y|Yes|yes|"") create_dwc2fk_cfg; break;; + N|n|No|no) break;; + *) echo "Unknown parameter: $yn"; dwc2fk_cfg;; + esac + done +} + +create_dwc2fk_cfg(){ + echo -e "/=================================================\ " + echo -e "| 1) [Default configuration] | " + echo -e "| 2) [Custom configuration] | " + echo -e "| 3) [Skip] | " + echo -e "\=================================================/ " + while true; do + read -p "Please select: " choice; echo + case "$choice" in + 1) dwc2fk_default_cfg && ok_msg "Config written ..."; break;; + 2) create_dwc2fk_custom_cfg && ok_msg "Config written ..."; break;; + 3) echo "Skipping ..."; break;; + esac + done +} + +dwc2fk_default_cfg(){ + cat <> $PRINTER_CFG + +########################## +### CREATED WITH KIAUH ### +########################## +[virtual_sdcard] +path: ~/sdcard + +[web_dwc2] +printer_name: my_printer +listen_adress: 0.0.0.0 +listen_port: 4750 +web_path: dwc2/web +########################## +########################## +DWC2 +} + +create_dwc2fk_custom_cfg(){ + echo -e "${cyan}" + read -e -p "Printer name: " -i "my_printer" PRINTER_NAME + read -e -p "Listen adress: " -i "0.0.0.0" LISTEN_ADRESS + read -e -p "Listen port: " -i "4750" LISTEN_PORT + read -e -p "Web path: " -i "dwc2/web" WEB_PATH + echo -e "${default}" + DWC2_CFG=$(cat <> $PRINTER_CFG; break;; + N|n|No|no) create_dwc2fk_custom_cfg;; + esac + done +} + +install_dwc2(){ + #needed packages for webcam + while true; do + echo -e "${cyan}" + read -p "###### Do you want to use a webcam? (Y/n): " yn + echo -e "${default}" + case "$yn" in + Y|y|Yes|yes|"") + status_msg "Checking for dependencies ..." + webcam_dep_check && ok_msg "Dependencies installed!" + break;; + N|n|No|no) break;; + *) echo "Unknown parameter: $yn"; echo;; + esac + done + #the update_dwc2 function does the same as installing dwc2 + update_dwc2 && ok_msg "DWC2 Web UI installed!" +} + +webcam_dep_check(){ + webcam_dep=( + build-essential + libjpeg8-dev + imagemagick + libv4l-dev + cmake + ) + for pkg in "${webcam_dep[@]}" + do + if ! [[ $(dpkg-query -f'${Status}' --show $pkg 2>/dev/null) = *\ installed ]]; then + install+=($pkg) + fi + done + if ! [ ${#install[@]} -eq 0 ]; then + sudo apt-get install ${install[@]} -y + fi +} \ No newline at end of file diff --git a/scripts/install_klipper.sh b/scripts/install_klipper.sh new file mode 100644 index 0000000..6c13945 --- /dev/null +++ b/scripts/install_klipper.sh @@ -0,0 +1,30 @@ +install_klipper(){ + if [ -e /etc/init.d/klipper ] && [ -e /etc/default/klipper ]; then + ERROR_MSG=" Looks like klipper is already installed!\n Skipping ..." + else + #check for dependencies + dep=(git) + dep_check + #execute operation + cd ${HOME} + status_msg "Cloning klipper repository ..." + git clone $KLIPPER_REPO && ok_msg "Klipper successfully cloned!" + status_msg "Installing klipper service ..." + $KLIPPER_DIR/scripts/install-octopi.sh && sleep 2 && ok_msg "Klipper installation complete!" + #create a klippy.log symlink in home-dir just for convenience + if [ ! -e ${HOME}/klippy.log ]; then + status_msg "Creating klippy.log symlink ..." + ln -s /tmp/klippy.log ${HOME}/klippy.log && ok_msg "Symlink created!" + fi + while true; do + echo -e "${cyan}" + read -p "###### Do you want to flash your MCU now? (Y/n): " yn + echo -e "${default}" + case "$yn" in + Y|y|Yes|yes|"") build_fw && flash_routine; break;; + N|n|No|no) break;; + *) warn_msg "Unknown parameter: $yn"; echo;; + esac + done + fi +} \ No newline at end of file diff --git a/scripts/install_mainsail.sh b/scripts/install_mainsail.sh new file mode 100644 index 0000000..fa0447a --- /dev/null +++ b/scripts/install_mainsail.sh @@ -0,0 +1,349 @@ +mainsail_install_routine(){ + if [ -d $KLIPPER_DIR ]; then + #check for dependencies + dep=(wget curl unzip) + dep_check + #execute operation + install_moonraker + disable_wrong_webserver + remove_wrong_webserver + install_nginx + test_api + test_nginx + install_mainsail && ok_msg "Mainsail install complete!"; echo + else + ERROR_MSG=" Please install Klipper first!\n Skipping..." + fi +} + +install_moonraker(){ + cd $KLIPPER_DIR + if [[ $(git describe --all) = "remotes/Arksine/work-web_server-20200131" ]]; then + status_msg "Installing Moonraker ..." + $KLIPPER_DIR/scripts/install-moonraker.sh && ok_msg "Moonraker successfully installed!" + if [ ! -d ${HOME}/sdcard ]; then + mkdir ${HOME}/sdcard + fi + #create a moonraker.log symlink in home-dir just for convenience + if [ ! -e ${HOME}/moonraker.log ]; then + status_msg "Creating moonraker.log symlink ..." + ln -s /tmp/moonraker.log ${HOME}/moonraker.log && ok_msg "Symlink created!" + fi + else + warn_msg "You are not using Arksine/work-web_server-20200131." + warn_msg "Please switch to the moonraker fork first!" + while true; do + echo -e "${cyan}" + read -p "###### Do you want to switch to it now? (Y/n): " yn + echo -e "${default}" + case "$yn" in + Y|y|Yes|yes|"") switch_to_moonraker && install_moonraker; break;; + N|n|No|no) break;; + *) echo "Unknown parameter: $yn"; echo;; + esac + done + fi +} + +check_printer_cfg(){ + if [ ! -e $PRINTER_CFG ]; then + warn_msg "No printer.cfg found" + while true; do + echo -e "${cyan}" + read -p "###### Do you want to create a default config? (Y/n): " yn + echo -e "${default}" + case "$yn" in + Y|y|Yes|yes|"") create_default_cfg; break;; + N|n|No|no) break;; + *) echo "Unknown parameter: $yn"; echo;; + esac + done + else + check_vsdcard_section + check_api_section + fi +} + +disable_wrong_webserver(){ + if systemctl is-active haproxy ; then + status_msg "Stopping haproxy service ..." + sudo /etc/init.d/haproxy stop && ok_msg "Service stopped!" + fi + if systemctl is-active lighttpd ; then + status_msg "Stopping lighttpd service ..." + sudo /etc/init.d/lighttpd stop && ok_msg "Service stopped!" + fi +} + +remove_wrong_webserver(){ + rem=(haproxy lighttpd) + for remove in "${rem[@]}" + do + if [[ $(dpkg-query -f'${Status}' --show $remove 2>/dev/null) = *\ installed ]]; then + delete+=($remove) + fi + done + if ! [ ${#delete[@]} -eq 0 ]; then + sudo apt-get remove ${delete[@]} -y + fi +} + +install_nginx(){ + if ! [[ $(dpkg-query -f'${Status}' --show nginx 2>/dev/null) = *\ installed ]]; then + status_msg "Installing Nginx ..." + sudo apt-get install nginx -y && ok_msg "Nginx successfully installed!" + fi + if [ ! -d $MAINSAIL_DIR ]; then + mkdir $MAINSAIL_DIR + fi + status_msg "Configure Nginx ..." + create_mainsail_cfgfile && sudo mv $MAINSAIL_DIR/mainsail /etc/nginx/sites-available/ + if [ -e /etc/nginx/sites-enabled/default ]; then + sudo rm /etc/nginx/sites-enabled/default + fi + if [ ! -e /etc/nginx/sites-enabled/mainsail ]; then + sudo ln -s /etc/nginx/sites-available/mainsail /etc/nginx/sites-enabled/ + fi + ok_msg "Nginx configured!" +} + +test_api(){ + status_msg "Testing API ..." + sleep 5 + status_msg "API response from http://localhost:7125/printer/info:" + API_RESPONSE="$(curl -sG4 http://localhost:7125/printer/info)" + echo -e "${cyan}$API_RESPONSE${default}" + if [ $(curl -sG4 "http://localhost:7125/printer/info" | grep '^{"result"' -c) -eq 1 ]; then + echo; ok_msg "Klipper API is working correctly!"; echo + else + echo; warn_msg "Klipper API not working correctly!"; echo + fi +} + +test_nginx(){ + sudo /etc/init.d/nginx restart + status_msg "Testing Nginx ..." + sleep 5 + status_msg "API response from http://localhost/printer/info:" + API_RESPONSE="$(curl -sG4 http://localhost/printer/info)" + echo -e "${cyan}$API_RESPONSE${default}" + if [ $(curl -sG4 "http://localhost/printer/info" | grep '^{"result"' -c) -eq 1 ]; then + echo; ok_msg "Nginx is working correctly!"; echo + else + echo; warn_msg "Nginx is not working correctly!"; echo + fi +} + +get_mainsail_ver(){ + MAINSAIL_VERSION=`curl -s https://api.github.com/repositories/240875926/tags | grep name | cut -d'"' -f4 | cut -d"v" -f2 | head -1` +} + +mainsail_dl_url(){ + get_mainsail_ver + MAINSAIL_URL=https://github.com/meteyou/mainsail/releases/download/v"$MAINSAIL_VERSION"/mainsail-alpha-"$MAINSAIL_VERSION".zip +} + +install_mainsail(){ + mainsail_dl_url + if [ ! -d $MAINSAIL_DIR ]; then + mkdir $MAINSAIL_DIR + fi + cd $MAINSAIL_DIR + status_msg "Downloading Mainsail v$MAINSAIL_VERSION ..." + wget -q -O mainsail.zip $MAINSAIL_URL && status_msg "Extracting archive ..." && unzip -o mainsail.zip && rm mainsail.zip + ### write mainsail version to file for update check reasons + echo "$MAINSAIL_VERSION" > $MAINSAIL_DIR/version +} + +create_mainsail_cfgfile(){ + cat < $MAINSAIL_DIR/mainsail +map \$http_upgrade \$connection_upgrade { + default upgrade; + '' close; +} + +upstream apiserver { + #edit your api port here + ip_hash; + server 127.0.0.1:7125; +} + +server { + listen 80 default_server; + listen [::]:80 default_server; + + access_log /var/log/nginx/mainsail-access.log; + error_log /var/log/nginx/mainsail-error.log; + + #web_path from mainsail static files + root /home/pi/mainsail; + + index index.html; + server_name _; + + #max upload size for gcodes + client_max_body_size 200M; + + location / { + try_files \$uri \$uri/ /index.html; + } + + location /printer { + proxy_pass http://apiserver/printer; + proxy_set_header Host \$http_host; + proxy_set_header X-Real-IP \$remote_addr; + proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; + proxy_set_header X-Scheme \$scheme; + } + + location /api { + proxy_pass http://apiserver/api; + proxy_set_header Host \$http_host; + proxy_set_header X-Real-IP \$remote_addr; + proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; + proxy_set_header X-Scheme \$scheme; + } + + location /access { + proxy_pass http://apiserver/access; + proxy_set_header Host \$http_host; + proxy_set_header X-Real-IP \$remote_addr; + proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; + proxy_set_header X-Scheme \$scheme; + } + + location /websocket { + proxy_pass http://apiserver/websocket; + proxy_http_version 1.1; + proxy_set_header Upgrade \$http_upgrade; + proxy_set_header Connection \$connection_upgrade; + proxy_set_header Host \$http_host; + proxy_set_header X-Real-IP \$remote_addr; + proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; + proxy_read_timeout 86400; + } + + location /machine { + proxy_pass http://apiserver/machine; + proxy_set_header Host \$http_host; + proxy_set_header X-Real-IP \$remote_addr; + proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; + proxy_set_header X-Scheme \$scheme; + } + + location /server { + proxy_pass http://apiserver/server; + proxy_set_header Host \$http_host; + proxy_set_header X-Real-IP \$remote_addr; + proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; + proxy_set_header X-Scheme \$scheme; + } +} +MAINSAIL_CFG +} + +check_vsdcard_section(){ + # check if virtual sdcard is present in printer.cfg + if [ $(grep '^\[virtual_sdcard\]$' /home/pi/printer.cfg) ]; then + echo "Virtual sdcard already configured" + else + echo "No virtual sdcard entry found..." + echo "Configuring virtual sdcard..." +# append the following lines to printer.cfg +cat <> $PRINTER_CFG + +########################## +### CREATED WITH KIAUH ### +########################## +[virtual_sdcard] +path: ~/sdcard +########################## +########################## +VSDCARD + fi +} + +check_api_section(){ + # check if api server is present in printer.cfg + if [ $(grep '^\[api_server\]$' /home/pi/printer.cfg) ]; then + echo "API server already configured" + else + echo "No API server entry found..." + echo "Configuring API server..." +# append the following lines to printer.cfg +cat <> $PRINTER_CFG + +########################## +### CREATED WITH KIAUH ### +########################## +[api_server] +trusted_clients: + 192.168.0.0/24 + 192.168.1.0/24 + 127.0.0.0/24 +########################## +########################## +API + fi +} + +create_default_cfg(){ +cat <> $PRINTER_CFG + +########################## +### CREATED WITH KIAUH ### +########################## +[virtual_sdcard] +path: ~/sdcard + +[api_server] +trusted_clients: + 192.168.0.0/24 + 192.168.1.0/24 + 127.0.0.0/24 + +[pause_resume] + +[gcode_macro CANCEL] +default_parameter_X: 230 +default_parameter_Y: 230 +default_parameter_Z: 10 +gcode: + M104 S0 + M140 S0 + M141 S0 + M106 S0 + CLEAR_PAUSE + RESET_SD + +[gcode_macro CANCEL_PRINT] +gcode: + CANCEL + +[gcode_macro PAUSE] +rename_existing: BASE_PAUSE +default_parameter_X: 230 +default_parameter_Y: 230 +default_parameter_Z: 10 +gcode: + SAVE_GCODE_STATE NAME=PAUSE_state + BASE_PAUSE + G91 + G1 E-1.7 F2100 + G1 Z{Z} + G90 + G1 X{X} Y{Y} F6000 + G91 + +[gcode_macro RESUME] +rename_existing: BASE_RESUME +gcode: + G91 + G1 E1.7 F2100 + G91 + RESTORE_GCODE_STATE NAME=PAUSE_state MOVE=1 + BASE_RESUME +########################## +########################## +MAINSAIL_CFG +} \ No newline at end of file diff --git a/scripts/remove.sh b/scripts/remove.sh new file mode 100644 index 0000000..fa8ff82 --- /dev/null +++ b/scripts/remove.sh @@ -0,0 +1,145 @@ +remove_klipper(){ + data_arr=( + /etc/init.d/klipper + /etc/default/klipper + $KLIPPER_DIR + $KLIPPY_ENV_DIR + ${HOME}/klippy.log + ) + print_error "Klipper" && data_count=() + if [ "$ERROR_MSG" = "" ]; then + stop_klipper + if [[ -e /etc/init.d/klipper || -e /etc/default/klipper ]]; then + status_msg "Removing klipper service ..." + sudo update-rc.d -f klipper remove + sudo rm -rf /etc/init.d/klipper /etc/default/klipper && ok_msg "Klipper service removed!" + fi + if [[ -d $KLIPPER_DIR || -d $KLIPPY_ENV_DIR ]]; then + status_msg "Removing klipper and klippy-env diretory ..." + rm -rf $KLIPPER_DIR $KLIPPY_ENV_DIR && ok_msg "Directories removed!" + fi + if [[ -L ${HOME}/klippy.log || -e /tmp/klippy.log ]]; then + status_msg "Removing klippy.log symlink ..." + rm -rf ${HOME}/klippy.log /tmp/klippy.log && ok_msg "Symlink removed!" + fi + ok_msg "Klipper successfully removed!" + fi +} + +remove_dwc2(){ + data_arr=( + $DWC2FK_DIR + $TORNADO_DIR1 + $TORNADO_DIR2 + $WEB_DWC2 + $DWC2_DIR + ) + print_error "DWC2-for-Klipper &\n DWC2 Web UI" && data_count=() + if [ "$ERROR_MSG" = "" ]; then + if [ -d $DWC2FK_DIR ]; then + status_msg "Removing dwc2-for-klipper directory ..." + rm -rf $DWC2FK_DIR && ok_msg "Directory removed!" + fi + if [ -d $TORNADO_DIR1 ]; then + status_msg "Removing tornado from klippy-env ..." + rm -rf $TORNADO_DIR1 $TORNADO_DIR2 && ok_msg "Tornado removed!" + fi + if [ -e $WEB_DWC2 ]; then + status_msg "Removing web_dwc2.py symlink from klippy ..." + rm -rf $WEB_DWC2 && ok_msg "File removed!" + fi + if [ -d $DWC2_DIR ]; then + status_msg "Removing dwc2 directory ..." + rm -rf $DWC2_DIR && ok_msg "Directory removed!" + fi + ok_msg "DWC2-for-Klipper & DWC2 Web UI successfully removed!" + fi +} + +remove_mainsail(){ + data_arr=( + $MAINSAIL_SERVICE1 + $MAINSAIL_SERVICE2 + $MAINSAIL_DIR + ${HOME}/moonraker.log + ${HOME}/.klippy_api_key + ${HOME}/.moonraker_api_key + ${HOME}/moonraker-env + /etc/nginx/sites-available/mainsail + /etc/nginx/sites-enabled/mainsail + /etc/init.d/nginx + /etc/default/nginx + ) + print_error "Mainsail" && data_count=() + if [ "$ERROR_MSG" = "" ]; then + stop_moonraker + #remove moonraker services + if [[ -e /etc/init.d/moonraker || -e /etc/default/moonraker ]]; then + status_msg "Removing moonraker service ..." + sudo update-rc.d -f moonraker remove + sudo rm -rf /etc/init.d/moonraker /etc/default/moonraker && ok_msg "Moonraker service removed!" + fi + #remove mainsail dir + if [ -d $MAINSAIL_DIR ]; then + status_msg "Removing mainsail directory ..." + rm -rf $MAINSAIL_DIR && ok_msg "Directory removed!" + fi + #remove moonraker-env + if [ -d ${HOME}/moonraker-env ]; then + status_msg "Removing moonraker virtualenv ..." + rm -rf ${HOME}/moonraker-env && ok_msg "Directory removed!" + fi + #remove moonraker.log symlink + if [[ -L ${HOME}/moonraker.log || -e /tmp/moonraker.log ]]; then + status_msg "Removing moonraker.log symlink ..." + rm -rf ${HOME}/moonraker.log /tmp/moonraker.log && ok_msg "Symlink removed!" + fi + #remove mainsail cfg + if [ -e /etc/nginx/sites-available/mainsail ]; then + status_msg "Removing mainsail configuration for nginx ..." + sudo rm /etc/nginx/sites-available/mainsail && ok_msg "File removed!" + fi + #remove mainsail symlink + if [ -L /etc/nginx/sites-enabled/mainsail ]; then + status_msg "Removing mainsail symlink for nginx ..." + sudo rm /etc/nginx/sites-enabled/mainsail && ok_msg "File removed!" + fi + #remove legacy api key + if [ -e ${HOME}/.klippy_api_key ]; then + status_msg "Removing legacy API Key ..." + rm ${HOME}/.klippy_api_key && ok_msg "Done!" + fi + #remove api key + if [ -e ${HOME}/.moonraker_api_key ]; then + status_msg "Removing API Key ..." + rm ${HOME}/.moonraker_api_key && ok_msg "Done!" + fi + remove_nginx + ok_msg "Mainsail successfully removed!" + fi +} + +remove_nginx(){ + #ask for complete removal of nginx if installed + if [[ $(dpkg-query -f'${Status}' --show nginx 2>/dev/null) = *\ installed ]] ; then + while true; do + echo + read -p "Do you want to completely remove (purge) nginx? (Y/n): " yn + case "$yn" in + Y|y|Yes|yes|"") + status_msg "Stopping and removing nginx service ..." + if [ -e /etc/init.d/nginx ]; then + sudo /etc/init.d/nginx stop && ok_msg "Nginx service stopped!" + sudo rm /etc/init.d/nginx && ok_msg "Nginx service removed!" + fi + if [ -e /etc/default/nginx ]; then + sudo rm /etc/default/nginx + fi + status_msg "Purging nginx from system ..." + sudo apt-get purge nginx nginx-common -y && ok_msg "Nginx removed!" + break;; + N|n|No|no) break;; + esac + done + fi +} \ No newline at end of file diff --git a/scripts/status.sh b/scripts/status.sh new file mode 100644 index 0000000..8ada19e --- /dev/null +++ b/scripts/status.sh @@ -0,0 +1,226 @@ +klipper_status(){ + kcount=0 + klipper_data=( + $KLIPPER_DIR + $KLIPPY_ENV_DIR + $KLIPPER_SERVICE1 + $KLIPPER_SERVICE2 + ) + #count+1 for each found data-item from array + for kd in "${klipper_data[@]}" + do + if [ -e $kd ]; then + kcount=$(expr $kcount + 1) + fi + done + if [ "$kcount" == "${#klipper_data[*]}" ]; then + KLIPPER_STATUS="${green}Installed!${default} " + elif [ "$kcount" == 0 ]; then + KLIPPER_STATUS="${red}Not installed!${default} " + else + KLIPPER_STATUS="${yellow}Incomplete!${default} " + fi +} + +dwc2_status(){ + dcount=0 + dwc2_data=( + $DWC2FK_DIR + $WEB_DWC2 + $DWC2_DIR + $TORNADO_DIR1 + $TORNADO_DIR2 + ) + #count+1 for each found data-item from array + for dd in "${dwc2_data[@]}" + do + if [ -e $dd ]; then + dcount=$(expr $dcount + 1) + fi + done + if [ "$dcount" == "${#dwc2_data[*]}" ]; then + DWC2_STATUS="${green}Installed!${default} " + elif [ "$dcount" == 0 ]; then + DWC2_STATUS="${red}Not installed!${default} " + else + DWC2_STATUS="${yellow}Incomplete!${default} " + fi +} + +mainsail_status(){ + mcount=0 + mainsail_data=( + $MAINSAIL_SERVICE1 + $MAINSAIL_SERVICE2 + $MAINSAIL_DIR + #${HOME}/.klippy_api_key + #${HOME}/.moonraker_api_key + #${HOME}/moonraker-env + /etc/nginx/sites-available/mainsail + /etc/nginx/sites-enabled/mainsail + /etc/init.d/nginx + /etc/default/nginx + ) + #count+1 for each found data-item from array + for md in "${mainsail_data[@]}" + do + if [ -e $md ]; then + mcount=$(expr $mcount + 1) + fi + done + if [ "$mcount" == "${#mainsail_data[*]}" ]; then + MAINSAIL_STATUS="${green}Installed!${default} " + elif [ "$mcount" == 0 ]; then + MAINSAIL_STATUS="${red}Not installed!${default} " + else + MAINSAIL_STATUS="${yellow}Incomplete!${default} " + fi +} + +read_branch(){ + if [ -d $KLIPPER_DIR ] && [ -d $KLIPPER_DIR/.git ]; then + cd $KLIPPER_DIR + GET_BRANCH=$(git branch -a | head -1 | cut -d " " -f5 | cut -d ")" -f1) + #if reading the branch gives an empty string + #we are on non-detached HEAD state on origin/master + #and need to set GET_BRANCH to make a non-empty string + if [ -z $GET_BRANCH ]; then + GET_BRANCH="origin/master" + fi + else + GET_BRANCH="" + fi +} + +print_branch(){ + read_branch + if [ "$GET_BRANCH" == "origin/master" ]; then + PRINT_BRANCH="${cyan}$GET_BRANCH${default} " + elif [ "$GET_BRANCH" == "dmbutyugin/scurve-shaping" ]; then + PRINT_BRANCH="${cyan}scurve-shaping${default} " + elif [ "$GET_BRANCH" == "dmbutyugin/scurve-smoothing" ]; then + PRINT_BRANCH="${cyan}scurve-smoothing${default} " + elif [ "$GET_BRANCH" == "Arksine/work-web_server-20200131" ]; then + PRINT_BRANCH="${cyan}moonraker${default} " + elif [ "$GET_BRANCH" == "Arksine/dev-moonraker-testing" ]; then + PRINT_BRANCH="${cyan}dev-moonraker${default} " + else + PRINT_BRANCH="${red}----${default} " + fi +} + +read_local_klipper_commit(){ + if [ -d $KLIPPER_DIR ] && [ -d $KLIPPER_DIR/.git ]; then + cd $KLIPPER_DIR + LOCAL_COMMIT=$(git rev-parse --short=8 HEAD) + else + LOCAL_COMMIT="" + fi +} + +read_remote_klipper_commit(){ + read_branch + if [ ! -z $GET_BRANCH ];then + REMOTE_COMMIT=$(git rev-parse --short=8 $GET_BRANCH) + else + REMOTE_COMMIT="" + fi +} + +compare_klipper_versions(){ + read_local_klipper_commit + read_remote_klipper_commit + #echo "Local: $LOCAL_COMMIT" + #echo "Remote: $REMOTE_COMMIT" + if [ "$LOCAL_COMMIT" != "$REMOTE_COMMIT" ]; then + LOCAL_COMMIT="${yellow}$LOCAL_COMMIT${default}" + REMOTE_COMMIT="${green}$REMOTE_COMMIT${default}" + else + LOCAL_COMMIT="${green}$LOCAL_COMMIT${default}" + REMOTE_COMMIT="${green}$REMOTE_COMMIT${default}" + fi +} + +read_dwc2fk_versions(){ + if [ -d $DWC2FK_DIR ] && [ -d $DWC2FK_DIR/.git ]; then + cd $DWC2FK_DIR + LOCAL_DWC2FK_COMMIT=$(git rev-parse --short=8 HEAD) + REMOTE_DWC2FK_COMMIT=$(git rev-parse --short=8 origin/master) + else + LOCAL_DWC2FK_COMMIT="" + REMOTE_DWC2FK_COMMIT="" + fi +} + +compare_dwc2fk_versions(){ + read_dwc2fk_versions + #echo "Local: $LOCAL_DWC2FK_COMMIT" + #echo "Remote: $REMOTE_DWC2FK_COMMIT" + if [ "$LOCAL_DWC2FK_COMMIT" != "$REMOTE_DWC2FK_COMMIT" ]; then + LOCAL_DWC2FK_COMMIT="${yellow}$LOCAL_DWC2FK_COMMIT${default}" + REMOTE_DWC2FK_COMMIT="${green}$REMOTE_DWC2FK_COMMIT${default}" + else + LOCAL_DWC2FK_COMMIT="${green}$LOCAL_DWC2FK_COMMIT${default}" + REMOTE_DWC2FK_COMMIT="${green}$REMOTE_DWC2FK_COMMIT${default}" + fi +} + +read_local_dwc2_version(){ + if [ -e $DWC2_DIR/web/version ]; then + DWC2_LOCAL_VER=$(head -n 1 $DWC2_DIR/web/version) + else + DWC2_LOCAL_VER="" + fi +} + +read_remote_dwc2_version(){ + DWC2_REMOTE_VER=$(curl -s https://api.github.com/repositories/28820678/releases/latest | grep tag_name | cut -d'"' -f4) +} + +compare_dwc2_versions(){ + read_local_dwc2_version + read_remote_dwc2_version + #echo "Local: $DWC2_LOCAL_VER" + #echo "Remote: $DWC2_REMOTE_VER" + if [ "$DWC2_LOCAL_VER" != "$DWC2_REMOTE_VER" ]; then + DWC2_LOCAL_VER="${yellow}$DWC2_LOCAL_VER${default}" + DWC2_REMOTE_VER="${green}$DWC2_REMOTE_VER${default}" + else + DWC2_LOCAL_VER="${green}$DWC2_LOCAL_VER${default}" + DWC2_REMOTE_VER="${green}$DWC2_REMOTE_VER${default}" + fi +} + +read_local_mainsail_version(){ + if [ -e $MAINSAIL_DIR/version ]; then + MAINSAIL_LOCAL_VER=$(head -n 1 $MAINSAIL_DIR/version) + else + MAINSAIL_LOCAL_VER="" + fi +} + +read_remote_mainsail_version(){ + get_mainsail_ver + MAINSAIL_REMOTE_VER=$MAINSAIL_VERSION +} + +compare_mainsail_versions(){ + read_local_mainsail_version + read_remote_mainsail_version + #echo "Local: $MAINSAIL_LOCAL_VER" + #echo "Remote: $MAINSAIL_REMOTE_VER" + if [ "$MAINSAIL_LOCAL_VER" != "$MAINSAIL_REMOTE_VER" ]; then + MAINSAIL_LOCAL_VER="${yellow}$MAINSAIL_LOCAL_VER${default}" + MAINSAIL_REMOTE_VER="${green}$MAINSAIL_REMOTE_VER${default}" + else + MAINSAIL_LOCAL_VER="${green}$MAINSAIL_LOCAL_VER${default}" + MAINSAIL_REMOTE_VER="${green}$MAINSAIL_REMOTE_VER${default}" + fi +} + +ui_print_versions(){ + compare_klipper_versions + compare_dwc2fk_versions + compare_dwc2_versions + compare_mainsail_versions +} \ No newline at end of file diff --git a/scripts/switch_branch.sh b/scripts/switch_branch.sh new file mode 100644 index 0000000..a2b22ed --- /dev/null +++ b/scripts/switch_branch.sh @@ -0,0 +1,41 @@ +switch_to_origin(){ + cd $KLIPPER_DIR + status_msg "Switching...Please wait ..."; echo + git fetch origin -q && git checkout origin/master -q +} + +switch_to_scurve_shaping(){ + cd $KLIPPER_DIR + status_msg "Switching...Please wait ..."; echo + if ! git remote | grep dmbutyugin -q; then + git remote add dmbutyugin $DMBUTYUGIN_REPO + fi + git fetch dmbutyugin -q && git checkout $BRANCH_SCURVE_SHAPING -q +} + +switch_to_scurve_smoothing(){ + cd $KLIPPER_DIR + status_msg "Switching...Please wait ..."; echo + if ! git remote | grep dmbutyugin -q; then + git remote add dmbutyugin $DMBUTYUGIN_REPO + fi + git fetch dmbutyugin -q && git checkout $BRANCH_SCURVE_SMOOTHING -q +} + +switch_to_moonraker(){ + cd $KLIPPER_DIR + status_msg "Switching...Please wait ..."; echo + if ! git remote | grep Arksine -q; then + git remote add Arksine $ARKSINE_REPO + fi + git fetch Arksine -q && git checkout $BRANCH_MOONRAKER -q +} + +switch_to_dev_moonraker(){ + cd $KLIPPER_DIR + status_msg "Switching...Please wait ..."; echo + if ! git remote | grep Arksine -q; then + git remote add Arksine $ARKSINE_REPO + fi + git fetch Arksine -q && git checkout $BRANCH_DEV_MOONRAKER -q +} \ No newline at end of file diff --git a/scripts/ui.sh b/scripts/ui.sh new file mode 100644 index 0000000..19bb106 --- /dev/null +++ b/scripts/ui.sh @@ -0,0 +1,154 @@ +### set up some UI stuff + +#ui total width = 57 chars +top_border(){ + echo -e "/=======================================================\ " +} + +bottom_border(){ + echo -e "\=======================================================/" +} + +hr(){ + echo -e "|-------------------------------------------------------|" +} + +quit_footer(){ + hr + echo -e "| ${red}Q) Quit${default} | " + bottom_border +} + +print_header(){ + top_border + echo -e "| $(title_msg "~~~~~~~~~~~~~~~~~ [ KIAUH ] ~~~~~~~~~~~~~~~~~") |" + echo -e "| $(title_msg " Klipper Installation And Update Helper ") |" + echo -e "| $(title_msg "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~") |" + bottom_border +} + +main_ui(){ + top_border + echo -e "| $(title_msg "~~~~~~~~~~~~~~~ [ Main Menu ] ~~~~~~~~~~~~~~~") |" + hr + echo -e "| 0) [System status] | |" + echo -e "| | Klipper: $KLIPPER_STATUS|" + echo -e "| 1) [Install] | Branch: $PRINT_BRANCH|" + echo -e "| 2) [Update] | |" + echo -e "| 3) [Remove] | DWC2: $DWC2_STATUS|" + echo -e "| | Mainsail: $MAINSAIL_STATUS|" + echo -e "| 4) [Advanced] | Octoprint: #### WIP #### |" + echo -e "| 5) [Backup] | |" + quit_footer +} + +install_ui(){ + top_border + echo -e "| $(title_msg "~~~~~~~~~~~ [ Installation Menu ] ~~~~~~~~~~~") | " + hr + echo -e "| You need this menu usually only for installing | " + echo -e "| all necessary dependencies for the various | " + echo -e "| functions on a completely fresh system. | " + hr + echo -e "| Firmware: | | " + echo -e "| 1) [Klipper] | | " + echo -e "| | | " + echo -e "| Webinterface: | | " + echo -e "| 2) [DWC2] | | " + echo -e "| 3) [Mainsail] | | " + echo -e "| | | " + quit_footer +} + +update_ui(){ + top_border + echo -e "| $(title_msg "~~~~~~~~~~~~~~ [ Update Menu ] ~~~~~~~~~~~~~~") | " + hr + echo -e "| It's a good idea to check the following website | " + echo -e "| for important software changes to the config file | " + echo -e "| BEFORE updating your klipper installation: | " + echo -e "| | " + echo -e "| ${yellow}https://www.klipper3d.org/Config_Changes.html${default} | " + bottom_border + top_border + echo -e "| 0) $BB4U_STATUS| " + hr + echo -e "| | Local Vers: | Remote Vers: | " + echo -e "| Firmware: | | | " + echo -e "| 1) [Klipper] | $(echo "$LOCAL_COMMIT") | $(echo "$REMOTE_COMMIT") | " + echo -e "| | | | " + echo -e "| Webinterface: | | | " + echo -e "| 2) [DWC2-for-Klipper] | $(echo "$LOCAL_DWC2FK_COMMIT") | $(echo "$REMOTE_DWC2FK_COMMIT") | " + echo -e "| 3) [DWC2 Web UI] | $(echo "$DWC2_LOCAL_VER") | $(echo "$DWC2_REMOTE_VER") | " + echo -e "| 4) [Mainsail] | $(echo "$MAINSAIL_LOCAL_VER") | $(echo "$MAINSAIL_REMOTE_VER") | " + echo -e "| | | | " + quit_footer +} + +remove_ui(){ + top_border + echo -e "| $(title_msg "~~~~~~~~~~~~~~ [ Remove Menu ] ~~~~~~~~~~~~~~") | " + hr + echo -e "| Files and directories which remain untouched: | " + echo -e "| --> ~/printer.cfg | " + echo -e "| --> ~/backup | " + echo -e "| You need remove them manually if you wish so. | " + hr + echo -e "| 1) [Klipper] | | " + echo -e "| 2) [DWC2-for-Klipper] | | " + echo -e "| 3) [Mainsail] | | " + echo -e "| | | " + quit_footer +} + +advanced_ui(){ + top_border + echo -e "| $(title_msg "~~~~~~~~~~~~~ [ Advanced Menu ] ~~~~~~~~~~~~~") | " + hr + echo -e "| 1) [Switch Klipper version] | " + echo -e "| | " + echo -e "| 2) [Build Firmware] | " + echo -e "| 3) [Flash MCU] | " + echo -e "| 4) [Get Printer-ID] | " + echo -e "| 5) [Write Printer-ID to printer.cfg] | " + echo -e "| 6) [Write DWC2-for-klipper config] | " + echo -e "| | " + echo -e "| x) [Enable/Disable Octoprint service] | " + echo -e "| | " +quit_footer +} + +backup_ui(){ + top_border + echo -e "| $(title_msg "~~~~~~~~~~~~~~ [ Backup Menu ] ~~~~~~~~~~~~~~") | " + hr + echo -e "| | " + hr + echo -e "| 1) [ ] | " + echo -e "| 2) [ ] | " + echo -e "| 3) [ ] | " + echo -e "| 4) [ ] | " + echo -e "| 5) [ ] | " + echo -e "| 6) [ ] | " + echo -e "| 7) [ ] | " + echo -e "| | " + quit_footer +} + +switch_ui(){ + top_border + echo -e "| $(title_msg "~~~~~~~~~ [ Switch Klipper Branch ] ~~~~~~~~~") |" + bottom_border + echo + echo -e " $(title_msg "Active branch: ")${green}$GET_BRANCH${default}" + echo + top_border + echo -e "| 1) [--> origin/master] | " + echo -e "| | " + echo -e "| 2) [--> scurve-shaping] | " + echo -e "| 3) [--> scurve-smoothing] | " + echo -e "| | " + echo -e "| 4) [--> moonraker] | " + echo -e "| 5) [--> dev-moonraker] | " + quit_footer +} \ No newline at end of file diff --git a/scripts/update.sh b/scripts/update.sh new file mode 100644 index 0000000..3239f2a --- /dev/null +++ b/scripts/update.sh @@ -0,0 +1,77 @@ +#TODO +# - update the correct branch +# - version checks before updating + +#WIP +update_check(){ + read_local_commit + read_remote_commit +} + +update_klipper(){ + stop_klipper + bb4u_klipper + if [ ! -d $KLIPPER_DIR ]; then + cd ${HOME} && git clone $KLIPPER_REPO + else + read_branch + status_msg "Updating $GET_BRANCH" + #fetching origin/master -> error + #rewriting origin/master to origin + if [ "$GET_BRANCH" == "origin/master" ]; then + FETCH_BRANCH="origin" + else + FETCH_BRANCH=$(echo "$GET_BRANCH" | cut -d "/" -f1) + fi + status_msg "Fetching from $FETCH_BRANCH" + git fetch $FETCH_BRANCH -q && ok_msg "Fetch successfull!" + status_msg "Checking out $GET_BRANCH" + git checkout $GET_BRANCH -q && ok_msg "Checkout successfull!" && echo; ok_msg "Update complete!" + fi + start_klipper; echo +} + +update_dwc2fk(){ + stop_klipper + bb4u_dwc2fk + if [ ! -d $DWC2FK_DIR ]; then + cd ${HOME} && git clone $DWC2FK_REPO + else + cd $DWC2FK_DIR && git pull + #create a web_dwc2.py symlink if not already existing + if [ -d $KLIPPER_DIR/klippy/extras ] && [ ! -e $WEB_DWC2 ]; then + status_msg "Creating web_dwc2.py symlink ..." + ln -s $DWC2FK_DIR/web_dwc2.py $WEB_DWC2 && ok_msg "Symlink created!" + fi + fi + start_klipper +} + +update_dwc2(){ + bb4u_dwc2 + #check dependencies + dep=(wget gzip tar curl) + dep_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!" +} + +update_mainsail(){ + stop_klipper + bb4u_mainsail + status_msg "Updating Mainsail ..." + install_mainsail + start_klipper +} \ No newline at end of file From bf70157a640de3b7a3477a6bd7f62050cc79284c Mon Sep 17 00:00:00 2001 From: th33xitus <31533186+th33xitus@users.noreply.github.com> Date: Mon, 13 Jul 2020 17:15:09 +0200 Subject: [PATCH 03/64] Update README.md --- README.md | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b0a76b8..d162a59 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +# THIS VERSION IS WORK IN PROGRESS!!! + # KIAUH ## Klipper Installation And Update Helper @@ -8,5 +10,34 @@ There are also functions for updating your current installations or removing the ## First things first: When you decide to use this script, you use it at your own risk! -# THIS VERSION IS WORK IN PROGRESS!!! -# BUGS MAY BE STILL PRESENT!!! +Give it a try if you want and if you have suggestions or encounter any problems, please report them. But i can't guarantee that i will fix them immediately (or at all). + +## Instructions: + +In order to run this script you have to make it executable. Use the following commands in the given order to download and execute the script. + +``` +cd ~ +git clone https://github.com/th33xitus/kiauh.git +chmod +x ~/kiauh/kiauh.sh +chmod +x ~/kiauh/scripts/* +./kiauh/kiauh.sh +``` + +## Restrictions: +* Tested only on Raspbian Buster Lite + +## Functions and Features: +Soon™ + + +## Q&A + +__*Q: Can i install octoprint with this script?*__ + +**A:** Soon™ + + +__*Q: Can i use this script to install multiple instancec of Klipper on the same Pi? (Multisession?)*__ + + **A:** No, and at the moment i don't plan to implement this function. For multisession installations take a look at this script manu7irl created: https://github.com/manu7irl/klipper-DWC2-installer From 50eb2621d77c6d2576a9997d4efe2cacf2a815a8 Mon Sep 17 00:00:00 2001 From: th33xitus <31533186+th33xitus@users.noreply.github.com> Date: Mon, 13 Jul 2020 17:21:10 +0200 Subject: [PATCH 04/64] Update README.md Update instructions for switching to the dev-2.0 branch. --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d162a59..4930eba 100644 --- a/README.md +++ b/README.md @@ -19,9 +19,10 @@ In order to run this script you have to make it executable. Use the following co ``` cd ~ git clone https://github.com/th33xitus/kiauh.git +cd kiauh && git checkout dev-2.0 chmod +x ~/kiauh/kiauh.sh chmod +x ~/kiauh/scripts/* -./kiauh/kiauh.sh +./kiauh.sh ``` ## Restrictions: From 3f7b454710bed4d9e9531f3e8ca46933d3f5249a Mon Sep 17 00:00:00 2001 From: th33xitus <31533186+th33xitus@users.noreply.github.com> Date: Mon, 13 Jul 2020 17:42:38 +0200 Subject: [PATCH 05/64] Update README.md add screenshot --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 4930eba..48aefa4 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ ## Klipper Installation And Update Helper +[![kiauh](https://abload.de/img/mobaxterm_personal_207mk20.png)](https://abload.de/image.php?img=mobaxterm_personal_207mk20.png) + This script was actually created for my personal use only but i then decided to make the script accessible for everyone. It is meant to help guiding you through a complete fresh install of Klipper and optionally the DWC2 web UI + DWC2-for-Klipper. There are also functions for updating your current installations or removing them from your system. From 6cf253eb8c359bb5a974afb3c4ffb2e75a652f20 Mon Sep 17 00:00:00 2001 From: th33xitus <31533186+th33xitus@users.noreply.github.com> Date: Mon, 13 Jul 2020 17:53:08 +0200 Subject: [PATCH 06/64] Fix typo --- scripts/functions.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/functions.sh b/scripts/functions.sh index 3f2eaa7..d99cc66 100644 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -12,7 +12,7 @@ check_euid(){ } source_ini(){ - source ${HOME}/kiauh2/kiauh.ini + source ${HOME}/kiauh/kiauh.ini } start_klipper(){ @@ -182,4 +182,4 @@ flash_mcu(){ ok_msg "Flashing successfull!" fi start_klipper -} \ No newline at end of file +} From f1d9b9c21bcb6ee776c3c15647ee65cc0c889cb6 Mon Sep 17 00:00:00 2001 From: th33xitus <31533186+th33xitus@users.noreply.github.com> Date: Mon, 13 Jul 2020 18:07:43 +0200 Subject: [PATCH 07/64] Fix visual issue Fix an UI issue when DWC2 or Mainsail are not installed --- status.sh | 226 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 226 insertions(+) create mode 100644 status.sh diff --git a/status.sh b/status.sh new file mode 100644 index 0000000..64194fe --- /dev/null +++ b/status.sh @@ -0,0 +1,226 @@ +klipper_status(){ + kcount=0 + klipper_data=( + $KLIPPER_DIR + $KLIPPY_ENV_DIR + $KLIPPER_SERVICE1 + $KLIPPER_SERVICE2 + ) + #count+1 for each found data-item from array + for kd in "${klipper_data[@]}" + do + if [ -e $kd ]; then + kcount=$(expr $kcount + 1) + fi + done + if [ "$kcount" == "${#klipper_data[*]}" ]; then + KLIPPER_STATUS="${green}Installed!${default} " + elif [ "$kcount" == 0 ]; then + KLIPPER_STATUS="${red}Not installed!${default} " + else + KLIPPER_STATUS="${yellow}Incomplete!${default} " + fi +} + +dwc2_status(){ + dcount=0 + dwc2_data=( + $DWC2FK_DIR + $WEB_DWC2 + $DWC2_DIR + $TORNADO_DIR1 + $TORNADO_DIR2 + ) + #count+1 for each found data-item from array + for dd in "${dwc2_data[@]}" + do + if [ -e $dd ]; then + dcount=$(expr $dcount + 1) + fi + done + if [ "$dcount" == "${#dwc2_data[*]}" ]; then + DWC2_STATUS="${green}Installed!${default} " + elif [ "$dcount" == 0 ]; then + DWC2_STATUS="${red}Not installed!${default} " + else + DWC2_STATUS="${yellow}Incomplete!${default} " + fi +} + +mainsail_status(){ + mcount=0 + mainsail_data=( + $MAINSAIL_SERVICE1 + $MAINSAIL_SERVICE2 + $MAINSAIL_DIR + #${HOME}/.klippy_api_key + #${HOME}/.moonraker_api_key + #${HOME}/moonraker-env + /etc/nginx/sites-available/mainsail + /etc/nginx/sites-enabled/mainsail + /etc/init.d/nginx + /etc/default/nginx + ) + #count+1 for each found data-item from array + for md in "${mainsail_data[@]}" + do + if [ -e $md ]; then + mcount=$(expr $mcount + 1) + fi + done + if [ "$mcount" == "${#mainsail_data[*]}" ]; then + MAINSAIL_STATUS="${green}Installed!${default} " + elif [ "$mcount" == 0 ]; then + MAINSAIL_STATUS="${red}Not installed!${default} " + else + MAINSAIL_STATUS="${yellow}Incomplete!${default} " + fi +} + +read_branch(){ + if [ -d $KLIPPER_DIR ] && [ -d $KLIPPER_DIR/.git ]; then + cd $KLIPPER_DIR + GET_BRANCH=$(git branch -a | head -1 | cut -d " " -f5 | cut -d ")" -f1) + #if reading the branch gives an empty string + #we are on non-detached HEAD state on origin/master + #and need to set GET_BRANCH to make a non-empty string + if [ -z $GET_BRANCH ]; then + GET_BRANCH="origin/master" + fi + else + GET_BRANCH="" + fi +} + +print_branch(){ + read_branch + if [ "$GET_BRANCH" == "origin/master" ]; then + PRINT_BRANCH="${cyan}$GET_BRANCH${default} " + elif [ "$GET_BRANCH" == "dmbutyugin/scurve-shaping" ]; then + PRINT_BRANCH="${cyan}scurve-shaping${default} " + elif [ "$GET_BRANCH" == "dmbutyugin/scurve-smoothing" ]; then + PRINT_BRANCH="${cyan}scurve-smoothing${default} " + elif [ "$GET_BRANCH" == "Arksine/work-web_server-20200131" ]; then + PRINT_BRANCH="${cyan}moonraker${default} " + elif [ "$GET_BRANCH" == "Arksine/dev-moonraker-testing" ]; then + PRINT_BRANCH="${cyan}dev-moonraker${default} " + else + PRINT_BRANCH="${red}----${default} " + fi +} + +read_local_klipper_commit(){ + if [ -d $KLIPPER_DIR ] && [ -d $KLIPPER_DIR/.git ]; then + cd $KLIPPER_DIR + LOCAL_COMMIT=$(git rev-parse --short=8 HEAD) + else + LOCAL_COMMIT="" + fi +} + +read_remote_klipper_commit(){ + read_branch + if [ ! -z $GET_BRANCH ];then + REMOTE_COMMIT=$(git rev-parse --short=8 $GET_BRANCH) + else + REMOTE_COMMIT="" + fi +} + +compare_klipper_versions(){ + read_local_klipper_commit + read_remote_klipper_commit + #echo "Local: $LOCAL_COMMIT" + #echo "Remote: $REMOTE_COMMIT" + if [ "$LOCAL_COMMIT" != "$REMOTE_COMMIT" ]; then + LOCAL_COMMIT="${yellow}$LOCAL_COMMIT${default}" + REMOTE_COMMIT="${green}$REMOTE_COMMIT${default}" + else + LOCAL_COMMIT="${green}$LOCAL_COMMIT${default}" + REMOTE_COMMIT="${green}$REMOTE_COMMIT${default}" + fi +} + +read_dwc2fk_versions(){ + if [ -d $DWC2FK_DIR ] && [ -d $DWC2FK_DIR/.git ]; then + cd $DWC2FK_DIR + LOCAL_DWC2FK_COMMIT=$(git rev-parse --short=8 HEAD) + REMOTE_DWC2FK_COMMIT=$(git rev-parse --short=8 origin/master) + else + LOCAL_DWC2FK_COMMIT="${red}--------${default}" + REMOTE_DWC2FK_COMMIT="${red}--------${default}" + fi +} + +compare_dwc2fk_versions(){ + read_dwc2fk_versions + #echo "Local: $LOCAL_DWC2FK_COMMIT" + #echo "Remote: $REMOTE_DWC2FK_COMMIT" + if [ "$LOCAL_DWC2FK_COMMIT" != "$REMOTE_DWC2FK_COMMIT" ]; then + LOCAL_DWC2FK_COMMIT="${yellow}$LOCAL_DWC2FK_COMMIT${default}" + REMOTE_DWC2FK_COMMIT="${green}$REMOTE_DWC2FK_COMMIT${default}" + else + LOCAL_DWC2FK_COMMIT="${green}$LOCAL_DWC2FK_COMMIT${default}" + REMOTE_DWC2FK_COMMIT="${green}$REMOTE_DWC2FK_COMMIT${default}" + fi +} + +read_local_dwc2_version(){ + if [ -e $DWC2_DIR/web/version ]; then + DWC2_LOCAL_VER=$(head -n 1 $DWC2_DIR/web/version) + else + DWC2_LOCAL_VER="${red}-----${default}" + fi +} + +read_remote_dwc2_version(){ + DWC2_REMOTE_VER=$(curl -s https://api.github.com/repositories/28820678/releases/latest | grep tag_name | cut -d'"' -f4) +} + +compare_dwc2_versions(){ + read_local_dwc2_version + read_remote_dwc2_version + #echo "Local: $DWC2_LOCAL_VER" + #echo "Remote: $DWC2_REMOTE_VER" + if [ "$DWC2_LOCAL_VER" != "$DWC2_REMOTE_VER" ]; then + DWC2_LOCAL_VER="${yellow}$DWC2_LOCAL_VER${default}" + DWC2_REMOTE_VER="${green}$DWC2_REMOTE_VER${default}" + else + DWC2_LOCAL_VER="${green}$DWC2_LOCAL_VER${default}" + DWC2_REMOTE_VER="${green}$DWC2_REMOTE_VER${default}" + fi +} + +read_local_mainsail_version(){ + if [ -e $MAINSAIL_DIR/version ]; then + MAINSAIL_LOCAL_VER=$(head -n 1 $MAINSAIL_DIR/version) + else + MAINSAIL_LOCAL_VER="${red}------${default}" + fi +} + +read_remote_mainsail_version(){ + get_mainsail_ver + MAINSAIL_REMOTE_VER=$MAINSAIL_VERSION +} + +compare_mainsail_versions(){ + read_local_mainsail_version + read_remote_mainsail_version + #echo "Local: $MAINSAIL_LOCAL_VER" + #echo "Remote: $MAINSAIL_REMOTE_VER" + if [ "$MAINSAIL_LOCAL_VER" != "$MAINSAIL_REMOTE_VER" ]; then + MAINSAIL_LOCAL_VER="${yellow}$MAINSAIL_LOCAL_VER${default}" + MAINSAIL_REMOTE_VER="${green}$MAINSAIL_REMOTE_VER${default}" + else + MAINSAIL_LOCAL_VER="${green}$MAINSAIL_LOCAL_VER${default}" + MAINSAIL_REMOTE_VER="${green}$MAINSAIL_REMOTE_VER${default}" + fi +} + +ui_print_versions(){ + compare_klipper_versions + compare_dwc2fk_versions + compare_dwc2_versions + compare_mainsail_versions +} \ No newline at end of file From e2bb6cd849532ee97e04e2a9340f3609cde02079 Mon Sep 17 00:00:00 2001 From: th33xitus <31533186+th33xitus@users.noreply.github.com> Date: Mon, 13 Jul 2020 18:09:30 +0200 Subject: [PATCH 08/64] Fix visual issue Fix an UI issue when DWC2 or Mainsail are not installed --- scripts/status.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/status.sh b/scripts/status.sh index 8ada19e..64194fe 100644 --- a/scripts/status.sh +++ b/scripts/status.sh @@ -147,8 +147,8 @@ read_dwc2fk_versions(){ LOCAL_DWC2FK_COMMIT=$(git rev-parse --short=8 HEAD) REMOTE_DWC2FK_COMMIT=$(git rev-parse --short=8 origin/master) else - LOCAL_DWC2FK_COMMIT="" - REMOTE_DWC2FK_COMMIT="" + LOCAL_DWC2FK_COMMIT="${red}--------${default}" + REMOTE_DWC2FK_COMMIT="${red}--------${default}" fi } @@ -169,7 +169,7 @@ read_local_dwc2_version(){ if [ -e $DWC2_DIR/web/version ]; then DWC2_LOCAL_VER=$(head -n 1 $DWC2_DIR/web/version) else - DWC2_LOCAL_VER="" + DWC2_LOCAL_VER="${red}-----${default}" fi } @@ -195,7 +195,7 @@ read_local_mainsail_version(){ if [ -e $MAINSAIL_DIR/version ]; then MAINSAIL_LOCAL_VER=$(head -n 1 $MAINSAIL_DIR/version) else - MAINSAIL_LOCAL_VER="" + MAINSAIL_LOCAL_VER="${red}------${default}" fi } From c57acefc16452e793e04d2e2b2dd84ff16c23269 Mon Sep 17 00:00:00 2001 From: th33xitus <31533186+th33xitus@users.noreply.github.com> Date: Mon, 13 Jul 2020 18:10:10 +0200 Subject: [PATCH 09/64] Delete status.sh derp... --- status.sh | 226 ------------------------------------------------------ 1 file changed, 226 deletions(-) delete mode 100644 status.sh diff --git a/status.sh b/status.sh deleted file mode 100644 index 64194fe..0000000 --- a/status.sh +++ /dev/null @@ -1,226 +0,0 @@ -klipper_status(){ - kcount=0 - klipper_data=( - $KLIPPER_DIR - $KLIPPY_ENV_DIR - $KLIPPER_SERVICE1 - $KLIPPER_SERVICE2 - ) - #count+1 for each found data-item from array - for kd in "${klipper_data[@]}" - do - if [ -e $kd ]; then - kcount=$(expr $kcount + 1) - fi - done - if [ "$kcount" == "${#klipper_data[*]}" ]; then - KLIPPER_STATUS="${green}Installed!${default} " - elif [ "$kcount" == 0 ]; then - KLIPPER_STATUS="${red}Not installed!${default} " - else - KLIPPER_STATUS="${yellow}Incomplete!${default} " - fi -} - -dwc2_status(){ - dcount=0 - dwc2_data=( - $DWC2FK_DIR - $WEB_DWC2 - $DWC2_DIR - $TORNADO_DIR1 - $TORNADO_DIR2 - ) - #count+1 for each found data-item from array - for dd in "${dwc2_data[@]}" - do - if [ -e $dd ]; then - dcount=$(expr $dcount + 1) - fi - done - if [ "$dcount" == "${#dwc2_data[*]}" ]; then - DWC2_STATUS="${green}Installed!${default} " - elif [ "$dcount" == 0 ]; then - DWC2_STATUS="${red}Not installed!${default} " - else - DWC2_STATUS="${yellow}Incomplete!${default} " - fi -} - -mainsail_status(){ - mcount=0 - mainsail_data=( - $MAINSAIL_SERVICE1 - $MAINSAIL_SERVICE2 - $MAINSAIL_DIR - #${HOME}/.klippy_api_key - #${HOME}/.moonraker_api_key - #${HOME}/moonraker-env - /etc/nginx/sites-available/mainsail - /etc/nginx/sites-enabled/mainsail - /etc/init.d/nginx - /etc/default/nginx - ) - #count+1 for each found data-item from array - for md in "${mainsail_data[@]}" - do - if [ -e $md ]; then - mcount=$(expr $mcount + 1) - fi - done - if [ "$mcount" == "${#mainsail_data[*]}" ]; then - MAINSAIL_STATUS="${green}Installed!${default} " - elif [ "$mcount" == 0 ]; then - MAINSAIL_STATUS="${red}Not installed!${default} " - else - MAINSAIL_STATUS="${yellow}Incomplete!${default} " - fi -} - -read_branch(){ - if [ -d $KLIPPER_DIR ] && [ -d $KLIPPER_DIR/.git ]; then - cd $KLIPPER_DIR - GET_BRANCH=$(git branch -a | head -1 | cut -d " " -f5 | cut -d ")" -f1) - #if reading the branch gives an empty string - #we are on non-detached HEAD state on origin/master - #and need to set GET_BRANCH to make a non-empty string - if [ -z $GET_BRANCH ]; then - GET_BRANCH="origin/master" - fi - else - GET_BRANCH="" - fi -} - -print_branch(){ - read_branch - if [ "$GET_BRANCH" == "origin/master" ]; then - PRINT_BRANCH="${cyan}$GET_BRANCH${default} " - elif [ "$GET_BRANCH" == "dmbutyugin/scurve-shaping" ]; then - PRINT_BRANCH="${cyan}scurve-shaping${default} " - elif [ "$GET_BRANCH" == "dmbutyugin/scurve-smoothing" ]; then - PRINT_BRANCH="${cyan}scurve-smoothing${default} " - elif [ "$GET_BRANCH" == "Arksine/work-web_server-20200131" ]; then - PRINT_BRANCH="${cyan}moonraker${default} " - elif [ "$GET_BRANCH" == "Arksine/dev-moonraker-testing" ]; then - PRINT_BRANCH="${cyan}dev-moonraker${default} " - else - PRINT_BRANCH="${red}----${default} " - fi -} - -read_local_klipper_commit(){ - if [ -d $KLIPPER_DIR ] && [ -d $KLIPPER_DIR/.git ]; then - cd $KLIPPER_DIR - LOCAL_COMMIT=$(git rev-parse --short=8 HEAD) - else - LOCAL_COMMIT="" - fi -} - -read_remote_klipper_commit(){ - read_branch - if [ ! -z $GET_BRANCH ];then - REMOTE_COMMIT=$(git rev-parse --short=8 $GET_BRANCH) - else - REMOTE_COMMIT="" - fi -} - -compare_klipper_versions(){ - read_local_klipper_commit - read_remote_klipper_commit - #echo "Local: $LOCAL_COMMIT" - #echo "Remote: $REMOTE_COMMIT" - if [ "$LOCAL_COMMIT" != "$REMOTE_COMMIT" ]; then - LOCAL_COMMIT="${yellow}$LOCAL_COMMIT${default}" - REMOTE_COMMIT="${green}$REMOTE_COMMIT${default}" - else - LOCAL_COMMIT="${green}$LOCAL_COMMIT${default}" - REMOTE_COMMIT="${green}$REMOTE_COMMIT${default}" - fi -} - -read_dwc2fk_versions(){ - if [ -d $DWC2FK_DIR ] && [ -d $DWC2FK_DIR/.git ]; then - cd $DWC2FK_DIR - LOCAL_DWC2FK_COMMIT=$(git rev-parse --short=8 HEAD) - REMOTE_DWC2FK_COMMIT=$(git rev-parse --short=8 origin/master) - else - LOCAL_DWC2FK_COMMIT="${red}--------${default}" - REMOTE_DWC2FK_COMMIT="${red}--------${default}" - fi -} - -compare_dwc2fk_versions(){ - read_dwc2fk_versions - #echo "Local: $LOCAL_DWC2FK_COMMIT" - #echo "Remote: $REMOTE_DWC2FK_COMMIT" - if [ "$LOCAL_DWC2FK_COMMIT" != "$REMOTE_DWC2FK_COMMIT" ]; then - LOCAL_DWC2FK_COMMIT="${yellow}$LOCAL_DWC2FK_COMMIT${default}" - REMOTE_DWC2FK_COMMIT="${green}$REMOTE_DWC2FK_COMMIT${default}" - else - LOCAL_DWC2FK_COMMIT="${green}$LOCAL_DWC2FK_COMMIT${default}" - REMOTE_DWC2FK_COMMIT="${green}$REMOTE_DWC2FK_COMMIT${default}" - fi -} - -read_local_dwc2_version(){ - if [ -e $DWC2_DIR/web/version ]; then - DWC2_LOCAL_VER=$(head -n 1 $DWC2_DIR/web/version) - else - DWC2_LOCAL_VER="${red}-----${default}" - fi -} - -read_remote_dwc2_version(){ - DWC2_REMOTE_VER=$(curl -s https://api.github.com/repositories/28820678/releases/latest | grep tag_name | cut -d'"' -f4) -} - -compare_dwc2_versions(){ - read_local_dwc2_version - read_remote_dwc2_version - #echo "Local: $DWC2_LOCAL_VER" - #echo "Remote: $DWC2_REMOTE_VER" - if [ "$DWC2_LOCAL_VER" != "$DWC2_REMOTE_VER" ]; then - DWC2_LOCAL_VER="${yellow}$DWC2_LOCAL_VER${default}" - DWC2_REMOTE_VER="${green}$DWC2_REMOTE_VER${default}" - else - DWC2_LOCAL_VER="${green}$DWC2_LOCAL_VER${default}" - DWC2_REMOTE_VER="${green}$DWC2_REMOTE_VER${default}" - fi -} - -read_local_mainsail_version(){ - if [ -e $MAINSAIL_DIR/version ]; then - MAINSAIL_LOCAL_VER=$(head -n 1 $MAINSAIL_DIR/version) - else - MAINSAIL_LOCAL_VER="${red}------${default}" - fi -} - -read_remote_mainsail_version(){ - get_mainsail_ver - MAINSAIL_REMOTE_VER=$MAINSAIL_VERSION -} - -compare_mainsail_versions(){ - read_local_mainsail_version - read_remote_mainsail_version - #echo "Local: $MAINSAIL_LOCAL_VER" - #echo "Remote: $MAINSAIL_REMOTE_VER" - if [ "$MAINSAIL_LOCAL_VER" != "$MAINSAIL_REMOTE_VER" ]; then - MAINSAIL_LOCAL_VER="${yellow}$MAINSAIL_LOCAL_VER${default}" - MAINSAIL_REMOTE_VER="${green}$MAINSAIL_REMOTE_VER${default}" - else - MAINSAIL_LOCAL_VER="${green}$MAINSAIL_LOCAL_VER${default}" - MAINSAIL_REMOTE_VER="${green}$MAINSAIL_REMOTE_VER${default}" - fi -} - -ui_print_versions(){ - compare_klipper_versions - compare_dwc2fk_versions - compare_dwc2_versions - compare_mainsail_versions -} \ No newline at end of file From 7106994bf6b40d3be744b0f710a8b5e31fa3afc2 Mon Sep 17 00:00:00 2001 From: th33xitus <31533186+th33xitus@users.noreply.github.com> Date: Mon, 13 Jul 2020 18:14:10 +0200 Subject: [PATCH 10/64] Deactivate backup menu Still WIP, has no function at all at them moment. --- kiauh.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kiauh.sh b/kiauh.sh index 57fdc79..3e8dc21 100644 --- a/kiauh.sh +++ b/kiauh.sh @@ -107,8 +107,10 @@ main_menu(){ break;; 5) clear - backup_menu - break;; + print_header + ERROR_MSG=" Sorry this function is not implemented yet!" + print_error_msg && ERROR_MSG="" + main_ui;; Q|q) exit -1;; *) From 85a9186c78dafbe391048ac631ff90791b5dff13 Mon Sep 17 00:00:00 2001 From: th33xitus <31533186+th33xitus@users.noreply.github.com> Date: Mon, 13 Jul 2020 21:08:31 +0200 Subject: [PATCH 11/64] Add restart functions --- scripts/functions.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/scripts/functions.sh b/scripts/functions.sh index d99cc66..d5aef86 100644 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -21,6 +21,7 @@ start_klipper(){ sudo /etc/init.d/klipper start && sleep 2 && ok_msg "Klipper service started!" fi } + stop_klipper(){ if [ -e /etc/init.d/klipper ]; then status_msg "Stopping klipper service ..." @@ -28,6 +29,13 @@ stop_klipper(){ fi } +restart_klipper(){ + if [ -e /etc/init.d/klipper ]; then + status_msg "Restarting klipper service ..." + sudo /etc/init.d/klipper restart && sleep 2 && ok_msg "Klipper service restarted!" + fi +} + start_moonraker(){ if [ -e /etc/init.d/moonraker ]; then status_msg "Starting moonraker service ..." @@ -42,6 +50,13 @@ stop_moonraker(){ fi } +restart_moonraker(){ + if [ -e /etc/init.d/moonraker ]; then + status_msg "Restarting moonraker service ..." + sudo /etc/init.d/moonraker restart && sleep 2 && ok_msg "Moonraker service restarted!" + fi +} + dep_check(){ for package in "${dep[@]}" do From 2b6abac0c92257bf516ff19df1ba80ffba68eef4 Mon Sep 17 00:00:00 2001 From: th33xitus <31533186+th33xitus@users.noreply.github.com> Date: Mon, 13 Jul 2020 21:09:40 +0200 Subject: [PATCH 12/64] Fix missing function call Fixed a missing function call for creating config entries. Installing mainsail should work now pretty straight forward. --- scripts/install_mainsail.sh | 235 ++++++++++++++++++------------------ 1 file changed, 119 insertions(+), 116 deletions(-) diff --git a/scripts/install_mainsail.sh b/scripts/install_mainsail.sh index fa0447a..3317a64 100644 --- a/scripts/install_mainsail.sh +++ b/scripts/install_mainsail.sh @@ -7,6 +7,9 @@ mainsail_install_routine(){ install_moonraker disable_wrong_webserver remove_wrong_webserver + check_printer_cfg + restart_moonraker + restart_klipper install_nginx test_api test_nginx @@ -39,37 +42,143 @@ install_moonraker(){ case "$yn" in Y|y|Yes|yes|"") switch_to_moonraker && install_moonraker; break;; N|n|No|no) break;; - *) echo "Unknown parameter: $yn"; echo;; esac done fi } check_printer_cfg(){ - if [ ! -e $PRINTER_CFG ]; then - warn_msg "No printer.cfg found" + if [ -e $PRINTER_CFG ]; then + check_vsdcard_section + check_api_section + else + echo; warn_msg "No printer.cfg found!" while true; do echo -e "${cyan}" - read -p "###### Do you want to create a default config? (Y/n): " yn + read -p "###### Do you want to create a default config now? (Y/n): " yn echo -e "${default}" case "$yn" in Y|y|Yes|yes|"") create_default_cfg; break;; N|n|No|no) break;; - *) echo "Unknown parameter: $yn"; echo;; esac done - else - check_vsdcard_section - check_api_section fi } +check_vsdcard_section(){ + # check if virtual sdcard is present in printer.cfg + status_msg "Checking for virtual_sdcard configuration ..." + if [ $(grep '^\[virtual_sdcard\]$' $PRINTER_CFG) ]; then + ok_msg "Virtual sdcard already configured!" + else + status_msg "No virtual sdcard entry found." + status_msg "Configuring virtual sdcard..." +# append the following lines to printer.cfg +cat <> $PRINTER_CFG + +########################## +### CREATED WITH KIAUH ### +########################## +[virtual_sdcard] +path: ~/sdcard +########################## +########################## +VSDCARD + fi +} + +check_api_section(){ + status_msg "Checking for api_server configuration ..." + # check if api server is present in printer.cfg + if [ $(grep '^\[api_server\]$' $PRINTER_CFG) ]; then + ok_msg "API server already configured" + else + status_msg "No API server entry found." + status_msg "Configuring API server..." +# append the following lines to printer.cfg +cat <> $PRINTER_CFG + +########################## +### CREATED WITH KIAUH ### +########################## +[api_server] +trusted_clients: + 192.168.0.0/24 + 192.168.1.0/24 + 127.0.0.0/24 +########################## +########################## +API + fi +} + +create_default_cfg(){ +cat <> $PRINTER_CFG + +########################## +### CREATED WITH KIAUH ### +########################## +[virtual_sdcard] +path: ~/sdcard + +[api_server] +trusted_clients: + 192.168.0.0/24 + 192.168.1.0/24 + 127.0.0.0/24 + +[pause_resume] + +[gcode_macro CANCEL] +default_parameter_X: 230 +default_parameter_Y: 230 +default_parameter_Z: 10 +gcode: + M104 S0 + M140 S0 + M141 S0 + M106 S0 + CLEAR_PAUSE + RESET_SD + +[gcode_macro CANCEL_PRINT] +gcode: + CANCEL + +[gcode_macro PAUSE] +rename_existing: BASE_PAUSE +default_parameter_X: 230 +default_parameter_Y: 230 +default_parameter_Z: 10 +gcode: + SAVE_GCODE_STATE NAME=PAUSE_state + BASE_PAUSE + G91 + G1 E-1.7 F2100 + G1 Z{Z} + G90 + G1 X{X} Y{Y} F6000 + G91 + +[gcode_macro RESUME] +rename_existing: BASE_RESUME +gcode: + G91 + G1 E1.7 F2100 + G91 + RESTORE_GCODE_STATE NAME=PAUSE_state MOVE=1 + BASE_RESUME +########################## +########################## +DEFAULT_CFG +} + disable_wrong_webserver(){ - if systemctl is-active haproxy ; then + if systemctl is-active haproxy -q; then status_msg "Stopping haproxy service ..." sudo /etc/init.d/haproxy stop && ok_msg "Service stopped!" fi - if systemctl is-active lighttpd ; then + if systemctl is-active lighttpd -q; then status_msg "Stopping lighttpd service ..." sudo /etc/init.d/lighttpd stop && ok_msg "Service stopped!" fi @@ -240,110 +349,4 @@ server { } } MAINSAIL_CFG -} - -check_vsdcard_section(){ - # check if virtual sdcard is present in printer.cfg - if [ $(grep '^\[virtual_sdcard\]$' /home/pi/printer.cfg) ]; then - echo "Virtual sdcard already configured" - else - echo "No virtual sdcard entry found..." - echo "Configuring virtual sdcard..." -# append the following lines to printer.cfg -cat <> $PRINTER_CFG - -########################## -### CREATED WITH KIAUH ### -########################## -[virtual_sdcard] -path: ~/sdcard -########################## -########################## -VSDCARD - fi -} - -check_api_section(){ - # check if api server is present in printer.cfg - if [ $(grep '^\[api_server\]$' /home/pi/printer.cfg) ]; then - echo "API server already configured" - else - echo "No API server entry found..." - echo "Configuring API server..." -# append the following lines to printer.cfg -cat <> $PRINTER_CFG - -########################## -### CREATED WITH KIAUH ### -########################## -[api_server] -trusted_clients: - 192.168.0.0/24 - 192.168.1.0/24 - 127.0.0.0/24 -########################## -########################## -API - fi -} - -create_default_cfg(){ -cat <> $PRINTER_CFG - -########################## -### CREATED WITH KIAUH ### -########################## -[virtual_sdcard] -path: ~/sdcard - -[api_server] -trusted_clients: - 192.168.0.0/24 - 192.168.1.0/24 - 127.0.0.0/24 - -[pause_resume] - -[gcode_macro CANCEL] -default_parameter_X: 230 -default_parameter_Y: 230 -default_parameter_Z: 10 -gcode: - M104 S0 - M140 S0 - M141 S0 - M106 S0 - CLEAR_PAUSE - RESET_SD - -[gcode_macro CANCEL_PRINT] -gcode: - CANCEL - -[gcode_macro PAUSE] -rename_existing: BASE_PAUSE -default_parameter_X: 230 -default_parameter_Y: 230 -default_parameter_Z: 10 -gcode: - SAVE_GCODE_STATE NAME=PAUSE_state - BASE_PAUSE - G91 - G1 E-1.7 F2100 - G1 Z{Z} - G90 - G1 X{X} Y{Y} F6000 - G91 - -[gcode_macro RESUME] -rename_existing: BASE_RESUME -gcode: - G91 - G1 E1.7 F2100 - G91 - RESTORE_GCODE_STATE NAME=PAUSE_state MOVE=1 - BASE_RESUME -########################## -########################## -MAINSAIL_CFG } \ No newline at end of file From 2771184e4858accee43df4f8c48cee33852d5372 Mon Sep 17 00:00:00 2001 From: th33xitus <> Date: Wed, 15 Jul 2020 11:17:36 +0200 Subject: [PATCH 13/64] Add abort method if not on moonraker fork --- kiauh.sh | 0 scripts/install_mainsail.sh | 30 ++++++++++++------------------ 2 files changed, 12 insertions(+), 18 deletions(-) mode change 100644 => 100755 kiauh.sh diff --git a/kiauh.sh b/kiauh.sh old mode 100644 new mode 100755 diff --git a/scripts/install_mainsail.sh b/scripts/install_mainsail.sh index 3317a64..89b439e 100644 --- a/scripts/install_mainsail.sh +++ b/scripts/install_mainsail.sh @@ -4,16 +4,18 @@ mainsail_install_routine(){ dep=(wget curl unzip) dep_check #execute operation - install_moonraker disable_wrong_webserver remove_wrong_webserver - check_printer_cfg - restart_moonraker - restart_klipper - install_nginx - test_api - test_nginx - install_mainsail && ok_msg "Mainsail install complete!"; echo + install_moonraker + if [ $ERROR != 1 ]; then + check_printer_cfg + restart_moonraker + restart_klipper + install_nginx + test_api + test_nginx + install_mainsail && ok_msg "Mainsail install complete!"; echo + fi else ERROR_MSG=" Please install Klipper first!\n Skipping..." fi @@ -21,7 +23,7 @@ mainsail_install_routine(){ install_moonraker(){ cd $KLIPPER_DIR - if [[ $(git describe --all) = "remotes/Arksine/work-web_server-20200131" ]]; then + if [[ $(git describe --all) = "remotes/Arksine/work-web_server-20200131" || $(git describe --all) = "remotes/Arksine/dev-moonraker-testing" ]]; then status_msg "Installing Moonraker ..." $KLIPPER_DIR/scripts/install-moonraker.sh && ok_msg "Moonraker successfully installed!" if [ ! -d ${HOME}/sdcard ]; then @@ -35,15 +37,7 @@ install_moonraker(){ else warn_msg "You are not using Arksine/work-web_server-20200131." warn_msg "Please switch to the moonraker fork first!" - while true; do - echo -e "${cyan}" - read -p "###### Do you want to switch to it now? (Y/n): " yn - echo -e "${default}" - case "$yn" in - Y|y|Yes|yes|"") switch_to_moonraker && install_moonraker; break;; - N|n|No|no) break;; - esac - done + ERROR=1 fi } From eea1f5540e3d28d8ed4920ff68a9b5e747031edf Mon Sep 17 00:00:00 2001 From: th33xitus <> Date: Wed, 15 Jul 2020 11:25:16 +0200 Subject: [PATCH 14/64] Better error message --- scripts/install_mainsail.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/install_mainsail.sh b/scripts/install_mainsail.sh index 89b439e..4b93100 100644 --- a/scripts/install_mainsail.sh +++ b/scripts/install_mainsail.sh @@ -35,8 +35,7 @@ install_moonraker(){ ln -s /tmp/moonraker.log ${HOME}/moonraker.log && ok_msg "Symlink created!" fi else - warn_msg "You are not using Arksine/work-web_server-20200131." - warn_msg "Please switch to the moonraker fork first!" + ERROR_MSG=" You are not using a moonraker fork\n Please switch to a moonraker fork first! Aborting ..." ERROR=1 fi } From 21aa2f45e51d0a867f55de410d120ad83fdb5da5 Mon Sep 17 00:00:00 2001 From: th33xitus <> Date: Wed, 15 Jul 2020 11:50:57 +0200 Subject: [PATCH 15/64] Rename mainsail service to moonraker service --- kiauh.sh | 4 ++-- scripts/remove.sh | 4 ++-- scripts/status.sh | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/kiauh.sh b/kiauh.sh index 3e8dc21..826b88d 100755 --- a/kiauh.sh +++ b/kiauh.sh @@ -44,8 +44,8 @@ TORNADO_DIR1=${HOME}/klippy-env/lib/python2.7/site-packages/tornado TORNADO_DIR2=${HOME}/klippy-env/lib/python2.7/site-packages/tornado-5.1.1.dist-info #mainsail/moonraker MAINSAIL_DIR=${HOME}/mainsail -MAINSAIL_SERVICE1=/etc/init.d/moonraker -MAINSAIL_SERVICE2=/etc/default/moonraker +MOONRAKER_SERVICE1=/etc/init.d/moonraker +MOONRAKER_SERVICE2=/etc/default/moonraker #misc BACKUP_DIR=${HOME}/kiauh-backups PRINTER_CFG=${HOME}/printer.cfg diff --git a/scripts/remove.sh b/scripts/remove.sh index fa8ff82..ab4d92c 100644 --- a/scripts/remove.sh +++ b/scripts/remove.sh @@ -58,8 +58,8 @@ remove_dwc2(){ remove_mainsail(){ data_arr=( - $MAINSAIL_SERVICE1 - $MAINSAIL_SERVICE2 + $MOONRAKER_SERVICE1 + $MOONRAKER_SERVICE2 $MAINSAIL_DIR ${HOME}/moonraker.log ${HOME}/.klippy_api_key diff --git a/scripts/status.sh b/scripts/status.sh index 64194fe..be8aae4 100644 --- a/scripts/status.sh +++ b/scripts/status.sh @@ -50,8 +50,8 @@ dwc2_status(){ mainsail_status(){ mcount=0 mainsail_data=( - $MAINSAIL_SERVICE1 - $MAINSAIL_SERVICE2 + $MOONRAKER_SERVICE1 + $MOONRAKER_SERVICE2 $MAINSAIL_DIR #${HOME}/.klippy_api_key #${HOME}/.moonraker_api_key From fe27d054f86eb99a3c5261e769065c5ec6b8aeeb Mon Sep 17 00:00:00 2001 From: th33xitus <> Date: Wed, 15 Jul 2020 18:57:46 +0200 Subject: [PATCH 16/64] Add Octoprint installer/remover --- kiauh.sh | 18 ++++++ scripts/functions.sh | 21 ++++++ scripts/install_octoprint.sh | 121 +++++++++++++++++++++++++++++++++++ scripts/remove.sh | 34 +++++++++- scripts/status.sh | 24 +++++++ scripts/ui.sh | 6 +- 6 files changed, 220 insertions(+), 4 deletions(-) create mode 100755 scripts/install_octoprint.sh diff --git a/kiauh.sh b/kiauh.sh index 826b88d..9db6058 100755 --- a/kiauh.sh +++ b/kiauh.sh @@ -46,6 +46,11 @@ TORNADO_DIR2=${HOME}/klippy-env/lib/python2.7/site-packages/tornado-5.1.1.dist-i MAINSAIL_DIR=${HOME}/mainsail MOONRAKER_SERVICE1=/etc/init.d/moonraker MOONRAKER_SERVICE2=/etc/default/moonraker +#octoprint +OCTOPRINT_DIR=${HOME}/OctoPrint +OCTOPRINT_CFG_DIR=${HOME}/.octoprint +OCTOPRINT_SERVICE1=/etc/init.d/octoprint +OCTOPRINT_SERVICE2=/etc/default/octoprint #misc BACKUP_DIR=${HOME}/kiauh-backups PRINTER_CFG=${HOME}/printer.cfg @@ -78,6 +83,7 @@ main_menu(){ klipper_status dwc2_status mainsail_status + octoprint_status print_branch main_ui while true; do @@ -148,6 +154,12 @@ install_menu(){ mainsail_install_routine print_error_msg && ERROR_MSG="" install_ui;; + 4) + clear + print_header + octoprint_install_routine + print_error_msg && ERROR_MSG="" + install_ui;; Q|q) clear; main_menu; break;; *) @@ -238,6 +250,12 @@ remove_menu(){ remove_mainsail print_error_msg && ERROR_MSG="" remove_ui;; + 4) + clear + print_header + remove_octoprint + print_error_msg && ERROR_MSG="" + remove_ui;; Q|q) clear; main_menu; break;; *) diff --git a/scripts/functions.sh b/scripts/functions.sh index d5aef86..71de49f 100644 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -57,6 +57,27 @@ restart_moonraker(){ fi } +start_octoprint(){ + if [ -e /etc/init.d/octoprint ]; then + status_msg "Starting octoprint service ..." + sudo /etc/init.d/octoprint start && sleep 2 && ok_msg "Octoprint service started!" + fi +} + +stop_octoprint(){ + if [ -e /etc/init.d/octoprint ]; then + status_msg "Stopping octoprint service ..." + sudo /etc/init.d/octoprint stop && sleep 2 && ok_msg "Octoprint service stopped!" + fi +} + +restart_octoprint(){ + if [ -e /etc/init.d/octoprint ]; then + status_msg "Restarting octoprint service ..." + sudo /etc/init.d/octoprint restart && sleep 2 && ok_msg "Octoprint service restarted!" + fi +} + dep_check(){ for package in "${dep[@]}" do diff --git a/scripts/install_octoprint.sh b/scripts/install_octoprint.sh new file mode 100755 index 0000000..1a2b29e --- /dev/null +++ b/scripts/install_octoprint.sh @@ -0,0 +1,121 @@ +octoprint_install_routine(){ + #experimental new dependency check + octoprint_dependencies + #execute operations + install_octoprint + add_groups + configure_autostart + add_reboot_permission + load_server +} + +octoprint_dependencies(){ + octo_dep=( + python-pip + python-dev + python-setuptools + python-virtualenv + git + libyaml-dev + build-essential + wget + ) + status_msg "Checking for dependencies ..." + for octo_dep_pgk in "${octo_dep[@]}" + do + if [[ $(dpkg-query -f'${Status}' --show $octo_dep_pgk 2>/dev/null) = *\ installed ]]; then + install+=($octo_dep_pgk) + fi + done + if ! [ ${#install[@]} -eq 0 ]; then + status_msg "Installing dependencies ..." + sudo apt-get install ${install[@]} -y && ok_msg "Dependencies installed!" + else + ok_msg "All dependencies already met!" + fi +} + +install_octoprint(){ + if [ ! -d $OCTOPRINT_DIR ];then + status_msg "Create Octoprint directory ..." + mkdir -p $OCTOPRINT_DIR && ok_msg "Directory created!" + fi + cd $OCTOPRINT_DIR + #create the virtualenv + status_msg "Set up virtualenv ..." + virtualenv venv + source venv/bin/activate + #install octoprint with pip + status_msg "Download and install octoprint ..." + pip install pip --upgrade + pip install --no-cache-dir octoprint + ok_msg "Download complete!" + #leave virtualenv + deactivate +} + +add_groups(){ + USER=$(whoami) + if [[ ! $(groups | grep tty) ]]; then + status_msg "Adding the current user to group 'tty' ..." + sudo usermod -a -G tty $USER && ok_msg "Done!" + fi + if [[ ! $(groups | grep tty) ]]; then + status_msg "Adding the current user to group 'dialout' ..." + sudo usermod -a -G dialout $USER && ok_msg "Done!" + fi +} + +configure_autostart(){ + USER=$(whoami) + cd $OCTOPRINT_DIR + status_msg "Downloading files ..." + wget https://github.com/foosel/OctoPrint/raw/master/scripts/octoprint.init + wget https://github.com/foosel/OctoPrint/raw/master/scripts/octoprint.default + ok_msg "Files downloaded successfully!" + #make necessary changes in default file + status_msg "Configure octoprint service ..." + DEFAULT_FILE=$OCTOPRINT_DIR/octoprint.default + sed -i "s/pi/$USER/g" $DEFAULT_FILE + sed -i "s/#BASEDIR=/BASEDIR=/" $DEFAULT_FILE + sed -i "s/#CONFIGFILE=/CONFIGFILE=/" $DEFAULT_FILE + sed -i "s/#DAEMON=/DAEMON=/" $DEFAULT_FILE + #move files to correct location + sudo mv octoprint.init $OCTOPRINT_SERVICE1 + sudo mv octoprint.default $OCTOPRINT_SERVICE2 + #make file in init.d executable + sudo chmod +x $OCTOPRINT_SERVICE1 + status_msg "Reload systemd configuration files" + sudo update-rc.d octoprint defaults + sudo systemctl daemon-reload + ok_msg "Configuration complete!" + ok_msg "Octoprint installed!" +} + +add_reboot_permission(){ + USER=$(whoami) + #create a backup when file already exists + if [ -f /etc/sudoers.d/octoprint-shutdown ]; then + sudo mv /etc/sudoers.d/octoprint-shutdown /etc/sudoers.d/octoprint-shutdown.old + fi + #create new permission file + status_msg "Add reboot permission to user '$USER' ..." + cd $OCTOPRINT_DIR + echo "$USER ALL=NOPASSWD: /sbin/shutdown" > octoprint-shutdown + sudo chown 0 octoprint-shutdown + sudo mv octoprint-shutdown /etc/sudoers.d/octoprint-shutdown + ok_msg "Permission set!" + sleep 2 +} + +load_server(){ + start_octoprint + #create an octoprint.log symlink in home-dir just for convenience + if [ ! -e ${HOME}/octoprint.log ]; then + status_msg "Creating octoprint.log symlink ..." + ln -s ${HOME}/.octoprint/logs/octoprint.log ${HOME}/octoprint.log && ok_msg "Symlink created!" + fi + ok_msg "Octoprint is now running on:" + ok_msg "$(hostname -I | cut -d " " -f1):5000 or" + ok_msg "http://localhost:5000"; echo +} \ No newline at end of file diff --git a/scripts/remove.sh b/scripts/remove.sh index ab4d92c..445d5e8 100644 --- a/scripts/remove.sh +++ b/scripts/remove.sh @@ -15,7 +15,7 @@ remove_klipper(){ sudo rm -rf /etc/init.d/klipper /etc/default/klipper && ok_msg "Klipper service removed!" fi if [[ -d $KLIPPER_DIR || -d $KLIPPY_ENV_DIR ]]; then - status_msg "Removing klipper and klippy-env diretory ..." + status_msg "Removing klipper and klippy-env directory ..." rm -rf $KLIPPER_DIR $KLIPPY_ENV_DIR && ok_msg "Directories removed!" fi if [[ -L ${HOME}/klippy.log || -e /tmp/klippy.log ]]; then @@ -142,4 +142,36 @@ remove_nginx(){ esac done fi +} + +remove_octoprint(){ + data_arr=( + $OCTOPRINT_SERVICE1 + $OCTOPRINT_SERVICE2 + $OCTOPRINT_DIR + $OCTOPRINT_CFG_DIR + ${HOME}/octoprint.log + /etc/sudoers.d/octoprint-shutdown + ) + print_error "Octoprint" && data_count=() + if [ "$ERROR_MSG" = "" ]; then + stop_octoprint + if [[ -e $OCTOPRINT_SERVICE1 || -e $OCTOPRINT_SERVICE2 ]]; then + status_msg "Removing octoprint service ..." + sudo update-rc.d -f octoprint remove + sudo rm -rf $OCTOPRINT_SERVICE1 $OCTOPRINT_SERVICE2 && ok_msg "Octoprint service removed!" + fi + if [[ -d $OCTOPRINT_DIR || -d $OCTOPRINT_CFG_DIR ]]; then + status_msg "Removing Octoprint and .octoprint directory ..." + rm -rf $OCTOPRINT_DIR $OCTOPRINT_CFG_DIR && ok_msg "Directories removed!" + fi + if [ -f /etc/sudoers.d/octoprint-shutdown ]; then + sudo rm -rf /etc/sudoers.d/octoprint-shutdown + fi + if [ -L ${HOME}/octoprint.log ]; then + status_msg "Removing octoprint.log symlink ..." + rm -rf ${HOME}/octoprint.log && ok_msg "Symlink removed!" + fi + ok_msg "Octoprint successfully removed!"; echo + fi } \ No newline at end of file diff --git a/scripts/status.sh b/scripts/status.sh index be8aae4..04654fa 100644 --- a/scripts/status.sh +++ b/scripts/status.sh @@ -77,6 +77,30 @@ mainsail_status(){ fi } +octoprint_status(){ + ocount=0 + octoprint_data=( + $OCTOPRINT_DIR + $OCTOPRINT_CFG_DIR + $OCTOPRINT_SERVICE1 + $OCTOPRINT_SERVICE2 + ) + #count+1 for each found data-item from array + for op in "${octoprint_data[@]}" + do + if [ -e $op ]; then + ocount=$(expr $ocount + 1) + fi + done + if [ "$ocount" == "${#octoprint_data[*]}" ]; then + OCTOPRINT_STATUS="${green}Installed!${default} " + elif [ "$ocount" == 0 ]; then + OCTOPRINT_STATUS="${red}Not installed!${default} " + else + OCTOPRINT_STATUS="${yellow}Incomplete!${default} " + fi +} + read_branch(){ if [ -d $KLIPPER_DIR ] && [ -d $KLIPPER_DIR/.git ]; then cd $KLIPPER_DIR diff --git a/scripts/ui.sh b/scripts/ui.sh index 19bb106..e724eb9 100644 --- a/scripts/ui.sh +++ b/scripts/ui.sh @@ -37,7 +37,7 @@ main_ui(){ echo -e "| 2) [Update] | |" echo -e "| 3) [Remove] | DWC2: $DWC2_STATUS|" echo -e "| | Mainsail: $MAINSAIL_STATUS|" - echo -e "| 4) [Advanced] | Octoprint: #### WIP #### |" + echo -e "| 4) [Advanced] | Octoprint: $OCTOPRINT_STATUS|" echo -e "| 5) [Backup] | |" quit_footer } @@ -56,7 +56,7 @@ install_ui(){ echo -e "| Webinterface: | | " echo -e "| 2) [DWC2] | | " echo -e "| 3) [Mainsail] | | " - echo -e "| | | " + echo -e "| 4) [Octoprint] | | " quit_footer } @@ -97,7 +97,7 @@ remove_ui(){ echo -e "| 1) [Klipper] | | " echo -e "| 2) [DWC2-for-Klipper] | | " echo -e "| 3) [Mainsail] | | " - echo -e "| | | " + echo -e "| 4) [Octoprint] | | " quit_footer } From 45fe688f872af62eb3bdb84b71aba47386ea56b8 Mon Sep 17 00:00:00 2001 From: th33xitus <> Date: Wed, 15 Jul 2020 21:41:20 +0200 Subject: [PATCH 17/64] Add Octoprint Service toggle function and a new confirm message --- kiauh.sh | 93 +++++++++++++++++++++++++------------------- scripts/functions.sh | 22 +++++++++++ scripts/ui.sh | 5 ++- 3 files changed, 79 insertions(+), 41 deletions(-) diff --git a/kiauh.sh b/kiauh.sh index 9db6058..4fb5943 100755 --- a/kiauh.sh +++ b/kiauh.sh @@ -66,7 +66,7 @@ BRANCH_DEV_MOONRAKER=Arksine/dev-moonraker-testing BRANCH_SCURVE_SMOOTHING=dmbutyugin/scurve-smoothing BRANCH_SCURVE_SHAPING=dmbutyugin/scurve-shaping -print_error_msg(){ +print_msg(){ if [[ "$ERROR_MSG" != "" ]]; then echo -e "${red}" echo -e "#########################################################" @@ -74,11 +74,18 @@ print_error_msg(){ echo -e "#########################################################" echo -e "${default}" fi + if [ "$CONFIRM_MSG" != "" ]; then + echo -e "${green}" + echo -e "#########################################################" + echo -e "$CONFIRM_MSG " + echo -e "#########################################################" + echo -e "${default}" + fi } main_menu(){ print_header - print_error_msg && ERROR_MSG="" + print_msg && CONFIRM_MSG="" && ERROR_MSG="" #check install status klipper_status dwc2_status @@ -93,7 +100,7 @@ main_menu(){ clear print_header ERROR_MSG=" Sorry this function is not implemented yet!" - print_error_msg && ERROR_MSG="" + print_msg && CONFIRM_MSG="" && ERROR_MSG="" main_ui;; 1) clear @@ -115,7 +122,7 @@ main_menu(){ clear print_header ERROR_MSG=" Sorry this function is not implemented yet!" - print_error_msg && ERROR_MSG="" + print_msg && CONFIRM_MSG="" && ERROR_MSG="" main_ui;; Q|q) exit -1;; @@ -123,7 +130,7 @@ main_menu(){ clear print_header ERROR_MSG=" Unknown command '$action'" - print_error_msg && ERROR_MSG="" + print_msg && CONFIRM_MSG="" && ERROR_MSG="" main_ui;; esac done @@ -140,25 +147,25 @@ install_menu(){ clear print_header install_klipper - print_error_msg && ERROR_MSG="" + print_msg && CONFIRM_MSG="" && ERROR_MSG="" install_ui;; 2) clear print_header dwc2_install_routine - print_error_msg && ERROR_MSG="" + print_msg && CONFIRM_MSG="" && ERROR_MSG="" install_ui;; 3) clear print_header mainsail_install_routine - print_error_msg && ERROR_MSG="" + print_msg && CONFIRM_MSG="" && ERROR_MSG="" install_ui;; 4) clear print_header octoprint_install_routine - print_error_msg && ERROR_MSG="" + print_msg && CONFIRM_MSG="" && ERROR_MSG="" install_ui;; Q|q) clear; main_menu; break;; @@ -166,7 +173,7 @@ install_menu(){ clear print_header ERROR_MSG=" Unknown command '$action'" - print_error_msg && ERROR_MSG="" + print_msg && CONFIRM_MSG="" && ERROR_MSG="" install_ui;; esac done @@ -186,31 +193,31 @@ update_menu(){ clear print_header toggle_backups - print_error_msg && ERROR_MSG="" + print_msg && CONFIRM_MSG="" && ERROR_MSG="" update_ui;; 1) clear print_header update_klipper && ui_print_versions - print_error_msg && ERROR_MSG="" + print_msg && CONFIRM_MSG="" && ERROR_MSG="" update_ui;; 2) clear print_header update_dwc2fk && ui_print_versions - print_error_msg && ERROR_MSG="" + print_msg && CONFIRM_MSG="" && ERROR_MSG="" update_ui;; 3) clear print_header update_dwc2 && ui_print_versions - print_error_msg && ERROR_MSG="" + print_msg && CONFIRM_MSG="" && ERROR_MSG="" update_ui;; 4) clear print_header update_mainsail && ui_print_versions - print_error_msg && ERROR_MSG="" + print_msg && CONFIRM_MSG="" && ERROR_MSG="" update_ui;; Q|q) clear; main_menu; break;; @@ -218,7 +225,7 @@ update_menu(){ clear print_header ERROR_MSG=" Unknown command '$action'" - print_error_msg && ERROR_MSG="" + print_msg && CONFIRM_MSG="" && ERROR_MSG="" ui_print_versions update_ui;; esac @@ -236,25 +243,25 @@ remove_menu(){ clear print_header remove_klipper - print_error_msg && ERROR_MSG="" + print_msg && CONFIRM_MSG="" && ERROR_MSG="" remove_ui;; 2) clear print_header remove_dwc2 - print_error_msg && ERROR_MSG="" + print_msg && CONFIRM_MSG="" && ERROR_MSG="" remove_ui;; 3) clear print_header remove_mainsail - print_error_msg && ERROR_MSG="" + print_msg && CONFIRM_MSG="" && ERROR_MSG="" remove_ui;; 4) clear print_header remove_octoprint - print_error_msg && ERROR_MSG="" + print_msg && CONFIRM_MSG="" && ERROR_MSG="" remove_ui;; Q|q) clear; main_menu; break;; @@ -262,7 +269,7 @@ remove_menu(){ clear print_header ERROR_MSG=" Unknown command '$action'" - print_error_msg && ERROR_MSG="" + print_msg && CONFIRM_MSG="" && ERROR_MSG="" remove_ui;; esac done @@ -271,45 +278,54 @@ remove_menu(){ advanced_menu(){ print_header - print_error_msg && ERROR_MSG="" + print_msg && CONFIRM_MSG="" && ERROR_MSG="" + read_octoprint_service_status advanced_ui while true; do read -p "Perform action: " action; echo case "$action" in + 0) + clear + print_header + toggle_octoprint_service + read_octoprint_service_status + print_msg && CONFIRM_MSG="" && ERROR_MSG="" + advanced_ui;; 1) clear + print_header switch_menu - print_error_msg && ERROR_MSG="" + print_msg && CONFIRM_MSG="" && ERROR_MSG="" advanced_ui;; 2) clear print_header build_fw - print_error_msg && ERROR_MSG="" + print_msg && CONFIRM_MSG="" && ERROR_MSG="" advanced_ui;; 3) clear print_header flash_routine - print_error_msg && ERROR_MSG="" + print_msg && CONFIRM_MSG="" && ERROR_MSG="" advanced_ui;; 4) clear print_header get_usb_id - print_error_msg && ERROR_MSG="" + print_msg && CONFIRM_MSG="" && ERROR_MSG="" advanced_ui;; 5) clear print_header get_usb_id && write_printer_id - print_error_msg && ERROR_MSG="" + print_msg && CONFIRM_MSG="" && ERROR_MSG="" advanced_ui;; 6) clear print_header create_dwc2fk_cfg - print_error_msg && ERROR_MSG="" + print_msg && CONFIRM_MSG="" && ERROR_MSG="" advanced_ui;; Q|q) clear; main_menu; break;; @@ -317,7 +333,7 @@ advanced_menu(){ clear print_header ERROR_MSG=" Unknown command '$action'" - print_error_msg && ERROR_MSG="" + print_msg && CONFIRM_MSG="" && ERROR_MSG="" advanced_ui;; esac done @@ -325,10 +341,9 @@ advanced_menu(){ } switch_menu(){ - print_header if [ -d $KLIPPER_DIR ]; then read_branch - print_error_msg && ERROR_MSG="" + print_msg && CONFIRM_MSG="" && ERROR_MSG="" switch_ui while true; do read -p "Perform action: " action; echo @@ -338,35 +353,35 @@ switch_menu(){ print_header switch_to_origin read_branch - print_error_msg && ERROR_MSG="" + print_msg && CONFIRM_MSG="" && ERROR_MSG="" switch_ui;; 2) clear print_header switch_to_scurve_shaping read_branch - print_error_msg && ERROR_MSG="" + print_msg && CONFIRM_MSG="" && ERROR_MSG="" switch_ui;; 3) clear print_header switch_to_scurve_smoothing read_branch - print_error_msg && ERROR_MSG="" + print_msg && CONFIRM_MSG="" && ERROR_MSG="" switch_ui;; 4) clear print_header switch_to_moonraker read_branch - print_error_msg && ERROR_MSG="" + print_msg && CONFIRM_MSG="" && ERROR_MSG="" switch_ui;; 5) clear print_header switch_to_dev_moonraker read_branch - print_error_msg && ERROR_MSG="" + print_msg && CONFIRM_MSG="" && ERROR_MSG="" switch_ui;; Q|q) clear; advanced_menu; break;; @@ -379,7 +394,7 @@ switch_menu(){ backup_menu(){ print_header - print_error_msg && ERROR_MSG="" + print_msg && CONFIRM_MSG="" && ERROR_MSG="" backup_ui while true; do read -p "Perform action: " action; echo @@ -388,7 +403,7 @@ backup_menu(){ clear print_header #function goes here - print_error_msg && ERROR_MSG="" + print_msg && CONFIRM_MSG="" && ERROR_MSG="" backup_ui;; Q|q) clear; main_menu; break;; @@ -396,7 +411,7 @@ backup_menu(){ clear print_header ERROR_MSG=" Unknown command '$action'" - print_error_msg && ERROR_MSG="" + print_msg && CONFIRM_MSG="" && ERROR_MSG="" backup_ui;; esac done diff --git a/scripts/functions.sh b/scripts/functions.sh index 71de49f..29cf093 100644 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -219,3 +219,25 @@ flash_mcu(){ fi start_klipper } + +toggle_octoprint_service(){ + if systemctl is-enabled octoprint.service -q; then + status_msg "Service is enabled! Disabling now ..." + sudo systemctl stop octoprint && sudo systemctl disable octoprint -q + sleep 2 + CONFIRM_MSG=" Octoprint Service is now >>> DISABLED <<< !" + else + status_msg "Service is disabled! Enabling now ..." + sudo systemctl enable octoprint -q && sudo systemctl start octoprint + sleep 2 + CONFIRM_MSG=" Octoprint Service is now >>> ENABLED <<< !" + fi +} + +read_octoprint_service_status(){ + if ! systemctl is-enabled octoprint.service -q; then + OPRINT_SERVICE_STATUS="${green}[Enable]${default} Octoprint service " + else + OPRINT_SERVICE_STATUS="${red}[Disable]${default} Octoprint service " + fi +} \ No newline at end of file diff --git a/scripts/ui.sh b/scripts/ui.sh index e724eb9..d58308f 100644 --- a/scripts/ui.sh +++ b/scripts/ui.sh @@ -105,6 +105,9 @@ advanced_ui(){ top_border echo -e "| $(title_msg "~~~~~~~~~~~~~ [ Advanced Menu ] ~~~~~~~~~~~~~") | " hr + echo -e "| 0) $OPRINT_SERVICE_STATUS| " + hr + echo -e "| | " echo -e "| 1) [Switch Klipper version] | " echo -e "| | " echo -e "| 2) [Build Firmware] | " @@ -113,8 +116,6 @@ advanced_ui(){ echo -e "| 5) [Write Printer-ID to printer.cfg] | " echo -e "| 6) [Write DWC2-for-klipper config] | " echo -e "| | " - echo -e "| x) [Enable/Disable Octoprint service] | " - echo -e "| | " quit_footer } From 182164af9c82cbad8c443091f04dede7a1d9bcaf Mon Sep 17 00:00:00 2001 From: th33xitus <> Date: Wed, 15 Jul 2020 21:50:40 +0200 Subject: [PATCH 18/64] Small fixes/tweaks --- kiauh.sh | 2 ++ scripts/backup.sh | 6 ++++-- scripts/ui.sh | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/kiauh.sh b/kiauh.sh index 4fb5943..f37af71 100755 --- a/kiauh.sh +++ b/kiauh.sh @@ -52,6 +52,7 @@ OCTOPRINT_CFG_DIR=${HOME}/.octoprint OCTOPRINT_SERVICE1=/etc/init.d/octoprint OCTOPRINT_SERVICE2=/etc/default/octoprint #misc +INI_DIR=${HOME}/kiauh/kiauh.ini BACKUP_DIR=${HOME}/kiauh-backups PRINTER_CFG=${HOME}/printer.cfg @@ -182,6 +183,7 @@ install_menu(){ update_menu(){ print_header + print_msg && CONFIRM_MSG="" && ERROR_MSG="" read_bb4u_stat #compare versions ui_print_versions diff --git a/scripts/backup.sh b/scripts/backup.sh index 3d689e0..d28445d 100644 --- a/scripts/backup.sh +++ b/scripts/backup.sh @@ -24,12 +24,14 @@ read_bb4u_stat(){ toggle_backups(){ source_ini if [ "$backup_before_update" = "true" ]; then - sed -i '/backup_before_update=/s/true/false/' ${HOME}/kiauh2/kiauh.ini + sed -i '/backup_before_update=/s/true/false/' $INI_DIR BB4U_STATUS="${green}[Enable]${default} backups before updating " + CONFIRM_MSG=" Backups before updates are now >>> DISABLED <<< !" fi if [ "$backup_before_update" = "false" ]; then - sed -i '/backup_before_update=/s/false/true/' ${HOME}/kiauh2/kiauh.ini + sed -i '/backup_before_update=/s/false/true/' $INI_DIR BB4U_STATUS="${red}[Disable]${default} backups before updating " + CONFIRM_MSG=" Backups before updates are now >>> ENABLED <<< !" fi } diff --git a/scripts/ui.sh b/scripts/ui.sh index d58308f..8605219 100644 --- a/scripts/ui.sh +++ b/scripts/ui.sh @@ -64,9 +64,9 @@ update_ui(){ top_border echo -e "| $(title_msg "~~~~~~~~~~~~~~ [ Update Menu ] ~~~~~~~~~~~~~~") | " hr - echo -e "| It's a good idea to check the following website | " + echo -e "| It is a good idea to check the following website | " echo -e "| for important software changes to the config file | " - echo -e "| BEFORE updating your klipper installation: | " + echo -e "| >> BEFORE << updating your klipper installation: | " echo -e "| | " echo -e "| ${yellow}https://www.klipper3d.org/Config_Changes.html${default} | " bottom_border From 57d86b9ef40cfc2b27270bb8d46308a7f29a55ce Mon Sep 17 00:00:00 2001 From: th33xitus <> Date: Wed, 15 Jul 2020 22:02:42 +0200 Subject: [PATCH 19/64] Add checks for octoprint service when installing DWC2/Mainsail --- scripts/functions.sh | 16 ++++++++++++---- scripts/install_dwc2.sh | 12 ++++++++---- scripts/install_mainsail.sh | 4 ++++ 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/scripts/functions.sh b/scripts/functions.sh index 29cf093..c4f7b66 100644 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -220,15 +220,23 @@ flash_mcu(){ start_klipper } +enable_octoprint_service(){ + status_msg "Octoprint Service is disabled! Enabling now ..." + sudo systemctl enable octoprint -q && sudo systemctl start octoprint +} + +disable_octoprint_service(){ + status_msg "Octoprint Service is enabled! Disabling now ..." + sudo systemctl stop octoprint && sudo systemctl disable octoprint -q +} + toggle_octoprint_service(){ if systemctl is-enabled octoprint.service -q; then - status_msg "Service is enabled! Disabling now ..." - sudo systemctl stop octoprint && sudo systemctl disable octoprint -q + disable_octoprint_service sleep 2 CONFIRM_MSG=" Octoprint Service is now >>> DISABLED <<< !" else - status_msg "Service is disabled! Enabling now ..." - sudo systemctl enable octoprint -q && sudo systemctl start octoprint + enable_octoprint_service sleep 2 CONFIRM_MSG=" Octoprint Service is now >>> ENABLED <<< !" fi diff --git a/scripts/install_dwc2.sh b/scripts/install_dwc2.sh index 632f166..ca535ed 100644 --- a/scripts/install_dwc2.sh +++ b/scripts/install_dwc2.sh @@ -5,11 +5,15 @@ dwc2_install_routine(){ if [ -d $KLIPPER_DIR ]; then # check for existing installation - if [ -d ${HOME}/klippy-env/lib/python2.7/site-packages/tornado ]; then - ERROR_MSG=" Looks like DWC2 is already installed!\n Skipping..." - return - fi + if [ -d ${HOME}/klippy-env/lib/python2.7/site-packages/tornado ]; then + ERROR_MSG=" Looks like DWC2 is already installed!\n Skipping..." + return + fi stop_klipper + #disable octoprint service if installed + if systemctl is-enabled octoprint.service -q; then + disable_octoprint_service + fi install_tornado install_dwc2fk && dwc2fk_cfg install_dwc2 diff --git a/scripts/install_mainsail.sh b/scripts/install_mainsail.sh index 4b93100..ef977d1 100644 --- a/scripts/install_mainsail.sh +++ b/scripts/install_mainsail.sh @@ -4,6 +4,10 @@ mainsail_install_routine(){ dep=(wget curl unzip) dep_check #execute operation + #disable octoprint service if installed + if systemctl is-enabled octoprint.service -q; then + disable_octoprint_service + fi disable_wrong_webserver remove_wrong_webserver install_moonraker From a5155c50ccc5c6134923981c603bd3228e9ee8ea Mon Sep 17 00:00:00 2001 From: th33xitus <> Date: Wed, 15 Jul 2020 22:52:23 +0200 Subject: [PATCH 20/64] Fixes/Tweaks --- kiauh.sh | 2 +- scripts/functions.sh | 67 +++++++++++++++++------------------- scripts/install_dwc2.sh | 8 ++--- scripts/install_klipper.sh | 9 +++-- scripts/install_mainsail.sh | 8 ++--- scripts/install_octoprint.sh | 16 ++++----- scripts/remove.sh | 52 ++++++++++++++-------------- scripts/ui.sh | 6 ++-- scripts/update.sh | 2 +- 9 files changed, 82 insertions(+), 88 deletions(-) diff --git a/kiauh.sh b/kiauh.sh index f37af71..66cda5e 100755 --- a/kiauh.sh +++ b/kiauh.sh @@ -390,7 +390,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 } diff --git a/scripts/functions.sh b/scripts/functions.sh index c4f7b66..f136a1b 100644 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -17,64 +17,64 @@ source_ini(){ start_klipper(){ if [ -e /etc/init.d/klipper ]; then - status_msg "Starting klipper service ..." - sudo /etc/init.d/klipper start && sleep 2 && ok_msg "Klipper service started!" + status_msg "Starting Klipper Service ..." + sudo /etc/init.d/klipper start && sleep 2 && ok_msg "Klipper Service started!" fi } stop_klipper(){ if [ -e /etc/init.d/klipper ]; then - status_msg "Stopping klipper service ..." - sudo /etc/init.d/klipper stop && sleep 2 && ok_msg "Klipper service stopped!" + status_msg "Stopping Klipper Service ..." + sudo /etc/init.d/klipper stop && sleep 2 && ok_msg "Klipper Service stopped!" fi } restart_klipper(){ if [ -e /etc/init.d/klipper ]; then - status_msg "Restarting klipper service ..." - sudo /etc/init.d/klipper restart && sleep 2 && ok_msg "Klipper service restarted!" + status_msg "Restarting Klipper Service ..." + sudo /etc/init.d/klipper restart && sleep 2 && ok_msg "Klipper Service restarted!" fi } start_moonraker(){ if [ -e /etc/init.d/moonraker ]; then - status_msg "Starting moonraker service ..." - sudo /etc/init.d/moonraker start && sleep 2 && ok_msg "Moonraker service started!" + status_msg "Starting Moonraker Service ..." + sudo /etc/init.d/moonraker start && sleep 2 && ok_msg "Moonraker Service started!" fi } stop_moonraker(){ if [ -e /etc/init.d/moonraker ]; then - status_msg "Stopping moonraker service ..." - sudo /etc/init.d/moonraker stop && sleep 2 && ok_msg "Moonraker service stopped!" + status_msg "Stopping Moonraker Service ..." + sudo /etc/init.d/moonraker stop && sleep 2 && ok_msg "Moonraker Service stopped!" fi } restart_moonraker(){ if [ -e /etc/init.d/moonraker ]; then - status_msg "Restarting moonraker service ..." - sudo /etc/init.d/moonraker restart && sleep 2 && ok_msg "Moonraker service restarted!" + status_msg "Restarting Moonraker Service ..." + sudo /etc/init.d/moonraker restart && sleep 2 && ok_msg "Moonraker Service restarted!" fi } start_octoprint(){ if [ -e /etc/init.d/octoprint ]; then - status_msg "Starting octoprint service ..." - sudo /etc/init.d/octoprint start && sleep 2 && ok_msg "Octoprint service started!" + status_msg "Starting OctoPrint Service ..." + sudo /etc/init.d/octoprint start && sleep 2 && ok_msg "OctoPrint Service started!" fi } stop_octoprint(){ if [ -e /etc/init.d/octoprint ]; then - status_msg "Stopping octoprint service ..." - sudo /etc/init.d/octoprint stop && sleep 2 && ok_msg "Octoprint service stopped!" + status_msg "Stopping OctoPrint Service ..." + sudo /etc/init.d/octoprint stop && sleep 2 && ok_msg "OctoPrint Service stopped!" fi } restart_octoprint(){ if [ -e /etc/init.d/octoprint ]; then - status_msg "Restarting octoprint service ..." - sudo /etc/init.d/octoprint restart && sleep 2 && ok_msg "Octoprint service restarted!" + status_msg "Restarting OctoPrint Service ..." + sudo /etc/init.d/octoprint restart && sleep 2 && ok_msg "OctoPrint Service restarted!" fi } @@ -94,7 +94,6 @@ dep_check(){ sudo apt-get install ${install[@]} -y && ok_msg "Dependencies installed!" break;; N|n|No|no) break;; - *) echo "Unknown parameter: $yn"; echo;; esac done fi @@ -118,22 +117,20 @@ print_error(){ } pkg_check(){ - status_msg "Checking if nginx is installed" - if [[ $(dpkg-query -f'${Status}' --show nginx 2>/dev/null) = *\ installed ]]; then -echo "nginx found!" -else -echo "nginx was not found, installing..." 2>&1 -sudo apt-get -y install nginx 2>/dev/null -fi + #WIP + if [[ $(dpkg-query -f'${Status}' --show $PKG 2>/dev/null) = *\ installed ]]; then + else + sudo apt-get -y install nginx 2>/dev/null + fi } build_fw(){ if [ -d $KLIPPER_DIR ]; then cd $KLIPPER_DIR && make menuconfig - status_msg "Building firmware ..." + status_msg "Building Firmware ..." make clean && make && ok_msg "Firmware built!" else - warn_msg "Can not build firmware without a Klipper directory!" + warn_msg "Can not build Firmware without a Klipper directory!" fi } @@ -186,7 +183,7 @@ PRINTERID flash_routine(){ echo -e "/=================================================\ " - echo -e "| ATTENTION! |" + echo -e "| ${red}~~~~~~~~~~~ [ ATTENTION! ] ~~~~~~~~~~~~${default} |" echo -e "| Flashing a Smoothie based board for the first |" echo -e "| time with this script will certainly fail. |" echo -e "| This applies to boards like the BTT SKR V1.3 or |" @@ -221,12 +218,12 @@ flash_mcu(){ } enable_octoprint_service(){ - status_msg "Octoprint Service is disabled! Enabling now ..." + status_msg "OctoPrint Service is disabled! Enabling now ..." sudo systemctl enable octoprint -q && sudo systemctl start octoprint } disable_octoprint_service(){ - status_msg "Octoprint Service is enabled! Disabling now ..." + status_msg "OctoPrint Service is enabled! Disabling now ..." sudo systemctl stop octoprint && sudo systemctl disable octoprint -q } @@ -234,18 +231,18 @@ toggle_octoprint_service(){ if systemctl is-enabled octoprint.service -q; then disable_octoprint_service sleep 2 - CONFIRM_MSG=" Octoprint Service is now >>> DISABLED <<< !" + CONFIRM_MSG=" OctoPrint Service is now >>> DISABLED <<< !" else enable_octoprint_service sleep 2 - CONFIRM_MSG=" Octoprint Service is now >>> ENABLED <<< !" + CONFIRM_MSG=" OctoPrint Service is now >>> ENABLED <<< !" fi } read_octoprint_service_status(){ if ! systemctl is-enabled octoprint.service -q; then - OPRINT_SERVICE_STATUS="${green}[Enable]${default} Octoprint service " + OPRINT_SERVICE_STATUS="${green}[Enable]${default} OctoPrint Service " else - OPRINT_SERVICE_STATUS="${red}[Disable]${default} Octoprint service " + OPRINT_SERVICE_STATUS="${red}[Disable]${default} OctoPrint Service " fi } \ No newline at end of file diff --git a/scripts/install_dwc2.sh b/scripts/install_dwc2.sh index ca535ed..4e4f65f 100644 --- a/scripts/install_dwc2.sh +++ b/scripts/install_dwc2.sh @@ -37,11 +37,11 @@ install_tornado(){ install_dwc2fk(){ cd ${HOME} - status_msg "Cloning dwc2-for-klipper repository ..." - git clone $DWC2FK_REPO && ok_msg "dwc2-for-klipper successfully cloned!" + status_msg "Cloning DWC2-for-Klipper repository ..." + git clone $DWC2FK_REPO && ok_msg "DWC2-for-Klipper successfully cloned!" #create a web_dwc2.py symlink if not already existing if [ -d $KLIPPER_DIR/klippy/extras ] && [ ! -e $KLIPPER_DIR/klippy/extras/web_dwc2.py ]; then - status_msg "Creating web_dwc2.py symlink ..." + status_msg "Creating web_dwc2.py Symlink ..." ln -s $DWC2FK_DIR/web_dwc2.py $KLIPPER_DIR/klippy/extras/web_dwc2.py && ok_msg "Symlink created!" fi } @@ -54,7 +54,6 @@ dwc2fk_cfg(){ case "$yn" in Y|y|Yes|yes|"") create_dwc2fk_cfg; break;; N|n|No|no) break;; - *) echo "Unknown parameter: $yn"; dwc2fk_cfg;; esac done } @@ -143,7 +142,6 @@ install_dwc2(){ webcam_dep_check && ok_msg "Dependencies installed!" break;; N|n|No|no) break;; - *) echo "Unknown parameter: $yn"; echo;; esac done #the update_dwc2 function does the same as installing dwc2 diff --git a/scripts/install_klipper.sh b/scripts/install_klipper.sh index 6c13945..a158ed6 100644 --- a/scripts/install_klipper.sh +++ b/scripts/install_klipper.sh @@ -1,19 +1,19 @@ install_klipper(){ if [ -e /etc/init.d/klipper ] && [ -e /etc/default/klipper ]; then - ERROR_MSG=" Looks like klipper is already installed!\n Skipping ..." + ERROR_MSG=" Looks like Klipper is already installed!\n Skipping ..." else #check for dependencies dep=(git) dep_check #execute operation cd ${HOME} - status_msg "Cloning klipper repository ..." + status_msg "Cloning Klipper repository ..." git clone $KLIPPER_REPO && ok_msg "Klipper successfully cloned!" - status_msg "Installing klipper service ..." + status_msg "Installing Klipper Service ..." $KLIPPER_DIR/scripts/install-octopi.sh && sleep 2 && ok_msg "Klipper installation complete!" #create a klippy.log symlink in home-dir just for convenience if [ ! -e ${HOME}/klippy.log ]; then - status_msg "Creating klippy.log symlink ..." + status_msg "Creating klippy.log Symlink ..." ln -s /tmp/klippy.log ${HOME}/klippy.log && ok_msg "Symlink created!" fi while true; do @@ -23,7 +23,6 @@ install_klipper(){ case "$yn" in Y|y|Yes|yes|"") build_fw && flash_routine; break;; N|n|No|no) break;; - *) warn_msg "Unknown parameter: $yn"; echo;; esac done fi diff --git a/scripts/install_mainsail.sh b/scripts/install_mainsail.sh index ef977d1..6e65b37 100644 --- a/scripts/install_mainsail.sh +++ b/scripts/install_mainsail.sh @@ -18,7 +18,7 @@ mainsail_install_routine(){ install_nginx test_api test_nginx - install_mainsail && ok_msg "Mainsail install complete!"; echo + install_mainsail && ok_msg "Mainsail installation complete!"; echo fi else ERROR_MSG=" Please install Klipper first!\n Skipping..." @@ -39,7 +39,7 @@ install_moonraker(){ ln -s /tmp/moonraker.log ${HOME}/moonraker.log && ok_msg "Symlink created!" fi else - ERROR_MSG=" You are not using a moonraker fork\n Please switch to a moonraker fork first! Aborting ..." + ERROR_MSG=" You are not using a Moonraker fork\n Please switch to a Moonraker fork first! Aborting ..." ERROR=1 fi } @@ -88,9 +88,9 @@ check_api_section(){ status_msg "Checking for api_server configuration ..." # check if api server is present in printer.cfg if [ $(grep '^\[api_server\]$' $PRINTER_CFG) ]; then - ok_msg "API server already configured" + ok_msg "API Server already configured" else - status_msg "No API server entry found." + status_msg "No API Server entry found." status_msg "Configuring API server..." # append the following lines to printer.cfg cat <> $PRINTER_CFG diff --git a/scripts/install_octoprint.sh b/scripts/install_octoprint.sh index 1a2b29e..e921b59 100755 --- a/scripts/install_octoprint.sh +++ b/scripts/install_octoprint.sh @@ -37,7 +37,7 @@ octoprint_dependencies(){ install_octoprint(){ if [ ! -d $OCTOPRINT_DIR ];then - status_msg "Create Octoprint directory ..." + status_msg "Create OctoPrint directory ..." mkdir -p $OCTOPRINT_DIR && ok_msg "Directory created!" fi cd $OCTOPRINT_DIR @@ -46,7 +46,7 @@ install_octoprint(){ virtualenv venv source venv/bin/activate #install octoprint with pip - status_msg "Download and install octoprint ..." + status_msg "Download and install OctoPrint ..." pip install pip --upgrade pip install --no-cache-dir octoprint ok_msg "Download complete!" @@ -57,11 +57,11 @@ install_octoprint(){ add_groups(){ USER=$(whoami) if [[ ! $(groups | grep tty) ]]; then - status_msg "Adding the current user to group 'tty' ..." + status_msg "Adding user '$USER' to group 'tty' ..." sudo usermod -a -G tty $USER && ok_msg "Done!" fi if [[ ! $(groups | grep tty) ]]; then - status_msg "Adding the current user to group 'dialout' ..." + status_msg "Adding user '$USER' to group 'dialout' ..." sudo usermod -a -G dialout $USER && ok_msg "Done!" fi } @@ -74,7 +74,7 @@ configure_autostart(){ wget https://github.com/foosel/OctoPrint/raw/master/scripts/octoprint.default ok_msg "Files downloaded successfully!" #make necessary changes in default file - status_msg "Configure octoprint service ..." + status_msg "Configure OctoPrint Service ..." DEFAULT_FILE=$OCTOPRINT_DIR/octoprint.default sed -i "s/pi/$USER/g" $DEFAULT_FILE sed -i "s/#BASEDIR=/BASEDIR=/" $DEFAULT_FILE @@ -89,7 +89,7 @@ configure_autostart(){ sudo update-rc.d octoprint defaults sudo systemctl daemon-reload ok_msg "Configuration complete!" - ok_msg "Octoprint installed!" + ok_msg "OctoPrint installed!" } add_reboot_permission(){ @@ -112,10 +112,10 @@ load_server(){ start_octoprint #create an octoprint.log symlink in home-dir just for convenience if [ ! -e ${HOME}/octoprint.log ]; then - status_msg "Creating octoprint.log symlink ..." + status_msg "Creating octoprint.log Symlink ..." ln -s ${HOME}/.octoprint/logs/octoprint.log ${HOME}/octoprint.log && ok_msg "Symlink created!" fi - ok_msg "Octoprint is now running on:" + ok_msg "OctoPrint is now running on:" ok_msg "$(hostname -I | cut -d " " -f1):5000 or" ok_msg "http://localhost:5000"; echo } \ No newline at end of file diff --git a/scripts/remove.sh b/scripts/remove.sh index 445d5e8..213bd55 100644 --- a/scripts/remove.sh +++ b/scripts/remove.sh @@ -10,16 +10,16 @@ remove_klipper(){ if [ "$ERROR_MSG" = "" ]; then stop_klipper if [[ -e /etc/init.d/klipper || -e /etc/default/klipper ]]; then - status_msg "Removing klipper service ..." + status_msg "Removing Klipper Service ..." sudo update-rc.d -f klipper remove - sudo rm -rf /etc/init.d/klipper /etc/default/klipper && ok_msg "Klipper service removed!" + sudo rm -rf /etc/init.d/klipper /etc/default/klipper && ok_msg "Klipper Service removed!" fi if [[ -d $KLIPPER_DIR || -d $KLIPPY_ENV_DIR ]]; then - status_msg "Removing klipper and klippy-env directory ..." + status_msg "Removing Klipper and klippy-env directory ..." rm -rf $KLIPPER_DIR $KLIPPY_ENV_DIR && ok_msg "Directories removed!" fi if [[ -L ${HOME}/klippy.log || -e /tmp/klippy.log ]]; then - status_msg "Removing klippy.log symlink ..." + status_msg "Removing klippy.log Symlink ..." rm -rf ${HOME}/klippy.log /tmp/klippy.log && ok_msg "Symlink removed!" fi ok_msg "Klipper successfully removed!" @@ -37,19 +37,19 @@ remove_dwc2(){ print_error "DWC2-for-Klipper &\n DWC2 Web UI" && data_count=() if [ "$ERROR_MSG" = "" ]; then if [ -d $DWC2FK_DIR ]; then - status_msg "Removing dwc2-for-klipper directory ..." + status_msg "Removing DWC2-for-Klipper directory ..." rm -rf $DWC2FK_DIR && ok_msg "Directory removed!" fi if [ -d $TORNADO_DIR1 ]; then - status_msg "Removing tornado from klippy-env ..." + status_msg "Removing Tornado from klippy-env ..." rm -rf $TORNADO_DIR1 $TORNADO_DIR2 && ok_msg "Tornado removed!" fi if [ -e $WEB_DWC2 ]; then - status_msg "Removing web_dwc2.py symlink from klippy ..." + status_msg "Removing web_dwc2.py Symlink from klippy ..." rm -rf $WEB_DWC2 && ok_msg "File removed!" fi if [ -d $DWC2_DIR ]; then - status_msg "Removing dwc2 directory ..." + status_msg "Removing DWC2 directory ..." rm -rf $DWC2_DIR && ok_msg "Directory removed!" fi ok_msg "DWC2-for-Klipper & DWC2 Web UI successfully removed!" @@ -75,33 +75,33 @@ remove_mainsail(){ stop_moonraker #remove moonraker services if [[ -e /etc/init.d/moonraker || -e /etc/default/moonraker ]]; then - status_msg "Removing moonraker service ..." + status_msg "Removing Moonraker Service ..." sudo update-rc.d -f moonraker remove - sudo rm -rf /etc/init.d/moonraker /etc/default/moonraker && ok_msg "Moonraker service removed!" + sudo rm -rf /etc/init.d/moonraker /etc/default/moonraker && ok_msg "Moonraker Service removed!" fi #remove mainsail dir if [ -d $MAINSAIL_DIR ]; then - status_msg "Removing mainsail directory ..." + status_msg "Removing Mainsail directory ..." rm -rf $MAINSAIL_DIR && ok_msg "Directory removed!" fi #remove moonraker-env if [ -d ${HOME}/moonraker-env ]; then - status_msg "Removing moonraker virtualenv ..." + status_msg "Removing Moonraker virtualenv ..." rm -rf ${HOME}/moonraker-env && ok_msg "Directory removed!" fi #remove moonraker.log symlink if [[ -L ${HOME}/moonraker.log || -e /tmp/moonraker.log ]]; then - status_msg "Removing moonraker.log symlink ..." + status_msg "Removing moonraker.log Symlink ..." rm -rf ${HOME}/moonraker.log /tmp/moonraker.log && ok_msg "Symlink removed!" fi #remove mainsail cfg if [ -e /etc/nginx/sites-available/mainsail ]; then - status_msg "Removing mainsail configuration for nginx ..." + status_msg "Removing Mainsail configuration for Nginx ..." sudo rm /etc/nginx/sites-available/mainsail && ok_msg "File removed!" fi #remove mainsail symlink if [ -L /etc/nginx/sites-enabled/mainsail ]; then - status_msg "Removing mainsail symlink for nginx ..." + status_msg "Removing Mainsail Symlink for Nginx ..." sudo rm /etc/nginx/sites-enabled/mainsail && ok_msg "File removed!" fi #remove legacy api key @@ -124,18 +124,18 @@ remove_nginx(){ if [[ $(dpkg-query -f'${Status}' --show nginx 2>/dev/null) = *\ installed ]] ; then while true; do echo - read -p "Do you want to completely remove (purge) nginx? (Y/n): " yn + read -p "Do you want to completely remove (purge) Nginx? (Y/n): " yn case "$yn" in Y|y|Yes|yes|"") - status_msg "Stopping and removing nginx service ..." + status_msg "Stopping and removing Nginx Service ..." if [ -e /etc/init.d/nginx ]; then - sudo /etc/init.d/nginx stop && ok_msg "Nginx service stopped!" - sudo rm /etc/init.d/nginx && ok_msg "Nginx service removed!" + sudo /etc/init.d/nginx stop && ok_msg "Nginx Service stopped!" + sudo rm /etc/init.d/nginx && ok_msg "Nginx Service removed!" fi if [ -e /etc/default/nginx ]; then sudo rm /etc/default/nginx fi - status_msg "Purging nginx from system ..." + status_msg "Purging Nginx from system ..." sudo apt-get purge nginx nginx-common -y && ok_msg "Nginx removed!" break;; N|n|No|no) break;; @@ -153,25 +153,25 @@ remove_octoprint(){ ${HOME}/octoprint.log /etc/sudoers.d/octoprint-shutdown ) - print_error "Octoprint" && data_count=() + print_error "OctoPrint" && data_count=() if [ "$ERROR_MSG" = "" ]; then stop_octoprint if [[ -e $OCTOPRINT_SERVICE1 || -e $OCTOPRINT_SERVICE2 ]]; then - status_msg "Removing octoprint service ..." + status_msg "Removing OctoPrint Service ..." sudo update-rc.d -f octoprint remove - sudo rm -rf $OCTOPRINT_SERVICE1 $OCTOPRINT_SERVICE2 && ok_msg "Octoprint service removed!" + sudo rm -rf $OCTOPRINT_SERVICE1 $OCTOPRINT_SERVICE2 && ok_msg "OctoPrint Service removed!" fi if [[ -d $OCTOPRINT_DIR || -d $OCTOPRINT_CFG_DIR ]]; then - status_msg "Removing Octoprint and .octoprint directory ..." + status_msg "Removing OctoPrint and .octoprint directory ..." rm -rf $OCTOPRINT_DIR $OCTOPRINT_CFG_DIR && ok_msg "Directories removed!" fi if [ -f /etc/sudoers.d/octoprint-shutdown ]; then sudo rm -rf /etc/sudoers.d/octoprint-shutdown fi if [ -L ${HOME}/octoprint.log ]; then - status_msg "Removing octoprint.log symlink ..." + status_msg "Removing octoprint.log Symlink ..." rm -rf ${HOME}/octoprint.log && ok_msg "Symlink removed!" fi - ok_msg "Octoprint successfully removed!"; echo + ok_msg "OctoPrint successfully removed!"; echo fi } \ No newline at end of file diff --git a/scripts/ui.sh b/scripts/ui.sh index 8605219..5f2c963 100644 --- a/scripts/ui.sh +++ b/scripts/ui.sh @@ -91,7 +91,7 @@ remove_ui(){ hr echo -e "| Files and directories which remain untouched: | " echo -e "| --> ~/printer.cfg | " - echo -e "| --> ~/backup | " + echo -e "| --> ~/kiauh-backups | " echo -e "| You need remove them manually if you wish so. | " hr echo -e "| 1) [Klipper] | | " @@ -114,7 +114,7 @@ advanced_ui(){ echo -e "| 3) [Flash MCU] | " echo -e "| 4) [Get Printer-ID] | " echo -e "| 5) [Write Printer-ID to printer.cfg] | " - echo -e "| 6) [Write DWC2-for-klipper config] | " + echo -e "| 6) [Write DWC2-for-Klipper config] | " echo -e "| | " quit_footer } @@ -141,7 +141,7 @@ switch_ui(){ echo -e "| $(title_msg "~~~~~~~~~ [ Switch Klipper Branch ] ~~~~~~~~~") |" bottom_border echo - echo -e " $(title_msg "Active branch: ")${green}$GET_BRANCH${default}" + echo -e " $(title_msg "Active Branch: ")${green}$GET_BRANCH${default}" echo top_border echo -e "| 1) [--> origin/master] | " diff --git a/scripts/update.sh b/scripts/update.sh index 3239f2a..73f92ff 100644 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -40,7 +40,7 @@ update_dwc2fk(){ cd $DWC2FK_DIR && git pull #create a web_dwc2.py symlink if not already existing if [ -d $KLIPPER_DIR/klippy/extras ] && [ ! -e $WEB_DWC2 ]; then - status_msg "Creating web_dwc2.py symlink ..." + status_msg "Creating web_dwc2.py Symlink ..." ln -s $DWC2FK_DIR/web_dwc2.py $WEB_DWC2 && ok_msg "Symlink created!" fi fi From 1551920fe3c10146a06f7c4a22542bfe3b8b3fdc Mon Sep 17 00:00:00 2001 From: th33xitus <31533186+th33xitus@users.noreply.github.com> Date: Wed, 15 Jul 2020 23:33:20 +0200 Subject: [PATCH 21/64] Update README.md --- README.md | 40 +++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 48aefa4..389815f 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,8 @@ [![kiauh](https://abload.de/img/mobaxterm_personal_207mk20.png)](https://abload.de/image.php?img=mobaxterm_personal_207mk20.png) This script was actually created for my personal use only but i then decided to make the script accessible for everyone. -It is meant to help guiding you through a complete fresh install of Klipper and optionally the DWC2 web UI + DWC2-for-Klipper. -There are also functions for updating your current installations or removing them from your system. +~~It is meant to help guiding you through a complete fresh install of Klipper and optionally the DWC2 web UI + DWC2-for-Klipper. +There are also functions for updating your current installations or removing them from your system.~~ ## First things first: When you decide to use this script, you use it at your own risk! @@ -17,6 +17,7 @@ Give it a try if you want and if you have suggestions or encounter any problems, ## Instructions: In order to run this script you have to make it executable. Use the following commands in the given order to download and execute the script. +Make sure you don't skip checking out the development branch if you want to use this new version of the script. ``` cd ~ @@ -31,16 +32,45 @@ chmod +x ~/kiauh/scripts/* * Tested only on Raspbian Buster Lite ## Functions and Features: -Soon™ +- Installing: + - Klipper + - dwc2-for-klipper + Duet Web Control + - Moonraker + Mainsail + - OctoPrint +- Updating: + - Klipper + - dwc2-for-klipper + Duet Web Control + - Moonraker + Mainsail +- Removing: + - Klipper + - dwc2-for-klipper + Duet Web Control + - Moonraker + Mainsail + - OctoPrint + +- Build Klipper Firmware +- Flash MCU +- Read ID of currently connected printer +- Write several entries to your printer.cfg, some of them customizable right in the console +- Switch between Klipper Forks: + - scurve-shaping + - scurve-smoothing + - moonraker +- Toggle auto-create backups before updating +- Toggle OctoPrint Service (usefull when using DWC2/Mainsail and Octoprint at the same time) + +tbc ... + +## What this script can't do: +- Updating OctoPrint. Use OctoPrint for updating! ## Q&A __*Q: Can i install octoprint with this script?*__ -**A:** Soon™ +**A:** ~~Soon™~~ Yes :) __*Q: Can i use this script to install multiple instancec of Klipper on the same Pi? (Multisession?)*__ - **A:** No, and at the moment i don't plan to implement this function. For multisession installations take a look at this script manu7irl created: https://github.com/manu7irl/klipper-DWC2-installer + **A:** No, and at the moment i don't plan to implement this function. For multisession installations take a look at this script manu7irl created: https://github.com/manu7irl/klipper-DWC2-installer . Keep in mind that klipper-DWC2-installer and KIAUH are **NOT** compatible with each other. From 8c0e231adeeea458bf83fd5ab7b9df03505cca5c Mon Sep 17 00:00:00 2001 From: th33xitus <> Date: Thu, 16 Jul 2020 15:07:00 +0200 Subject: [PATCH 22/64] some "debloating" --- resources/mainsail_nginx.cfg | 82 +++++++++++++++++++++++++++++++ scripts/install_mainsail.sh | 95 ++---------------------------------- 2 files changed, 86 insertions(+), 91 deletions(-) create mode 100644 resources/mainsail_nginx.cfg diff --git a/resources/mainsail_nginx.cfg b/resources/mainsail_nginx.cfg new file mode 100644 index 0000000..faf55d5 --- /dev/null +++ b/resources/mainsail_nginx.cfg @@ -0,0 +1,82 @@ +map $http_upgrade $connection_upgrade { + default upgrade; + '' close; +} + +upstream apiserver { + #edit your api port here + ip_hash; + server 127.0.0.1:7125; +} + +server { + listen 80 default_server; + listen [::]:80 default_server; + + access_log /var/log/nginx/mainsail-access.log; + error_log /var/log/nginx/mainsail-error.log; + + #web_path from mainsail static files + root /home/pi/mainsail; + + index index.html; + server_name _; + + #max upload size for gcodes + client_max_body_size 200M; + + location / { + try_files $uri $uri/ /index.html; + } + + location /printer { + proxy_pass http://apiserver/printer; + proxy_set_header Host $http_host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Scheme $scheme; + } + + location /api { + proxy_pass http://apiserver/api; + proxy_set_header Host $http_host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Scheme $scheme; + } + + location /access { + proxy_pass http://apiserver/access; + proxy_set_header Host $http_host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Scheme $scheme; + } + + location /websocket { + proxy_pass http://apiserver/websocket; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection $connection_upgrade; + proxy_set_header Host $http_host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_read_timeout 86400; + } + + location /machine { + proxy_pass http://apiserver/machine; + proxy_set_header Host $http_host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Scheme $scheme; + } + + location /server { + proxy_pass http://apiserver/server; + proxy_set_header Host $http_host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Scheme $scheme; + } +} \ No newline at end of file diff --git a/scripts/install_mainsail.sh b/scripts/install_mainsail.sh index 6e65b37..f815a3c 100644 --- a/scripts/install_mainsail.sh +++ b/scripts/install_mainsail.sh @@ -15,7 +15,7 @@ mainsail_install_routine(){ check_printer_cfg restart_moonraker restart_klipper - install_nginx + config_nginx_mainsail test_api test_nginx install_mainsail && ok_msg "Mainsail installation complete!"; echo @@ -194,7 +194,7 @@ remove_wrong_webserver(){ fi } -install_nginx(){ +config_nginx_mainsail(){ if ! [[ $(dpkg-query -f'${Status}' --show nginx 2>/dev/null) = *\ installed ]]; then status_msg "Installing Nginx ..." sudo apt-get install nginx -y && ok_msg "Nginx successfully installed!" @@ -202,8 +202,8 @@ install_nginx(){ if [ ! -d $MAINSAIL_DIR ]; then mkdir $MAINSAIL_DIR fi - status_msg "Configure Nginx ..." - create_mainsail_cfgfile && sudo mv $MAINSAIL_DIR/mainsail /etc/nginx/sites-available/ + status_msg "Create Nginx configuration ..." + sudo cat ${HOME}/kiauh/resources/mainsail_nginx.cfg > /etc/nginx/sites-available/mainsail if [ -e /etc/nginx/sites-enabled/default ]; then sudo rm /etc/nginx/sites-enabled/default fi @@ -259,91 +259,4 @@ install_mainsail(){ wget -q -O mainsail.zip $MAINSAIL_URL && status_msg "Extracting archive ..." && unzip -o mainsail.zip && rm mainsail.zip ### write mainsail version to file for update check reasons echo "$MAINSAIL_VERSION" > $MAINSAIL_DIR/version -} - -create_mainsail_cfgfile(){ - cat < $MAINSAIL_DIR/mainsail -map \$http_upgrade \$connection_upgrade { - default upgrade; - '' close; -} - -upstream apiserver { - #edit your api port here - ip_hash; - server 127.0.0.1:7125; -} - -server { - listen 80 default_server; - listen [::]:80 default_server; - - access_log /var/log/nginx/mainsail-access.log; - error_log /var/log/nginx/mainsail-error.log; - - #web_path from mainsail static files - root /home/pi/mainsail; - - index index.html; - server_name _; - - #max upload size for gcodes - client_max_body_size 200M; - - location / { - try_files \$uri \$uri/ /index.html; - } - - location /printer { - proxy_pass http://apiserver/printer; - proxy_set_header Host \$http_host; - proxy_set_header X-Real-IP \$remote_addr; - proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; - proxy_set_header X-Scheme \$scheme; - } - - location /api { - proxy_pass http://apiserver/api; - proxy_set_header Host \$http_host; - proxy_set_header X-Real-IP \$remote_addr; - proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; - proxy_set_header X-Scheme \$scheme; - } - - location /access { - proxy_pass http://apiserver/access; - proxy_set_header Host \$http_host; - proxy_set_header X-Real-IP \$remote_addr; - proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; - proxy_set_header X-Scheme \$scheme; - } - - location /websocket { - proxy_pass http://apiserver/websocket; - proxy_http_version 1.1; - proxy_set_header Upgrade \$http_upgrade; - proxy_set_header Connection \$connection_upgrade; - proxy_set_header Host \$http_host; - proxy_set_header X-Real-IP \$remote_addr; - proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; - proxy_read_timeout 86400; - } - - location /machine { - proxy_pass http://apiserver/machine; - proxy_set_header Host \$http_host; - proxy_set_header X-Real-IP \$remote_addr; - proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; - proxy_set_header X-Scheme \$scheme; - } - - location /server { - proxy_pass http://apiserver/server; - proxy_set_header Host \$http_host; - proxy_set_header X-Real-IP \$remote_addr; - proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; - proxy_set_header X-Scheme \$scheme; - } -} -MAINSAIL_CFG } \ No newline at end of file From 1be6cd0a3d579db9fcbfdab9ae31d4d655ed95cc Mon Sep 17 00:00:00 2001 From: th33xitus <> Date: Thu, 16 Jul 2020 15:09:28 +0200 Subject: [PATCH 23/64] remove nginx-purge option --- scripts/remove.sh | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/scripts/remove.sh b/scripts/remove.sh index 213bd55..fd6cdf1 100644 --- a/scripts/remove.sh +++ b/scripts/remove.sh @@ -67,8 +67,6 @@ remove_mainsail(){ ${HOME}/moonraker-env /etc/nginx/sites-available/mainsail /etc/nginx/sites-enabled/mainsail - /etc/init.d/nginx - /etc/default/nginx ) print_error "Mainsail" && data_count=() if [ "$ERROR_MSG" = "" ]; then @@ -114,36 +112,10 @@ remove_mainsail(){ status_msg "Removing API Key ..." rm ${HOME}/.moonraker_api_key && ok_msg "Done!" fi - remove_nginx ok_msg "Mainsail successfully removed!" fi } -remove_nginx(){ - #ask for complete removal of nginx if installed - if [[ $(dpkg-query -f'${Status}' --show nginx 2>/dev/null) = *\ installed ]] ; then - while true; do - echo - read -p "Do you want to completely remove (purge) Nginx? (Y/n): " yn - case "$yn" in - Y|y|Yes|yes|"") - status_msg "Stopping and removing Nginx Service ..." - if [ -e /etc/init.d/nginx ]; then - sudo /etc/init.d/nginx stop && ok_msg "Nginx Service stopped!" - sudo rm /etc/init.d/nginx && ok_msg "Nginx Service removed!" - fi - if [ -e /etc/default/nginx ]; then - sudo rm /etc/default/nginx - fi - status_msg "Purging Nginx from system ..." - sudo apt-get purge nginx nginx-common -y && ok_msg "Nginx removed!" - break;; - N|n|No|no) break;; - esac - done - fi -} - remove_octoprint(){ data_arr=( $OCTOPRINT_SERVICE1 From ba53517f0970f1632981bc1fe73f838f6966f2df Mon Sep 17 00:00:00 2001 From: th33xitus <> Date: Thu, 16 Jul 2020 15:14:23 +0200 Subject: [PATCH 24/64] fix breaking stuff --- scripts/functions.sh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/scripts/functions.sh b/scripts/functions.sh index f136a1b..d7b3079 100644 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -116,13 +116,14 @@ print_error(){ fi } -pkg_check(){ - #WIP - if [[ $(dpkg-query -f'${Status}' --show $PKG 2>/dev/null) = *\ installed ]]; then - else - sudo apt-get -y install nginx 2>/dev/null - fi -} +#pkg_check(){ +# #WIP +# if [[ $(dpkg-query -f'${Status}' --show $PKG 2>/dev/null) = *\ installed ]]; then +# echo "WIP" +# else +# sudo apt-get -y install $PKG 2>/dev/null +# fi +#} build_fw(){ if [ -d $KLIPPER_DIR ]; then From fd71b0ee62558b2333048bf3842470f4f8dc6ec3 Mon Sep 17 00:00:00 2001 From: th33xitus <> Date: Thu, 16 Jul 2020 15:54:57 +0200 Subject: [PATCH 25/64] Fixes/Tweaks --- kiauh.sh | 12 ++++++------ scripts/remove.sh | 8 ++++---- scripts/status.sh | 2 -- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/kiauh.sh b/kiauh.sh index 66cda5e..bc9a8eb 100755 --- a/kiauh.sh +++ b/kiauh.sh @@ -130,7 +130,7 @@ main_menu(){ *) clear print_header - ERROR_MSG=" Unknown command '$action'" + ERROR_MSG=" Sorry, i don't know that command!" print_msg && CONFIRM_MSG="" && ERROR_MSG="" main_ui;; esac @@ -173,7 +173,7 @@ install_menu(){ *) clear print_header - ERROR_MSG=" Unknown command '$action'" + ERROR_MSG=" Sorry, i don't know that command!" print_msg && CONFIRM_MSG="" && ERROR_MSG="" install_ui;; esac @@ -226,7 +226,7 @@ update_menu(){ *) clear print_header - ERROR_MSG=" Unknown command '$action'" + ERROR_MSG=" Sorry, i don't know that command!" print_msg && CONFIRM_MSG="" && ERROR_MSG="" ui_print_versions update_ui;; @@ -270,7 +270,7 @@ remove_menu(){ *) clear print_header - ERROR_MSG=" Unknown command '$action'" + ERROR_MSG=" Sorry, i don't know that command!" print_msg && CONFIRM_MSG="" && ERROR_MSG="" remove_ui;; esac @@ -334,7 +334,7 @@ advanced_menu(){ *) clear print_header - ERROR_MSG=" Unknown command '$action'" + ERROR_MSG=" Sorry, i don't know that command!" print_msg && CONFIRM_MSG="" && ERROR_MSG="" advanced_ui;; esac @@ -412,7 +412,7 @@ backup_menu(){ *) clear print_header - ERROR_MSG=" Unknown command '$action'" + ERROR_MSG=" Sorry, i don't know that command!" print_msg && CONFIRM_MSG="" && ERROR_MSG="" backup_ui;; esac diff --git a/scripts/remove.sh b/scripts/remove.sh index fd6cdf1..6404a3c 100644 --- a/scripts/remove.sh +++ b/scripts/remove.sh @@ -22,7 +22,7 @@ remove_klipper(){ status_msg "Removing klippy.log Symlink ..." rm -rf ${HOME}/klippy.log /tmp/klippy.log && ok_msg "Symlink removed!" fi - ok_msg "Klipper successfully removed!" + CONFIRM_MSG=" Klipper successfully removed!" fi } @@ -52,7 +52,7 @@ remove_dwc2(){ status_msg "Removing DWC2 directory ..." rm -rf $DWC2_DIR && ok_msg "Directory removed!" fi - ok_msg "DWC2-for-Klipper & DWC2 Web UI successfully removed!" + CONFIRM_MSG=" DWC2-for-Klipper & DWC2 Web UI successfully removed!" fi } @@ -112,7 +112,7 @@ remove_mainsail(){ status_msg "Removing API Key ..." rm ${HOME}/.moonraker_api_key && ok_msg "Done!" fi - ok_msg "Mainsail successfully removed!" + CONFIRM_MSG=" Mainsail successfully removed!" fi } @@ -144,6 +144,6 @@ remove_octoprint(){ status_msg "Removing octoprint.log Symlink ..." rm -rf ${HOME}/octoprint.log && ok_msg "Symlink removed!" fi - ok_msg "OctoPrint successfully removed!"; echo + CONFIRM_MSG=" OctoPrint successfully removed!" fi } \ No newline at end of file diff --git a/scripts/status.sh b/scripts/status.sh index 04654fa..aeb28d5 100644 --- a/scripts/status.sh +++ b/scripts/status.sh @@ -58,8 +58,6 @@ mainsail_status(){ #${HOME}/moonraker-env /etc/nginx/sites-available/mainsail /etc/nginx/sites-enabled/mainsail - /etc/init.d/nginx - /etc/default/nginx ) #count+1 for each found data-item from array for md in "${mainsail_data[@]}" From d19c4d33cbf99fbb4a2a89796e17431c8b2016c1 Mon Sep 17 00:00:00 2001 From: th33xitus <> Date: Thu, 16 Jul 2020 16:33:44 +0200 Subject: [PATCH 26/64] Fix OctoPrint toggle function --- scripts/functions.sh | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/scripts/functions.sh b/scripts/functions.sh index d7b3079..f9919af 100644 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -229,14 +229,18 @@ disable_octoprint_service(){ } toggle_octoprint_service(){ - if systemctl is-enabled octoprint.service -q; then - disable_octoprint_service - sleep 2 - CONFIRM_MSG=" OctoPrint Service is now >>> DISABLED <<< !" + if [[ -f $OCTOPRINT_SERVICE1 && -f $OCTOPRINT_SERVICE2 ]]; then + if systemctl is-enabled octoprint.service -q; then + disable_octoprint_service + sleep 2 + CONFIRM_MSG=" OctoPrint Service is now >>> DISABLED <<< !" + else + enable_octoprint_service + sleep 2 + CONFIRM_MSG=" OctoPrint Service is now >>> ENABLED <<< !" + fi else - enable_octoprint_service - sleep 2 - CONFIRM_MSG=" OctoPrint Service is now >>> ENABLED <<< !" + ERROR_MSG=" You cannot activate a service that does not exist!" fi } From 1cc94d4874fb39f80063a5e2d0efcd643c11e20d Mon Sep 17 00:00:00 2001 From: th33xitus <> Date: Thu, 16 Jul 2020 17:01:57 +0200 Subject: [PATCH 27/64] Fix bugs --- scripts/functions.sh | 14 +++++++++----- scripts/install_mainsail.sh | 9 ++++----- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/scripts/functions.sh b/scripts/functions.sh index f9919af..3886f3f 100644 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -219,13 +219,17 @@ flash_mcu(){ } enable_octoprint_service(){ - status_msg "OctoPrint Service is disabled! Enabling now ..." - sudo systemctl enable octoprint -q && sudo systemctl start octoprint + if [[ -f $OCTOPRINT_SERVICE1 && -f $OCTOPRINT_SERVICE2 ]]; then + status_msg "OctoPrint Service is disabled! Enabling now ..." + sudo systemctl enable octoprint -q && sudo systemctl start octoprint + fi } disable_octoprint_service(){ - status_msg "OctoPrint Service is enabled! Disabling now ..." - sudo systemctl stop octoprint && sudo systemctl disable octoprint -q + if [[ -f $OCTOPRINT_SERVICE1 && -f $OCTOPRINT_SERVICE2 ]]; then + status_msg "OctoPrint Service is enabled! Disabling now ..." + sudo systemctl stop octoprint && sudo systemctl disable octoprint -q + fi } toggle_octoprint_service(){ @@ -245,7 +249,7 @@ toggle_octoprint_service(){ } read_octoprint_service_status(){ - if ! systemctl is-enabled octoprint.service -q; then + if ! systemctl is-enabled octoprint.service -q &>/dev/null; then OPRINT_SERVICE_STATUS="${green}[Enable]${default} OctoPrint Service " else OPRINT_SERVICE_STATUS="${red}[Disable]${default} OctoPrint Service " diff --git a/scripts/install_mainsail.sh b/scripts/install_mainsail.sh index f815a3c..e59233c 100644 --- a/scripts/install_mainsail.sh +++ b/scripts/install_mainsail.sh @@ -5,13 +5,11 @@ mainsail_install_routine(){ dep_check #execute operation #disable octoprint service if installed - if systemctl is-enabled octoprint.service -q; then - disable_octoprint_service - fi + disable_octoprint_service disable_wrong_webserver remove_wrong_webserver install_moonraker - if [ $ERROR != 1 ]; then + if [ "$ERROR" != 1 ]; then check_printer_cfg restart_moonraker restart_klipper @@ -203,7 +201,8 @@ config_nginx_mainsail(){ mkdir $MAINSAIL_DIR fi status_msg "Create Nginx configuration ..." - sudo cat ${HOME}/kiauh/resources/mainsail_nginx.cfg > /etc/nginx/sites-available/mainsail + cat ${HOME}/kiauh/resources/mainsail_nginx.cfg > ${HOME}/kiauh/resources/mainsail + sudo mv ${HOME}/kiauh/resources/mainsail /etc/nginx/sites-available/mainsail if [ -e /etc/nginx/sites-enabled/default ]; then sudo rm /etc/nginx/sites-enabled/default fi From e4cfad41624040c2f32ee66bdfbb71e1f216bf6d Mon Sep 17 00:00:00 2001 From: th33xitus <> Date: Sat, 18 Jul 2020 18:33:55 +0200 Subject: [PATCH 28/64] new function: allow hostname to be set --- scripts/functions.sh | 75 +++++++++++++++++++++++++++++++++++++ scripts/install_mainsail.sh | 16 +++++--- 2 files changed, 86 insertions(+), 5 deletions(-) diff --git a/scripts/functions.sh b/scripts/functions.sh index 3886f3f..ac8ad21 100644 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -254,4 +254,79 @@ read_octoprint_service_status(){ else OPRINT_SERVICE_STATUS="${red}[Disable]${default} OctoPrint Service " fi +} + +create_custom_hostname(){ + echo + top_border + echo -e "| You can change the hostname of this machine to use |" + echo -e "| that name to open the Interface in your browser. |" + echo -e "| This option is completely optional and can also be |" + echo -e "| done at a later point in time if you are unsure. |" + echo -e "| |" + echo -e "| Example: If you set the hostname to 'my-printer' |" + echo -e "| you can open Mainsail by browsing to: |" + echo -e "| http://my-printer.local |" + bottom_border + while true; do + echo -e "${cyan}" + read -p "###### Do you want to change the hostname? (Y/n): " yn + echo -e "${default}" + case "$yn" in + Y|y|Yes|yes|"") set_hostname; break;; + N|n|No|no) break;; + esac + done +} + +set_hostname(){ + #check for existing avahi installation + status_msg "Checking for necessary Avahi installation ..." + if ! [[ $(dpkg-query -f'${Status}' --show avahi-daemon 2>/dev/null) = *\ installed ]]; then + status_msg "Installing Avahi ..." + sudo apt-get install avahi-daemon -y && ok_msg "Avahi successfully installed!" + fi + ok_msg "Avahi found!" + #get current hostname and write to variable + HOSTNAME=$(hostname) + #create host file if missing or create backup of existing one with current date&time + if [ -f /etc/hosts ]; then + status_msg "Creating backup of hosts file ..." + get_date + sudo cp /etc/hosts /etc/hosts."$current_date".bak + ok_msg "Backup done!" + ok_msg "File:'/etc/hosts."$current_date".bak'" + else + sudo touch /etc/hosts + fi + echo + top_border + echo -e "| ${green}Allowed characters: a-z, 0-9 and single '-'${default} |" + echo -e "| ${red}No special characters allowed!${default} |" + echo -e "| ${red}No leading or trailing '-' allowed!${default} |" + bottom_border + while true; do + echo -e "${cyan}" + read -p "###### Please set the new hostname: " NEW_HOSTNAME + echo -e "${default}" + if [[ $NEW_HOSTNAME =~ ^[^\-]+([0-9a-z]\-{0,1})+[^\-]+$ ]]; then + ok_msg "'$NEW_HOSTNAME' is a valid hostname!" + #set hostname in /etc/hostname + status_msg "Setting hostname to '$NEW_HOSTNAME' ..." + status_msg "Please wait ..." + sudo hostnamectl set-hostname $NEW_HOSTNAME + #write new hostname to /etc/hosts + status_msg "Writing new hostname to /etc/hosts ..." + if cat /etc/hosts | grep "###set by kiauh" &>/dev/null; then + sudo sed -i "/###set by kiauh/s/\<$HOSTNAME\>/$NEW_HOSTNAME/" /etc/hosts + else + echo "127.0.0.1 $NEW_HOSTNAME ###set by kiauh" | sudo tee -a /etc/hosts &>/dev/null + fi + ok_msg "New hostname successfully configured!" + ok_msg "You need to reboot your machine for changes to take effect!" + break + else + warn_msg "'$NEW_HOSTNAME' is not a valid hostname!" + fi + done } \ No newline at end of file diff --git a/scripts/install_mainsail.sh b/scripts/install_mainsail.sh index e59233c..66ebbe5 100644 --- a/scripts/install_mainsail.sh +++ b/scripts/install_mainsail.sh @@ -6,8 +6,8 @@ mainsail_install_routine(){ #execute operation #disable octoprint service if installed disable_octoprint_service - disable_wrong_webserver - remove_wrong_webserver + disable_haproxy_lighttpd + remove_haproxy_lighttpd install_moonraker if [ "$ERROR" != 1 ]; then check_printer_cfg @@ -16,7 +16,9 @@ mainsail_install_routine(){ config_nginx_mainsail test_api test_nginx - install_mainsail && ok_msg "Mainsail installation complete!"; echo + install_mainsail + create_custom_hostname + ok_msg "Mainsail installation complete!"; echo fi else ERROR_MSG=" Please install Klipper first!\n Skipping..." @@ -168,7 +170,7 @@ gcode: DEFAULT_CFG } -disable_wrong_webserver(){ +disable_haproxy_lighttpd(){ if systemctl is-active haproxy -q; then status_msg "Stopping haproxy service ..." sudo /etc/init.d/haproxy stop && ok_msg "Service stopped!" @@ -179,7 +181,7 @@ disable_wrong_webserver(){ fi } -remove_wrong_webserver(){ +remove_haproxy_lighttpd(){ rem=(haproxy lighttpd) for remove in "${rem[@]}" do @@ -193,6 +195,7 @@ remove_wrong_webserver(){ } config_nginx_mainsail(){ + USER=$(whoami) if ! [[ $(dpkg-query -f'${Status}' --show nginx 2>/dev/null) = *\ installed ]]; then status_msg "Installing Nginx ..." sudo apt-get install nginx -y && ok_msg "Nginx successfully installed!" @@ -203,6 +206,8 @@ config_nginx_mainsail(){ status_msg "Create Nginx configuration ..." cat ${HOME}/kiauh/resources/mainsail_nginx.cfg > ${HOME}/kiauh/resources/mainsail sudo mv ${HOME}/kiauh/resources/mainsail /etc/nginx/sites-available/mainsail + #make sure the config is for the correct user + sudo sed -i "/root/s/pi/$USER/" /etc/nginx/sites-available/mainsail if [ -e /etc/nginx/sites-enabled/default ]; then sudo rm /etc/nginx/sites-enabled/default fi @@ -258,4 +263,5 @@ install_mainsail(){ wget -q -O mainsail.zip $MAINSAIL_URL && status_msg "Extracting archive ..." && unzip -o mainsail.zip && rm mainsail.zip ### write mainsail version to file for update check reasons echo "$MAINSAIL_VERSION" > $MAINSAIL_DIR/version + echo } \ No newline at end of file From fed882298e85c4516dba377915fd1675f7cf0f3c Mon Sep 17 00:00:00 2001 From: th33xitus <> Date: Sat, 18 Jul 2020 18:49:55 +0200 Subject: [PATCH 29/64] do not remove tornado when removing dwc2fk, will get seperate function --- scripts/remove.sh | 6 ------ scripts/status.sh | 2 -- 2 files changed, 8 deletions(-) diff --git a/scripts/remove.sh b/scripts/remove.sh index 6404a3c..8817de6 100644 --- a/scripts/remove.sh +++ b/scripts/remove.sh @@ -29,8 +29,6 @@ remove_klipper(){ remove_dwc2(){ data_arr=( $DWC2FK_DIR - $TORNADO_DIR1 - $TORNADO_DIR2 $WEB_DWC2 $DWC2_DIR ) @@ -40,10 +38,6 @@ remove_dwc2(){ status_msg "Removing DWC2-for-Klipper directory ..." rm -rf $DWC2FK_DIR && ok_msg "Directory removed!" fi - if [ -d $TORNADO_DIR1 ]; then - status_msg "Removing Tornado from klippy-env ..." - rm -rf $TORNADO_DIR1 $TORNADO_DIR2 && ok_msg "Tornado removed!" - fi if [ -e $WEB_DWC2 ]; then status_msg "Removing web_dwc2.py Symlink from klippy ..." rm -rf $WEB_DWC2 && ok_msg "File removed!" diff --git a/scripts/status.sh b/scripts/status.sh index aeb28d5..cffa419 100644 --- a/scripts/status.sh +++ b/scripts/status.sh @@ -28,8 +28,6 @@ dwc2_status(){ $DWC2FK_DIR $WEB_DWC2 $DWC2_DIR - $TORNADO_DIR1 - $TORNADO_DIR2 ) #count+1 for each found data-item from array for dd in "${dwc2_data[@]}" From 28d7a4aeda81bbdd95b934a7d96c82f11e579dae Mon Sep 17 00:00:00 2001 From: th33xitus <> Date: Sat, 18 Jul 2020 20:30:49 +0200 Subject: [PATCH 30/64] feature: remove option for tornado and nginx --- kiauh.sh | 12 ++++++++++++ scripts/remove.sh | 34 ++++++++++++++++++++++++++++++++++ scripts/ui.sh | 4 ++-- 3 files changed, 48 insertions(+), 2 deletions(-) diff --git a/kiauh.sh b/kiauh.sh index bc9a8eb..bfb28d9 100755 --- a/kiauh.sh +++ b/kiauh.sh @@ -265,6 +265,18 @@ remove_menu(){ remove_octoprint print_msg && CONFIRM_MSG="" && ERROR_MSG="" remove_ui;; + 5) + clear + print_header + remove_tornado + print_msg && CONFIRM_MSG="" && ERROR_MSG="" + remove_ui;; + 6) + clear + print_header + remove_nginx + print_msg && CONFIRM_MSG="" && ERROR_MSG="" + remove_ui;; Q|q) clear; main_menu; break;; *) diff --git a/scripts/remove.sh b/scripts/remove.sh index 8817de6..a404d97 100644 --- a/scripts/remove.sh +++ b/scripts/remove.sh @@ -26,6 +26,20 @@ remove_klipper(){ fi } +remove_tornado(){ + data_arr=( + $TORNADO_DIR1 + $TORNADO_DIR2 + ) + print_error "Tornado" && data_count=() + if [ "$ERROR_MSG" = "" ]; then + status_msg "Removing Tornado from klippy-env ..." + PYTHONDIR=$KLIPPY_ENV_DIR + $PYTHONDIR/bin/pip uninstall tornado -y + CONFIRM_MSG=" Tornado successfully removed!" + fi +} + remove_dwc2(){ data_arr=( $DWC2FK_DIR @@ -118,6 +132,8 @@ remove_octoprint(){ $OCTOPRINT_CFG_DIR ${HOME}/octoprint.log /etc/sudoers.d/octoprint-shutdown + /etc/nginx/sites-available/octoprint + /etc/nginx/sites-enabled/octoprint ) print_error "OctoPrint" && data_count=() if [ "$ERROR_MSG" = "" ]; then @@ -140,4 +156,22 @@ remove_octoprint(){ fi CONFIRM_MSG=" OctoPrint successfully removed!" fi +} + +remove_nginx(){ + if [[ $(dpkg-query -f'${Status}' --show nginx 2>/dev/null) = *\ installed ]] ; then + status_msg "Stopping and removing Nginx Service ..." + if [ -e /etc/init.d/nginx ]; then + sudo /etc/init.d/nginx stop && ok_msg "Nginx Service stopped!" + sudo rm /etc/init.d/nginx && ok_msg "Nginx Service removed!" + fi + if [ -e /etc/default/nginx ]; then + sudo rm /etc/default/nginx + fi + status_msg "Purging Nginx from system ..." + sudo apt-get purge nginx nginx-common -y + CONFIRM_MSG=" Nginx successfully removed!" + else + ERROR_MSG=" Looks like Nginx was already removed!\n Skipping..." + fi } \ No newline at end of file diff --git a/scripts/ui.sh b/scripts/ui.sh index 5f2c963..0a6ac30 100644 --- a/scripts/ui.sh +++ b/scripts/ui.sh @@ -94,8 +94,8 @@ remove_ui(){ echo -e "| --> ~/kiauh-backups | " echo -e "| You need remove them manually if you wish so. | " hr - echo -e "| 1) [Klipper] | | " - echo -e "| 2) [DWC2-for-Klipper] | | " + echo -e "| 1) [Klipper] | 5) [Tornado] | " + echo -e "| 2) [DWC2-for-Klipper] | 6) [Nginx] | " echo -e "| 3) [Mainsail] | | " echo -e "| 4) [Octoprint] | | " quit_footer From 8ffdf12a4af1e3d63095864f10ef5065380a8388 Mon Sep 17 00:00:00 2001 From: th33xitus <> Date: Sun, 19 Jul 2020 22:38:21 +0200 Subject: [PATCH 31/64] add octoprint reverse proxy --- resources/octoprint_nginx.cfg | 40 +++++++++++++++++++++++++++++++++++ scripts/functions.sh | 15 ++++++++----- scripts/install_octoprint.sh | 36 +++++++++++++++++++++++++++++++ 3 files changed, 86 insertions(+), 5 deletions(-) create mode 100644 resources/octoprint_nginx.cfg diff --git a/resources/octoprint_nginx.cfg b/resources/octoprint_nginx.cfg new file mode 100644 index 0000000..b35d3cc --- /dev/null +++ b/resources/octoprint_nginx.cfg @@ -0,0 +1,40 @@ +map $http_upgrade $connection_upgrade { + default upgrade; + '' close; +} + +upstream octoprint { + server 127.0.0.1:5000; +} + +upstream mjpg-streamer { + server 127.0.0.1:8080; +} + +server { + listen 80; + listen [::]:80; + + location / { + proxy_pass http://octoprint/; + proxy_set_header Host $http_host; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Scheme $scheme; + #proxy_set_header X-Script-Name /; + proxy_http_version 1.1; + client_max_body_size 0; + } + + location /webcam { + proxy_pass http://mjpg-streamer/; + } + + # redirect server error pages to the static page /50x.html + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root html; + } +} \ No newline at end of file diff --git a/scripts/functions.sh b/scripts/functions.sh index ac8ad21..2628943 100644 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -78,6 +78,13 @@ restart_octoprint(){ fi } +restart_nginx(){ + if [ -e /etc/init.d/nginx ]; then + status_msg "Restarting Nginx Service ..." + sudo /etc/init.d/nginx restart && sleep 2 && ok_msg "Nginx Service restarted!" + fi +} + dep_check(){ for package in "${dep[@]}" do @@ -261,12 +268,10 @@ create_custom_hostname(){ top_border echo -e "| You can change the hostname of this machine to use |" echo -e "| that name to open the Interface in your browser. |" - echo -e "| This option is completely optional and can also be |" - echo -e "| done at a later point in time if you are unsure. |" echo -e "| |" echo -e "| Example: If you set the hostname to 'my-printer' |" - echo -e "| you can open Mainsail by browsing to: |" - echo -e "| http://my-printer.local |" + echo -e "| you can open Mainsail/Octoprint by |" + echo -e "| browsing to: http://my-printer.local |" bottom_border while true; do echo -e "${cyan}" @@ -323,7 +328,7 @@ set_hostname(){ echo "127.0.0.1 $NEW_HOSTNAME ###set by kiauh" | sudo tee -a /etc/hosts &>/dev/null fi ok_msg "New hostname successfully configured!" - ok_msg "You need to reboot your machine for changes to take effect!" + ok_msg "Remember to reboot your machine for the changes to take effect!" break else warn_msg "'$NEW_HOSTNAME' is not a valid hostname!" diff --git a/scripts/install_octoprint.sh b/scripts/install_octoprint.sh index e921b59..0766113 100755 --- a/scripts/install_octoprint.sh +++ b/scripts/install_octoprint.sh @@ -6,6 +6,7 @@ octoprint_install_routine(){ add_groups configure_autostart add_reboot_permission + octoprint_reverse_proxy_dialog load_server } @@ -108,6 +109,41 @@ add_reboot_permission(){ sleep 2 } +octoprint_reverse_proxy_dialog(){ + top_border + echo -e "| If you want to have nicer URLs or simply need | " + echo -e "| OctoPrint to run on port 80 (http's default port) | " + echo -e "| due to some network restrictions, you can set up a | " + echo -e "| reverse proxy instead of configuring OctoPrint to | " + echo -e "| run on port 80. | " + bottom_border + while true; do + echo -e "${cyan}" + read -p "###### Do you want to set up a reverse proxy now? (Y/n): " yn + echo -e "${default}" + case "$yn" in + Y|y|Yes|yes|"") octoprint_reverse_proxy; break;; + N|n|No|no) break;; + esac + done +} + +octoprint_reverse_proxy(){ + if ! [[ $(dpkg-query -f'${Status}' --show nginx 2>/dev/null) = *\ installed ]]; then + sudo apt-get install nginx -y + fi + cat ${HOME}/kiauh/resources/octoprint_nginx.cfg > ${HOME}/kiauh/resources/octoprint + sudo mv ${HOME}/kiauh/resources/octoprint /etc/nginx/sites-available/octoprint + if [ -e /etc/nginx/sites-enabled/default ]; then + sudo rm /etc/nginx/sites-enabled/default + fi + if [ ! -e /etc/nginx/sites-enabled/octoprint ]; then + sudo ln -s /etc/nginx/sites-available/octoprint /etc/nginx/sites-enabled/ + fi + restart_nginx + create_custom_hostname +} + load_server(){ start_octoprint #create an octoprint.log symlink in home-dir just for convenience From 4cb2ba51bd1d3f5c1f576afe444f8a17f36fbeb9 Mon Sep 17 00:00:00 2001 From: th33xitus <> Date: Mon, 20 Jul 2020 10:09:42 +0200 Subject: [PATCH 32/64] fix remote version checks --- scripts/status.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/status.sh b/scripts/status.sh index cffa419..7f7c65d 100644 --- a/scripts/status.sh +++ b/scripts/status.sh @@ -104,7 +104,7 @@ read_branch(){ #if reading the branch gives an empty string #we are on non-detached HEAD state on origin/master #and need to set GET_BRANCH to make a non-empty string - if [ -z $GET_BRANCH ]; then + if [ -z "$GET_BRANCH" ]; then GET_BRANCH="origin/master" fi else @@ -140,7 +140,12 @@ read_local_klipper_commit(){ read_remote_klipper_commit(){ read_branch - if [ ! -z $GET_BRANCH ];then + if [ ! -z "$GET_BRANCH" ];then + if [ "$GET_BRANCH" == "origin/master" ]; then + git fetch origin master -q + else + git fetch $GET_BRANCH -q + fi REMOTE_COMMIT=$(git rev-parse --short=8 $GET_BRANCH) else REMOTE_COMMIT="" @@ -164,6 +169,7 @@ compare_klipper_versions(){ read_dwc2fk_versions(){ if [ -d $DWC2FK_DIR ] && [ -d $DWC2FK_DIR/.git ]; then cd $DWC2FK_DIR + git fetch origin master -q LOCAL_DWC2FK_COMMIT=$(git rev-parse --short=8 HEAD) REMOTE_DWC2FK_COMMIT=$(git rev-parse --short=8 origin/master) else From 2b6dbaab765f07045d3608dd0025a4cb6302547d Mon Sep 17 00:00:00 2001 From: th33xitus <> Date: Mon, 20 Jul 2020 10:45:04 +0200 Subject: [PATCH 33/64] remove webcam stuff: i can't test it sufficient enough, users need to install it manually for now --- scripts/install_dwc2.sh | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/scripts/install_dwc2.sh b/scripts/install_dwc2.sh index 4e4f65f..e200ef3 100644 --- a/scripts/install_dwc2.sh +++ b/scripts/install_dwc2.sh @@ -131,38 +131,6 @@ DWC2 } install_dwc2(){ - #needed packages for webcam - while true; do - echo -e "${cyan}" - read -p "###### Do you want to use a webcam? (Y/n): " yn - echo -e "${default}" - case "$yn" in - Y|y|Yes|yes|"") - status_msg "Checking for dependencies ..." - webcam_dep_check && ok_msg "Dependencies installed!" - break;; - N|n|No|no) break;; - esac - done #the update_dwc2 function does the same as installing dwc2 update_dwc2 && ok_msg "DWC2 Web UI installed!" -} - -webcam_dep_check(){ - webcam_dep=( - build-essential - libjpeg8-dev - imagemagick - libv4l-dev - cmake - ) - for pkg in "${webcam_dep[@]}" - do - if ! [[ $(dpkg-query -f'${Status}' --show $pkg 2>/dev/null) = *\ installed ]]; then - install+=($pkg) - fi - done - if ! [ ${#install[@]} -eq 0 ]; then - sudo apt-get install ${install[@]} -y - fi } \ No newline at end of file From 7b48061281d9448f6ad8c69e685c961e39ff22bb Mon Sep 17 00:00:00 2001 From: th33xitus <> Date: Mon, 20 Jul 2020 11:02:11 +0200 Subject: [PATCH 34/64] Update README.md --- README.md | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 389815f..deaf92c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# THIS VERSION IS WORK IN PROGRESS!!! +# THIS VERSION IS WORK IN PROGRESS!!! # KIAUH @@ -29,9 +29,11 @@ chmod +x ~/kiauh/scripts/* ``` ## Restrictions: -* Tested only on Raspbian Buster Lite + +- Tested only on Raspbian Buster Lite ## Functions and Features: + - Installing: - Klipper - dwc2-for-klipper + Duet Web Control @@ -42,11 +44,12 @@ chmod +x ~/kiauh/scripts/* - dwc2-for-klipper + Duet Web Control - Moonraker + Mainsail - Removing: + - Klipper - dwc2-for-klipper + Duet Web Control - Moonraker + Mainsail - OctoPrint - + - Build Klipper Firmware - Flash MCU - Read ID of currently connected printer @@ -61,16 +64,22 @@ chmod +x ~/kiauh/scripts/* tbc ... ## What this script can't do: -- Updating OctoPrint. Use OctoPrint for updating! +- Updating OctoPrint -> Use OctoPrint for updating! +- Setting up webcam related stuff: + + - If you want to use a webcam in either case (DWC2/Mainsail/Octoprint) you have to install the dependencies and configurations yourself. I can't test this stuff sufficient enough due to me not using a webcam and therefore it's just too much work for me. + + There are install instructions (at least in case of Octoprint) available: + [Setting up OctoPrint on a Raspberry Pi running Raspbian](https://community.octoprint.org/t/setting-up-octoprint-on-a-raspberry-pi-running-raspbian/2337) + (look for "Optional: Webcam") ## Q&A -__*Q: Can i install octoprint with this script?*__ +**_Q: Can i install octoprint with this script?_** **A:** ~~Soon™~~ Yes :) +**_Q: Can i use this script to install multiple instancec of Klipper on the same Pi? (Multisession?)_** -__*Q: Can i use this script to install multiple instancec of Klipper on the same Pi? (Multisession?)*__ - - **A:** No, and at the moment i don't plan to implement this function. For multisession installations take a look at this script manu7irl created: https://github.com/manu7irl/klipper-DWC2-installer . Keep in mind that klipper-DWC2-installer and KIAUH are **NOT** compatible with each other. +**A:** No, and at the moment i don't plan to implement this function. For multisession installations take a look at this script manu7irl created: https://github.com/manu7irl/klipper-DWC2-installer . Keep in mind that klipper-DWC2-installer and KIAUH are **NOT** compatible with each other. From 3ab42447090e1ee976d2453e0d01147a473a7de6 Mon Sep 17 00:00:00 2001 From: th33xitus <> Date: Mon, 20 Jul 2020 11:50:24 +0200 Subject: [PATCH 35/64] Update README.md --- README.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index deaf92c..f5e2c5a 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,7 @@ chmod +x ~/kiauh/scripts/* ## Restrictions: - Tested only on Raspbian Buster Lite +- Prevent simultaneous use of DWC2 and OctoPrint. There have been reports that DWC2 does strange things while the OctoPrint service is running while using the DWC2 web interface. The script disables an existing OctoPrint service when installing DWC2. However, the service can also be reactivated with the script! ## Functions and Features: @@ -58,19 +59,21 @@ chmod +x ~/kiauh/scripts/* - scurve-shaping - scurve-smoothing - moonraker + - dev-moonraker - Toggle auto-create backups before updating - Toggle OctoPrint Service (usefull when using DWC2/Mainsail and Octoprint at the same time) -tbc ... +- Set up reverse proxy for Mainsail/OctoPrint + tbc ... ## What this script can't do: - Updating OctoPrint -> Use OctoPrint for updating! - Setting up webcam related stuff: - - If you want to use a webcam in either case (DWC2/Mainsail/Octoprint) you have to install the dependencies and configurations yourself. I can't test this stuff sufficient enough due to me not using a webcam and therefore it's just too much work for me. + - If you want to use a webcam you have to install the dependencies and configurations yourself. I can't test this stuff sufficient enough due to me not having/using a webcam and therefore it's just too much work for me to set up an installation script which works, at best, with the first try. - There are install instructions (at least in case of Octoprint) available: + There are install instructions (at least in case of OctoPrint) available: [Setting up OctoPrint on a Raspberry Pi running Raspbian](https://community.octoprint.org/t/setting-up-octoprint-on-a-raspberry-pi-running-raspbian/2337) (look for "Optional: Webcam") From 092f2793b3b51ea3df18973b0579adce9906a0e0 Mon Sep 17 00:00:00 2001 From: th33xitus <31533186+th33xitus@users.noreply.github.com> Date: Mon, 20 Jul 2020 11:59:02 +0200 Subject: [PATCH 36/64] Update README.md --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f5e2c5a..5f823d2 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,7 @@ chmod +x ~/kiauh/scripts/* - Toggle OctoPrint Service (usefull when using DWC2/Mainsail and Octoprint at the same time) - Set up reverse proxy for Mainsail/OctoPrint + tbc ... ## What this script can't do: @@ -73,9 +74,9 @@ chmod +x ~/kiauh/scripts/* - If you want to use a webcam you have to install the dependencies and configurations yourself. I can't test this stuff sufficient enough due to me not having/using a webcam and therefore it's just too much work for me to set up an installation script which works, at best, with the first try. - There are install instructions (at least in case of OctoPrint) available: - [Setting up OctoPrint on a Raspberry Pi running Raspbian](https://community.octoprint.org/t/setting-up-octoprint-on-a-raspberry-pi-running-raspbian/2337) - (look for "Optional: Webcam") + There are install instructions (at least in case of OctoPrint) available: + [Setting up OctoPrint on a Raspberry Pi running Raspbian](https://community.octoprint.org/t/setting-up-octoprint-on-a-raspberry-pi-running-raspbian/2337) + (look for "Optional: Webcam") ## Q&A From e22105a728d6b370ab90e0ee74753d42267cfb5e Mon Sep 17 00:00:00 2001 From: th33xitus <> Date: Wed, 22 Jul 2020 10:16:52 +0200 Subject: [PATCH 37/64] add dwc2 reverse proxy option --- resources/dwc2_nginx.cfg | 26 ++++++++++++++++++++++++++ scripts/install_dwc2.sh | 36 +++++++++++++++++++++++++++++++++++- 2 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 resources/dwc2_nginx.cfg diff --git a/resources/dwc2_nginx.cfg b/resources/dwc2_nginx.cfg new file mode 100644 index 0000000..db8f860 --- /dev/null +++ b/resources/dwc2_nginx.cfg @@ -0,0 +1,26 @@ +map $http_upgrade $connection_upgrade { + default upgrade; + '' close; +} + +upstream dwc2 { + server 127.0.0.1:4750; +} + +server { + listen 80; + listen [::]:80; + + location / { + proxy_pass http://dwc2/; + proxy_set_header Host $http_host; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Scheme $scheme; + #proxy_set_header X-Script-Name /; + proxy_http_version 1.1; + client_max_body_size 0; + } +} \ No newline at end of file diff --git a/scripts/install_dwc2.sh b/scripts/install_dwc2.sh index e200ef3..f3f43f2 100644 --- a/scripts/install_dwc2.sh +++ b/scripts/install_dwc2.sh @@ -5,7 +5,7 @@ dwc2_install_routine(){ if [ -d $KLIPPER_DIR ]; then # check for existing installation - if [ -d ${HOME}/klippy-env/lib/python2.7/site-packages/tornado ]; then + if [ -d $DWC2FK_DIR ] && [ -d $DWC2_DIR ]; then ERROR_MSG=" Looks like DWC2 is already installed!\n Skipping..." return fi @@ -17,6 +17,7 @@ dwc2_install_routine(){ install_tornado install_dwc2fk && dwc2fk_cfg install_dwc2 + dwc2_reverse_proxy_dialog start_klipper else ERROR_MSG=" Please install Klipper first!\n Skipping..." @@ -133,4 +134,37 @@ DWC2 install_dwc2(){ #the update_dwc2 function does the same as installing dwc2 update_dwc2 && ok_msg "DWC2 Web UI installed!" +} + +dwc2_reverse_proxy_dialog(){ + top_border + echo -e "| If you want to have a nicer URL or simply need/want | " + echo -e "| DWC2 to run on port 80 (http's default port) you | " + echo -e "| can set up a reverse proxy to run DWC2 on port 80. | " + bottom_border + while true; do + echo -e "${cyan}" + read -p "###### Do you want to set up a reverse proxy now? (Y/n): " yn + echo -e "${default}" + case "$yn" in + Y|y|Yes|yes|"") dwc2_reverse_proxy; break;; + N|n|No|no) break;; + esac + done +} + +dwc2_reverse_proxy(){ + if ! [[ $(dpkg-query -f'${Status}' --show nginx 2>/dev/null) = *\ installed ]]; then + sudo apt-get install nginx -y + fi + cat ${HOME}/kiauh/resources/dwc2_nginx.cfg > ${HOME}/kiauh/resources/dwc2 + sudo mv ${HOME}/kiauh/resources/dwc2 /etc/nginx/sites-available/dwc2 + if [ -e /etc/nginx/sites-enabled/default ]; then + sudo rm /etc/nginx/sites-enabled/default + fi + if [ ! -e /etc/nginx/sites-enabled/dwc2 ]; then + sudo ln -s /etc/nginx/sites-available/dwc2 /etc/nginx/sites-enabled/ + fi + restart_nginx + create_custom_hostname } \ No newline at end of file From 3091ce55ad5a0af9df1b1712828a1b3d8178a74e Mon Sep 17 00:00:00 2001 From: th33xitus <> Date: Wed, 22 Jul 2020 13:27:41 +0200 Subject: [PATCH 38/64] Fix bug --- scripts/install_mainsail.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/install_mainsail.sh b/scripts/install_mainsail.sh index 66ebbe5..30f212a 100644 --- a/scripts/install_mainsail.sh +++ b/scripts/install_mainsail.sh @@ -1,4 +1,5 @@ mainsail_install_routine(){ + ERROR="0" #reset error state if [ -d $KLIPPER_DIR ]; then #check for dependencies dep=(wget curl unzip) @@ -9,7 +10,7 @@ mainsail_install_routine(){ disable_haproxy_lighttpd remove_haproxy_lighttpd install_moonraker - if [ "$ERROR" != 1 ]; then + if [ "$ERROR" != "1" ]; then check_printer_cfg restart_moonraker restart_klipper From 108b5c7b0c7b4ac4374d41e7be56080a0f32e4e0 Mon Sep 17 00:00:00 2001 From: th33xitus <> Date: Wed, 22 Jul 2020 17:50:46 +0200 Subject: [PATCH 39/64] Fixes --- scripts/install_dwc2.sh | 24 ++++++++++++++---------- scripts/install_octoprint.sh | 2 +- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/scripts/install_dwc2.sh b/scripts/install_dwc2.sh index f3f43f2..2550b20 100644 --- a/scripts/install_dwc2.sh +++ b/scripts/install_dwc2.sh @@ -11,7 +11,7 @@ dwc2_install_routine(){ fi stop_klipper #disable octoprint service if installed - if systemctl is-enabled octoprint.service -q; then + if systemctl is-enabled octoprint.service -q &>/dev/null; then disable_octoprint_service fi install_tornado @@ -25,15 +25,19 @@ dwc2_install_routine(){ } install_tornado(){ - #check for dependencies - dep=(virtualenv) - dep_check - #execute operation - status_msg "Installing Tornado 5.1.1 ..." - cd ${HOME} - PYTHONDIR="${HOME}/klippy-env" - virtualenv ${PYTHONDIR} - ${PYTHONDIR}/bin/pip install tornado==5.1.1 && ok_msg "Tornado 5.1.1 successfully installed!" + if [ ! -d $TORNADO_DIR1 ]; then + #check for dependencies + dep=(virtualenv) + dep_check + #execute operation + status_msg "Installing Tornado 5.1.1 ..." + cd ${HOME} + PYTHONDIR="${HOME}/klippy-env" + virtualenv ${PYTHONDIR} + ${PYTHONDIR}/bin/pip install tornado==5.1.1 && ok_msg "Tornado 5.1.1 successfully installed!" + else + ok_msg "Looks like Tornado 5.1.1 is already installed! Continue..." + fi } install_dwc2fk(){ diff --git a/scripts/install_octoprint.sh b/scripts/install_octoprint.sh index 0766113..e76ce92 100755 --- a/scripts/install_octoprint.sh +++ b/scripts/install_octoprint.sh @@ -24,7 +24,7 @@ octoprint_dependencies(){ status_msg "Checking for dependencies ..." for octo_dep_pgk in "${octo_dep[@]}" do - if [[ $(dpkg-query -f'${Status}' --show $octo_dep_pgk 2>/dev/null) = *\ installed ]]; then + if [[ ! $(dpkg-query -f'${Status}' --show $octo_dep_pgk 2>/dev/null) = *\ installed ]]; then install+=($octo_dep_pgk) fi done From 734aed1f7b7e9cfe37faf9bf4e2eb7e4a6918667 Mon Sep 17 00:00:00 2001 From: th33xitus <> Date: Thu, 23 Jul 2020 10:20:14 +0200 Subject: [PATCH 40/64] Better dependency check --- kiauh.sh | 7 +++--- scripts/functions.sh | 43 ++++++++++++++++++++---------------- scripts/install_octoprint.sh | 43 ++++++++++++------------------------ 3 files changed, 42 insertions(+), 51 deletions(-) diff --git a/kiauh.sh b/kiauh.sh index bfb28d9..5759fd4 100755 --- a/kiauh.sh +++ b/kiauh.sh @@ -27,9 +27,6 @@ get_date(){ current_date=`date +"%Y-%m-%d_%H%M%S"` } -### sourcing all additional scripts -for script in ${HOME}/kiauh/scripts/*; do . $script; done - ### set important directories #klipper KLIPPER_DIR=${HOME}/klipper @@ -432,5 +429,9 @@ backup_menu(){ backup_menu } +### sourcing all additional scripts +SRCDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/.. && pwd )" +for script in ${SRCDIR}/kiauh/scripts/*; do . $script; done + check_euid main_menu \ No newline at end of file diff --git a/scripts/functions.sh b/scripts/functions.sh index 2628943..3c716d1 100644 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -3,9 +3,9 @@ check_euid(){ if [ "$EUID" -eq 0 ] then echo -e "${red}" - echo -e "/=================================================\ " - echo -e "| !!! THIS SCRIPT MUST NOT RAN AS ROOT !!! |" - echo -e "\=================================================/ " + top_border + echo -e "| !!! THIS SCRIPT MUST NOT RAN AS ROOT !!! |" + bottom_border echo -e "${default}" exit 1 fi @@ -85,24 +85,29 @@ restart_nginx(){ fi } -dep_check(){ - for package in "${dep[@]}" +dependency_check(){ + status_msg "Checking for dependencies ..." + #check if package is installed, if not write name into array + for pkg in "${dep[@]}" do - ! command -v $package >&/dev/null 2>&1 && install+=($package) - done - if ! [ ${#install[@]} -eq 0 ]; then - warn_msg "The following packages are missing but necessary:" - echo ${install[@]} - while true; do - read -p "Do you want to install them now? (Y/n): " yn - case "$yn" in - Y|y|Yes|yes|"") - status_msg "Installing dependencies ..." - sudo apt-get install ${install[@]} -y && ok_msg "Dependencies installed!" - break;; - N|n|No|no) break;; - esac + if [[ ! $(dpkg-query -f'${Status}' --show $pkg 2>/dev/null) = *\ installed ]]; then + inst+=($pkg) + fi done + #if array is not empty, install packages from array elements + if [ "${#inst[@]}" != "0" ]; then + status_msg "Installing the following dependencies:" + for element in ${inst[@]} + do + echo -e "${cyan}● $element ${default}" + done + echo + sudo apt-get install ${inst[@]} -y + ok_msg "Dependencies installed!" + #clearing the array + unset inst + else + ok_msg "Dependencies already met! Continue..." fi } diff --git a/scripts/install_octoprint.sh b/scripts/install_octoprint.sh index e76ce92..7a0408e 100755 --- a/scripts/install_octoprint.sh +++ b/scripts/install_octoprint.sh @@ -1,7 +1,5 @@ octoprint_install_routine(){ - #experimental new dependency check - octoprint_dependencies - #execute operations + octoprint_dependencies install_octoprint add_groups configure_autostart @@ -11,29 +9,17 @@ octoprint_install_routine(){ } octoprint_dependencies(){ - octo_dep=( + dep=( + git + wget python-pip python-dev - python-setuptools - python-virtualenv - git libyaml-dev build-essential - wget - ) - status_msg "Checking for dependencies ..." - for octo_dep_pgk in "${octo_dep[@]}" - do - if [[ ! $(dpkg-query -f'${Status}' --show $octo_dep_pgk 2>/dev/null) = *\ installed ]]; then - install+=($octo_dep_pgk) - fi - done - if ! [ ${#install[@]} -eq 0 ]; then - status_msg "Installing dependencies ..." - sudo apt-get install ${install[@]} -y && ok_msg "Dependencies installed!" - else - ok_msg "All dependencies already met!" - fi + python-setuptools + python-virtualenv + ) + dependency_check } install_octoprint(){ @@ -56,14 +42,13 @@ install_octoprint(){ } add_groups(){ - USER=$(whoami) - if [[ ! $(groups | grep tty) ]]; then - status_msg "Adding user '$USER' to group 'tty' ..." - sudo usermod -a -G tty $USER && ok_msg "Done!" + if [ ! "$(groups | grep tty)" ]; then + status_msg "Adding user '${USER}' to group 'tty' ..." + sudo usermod -a -G tty ${USER} && ok_msg "Done!" fi - if [[ ! $(groups | grep tty) ]]; then - status_msg "Adding user '$USER' to group 'dialout' ..." - sudo usermod -a -G dialout $USER && ok_msg "Done!" + if [ ! "$(groups | grep dialout)" ]; then + status_msg "Adding user '${USER}' to group 'dialout' ..." + sudo usermod -a -G dialout ${USER} && ok_msg "Done!" fi } From a2042ec378fa5cf6555aa8173dac4eaebc50866c Mon Sep 17 00:00:00 2001 From: th33xitus <> Date: Thu, 23 Jul 2020 10:50:10 +0200 Subject: [PATCH 41/64] Better tornado install check --- scripts/install_dwc2.sh | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/scripts/install_dwc2.sh b/scripts/install_dwc2.sh index 2550b20..2472fc7 100644 --- a/scripts/install_dwc2.sh +++ b/scripts/install_dwc2.sh @@ -11,7 +11,7 @@ dwc2_install_routine(){ fi stop_klipper #disable octoprint service if installed - if systemctl is-enabled octoprint.service -q &>/dev/null; then + if systemctl is-enabled octoprint.service -q 2>/dev/null; then disable_octoprint_service fi install_tornado @@ -25,18 +25,15 @@ dwc2_install_routine(){ } install_tornado(){ - if [ ! -d $TORNADO_DIR1 ]; then - #check for dependencies - dep=(virtualenv) - dep_check - #execute operation + if [ "$(cd $KLIPPY_ENV_DIR/bin/ && $_/pip list 2>/dev/null | grep "tornado" | cut -d" " -f9)" = "5.1.1" ]; then + ok_msg "Tornado 5.1.1 is already installed! Continue..." + else status_msg "Installing Tornado 5.1.1 ..." cd ${HOME} PYTHONDIR="${HOME}/klippy-env" virtualenv ${PYTHONDIR} - ${PYTHONDIR}/bin/pip install tornado==5.1.1 && ok_msg "Tornado 5.1.1 successfully installed!" - else - ok_msg "Looks like Tornado 5.1.1 is already installed! Continue..." + ${PYTHONDIR}/bin/pip install tornado==5.1.1 + ok_msg "Tornado 5.1.1 successfully installed!" fi } From 80344ec41c33582b7ee44725c30b6158cbe5e461 Mon Sep 17 00:00:00 2001 From: th33xitus <> Date: Thu, 23 Jul 2020 11:04:23 +0200 Subject: [PATCH 42/64] Fixes --- scripts/functions.sh | 9 --------- scripts/install_dwc2.sh | 7 ++++--- scripts/install_mainsail.sh | 6 ++++-- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/scripts/functions.sh b/scripts/functions.sh index 3c716d1..626f538 100644 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -128,15 +128,6 @@ print_error(){ fi } -#pkg_check(){ -# #WIP -# if [[ $(dpkg-query -f'${Status}' --show $PKG 2>/dev/null) = *\ installed ]]; then -# echo "WIP" -# else -# sudo apt-get -y install $PKG 2>/dev/null -# fi -#} - build_fw(){ if [ -d $KLIPPER_DIR ]; then cd $KLIPPER_DIR && make menuconfig diff --git a/scripts/install_dwc2.sh b/scripts/install_dwc2.sh index 2472fc7..30d7f06 100644 --- a/scripts/install_dwc2.sh +++ b/scripts/install_dwc2.sh @@ -155,9 +155,10 @@ dwc2_reverse_proxy_dialog(){ } dwc2_reverse_proxy(){ - if ! [[ $(dpkg-query -f'${Status}' --show nginx 2>/dev/null) = *\ installed ]]; then - sudo apt-get install nginx -y - fi + #check for dependencies + dep=(avahi-daemon nginx) + dependency_check + #execute operations cat ${HOME}/kiauh/resources/dwc2_nginx.cfg > ${HOME}/kiauh/resources/dwc2 sudo mv ${HOME}/kiauh/resources/dwc2 /etc/nginx/sites-available/dwc2 if [ -e /etc/nginx/sites-enabled/default ]; then diff --git a/scripts/install_mainsail.sh b/scripts/install_mainsail.sh index 30f212a..d114d58 100644 --- a/scripts/install_mainsail.sh +++ b/scripts/install_mainsail.sh @@ -3,10 +3,12 @@ mainsail_install_routine(){ if [ -d $KLIPPER_DIR ]; then #check for dependencies dep=(wget curl unzip) - dep_check + dependency_check #execute operation #disable octoprint service if installed - disable_octoprint_service + if systemctl is-enabled octoprint.service -q 2>/dev/null; then + disable_octoprint_service + fi disable_haproxy_lighttpd remove_haproxy_lighttpd install_moonraker From 2596e8d08a73a43a21c88d1cf688d136b2d4b422 Mon Sep 17 00:00:00 2001 From: th33xitus <> Date: Thu, 23 Jul 2020 16:13:33 +0200 Subject: [PATCH 43/64] Fixes --- scripts/install_klipper.sh | 2 +- scripts/install_mainsail.sh | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/scripts/install_klipper.sh b/scripts/install_klipper.sh index a158ed6..76619bb 100644 --- a/scripts/install_klipper.sh +++ b/scripts/install_klipper.sh @@ -4,7 +4,7 @@ install_klipper(){ else #check for dependencies dep=(git) - dep_check + dependency_check #execute operation cd ${HOME} status_msg "Cloning Klipper repository ..." diff --git a/scripts/install_mainsail.sh b/scripts/install_mainsail.sh index d114d58..ab85848 100644 --- a/scripts/install_mainsail.sh +++ b/scripts/install_mainsail.sh @@ -1,10 +1,6 @@ mainsail_install_routine(){ ERROR="0" #reset error state if [ -d $KLIPPER_DIR ]; then - #check for dependencies - dep=(wget curl unzip) - dependency_check - #execute operation #disable octoprint service if installed if systemctl is-enabled octoprint.service -q 2>/dev/null; then disable_octoprint_service @@ -31,6 +27,8 @@ mainsail_install_routine(){ install_moonraker(){ cd $KLIPPER_DIR if [[ $(git describe --all) = "remotes/Arksine/work-web_server-20200131" || $(git describe --all) = "remotes/Arksine/dev-moonraker-testing" ]]; then + dep=(wget curl unzip) + dependency_check status_msg "Installing Moonraker ..." $KLIPPER_DIR/scripts/install-moonraker.sh && ok_msg "Moonraker successfully installed!" if [ ! -d ${HOME}/sdcard ]; then From 2bbf00647575246000c0980611cbd16cc30fa716 Mon Sep 17 00:00:00 2001 From: th33xitus <> Date: Thu, 23 Jul 2020 19:39:12 +0200 Subject: [PATCH 44/64] some reverse proxy tweaks --- resources/mainsail_nginx.cfg | 4 ++-- scripts/functions.sh | 35 ++++++++++++++++++++++++++++------- scripts/install_dwc2.sh | 20 ++------------------ scripts/install_mainsail.sh | 25 +------------------------ scripts/install_octoprint.sh | 19 ++----------------- 5 files changed, 35 insertions(+), 68 deletions(-) diff --git a/resources/mainsail_nginx.cfg b/resources/mainsail_nginx.cfg index faf55d5..3a5be13 100644 --- a/resources/mainsail_nginx.cfg +++ b/resources/mainsail_nginx.cfg @@ -10,8 +10,8 @@ upstream apiserver { } server { - listen 80 default_server; - listen [::]:80 default_server; + listen 80; + #listen [::]:80; # no ipv6 support in mainsail yet! access_log /var/log/nginx/mainsail-access.log; error_log /var/log/nginx/mainsail-error.log; diff --git a/scripts/functions.sh b/scripts/functions.sh index 626f538..4843d5b 100644 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -259,6 +259,30 @@ read_octoprint_service_status(){ fi } +create_reverse_proxy(){ + #check for dependencies + dep=(nginx) + dependency_check + #execute operations + status_msg "Creating Nginx configuration for $1 ..." + cat ${HOME}/kiauh/resources/$1_nginx.cfg > ${HOME}/kiauh/resources/$1 + sudo mv ${HOME}/kiauh/resources/$1 /etc/nginx/sites-available/$1 + #ONLY FOR MAINSAIL: replace username if not "pi" + if [ "$1" = "mainsail" ]; then + sudo sed -i "/root/s/pi/${USER}/" /etc/nginx/sites-available/mainsail + fi + ok_msg "Nginx configuration for $1 was set!" + #remove default config + if [ -e /etc/nginx/sites-enabled/default ]; then + sudo rm /etc/nginx/sites-enabled/default + fi + #create symlink for own configs + if [ ! -e /etc/nginx/sites-enabled/$1 ]; then + sudo ln -s /etc/nginx/sites-available/$1 /etc/nginx/sites-enabled/ + fi + restart_nginx +} + create_custom_hostname(){ echo top_border @@ -281,13 +305,10 @@ create_custom_hostname(){ } set_hostname(){ - #check for existing avahi installation - status_msg "Checking for necessary Avahi installation ..." - if ! [[ $(dpkg-query -f'${Status}' --show avahi-daemon 2>/dev/null) = *\ installed ]]; then - status_msg "Installing Avahi ..." - sudo apt-get install avahi-daemon -y && ok_msg "Avahi successfully installed!" - fi - ok_msg "Avahi found!" + #check for dependencies + dep=(avahi-daemon) + dependency_check + #execute operations #get current hostname and write to variable HOSTNAME=$(hostname) #create host file if missing or create backup of existing one with current date&time diff --git a/scripts/install_dwc2.sh b/scripts/install_dwc2.sh index 30d7f06..0a1aec2 100644 --- a/scripts/install_dwc2.sh +++ b/scripts/install_dwc2.sh @@ -18,6 +18,7 @@ dwc2_install_routine(){ install_dwc2fk && dwc2fk_cfg install_dwc2 dwc2_reverse_proxy_dialog + create_custom_hostname start_klipper else ERROR_MSG=" Please install Klipper first!\n Skipping..." @@ -148,25 +149,8 @@ dwc2_reverse_proxy_dialog(){ read -p "###### Do you want to set up a reverse proxy now? (Y/n): " yn echo -e "${default}" case "$yn" in - Y|y|Yes|yes|"") dwc2_reverse_proxy; break;; + Y|y|Yes|yes|"") create_reverse_proxy "dwc2"; break;; N|n|No|no) break;; esac done -} - -dwc2_reverse_proxy(){ - #check for dependencies - dep=(avahi-daemon nginx) - dependency_check - #execute operations - cat ${HOME}/kiauh/resources/dwc2_nginx.cfg > ${HOME}/kiauh/resources/dwc2 - sudo mv ${HOME}/kiauh/resources/dwc2 /etc/nginx/sites-available/dwc2 - if [ -e /etc/nginx/sites-enabled/default ]; then - sudo rm /etc/nginx/sites-enabled/default - fi - if [ ! -e /etc/nginx/sites-enabled/dwc2 ]; then - sudo ln -s /etc/nginx/sites-available/dwc2 /etc/nginx/sites-enabled/ - fi - restart_nginx - create_custom_hostname } \ No newline at end of file diff --git a/scripts/install_mainsail.sh b/scripts/install_mainsail.sh index ab85848..a192581 100644 --- a/scripts/install_mainsail.sh +++ b/scripts/install_mainsail.sh @@ -12,7 +12,7 @@ mainsail_install_routine(){ check_printer_cfg restart_moonraker restart_klipper - config_nginx_mainsail + create_reverse_proxy "mainsail" test_api test_nginx install_mainsail @@ -195,29 +195,6 @@ remove_haproxy_lighttpd(){ fi } -config_nginx_mainsail(){ - USER=$(whoami) - if ! [[ $(dpkg-query -f'${Status}' --show nginx 2>/dev/null) = *\ installed ]]; then - status_msg "Installing Nginx ..." - sudo apt-get install nginx -y && ok_msg "Nginx successfully installed!" - fi - if [ ! -d $MAINSAIL_DIR ]; then - mkdir $MAINSAIL_DIR - fi - status_msg "Create Nginx configuration ..." - cat ${HOME}/kiauh/resources/mainsail_nginx.cfg > ${HOME}/kiauh/resources/mainsail - sudo mv ${HOME}/kiauh/resources/mainsail /etc/nginx/sites-available/mainsail - #make sure the config is for the correct user - sudo sed -i "/root/s/pi/$USER/" /etc/nginx/sites-available/mainsail - if [ -e /etc/nginx/sites-enabled/default ]; then - sudo rm /etc/nginx/sites-enabled/default - fi - if [ ! -e /etc/nginx/sites-enabled/mainsail ]; then - sudo ln -s /etc/nginx/sites-available/mainsail /etc/nginx/sites-enabled/ - fi - ok_msg "Nginx configured!" -} - test_api(){ status_msg "Testing API ..." sleep 5 diff --git a/scripts/install_octoprint.sh b/scripts/install_octoprint.sh index 7a0408e..159a89e 100755 --- a/scripts/install_octoprint.sh +++ b/scripts/install_octoprint.sh @@ -5,6 +5,7 @@ octoprint_install_routine(){ configure_autostart add_reboot_permission octoprint_reverse_proxy_dialog + create_custom_hostname load_server } @@ -107,28 +108,12 @@ octoprint_reverse_proxy_dialog(){ read -p "###### Do you want to set up a reverse proxy now? (Y/n): " yn echo -e "${default}" case "$yn" in - Y|y|Yes|yes|"") octoprint_reverse_proxy; break;; + Y|y|Yes|yes|"") create_reverse_proxy "octoprint"; break;; N|n|No|no) break;; esac done } -octoprint_reverse_proxy(){ - if ! [[ $(dpkg-query -f'${Status}' --show nginx 2>/dev/null) = *\ installed ]]; then - sudo apt-get install nginx -y - fi - cat ${HOME}/kiauh/resources/octoprint_nginx.cfg > ${HOME}/kiauh/resources/octoprint - sudo mv ${HOME}/kiauh/resources/octoprint /etc/nginx/sites-available/octoprint - if [ -e /etc/nginx/sites-enabled/default ]; then - sudo rm /etc/nginx/sites-enabled/default - fi - if [ ! -e /etc/nginx/sites-enabled/octoprint ]; then - sudo ln -s /etc/nginx/sites-available/octoprint /etc/nginx/sites-enabled/ - fi - restart_nginx - create_custom_hostname -} - load_server(){ start_octoprint #create an octoprint.log symlink in home-dir just for convenience From 87ed15a11734b3e1c0206db5ed4bb971f7fd6fa4 Mon Sep 17 00:00:00 2001 From: th33xitus <> Date: Fri, 24 Jul 2020 13:11:53 +0200 Subject: [PATCH 45/64] Finish backup functions --- scripts/backup.sh | 74 ++++++++++++++++++++++++++++++++--------------- scripts/update.sh | 8 ++--- 2 files changed, 54 insertions(+), 28 deletions(-) diff --git a/scripts/backup.sh b/scripts/backup.sh index d28445d..c329534 100644 --- a/scripts/backup.sh +++ b/scripts/backup.sh @@ -1,8 +1,12 @@ -backup_printer_cfg(){ +check_for_backup_dir(){ if [ ! -d $BACKUP_DIR ]; then status_msg "Create backup directory ..." mkdir -p $BACKUP_DIR && ok_msg "Directory created!" fi +} + +backup_printer_cfg(){ + check_for_backup_dir if [ -f $PRINTER_CFG ]; then get_date status_msg "Create backup of printer.cfg ..." @@ -35,42 +39,64 @@ toggle_backups(){ fi } -bb4u_klipper(){ +bb4u(){ source_ini - if [ -d $KLIPPER_DIR ] && [ "$backup_before_update" = "true" ]; then - get_date + if [ "$backup_before_update" = "true" ]; then + backup_$1 + fi +} + +backup_klipper(){ + if [ -d $KLIPPER_DIR ] && [ -d $KLIPPY_ENV_DIR ]; then status_msg "Creating Klipper backup ..." + check_for_backup_dir + get_date + status_msg "Timestamp: $current_date" mkdir -p $BACKUP_DIR/klipper-backups/"$current_date" - cp -r $KLIPPER_DIR $_ && cp -r $KLIPPY_ENV_DIR $_ && ok_msg "Backup complete!" + cp -r $KLIPPER_DIR $_ && cp -r $KLIPPY_ENV_DIR $_ + ok_msg "Backup complete!" + else + ERROR_MSG=" Can't backup klipper and/or klipper-env directory! Not found!" fi } -bb4u_dwc2fk(){ - source_ini - if [ -d $DWC2FK_DIR ] && [ "$backup_before_update" = "true" ]; then - get_date - status_msg "Creating DWC2-for-Klipper backup ..." - mkdir -p $BACKUP_DIR/dwc2-for-klipper-backups/"$current_date" - cp -r $DWC2FK_DIR $_ && ok_msg "Backup complete!" - fi -} - -bb4u_dwc2(){ - source_ini - if [ -d $DWC2_DIR ] && [ "$backup_before_update" = "true" ]; then - get_date +backup_dwc2(){ + if [ -d $DWC2FK_DIR ] && [ -d $DWC2_DIR ]; then status_msg "Creating DWC2 Web UI backup ..." + check_for_backup_dir + get_date + status_msg "Timestamp: $current_date" mkdir -p $BACKUP_DIR/dwc2-backups/"$current_date" - cp -r $DWC2_DIR $_ && ok_msg "Backup complete!" + cp -r $DWC2FK_DIR $_ && $DWC2_DIR $_ + ok_msg "Backup complete!" + else + ERROR_MSG=" Can't backup dwc2-for-klipper and/or dwc2 directory!\n Not found!" fi } -bb4u_mainsail(){ - source_ini - if [ -d $MAINSAIL_DIR ] && [ "$backup_before_update" = "true" ]; then - get_date +backup_mainsail(){ + if [ -d $MAINSAIL_DIR ]; then status_msg "Creating Mainsail backup ..." + check_for_backup_dir + get_date + status_msg "Timestamp: $current_date" mkdir -p $BACKUP_DIR/mainsail-backups/"$current_date" cp -r $MAINSAIL_DIR $_ && ok_msg "Backup complete!" + else + ERROR_MSG=" Can't backup mainsail directory! Not found!" + fi +} + +backup_octoprint(){ + if [ -d $OCTOPRINT_DIR ] && [ -d $OCTOPRINT_CFG_DIR ]; then + status_msg "Creating OctoPrint backup ..." + check_for_backup_dir + get_date + status_msg "Timestamp: $current_date" + mkdir -p $BACKUP_DIR/octoprint-backups/"$current_date" + cp -r $OCTOPRINT_DIR $_ && cp -r $OCTOPRINT_CFG_DIR $_ + ok_msg "Backup complete!" + else + ERROR_MSG=" Can't backup OctoPrint and/or .octoprint directory!\n Not found!" fi } \ No newline at end of file diff --git a/scripts/update.sh b/scripts/update.sh index 73f92ff..2eefde1 100644 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -10,7 +10,7 @@ update_check(){ update_klipper(){ stop_klipper - bb4u_klipper + bb4u "klipper" if [ ! -d $KLIPPER_DIR ]; then cd ${HOME} && git clone $KLIPPER_REPO else @@ -33,7 +33,7 @@ update_klipper(){ update_dwc2fk(){ stop_klipper - bb4u_dwc2fk + bb4u "dwc2" if [ ! -d $DWC2FK_DIR ]; then cd ${HOME} && git clone $DWC2FK_REPO else @@ -48,7 +48,7 @@ update_dwc2fk(){ } update_dwc2(){ - bb4u_dwc2 + bb4u "dwc2" #check dependencies dep=(wget gzip tar curl) dep_check @@ -70,7 +70,7 @@ update_dwc2(){ update_mainsail(){ stop_klipper - bb4u_mainsail + bb4u "mainsail" status_msg "Updating Mainsail ..." install_mainsail start_klipper From 84fc849caf0f7cac8f616a0cc9d92c5ebdb51f96 Mon Sep 17 00:00:00 2001 From: th33xitus <> Date: Fri, 24 Jul 2020 13:12:04 +0200 Subject: [PATCH 46/64] UI stuff --- kiauh.sh | 64 +++++++++++++++++++++++++++++++++++++++++---------- scripts/ui.sh | 16 ++++++------- 2 files changed, 60 insertions(+), 20 deletions(-) diff --git a/kiauh.sh b/kiauh.sh index 5759fd4..9bdfe87 100755 --- a/kiauh.sh +++ b/kiauh.sh @@ -24,7 +24,10 @@ title_msg(){ echo -e "${cyan}$1${default}" } get_date(){ - current_date=`date +"%Y-%m-%d_%H%M%S"` + current_date=$(date +"%Y-%m-%d_%H-%M") +} +print_unkown_cmd(){ + ERROR_MSG=" Sorry i don't know that command!" } ### set important directories @@ -92,7 +95,9 @@ main_menu(){ print_branch main_ui while true; do + echo -e "${cyan}" read -p "Perform action: " action; echo + echo -e "${default}" case "$action" in 0) clear @@ -118,16 +123,15 @@ main_menu(){ break;; 5) clear - print_header - ERROR_MSG=" Sorry this function is not implemented yet!" - print_msg && CONFIRM_MSG="" && ERROR_MSG="" - main_ui;; + backup_menu + break;; Q|q) + echo -e "${green}###### Happy printing! ######${default}"; echo exit -1;; *) clear print_header - ERROR_MSG=" Sorry, i don't know that command!" + print_unkown_cmd print_msg && CONFIRM_MSG="" && ERROR_MSG="" main_ui;; esac @@ -139,7 +143,9 @@ install_menu(){ print_header install_ui while true; do + echo -e "${cyan}" read -p "Perform action: " action; echo + echo -e "${default}" case "$action" in 1) clear @@ -170,7 +176,7 @@ install_menu(){ *) clear print_header - ERROR_MSG=" Sorry, i don't know that command!" + print_unkown_cmd print_msg && CONFIRM_MSG="" && ERROR_MSG="" install_ui;; esac @@ -186,7 +192,9 @@ update_menu(){ ui_print_versions update_ui while true; do + echo -e "${cyan}" read -p "Perform action: " action; echo + echo -e "${default}" case "$action" in 0) clear @@ -223,7 +231,7 @@ update_menu(){ *) clear print_header - ERROR_MSG=" Sorry, i don't know that command!" + print_unkown_cmd print_msg && CONFIRM_MSG="" && ERROR_MSG="" ui_print_versions update_ui;; @@ -236,7 +244,9 @@ remove_menu(){ print_header remove_ui while true; do + echo -e "${cyan}" read -p "Perform action: " action; echo + echo -e "${default}" case "$action" in 1) clear @@ -279,7 +289,7 @@ remove_menu(){ *) clear print_header - ERROR_MSG=" Sorry, i don't know that command!" + print_unkown_cmd print_msg && CONFIRM_MSG="" && ERROR_MSG="" remove_ui;; esac @@ -293,7 +303,9 @@ advanced_menu(){ read_octoprint_service_status advanced_ui while true; do + echo -e "${cyan}" read -p "Perform action: " action; echo + echo -e "${default}" case "$action" in 0) clear @@ -343,7 +355,7 @@ advanced_menu(){ *) clear print_header - ERROR_MSG=" Sorry, i don't know that command!" + print_unkown_cmd print_msg && CONFIRM_MSG="" && ERROR_MSG="" advanced_ui;; esac @@ -357,7 +369,9 @@ switch_menu(){ print_msg && CONFIRM_MSG="" && ERROR_MSG="" switch_ui while true; do + echo -e "${cyan}" read -p "Perform action: " action; echo + echo -e "${default}" case "$action" in 1) clear @@ -396,6 +410,12 @@ switch_menu(){ switch_ui;; Q|q) clear; advanced_menu; break;; + *) + clear + print_header + print_unkown_cmd + print_msg && CONFIRM_MSG="" && ERROR_MSG="" + switch_ui;; esac done else @@ -408,12 +428,32 @@ backup_menu(){ print_msg && CONFIRM_MSG="" && ERROR_MSG="" backup_ui while true; do + echo -e "${cyan}" read -p "Perform action: " action; echo + echo -e "${default}" case "$action" in 1) clear print_header - #function goes here + backup_klipper + print_msg && CONFIRM_MSG="" && ERROR_MSG="" + backup_ui;; + 2) + clear + print_header + backup_dwc2 + print_msg && CONFIRM_MSG="" && ERROR_MSG="" + backup_ui;; + 3) + clear + print_header + backup_mainsail + print_msg && CONFIRM_MSG="" && ERROR_MSG="" + backup_ui;; + 4) + clear + print_header + backup_octoprint print_msg && CONFIRM_MSG="" && ERROR_MSG="" backup_ui;; Q|q) @@ -421,7 +461,7 @@ backup_menu(){ *) clear print_header - ERROR_MSG=" Sorry, i don't know that command!" + print_unkown_cmd print_msg && CONFIRM_MSG="" && ERROR_MSG="" backup_ui;; esac diff --git a/scripts/ui.sh b/scripts/ui.sh index 0a6ac30..d9ce06f 100644 --- a/scripts/ui.sh +++ b/scripts/ui.sh @@ -123,15 +123,15 @@ backup_ui(){ top_border echo -e "| $(title_msg "~~~~~~~~~~~~~~ [ Backup Menu ] ~~~~~~~~~~~~~~") | " hr - echo -e "| | " + echo -e "| ${yellow}Backup location: ~/kiauh-backups${default} | " hr - echo -e "| 1) [ ] | " - echo -e "| 2) [ ] | " - echo -e "| 3) [ ] | " - echo -e "| 4) [ ] | " - echo -e "| 5) [ ] | " - echo -e "| 6) [ ] | " - echo -e "| 7) [ ] | " + echo -e "| Firmware: | " + echo -e "| 1) [Klipper] | " + echo -e "| | " + echo -e "| Webinterface: | " + echo -e "| 2) [DWC2-for-Klipper + DWC2 Web UI] | " + echo -e "| 3) [Mainsail] | " + echo -e "| 4) [OctoPrint] | " echo -e "| | " quit_footer } From 02c6a46a78af75935a1d5bbbcccc2cfe3862305c Mon Sep 17 00:00:00 2001 From: th33xitus <> Date: Fri, 24 Jul 2020 13:21:34 +0200 Subject: [PATCH 47/64] Fix bugs --- scripts/backup.sh | 2 +- scripts/update.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/backup.sh b/scripts/backup.sh index c329534..e62fb6e 100644 --- a/scripts/backup.sh +++ b/scripts/backup.sh @@ -67,7 +67,7 @@ backup_dwc2(){ get_date status_msg "Timestamp: $current_date" mkdir -p $BACKUP_DIR/dwc2-backups/"$current_date" - cp -r $DWC2FK_DIR $_ && $DWC2_DIR $_ + cp -r $DWC2FK_DIR $_ && cp -r $DWC2_DIR $_ ok_msg "Backup complete!" else ERROR_MSG=" Can't backup dwc2-for-klipper and/or dwc2 directory!\n Not found!" diff --git a/scripts/update.sh b/scripts/update.sh index 2eefde1..d2daa1b 100644 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -51,7 +51,7 @@ update_dwc2(){ bb4u "dwc2" #check dependencies dep=(wget gzip tar curl) - dep_check + 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 From f51ba88f64c0371a46977ca536f7a6703a22d759 Mon Sep 17 00:00:00 2001 From: th33xitus <> Date: Fri, 24 Jul 2020 18:00:57 +0200 Subject: [PATCH 48/64] advanced menu: change hostname function --- kiauh.sh | 6 ++++++ scripts/ui.sh | 20 +++++++++++--------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/kiauh.sh b/kiauh.sh index 9bdfe87..dd27a85 100755 --- a/kiauh.sh +++ b/kiauh.sh @@ -350,6 +350,12 @@ advanced_menu(){ create_dwc2fk_cfg print_msg && CONFIRM_MSG="" && ERROR_MSG="" advanced_ui;; + 7) + clear + print_header + create_custom_hostname + print_msg && CONFIRM_MSG="" && ERROR_MSG="" + advanced_ui;; Q|q) clear; main_menu; break;; *) diff --git a/scripts/ui.sh b/scripts/ui.sh index d9ce06f..5ddd738 100644 --- a/scripts/ui.sh +++ b/scripts/ui.sh @@ -107,15 +107,17 @@ advanced_ui(){ hr echo -e "| 0) $OPRINT_SERVICE_STATUS| " hr - echo -e "| | " - echo -e "| 1) [Switch Klipper version] | " - echo -e "| | " - echo -e "| 2) [Build Firmware] | " - echo -e "| 3) [Flash MCU] | " - echo -e "| 4) [Get Printer-ID] | " - echo -e "| 5) [Write Printer-ID to printer.cfg] | " - echo -e "| 6) [Write DWC2-for-Klipper config] | " - echo -e "| | " + echo -e "| | | " + echo -e "| Klipper: | System: | " + echo -e "| 1) [Switch Version] | 7) [Change hostname] | " + echo -e "| | | " + echo -e "| Firmware: | | " + echo -e "| 2) [Build Firmware] | | " + echo -e "| 3) [Flash MCU] | | " + echo -e "| 4) [Get Printer-ID] | | " + echo -e "| 5) [Write Printer-ID] | | " + echo -e "| 6) [Write DWC2 config] | | " + echo -e "| | | " quit_footer } From 876b316af437c464aaccc1bc7f3c720de3e0c640 Mon Sep 17 00:00:00 2001 From: th33xitus <> Date: Fri, 24 Jul 2020 21:44:30 +0200 Subject: [PATCH 49/64] change nginx configs listen to ipv4 only --- resources/dwc2_nginx.cfg | 2 +- resources/octoprint_nginx.cfg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/dwc2_nginx.cfg b/resources/dwc2_nginx.cfg index db8f860..ef7d7bc 100644 --- a/resources/dwc2_nginx.cfg +++ b/resources/dwc2_nginx.cfg @@ -9,7 +9,7 @@ upstream dwc2 { server { listen 80; - listen [::]:80; + #listen [::]:80; location / { proxy_pass http://dwc2/; diff --git a/resources/octoprint_nginx.cfg b/resources/octoprint_nginx.cfg index b35d3cc..c3bdad4 100644 --- a/resources/octoprint_nginx.cfg +++ b/resources/octoprint_nginx.cfg @@ -13,7 +13,7 @@ upstream mjpg-streamer { server { listen 80; - listen [::]:80; + #listen [::]:80; location / { proxy_pass http://octoprint/; From 0a0a9f2f934696d563185a5a6c08c324caae7e9d Mon Sep 17 00:00:00 2001 From: th33xitus <> Date: Fri, 24 Jul 2020 21:44:58 +0200 Subject: [PATCH 50/64] preconfigure octoprint for use with klipper --- resources/octoprint_config.cfg | 10 ++++++++++ scripts/install_octoprint.sh | 10 ++++++++++ 2 files changed, 20 insertions(+) create mode 100644 resources/octoprint_config.cfg diff --git a/resources/octoprint_config.cfg b/resources/octoprint_config.cfg new file mode 100644 index 0000000..9ad22c6 --- /dev/null +++ b/resources/octoprint_config.cfg @@ -0,0 +1,10 @@ +serial: + additionalPorts: + - /tmp/printer + disconnectOnErrors: false + port: /tmp/printer +server: + commands: + serverRestartCommand: sudo service octoprint restart + systemRestartCommand: sudo shutdown -r now + systemShutdownCommand: sudo shutdown -h now diff --git a/scripts/install_octoprint.sh b/scripts/install_octoprint.sh index 159a89e..2cc48fe 100755 --- a/scripts/install_octoprint.sh +++ b/scripts/install_octoprint.sh @@ -6,6 +6,7 @@ octoprint_install_routine(){ add_reboot_permission octoprint_reverse_proxy_dialog create_custom_hostname + create_config_yaml load_server } @@ -114,6 +115,15 @@ octoprint_reverse_proxy_dialog(){ done } +create_config_yaml(){ + if [ ! -d $OCTOPRINT_CFG_DIR ]; then + status_msg "Creating config.yaml ..." + mkdir $OCTOPRINT_CFG_DIR + cp ${HOME}/kiauh/resources/octoprint_config.cfg $OCTOPRINT_CFG_DIR/config.yaml + ok_msg "Config created!" + fi +} + load_server(){ start_octoprint #create an octoprint.log symlink in home-dir just for convenience From 5651ce2d63b21da40fb9dece07e5540fbb16c085 Mon Sep 17 00:00:00 2001 From: th33xitus <31533186+th33xitus@users.noreply.github.com> Date: Fri, 24 Jul 2020 22:07:52 +0200 Subject: [PATCH 51/64] add screenshots --- resources/screenshots/advanced.png | Bin 0 -> 13909 bytes resources/screenshots/main.png | Bin 0 -> 13226 bytes resources/screenshots/remove.png | Bin 0 -> 13103 bytes resources/screenshots/update.png | Bin 0 -> 20901 bytes 4 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 resources/screenshots/advanced.png create mode 100644 resources/screenshots/main.png create mode 100644 resources/screenshots/remove.png create mode 100644 resources/screenshots/update.png diff --git a/resources/screenshots/advanced.png b/resources/screenshots/advanced.png new file mode 100644 index 0000000000000000000000000000000000000000..a63d7fcf81bd413d578a4643e85f92d0ef2c2e68 GIT binary patch literal 13909 zcmb_@d0bLk)HY^iSt@B|<`mgr=5Q;^94RHooGs0XCUeRm#~i8Dq)9U~(i{>898$_L zHN|F?oI*uG#mWf?F%eJ@_>SFs-+RCB_rBl!hxp@g&OU3Oz1Fjzwbpa)IM`W8N$!*c zfk0ALmM|v}NUR_DE8DOhIHE8|c?A3u3wN?G1y%PbQGqXOeNWn+1c6?qZ(6yq4*0$? z)bd<72qgV}^-t_`NZDl&=qSw!cGBg#H)E`|dh&H^^{;RR^89e~dU3|VKh{s(eBZfq z_)b#V+WUvn6kldarH=1p#@vjuVuDBqcwcbkRBhkE~UUQ@DPxM1KJyJjnBezaM5_>K0C2UpAn??v^~-H9%DoE>`a|JNlUj&m9c57z&A zzgcVZqPO6z;^`I#P<#KBd66C@;1LS21k`kTa~jNkQ*g{$Q2P8lx-P;J9mI3{#NG!U-?M3;eG~Kd&5Y znQQqbAYL2GN-t>JWG7*C#B}THq-4LK>$xVqNf1-CLSY}oCGH)@)@9?3J}TB3svBwg?cha zqnm5x^Pfn6!oqKRuluR_$418qTQIs^d1!;9oF7y|e85hAlVeLfPB~e9{@4b`32AQX ztc<}Ir^pYc1GlkjOH^;H{vfT4UdYRA+BJ!v7bYoe$u+4IrAw%ErF(gQp97!4^UFwJ z#gw~#NSbrgzQvV3O)1A#VYS}oehY-?K!``1e5zFcoX62M4n-ioDADNo@FqQVXjDu& z-vUjWfT*<}8ofwJF?D&uXbYxiil98p#c^)x!i+X0(<~i!Gp=e2dI6z~%m8glDU&*> zKmP@0UK*=nH?yWv4R+J;#Wu9F`g)T)5@rJ%KTwbA93SJQNCz0o?tO zR9W=#U8Y+>H>`hq_s~Yi{QZDK?OOdjvDa?q*lrvvbAL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pA6|8APcuY|4r&a^v zHV+B^9}$t&k2^(q2SZtOtoOkUjtVDdZjH+SJ@$Fz_t$^>%qir>eOq&@|3{zx?+^d| jg4KT(L|xcak<8PV{xEJ;2JlK42xN824pwb?{?>m3%5F&w literal 0 HcmV?d00001 diff --git a/resources/screenshots/main.png b/resources/screenshots/main.png new file mode 100644 index 0000000000000000000000000000000000000000..993b06c6ca8a2a254eb4b6d9aa10b856d55b4092 GIT binary patch literal 13226 zcmc(_cUV(f*Do6EVnMNi3Mhz3mw=*F0R@3jBuIxSBp_X>QbO2@AcAxVOGI=Ffl#GO zC{gKzfLls{08tT;guteR7LuHW?)UxPbMN`?bDwkW^V~l&leMzunsbaf=NP~78za`- z)ZhUBNqz_fa=`HBbqffDuMhm(*|Q70^YwLV5ctLCZ(*PdDeXBu177TK(=pM3K*|&M zZQk7pUhlns)7BpXIoQ1Q;cNFTKtdqO+J@J4EFU^Cvl~lCYfj#qcRAg>@|UvEP{_9C zOd;tp;VaMgS#Jyf+P^EMZE{Bk{!6`R?){nX8#`-cv7JX|sdN-q zp|EAcqc;p4mfSDQ@HW{ro)0+g9gU8oU@QKAZ(E@y0x`Jp+aHA>kPjpHpg{jC{U2=- z!~v^%v_FRE8*~i16B0?yEes-axlO}~H&4eQ?ZiZ1=smy52l-lqr|T_U6jvvAr4@q% z)O;G6Rgr~v8qKfP-`NkUWN?T%zuPU}5TF+?fBW3;WF_+m{qXPmR9(-?!EmKmk zyghbWG#Ujy(q+_X#0Rf6{?=A@OIp{g{1OJTI zlQgSx0j{JG)nbTYDxDrk+T#$r7BJFcWCd>Nucc0;dK&}b@ zR)QfgM@Ltd2|wKdfl!?bcweAnH08n*5Xj|rbKY5aBqUgjsLCdCmBKlVb=1#4R|-Ri z8@MAr_1~M@u^-nVKEg=;i`&Kf$_0nf^nC@P3t>y&%I3+86Z#$XW`(n5*~ODQft+!X zX$r~aO^A3|VXz4^EiZp&QJXrFIS8CAM+-db?>Ui*cO)VNko@;WlcYcFhhb;b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-sYC@TViglt(DdleW%vKnVUM~BhMV4 zC0%pWC4nb8`#mf>erAq2J*?bb7)t2}J!;V2;bOpOWR@{+2slZc{e$p(Qa7NNY=3B* zaB7Y;kG1!bccVkBQ15a!z6_x)gt0K*+83Zqu_q0NLR&=FZK@ZC%PUK=}2TUDb4Y?tFmZL$HpPwN!Mv96atDT?ciB9=m?LqBuddp6c}d1TD#K7a=nQsk`tK4^+xpeqh{Md?MHbRoeg~{p=$IvzxCK-k`RM2F-Er z9RIx+lcbmbJ*E!s^S>3m8_-Ss*UkguQV8VY;s4_{7Ng1&o0wScebizKmUBTMhBr*F Km+Ibm^gjS+2rT;m literal 0 HcmV?d00001 diff --git a/resources/screenshots/remove.png b/resources/screenshots/remove.png new file mode 100644 index 0000000000000000000000000000000000000000..cf1f665b5372c926ef6d97a3c8d91a91d1e552c8 GIT binary patch literal 13103 zcmb_?bzIYL`|mJOR2XScjt1Ez6cA*J8!6xbrI~<82%>FD_`QZ0?p7Wg7`NiwRAG`O->%Q;nbH)3L@GE8phYub<2m*l)8yO-j zKp?Iz;OE7?54eKtxULNRars*q=z$74L}!7MJ?eD(L7A&y}ld{NgB3-WK;|=WS55(BI`79hvW%=V%J-I z!_M)e3^lpqha)@`4?1e6HvD;GpuDImUOyuUVk`*o-#thDc(niu<%Q+hncb2<$_&vf z4@1d=Ko`PgN0G$Dq-dR808zzu8I0T6&&AvTFIFUpz?gtQu5~+A-D=$@1>6_$UxPu3 z{ThL@yFfLwuQPCX`A3amg}8hDI8Oi4c;{kWc;I`D_Rf(U3CxHPn#2~>Ir6IsAjHE5 z&KHVqEzet0m*6arn2f^39s{ZRL|;XkM22B22Tfv~6)o(sIk~#$izjy8P7cOO>)=#j z9n($wv4IN&vNeJGl;{3O*89MFZE7+Qz4%e9-r@0rH}~yIPP4a0OO3C~JqgF}(%Fj; zyv`NPhm!KZ?cLieE+T-kC(-sp4larEp&so$CDKJHd7ZU_56=}sgN@N3FzV6t9WQVK zCAICZm$Z?bPFcw35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sRVdfOS_o%cgn#}w<;n_-# z7S3s8W)V9G>zkEMinV2D!>7piW4>&8kgOZ`JUffV&GP(^t5eyO(`?|4|DjO4y^ z(QIv_)r&~8zU&^&+8_=FQF3slzj1@qssj1Af~&@l_FJ!fq&MUWb;WKoCc_XVul}{n znFdIt!wb<2=!vndJqT!VQ4TWT;RB0EQ)f2N!CtLkh^)BH^0rfYHy`0q$p*Bo2HT`h zgr+y0s#gV@8o1Qj0R?{FZg9BSfh;bNrrIZj)%QU6WnW$PFlGrW&^8GcKwU)WbsMuG zE+@MpCOJpJVp3nHGPW1cq%z`J#PsHRA)pS{IF5g=@`s}gISH+Q$;r*g+_$v5y^$rq z!xo<06QOry!}jhMUXI5fAG@MEp!4uz@rD)K1ZlMtB#yRv6GW!B1hG^W7abC9#OfQJ zg9-*FaPIqWlh|`ryTA$D=j0}IPmTrrz04rU!D$)kRA{<7pwj!mp^yK`kpD%Z`A|o> r59FB09|qMV{awiXFUNOV_M05=n{v;i!8{KD?F1Pi%@758*Pr|kh@Php literal 0 HcmV?d00001 diff --git a/resources/screenshots/update.png b/resources/screenshots/update.png new file mode 100644 index 0000000000000000000000000000000000000000..7ef37678f7a672f014073c375b2037c07779a122 GIT binary patch literal 20901 zcmeFZcT`hdw>OF)U8IYO8V~^i0V_xi1d%49^d1Be=?Vx^l8AzcC`6@63uq{zij>f! zQUxJO?@XNY<9>hLJI4JZn_ZH<=9+WOIe)V(60cn~5fV5o zz`?;GWM+EFnuBA{An>8{@c?)3w;$^P{_F|0Hi2+d4jdr@7khmSEe$z1s#63RH@Jao z{yU~lp&T6h+jl>Ex`Rt@a&TPNHoIhKd*6MfwY74&>va{P^2d>VT@NXFZIAcVSAD4Y zCZ-UkV37Fe=mnYfWNydUh;dHcZ;7hKLfisJ8QVgqjC+$|-2U%BQ>(B~jSrNOl1{yx zIf45A(YZf^Oto*tRr6sJscbXxkJ>! z>7a~!RTFztt406KjgY_r#W)EL4$5a@SWu<9djGvoZ_cQoGp77Qn`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sKxh#)7Y-Z0|q&JcSEmLETBZYXX&?^VasYE}l1`%ffOl&|Ts zLUCIZjKA*pgjSWBs};Ii(OvKS3U`gBCgkQwLB)eELsT~C58z0sjrORmVv}@03G0xL z@0dCJ;g28@EZWoJu3wBjuacyPkw~8T2LbdRFlW!*v?930Fj_fY$?(>T=OF%oj5tYeYV8p?L(V=x$t!u&gsD7gm?;^;PcQ zf&>O24O&oc<#6GJiJ7cLwNf!5VS9}Ooq4XFCRA|HKE)=k%hm;A0cX9TMz>kyvTI>-vMX`T*VthW28eDI98i@|7{7KX0b1mDYCt8kvP1t9`+JHMu3n zLv7_=S_DGXw=?OZ%6uC2YL0)uHuCcjvgwESW6p~XrqELI*ULke7HnAvsPlw zcq2BviuV3OzV?hidzyi+SSJJ!=Z0``0|_B6+QN)w>DXmj>|X4AtP1xpfJD~~euC9D z1C@=_&JRs?#issJpd)-v=IZ>|vOb~ip2%kU&eYG`IaP5R_?~3h2xMAxIi7W#()49t zD&8(!qPu+KOq4Dh`Gm~*5;}!KF*;4L+BIU0q#h|gk1`xZt2=NE+MD7=^lb~GneXwh zTA$DmQXS95SAHh-8zA@Bd#xo(d6*JrcoSmZt4n6e@Vo4x7ZOcpB~*0mS6fQ1&n5RJ z`_4PvVw_P*jOrO`N&dV*)7@xisjBT&vS+zN7F@x^$hF%-vnIq*&8N#99yWya8UMVw zB!nWm)jtYPJbsoS6;*A*W@W{?K1qCk=~}KGdH7t v0X(j!?>+G122KWiHUU)Tf3_~;Be{s71QS6a4*Dy|hA1aT*Mqm9qZfVyjiQ1R literal 0 HcmV?d00001 From 37b23129c010efc0b74a8a3c970dca6d956b392b Mon Sep 17 00:00:00 2001 From: th33xitus <31533186+th33xitus@users.noreply.github.com> Date: Fri, 24 Jul 2020 23:05:24 +0200 Subject: [PATCH 52/64] Update README.md --- README.md | 75 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 40 insertions(+), 35 deletions(-) diff --git a/README.md b/README.md index 5f823d2..c9c0518 100644 --- a/README.md +++ b/README.md @@ -4,22 +4,23 @@ ## Klipper Installation And Update Helper -[![kiauh](https://abload.de/img/mobaxterm_personal_207mk20.png)](https://abload.de/image.php?img=mobaxterm_personal_207mk20.png) - -This script was actually created for my personal use only but i then decided to make the script accessible for everyone. -~~It is meant to help guiding you through a complete fresh install of Klipper and optionally the DWC2 web UI + DWC2-for-Klipper. -There are also functions for updating your current installations or removing them from your system.~~ +![main_menu](https://raw.githubusercontent.com/th33xitus/kiauh/dev-2.0/resources/screenshots/main.png) +![remove_menu](https://raw.githubusercontent.com/th33xitus/kiauh/dev-2.0/resources/screenshots/remove.png) +![update_menu](https://raw.githubusercontent.com/th33xitus/kiauh/dev-2.0/resources/screenshots/update.png) +![advanced_menu](https://raw.githubusercontent.com/th33xitus/kiauh/dev-2.0/resources/screenshots/advanced.png) ## First things first: When you decide to use this script, you use it at your own risk! -Give it a try if you want and if you have suggestions or encounter any problems, please report them. But i can't guarantee that i will fix them immediately (or at all). +Give it a try if you want and if you have suggestions or encounter any problems, please report them to me. ## Instructions: -In order to run this script you have to make it executable. Use the following commands in the given order to download and execute the script. -Make sure you don't skip checking out the development branch if you want to use this new version of the script. +If you don't have git already installed on your machine run `sudo apt-get install git -y` to install git first. You will need it anyways! -``` +After you have successfully installed git, use the following commands in the given order to download and execute the script. +Make sure you **don't skip checking out the development branch** if you want to use this new version of the script. + +```shell cd ~ git clone https://github.com/th33xitus/kiauh.git cd kiauh && git checkout dev-2.0 @@ -31,39 +32,43 @@ chmod +x ~/kiauh/scripts/* ## Restrictions: - Tested only on Raspbian Buster Lite -- Prevent simultaneous use of DWC2 and OctoPrint. There have been reports that DWC2 does strange things while the OctoPrint service is running while using the DWC2 web interface. The script disables an existing OctoPrint service when installing DWC2. However, the service can also be reactivated with the script! +- Prevent simultaneous use of DWC2 and OctoPrint if possible. There have been reports that DWC2 does strange things while the OctoPrint service is running while using the DWC2 webinterface. The script disables an existing OctoPrint service when installing DWC2. However, the service can also be reactivated with the script! + +## Notes: + +During the use of this script you will be asked for your sudo password. There are several functions involved which need sudo privileges. ## Functions and Features: -- Installing: - - Klipper - - dwc2-for-klipper + Duet Web Control - - Moonraker + Mainsail - - OctoPrint -- Updating: - - Klipper - - dwc2-for-klipper + Duet Web Control - - Moonraker + Mainsail -- Removing: - - - Klipper - - dwc2-for-klipper + Duet Web Control - - Moonraker + Mainsail - - OctoPrint - +### Core Functions: +- **Install:** Klipper Firmware, dwc2-for-klipper + Duet Web Control, Moonraker + Mainsail, OctoPrint +- **Update:** Klipper Firmware, dwc2-for-klipper + Duet Web Control, Moonraker + Mainsail +- **Backup:** Klipper Firmware, dwc2-for-klipper + Duet Web Control, Moonraker + Mainsail, OctoPrint +- **Remove:** Klipper Firmware, dwc2-for-klipper + Duet Web Control, Moonraker + Mainsail, OctoPrint - Build Klipper Firmware - Flash MCU -- Read ID of currently connected printer +- Read ID of the currently connected printer (only one at the time) - Write several entries to your printer.cfg, some of them customizable right in the console -- Switch between Klipper Forks: - - scurve-shaping - - scurve-smoothing - - moonraker - - dev-moonraker -- Toggle auto-create backups before updating -- Toggle OctoPrint Service (usefull when using DWC2/Mainsail and Octoprint at the same time) + - Before writing to an existing printer.cfg the script will create a backup! (better safe than sorry!) -- Set up reverse proxy for Mainsail/OctoPrint +### Features: +- Automatic dependency check: + - If packages are missing on your machine but needed for the asked task, the script will automatically install them +- Switch between Klipper Forks: + - origin/master, scurve-shaping, scurve-smoothing, moonraker, dev-moonraker + - The update function of the script will always update the currently selected/active fork! +- Toggle auto-create backups before updating: + - When enabled, a backup of the installation you want to update is made prior updating +- Preconfigure OctoPrint: + - When installing OctoPrint, a config is created which preconfigures your installation to be used with Klipper + - adding the restart/shutdown commands for OctoPrint + - adding the serial port `/tmp/printer` + - set the behavior to "Cancel any ongoing prints but stay connected to the printer" +- Enable/Disable OctoPrint Service: + - Usefull when using DWC2/Mainsail and Octoprint at the same time to prevent them interfering with each other +- Set up reverse proxy for DWC2, Mainsail and OctoPrint and changing the hostname: + - The script can install and configure Nginx for the selected webinterface. This will allow you to make your webinterface reachable over an URL like `.local` + - Example: If you name the host "mainsail" and set up a reverse proxy, type `mainsail.local` in your webbrowser to open the Mainsail webinterface tbc ... From 6c4e6b057e5ca920725c066dd6d65b4d5b0f63ba Mon Sep 17 00:00:00 2001 From: th33xitus <31533186+th33xitus@users.noreply.github.com> Date: Fri, 24 Jul 2020 23:08:12 +0200 Subject: [PATCH 53/64] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c9c0518..4dca266 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ Give it a try if you want and if you have suggestions or encounter any problems, If you don't have git already installed on your machine run `sudo apt-get install git -y` to install git first. You will need it anyways! After you have successfully installed git, use the following commands in the given order to download and execute the script. + Make sure you **don't skip checking out the development branch** if you want to use this new version of the script. ```shell @@ -65,7 +66,7 @@ During the use of this script you will be asked for your sudo password. There ar - adding the serial port `/tmp/printer` - set the behavior to "Cancel any ongoing prints but stay connected to the printer" - Enable/Disable OctoPrint Service: - - Usefull when using DWC2/Mainsail and Octoprint at the same time to prevent them interfering with each other + - Usefull when using DWC2/Mainsail and OctoPrint at the same time to prevent them interfering with each other - Set up reverse proxy for DWC2, Mainsail and OctoPrint and changing the hostname: - The script can install and configure Nginx for the selected webinterface. This will allow you to make your webinterface reachable over an URL like `.local` - Example: If you name the host "mainsail" and set up a reverse proxy, type `mainsail.local` in your webbrowser to open the Mainsail webinterface From e0b9a1ef3bdf0dfd3a31d38ff877b4104b6f5426 Mon Sep 17 00:00:00 2001 From: th33xitus <31533186+th33xitus@users.noreply.github.com> Date: Fri, 24 Jul 2020 23:09:06 +0200 Subject: [PATCH 54/64] Update README.md --- README.md | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 4dca266..0a06f61 100644 --- a/README.md +++ b/README.md @@ -30,14 +30,11 @@ chmod +x ~/kiauh/scripts/* ./kiauh.sh ``` -## Restrictions: - -- Tested only on Raspbian Buster Lite -- Prevent simultaneous use of DWC2 and OctoPrint if possible. There have been reports that DWC2 does strange things while the OctoPrint service is running while using the DWC2 webinterface. The script disables an existing OctoPrint service when installing DWC2. However, the service can also be reactivated with the script! - ## Notes: -During the use of this script you will be asked for your sudo password. There are several functions involved which need sudo privileges. +- Tested only on Raspbian Buster Lite +- During the use of this script you will be asked for your sudo password. There are several functions involved which need sudo privileges. +- Prevent simultaneous use of DWC2 and OctoPrint if possible. There have been reports that DWC2 does strange things while the OctoPrint service is running while using the DWC2 webinterface. The script disables an existing OctoPrint service when installing DWC2. However, the service can also be reactivated with the script! ## Functions and Features: From a76cab0fe6ec18950a868bc54b829be6f5cb0054 Mon Sep 17 00:00:00 2001 From: th33xitus <> Date: Sat, 25 Jul 2020 13:16:04 +0200 Subject: [PATCH 55/64] restructure install/update for dwc2 --- scripts/update.sh | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/scripts/update.sh b/scripts/update.sh index d2daa1b..1cb3446 100644 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -1,8 +1,6 @@ #TODO -# - update the correct branch # - version checks before updating -#WIP update_check(){ read_local_commit read_remote_commit @@ -49,23 +47,7 @@ update_dwc2fk(){ update_dwc2(){ bb4u "dwc2" - #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!" + install_dwc2 } update_mainsail(){ From 64a7dec09d0a31f90002fe13b450165567013ca2 Mon Sep 17 00:00:00 2001 From: th33xitus <> Date: Sat, 25 Jul 2020 13:16:37 +0200 Subject: [PATCH 56/64] Fix UI stuff --- kiauh.sh | 19 +++++++++++++------ scripts/install_dwc2.sh | 21 ++++++++++++++++++--- scripts/status.sh | 24 +++++++++++++++++++----- 3 files changed, 50 insertions(+), 14 deletions(-) diff --git a/kiauh.sh b/kiauh.sh index dd27a85..1524c63 100755 --- a/kiauh.sh +++ b/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 } diff --git a/scripts/install_dwc2.sh b/scripts/install_dwc2.sh index 0a1aec2..a1a3aad 100644 --- a/scripts/install_dwc2.sh +++ b/scripts/install_dwc2.sh @@ -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(){ diff --git a/scripts/status.sh b/scripts/status.sh index 7f7c65d..dfc6335 100644 --- a/scripts/status.sh +++ b/scripts/status.sh @@ -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(){ From 22888f57566ee9017edfce53c53c2d56f144c7b1 Mon Sep 17 00:00:00 2001 From: th33xitus <> Date: Sat, 25 Jul 2020 20:57:32 +0200 Subject: [PATCH 57/64] simple startup update check for KIAUH --- kiauh.sh | 13 ++++++++++++- scripts/status.sh | 13 +++++++++++++ scripts/ui.sh | 7 +++++++ scripts/update.sh | 8 ++++++++ 4 files changed, 40 insertions(+), 1 deletion(-) diff --git a/kiauh.sh b/kiauh.sh index 1524c63..190ad98 100755 --- a/kiauh.sh +++ b/kiauh.sh @@ -93,19 +93,29 @@ print_msg(){ main_menu(){ print_header - print_msg && CONFIRM_MSG="" && ERROR_MSG="" + #print KIAUH update msg if update available + if [ $KIAUH_UPDATE_AVAIL = 1 ]; then + kiauh_update_msg + fi #check install status klipper_status dwc2_status mainsail_status octoprint_status print_branch + print_msg && CONFIRM_MSG="" && ERROR_MSG="" main_ui while true; do echo -e "${cyan}" read -p "Perform action: " action; echo echo -e "${default}" case "$action" in + update) + clear + print_header + update_kiauh + print_msg && CONFIRM_MSG="" && ERROR_MSG="" + main_ui;; 0) clear print_header @@ -487,4 +497,5 @@ SRCDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/.. && pwd )" for script in ${SRCDIR}/kiauh/scripts/*; do . $script; done check_euid +kiauh_status main_menu \ No newline at end of file diff --git a/scripts/status.sh b/scripts/status.sh index dfc6335..ac74d77 100644 --- a/scripts/status.sh +++ b/scripts/status.sh @@ -1,3 +1,16 @@ +kiauh_status(){ + cd ${HOME}/kiauh + #get local state + LOCAL_KIAUH_COMMIT=$(git rev-parse --short=8 HEAD) + #REMOTE_KIAUH_COMMIT=$(git rev-parse --short=8 origin/master) + REMOTE_KIAUH_COMMIT=$(git rev-parse --short=8 dev-2.0) + if [ "$LOCAL_KIAUH_COMMIT" != "$REMOTE_KIAUH_COMMIT" ]; then + KIAUH_UPDATE_AVAIL=1 + else + KIAUH_UPDATE_AVAIL=0 + fi +} + klipper_status(){ kcount=0 klipper_data=( diff --git a/scripts/ui.sh b/scripts/ui.sh index 5ddd738..97fba1d 100644 --- a/scripts/ui.sh +++ b/scripts/ui.sh @@ -154,4 +154,11 @@ switch_ui(){ echo -e "| 4) [--> moonraker] | " echo -e "| 5) [--> dev-moonraker] | " quit_footer +} + +kiauh_update_msg(){ + top_border + echo -e "| ${yellow}There is a newer version of this script available!${default} | " + echo -e "| ${yellow}Type 'update' if you want to update KIAUH now.${default} | " + bottom_border } \ No newline at end of file diff --git a/scripts/update.sh b/scripts/update.sh index 1cb3446..7d8f258 100644 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -6,6 +6,14 @@ update_check(){ read_remote_commit } +update_kiauh(){ + if [ $KIAUH_UPDATE_AVAIL = 1 ]; then + status_msg "Updating KIAUH ..." + cd ${HOME}/kiauh + git pull && ok_msg "Update complete! Please restart KIAUH."; echo + fi +} + update_klipper(){ stop_klipper bb4u "klipper" From e5e135c68b8b47658cf69556ae85ce865fb115f7 Mon Sep 17 00:00:00 2001 From: th33xitus <> Date: Sun, 26 Jul 2020 12:36:05 +0200 Subject: [PATCH 58/64] add confirmation messages --- scripts/install_mainsail.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install_mainsail.sh b/scripts/install_mainsail.sh index a192581..ee47db3 100644 --- a/scripts/install_mainsail.sh +++ b/scripts/install_mainsail.sh @@ -70,7 +70,7 @@ check_vsdcard_section(){ ok_msg "Virtual sdcard already configured!" else status_msg "No virtual sdcard entry found." - status_msg "Configuring virtual sdcard..." + ok_msg "Virtual sdcard entry added to printer.cfg!" # append the following lines to printer.cfg cat <> $PRINTER_CFG @@ -92,7 +92,7 @@ check_api_section(){ ok_msg "API Server already configured" else status_msg "No API Server entry found." - status_msg "Configuring API server..." + ok_msg "API server entry added to printer.cfg!" # append the following lines to printer.cfg cat <> $PRINTER_CFG From da57fe7ccc672c227f905df5dcae529f8d274b2b Mon Sep 17 00:00:00 2001 From: th33xitus <> Date: Sun, 26 Jul 2020 15:16:29 +0200 Subject: [PATCH 59/64] fix bug --- scripts/status.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/status.sh b/scripts/status.sh index ac74d77..d07e23e 100644 --- a/scripts/status.sh +++ b/scripts/status.sh @@ -157,7 +157,7 @@ read_remote_klipper_commit(){ if [ "$GET_BRANCH" == "origin/master" ]; then git fetch origin master -q else - git fetch $GET_BRANCH -q + git fetch $(echo "$GET_BRANCH" | cut -d"/" -f1) -q fi REMOTE_COMMIT=$(git rev-parse --short=8 $GET_BRANCH) else From 303c96cbb1e7f111c95b6948c944c7c334e2c1e9 Mon Sep 17 00:00:00 2001 From: th33xitus <> Date: Sun, 26 Jul 2020 18:10:45 +0200 Subject: [PATCH 60/64] remove hint msg -> useless --- kiauh.sh | 105 ++++++++++++++++++++++------------------------ scripts/status.sh | 4 -- 2 files changed, 51 insertions(+), 58 deletions(-) diff --git a/kiauh.sh b/kiauh.sh index 190ad98..4d99a5a 100755 --- a/kiauh.sh +++ b/kiauh.sh @@ -52,7 +52,7 @@ OCTOPRINT_CFG_DIR=${HOME}/.octoprint OCTOPRINT_SERVICE1=/etc/init.d/octoprint OCTOPRINT_SERVICE2=/etc/default/octoprint #misc -INI_DIR=${HOME}/kiauh/kiauh.ini +INI_FILE=${HOME}/kiauh/kiauh.ini BACKUP_DIR=${HOME}/kiauh-backups PRINTER_CFG=${HOME}/printer.cfg @@ -75,13 +75,6 @@ print_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 "#########################################################" @@ -91,6 +84,10 @@ print_msg(){ fi } +clear_msg(){ + CONFIRM_MSG="" && ERROR_MSG="" +} + main_menu(){ print_header #print KIAUH update msg if update available @@ -103,7 +100,7 @@ main_menu(){ mainsail_status octoprint_status print_branch - print_msg && CONFIRM_MSG="" && ERROR_MSG="" + print_msg && clear_msg main_ui while true; do echo -e "${cyan}" @@ -114,13 +111,13 @@ main_menu(){ clear print_header update_kiauh - print_msg && CONFIRM_MSG="" && ERROR_MSG="" + print_msg && clear_msg main_ui;; 0) clear print_header ERROR_MSG="Sorry this function is not implemented yet!" - print_msg && CONFIRM_MSG="" && ERROR_MSG="" + print_msg && clear_msg main_ui;; 1) clear @@ -149,7 +146,7 @@ main_menu(){ clear print_header print_unkown_cmd - print_msg && CONFIRM_MSG="" && ERROR_MSG="" + print_msg && clear_msg main_ui;; esac done @@ -168,25 +165,25 @@ install_menu(){ clear print_header install_klipper - print_msg && CONFIRM_MSG="" && ERROR_MSG="" + print_msg && clear_msg install_ui;; 2) clear print_header dwc2_install_routine - print_msg && CONFIRM_MSG="" && ERROR_MSG="" + print_msg && clear_msg install_ui;; 3) clear print_header mainsail_install_routine - print_msg && CONFIRM_MSG="" && ERROR_MSG="" + print_msg && clear_msg install_ui;; 4) clear print_header octoprint_install_routine - print_msg && CONFIRM_MSG="" && ERROR_MSG="" + print_msg && clear_msg install_ui;; Q|q) clear; main_menu; break;; @@ -194,7 +191,7 @@ install_menu(){ clear print_header print_unkown_cmd - print_msg && CONFIRM_MSG="" && ERROR_MSG="" + print_msg && clear_msg install_ui;; esac done @@ -205,7 +202,7 @@ update_menu(){ print_header #compare versions ui_print_versions - print_msg && CONFIRM_MSG="" && HINT_MSG="" && ERROR_MSG="" + print_msg && clear_msg read_bb4u_stat update_ui while true; do @@ -217,31 +214,31 @@ update_menu(){ clear print_header toggle_backups - print_msg && CONFIRM_MSG="" && ERROR_MSG="" + print_msg && clear_msg update_ui;; 1) clear print_header update_klipper && ui_print_versions - print_msg && CONFIRM_MSG="" && ERROR_MSG="" + print_msg && clear_msg update_ui;; 2) clear print_header update_dwc2fk && ui_print_versions - print_msg && CONFIRM_MSG="" && ERROR_MSG="" + print_msg && clear_msg update_ui;; 3) clear print_header update_dwc2 && ui_print_versions - print_msg && CONFIRM_MSG="" && ERROR_MSG="" + print_msg && clear_msg update_ui;; 4) clear print_header update_mainsail && ui_print_versions - print_msg && CONFIRM_MSG="" && ERROR_MSG="" + print_msg && clear_msg update_ui;; Q|q) clear; main_menu; break;; @@ -249,7 +246,7 @@ update_menu(){ clear print_header print_unkown_cmd - print_msg && CONFIRM_MSG="" && ERROR_MSG="" + print_msg && clear_msg ui_print_versions update_ui;; esac @@ -269,37 +266,37 @@ remove_menu(){ clear print_header remove_klipper - print_msg && CONFIRM_MSG="" && ERROR_MSG="" + print_msg && clear_msg remove_ui;; 2) clear print_header remove_dwc2 - print_msg && CONFIRM_MSG="" && ERROR_MSG="" + print_msg && clear_msg remove_ui;; 3) clear print_header remove_mainsail - print_msg && CONFIRM_MSG="" && ERROR_MSG="" + print_msg && clear_msg remove_ui;; 4) clear print_header remove_octoprint - print_msg && CONFIRM_MSG="" && ERROR_MSG="" + print_msg && clear_msg remove_ui;; 5) clear print_header remove_tornado - print_msg && CONFIRM_MSG="" && ERROR_MSG="" + print_msg && clear_msg remove_ui;; 6) clear print_header remove_nginx - print_msg && CONFIRM_MSG="" && ERROR_MSG="" + print_msg && clear_msg remove_ui;; Q|q) clear; main_menu; break;; @@ -307,7 +304,7 @@ remove_menu(){ clear print_header print_unkown_cmd - print_msg && CONFIRM_MSG="" && ERROR_MSG="" + print_msg && clear_msg remove_ui;; esac done @@ -316,7 +313,7 @@ remove_menu(){ advanced_menu(){ print_header - print_msg && CONFIRM_MSG="" && ERROR_MSG="" + print_msg && clear_msg read_octoprint_service_status advanced_ui while true; do @@ -329,49 +326,49 @@ advanced_menu(){ print_header toggle_octoprint_service read_octoprint_service_status - print_msg && CONFIRM_MSG="" && ERROR_MSG="" + print_msg && clear_msg advanced_ui;; 1) clear print_header switch_menu - print_msg && CONFIRM_MSG="" && ERROR_MSG="" + print_msg && clear_msg advanced_ui;; 2) clear print_header build_fw - print_msg && CONFIRM_MSG="" && ERROR_MSG="" + print_msg && clear_msg advanced_ui;; 3) clear print_header flash_routine - print_msg && CONFIRM_MSG="" && ERROR_MSG="" + print_msg && clear_msg advanced_ui;; 4) clear print_header get_usb_id - print_msg && CONFIRM_MSG="" && ERROR_MSG="" + print_msg && clear_msg advanced_ui;; 5) clear print_header get_usb_id && write_printer_id - print_msg && CONFIRM_MSG="" && ERROR_MSG="" + print_msg && clear_msg advanced_ui;; 6) clear print_header create_dwc2fk_cfg - print_msg && CONFIRM_MSG="" && ERROR_MSG="" + print_msg && clear_msg advanced_ui;; 7) clear print_header create_custom_hostname - print_msg && CONFIRM_MSG="" && ERROR_MSG="" + print_msg && clear_msg advanced_ui;; Q|q) clear; main_menu; break;; @@ -379,7 +376,7 @@ advanced_menu(){ clear print_header print_unkown_cmd - print_msg && CONFIRM_MSG="" && ERROR_MSG="" + print_msg && clear_msg advanced_ui;; esac done @@ -389,7 +386,7 @@ advanced_menu(){ switch_menu(){ if [ -d $KLIPPER_DIR ]; then read_branch - print_msg && CONFIRM_MSG="" && ERROR_MSG="" + print_msg && clear_msg switch_ui while true; do echo -e "${cyan}" @@ -401,35 +398,35 @@ switch_menu(){ print_header switch_to_origin read_branch - print_msg && CONFIRM_MSG="" && ERROR_MSG="" + print_msg && clear_msg switch_ui;; 2) clear print_header switch_to_scurve_shaping read_branch - print_msg && CONFIRM_MSG="" && ERROR_MSG="" + print_msg && clear_msg switch_ui;; 3) clear print_header switch_to_scurve_smoothing read_branch - print_msg && CONFIRM_MSG="" && ERROR_MSG="" + print_msg && clear_msg switch_ui;; 4) clear print_header switch_to_moonraker read_branch - print_msg && CONFIRM_MSG="" && ERROR_MSG="" + print_msg && clear_msg switch_ui;; 5) clear print_header switch_to_dev_moonraker read_branch - print_msg && CONFIRM_MSG="" && ERROR_MSG="" + print_msg && clear_msg switch_ui;; Q|q) clear; advanced_menu; break;; @@ -437,7 +434,7 @@ switch_menu(){ clear print_header print_unkown_cmd - print_msg && CONFIRM_MSG="" && ERROR_MSG="" + print_msg && clear_msg switch_ui;; esac done @@ -448,7 +445,7 @@ switch_menu(){ backup_menu(){ print_header - print_msg && CONFIRM_MSG="" && ERROR_MSG="" + print_msg && clear_msg backup_ui while true; do echo -e "${cyan}" @@ -459,25 +456,25 @@ backup_menu(){ clear print_header backup_klipper - print_msg && CONFIRM_MSG="" && ERROR_MSG="" + print_msg && clear_msg backup_ui;; 2) clear print_header backup_dwc2 - print_msg && CONFIRM_MSG="" && ERROR_MSG="" + print_msg && clear_msg backup_ui;; 3) clear print_header backup_mainsail - print_msg && CONFIRM_MSG="" && ERROR_MSG="" + print_msg && clear_msg backup_ui;; 4) clear print_header backup_octoprint - print_msg && CONFIRM_MSG="" && ERROR_MSG="" + print_msg && clear_msg backup_ui;; Q|q) clear; main_menu; break;; @@ -485,7 +482,7 @@ backup_menu(){ clear print_header print_unkown_cmd - print_msg && CONFIRM_MSG="" && ERROR_MSG="" + print_msg && clear_msg backup_ui;; esac done diff --git a/scripts/status.sh b/scripts/status.sh index d07e23e..45918ac 100644 --- a/scripts/status.sh +++ b/scripts/status.sh @@ -162,7 +162,6 @@ read_remote_klipper_commit(){ REMOTE_COMMIT=$(git rev-parse --short=8 $GET_BRANCH) else REMOTE_COMMIT="${red}--------${default}" - HINT_MSG="Can't fetch all remote versions!\n No git repo available or curl not installed!" fi } @@ -189,7 +188,6 @@ 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 } @@ -218,7 +216,6 @@ 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) fi @@ -250,7 +247,6 @@ 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 MAINSAIL_REMOTE_VER=$MAINSAIL_VERSION From 6f302088632eb8f16f51c4969ce46f9820f269f8 Mon Sep 17 00:00:00 2001 From: th33xitus <> Date: Sun, 26 Jul 2020 18:11:22 +0200 Subject: [PATCH 61/64] rename INI_DIR to INI_FILE --- scripts/backup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/backup.sh b/scripts/backup.sh index e62fb6e..2f98411 100644 --- a/scripts/backup.sh +++ b/scripts/backup.sh @@ -28,12 +28,12 @@ read_bb4u_stat(){ toggle_backups(){ source_ini if [ "$backup_before_update" = "true" ]; then - sed -i '/backup_before_update=/s/true/false/' $INI_DIR + sed -i '/backup_before_update=/s/true/false/' $INI_FILE BB4U_STATUS="${green}[Enable]${default} backups before updating " CONFIRM_MSG=" Backups before updates are now >>> DISABLED <<< !" fi if [ "$backup_before_update" = "false" ]; then - sed -i '/backup_before_update=/s/false/true/' $INI_DIR + sed -i '/backup_before_update=/s/false/true/' $INI_FILE BB4U_STATUS="${red}[Disable]${default} backups before updating " CONFIRM_MSG=" Backups before updates are now >>> ENABLED <<< !" fi From dc4cc590385b2ab223bd61338c1a34cc083d841c Mon Sep 17 00:00:00 2001 From: th33xitus <> Date: Sun, 26 Jul 2020 18:15:36 +0200 Subject: [PATCH 62/64] before updating, save the current klipper commit state in ini --- kiauh.ini | 8 +++++++- scripts/update.sh | 30 +++++++++++++++++++++++++++++- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/kiauh.ini b/kiauh.ini index 984cb48..b2f72f5 100644 --- a/kiauh.ini +++ b/kiauh.ini @@ -1 +1,7 @@ -backup_before_update=false \ No newline at end of file +#don't edit this file if you don't know what you are doing... +backup_before_update=false +previous_origin_state=25a9a32e +previous_smoothing_state=feb966c1 +previous_shaping_state=e0b94b7f +previous_moonraker_state=9c29a4fc +previous_dev_moonraker_state=528f9f25 \ No newline at end of file diff --git a/scripts/update.sh b/scripts/update.sh index 7d8f258..e7aefed 100644 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -16,11 +16,12 @@ update_kiauh(){ update_klipper(){ stop_klipper - bb4u "klipper" if [ ! -d $KLIPPER_DIR ]; then cd ${HOME} && git clone $KLIPPER_REPO else + bb4u "klipper" read_branch + save_klipper_state status_msg "Updating $GET_BRANCH" #fetching origin/master -> error #rewriting origin/master to origin @@ -64,4 +65,31 @@ update_mainsail(){ status_msg "Updating Mainsail ..." install_mainsail start_klipper +} + +save_klipper_state(){ + source_ini + #read current klipper state + COMMIT_STATE=$(git rev-parse --short HEAD) + if [ $GET_BRANCH = origin/master ]; then + ORI_OLD=$previous_origin_state + ORI_NEW=$COMMIT_STATE + sed -i "/previous_origin_state=/s/$ORI_OLD/$ORI_NEW/" $INI_FILE + elif [ $GET_BRANCH = dmbutyugin/scurve-shaping ]; then + SHA_OLD=$previous_shaping_state + SHA_NEW=$COMMIT_STATE + sed -i "/previous_shaping_state=/s/$SHA_OLD/$SHA_NEW/" $INI_FILE + elif [ $GET_BRANCH = dmbutyugin/scurve-smoothing ]; then + SMO_OLD=$previous_smoothing_state + SMO_NEW=$COMMIT_STATE + sed -i "/previous_smoothing_state=/s/$SMO_OLD/$SMO_NEW/" $INI_FILE + elif [ $GET_BRANCH = Arksine/work-web_server-20200131 ]; then + WWS_OLD=$previous_moonraker_state + WWS_NEW=$COMMIT_STATE + sed -i "/previous_moonraker_state=/s/$WWS_OLD/$WWS_NEW/" $INI_FILE + elif [ $GET_BRANCH = Arksine/dev-moonraker-testing ]; then + DMT_OLD=$previous_dev_moonraker_state + DMT_NEW=$COMMIT_STATE + sed -i "/previous_dev_moonraker_state=/s/$DMT_OLD/$DMT_NEW/" $INI_FILE + fi } \ No newline at end of file From 82d76b18f006a4b9c48b07f17c64b54cf4176f6b Mon Sep 17 00:00:00 2001 From: th33xitus <> Date: Mon, 27 Jul 2020 10:29:28 +0200 Subject: [PATCH 63/64] new rollback feature --- kiauh.ini | 10 ++--- kiauh.sh | 22 ++++++++--- scripts/rollback.sh | 92 +++++++++++++++++++++++++++++++++++++++++++++ scripts/status.sh | 10 ++--- scripts/ui.sh | 34 +++++++++++++---- scripts/update.sh | 27 ------------- 6 files changed, 146 insertions(+), 49 deletions(-) create mode 100755 scripts/rollback.sh diff --git a/kiauh.ini b/kiauh.ini index b2f72f5..71c376d 100644 --- a/kiauh.ini +++ b/kiauh.ini @@ -1,7 +1,7 @@ #don't edit this file if you don't know what you are doing... backup_before_update=false -previous_origin_state=25a9a32e -previous_smoothing_state=feb966c1 -previous_shaping_state=e0b94b7f -previous_moonraker_state=9c29a4fc -previous_dev_moonraker_state=528f9f25 \ No newline at end of file +previous_origin_state=0 +previous_smoothing_state=0 +previous_shaping_state=0 +previous_moonraker_state=0 +previous_dev_moonraker_state=0 \ No newline at end of file diff --git a/kiauh.sh b/kiauh.sh index 4d99a5a..9e2fe4a 100755 --- a/kiauh.sh +++ b/kiauh.sh @@ -337,34 +337,40 @@ advanced_menu(){ 2) clear print_header - build_fw + load_klipper_state print_msg && clear_msg advanced_ui;; 3) clear print_header - flash_routine + build_fw print_msg && clear_msg advanced_ui;; 4) clear print_header - get_usb_id + flash_routine print_msg && clear_msg advanced_ui;; 5) clear print_header - get_usb_id && write_printer_id + get_usb_id print_msg && clear_msg advanced_ui;; 6) clear print_header - create_dwc2fk_cfg + get_usb_id && write_printer_id print_msg && clear_msg advanced_ui;; 7) + clear + print_header + create_dwc2fk_cfg + print_msg && clear_msg + advanced_ui;; + 8) clear print_header create_custom_hostname @@ -443,6 +449,12 @@ switch_menu(){ fi } +#rollback_menu(){ +# load_klipper_state +# print_msg && clear_msg +# advanced_menu +#} + backup_menu(){ print_header print_msg && clear_msg diff --git a/scripts/rollback.sh b/scripts/rollback.sh new file mode 100755 index 0000000..cd5f9ae --- /dev/null +++ b/scripts/rollback.sh @@ -0,0 +1,92 @@ +save_klipper_state(){ + source_ini + #read current klipper state + COMMIT_STATE=$(git rev-parse --short HEAD) + if [ $GET_BRANCH = origin/master ]; then + ORI_OLD=$previous_origin_state + ORI_NEW=$COMMIT_STATE + sed -i "/previous_origin_state=/s/$ORI_OLD/$ORI_NEW/" $INI_FILE + elif [ $GET_BRANCH = dmbutyugin/scurve-shaping ]; then + SHA_OLD=$previous_shaping_state + SHA_NEW=$COMMIT_STATE + sed -i "/previous_shaping_state=/s/$SHA_OLD/$SHA_NEW/" $INI_FILE + elif [ $GET_BRANCH = dmbutyugin/scurve-smoothing ]; then + SMO_OLD=$previous_smoothing_state + SMO_NEW=$COMMIT_STATE + sed -i "/previous_smoothing_state=/s/$SMO_OLD/$SMO_NEW/" $INI_FILE + elif [ $GET_BRANCH = Arksine/work-web_server-20200131 ]; then + WWS_OLD=$previous_moonraker_state + WWS_NEW=$COMMIT_STATE + sed -i "/previous_moonraker_state=/s/$WWS_OLD/$WWS_NEW/" $INI_FILE + elif [ $GET_BRANCH = Arksine/dev-moonraker-testing ]; then + DMT_OLD=$previous_dev_moonraker_state + DMT_NEW=$COMMIT_STATE + sed -i "/previous_dev_moonraker_state=/s/$DMT_OLD/$DMT_NEW/" $INI_FILE + fi +} + +load_klipper_state(){ + source_ini + print_branch + CURR_COMM=$(git rev-parse --short=8 HEAD) + if [ "$GET_BRANCH" == "origin/master" ]; then + PREV_COMM=$previous_origin_state + elif [ "$GET_BRANCH" == "dmbutyugin/scurve-shaping" ]; then + PREV_COMM=$previous_shaping_state + elif [ "$GET_BRANCH" == "dmbutyugin/scurve-smoothing" ]; then + PREV_COMM=$previous_smoothing_state + elif [ "$GET_BRANCH" == "Arksine/work-web_server-20200131" ]; then + PREV_COMM=$previous_moonraker_state + elif [ "$GET_BRANCH" == "Arksine/dev-moonraker-testing" ]; then + PREV_COMM=$previous_dev_moonraker_state + fi + PREV_COMM_DATE=$(git show -s --format=%cd --date=short $PREV_COMM) + CURR_COMM_DATE=$(git show -s --format=%cd --date=short $CURR_COMM) + if [ $CURR_COMM = $PREV_COMM ]; then + CURR_UI=$(echo -e "${green}$CURR_COMM from $CURR_COMM_DATE${default}") + PREV_UI=$(echo -e "${green}$PREV_COMM from $PREV_COMM_DATE${default}") + else + CURR_UI=$(echo -e "${yellow}$CURR_COMM from $CURR_COMM_DATE${default}") + PREV_UI=$(echo -e "${yellow}$PREV_COMM from $PREV_COMM_DATE${default}") + fi + rollback_ui + rollback_klipper +} + +rollback_klipper(){ + if [ "$CURR_COMM" != "$PREV_COMM" ]; then + while true; do + echo -e "${cyan}" + read -p "###### Do you want to rollback to $PREV_COMM? (Y/n): " yn + echo -e "${default}" + case "$yn" in + Y|y|Yes|yes|"") + clear + print_header + status_msg "Rolling back to $PREV_COMM ..." + git reset --hard $PREV_COMM -q + ok_msg "Rollback complete!"; echo + load_klipper_state + break;; + N|n|No|no) clear; advanced_menu; break;; + Q|q) clear; advanced_menu; break;; + esac + done + else + while true; do + echo -e "${cyan}" + read -p "Perform action: " action; echo + echo -e "${default}" + case "$action" in + Q|q) + clear; advanced_menu; break;; + *) + clear + print_header + print_unkown_cmd + print_msg && clear_msg + rollback_ui;; + esac + done + fi +} \ No newline at end of file diff --git a/scripts/status.sh b/scripts/status.sh index 45918ac..e17b2d9 100644 --- a/scripts/status.sh +++ b/scripts/status.sh @@ -128,15 +128,15 @@ read_branch(){ print_branch(){ read_branch if [ "$GET_BRANCH" == "origin/master" ]; then - PRINT_BRANCH="${cyan}$GET_BRANCH${default} " + PRINT_BRANCH="$GET_BRANCH " elif [ "$GET_BRANCH" == "dmbutyugin/scurve-shaping" ]; then - PRINT_BRANCH="${cyan}scurve-shaping${default} " + PRINT_BRANCH="scurve-shaping " elif [ "$GET_BRANCH" == "dmbutyugin/scurve-smoothing" ]; then - PRINT_BRANCH="${cyan}scurve-smoothing${default} " + PRINT_BRANCH="scurve-smoothing " elif [ "$GET_BRANCH" == "Arksine/work-web_server-20200131" ]; then - PRINT_BRANCH="${cyan}moonraker${default} " + PRINT_BRANCH="moonraker " elif [ "$GET_BRANCH" == "Arksine/dev-moonraker-testing" ]; then - PRINT_BRANCH="${cyan}dev-moonraker${default} " + PRINT_BRANCH="dev-moonraker " else PRINT_BRANCH="${red}----${default} " fi diff --git a/scripts/ui.sh b/scripts/ui.sh index 97fba1d..37fbe99 100644 --- a/scripts/ui.sh +++ b/scripts/ui.sh @@ -33,7 +33,7 @@ main_ui(){ hr echo -e "| 0) [System status] | |" echo -e "| | Klipper: $KLIPPER_STATUS|" - echo -e "| 1) [Install] | Branch: $PRINT_BRANCH|" + echo -e "| 1) [Install] | Branch: ${cyan}$PRINT_BRANCH${default}|" echo -e "| 2) [Update] | |" echo -e "| 3) [Remove] | DWC2: $DWC2_STATUS|" echo -e "| | Mainsail: $MAINSAIL_STATUS|" @@ -109,14 +109,15 @@ advanced_ui(){ hr echo -e "| | | " echo -e "| Klipper: | System: | " - echo -e "| 1) [Switch Version] | 7) [Change hostname] | " + echo -e "| 1) [Switch Version] | 8) [Change hostname] | " + echo -e "| 2) [Rollback] | | " echo -e "| | | " echo -e "| Firmware: | | " - echo -e "| 2) [Build Firmware] | | " - echo -e "| 3) [Flash MCU] | | " - echo -e "| 4) [Get Printer-ID] | | " - echo -e "| 5) [Write Printer-ID] | | " - echo -e "| 6) [Write DWC2 config] | | " + echo -e "| 3) [Build Firmware] | | " + echo -e "| 4) [Flash MCU] | | " + echo -e "| 5) [Get Printer-ID] | | " + echo -e "| 6) [Write Printer-ID] | | " + echo -e "| 7) [Write DWC2 config] | | " echo -e "| | | " quit_footer } @@ -161,4 +162,23 @@ kiauh_update_msg(){ echo -e "| ${yellow}There is a newer version of this script available!${default} | " echo -e "| ${yellow}Type 'update' if you want to update KIAUH now.${default} | " bottom_border +} + +rollback_ui(){ + top_border + echo -e "| $(title_msg "~~~~~~~~~~~~~ [ Rollback Menu ] ~~~~~~~~~~~~~") | " + hr + echo -e "| If serious errors occured after updating Klipper, | " + echo -e "| you can use this menu to return to the previously | " + echo -e "| used commit from which you have updated. | " + bottom_border + top_border + echo -e "| Active branch: ${green}$PRINT_BRANCH${default} | " + hr + echo -e "| Currently on commit: | " + echo -e "| $CURR_UI | " + hr + echo -e "| Commit last updated from: | " + echo -e "| $PREV_UI | " + quit_footer } \ No newline at end of file diff --git a/scripts/update.sh b/scripts/update.sh index e7aefed..16a4aa7 100644 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -65,31 +65,4 @@ update_mainsail(){ status_msg "Updating Mainsail ..." install_mainsail start_klipper -} - -save_klipper_state(){ - source_ini - #read current klipper state - COMMIT_STATE=$(git rev-parse --short HEAD) - if [ $GET_BRANCH = origin/master ]; then - ORI_OLD=$previous_origin_state - ORI_NEW=$COMMIT_STATE - sed -i "/previous_origin_state=/s/$ORI_OLD/$ORI_NEW/" $INI_FILE - elif [ $GET_BRANCH = dmbutyugin/scurve-shaping ]; then - SHA_OLD=$previous_shaping_state - SHA_NEW=$COMMIT_STATE - sed -i "/previous_shaping_state=/s/$SHA_OLD/$SHA_NEW/" $INI_FILE - elif [ $GET_BRANCH = dmbutyugin/scurve-smoothing ]; then - SMO_OLD=$previous_smoothing_state - SMO_NEW=$COMMIT_STATE - sed -i "/previous_smoothing_state=/s/$SMO_OLD/$SMO_NEW/" $INI_FILE - elif [ $GET_BRANCH = Arksine/work-web_server-20200131 ]; then - WWS_OLD=$previous_moonraker_state - WWS_NEW=$COMMIT_STATE - sed -i "/previous_moonraker_state=/s/$WWS_OLD/$WWS_NEW/" $INI_FILE - elif [ $GET_BRANCH = Arksine/dev-moonraker-testing ]; then - DMT_OLD=$previous_dev_moonraker_state - DMT_NEW=$COMMIT_STATE - sed -i "/previous_dev_moonraker_state=/s/$DMT_OLD/$DMT_NEW/" $INI_FILE - fi } \ No newline at end of file From fce1eb5a8ccb930d95acfc7071198eeed422b07a Mon Sep 17 00:00:00 2001 From: th33xitus <> Date: Mon, 27 Jul 2020 11:26:22 +0200 Subject: [PATCH 64/64] update script to use mainsail beta - dropping mainsail alpha --- README.md | 13 ++++++++----- kiauh.sh | 13 ++++--------- scripts/install_mainsail.sh | 28 ++++++++++++++++------------ scripts/remove.sh | 17 +++++++++-------- scripts/status.sh | 4 +--- scripts/switch_branch.sh | 9 --------- scripts/ui.sh | 1 - 7 files changed, 38 insertions(+), 47 deletions(-) diff --git a/README.md b/README.md index 0a06f61..546332b 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ ## First things first: When you decide to use this script, you use it at your own risk! -Give it a try if you want and if you have suggestions or encounter any problems, please report them to me. +Give it a try if you want and if you have suggestions or encounter any problems, please report them to me. ## Instructions: @@ -34,11 +34,12 @@ chmod +x ~/kiauh/scripts/* - Tested only on Raspbian Buster Lite - During the use of this script you will be asked for your sudo password. There are several functions involved which need sudo privileges. -- Prevent simultaneous use of DWC2 and OctoPrint if possible. There have been reports that DWC2 does strange things while the OctoPrint service is running while using the DWC2 webinterface. The script disables an existing OctoPrint service when installing DWC2. However, the service can also be reactivated with the script! +- Prevent simultaneous use of DWC2 and OctoPrint if possible. There have been reports that DWC2 does strange things while the OctoPrint service is running while using the DWC2 webinterface. The script disables an existing OctoPrint service when installing DWC2. However, the service can also be reactivated with the script! ## Functions and Features: ### Core Functions: + - **Install:** Klipper Firmware, dwc2-for-klipper + Duet Web Control, Moonraker + Mainsail, OctoPrint - **Update:** Klipper Firmware, dwc2-for-klipper + Duet Web Control, Moonraker + Mainsail - **Backup:** Klipper Firmware, dwc2-for-klipper + Duet Web Control, Moonraker + Mainsail, OctoPrint @@ -50,10 +51,11 @@ chmod +x ~/kiauh/scripts/* - Before writing to an existing printer.cfg the script will create a backup! (better safe than sorry!) ### Features: + - Automatic dependency check: - If packages are missing on your machine but needed for the asked task, the script will automatically install them - Switch between Klipper Forks: - - origin/master, scurve-shaping, scurve-smoothing, moonraker, dev-moonraker + - [origin/master](https://github.com/KevinOConnor/klipper/tree/master), [scurve-shaping](https://github.com/dmbutyugin/klipper/tree/scurve-shaping), [scurve-smoothing](https://github.com/dmbutyugin/klipper/tree/scurve-smoothing), [moonraker](https://github.com/Arksine/klipper/tree/dev-moonraker-testing) - The update function of the script will always update the currently selected/active fork! - Toggle auto-create backups before updating: - When enabled, a backup of the installation you want to update is made prior updating @@ -65,9 +67,10 @@ chmod +x ~/kiauh/scripts/* - Enable/Disable OctoPrint Service: - Usefull when using DWC2/Mainsail and OctoPrint at the same time to prevent them interfering with each other - Set up reverse proxy for DWC2, Mainsail and OctoPrint and changing the hostname: + - The script can install and configure Nginx for the selected webinterface. This will allow you to make your webinterface reachable over an URL like `.local` - - Example: If you name the host "mainsail" and set up a reverse proxy, type `mainsail.local` in your webbrowser to open the Mainsail webinterface - + - Example: If you name the host "mainsail" and set up a reverse proxy, type `mainsail.local` in your webbrowser to open the Mainsail webinterface + tbc ... ## What this script can't do: diff --git a/kiauh.sh b/kiauh.sh index 9e2fe4a..01cefc2 100755 --- a/kiauh.sh +++ b/kiauh.sh @@ -44,6 +44,8 @@ TORNADO_DIR1=${HOME}/klippy-env/lib/python2.7/site-packages/tornado TORNADO_DIR2=${HOME}/klippy-env/lib/python2.7/site-packages/tornado-5.1.1.dist-info #mainsail/moonraker MAINSAIL_DIR=${HOME}/mainsail +MOONRAKER_DIR=${HOME}/moonraker +MOONRAKER_ENV_DIR=${HOME}/moonraker-env MOONRAKER_SERVICE1=/etc/init.d/moonraker MOONRAKER_SERVICE2=/etc/default/moonraker #octoprint @@ -61,9 +63,9 @@ KLIPPER_REPO=https://github.com/KevinOConnor/klipper.git ARKSINE_REPO=https://github.com/Arksine/klipper.git DMBUTYUGIN_REPO=https://github.com/dmbutyugin/klipper.git DWC2FK_REPO=https://github.com/Stephan3/dwc2-for-klipper.git +MOONRAKER_REPO=https://github.com/Arksine/moonraker.git #branches -BRANCH_MOONRAKER=Arksine/work-web_server-20200131 -BRANCH_DEV_MOONRAKER=Arksine/dev-moonraker-testing +BRANCH_MOONRAKER=Arksine/dev-moonraker-testing BRANCH_SCURVE_SMOOTHING=dmbutyugin/scurve-smoothing BRANCH_SCURVE_SHAPING=dmbutyugin/scurve-shaping @@ -427,13 +429,6 @@ switch_menu(){ read_branch print_msg && clear_msg switch_ui;; - 5) - clear - print_header - switch_to_dev_moonraker - read_branch - print_msg && clear_msg - switch_ui;; Q|q) clear; advanced_menu; break;; *) diff --git a/scripts/install_mainsail.sh b/scripts/install_mainsail.sh index ee47db3..29a6aad 100644 --- a/scripts/install_mainsail.sh +++ b/scripts/install_mainsail.sh @@ -26,11 +26,15 @@ mainsail_install_routine(){ install_moonraker(){ cd $KLIPPER_DIR - if [[ $(git describe --all) = "remotes/Arksine/work-web_server-20200131" || $(git describe --all) = "remotes/Arksine/dev-moonraker-testing" ]]; then + if [[ $(git describe --all) = "remotes/Arksine/dev-moonraker-testing" ]]; then dep=(wget curl unzip) dependency_check + status_msg "Downloading Moonraker ..." + cd ${HOME} && git clone $MOONRAKER_REPO + ok_msg "Download complete!" status_msg "Installing Moonraker ..." - $KLIPPER_DIR/scripts/install-moonraker.sh && ok_msg "Moonraker successfully installed!" + $MOONRAKER_DIR/scripts/install-moonraker.sh && ok_msg "Moonraker successfully installed!" + #create sdcard folder if it doesn't exists yet if [ ! -d ${HOME}/sdcard ]; then mkdir ${HOME}/sdcard fi @@ -40,7 +44,7 @@ install_moonraker(){ ln -s /tmp/moonraker.log ${HOME}/moonraker.log && ok_msg "Symlink created!" fi else - ERROR_MSG=" You are not using a Moonraker fork\n Please switch to a Moonraker fork first! Aborting ..." + ERROR_MSG=" You are not using the Moonraker fork\n Please switch to the Moonraker fork first! Aborting ..." ERROR=1 fi } @@ -86,20 +90,20 @@ VSDCARD } check_api_section(){ - status_msg "Checking for api_server configuration ..." + status_msg "Checking for moonraker configuration ..." # check if api server is present in printer.cfg - if [ $(grep '^\[api_server\]$' $PRINTER_CFG) ]; then - ok_msg "API Server already configured" + if [ $(grep '^\[moonraker\]$' $PRINTER_CFG) ]; then + ok_msg "Moonraker already configured" else - status_msg "No API Server entry found." - ok_msg "API server entry added to printer.cfg!" + status_msg "No Moonraker entry found." + ok_msg "Moonraker entry added to printer.cfg!" # append the following lines to printer.cfg cat <> $PRINTER_CFG ########################## ### CREATED WITH KIAUH ### ########################## -[api_server] +[moonraker] trusted_clients: 192.168.0.0/24 192.168.1.0/24 @@ -119,7 +123,7 @@ cat <> $PRINTER_CFG [virtual_sdcard] path: ~/sdcard -[api_server] +[moonraker] trusted_clients: 192.168.0.0/24 192.168.1.0/24 @@ -223,12 +227,12 @@ test_nginx(){ } get_mainsail_ver(){ - MAINSAIL_VERSION=`curl -s https://api.github.com/repositories/240875926/tags | grep name | cut -d'"' -f4 | cut -d"v" -f2 | head -1` + MAINSAIL_VERSION=$(curl -s https://api.github.com/repositories/240875926/tags | grep name | cut -d'"' -f4 | cut -d"v" -f2 | head -1) } mainsail_dl_url(){ get_mainsail_ver - MAINSAIL_URL=https://github.com/meteyou/mainsail/releases/download/v"$MAINSAIL_VERSION"/mainsail-alpha-"$MAINSAIL_VERSION".zip + MAINSAIL_URL=https://github.com/meteyou/mainsail/releases/download/v"$MAINSAIL_VERSION"/mainsail-beta-"$MAINSAIL_VERSION".zip } install_mainsail(){ diff --git a/scripts/remove.sh b/scripts/remove.sh index a404d97..2e25f54 100644 --- a/scripts/remove.sh +++ b/scripts/remove.sh @@ -69,10 +69,11 @@ remove_mainsail(){ $MOONRAKER_SERVICE1 $MOONRAKER_SERVICE2 $MAINSAIL_DIR + $MOONRAKER_DIR + $MOONRAKER_ENV_DIR ${HOME}/moonraker.log ${HOME}/.klippy_api_key ${HOME}/.moonraker_api_key - ${HOME}/moonraker-env /etc/nginx/sites-available/mainsail /etc/nginx/sites-enabled/mainsail ) @@ -90,15 +91,15 @@ remove_mainsail(){ status_msg "Removing Mainsail directory ..." rm -rf $MAINSAIL_DIR && ok_msg "Directory removed!" fi - #remove moonraker-env - if [ -d ${HOME}/moonraker-env ]; then - status_msg "Removing Moonraker virtualenv ..." - rm -rf ${HOME}/moonraker-env && ok_msg "Directory removed!" + #remove moonraker and moonraker-env dir + if [[ -d $MOONRAKER_DIR || -d $MOONRAKER_ENV_DIR ]]; then + status_msg "Removing Moonraker and moonraker-env directory ..." + rm -rf $MOONRAKER_DIR $MOONRAKER_ENV_DIR && ok_msg "Directories removed!" fi - #remove moonraker.log symlink + #remove moonraker.log and symlink if [[ -L ${HOME}/moonraker.log || -e /tmp/moonraker.log ]]; then - status_msg "Removing moonraker.log Symlink ..." - rm -rf ${HOME}/moonraker.log /tmp/moonraker.log && ok_msg "Symlink removed!" + status_msg "Removing moonraker.log and Symlink ..." + rm -rf ${HOME}/moonraker.log /tmp/moonraker.log && ok_msg "Files removed!" fi #remove mainsail cfg if [ -e /etc/nginx/sites-available/mainsail ]; then diff --git a/scripts/status.sh b/scripts/status.sh index e17b2d9..2972b21 100644 --- a/scripts/status.sh +++ b/scripts/status.sh @@ -133,10 +133,8 @@ print_branch(){ PRINT_BRANCH="scurve-shaping " elif [ "$GET_BRANCH" == "dmbutyugin/scurve-smoothing" ]; then PRINT_BRANCH="scurve-smoothing " - elif [ "$GET_BRANCH" == "Arksine/work-web_server-20200131" ]; then - PRINT_BRANCH="moonraker " elif [ "$GET_BRANCH" == "Arksine/dev-moonraker-testing" ]; then - PRINT_BRANCH="dev-moonraker " + PRINT_BRANCH="moonraker " else PRINT_BRANCH="${red}----${default} " fi diff --git a/scripts/switch_branch.sh b/scripts/switch_branch.sh index a2b22ed..6838f8b 100644 --- a/scripts/switch_branch.sh +++ b/scripts/switch_branch.sh @@ -29,13 +29,4 @@ switch_to_moonraker(){ git remote add Arksine $ARKSINE_REPO fi git fetch Arksine -q && git checkout $BRANCH_MOONRAKER -q -} - -switch_to_dev_moonraker(){ - cd $KLIPPER_DIR - status_msg "Switching...Please wait ..."; echo - if ! git remote | grep Arksine -q; then - git remote add Arksine $ARKSINE_REPO - fi - git fetch Arksine -q && git checkout $BRANCH_DEV_MOONRAKER -q } \ No newline at end of file diff --git a/scripts/ui.sh b/scripts/ui.sh index 37fbe99..49a9a81 100644 --- a/scripts/ui.sh +++ b/scripts/ui.sh @@ -153,7 +153,6 @@ switch_ui(){ echo -e "| 3) [--> scurve-smoothing] | " echo -e "| | " echo -e "| 4) [--> moonraker] | " - echo -e "| 5) [--> dev-moonraker] | " quit_footer }