update script to use mainsail beta - dropping mainsail alpha

This commit is contained in:
th33xitus
2020-07-27 11:26:22 +02:00
parent 82d76b18f0
commit fce1eb5a8c
7 changed files with 38 additions and 47 deletions

View File

@@ -39,6 +39,7 @@ chmod +x ~/kiauh/scripts/*
## Functions and Features: ## Functions and Features:
### Core Functions: ### Core Functions:
- **Install:** Klipper Firmware, dwc2-for-klipper + Duet Web Control, Moonraker + Mainsail, OctoPrint - **Install:** Klipper Firmware, dwc2-for-klipper + Duet Web Control, Moonraker + Mainsail, OctoPrint
- **Update:** Klipper Firmware, dwc2-for-klipper + Duet Web Control, Moonraker + Mainsail - **Update:** Klipper Firmware, dwc2-for-klipper + Duet Web Control, Moonraker + Mainsail
- **Backup:** Klipper Firmware, dwc2-for-klipper + Duet Web Control, Moonraker + Mainsail, OctoPrint - **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!) - Before writing to an existing printer.cfg the script will create a backup! (better safe than sorry!)
### Features: ### Features:
- Automatic dependency check: - Automatic dependency check:
- If packages are missing on your machine but needed for the asked task, the script will automatically install them - If packages are missing on your machine but needed for the asked task, the script will automatically install them
- Switch between Klipper Forks: - 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! - The update function of the script will always update the currently selected/active fork!
- Toggle auto-create backups before updating: - Toggle auto-create backups before updating:
- When enabled, a backup of the installation you want to update is made prior updating - When enabled, a backup of the installation you want to update is made prior updating
@@ -65,6 +67,7 @@ chmod +x ~/kiauh/scripts/*
- Enable/Disable OctoPrint Service: - 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: - 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 `<hostname>.local` - The script can install and configure Nginx for the selected webinterface. This will allow you to make your webinterface reachable over an URL like `<hostname>.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

View File

@@ -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 TORNADO_DIR2=${HOME}/klippy-env/lib/python2.7/site-packages/tornado-5.1.1.dist-info
#mainsail/moonraker #mainsail/moonraker
MAINSAIL_DIR=${HOME}/mainsail MAINSAIL_DIR=${HOME}/mainsail
MOONRAKER_DIR=${HOME}/moonraker
MOONRAKER_ENV_DIR=${HOME}/moonraker-env
MOONRAKER_SERVICE1=/etc/init.d/moonraker MOONRAKER_SERVICE1=/etc/init.d/moonraker
MOONRAKER_SERVICE2=/etc/default/moonraker MOONRAKER_SERVICE2=/etc/default/moonraker
#octoprint #octoprint
@@ -61,9 +63,9 @@ KLIPPER_REPO=https://github.com/KevinOConnor/klipper.git
ARKSINE_REPO=https://github.com/Arksine/klipper.git ARKSINE_REPO=https://github.com/Arksine/klipper.git
DMBUTYUGIN_REPO=https://github.com/dmbutyugin/klipper.git DMBUTYUGIN_REPO=https://github.com/dmbutyugin/klipper.git
DWC2FK_REPO=https://github.com/Stephan3/dwc2-for-klipper.git DWC2FK_REPO=https://github.com/Stephan3/dwc2-for-klipper.git
MOONRAKER_REPO=https://github.com/Arksine/moonraker.git
#branches #branches
BRANCH_MOONRAKER=Arksine/work-web_server-20200131 BRANCH_MOONRAKER=Arksine/dev-moonraker-testing
BRANCH_DEV_MOONRAKER=Arksine/dev-moonraker-testing
BRANCH_SCURVE_SMOOTHING=dmbutyugin/scurve-smoothing BRANCH_SCURVE_SMOOTHING=dmbutyugin/scurve-smoothing
BRANCH_SCURVE_SHAPING=dmbutyugin/scurve-shaping BRANCH_SCURVE_SHAPING=dmbutyugin/scurve-shaping
@@ -427,13 +429,6 @@ switch_menu(){
read_branch read_branch
print_msg && clear_msg print_msg && clear_msg
switch_ui;; switch_ui;;
5)
clear
print_header
switch_to_dev_moonraker
read_branch
print_msg && clear_msg
switch_ui;;
Q|q) Q|q)
clear; advanced_menu; break;; clear; advanced_menu; break;;
*) *)

View File

@@ -26,11 +26,15 @@ mainsail_install_routine(){
install_moonraker(){ install_moonraker(){
cd $KLIPPER_DIR 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) dep=(wget curl unzip)
dependency_check dependency_check
status_msg "Downloading Moonraker ..."
cd ${HOME} && git clone $MOONRAKER_REPO
ok_msg "Download complete!"
status_msg "Installing Moonraker ..." 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 if [ ! -d ${HOME}/sdcard ]; then
mkdir ${HOME}/sdcard mkdir ${HOME}/sdcard
fi fi
@@ -40,7 +44,7 @@ install_moonraker(){
ln -s /tmp/moonraker.log ${HOME}/moonraker.log && ok_msg "Symlink created!" ln -s /tmp/moonraker.log ${HOME}/moonraker.log && ok_msg "Symlink created!"
fi fi
else 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 ERROR=1
fi fi
} }
@@ -86,20 +90,20 @@ VSDCARD
} }
check_api_section(){ 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 # check if api server is present in printer.cfg
if [ $(grep '^\[api_server\]$' $PRINTER_CFG) ]; then if [ $(grep '^\[moonraker\]$' $PRINTER_CFG) ]; then
ok_msg "API Server already configured" ok_msg "Moonraker already configured"
else else
status_msg "No API Server entry found." status_msg "No Moonraker entry found."
ok_msg "API server entry added to printer.cfg!" ok_msg "Moonraker entry added to printer.cfg!"
# append the following lines to printer.cfg # append the following lines to printer.cfg
cat <<API >> $PRINTER_CFG cat <<API >> $PRINTER_CFG
########################## ##########################
### CREATED WITH KIAUH ### ### CREATED WITH KIAUH ###
########################## ##########################
[api_server] [moonraker]
trusted_clients: trusted_clients:
192.168.0.0/24 192.168.0.0/24
192.168.1.0/24 192.168.1.0/24
@@ -119,7 +123,7 @@ cat <<DEFAULT_CFG >> $PRINTER_CFG
[virtual_sdcard] [virtual_sdcard]
path: ~/sdcard path: ~/sdcard
[api_server] [moonraker]
trusted_clients: trusted_clients:
192.168.0.0/24 192.168.0.0/24
192.168.1.0/24 192.168.1.0/24
@@ -223,12 +227,12 @@ test_nginx(){
} }
get_mainsail_ver(){ 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(){ mainsail_dl_url(){
get_mainsail_ver 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(){ install_mainsail(){

View File

@@ -69,10 +69,11 @@ remove_mainsail(){
$MOONRAKER_SERVICE1 $MOONRAKER_SERVICE1
$MOONRAKER_SERVICE2 $MOONRAKER_SERVICE2
$MAINSAIL_DIR $MAINSAIL_DIR
$MOONRAKER_DIR
$MOONRAKER_ENV_DIR
${HOME}/moonraker.log ${HOME}/moonraker.log
${HOME}/.klippy_api_key ${HOME}/.klippy_api_key
${HOME}/.moonraker_api_key ${HOME}/.moonraker_api_key
${HOME}/moonraker-env
/etc/nginx/sites-available/mainsail /etc/nginx/sites-available/mainsail
/etc/nginx/sites-enabled/mainsail /etc/nginx/sites-enabled/mainsail
) )
@@ -90,15 +91,15 @@ remove_mainsail(){
status_msg "Removing Mainsail directory ..." status_msg "Removing Mainsail directory ..."
rm -rf $MAINSAIL_DIR && ok_msg "Directory removed!" rm -rf $MAINSAIL_DIR && ok_msg "Directory removed!"
fi fi
#remove moonraker-env #remove moonraker and moonraker-env dir
if [ -d ${HOME}/moonraker-env ]; then if [[ -d $MOONRAKER_DIR || -d $MOONRAKER_ENV_DIR ]]; then
status_msg "Removing Moonraker virtualenv ..." status_msg "Removing Moonraker and moonraker-env directory ..."
rm -rf ${HOME}/moonraker-env && ok_msg "Directory removed!" rm -rf $MOONRAKER_DIR $MOONRAKER_ENV_DIR && ok_msg "Directories removed!"
fi fi
#remove moonraker.log symlink #remove moonraker.log and symlink
if [[ -L ${HOME}/moonraker.log || -e /tmp/moonraker.log ]]; then if [[ -L ${HOME}/moonraker.log || -e /tmp/moonraker.log ]]; then
status_msg "Removing moonraker.log Symlink ..." status_msg "Removing moonraker.log and Symlink ..."
rm -rf ${HOME}/moonraker.log /tmp/moonraker.log && ok_msg "Symlink removed!" rm -rf ${HOME}/moonraker.log /tmp/moonraker.log && ok_msg "Files removed!"
fi fi
#remove mainsail cfg #remove mainsail cfg
if [ -e /etc/nginx/sites-available/mainsail ]; then if [ -e /etc/nginx/sites-available/mainsail ]; then

View File

@@ -133,10 +133,8 @@ print_branch(){
PRINT_BRANCH="scurve-shaping " PRINT_BRANCH="scurve-shaping "
elif [ "$GET_BRANCH" == "dmbutyugin/scurve-smoothing" ]; then elif [ "$GET_BRANCH" == "dmbutyugin/scurve-smoothing" ]; then
PRINT_BRANCH="scurve-smoothing " PRINT_BRANCH="scurve-smoothing "
elif [ "$GET_BRANCH" == "Arksine/work-web_server-20200131" ]; then
PRINT_BRANCH="moonraker "
elif [ "$GET_BRANCH" == "Arksine/dev-moonraker-testing" ]; then elif [ "$GET_BRANCH" == "Arksine/dev-moonraker-testing" ]; then
PRINT_BRANCH="dev-moonraker " PRINT_BRANCH="moonraker "
else else
PRINT_BRANCH="${red}----${default} " PRINT_BRANCH="${red}----${default} "
fi fi

View File

@@ -30,12 +30,3 @@ switch_to_moonraker(){
fi fi
git fetch Arksine -q && git checkout $BRANCH_MOONRAKER -q 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
}

View File

@@ -153,7 +153,6 @@ switch_ui(){
echo -e "| 3) [--> scurve-smoothing] | " echo -e "| 3) [--> scurve-smoothing] | "
echo -e "| | " echo -e "| | "
echo -e "| 4) [--> moonraker] | " echo -e "| 4) [--> moonraker] | "
echo -e "| 5) [--> dev-moonraker] | "
quit_footer quit_footer
} }