diff --git a/Macros/fan_monitor.cfg b/Scripts/fan_monitor.cfg similarity index 100% rename from Macros/fan_monitor.cfg rename to Scripts/fan_monitor.cfg diff --git a/Macros/idle.cfg b/Scripts/idle.cfg similarity index 100% rename from Macros/idle.cfg rename to Scripts/idle.cfg diff --git a/Macros/macros.cfg b/Scripts/macros.cfg similarity index 100% rename from Macros/macros.cfg rename to Scripts/macros.cfg diff --git a/Macros/motor_sync.cfg b/Scripts/motor_sync.cfg similarity index 100% rename from Macros/motor_sync.cfg rename to Scripts/motor_sync.cfg diff --git a/Macros/ratrig_z-tilt.cfg b/Scripts/ratrig_z-tilt.cfg similarity index 100% rename from Macros/ratrig_z-tilt.cfg rename to Scripts/ratrig_z-tilt.cfg diff --git a/macros_installer.sh b/macros_installer.sh new file mode 100644 index 0000000..be1cf1c --- /dev/null +++ b/macros_installer.sh @@ -0,0 +1,98 @@ +#!/usr/bin/env bash +mainmenu() { + cd ~ + OPTION=$(whiptail --title "Macros installer helper" --separate-output --checklist "Choose your option" 15 60 6 \ + "1" "Macros" ON \ + "2" "Klipper Backup" ON \ + "3" "Shake and tune" ON \ + "4" "Cartographer" OFF \ + "5" "Motor Sync" OFF \ + "6" "Chopper Tune" OFF 3>&1 1>&2 2>&3) + exitstatus=$? + + if [ $exitstatus = 0 ]; then + for OPTION in $OPTION; do + case "$OPTION" in + "1") + echo "Macros was selected" + install_macros + ;; + "2") + echo "Klipper Backup was selected" + install_backup + ;; + "3") + echo "Shake and Tune was selected" + wget -O - https://raw.githubusercontent.com/Frix-x/klippain-shaketune/main/install.sh | bash + ;; + "4") + echo "Option 3 was selected" + git clone https://github.com/Cartographer3D/cartographer-klipper.git + ./cartographer-klipper/install.sh + ;; + "5") + echo "Option 4 was selected" + git clone https://github.com/MRX8024/motors-sync + bash ~/motors-sync/install.sh + ;; + "6") + echo "Option 4 was selected" + git clone https://github.com/MRX8024/chopper-resonance-tuner + bash ~/chopper-resonance-tuner/install.sh + ;; + *) + echo "Unsupported item $OPTION!" >&2 + exit 1 + ;; + esac + done + else + echo "You chose Cancel." + fi +} + +install_backup() { + NAME=$(whiptail --inputbox "Please enter printer name" 10 100 3>&1 1>&2 2>&3) + echo "name: $NAME" + TOKEN=$(whiptail --inputbox "Please enter printer token" 10 100 3>&1 1>&2 2>&3) + echo "TOKEN: $TOKEN" + #curl -fsSL get.klipperbackup.xyz | bash + cat << EOF > file.txt + github_token=$TOKEN + github_username=reijii + github_repository=Klipper-Backups + git_host="cloud.reijii.org/gitea" + git_protocol="https" + branch_name=$NAME + commit_username="" + commit_email="$NAME@vertorix" + backupPaths=( \\ + "printer_data/config/*" \\ + ) + + exclude=( \\ + "*.swp" \\ + "*.tmp" \\ + "printer-[0-9]*_[0-9]*.cfg" \\ + "*.bak" \\ + "*.bkp" \\ + "*.csv" \\ + "*.zip" \\ + "*.png" \\ + "*.tar.gz" \\ + ) +EOF + rm /tmp/c1 + crontab -l >/tmp/c1 + echo $(($RANDOM % 60 ))' */12 * * * $HOME/klipper-backup/script.sh' >>/tmp/c1 + crontab /tmp/c1 +} + +install_macros() { + git clone https://cloud.reijii.org/gitea/reijii/Macros + mkdir ~/printer_data/config/Macros + ln -s ~/Macros/Scripts ~/printer_data/config/Macros/Scripts + cp ~/Macros/macros_variables.cfg ~/printer_data/config/Macros/ +} + +mainmenu \ No newline at end of file