98 lines
2.6 KiB
Bash
98 lines
2.6 KiB
Bash
#!/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 |