script: Fix Broken Git
This commit is contained in:
104
kiauh.sh
104
kiauh.sh
@@ -1,62 +1,88 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
### Gettext Configuration
|
|
||||||
alias GETTEXT='gettext "KIAUH"'
|
|
||||||
|
|
||||||
#clear
|
|
||||||
# TODO set -e cause whiptail to force an exit because it use stderr, need a workaround here
|
|
||||||
# set -e
|
|
||||||
|
|
||||||
### set color variables
|
|
||||||
green=$(echo -en "\e[92m")
|
|
||||||
yellow=$(echo -en "\e[93m")
|
|
||||||
red=$(echo -en "\e[91m")
|
|
||||||
cyan=$(echo -en "\e[96m")
|
|
||||||
default=$(echo -en "\e[39m")
|
|
||||||
|
|
||||||
### sourcing all additional scripts
|
|
||||||
SRCDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/.. && pwd )"
|
|
||||||
for script in "${SRCDIR}/kiauh/scripts/constants/"*.sh; do . $script; done
|
|
||||||
for script in "${SRCDIR}/kiauh/scripts/"*.sh; do . $script; done
|
|
||||||
for script in "${SRCDIR}/kiauh/scripts/ui/"*.sh; do . $script; done
|
|
||||||
|
|
||||||
### set some messages
|
### set some messages
|
||||||
warn_msg(){
|
warn_msg() {
|
||||||
echo -e "${red}<!!!!> $1${default}"
|
echo -e "${red}<!!!!> $1${default}"
|
||||||
}
|
}
|
||||||
status_msg(){
|
status_msg() {
|
||||||
echo; echo -e "${yellow}###### $1${default}"
|
echo
|
||||||
|
echo -e "${yellow}###### $1${default}"
|
||||||
}
|
}
|
||||||
ok_msg(){
|
ok_msg() {
|
||||||
echo -e "${green}>>>>>> $1${default}"
|
echo -e "${green}>>>>>> $1${default}"
|
||||||
}
|
}
|
||||||
title_msg(){
|
title_msg() {
|
||||||
echo -e "${cyan}$1${default}"
|
echo -e "${cyan}$1${default}"
|
||||||
}
|
}
|
||||||
get_date(){
|
get_date() {
|
||||||
current_date=$(date +"%y%m%d-%H%M")
|
current_date=$(date +"%y%m%d-%H%M")
|
||||||
}
|
}
|
||||||
print_unkown_cmd(){
|
print_unkown_cmd() {
|
||||||
ERROR_MSG="Invalid command!"
|
ERROR_MSG="Invalid command!"
|
||||||
}
|
}
|
||||||
|
|
||||||
print_msg(){
|
#######################################
|
||||||
if [[ "$ERROR_MSG" != "" ]]; then
|
# description Display an error or a confirmation
|
||||||
whiptail --title "$KIAUH_TITLE" --msgbox "$ERROR_MSG"\
|
# Globals:
|
||||||
"$KIAUH_WHIPTAIL_SINGLE_LINE_HEIGHT" "$KIAUH_WHIPTAIL_NORMAL_WIDTH"
|
# CONFIRM_MSG
|
||||||
|
# ERROR_MSG
|
||||||
|
# KIAUH_TITLE
|
||||||
|
# KIAUH_WHIPTAIL_NORMAL_WIDTH
|
||||||
|
# KIAUH_WHIPTAIL_SINGLE_LINE_HEIGHT
|
||||||
|
# Arguments:
|
||||||
|
# None
|
||||||
|
#######################################
|
||||||
|
print_msg() {
|
||||||
|
if [[ $ERROR_MSG != "" ]]; then
|
||||||
|
whiptail --title "$KIAUH_TITLE" --msgbox "$ERROR_MSG" \
|
||||||
|
"$KIAUH_WHIPTAIL_SINGLE_LINE_HEIGHT" "$KIAUH_WHIPTAIL_NORMAL_WIDTH"
|
||||||
fi
|
fi
|
||||||
|
# TODO Maybe confirm_msg can be yesno box
|
||||||
if [ "$CONFIRM_MSG" != "" ]; then
|
if [ "$CONFIRM_MSG" != "" ]; then
|
||||||
whiptail --title "$KIAUH_TITLE" --msgbox "$CONFIRM_MSG"\
|
whiptail --title "$KIAUH_TITLE" --msgbox "$CONFIRM_MSG" \
|
||||||
"$KIAUH_WHIPTAIL_SINGLE_LINE_HEIGHT" "$KIAUH_WHIPTAIL_NORMAL_WIDTH"
|
"$KIAUH_WHIPTAIL_SINGLE_LINE_HEIGHT" "$KIAUH_WHIPTAIL_NORMAL_WIDTH"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
clear_msg(){
|
clear_msg() {
|
||||||
unset CONFIRM_MSG
|
unset CONFIRM_MSG
|
||||||
unset ERROR_MSG
|
unset ERROR_MSG
|
||||||
}
|
}
|
||||||
|
|
||||||
check_euid
|
function main() {
|
||||||
init_ini
|
### Gettext Configuration
|
||||||
kiauh_status
|
alias GETTEXT='gettext "KIAUH"'
|
||||||
main_menu
|
|
||||||
|
#clear
|
||||||
|
# TODO set -e cause whiptail to force an exit because it use stderr, need a workaround here
|
||||||
|
# set -e
|
||||||
|
### set color variables
|
||||||
|
green=$(echo -en "\e[92m")
|
||||||
|
|
||||||
|
yellow=$(echo -en "\e[93m")
|
||||||
|
|
||||||
|
red=$(echo -en "\e[91m")
|
||||||
|
|
||||||
|
cyan=$(echo -en "\e[96m")
|
||||||
|
|
||||||
|
default=$(echo -en "\e[39m")
|
||||||
|
|
||||||
|
### sourcing all additional scripts
|
||||||
|
SRCDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"/.. && pwd)"
|
||||||
|
|
||||||
|
for script in "${SRCDIR}/kiauh/scripts/constants/"*.sh; do . $script; done
|
||||||
|
|
||||||
|
for script in "${SRCDIR}/kiauh/scripts/"*.sh; do . $script; done
|
||||||
|
|
||||||
|
for script in "${SRCDIR}/kiauh/scripts/ui/"*.sh; do . $script; done
|
||||||
|
|
||||||
|
check_euid
|
||||||
|
|
||||||
|
init_ini
|
||||||
|
|
||||||
|
kiauh_status
|
||||||
|
|
||||||
|
main_menu
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
check_for_backup_dir(){
|
check_for_backup_dir(){
|
||||||
if [ ! -d $BACKUP_DIR ]; then
|
if [ ! -d $BACKUP_DIR ]; then
|
||||||
status_msg "Create KIAUH backup directory ..."
|
status_msg "Create KIAUH backup directory ..."
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ readonly DWC_ENV_DIR=${HOME}/dwc-env
|
|||||||
readonly DWC2_DIR=${HOME}/duetwebcontrol
|
readonly DWC2_DIR=${HOME}/duetwebcontrol
|
||||||
#octoprint
|
#octoprint
|
||||||
readonly OCTOPRINT_DIR=${HOME}/OctoPrint
|
readonly OCTOPRINT_DIR=${HOME}/OctoPrint
|
||||||
|
readonly OCTOPRINT_ENV_DIR=${HOME}/OctoPrint/env
|
||||||
#KlipperScreen
|
#KlipperScreen
|
||||||
readonly KLIPPERSCREEN_DIR=${HOME}/KlipperScreen
|
readonly KLIPPERSCREEN_DIR=${HOME}/KlipperScreen
|
||||||
readonly KLIPPERSCREEN_ENV_DIR=${HOME}/.KlipperScreen-env
|
readonly KLIPPERSCREEN_ENV_DIR=${HOME}/.KlipperScreen-env
|
||||||
@@ -44,6 +45,10 @@ readonly NLEF_REPO=https://github.com/nlef/moonraker-telegram-bot.git
|
|||||||
readonly BRANCH_SCURVE_SMOOTHING=dmbutyugin/scurve-smoothing
|
readonly BRANCH_SCURVE_SMOOTHING=dmbutyugin/scurve-smoothing
|
||||||
readonly BRANCH_SCURVE_SHAPING=dmbutyugin/scurve-shaping
|
readonly BRANCH_SCURVE_SHAPING=dmbutyugin/scurve-shaping
|
||||||
|
|
||||||
|
### Webcam
|
||||||
|
readonly WEBCAMD_SRC="https://raw.githubusercontent.com/raymondh2/MainsailOS/master/src/modules/mjpgstreamer/filesystem/root/usr/local/bin/webcamd"
|
||||||
|
readonly WEBCAM_TXT_SRC="https://raw.githubusercontent.com/raymondh2/MainsailOS/master/src/modules/mjpgstreamer/filesystem/home/pi/klipper_config/webcam.txt"
|
||||||
|
|
||||||
###Whiptail
|
###Whiptail
|
||||||
readonly KIAUH_WHIPTAIL_NORMAL_WIDTH=70
|
readonly KIAUH_WHIPTAIL_NORMAL_WIDTH=70
|
||||||
readonly KIAUH_WHIPTAIL_NORMAL_HEIGHT=24
|
readonly KIAUH_WHIPTAIL_NORMAL_HEIGHT=24
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# setting up some frequently used functions
|
# setting up some frequently used functions
|
||||||
|
|
||||||
check_euid(){
|
check_euid(){
|
||||||
@@ -456,7 +457,7 @@ init_ini(){
|
|||||||
fetch_webui_ports
|
fetch_webui_ports
|
||||||
}
|
}
|
||||||
|
|
||||||
print_kiauh_version() {
|
check_kiauh_version() {
|
||||||
cd ${SRCDIR}/kiauh
|
cd ${SRCDIR}/kiauh
|
||||||
KIAUH_VER=$(git describe HEAD --always --tags | cut -d "-" -f 1,2)
|
KIAUH_VER=$(git describe HEAD --always --tags | cut -d "-" -f 1,2)
|
||||||
KIAUH_VER="$(printf "%-20s" "$KIAUH_VER")"
|
KIAUH_VER="$(printf "%-20s" "$KIAUH_VER")"
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
### base variables
|
#!/bin/bash
|
||||||
KLIPPY_ENV="${HOME}/klippy-env"
|
|
||||||
KLIPPER_DIR="${HOME}/klipper"
|
|
||||||
|
|
||||||
klipper_setup_dialog(){
|
klipper_setup_dialog(){
|
||||||
status_msg "Initializing Klipper installation ..."
|
status_msg "Initializing Klipper installation ..."
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
### base variables
|
#!/bin/bash
|
||||||
WEBCAMD_SRC="https://raw.githubusercontent.com/raymondh2/MainsailOS/master/src/modules/mjpgstreamer/filesystem/root/usr/local/bin/webcamd"
|
|
||||||
WEBCAM_TXT_SRC="https://raw.githubusercontent.com/raymondh2/MainsailOS/master/src/modules/mjpgstreamer/filesystem/home/pi/klipper_config/webcam.txt"
|
|
||||||
|
|
||||||
install_mjpg-streamer(){
|
install_mjpg_streamer(){
|
||||||
### checking dependencies
|
### checking dependencies
|
||||||
check_klipper_cfg_path
|
check_klipper_cfg_path
|
||||||
|
|
||||||
@@ -108,4 +106,4 @@ EOF
|
|||||||
echo -e " ${cyan}● Webcam URL:${default} $WEBCAM_IP"
|
echo -e " ${cyan}● Webcam URL:${default} $WEBCAM_IP"
|
||||||
echo -e " ${cyan}● Webcam URL:${default} $WEBCAM_URL"
|
echo -e " ${cyan}● Webcam URL:${default} $WEBCAM_URL"
|
||||||
echo
|
echo
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
system_check_moonraker(){
|
system_check_moonraker() {
|
||||||
### python 3 check
|
### python 3 check
|
||||||
status_msg "Your Python 3 version is: $(python3 --version)"
|
status_msg "Your Python 3 version is: $(python3 --version)"
|
||||||
major=$(python3 --version | cut -d" " -f2 | cut -d"." -f1)
|
major=$(python3 --version | cut -d" " -f2 | cut -d"." -f1)
|
||||||
@@ -14,7 +14,7 @@ system_check_moonraker(){
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
moonraker_setup_dialog(){
|
moonraker_setup_dialog() {
|
||||||
status_msg "Initializing Moonraker installation ..."
|
status_msg "Initializing Moonraker installation ..."
|
||||||
|
|
||||||
### checking system for python3.7+
|
### checking system for python3.7+
|
||||||
@@ -52,36 +52,39 @@ moonraker_setup_dialog(){
|
|||||||
|
|
||||||
### instance confirmation dialog
|
### instance confirmation dialog
|
||||||
while true; do
|
while true; do
|
||||||
echo
|
echo
|
||||||
top_border
|
top_border
|
||||||
if [ $INSTANCE_COUNT -gt 1 ]; then
|
if [ $INSTANCE_COUNT -gt 1 ]; then
|
||||||
printf "|%-55s|\n" " $INSTANCE_COUNT Klipper instances were found!"
|
printf "|%-55s|\n" " $INSTANCE_COUNT Klipper instances were found!"
|
||||||
else
|
else
|
||||||
echo -e "| 1 Klipper instance was found! | "
|
echo -e "| 1 Klipper instance was found! | "
|
||||||
fi
|
fi
|
||||||
echo -e "| You need one Moonraker instance per Klipper instance. | "
|
echo -e "| You need one Moonraker instance per Klipper instance. | "
|
||||||
bottom_border
|
bottom_border
|
||||||
echo
|
echo
|
||||||
read -p "${cyan}###### Create $INSTANCE_COUNT Moonraker instances? (Y/n):${default} " yn
|
read -p "${cyan}###### Create $INSTANCE_COUNT Moonraker instances? (Y/n):${default} " yn
|
||||||
case "$yn" in
|
case "$yn" in
|
||||||
Y|y|Yes|yes|"")
|
Y | y | Yes | yes | "")
|
||||||
echo -e "###### > Yes"
|
echo -e "###### > Yes"
|
||||||
status_msg "Creating $INSTANCE_COUNT Moonraker instances ..."
|
status_msg "Creating $INSTANCE_COUNT Moonraker instances ..."
|
||||||
moonraker_setup
|
moonraker_setup
|
||||||
break;;
|
break
|
||||||
N|n|No|no)
|
;;
|
||||||
echo -e "###### > No"
|
N | n | No | no)
|
||||||
warn_msg "Exiting Moonraker setup ..."
|
echo -e "###### > No"
|
||||||
echo
|
warn_msg "Exiting Moonraker setup ..."
|
||||||
break;;
|
echo
|
||||||
*)
|
break
|
||||||
print_unkown_cmd
|
;;
|
||||||
print_msg && clear_msg;;
|
*)
|
||||||
|
print_unkown_cmd
|
||||||
|
print_msg && clear_msg
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
moonraker_setup(){
|
moonraker_setup() {
|
||||||
### checking dependencies
|
### checking dependencies
|
||||||
dep=(wget curl unzip dfu-util virtualenv)
|
dep=(wget curl unzip dfu-util virtualenv)
|
||||||
### additional deps for kiauh compatibility for armbian
|
### additional deps for kiauh compatibility for armbian
|
||||||
@@ -112,10 +115,11 @@ moonraker_setup(){
|
|||||||
print_msg && clear_msg
|
print_msg && clear_msg
|
||||||
|
|
||||||
### display moonraker ips to the user
|
### display moonraker ips to the user
|
||||||
print_mr_ip_list; echo
|
print_mr_ip_list
|
||||||
|
echo
|
||||||
}
|
}
|
||||||
|
|
||||||
install_moonraker_packages(){
|
install_moonraker_packages() {
|
||||||
### read PKGLIST from official install script
|
### read PKGLIST from official install script
|
||||||
status_msg "Reading dependencies..."
|
status_msg "Reading dependencies..."
|
||||||
install_script="${HOME}/moonraker/scripts/install-moonraker.sh"
|
install_script="${HOME}/moonraker/scripts/install-moonraker.sh"
|
||||||
@@ -134,13 +138,13 @@ install_moonraker_packages(){
|
|||||||
sudo apt-get install --yes ${PKGARR[@]}
|
sudo apt-get install --yes ${PKGARR[@]}
|
||||||
}
|
}
|
||||||
|
|
||||||
create_moonraker_virtualenv(){
|
create_moonraker_virtualenv() {
|
||||||
status_msg "Installing python virtual environment..."
|
status_msg "Installing python virtual environment..."
|
||||||
|
|
||||||
### If venv exists and user prompts a rebuild, then do so
|
### If venv exists and user prompts a rebuild, then do so
|
||||||
if [ -d ${MOONRAKER_ENV} ] && [ $REBUILD_ENV = "y" ]; then
|
if [ -d "${MOONRAKER_ENV}" ] && [ $REBUILD_ENV = "y" ]; then
|
||||||
status_msg "Removing old virtualenv"
|
status_msg "Removing old virtualenv"
|
||||||
rm -rf ${MOONRAKER_ENV}
|
rm -rf "${MOONRAKER_ENV}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -d ${MOONRAKER_ENV} ]; then
|
if [ ! -d ${MOONRAKER_ENV} ]; then
|
||||||
@@ -152,7 +156,7 @@ create_moonraker_virtualenv(){
|
|||||||
${MOONRAKER_ENV}/bin/pip install -r ${MOONRAKER_DIR}/scripts/moonraker-requirements.txt
|
${MOONRAKER_ENV}/bin/pip install -r ${MOONRAKER_DIR}/scripts/moonraker-requirements.txt
|
||||||
}
|
}
|
||||||
|
|
||||||
create_moonraker_service(){
|
create_moonraker_service() {
|
||||||
### get config directory
|
### get config directory
|
||||||
source_kiauh_ini
|
source_kiauh_ini
|
||||||
|
|
||||||
@@ -166,16 +170,16 @@ create_moonraker_service(){
|
|||||||
MR_SERV_SRC="${SRCDIR}/kiauh/resources/moonraker.service"
|
MR_SERV_SRC="${SRCDIR}/kiauh/resources/moonraker.service"
|
||||||
MR_SERV_TARGET="$SYSTEMD_DIR/moonraker.service"
|
MR_SERV_TARGET="$SYSTEMD_DIR/moonraker.service"
|
||||||
|
|
||||||
write_mr_service(){
|
write_mr_service() {
|
||||||
if [ ! -f $MR_SERV_TARGET ]; then
|
if [ ! -f $MR_SERV_TARGET ]; then
|
||||||
status_msg "Creating Moonraker Service $i ..."
|
status_msg "Creating Moonraker Service $i ..."
|
||||||
sudo cp $MR_SERV_SRC $MR_SERV_TARGET
|
sudo cp $MR_SERV_SRC $MR_SERV_TARGET
|
||||||
sudo sed -i "s|%INST%|$i|" $MR_SERV_TARGET
|
sudo sed -i "s|%INST%|$i|" $MR_SERV_TARGET
|
||||||
sudo sed -i "s|%USER%|${USER}|" $MR_SERV_TARGET
|
sudo sed -i "s|%USER%|${USER}|" $MR_SERV_TARGET
|
||||||
sudo sed -i "s|%MR_ENV%|$MR_ENV|" $MR_SERV_TARGET
|
sudo sed -i "s|%MR_ENV%|$MR_ENV|" $MR_SERV_TARGET
|
||||||
sudo sed -i "s|%MR_DIR%|$MR_DIR|" $MR_SERV_TARGET
|
sudo sed -i "s|%MR_DIR%|$MR_DIR|" $MR_SERV_TARGET
|
||||||
sudo sed -i "s|%MR_LOG%|$MR_LOG|" $MR_SERV_TARGET
|
sudo sed -i "s|%MR_LOG%|$MR_LOG|" $MR_SERV_TARGET
|
||||||
sudo sed -i "s|%MR_CONF%|$MR_CONF|" $MR_SERV_TARGET
|
sudo sed -i "s|%MR_CONF%|$MR_CONF|" $MR_SERV_TARGET
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,7 +207,7 @@ create_moonraker_service(){
|
|||||||
### launching instance
|
### launching instance
|
||||||
do_action_service "start" "moonraker-$i"
|
do_action_service "start" "moonraker-$i"
|
||||||
### raise values by 1
|
### raise values by 1
|
||||||
i=$((i+1))
|
i=$((i + 1))
|
||||||
done
|
done
|
||||||
unset i
|
unset i
|
||||||
|
|
||||||
@@ -217,7 +221,7 @@ create_moonraker_service(){
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
create_moonraker_conf(){
|
create_moonraker_conf() {
|
||||||
### get config directory
|
### get config directory
|
||||||
source_kiauh_ini
|
source_kiauh_ini
|
||||||
|
|
||||||
@@ -234,7 +238,7 @@ create_moonraker_conf(){
|
|||||||
IP=$(hostname -I | cut -d" " -f1)
|
IP=$(hostname -I | cut -d" " -f1)
|
||||||
LAN="$(hostname -I | cut -d" " -f1 | cut -d"." -f1-2).0.0/16"
|
LAN="$(hostname -I | cut -d" " -f1 | cut -d"." -f1-2).0.0/16"
|
||||||
|
|
||||||
write_mr_conf(){
|
write_mr_conf() {
|
||||||
[ ! -d $CFG_PATH ] && mkdir -p $CFG_PATH
|
[ ! -d $CFG_PATH ] && mkdir -p $CFG_PATH
|
||||||
if [ ! -f $MR_CONF ]; then
|
if [ ! -f $MR_CONF ]; then
|
||||||
status_msg "Creating moonraker.conf in $CFG_PATH ..."
|
status_msg "Creating moonraker.conf in $CFG_PATH ..."
|
||||||
@@ -277,14 +281,14 @@ create_moonraker_conf(){
|
|||||||
mr_ip_list+=("$IP:$PORT")
|
mr_ip_list+=("$IP:$PORT")
|
||||||
|
|
||||||
### raise values by 1
|
### raise values by 1
|
||||||
PORT=$((PORT+1))
|
PORT=$((PORT + 1))
|
||||||
i=$((i+1))
|
i=$((i + 1))
|
||||||
done
|
done
|
||||||
unset PORT && unset i
|
unset PORT && unset i
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
print_mr_ip_list(){
|
print_mr_ip_list() {
|
||||||
i=1
|
i=1
|
||||||
for ip in ${mr_ip_list[@]}; do
|
for ip in ${mr_ip_list[@]}; do
|
||||||
echo -e " ${cyan}● Instance $i:${default} $ip"
|
echo -e " ${cyan}● Instance $i:${default} $ip"
|
||||||
|
|||||||
4
scripts/install_moonraker-telegram-bot.sh → scripts/install_moonraker_telegram_bot.sh
Normal file → Executable file
4
scripts/install_moonraker-telegram-bot.sh → scripts/install_moonraker_telegram_bot.sh
Normal file → Executable file
@@ -1,4 +1,6 @@
|
|||||||
install_MoonrakerTelegramBot(){
|
#!/bin/bash
|
||||||
|
|
||||||
|
install_moonraker_telegram_bot(){
|
||||||
source_kiauh_ini
|
source_kiauh_ini
|
||||||
#MoonrakerTelegramBot main installation
|
#MoonrakerTelegramBot main installation
|
||||||
MoonrakerTelegramBot_setup
|
MoonrakerTelegramBot_setup
|
||||||
@@ -23,9 +23,9 @@ octoprint_setup(){
|
|||||||
add_reboot_permission
|
add_reboot_permission
|
||||||
|
|
||||||
### create and activate the virtualenv
|
### create and activate the virtualenv
|
||||||
[ ! -d $OCTOPRINT_ENV ] && mkdir -p $OCTOPRINT_ENV
|
[ ! -d $OCTOPRINT_DIR ] && mkdir -p $OCTOPRINT_DIR
|
||||||
status_msg "Set up virtualenv ..."
|
status_msg "Set up virtualenv ..."
|
||||||
cd $OCTOPRINT_ENV
|
cd $OCTOPRINT_DIR
|
||||||
virtualenv --python=python3 venv
|
virtualenv --python=python3 venv
|
||||||
source venv/bin/activate
|
source venv/bin/activate
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ Environment="LC_ALL=C.UTF-8"
|
|||||||
Environment="LANG=C.UTF-8"
|
Environment="LANG=C.UTF-8"
|
||||||
Type=simple
|
Type=simple
|
||||||
User=$USER
|
User=$USER
|
||||||
ExecStart=${OCTOPRINT_ENV}/venv/bin/octoprint --basedir ${BASEDIR} --config ${CONFIG_YAML} --port=${PORT} serve
|
ExecStart=${OCTOPRINT_DIR}/venv/bin/octoprint --basedir ${BASEDIR} --config ${CONFIG_YAML} --port=${PORT} serve
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
@@ -91,7 +91,7 @@ Environment="LC_ALL=C.UTF-8"
|
|||||||
Environment="LANG=C.UTF-8"
|
Environment="LANG=C.UTF-8"
|
||||||
Type=simple
|
Type=simple
|
||||||
User=$USER
|
User=$USER
|
||||||
ExecStart=${OCTOPRINT_ENV}/venv/bin/octoprint --basedir ${BASEDIR} --config ${CONFIG_YAML} --port=${PORT} serve
|
ExecStart=${OCTOPRINT_DIR}/venv/bin/octoprint --basedir ${BASEDIR} --config ${CONFIG_YAML} --port=${PORT} serve
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
### base variables
|
### base variables
|
||||||
PGC_FOR_KLIPPER_REPO="https://github.com/Kragrathea/pgcode"
|
PGC_FOR_KLIPPER_REPO="https://github.com/Kragrathea/pgcode"
|
||||||
PGC_DIR="${HOME}/pgcode"
|
PGC_DIR="${HOME}/pgcode"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
### base variables
|
#!/bin/bash
|
||||||
|
|
||||||
get_theme_list(){
|
get_theme_list(){
|
||||||
theme_csv_url="https://raw.githubusercontent.com/meteyou/mainsail/develop/docs/_data/themes.csv"
|
theme_csv_url="https://raw.githubusercontent.com/meteyou/mainsail/develop/docs/_data/themes.csv"
|
||||||
@@ -20,47 +20,6 @@ get_theme_list(){
|
|||||||
done <<< $theme_csv
|
done <<< $theme_csv
|
||||||
}
|
}
|
||||||
|
|
||||||
ms_theme_ui(){
|
|
||||||
top_border
|
|
||||||
echo -e "| ${red}~~~~~~~~ [ Mainsail Theme Installer ] ~~~~~~~${default} | "
|
|
||||||
hr
|
|
||||||
echo -e "| ${green}A preview of each Mainsail theme can be found here:${default} | "
|
|
||||||
echo -e "| https://docs.mainsail.xyz/theming/themes | "
|
|
||||||
blank_line
|
|
||||||
echo -e "| ${yellow}Important note:${default} | "
|
|
||||||
echo -e "| Installing a theme from this menu will overwrite an | "
|
|
||||||
echo -e "| already installed theme or modified custom.css file! | "
|
|
||||||
hr
|
|
||||||
#echo -e "| Theme: | "
|
|
||||||
# dynamically generate the themelist from a csv file
|
|
||||||
get_theme_list
|
|
||||||
echo -e "| | "
|
|
||||||
echo -e "| R) [Remove Theme] | "
|
|
||||||
#echo -e "| | "
|
|
||||||
back_footer
|
|
||||||
}
|
|
||||||
|
|
||||||
ms_theme_menu(){
|
|
||||||
ms_theme_ui
|
|
||||||
while true; do
|
|
||||||
read -p "${cyan}Install theme:${default} " a; echo
|
|
||||||
if [ $a = "b" ] || [ $a = "B" ]; then
|
|
||||||
clear && advanced_menu && break
|
|
||||||
elif [ $a = "r" ] || [ $a = "R" ]; then
|
|
||||||
ms_theme_delete
|
|
||||||
ms_theme_menu
|
|
||||||
elif [ $a -le ${#t_url[@]} ]; then
|
|
||||||
ms_theme_install "${t_auth[$a]}" "${t_url[$a]}" "${t_name[$a]}" "${t_note[$a]}"
|
|
||||||
ms_theme_menu
|
|
||||||
else
|
|
||||||
clear && print_header
|
|
||||||
ERROR_MSG="Invalid command!" && print_msg && clear_msg
|
|
||||||
ms_theme_menu
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
ms_theme_menu
|
|
||||||
}
|
|
||||||
|
|
||||||
check_select_printer(){
|
check_select_printer(){
|
||||||
unset printer_num
|
unset printer_num
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
set_nginx_cfg(){
|
set_nginx_cfg(){
|
||||||
if [ "$SET_NGINX_CFG" = "true" ]; then
|
if [ "$SET_NGINX_CFG" = "true" ]; then
|
||||||
#check for dependencies
|
#check for dependencies
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ save_klipper_state(){
|
|||||||
|
|
||||||
load_klipper_state(){
|
load_klipper_state(){
|
||||||
source_kiauh_ini
|
source_kiauh_ini
|
||||||
print_branch
|
get_branch
|
||||||
cd $KLIPPER_DIR
|
cd $KLIPPER_DIR
|
||||||
CURRENT_COMMIT=$(git rev-parse --short=8 HEAD)
|
CURRENT_COMMIT=$(git rev-parse --short=8 HEAD)
|
||||||
if [ "$GET_BRANCH" = "origin/master" ] || [ "$GET_BRANCH" = "master" ]; then
|
if [ "$GET_BRANCH" = "origin/master" ] || [ "$GET_BRANCH" = "master" ]; then
|
||||||
|
|||||||
@@ -230,7 +230,7 @@ klipperscreen_status(){
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
MoonrakerTelegramBot_status(){
|
update_moonraker_telegram_bot_status(){
|
||||||
mtbcount=0
|
mtbcount=0
|
||||||
MoonrakerTelegramBot_data=(
|
MoonrakerTelegramBot_data=(
|
||||||
SERVICE
|
SERVICE
|
||||||
@@ -290,7 +290,7 @@ read_branch(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
#prints the current klipper branch in the main menu
|
#prints the current klipper branch in the main menu
|
||||||
print_branch(){
|
get_branch(){
|
||||||
read_branch
|
read_branch
|
||||||
if [ ! -z "$GET_BRANCH" ]; then
|
if [ ! -z "$GET_BRANCH" ]; then
|
||||||
PRINT_BRANCH="$(printf "%-16s" "$GET_BRANCH")"
|
PRINT_BRANCH="$(printf "%-16s" "$GET_BRANCH")"
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
switch_to_master(){
|
switch_to_master(){
|
||||||
cd $KLIPPER_DIR
|
cd $KLIPPER_DIR
|
||||||
status_msg "Switching...Please wait ..."; echo
|
status_msg "Switching...Please wait ..."; echo
|
||||||
|
|||||||
@@ -1,140 +1,63 @@
|
|||||||
advanced_ui(){
|
#!/bin/bash
|
||||||
top_border
|
|
||||||
echo -e "| ${yellow}~~~~~~~~~~~~~ [ Advanced Menu ] ~~~~~~~~~~~~~${default} | "
|
|
||||||
hr
|
|
||||||
if [ ! "$OPRINT_SERVICE_STATUS" == "" ]; then
|
|
||||||
echo -e "| 0) $OPRINT_SERVICE_STATUS| "
|
|
||||||
hr
|
|
||||||
echo -e "| | | "
|
|
||||||
fi
|
|
||||||
echo -e "| Klipper: | Mainsail: | "
|
|
||||||
echo -e "| 1) [Switch Branch] | 7) [Theme installer] | "
|
|
||||||
echo -e "| 2) [Rollback] | | "
|
|
||||||
echo -e "| | System: | "
|
|
||||||
echo -e "| Firmware: | 8) [Change hostname] | "
|
|
||||||
echo -e "| 3) [Build only] | | "
|
|
||||||
echo -e "| 4) [Flash only] | Extensions: | "
|
|
||||||
echo -e "| 5) [Build + Flash] | 9) [Shell Command] | "
|
|
||||||
echo -e "| 6) [Get MCU ID] | | "
|
|
||||||
echo -e "| | CustomPiOS: | "
|
|
||||||
echo -e "| | 10) [Migration Helper] | "
|
|
||||||
back_footer
|
|
||||||
}
|
|
||||||
|
|
||||||
advanced_menu(){
|
advanced_menu(){
|
||||||
read_octoprint_service_status
|
|
||||||
do_action "" "advanced_ui"
|
local menu_options=(
|
||||||
|
"1" " "
|
||||||
|
"2" "Switch Klipper Branch"
|
||||||
|
"3" "Rollback Klipper"
|
||||||
|
"4" "Build Firmware"
|
||||||
|
"5" "Flash Firmware"
|
||||||
|
"6" "Build and Flash Firmware"
|
||||||
|
"7" "Get MCU ID"
|
||||||
|
"8" "Install Mainsail Theme"
|
||||||
|
"9" "Change System Hostname"
|
||||||
|
"10" "Run Shell Command"
|
||||||
|
"11" "CustomPiOS Migration Helper"
|
||||||
|
)
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
read -p "${cyan}Perform action:${default} " action; echo
|
read_octoprint_service_status
|
||||||
case "$action" in
|
menu_options[2]="Current OctoPrint Status: $OPRINT_SERVICE_STATUS"
|
||||||
0)
|
|
||||||
clear
|
|
||||||
print_header
|
|
||||||
toggle_octoprint_service
|
|
||||||
read_octoprint_service_status
|
|
||||||
print_msg && clear_msg
|
|
||||||
advanced_ui;;
|
|
||||||
1)
|
|
||||||
do_action "switch_menu";;
|
|
||||||
2)
|
|
||||||
do_action "load_klipper_state" "advanced_ui";;
|
|
||||||
3)
|
|
||||||
do_action "build_fw" "advanced_ui";;
|
|
||||||
4)
|
|
||||||
do_action "select_flash_method" "advanced_ui";;
|
|
||||||
5)
|
|
||||||
clear && print_header
|
|
||||||
status_msg "Please wait..."
|
|
||||||
build_fw
|
|
||||||
select_flash_method
|
|
||||||
print_msg && clear_msg
|
|
||||||
advanced_ui;;
|
|
||||||
6)
|
|
||||||
do_action "select_mcu_connection" "advanced_ui";;
|
|
||||||
7)
|
|
||||||
do_action "ms_theme_menu";;
|
|
||||||
8)
|
|
||||||
clear
|
|
||||||
print_header
|
|
||||||
create_custom_hostname && set_hostname
|
|
||||||
print_msg && clear_msg
|
|
||||||
advanced_ui;;
|
|
||||||
9)
|
|
||||||
do_action "setup_gcode_shell_command" "advanced_ui";;
|
|
||||||
10)
|
|
||||||
do_action "migration_menu";;
|
|
||||||
B|b)
|
|
||||||
clear; main_menu; break;;
|
|
||||||
*)
|
|
||||||
deny_action "advanced_ui";;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
advanced_menu
|
|
||||||
}
|
|
||||||
|
|
||||||
#############################################################
|
if [ ! "$OPRINT_SERVICE_STATUS" == "" ]; then
|
||||||
#############################################################
|
local menu
|
||||||
|
menu=$(whiptail --title "Advanced Menu" --cancel-button "Back" --notags --menu "Perform Action:"\
|
||||||
|
"$KIAUH_WHIPTAIL_NORMAL_HEIGHT" "$KIAUH_WHIPTAIL_NORMAL_WIDTH" 8 "${menu_options[@]}" 3>&1 1>&2 2>&3)
|
||||||
|
else
|
||||||
|
local menu
|
||||||
|
menu=$(whiptail --title "Advanced Menu" --cancel-button "Back" --notags --menu "Perform Action:"\
|
||||||
|
"$KIAUH_WHIPTAIL_NORMAL_HEIGHT" "$KIAUH_WHIPTAIL_NORMAL_WIDTH" 8 "${menu_options[@]:2}" 3>&1 1>&2 2>&3)
|
||||||
|
fi
|
||||||
|
|
||||||
switch_ui(){
|
local out=$?
|
||||||
top_border
|
if [ $out -eq 1 ]; then
|
||||||
echo -e "| $(title_msg "~~~~~~~~~ [ Switch Klipper Branch ] ~~~~~~~~~") |"
|
break
|
||||||
bottom_border
|
elif [ $out -eq 0 ]; then
|
||||||
echo
|
case "$menu" in
|
||||||
echo -e " $(title_msg "Active Branch: ")${green}$GET_BRANCH${default}"
|
1) clear
|
||||||
echo
|
print_header
|
||||||
top_border
|
toggle_octoprint_service
|
||||||
echo -e "| | "
|
read_octoprint_service_status
|
||||||
echo -e "| KevinOConnor: | "
|
print_msg && clear_msg;;
|
||||||
echo -e "| 1) [--> master] | "
|
2) do_action "switch_menu" ;;
|
||||||
echo -e "| | "
|
3) do_action "load_klipper_state";;
|
||||||
echo -e "| dmbutyugin: | "
|
4) do_action "build_fw" ;;
|
||||||
echo -e "| 2) [--> scurve-shaping] | "
|
5) do_action "select_flash_method" ;;
|
||||||
echo -e "| 3) [--> scurve-smoothing] | "
|
6) clear && print_header
|
||||||
back_footer
|
status_msg "Please wait..."
|
||||||
}
|
build_fw
|
||||||
|
select_flash_method
|
||||||
switch_menu(){
|
print_msg && clear_msg;;
|
||||||
if [ -d $KLIPPER_DIR ]; then
|
7) do_action "select_mcu_connection" ;;
|
||||||
read_branch
|
8) do_action "select_flash_method" ;;
|
||||||
do_action "" "switch_ui"
|
9) do_action "ms_theme_menu";;
|
||||||
while true; do
|
10) do_action "setup_gcode_shell_command" ;;
|
||||||
read -p "${cyan}Perform action:${default} " action; echo
|
11) migration_menu;;
|
||||||
case "$action" in
|
esac
|
||||||
1)
|
else
|
||||||
clear
|
# Unexpected event, no clue what happened
|
||||||
print_header
|
exit 1
|
||||||
switch_to_master
|
fi
|
||||||
read_branch
|
done
|
||||||
print_msg && clear_msg
|
|
||||||
switch_ui;;
|
|
||||||
2)
|
|
||||||
clear
|
|
||||||
print_header
|
|
||||||
switch_to_scurve_shaping
|
|
||||||
read_branch
|
|
||||||
print_msg && clear_msg
|
|
||||||
switch_ui;;
|
|
||||||
3)
|
|
||||||
clear
|
|
||||||
print_header
|
|
||||||
switch_to_scurve_smoothing
|
|
||||||
read_branch
|
|
||||||
print_msg && clear_msg
|
|
||||||
switch_ui;;
|
|
||||||
4)
|
|
||||||
clear
|
|
||||||
print_header
|
|
||||||
switch_to_moonraker
|
|
||||||
read_branch
|
|
||||||
print_msg && clear_msg
|
|
||||||
switch_ui;;
|
|
||||||
B|b)
|
|
||||||
clear; advanced_menu; break;;
|
|
||||||
*)
|
|
||||||
deny_action "switch_ui";;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
else
|
|
||||||
ERROR_MSG="No Klipper directory found! Download Klipper first!"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|||||||
1
scripts/ui/kiauh_update_yesno.sh
Normal file → Executable file
1
scripts/ui/kiauh_update_yesno.sh
Normal file → Executable file
@@ -1,3 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
#######################################
|
#######################################
|
||||||
# description Advise user to update KIAUH
|
# description Advise user to update KIAUH
|
||||||
# Globals:
|
# Globals:
|
||||||
|
|||||||
@@ -3,22 +3,25 @@
|
|||||||
main_menu() {
|
main_menu() {
|
||||||
#print KIAUH update msg if update available
|
#print KIAUH update msg if update available
|
||||||
local menu_options=(
|
local menu_options=(
|
||||||
"1" "Install"\
|
"1" "Install"
|
||||||
"2" "Update"\
|
"2" "Update"
|
||||||
"3" "Remove"\
|
"3" "Remove"
|
||||||
"4" "Advanced Settings"\
|
"4" "Advanced Settings"
|
||||||
"5" "Backup"\
|
"5" "Backup"
|
||||||
"6" "Settings"\
|
"6" "Settings"
|
||||||
"7" "Upload Log"\
|
"7" "Upload Log"
|
||||||
"8" "Service")
|
"8" "Service"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Ask for update only once
|
||||||
if [ "$KIAUH_UPDATE_AVAIL" = "true" ]; then
|
if [ "$KIAUH_UPDATE_AVAIL" = "true" ]; then
|
||||||
kiauh_update_dialog
|
kiauh_update_yesno
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
#check install status
|
#check install status
|
||||||
print_kiauh_version
|
#TODO it is install status, introduce a "service status" for service menu is probably a good idea, refactor required
|
||||||
|
check_kiauh_version
|
||||||
klipper_status
|
klipper_status
|
||||||
moonraker_status
|
moonraker_status
|
||||||
dwc2_status
|
dwc2_status
|
||||||
@@ -26,8 +29,8 @@ main_menu() {
|
|||||||
mainsail_status
|
mainsail_status
|
||||||
octoprint_status
|
octoprint_status
|
||||||
klipperscreen_status
|
klipperscreen_status
|
||||||
MoonrakerTelegramBot_status
|
update_moonraker_telegram_bot_status
|
||||||
print_branch
|
get_branch
|
||||||
print_msg && clear_msg
|
print_msg && clear_msg
|
||||||
|
|
||||||
local menu_str="Klipper: $KLIPPER_STATUS Branch: $PRINT_BRANCH\n
|
local menu_str="Klipper: $KLIPPER_STATUS Branch: $PRINT_BRANCH\n
|
||||||
@@ -35,6 +38,7 @@ Moonraker: $MOONRAKER_STATUS\n
|
|||||||
Mainsail: $MAINSAIL_STATUS Fluidd: $FLUIDD_STATUS
|
Mainsail: $MAINSAIL_STATUS Fluidd: $FLUIDD_STATUS
|
||||||
KlipperScreen: $KLIPPERSCREEN_STATUS Telegram Bot: $MOONRAKER_TELEGRAM_BOT_STATUS
|
KlipperScreen: $KLIPPERSCREEN_STATUS Telegram Bot: $MOONRAKER_TELEGRAM_BOT_STATUS
|
||||||
DWC2: $DWC2_STATUS OctoPrint: $OCTOPRINT_STATUS"
|
DWC2: $DWC2_STATUS OctoPrint: $OCTOPRINT_STATUS"
|
||||||
|
|
||||||
local menu
|
local menu
|
||||||
menu=$(whiptail --title "$KIAUH_TITLE $KIAUH_VER" --cancel-button "Finish" --notags --menu "$menu_str\n\nChoose an option:" \
|
menu=$(whiptail --title "$KIAUH_TITLE $KIAUH_VER" --cancel-button "Finish" --notags --menu "$menu_str\n\nChoose an option:" \
|
||||||
"$KIAUH_WHIPTAIL_NORMAL_HEIGHT" "$KIAUH_WHIPTAIL_NORMAL_WIDTH" 8 "${menu_options[@]}" 3>&1 1>&2 2>&3)
|
"$KIAUH_WHIPTAIL_NORMAL_HEIGHT" "$KIAUH_WHIPTAIL_NORMAL_WIDTH" 8 "${menu_options[@]}" 3>&1 1>&2 2>&3)
|
||||||
|
|||||||
@@ -1,26 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
remove_ui(){
|
|
||||||
top_border
|
|
||||||
echo -e "| ${red}~~~~~~~~~~~~~~ [ Remove Menu ] ~~~~~~~~~~~~~~${default} | "
|
|
||||||
hr
|
|
||||||
echo -e "| Directories which remain untouched: | "
|
|
||||||
echo -e "| --> Your printer configuration directory | "
|
|
||||||
echo -e "| --> ~/kiauh-backups | "
|
|
||||||
echo -e "| You need remove them manually if you wish so. | "
|
|
||||||
hr
|
|
||||||
echo -e "| Firmware: | Touchscreen GUI: | "
|
|
||||||
echo -e "| 1) [Klipper] | 5) [KlipperScreen] | "
|
|
||||||
echo -e "| | | "
|
|
||||||
echo -e "| Klipper API: | Other: | "
|
|
||||||
echo -e "| 2) [Moonraker] | 6) [Duet Web Control] | "
|
|
||||||
echo -e "| | 7) [OctoPrint] | "
|
|
||||||
echo -e "| Klipper Webinterface: | 8) [PrettyGCode] | "
|
|
||||||
echo -e "| 3) [Mainsail] | 9) [Telegram Bot] | "
|
|
||||||
echo -e "| 4) [Fluidd] | | "
|
|
||||||
echo -e "| | 10) [MJPG-Streamer] | "
|
|
||||||
echo -e "| | 11) [NGINX] | "
|
|
||||||
back_footer
|
|
||||||
}
|
|
||||||
|
|
||||||
remove_menu(){
|
remove_menu(){
|
||||||
#TODO Currently it's a "dumb" remove page, looking for a "smart" one
|
#TODO Currently it's a "dumb" remove page, looking for a "smart" one
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
settings_ui(){
|
settings_ui(){
|
||||||
source_kiauh_ini
|
source_kiauh_ini
|
||||||
top_border
|
top_border
|
||||||
|
|||||||
96
scripts/ui/switch_menu.sh
Executable file
96
scripts/ui/switch_menu.sh
Executable file
@@ -0,0 +1,96 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
switch_ui(){
|
||||||
|
SWITCH_MENU_STR="Active Branch: $GET_BRANCH"
|
||||||
|
SWITCH_MENU=$(whiptail --title "Switch Klipper Branch" --cancel-button "Back" --menu "$SWITCH_MENU_STR\n\nSelect a Branch Owner:"\
|
||||||
|
"$KIAUH_WHIPTAIL_NORMAL_HEIGHT" "$KIAUH_WHIPTAIL_NORMAL_WIDTH" 8\
|
||||||
|
"1 Klipper3D" "Official Klipper3D"\
|
||||||
|
"2 dmbutyugin" "dmbutyugin S-Curve Acceleration"\
|
||||||
|
"3 Custom" "Pick a custom branch" 3>&1 1>&2 2>&3)
|
||||||
|
|
||||||
|
OUT=$SWITCH_MENU
|
||||||
|
case "$OUT" in
|
||||||
|
1\ *) Something;;
|
||||||
|
2\ *) install_menu ;;
|
||||||
|
3\ *) echo "Custom Branch" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
KILPPER3D_MENU_STR="Active Branch: $GET_BRANCH"
|
||||||
|
KILPPER3D_MENU=$(whiptail --title "Switch Klipper Branch" --cancel-button "Back" --menu "$KILPPER3D_MENU_STR\n\nSelect a Branch:"\
|
||||||
|
"$KIAUH_WHIPTAIL_NORMAL_HEIGHT" "$KIAUH_WHIPTAIL_NORMAL_WIDTH" 8\
|
||||||
|
"1 master" "Official Klipper with rolling update")
|
||||||
|
|
||||||
|
OUT=$KILPPER3D_MENU
|
||||||
|
case "$OUT" in
|
||||||
|
1\ *) Something;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
DMBUTYUGIN_MENU_STR="Active Branch: $GET_BRANCH"
|
||||||
|
DMBUTYUGIN_MENU=$(whiptail --title "Switch Klipper Branch" --cancel-button "Back" --menu "$DMBUTYUGIN_MENU\n\nSelect a Branch:"\
|
||||||
|
"$KIAUH_WHIPTAIL_NORMAL_HEIGHT" "$KIAUH_WHIPTAIL_NORMAL_WIDTH" 8\
|
||||||
|
"1 scurve-shaping" "Official Klipper with rolling update"\
|
||||||
|
"2 scurve-smoothing" "Pick a custom branch/tag" 3>&1 1>&2 2>&3)
|
||||||
|
|
||||||
|
OUT=$DMBUTYUGIN_MENU
|
||||||
|
case "$OUT" in
|
||||||
|
1\ *) Something;;
|
||||||
|
2\ *) install_menu ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
CUSTOM_BRANCH_MENU_MENU=$(whiptail --title "Switch Klipper Branch" --cancel-button "Back" --inputbox "Paste the link of a Klipper Git repository:"\
|
||||||
|
"$KIAUH_WHIPTAIL_NORMAL_HEIGHT" "$KIAUH_WHIPTAIL_NORMAL_WIDTH" "github.com/Klipper3d/klipper" 3>&1 1>&2 2>&3)
|
||||||
|
|
||||||
|
OUT=$CUSTOM_BRANCH_MENU_MENU
|
||||||
|
case "$OUT" in
|
||||||
|
1\ *) Something;;
|
||||||
|
2\ *) install_menu ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
# TODO Automatically list the available branches of an account or allow type in custom
|
||||||
|
|
||||||
|
switch_menu(){
|
||||||
|
if [ -d $KLIPPER_DIR ]; then
|
||||||
|
read_branch
|
||||||
|
do_action "" "switch_ui"
|
||||||
|
while true; do
|
||||||
|
read -p "${cyan}Perform action:${default} " action; echo
|
||||||
|
case "$action" in
|
||||||
|
1)
|
||||||
|
clear
|
||||||
|
print_header
|
||||||
|
switch_to_master
|
||||||
|
read_branch
|
||||||
|
print_msg && clear_msg
|
||||||
|
switch_ui;;
|
||||||
|
2)
|
||||||
|
clear
|
||||||
|
print_header
|
||||||
|
switch_to_scurve_shaping
|
||||||
|
read_branch
|
||||||
|
print_msg && clear_msg
|
||||||
|
switch_ui;;
|
||||||
|
3)
|
||||||
|
clear
|
||||||
|
print_header
|
||||||
|
switch_to_scurve_smoothing
|
||||||
|
read_branch
|
||||||
|
print_msg && clear_msg
|
||||||
|
switch_ui;;
|
||||||
|
4)
|
||||||
|
clear
|
||||||
|
print_header
|
||||||
|
switch_to_moonraker
|
||||||
|
read_branch
|
||||||
|
print_msg && clear_msg
|
||||||
|
switch_ui;;
|
||||||
|
B|b)
|
||||||
|
clear; advanced_menu; break;;
|
||||||
|
*)
|
||||||
|
deny_action "switch_ui";;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
else
|
||||||
|
ERROR_MSG="No Klipper directory found! Download Klipper first!"
|
||||||
|
fi
|
||||||
|
}
|
||||||
69
scripts/ui/theme_menu.sh
Executable file
69
scripts/ui/theme_menu.sh
Executable file
@@ -0,0 +1,69 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
ms_theme_ui(){
|
||||||
|
top_border
|
||||||
|
echo -e "| ${red}~~~~~~~~ [ Mainsail Theme Installer ] ~~~~~~~${default} | "
|
||||||
|
hr
|
||||||
|
echo -e "| ${green}A preview of each Mainsail theme can be found here:${default} | "
|
||||||
|
echo -e "| https://docs.mainsail.xyz/theming/themes | "
|
||||||
|
blank_line
|
||||||
|
echo -e "| ${yellow}Important note:${default} | "
|
||||||
|
echo -e "| Installing a theme from this menu will overwrite an | "
|
||||||
|
echo -e "| already installed theme or modified custom.css file! | "
|
||||||
|
hr
|
||||||
|
#echo -e "| Theme: | "
|
||||||
|
# dynamically generate the themelist from a csv file
|
||||||
|
get_theme_list
|
||||||
|
echo -e "| | "
|
||||||
|
echo -e "| R) [Remove Theme] | "
|
||||||
|
#echo -e "| | "
|
||||||
|
back_footer
|
||||||
|
}
|
||||||
|
|
||||||
|
ms_theme_menu(){
|
||||||
|
|
||||||
|
local menu_options=(
|
||||||
|
"1" "Migrate MainsailOS"
|
||||||
|
"2" "Migrate FluiddPi"
|
||||||
|
)
|
||||||
|
local menu_str="This function will help you to migrate a vanilla MainsailOS or FluiddPi image to a newer state.
|
||||||
|
Only use this function if you use MainsailOS 0.4.0 or lower, or FluiddPi v1.13.0 or lower.
|
||||||
|
Please have a look at the KIAUH changelog for more details on what this function will do."
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
local menu
|
||||||
|
menu=$(whiptail --title "Mainsail Theme Installer" --cancel-button "Back" --notags --menu "$menu_str\n\nInstall/Remove Theme:" \
|
||||||
|
"$KIAUH_WHIPTAIL_NORMAL_HEIGHT" "$KIAUH_WHIPTAIL_NORMAL_WIDTH" 8 "${menu_options[@]}" 3>&1 1>&2 2>&3)
|
||||||
|
local out=$?
|
||||||
|
if [ $out -eq 1 ]; then
|
||||||
|
break
|
||||||
|
elif [ $out -eq 0 ]; then
|
||||||
|
case "$menu" in
|
||||||
|
1) migrate_custompios "mainsail";;
|
||||||
|
2) migrate_custompios "fluiddpi";;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
# Unexpected event, no clue what happened
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
ms_theme_ui
|
||||||
|
while true; do
|
||||||
|
read -p "${cyan}Install theme:${default} " a; echo
|
||||||
|
if [ $a = "b" ] || [ $a = "B" ]; then
|
||||||
|
clear && advanced_menu && break
|
||||||
|
elif [ $a = "r" ] || [ $a = "R" ]; then
|
||||||
|
ms_theme_delete
|
||||||
|
ms_theme_menu
|
||||||
|
elif [ $a -le ${#t_url[@]} ]; then
|
||||||
|
ms_theme_install "${t_auth[$a]}" "${t_url[$a]}" "${t_name[$a]}" "${t_note[$a]}"
|
||||||
|
ms_theme_menu
|
||||||
|
else
|
||||||
|
clear && print_header
|
||||||
|
ERROR_MSG="Invalid command!" && print_msg && clear_msg
|
||||||
|
ms_theme_menu
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
ms_theme_menu
|
||||||
|
}
|
||||||
@@ -1,4 +1,7 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
update_ui(){
|
update_ui(){
|
||||||
|
# TODO Try to match the width so we can use the menu text to show local and remote version
|
||||||
ui_print_versions
|
ui_print_versions
|
||||||
top_border
|
top_border
|
||||||
echo -e "| ${green}~~~~~~~~~~~~~~ [ Update Menu ] ~~~~~~~~~~~~~~${default} | "
|
echo -e "| ${green}~~~~~~~~~~~~~~ [ Update Menu ] ~~~~~~~~~~~~~~${default} | "
|
||||||
|
|||||||
0
scripts/ui/upload_yesno.sh
Normal file → Executable file
0
scripts/ui/upload_yesno.sh
Normal file → Executable file
@@ -1,3 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
update_kiauh(){
|
update_kiauh(){
|
||||||
if [ "$KIAUH_UPDATE_AVAIL" = "true" ]; then
|
if [ "$KIAUH_UPDATE_AVAIL" = "true" ]; then
|
||||||
status_msg "Updating KIAUH ..."
|
status_msg "Updating KIAUH ..."
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
upload_selection(){
|
upload_selection(){
|
||||||
source_kiauh_ini
|
source_kiauh_ini
|
||||||
|
# TODO Whiptail probably changed logic here
|
||||||
[ "$logupload_accepted" = "false" ] && upload_yesno
|
[ "$logupload_accepted" = "false" ] && upload_yesno
|
||||||
|
|
||||||
### find all suitable logfiles for klipper
|
### find all suitable logfiles for klipper
|
||||||
|
|||||||
Reference in New Issue
Block a user