From e2407b3a920ba7ae9c6a0907c6a001a7b018f542 Mon Sep 17 00:00:00 2001 From: Evgenii Date: Sat, 11 Sep 2021 00:50:41 +0300 Subject: [PATCH 01/16] Add moonraker-telegram-bot to kiauh --- kiauh.sh | 4 ++ scripts/backup.sh | 14 +++++ scripts/functions.sh | 15 +++++ scripts/install_moonraker-telegram-bot.sh | 67 +++++++++++++++++++++++ scripts/remove.sh | 43 +++++++++++++++ scripts/status.sh | 59 ++++++++++++++++++++ scripts/ui/backup_menu.sh | 3 + scripts/ui/install_menu.sh | 8 +-- scripts/ui/main_menu.sh | 3 +- scripts/ui/remove_menu.sh | 32 ++++++----- scripts/ui/update_menu.sh | 1 + scripts/update.sh | 12 ++++ 12 files changed, 241 insertions(+), 20 deletions(-) create mode 100644 scripts/install_moonraker-telegram-bot.sh diff --git a/kiauh.sh b/kiauh.sh index 157e83a..c56cf03 100755 --- a/kiauh.sh +++ b/kiauh.sh @@ -38,6 +38,9 @@ OCTOPRINT_DIR=${HOME}/OctoPrint #KlipperScreen KLIPPERSCREEN_DIR=${HOME}/KlipperScreen KLIPPERSCREEN_ENV_DIR=${HOME}/.KlipperScreen-env +#moonraker-telegram-bot +MOONRAKERTELEGRAMBOT_DIR=${HOME}/moonraker-telegram-bot +MOONRAKERTELEGRAMBOT_ENV_DIR=${HOME}/moonraker-telegram-bot-env #misc INI_FILE=${HOME}/.kiauh.ini BACKUP_DIR=${HOME}/kiauh-backups @@ -48,6 +51,7 @@ 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-socket.git KLIPPERSCREEN_REPO=https://github.com/jordanruthe/KlipperScreen.git +NLEF_REPO=https://github.com/nlef/moonraker-telegram-bot.git #branches BRANCH_SCURVE_SMOOTHING=dmbutyugin/scurve-smoothing BRANCH_SCURVE_SHAPING=dmbutyugin/scurve-shaping diff --git a/scripts/backup.sh b/scripts/backup.sh index 305d429..afd3ac5 100755 --- a/scripts/backup.sh +++ b/scripts/backup.sh @@ -179,3 +179,17 @@ backup_klipperscreen(){ ERROR_MSG=" Can't backup KlipperScreen directory!\n Not found!" fi } + +backup_klipperscreen(){ + if [ -d $MOONRAKERTELEGRAMBOT_DIR ] ; then + status_msg "Creating moonraker-telegram-bot backup ..." + check_for_backup_dir + get_date + status_msg "Timestamp: $current_date" + mkdir -p $BACKUP_DIR/moonraker-telegram-bot-backups/"$current_date" + cp -r $MOONRAKERTELEGRAMBOT_DIR $_ + ok_msg "Backup complete!" + else + ERROR_MSG=" Can't backup KlipperScreen directory!\n Not found!" + fi +} diff --git a/scripts/functions.sh b/scripts/functions.sh index 455ebe5..8b31b75 100755 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -270,6 +270,21 @@ restart_klipperscreen(){ sudo systemctl restart KlipperScreen && ok_msg "KlipperScreen Service restarted!" } +start_moonraker-telegram-bot(){ + status_msg "Starting moonraker-telegram-bot Service ..." + sudo systemctl start moonraker-telegram-bot && ok_msg "moonraker-telegram-bot Service started!" +} + +stop_moonraker-telegram-bot(){ + status_msg "Stopping moonraker-telegram-bot Service ..." + sudo systemctl stop moonraker-telegram-bot && ok_msg "moonraker-telegram-bot Service stopped!" +} + +restart_moonraker-telegram-bot(){ + status_msg "Restarting moonraker-telegram-bot Service ..." + sudo systemctl restart moonraker-telegram-bot && ok_msg "moonraker-telegram-bot Service restarted!" +} + restart_nginx(){ if [ "$(systemctl list-units --full -all -t service --no-legend | grep -F "nginx.service")" ]; then status_msg "Restarting NGINX Service ..." diff --git a/scripts/install_moonraker-telegram-bot.sh b/scripts/install_moonraker-telegram-bot.sh new file mode 100644 index 0000000..b8437ad --- /dev/null +++ b/scripts/install_moonraker-telegram-bot.sh @@ -0,0 +1,67 @@ +install_moonraker-telegram-bot(){ + source_kiauh_ini + system_check_moonraker-telegram-bot + #ask user for customization + get_user_selections_moonraker-telegram-bot + #moonraker-telegram-bot main installation + moonraker-telegram-bot_setup + #execute customizations + symlinks_moonraker-telegram-bot + #after install actions + restart_moonraker-telegram-bot +} + +system_check_moonraker-telegram-bot(){ + source_kiauh_ini + if [ ! -e $klipper_cfg_loc/telegram.log ]; then + MOONRAKERTELEGRAMBOT_SL_FOUND="false" + else + MOONRAKERTELEGRAMBOT_SL_FOUND="true" + fi +} + +get_user_selections_moonraker-telegram-bot(){ + #user selection for telegram.log symlink + if [ "$KMOONRAKERTELEGRAMBOT_SL_FOUND" = "false" ]; then + while true; do + echo + read -p "${cyan}###### Create telegram.log symlink? (y/N):${default} " yn + case "$yn" in + Y|y|Yes|yes) + echo -e "###### > Yes" + SEL_MTBLOG_SL="true" + break;; + N|n|No|no|"") + echo -e "###### > No" + SEL_MTBLOG_SL="false" + break;; + *) + print_unkown_cmd + print_msg && clear_msg;; + esac + done + fi +} + +moonraker-telegram-bot_setup(){ + dep=(wget curl unzip dfu-util) + dependency_check + status_msg "Downloading moonraker-telegram-bot ..." + #force remove existing moonraker-telegram-bot dir + [ -d $MOONRAKERTELEGRAMBOT_DIR ] && rm -rf $MOONRAKERTELEGRAMBOT_DIR + #clone into fresh moonraker-telegram-bot dir + cd ${HOME} && git clone $MOONRAKERTELEGRAMBOT_REPO + ok_msg "Download complete!" + status_msg "Installing moonraker-telegram-bot ..." + $MOONRAKERTELEGRAMBOT_DIR/install.sh + echo; ok_msg "moonraker-telegram-bot successfully installed!" +} + +symlinks_moonraker-telegram-bot(){ + #create a telegram.log symlink in klipper_config-dir + if [ "$SEL_MTBLOG_SL" = "true" ] && [ ! -e $klipper_cfg_loc/telegram.log ]; then + status_msg "Creating telegram.log symlink ..." + ln -s /tmp/telegram.log $klipper_cfg_loc + ok_msg "Symlink created!" + fi +} diff --git a/scripts/remove.sh b/scripts/remove.sh index 604fe42..ed4f4d9 100755 --- a/scripts/remove.sh +++ b/scripts/remove.sh @@ -387,6 +387,49 @@ remove_klipperscreen(){ CONFIRM_MSG="KlipperScreen successfully removed!" } +remove_moonraker-telegram-bot(){ + source_kiauh_ini + + ### remove moonraker-telegram-bot dir + if [ -d $MOONRAKERTELEGRAMBOT_DIR ]; then + status_msg "Removing moonraker-telegram-bot directory ..." + rm -rf $MOONRAKERTELEGRAMBOT_DIR && ok_msg "Directory removed!" + fi + + ### remove moonraker-telegram-bot VENV dir + if [ -d $MOONRAKERTELEGRAMBOT_ENV_DIR ]; then + status_msg "Removing moonraker-telegram-bot VENV directory ..." + rm -rf $MOONRAKERTELEGRAMBOT_ENV_DIR && ok_msg "Directory removed!" + fi + + ### remove moonraker-telegram-bot service + if [ -e /etc/systemd/system/moonraker-telegram-bot.service ]; then + status_msg "Removing moonraker-telegram-bot service ..." + sudo systemctl stop moonraker-telegram-bot + sudo systemctl disable moonraker + sudo rm -f $SYSTEMDDIR/moonraker-telegram-bot.service + ###reloading units + sudo systemctl daemon-reload + sudo systemctl reset-failed + ok_msg "moonraker-telegram-bot Service removed!" + fi + + ### remove moonraker-telegram-bot log + if [ -e /tmp/telegram.log ]; then + status_msg "Removing moonraker-telegram-bot log file ..." + rm -f /tmp/telegram.log && ok_msg "File removed!" + fi + + ### remove moonraker-telegram-bot log symlink in config dir + + if [ -e $klipper_cfg_loc/telegram.log ]; then + status_msg "Removing moonraker-telegram-bot log symlink ..." + rm -f $klipper_cfg_loc/telegram.log && ok_msg "File removed!" + fi + + CONFIRM_MSG="moonraker-telegram-bot successfully removed!" +} + remove_mjpg-streamer(){ ### remove MJPG-Streamer service if [ -e $SYSTEMDDIR/webcamd.service ]; then diff --git a/scripts/status.sh b/scripts/status.sh index cee1b04..390b94b 100755 --- a/scripts/status.sh +++ b/scripts/status.sh @@ -228,6 +228,36 @@ klipperscreen_status(){ fi } +moonraker-telegram-bot_status(){ + mtbcount=0 + moonraker-telegram-bot_data=( + SERVICE + $MOONRAKERTELEGRAMBOT_DIR + $MOONRAKERTELEGRAMBOT_ENV_DIR + ) + + ### count amount of moonraker-telegram-bot_data service files in /etc/systemd/system + SERVICE_FILE_COUNT=$(ls /etc/systemd/system | grep -E "moonraker-telegram-bot" | wc -l) + + ### remove the "SERVICE" entry from the moonraker-telegram-bot_data array if a moonraker-telegram-bot service is installed + [ $SERVICE_FILE_COUNT -gt 0 ] && unset moonraker-telegram-bot_data[0] + + #count+1 for each found data-item from array + for mtbd in "${moonraker-telegram-bot_data[@]}" + do + if [ -e $mtbd ]; then + mtbcount=$(expr $mtbcount + 1) + fi + done + if [ "$mtbccount" == "${#moonraker-telegram-bot_data[*]}" ]; then + MOONRAKERTELEGRAMBOT_STATUS="${green}Installed!${default} " + elif [ "$klsccount" == 0 ]; then + MOONRAKERTELEGRAMBOT_STATUS="${red}Not installed!${default} " + else + MOONRAKERTELEGRAMBOT_STATUS="${yellow}Incomplete!${default} " + fi +} + ############################################################# ############################################################# @@ -517,6 +547,34 @@ compare_klipperscreen_versions(){ fi } +read_moonraker-telegram-bot_versions(){ + if [ -d $MOONRAKERTELEGRAMBOT_DIR ] && [ -d $MOONRAKERTELEGRAMBOT_DIR/.git ]; then + cd $MOONRAKERTELEGRAMBOT_DIR + git fetch origin master -q + LOCAL_MOONRAKERTELEGRAMBOT_COMMIT=$(git describe HEAD --always --tags | cut -d "-" -f 1,2) + REMOTE_MOONRAKERTELEGRAMBOT_COMMIT=$(git describe origin/master --always --tags | cut -d "-" -f 1,2) + else + LOCAL_MOONRAKERTELEGRAMBOT_COMMIT=$NONE + REMOTE_MOONRAKERTELEGRAMBOT_COMMIT=$NONE + fi +} + +compare_moonraker-telegram-bot_versions(){ + unset MOONRAKERTELEGRAMBOT_UPDATE_AVAIL + read_moonraker-telegram-bot_versions + if [ "$LOCAL_MOONRAKERTELEGRAMBOT_COMMIT" != "$REMOTE_MOONRAKERTELEGRAMBOT_COMMIT" ]; then + LOCAL_MOONRAKERTELEGRAMBOT_COMMIT="${yellow}$(printf "%-12s" "$LOCAL_MOONRAKERTELEGRAMBOT_COMMIT")${default}" + REMOTE_MOONRAKERTELEGRAMBOT_COMMIT="${green}$(printf "%-12s" "$REMOTE_MOONRAKERTELEGRAMBOT_COMMIT")${default}" + MOONRAKERTELEGRAMBOT_UPDATE_AVAIL="true" + update_arr+=(update_moonraker-telegram-bot) + else + LOCAL_MOONRAKERTELEGRAMBOT_COMMIT="${green}$(printf "%-12s" "$LOCAL_MOONRAKERTELEGRAMBOT_COMMIT")${default}" + REMOTE_MOONRAKERTELEGRAMBOT_COMMIT="${green}$(printf "%-12s" "$REMOTE_MOONRAKERTELEGRAMBOT_COMMIT")${default}" + MOONRAKERTELEGRAMBOT_UPDATE_AVAIL="false" + fi +} + + ############################################################# ############################################################# @@ -533,4 +591,5 @@ ui_print_versions(){ compare_mainsail_versions compare_fluidd_versions compare_klipperscreen_versions + compare_moonraker-telegram-bot } diff --git a/scripts/ui/backup_menu.sh b/scripts/ui/backup_menu.sh index 16755a1..82f9e87 100755 --- a/scripts/ui/backup_menu.sh +++ b/scripts/ui/backup_menu.sh @@ -14,6 +14,7 @@ backup_ui(){ echo -e "| 2) [Moonraker] | Other: | " echo -e "| 3) [Moonraker DB] | 7) [Duet Web Control] | " echo -e "| | 8) [OctoPrint] | " + echo -e "| | 9) [MoonrakerTelegramBot] | " quit_footer } @@ -40,6 +41,8 @@ backup_menu(){ do_action "backup_dwc2" "backup_ui";; 8) do_action "backup_octoprint" "backup_ui";; + 9) + do_action "backup_moonraker-telegram-bot" "backup_ui";; Q|q) clear; main_menu; break;; *) diff --git a/scripts/ui/install_menu.sh b/scripts/ui/install_menu.sh index e5a03f7..94e6f44 100755 --- a/scripts/ui/install_menu.sh +++ b/scripts/ui/install_menu.sh @@ -12,10 +12,10 @@ install_ui(){ echo -e "| Klipper API: | Other: | " echo -e "| 2) [Moonraker] | 6) [Duet Web Control] | " echo -e "| | 7) [OctoPrint] | " - echo -e "| Klipper Webinterface: | | " - echo -e "| 3) [Mainsail] | Webcam: | " - echo -e "| 4) [Fluidd] | 8) [MJPG-Streamer] | " - echo -e "| | | " + echo -e "| Klipper Webinterface: | 9) [MoonrakerTelegramBot]| " + echo -e "| 3) [Mainsail] | | " + echo -e "| 4) [Fluidd] | Webcam: | " + echo -e "| | 8) [MJPG-Streamer] | " quit_footer } diff --git a/scripts/ui/main_menu.sh b/scripts/ui/main_menu.sh index cd26827..624c6d7 100755 --- a/scripts/ui/main_menu.sh +++ b/scripts/ui/main_menu.sh @@ -11,7 +11,8 @@ main_ui(){ echo -e "| 4) [Advanced] | Mainsail: $MAINSAIL_STATUS|" echo -e "| 5) [Backup] | Fluidd: $FLUIDD_STATUS|" echo -e "| | KlipperScreen: $KLIPPERSCREEN_STATUS|" - echo -e "| 6) [Settings] | |" + echo -e "| 6) [Settings] | MTelegramBot: $MOONRAKERTELEGRAMBOT_STATUS|" + echo -e "| | |" echo -e "| | DWC2: $DWC2_STATUS|" echo -e "| ${cyan}$KIAUH_VER${default}| Octoprint: $OCTOPRINT_STATUS|" quit_footer diff --git a/scripts/ui/remove_menu.sh b/scripts/ui/remove_menu.sh index 48eb07d..a4d8c77 100755 --- a/scripts/ui/remove_menu.sh +++ b/scripts/ui/remove_menu.sh @@ -1,22 +1,22 @@ remove_ui(){ top_border - echo -e "| ${red}~~~~~~~~~~~~~~ [ Remove Menu ] ~~~~~~~~~~~~~~${default} | " + 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. | " + 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) [NGINX] | " - echo -e "| 3) [Mainsail] | 9) [MJPG-Streamer] | " - echo -e "| 4) [Fluidd] | | " - echo -e "| | | " + 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) [NGINX] | " + echo -e "| 3) [Mainsail] | 9) [MJPG-Streamer] | " + echo -e "| 4) [Fluidd] | 10) [MoonrakerTelegramBot] | " + echo -e "| | | " quit_footer } @@ -43,6 +43,8 @@ remove_menu(){ do_action "remove_nginx" "remove_ui";; 9) do_action "remove_mjpg-streamer" "remove_ui";; + 10) + do_action "remove_moonraker-telegram-bot" "remove_ui";; Q|q) clear; main_menu; break;; *) diff --git a/scripts/ui/update_menu.sh b/scripts/ui/update_menu.sh index 5306836..289900f 100755 --- a/scripts/ui/update_menu.sh +++ b/scripts/ui/update_menu.sh @@ -21,6 +21,7 @@ update_ui(){ echo -e "| Other: |---------------|--------------| " echo -e "| 6) [DWC2-for-Klipper] | $LOCAL_DWC2FK_COMMIT | $REMOTE_DWC2FK_COMMIT | " echo -e "| 7) [DWC2 Web UI] | $DWC2_LOCAL_VER | $DWC2_REMOTE_VER | " + echo -e "| 5) [MTelegramBot] | $LOCAL_MOONRAKERTELEGRAMBOT_COMMIT | $REMOTE_MOONRAKERTELEGRAMBOT_COMMIT | " echo -e "| |------------------------------| " echo -e "| 8) [System] | $DISPLAY_SYS_UPDATE | " quit_footer diff --git a/scripts/update.sh b/scripts/update.sh index 616a541..5372a58 100755 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -39,6 +39,9 @@ update_all(){ if [ "$KLIPPERSCREEN_UPDATE_AVAIL" = "true" ]; then echo -e "| ${cyan}● KlipperScreen${default} |" fi + if [ "$MOONRAKERTELEGRAMBOT_UPDATE_AVAIL" = "true" ]; then + echo -e "| ${cyan}● moonraker-telegram-bot${default} |" + fi if [ "$SYS_UPDATE_AVAIL" = "true" ]; then echo -e "| ${cyan}● System${default} |" fi @@ -170,6 +173,15 @@ update_klipperscreen(){ start_klipperscreen } +update_moonraker-telegram-bot(){ + stop_moonraker-telegram-bot + cd $MOONRAKERTELEGRAMBOT_DIR + git pull + ./install.sh + ok_msg "Update complete!" + start_moonraker-telegram-bot +} + update_system(){ status_msg "Updating System ..." sudo apt-get update && sudo apt-get upgrade -y From 464cdc4f69198a68519768695311693ec6c23a4d Mon Sep 17 00:00:00 2001 From: Evgenii Date: Sat, 11 Sep 2021 01:18:54 +0300 Subject: [PATCH 02/16] fix --- kiauh.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kiauh.sh b/kiauh.sh index c56cf03..9bbeaf9 100755 --- a/kiauh.sh +++ b/kiauh.sh @@ -38,7 +38,7 @@ OCTOPRINT_DIR=${HOME}/OctoPrint #KlipperScreen KLIPPERSCREEN_DIR=${HOME}/KlipperScreen KLIPPERSCREEN_ENV_DIR=${HOME}/.KlipperScreen-env -#moonraker-telegram-bot +#MoonrakerTelegramBot MOONRAKERTELEGRAMBOT_DIR=${HOME}/moonraker-telegram-bot MOONRAKERTELEGRAMBOT_ENV_DIR=${HOME}/moonraker-telegram-bot-env #misc From 617852de656e63112dc1c0263c01fe3d3016a1cc Mon Sep 17 00:00:00 2001 From: Evgenii Date: Sat, 11 Sep 2021 01:20:07 +0300 Subject: [PATCH 03/16] fix --- scripts/backup.sh | 4 +-- scripts/functions.sh | 18 ++++++------- scripts/install_moonraker-telegram-bot.sh | 32 +++++++++++------------ scripts/remove.sh | 32 +++++++++++------------ scripts/status.sh | 26 +++++++++--------- scripts/ui/backup_menu.sh | 2 +- scripts/ui/remove_menu.sh | 2 +- scripts/update.sh | 8 +++--- 8 files changed, 62 insertions(+), 62 deletions(-) diff --git a/scripts/backup.sh b/scripts/backup.sh index afd3ac5..4c6e9af 100755 --- a/scripts/backup.sh +++ b/scripts/backup.sh @@ -182,11 +182,11 @@ backup_klipperscreen(){ backup_klipperscreen(){ if [ -d $MOONRAKERTELEGRAMBOT_DIR ] ; then - status_msg "Creating moonraker-telegram-bot backup ..." + status_msg "Creating MoonrakerTelegramBot backup ..." check_for_backup_dir get_date status_msg "Timestamp: $current_date" - mkdir -p $BACKUP_DIR/moonraker-telegram-bot-backups/"$current_date" + mkdir -p $BACKUP_DIR/MoonrakerTelegramBot-backups/"$current_date" cp -r $MOONRAKERTELEGRAMBOT_DIR $_ ok_msg "Backup complete!" else diff --git a/scripts/functions.sh b/scripts/functions.sh index 8b31b75..31cf514 100755 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -270,19 +270,19 @@ restart_klipperscreen(){ sudo systemctl restart KlipperScreen && ok_msg "KlipperScreen Service restarted!" } -start_moonraker-telegram-bot(){ - status_msg "Starting moonraker-telegram-bot Service ..." - sudo systemctl start moonraker-telegram-bot && ok_msg "moonraker-telegram-bot Service started!" +start_MoonrakerTelegramBot(){ + status_msg "Starting MoonrakerTelegramBot Service ..." + sudo systemctl start MoonrakerTelegramBot && ok_msg "MoonrakerTelegramBot Service started!" } -stop_moonraker-telegram-bot(){ - status_msg "Stopping moonraker-telegram-bot Service ..." - sudo systemctl stop moonraker-telegram-bot && ok_msg "moonraker-telegram-bot Service stopped!" +stop_MoonrakerTelegramBot(){ + status_msg "Stopping MoonrakerTelegramBot Service ..." + sudo systemctl stop MoonrakerTelegramBot && ok_msg "MoonrakerTelegramBot Service stopped!" } -restart_moonraker-telegram-bot(){ - status_msg "Restarting moonraker-telegram-bot Service ..." - sudo systemctl restart moonraker-telegram-bot && ok_msg "moonraker-telegram-bot Service restarted!" +restart_MoonrakerTelegramBot(){ + status_msg "Restarting MoonrakerTelegramBot Service ..." + sudo systemctl restart MoonrakerTelegramBot && ok_msg "MoonrakerTelegramBot Service restarted!" } restart_nginx(){ diff --git a/scripts/install_moonraker-telegram-bot.sh b/scripts/install_moonraker-telegram-bot.sh index b8437ad..43bc529 100644 --- a/scripts/install_moonraker-telegram-bot.sh +++ b/scripts/install_moonraker-telegram-bot.sh @@ -1,17 +1,17 @@ -install_moonraker-telegram-bot(){ +install_MoonrakerTelegramBot(){ source_kiauh_ini - system_check_moonraker-telegram-bot + system_check_MoonrakerTelegramBot #ask user for customization - get_user_selections_moonraker-telegram-bot - #moonraker-telegram-bot main installation - moonraker-telegram-bot_setup + get_user_selections_MoonrakerTelegramBot + #MoonrakerTelegramBot main installation + MoonrakerTelegramBot_setup #execute customizations - symlinks_moonraker-telegram-bot + symlinks_MoonrakerTelegramBot #after install actions - restart_moonraker-telegram-bot + restart_MoonrakerTelegramBot } -system_check_moonraker-telegram-bot(){ +system_check_MoonrakerTelegramBot(){ source_kiauh_ini if [ ! -e $klipper_cfg_loc/telegram.log ]; then MOONRAKERTELEGRAMBOT_SL_FOUND="false" @@ -20,7 +20,7 @@ system_check_moonraker-telegram-bot(){ fi } -get_user_selections_moonraker-telegram-bot(){ +get_user_selections_MoonrakerTelegramBot(){ #user selection for telegram.log symlink if [ "$KMOONRAKERTELEGRAMBOT_SL_FOUND" = "false" ]; then while true; do @@ -43,21 +43,21 @@ get_user_selections_moonraker-telegram-bot(){ fi } -moonraker-telegram-bot_setup(){ +MoonrakerTelegramBot_setup(){ dep=(wget curl unzip dfu-util) dependency_check - status_msg "Downloading moonraker-telegram-bot ..." - #force remove existing moonraker-telegram-bot dir + status_msg "Downloading MoonrakerTelegramBot ..." + #force remove existing MoonrakerTelegramBot dir [ -d $MOONRAKERTELEGRAMBOT_DIR ] && rm -rf $MOONRAKERTELEGRAMBOT_DIR - #clone into fresh moonraker-telegram-bot dir + #clone into fresh MoonrakerTelegramBot dir cd ${HOME} && git clone $MOONRAKERTELEGRAMBOT_REPO ok_msg "Download complete!" - status_msg "Installing moonraker-telegram-bot ..." + status_msg "Installing MoonrakerTelegramBot ..." $MOONRAKERTELEGRAMBOT_DIR/install.sh - echo; ok_msg "moonraker-telegram-bot successfully installed!" + echo; ok_msg "MoonrakerTelegramBot successfully installed!" } -symlinks_moonraker-telegram-bot(){ +symlinks_MoonrakerTelegramBot(){ #create a telegram.log symlink in klipper_config-dir if [ "$SEL_MTBLOG_SL" = "true" ] && [ ! -e $klipper_cfg_loc/telegram.log ]; then status_msg "Creating telegram.log symlink ..." diff --git a/scripts/remove.sh b/scripts/remove.sh index ed4f4d9..e47d55b 100755 --- a/scripts/remove.sh +++ b/scripts/remove.sh @@ -387,47 +387,47 @@ remove_klipperscreen(){ CONFIRM_MSG="KlipperScreen successfully removed!" } -remove_moonraker-telegram-bot(){ +remove_MoonrakerTelegramBot(){ source_kiauh_ini - ### remove moonraker-telegram-bot dir + ### remove MoonrakerTelegramBot dir if [ -d $MOONRAKERTELEGRAMBOT_DIR ]; then - status_msg "Removing moonraker-telegram-bot directory ..." + status_msg "Removing MoonrakerTelegramBot directory ..." rm -rf $MOONRAKERTELEGRAMBOT_DIR && ok_msg "Directory removed!" fi - ### remove moonraker-telegram-bot VENV dir + ### remove MoonrakerTelegramBot VENV dir if [ -d $MOONRAKERTELEGRAMBOT_ENV_DIR ]; then - status_msg "Removing moonraker-telegram-bot VENV directory ..." + status_msg "Removing MoonrakerTelegramBot VENV directory ..." rm -rf $MOONRAKERTELEGRAMBOT_ENV_DIR && ok_msg "Directory removed!" fi - ### remove moonraker-telegram-bot service - if [ -e /etc/systemd/system/moonraker-telegram-bot.service ]; then - status_msg "Removing moonraker-telegram-bot service ..." - sudo systemctl stop moonraker-telegram-bot + ### remove MoonrakerTelegramBot service + if [ -e /etc/systemd/system/MoonrakerTelegramBot.service ]; then + status_msg "Removing MoonrakerTelegramBot service ..." + sudo systemctl stop MoonrakerTelegramBot sudo systemctl disable moonraker - sudo rm -f $SYSTEMDDIR/moonraker-telegram-bot.service + sudo rm -f $SYSTEMDDIR/MoonrakerTelegramBot.service ###reloading units sudo systemctl daemon-reload sudo systemctl reset-failed - ok_msg "moonraker-telegram-bot Service removed!" + ok_msg "MoonrakerTelegramBot Service removed!" fi - ### remove moonraker-telegram-bot log + ### remove MoonrakerTelegramBot log if [ -e /tmp/telegram.log ]; then - status_msg "Removing moonraker-telegram-bot log file ..." + status_msg "Removing MoonrakerTelegramBot log file ..." rm -f /tmp/telegram.log && ok_msg "File removed!" fi - ### remove moonraker-telegram-bot log symlink in config dir + ### remove MoonrakerTelegramBot log symlink in config dir if [ -e $klipper_cfg_loc/telegram.log ]; then - status_msg "Removing moonraker-telegram-bot log symlink ..." + status_msg "Removing MoonrakerTelegramBot log symlink ..." rm -f $klipper_cfg_loc/telegram.log && ok_msg "File removed!" fi - CONFIRM_MSG="moonraker-telegram-bot successfully removed!" + CONFIRM_MSG="MoonrakerTelegramBot successfully removed!" } remove_mjpg-streamer(){ diff --git a/scripts/status.sh b/scripts/status.sh index 390b94b..80e19d5 100755 --- a/scripts/status.sh +++ b/scripts/status.sh @@ -228,28 +228,28 @@ klipperscreen_status(){ fi } -moonraker-telegram-bot_status(){ +MoonrakerTelegramBot_status(){ mtbcount=0 - moonraker-telegram-bot_data=( + MoonrakerTelegramBot_data=( SERVICE $MOONRAKERTELEGRAMBOT_DIR $MOONRAKERTELEGRAMBOT_ENV_DIR ) - ### count amount of moonraker-telegram-bot_data service files in /etc/systemd/system - SERVICE_FILE_COUNT=$(ls /etc/systemd/system | grep -E "moonraker-telegram-bot" | wc -l) + ### count amount of MoonrakerTelegramBot_data service files in /etc/systemd/system + SERVICE_FILE_COUNT=$(ls /etc/systemd/system | grep -E "MoonrakerTelegramBot" | wc -l) - ### remove the "SERVICE" entry from the moonraker-telegram-bot_data array if a moonraker-telegram-bot service is installed - [ $SERVICE_FILE_COUNT -gt 0 ] && unset moonraker-telegram-bot_data[0] + ### remove the "SERVICE" entry from the MoonrakerTelegramBot_data array if a MoonrakerTelegramBot service is installed + [ $SERVICE_FILE_COUNT -gt 0 ] && unset MoonrakerTelegramBot_data[0] #count+1 for each found data-item from array - for mtbd in "${moonraker-telegram-bot_data[@]}" + for mtbd in "${MoonrakerTelegramBot_data[@]}" do if [ -e $mtbd ]; then mtbcount=$(expr $mtbcount + 1) fi done - if [ "$mtbccount" == "${#moonraker-telegram-bot_data[*]}" ]; then + if [ "$mtbccount" == "${#MoonrakerTelegramBot_data[*]}" ]; then MOONRAKERTELEGRAMBOT_STATUS="${green}Installed!${default} " elif [ "$klsccount" == 0 ]; then MOONRAKERTELEGRAMBOT_STATUS="${red}Not installed!${default} " @@ -547,7 +547,7 @@ compare_klipperscreen_versions(){ fi } -read_moonraker-telegram-bot_versions(){ +read_MoonrakerTelegramBot_versions(){ if [ -d $MOONRAKERTELEGRAMBOT_DIR ] && [ -d $MOONRAKERTELEGRAMBOT_DIR/.git ]; then cd $MOONRAKERTELEGRAMBOT_DIR git fetch origin master -q @@ -559,14 +559,14 @@ read_moonraker-telegram-bot_versions(){ fi } -compare_moonraker-telegram-bot_versions(){ +compare_MoonrakerTelegramBot_versions(){ unset MOONRAKERTELEGRAMBOT_UPDATE_AVAIL - read_moonraker-telegram-bot_versions + read_MoonrakerTelegramBot_versions if [ "$LOCAL_MOONRAKERTELEGRAMBOT_COMMIT" != "$REMOTE_MOONRAKERTELEGRAMBOT_COMMIT" ]; then LOCAL_MOONRAKERTELEGRAMBOT_COMMIT="${yellow}$(printf "%-12s" "$LOCAL_MOONRAKERTELEGRAMBOT_COMMIT")${default}" REMOTE_MOONRAKERTELEGRAMBOT_COMMIT="${green}$(printf "%-12s" "$REMOTE_MOONRAKERTELEGRAMBOT_COMMIT")${default}" MOONRAKERTELEGRAMBOT_UPDATE_AVAIL="true" - update_arr+=(update_moonraker-telegram-bot) + update_arr+=(update_MoonrakerTelegramBot) else LOCAL_MOONRAKERTELEGRAMBOT_COMMIT="${green}$(printf "%-12s" "$LOCAL_MOONRAKERTELEGRAMBOT_COMMIT")${default}" REMOTE_MOONRAKERTELEGRAMBOT_COMMIT="${green}$(printf "%-12s" "$REMOTE_MOONRAKERTELEGRAMBOT_COMMIT")${default}" @@ -591,5 +591,5 @@ ui_print_versions(){ compare_mainsail_versions compare_fluidd_versions compare_klipperscreen_versions - compare_moonraker-telegram-bot + compare_MoonrakerTelegramBot } diff --git a/scripts/ui/backup_menu.sh b/scripts/ui/backup_menu.sh index 82f9e87..cdacd0e 100755 --- a/scripts/ui/backup_menu.sh +++ b/scripts/ui/backup_menu.sh @@ -42,7 +42,7 @@ backup_menu(){ 8) do_action "backup_octoprint" "backup_ui";; 9) - do_action "backup_moonraker-telegram-bot" "backup_ui";; + do_action "backup_MoonrakerTelegramBot" "backup_ui";; Q|q) clear; main_menu; break;; *) diff --git a/scripts/ui/remove_menu.sh b/scripts/ui/remove_menu.sh index a4d8c77..169b608 100755 --- a/scripts/ui/remove_menu.sh +++ b/scripts/ui/remove_menu.sh @@ -44,7 +44,7 @@ remove_menu(){ 9) do_action "remove_mjpg-streamer" "remove_ui";; 10) - do_action "remove_moonraker-telegram-bot" "remove_ui";; + do_action "remove_MoonrakerTelegramBot" "remove_ui";; Q|q) clear; main_menu; break;; *) diff --git a/scripts/update.sh b/scripts/update.sh index 5372a58..ff5bf2c 100755 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -40,7 +40,7 @@ update_all(){ echo -e "| ${cyan}● KlipperScreen${default} |" fi if [ "$MOONRAKERTELEGRAMBOT_UPDATE_AVAIL" = "true" ]; then - echo -e "| ${cyan}● moonraker-telegram-bot${default} |" + echo -e "| ${cyan}● MoonrakerTelegramBot${default} |" fi if [ "$SYS_UPDATE_AVAIL" = "true" ]; then echo -e "| ${cyan}● System${default} |" @@ -173,13 +173,13 @@ update_klipperscreen(){ start_klipperscreen } -update_moonraker-telegram-bot(){ - stop_moonraker-telegram-bot +update_MoonrakerTelegramBot(){ + stop_MoonrakerTelegramBot cd $MOONRAKERTELEGRAMBOT_DIR git pull ./install.sh ok_msg "Update complete!" - start_moonraker-telegram-bot + start_MoonrakerTelegramBot } update_system(){ From 935f1bd91085ce8742d8d06ebe99306ff89dec33 Mon Sep 17 00:00:00 2001 From: Evgenii Date: Sat, 11 Sep 2021 01:23:23 +0300 Subject: [PATCH 04/16] fix --- scripts/ui/main_menu.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/ui/main_menu.sh b/scripts/ui/main_menu.sh index 624c6d7..26e7864 100755 --- a/scripts/ui/main_menu.sh +++ b/scripts/ui/main_menu.sh @@ -54,6 +54,7 @@ main_menu(){ mainsail_status octoprint_status klipperscreen_status + MoonrakerTelegramBot_status print_branch print_msg && clear_msg main_ui From 2ff8cd558957d860876abde6f3ce446d60cd49c0 Mon Sep 17 00:00:00 2001 From: Evgenii Date: Sat, 11 Sep 2021 01:31:26 +0300 Subject: [PATCH 05/16] fix --- scripts/status.sh | 2 +- scripts/ui/install_menu.sh | 6 ++++-- scripts/ui/remove_menu.sh | 29 ++++++++++++++--------------- scripts/ui/update_menu.sh | 6 ++++-- 4 files changed, 23 insertions(+), 20 deletions(-) diff --git a/scripts/status.sh b/scripts/status.sh index 80e19d5..eba7b61 100755 --- a/scripts/status.sh +++ b/scripts/status.sh @@ -591,5 +591,5 @@ ui_print_versions(){ compare_mainsail_versions compare_fluidd_versions compare_klipperscreen_versions - compare_MoonrakerTelegramBot + compare_MoonrakerTelegramBot_versions } diff --git a/scripts/ui/install_menu.sh b/scripts/ui/install_menu.sh index 94e6f44..2ea5a56 100755 --- a/scripts/ui/install_menu.sh +++ b/scripts/ui/install_menu.sh @@ -12,10 +12,10 @@ install_ui(){ echo -e "| Klipper API: | Other: | " echo -e "| 2) [Moonraker] | 6) [Duet Web Control] | " echo -e "| | 7) [OctoPrint] | " - echo -e "| Klipper Webinterface: | 9) [MoonrakerTelegramBot]| " + echo -e "| Klipper Webinterface: | 8) [MoonrakerTelegramBot]| " echo -e "| 3) [Mainsail] | | " echo -e "| 4) [Fluidd] | Webcam: | " - echo -e "| | 8) [MJPG-Streamer] | " + echo -e "| | 9) [MJPG-Streamer] | " quit_footer } @@ -39,6 +39,8 @@ install_menu(){ 7) do_action "octoprint_setup_dialog" "install_ui";; 8) + do_action "install_MoonrakerTelegramBot" "install_ui";; + 9) do_action "install_mjpg-streamer" "install_ui";; Q|q) clear; main_menu; break;; diff --git a/scripts/ui/remove_menu.sh b/scripts/ui/remove_menu.sh index 169b608..8fcaf9e 100755 --- a/scripts/ui/remove_menu.sh +++ b/scripts/ui/remove_menu.sh @@ -2,21 +2,20 @@ 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) [NGINX] | " - echo -e "| 3) [Mainsail] | 9) [MJPG-Streamer] | " - echo -e "| 4) [Fluidd] | 10) [MoonrakerTelegramBot] | " - echo -e "| | | " + 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. | " + 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) [NGINX] | " + echo -e "| 3) [Mainsail] | 9) [MJPG-Streamer] | " + echo -e "| 4) [Fluidd] | 10) [MTelegramBot] | " + echo -e "| | | " quit_footer } diff --git a/scripts/ui/update_menu.sh b/scripts/ui/update_menu.sh index 289900f..2ec1b75 100755 --- a/scripts/ui/update_menu.sh +++ b/scripts/ui/update_menu.sh @@ -21,9 +21,9 @@ update_ui(){ echo -e "| Other: |---------------|--------------| " echo -e "| 6) [DWC2-for-Klipper] | $LOCAL_DWC2FK_COMMIT | $REMOTE_DWC2FK_COMMIT | " echo -e "| 7) [DWC2 Web UI] | $DWC2_LOCAL_VER | $DWC2_REMOTE_VER | " - echo -e "| 5) [MTelegramBot] | $LOCAL_MOONRAKERTELEGRAMBOT_COMMIT | $REMOTE_MOONRAKERTELEGRAMBOT_COMMIT | " + echo -e "| 8) [MTelegramBot] | $LOCAL_MOONRAKERTELEGRAMBOT_COMMIT | $REMOTE_MOONRAKERTELEGRAMBOT_COMMIT | " echo -e "| |------------------------------| " - echo -e "| 8) [System] | $DISPLAY_SYS_UPDATE | " + echo -e "| 9) [System] | $DISPLAY_SYS_UPDATE | " quit_footer } @@ -50,6 +50,8 @@ update_menu(){ 7) do_action "update_dwc2" "update_ui";; 8) + do_action "update_MoonrakerTelegramBot" "update_ui";; + 9) do_action "update_system" "update_ui";; a) do_action "update_all" "update_ui";; From 81c2a90b3f35b6a6f36ddb6648fbc29ad7c097ae Mon Sep 17 00:00:00 2001 From: Evgenii Date: Sat, 11 Sep 2021 01:34:26 +0300 Subject: [PATCH 06/16] fix --- scripts/install_moonraker-telegram-bot.sh | 2 -- scripts/ui/remove_menu.sh | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/install_moonraker-telegram-bot.sh b/scripts/install_moonraker-telegram-bot.sh index 43bc529..bb41fc0 100644 --- a/scripts/install_moonraker-telegram-bot.sh +++ b/scripts/install_moonraker-telegram-bot.sh @@ -44,8 +44,6 @@ get_user_selections_MoonrakerTelegramBot(){ } MoonrakerTelegramBot_setup(){ - dep=(wget curl unzip dfu-util) - dependency_check status_msg "Downloading MoonrakerTelegramBot ..." #force remove existing MoonrakerTelegramBot dir [ -d $MOONRAKERTELEGRAMBOT_DIR ] && rm -rf $MOONRAKERTELEGRAMBOT_DIR diff --git a/scripts/ui/remove_menu.sh b/scripts/ui/remove_menu.sh index 8fcaf9e..2e0d351 100755 --- a/scripts/ui/remove_menu.sh +++ b/scripts/ui/remove_menu.sh @@ -1,6 +1,6 @@ remove_ui(){ top_border - echo -e "| ${red}~~~~~~~~~~~~~~ [ Remove Menu ] ~~~~~~~~~~~~~~${default} | " + echo -e "| ${red}~~~~~~~~~~~~~~ [ Remove Menu ] ~~~~~~~~~~~~~~${default} | " hr echo -e "| Directories which remain untouched: | " echo -e "| --> Your printer configuration directory | " From a24e02757e999bc8d8c68327a05ac406f50a69bb Mon Sep 17 00:00:00 2001 From: Evgenii Date: Sat, 11 Sep 2021 01:35:39 +0300 Subject: [PATCH 07/16] fix --- scripts/install_moonraker-telegram-bot.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install_moonraker-telegram-bot.sh b/scripts/install_moonraker-telegram-bot.sh index bb41fc0..550ad4c 100644 --- a/scripts/install_moonraker-telegram-bot.sh +++ b/scripts/install_moonraker-telegram-bot.sh @@ -48,7 +48,7 @@ MoonrakerTelegramBot_setup(){ #force remove existing MoonrakerTelegramBot dir [ -d $MOONRAKERTELEGRAMBOT_DIR ] && rm -rf $MOONRAKERTELEGRAMBOT_DIR #clone into fresh MoonrakerTelegramBot dir - cd ${HOME} && git clone $MOONRAKERTELEGRAMBOT_REPO + cd ${HOME} && git clone $NLEF_REPO ok_msg "Download complete!" status_msg "Installing MoonrakerTelegramBot ..." $MOONRAKERTELEGRAMBOT_DIR/install.sh From e12c4c93abfea62439866af1e32e6a86221fb20c Mon Sep 17 00:00:00 2001 From: Evgenii Date: Sat, 11 Sep 2021 01:43:36 +0300 Subject: [PATCH 08/16] fix --- scripts/remove.sh | 4 ++-- scripts/status.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/remove.sh b/scripts/remove.sh index e47d55b..2c12c92 100755 --- a/scripts/remove.sh +++ b/scripts/remove.sh @@ -403,11 +403,11 @@ remove_MoonrakerTelegramBot(){ fi ### remove MoonrakerTelegramBot service - if [ -e /etc/systemd/system/MoonrakerTelegramBot.service ]; then + if [ -e /etc/systemd/system/moonraker-telegram-bot.service ]; then status_msg "Removing MoonrakerTelegramBot service ..." sudo systemctl stop MoonrakerTelegramBot sudo systemctl disable moonraker - sudo rm -f $SYSTEMDDIR/MoonrakerTelegramBot.service + sudo rm -f $SYSTEMDDIR/moonraker-telegram-bot.service ###reloading units sudo systemctl daemon-reload sudo systemctl reset-failed diff --git a/scripts/status.sh b/scripts/status.sh index eba7b61..a0542eb 100755 --- a/scripts/status.sh +++ b/scripts/status.sh @@ -237,7 +237,7 @@ MoonrakerTelegramBot_status(){ ) ### count amount of MoonrakerTelegramBot_data service files in /etc/systemd/system - SERVICE_FILE_COUNT=$(ls /etc/systemd/system | grep -E "MoonrakerTelegramBot" | wc -l) + SERVICE_FILE_COUNT=$(ls /etc/systemd/system | grep -E "moonraker-telegram-bot" | wc -l) ### remove the "SERVICE" entry from the MoonrakerTelegramBot_data array if a MoonrakerTelegramBot service is installed [ $SERVICE_FILE_COUNT -gt 0 ] && unset MoonrakerTelegramBot_data[0] From ecbf2c5494d0da06442380b4b0fbcf8e25442330 Mon Sep 17 00:00:00 2001 From: Evgenii Date: Sat, 11 Sep 2021 01:45:36 +0300 Subject: [PATCH 09/16] fix --- scripts/functions.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/functions.sh b/scripts/functions.sh index 31cf514..c7c4db4 100755 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -272,17 +272,17 @@ restart_klipperscreen(){ start_MoonrakerTelegramBot(){ status_msg "Starting MoonrakerTelegramBot Service ..." - sudo systemctl start MoonrakerTelegramBot && ok_msg "MoonrakerTelegramBot Service started!" + sudo systemctl start moonraker-telegram-bot && ok_msg "MoonrakerTelegramBot Service started!" } stop_MoonrakerTelegramBot(){ status_msg "Stopping MoonrakerTelegramBot Service ..." - sudo systemctl stop MoonrakerTelegramBot && ok_msg "MoonrakerTelegramBot Service stopped!" + sudo systemctl stop moonraker-telegram-bot && ok_msg "MoonrakerTelegramBot Service stopped!" } restart_MoonrakerTelegramBot(){ status_msg "Restarting MoonrakerTelegramBot Service ..." - sudo systemctl restart MoonrakerTelegramBot && ok_msg "MoonrakerTelegramBot Service restarted!" + sudo systemctl restart moonraker-telegram-bot && ok_msg "MoonrakerTelegramBot Service restarted!" } restart_nginx(){ From 5fa5149d8fb7a395ab34bcae897f593648fcf0c5 Mon Sep 17 00:00:00 2001 From: Evgenii Date: Sat, 11 Sep 2021 01:52:34 +0300 Subject: [PATCH 10/16] fix --- scripts/install_moonraker-telegram-bot.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/install_moonraker-telegram-bot.sh b/scripts/install_moonraker-telegram-bot.sh index 550ad4c..46b834a 100644 --- a/scripts/install_moonraker-telegram-bot.sh +++ b/scripts/install_moonraker-telegram-bot.sh @@ -44,6 +44,8 @@ get_user_selections_MoonrakerTelegramBot(){ } MoonrakerTelegramBot_setup(){ + dep=(virtualenv) + dependency_check status_msg "Downloading MoonrakerTelegramBot ..." #force remove existing MoonrakerTelegramBot dir [ -d $MOONRAKERTELEGRAMBOT_DIR ] && rm -rf $MOONRAKERTELEGRAMBOT_DIR From 68ccadb06fa63a1c6d6a6c233d03dc721df92fae Mon Sep 17 00:00:00 2001 From: Evgenii Date: Sat, 11 Sep 2021 02:04:50 +0300 Subject: [PATCH 11/16] fix --- scripts/status.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/status.sh b/scripts/status.sh index a0542eb..762709b 100755 --- a/scripts/status.sh +++ b/scripts/status.sh @@ -249,9 +249,9 @@ MoonrakerTelegramBot_status(){ mtbcount=$(expr $mtbcount + 1) fi done - if [ "$mtbccount" == "${#MoonrakerTelegramBot_data[*]}" ]; then + if [ "$mtbcount" == "${#MoonrakerTelegramBot_data[*]}" ]; then MOONRAKERTELEGRAMBOT_STATUS="${green}Installed!${default} " - elif [ "$klsccount" == 0 ]; then + elif [ "$mtbcount" == 0 ]; then MOONRAKERTELEGRAMBOT_STATUS="${red}Not installed!${default} " else MOONRAKERTELEGRAMBOT_STATUS="${yellow}Incomplete!${default} " From 263ebf9106f23e58b717658131fd4552c45e61b5 Mon Sep 17 00:00:00 2001 From: Evgenii Date: Sat, 11 Sep 2021 02:07:23 +0300 Subject: [PATCH 12/16] fix --- scripts/remove.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/remove.sh b/scripts/remove.sh index 2c12c92..f884bd1 100755 --- a/scripts/remove.sh +++ b/scripts/remove.sh @@ -405,7 +405,7 @@ remove_MoonrakerTelegramBot(){ ### remove MoonrakerTelegramBot service if [ -e /etc/systemd/system/moonraker-telegram-bot.service ]; then status_msg "Removing MoonrakerTelegramBot service ..." - sudo systemctl stop MoonrakerTelegramBot + sudo systemctl stop moonraker-telegram-bot sudo systemctl disable moonraker sudo rm -f $SYSTEMDDIR/moonraker-telegram-bot.service ###reloading units From b6cf30dea7667f8da874505ca259476bfae87214 Mon Sep 17 00:00:00 2001 From: Evgenii Date: Sat, 11 Sep 2021 02:13:37 +0300 Subject: [PATCH 13/16] fix --- scripts/remove.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/remove.sh b/scripts/remove.sh index f884bd1..5e1c2f4 100755 --- a/scripts/remove.sh +++ b/scripts/remove.sh @@ -406,7 +406,7 @@ remove_MoonrakerTelegramBot(){ if [ -e /etc/systemd/system/moonraker-telegram-bot.service ]; then status_msg "Removing MoonrakerTelegramBot service ..." sudo systemctl stop moonraker-telegram-bot - sudo systemctl disable moonraker + sudo systemctl disable moonraker-telegram-bot sudo rm -f $SYSTEMDDIR/moonraker-telegram-bot.service ###reloading units sudo systemctl daemon-reload From f46e81e22a4cc6d39bf1fcfe52210a0198302bc9 Mon Sep 17 00:00:00 2001 From: Evgenii Shavrin <37345777+shavrin777@users.noreply.github.com> Date: Sat, 11 Sep 2021 03:08:17 +0300 Subject: [PATCH 14/16] Update README.md Add telegram bot --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 11a6052..40c5083 100644 --- a/README.md +++ b/README.md @@ -135,6 +135,12 @@ https://github.com/Kragrathea/pgcode --- +### **🤖Telegram bot for Moonraker** by [nlef](https://github.com/nlef) : + +https://github.com/nlef/moonraker-telegram-bot + +--- + ## **❓ FAQ** **_Q: Can i use this script to install multiple instances of Klipper on the same Pi? (Multisession?)_** From d313ce73852e2598096cd1e45c58a01818ef76c5 Mon Sep 17 00:00:00 2001 From: Evgenii Date: Sat, 11 Sep 2021 03:16:53 +0300 Subject: [PATCH 15/16] Some adjustments --- scripts/ui/install_menu.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/ui/install_menu.sh b/scripts/ui/install_menu.sh index 47f3c65..600a15e 100755 --- a/scripts/ui/install_menu.sh +++ b/scripts/ui/install_menu.sh @@ -12,8 +12,8 @@ install_ui(){ echo -e "| Klipper API: | Other: | " echo -e "| 2) [Moonraker] | 6) [Duet Web Control] | " echo -e "| | 7) [OctoPrint] | " - echo -e "| Klipper Webinterface: | 8) [MoonrakerTelegramBot]| " - echo -e "| 3) [Mainsail] | 9) [PrettyGCode] | " + echo -e "| Klipper Webinterface: | 8) [PrettyGCode] | " + echo -e "| 3) [Mainsail] | 9) [MoonrakerTelegramBot]| " echo -e "| 4) [Fluidd] | | " echo -e "| | Webcam: | " echo -e "| | 10) [MJPG-Streamer] | " @@ -40,9 +40,9 @@ install_menu(){ 7) do_action "octoprint_setup_dialog" "install_ui";; 8) - do_action "install_MoonrakerTelegramBot" "install_ui";; - 9) do_action "install_pgc_for_klipper" "install_ui";; + 9) + do_action "install_MoonrakerTelegramBot" "install_ui";; 10) do_action "install_mjpg-streamer" "install_ui";; Q|q) From 2c1af585c985ead6de0ade04491f64bea3b7425c Mon Sep 17 00:00:00 2001 From: Evgenii Date: Sat, 11 Sep 2021 03:21:44 +0300 Subject: [PATCH 16/16] Some adjustments --- scripts/ui/update_menu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ui/update_menu.sh b/scripts/ui/update_menu.sh index ba60a54..7de6339 100755 --- a/scripts/ui/update_menu.sh +++ b/scripts/ui/update_menu.sh @@ -24,7 +24,7 @@ update_ui(){ echo -e "| 8) [PrettyGCode] | $LOCAL_PGC_COMMIT | $REMOTE_PGC_COMMIT | " echo -e "| 9) [MTelegramBot] | $LOCAL_MOONRAKERTELEGRAMBOT_COMMIT | $REMOTE_MOONRAKERTELEGRAMBOT_COMMIT | " echo -e "| |------------------------------| " - echo -e "| 10) [System] | $DISPLAY_SYS_UPDATE | " + echo -e "| 10) [System] | $DISPLAY_SYS_UPDATE | " quit_footer }