|
| 1 | +# Print a message to the user explaining the purpose of the script and a warning. |
| 2 | +echo "This installer will install some files and dependencies on your device. Never install something without knowing what it does." |
| 3 | + |
| 4 | +# Prompt the user for confirmation to continue and store the answer in the response1 variable. |
| 5 | +read -r -p "Are you sure you want to continue? (y/N) " response1 |
| 6 | + |
| 7 | +# Check if the user entered 'n' or 'N' for the first confirmation. |
| 8 | +if [[ "$response1" == [Nn] ]]; then |
| 9 | + # If 'n' or 'N' was entered, print an exit message and exit the script with an error code. |
| 10 | + echo "Exiting..." |
| 11 | + exit 1 |
| 12 | +fi |
| 13 | + |
| 14 | +# Prints a message to the user explaining the potential risks. |
| 15 | +echo "This also installs a g-code macro, which can potentially harm your printer." |
| 16 | + |
| 17 | +# Prompt the user for confirmation to continue and store the answer in the response2 variable. |
| 18 | +read -r -p "Are you sure you want to continue? (y/N) " response2 |
| 19 | + |
| 20 | +# Check if the user entered 'n' or 'N' for the second confirmation. |
| 21 | +if [[ "$response2" == [Nn] ]]; then |
| 22 | + # If 'n' or 'N' was entered, print an exit message and exit the script with an error code. |
| 23 | + echo "Exiting..." |
| 24 | + exit 1 |
| 25 | +fi |
| 26 | + |
| 27 | +# Print a message indicating the script is installing dependencies. |
| 28 | +echo "installing dependencies..." |
| 29 | + |
| 30 | +# Change the directory to the specified location for dependency installation. |
| 31 | +cd ~/klippy-env/bin |
| 32 | + |
| 33 | +# Installs the opencv-python dependency using pip. |
| 34 | +./python3 -m pip install opencv-python |
| 35 | + |
| 36 | +# Print a message indicating successful dependency installation. |
| 37 | +echo "dependencies installed" |
| 38 | + |
| 39 | +# Print a message indicating the script is copying a macro file. |
| 40 | +echo "copying macro to config file path..." |
| 41 | + |
| 42 | +# Copy the check_image.cfg file from repository path to your printers config files path. |
| 43 | +cp ~/klipper-camera-watchdog/check_image.cfg ~/printer_data/config |
| 44 | + |
| 45 | +# Print a message indicating successful macro file copy. |
| 46 | +echo "macro copied" |
| 47 | + |
| 48 | +# Change the directory to the repository directory. |
| 49 | +cd ~/klipper-camera-watchdog |
| 50 | + |
| 51 | +# Create a directory named Image-files. This directory holds the images for the python script to check |
| 52 | +mkdir Image-files |
| 53 | + |
| 54 | +# Print a message with additional information required for the Python script to function. |
| 55 | +echo "for this to work you need to install droans extended_macro repository at https://github.com/droans/klipper_extras/tree/main/extended_macro" |
0 commit comments