Compare commits
53 Commits
CODeRUS/in
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a374ac8fac | ||
|
|
f2691f33d3 | ||
|
|
d800d356ca | ||
|
|
b6c6edb622 | ||
|
|
099d47df2f | ||
|
|
ba1cdb3739 | ||
|
|
8e7d4db988 | ||
|
|
8f960495ba | ||
|
|
095823bf28 | ||
|
|
397038e43e | ||
|
|
061e222664 | ||
|
|
3f5ff50d69 | ||
|
|
5ebe941125 | ||
|
|
f5eb9486cc | ||
|
|
7a9e752f9c | ||
|
|
30bc56b198 | ||
|
|
b2567995de | ||
|
|
6fcd7a3f08 | ||
|
|
25dfbb83df | ||
|
|
899b204dc7 | ||
|
|
5cf4b018fc | ||
|
|
ae9d1b98da | ||
|
|
16d3388ff2 | ||
|
|
b88d0085ba | ||
|
|
0b6613e464 | ||
|
|
d99cda544a | ||
|
|
a50dce20de | ||
|
|
f45da66e9e | ||
|
|
2822499344 | ||
|
|
c777ba3e6b | ||
|
|
9f410450d7 | ||
|
|
0497d49066 | ||
|
|
229da227b0 | ||
|
|
65854c8da6 | ||
|
|
5985646633 | ||
|
|
979c39dc02 | ||
|
|
197058bd00 | ||
|
|
d3b5122ebb | ||
|
|
8ce4daf403 | ||
|
|
b0a65fe14e | ||
|
|
98866caefa | ||
|
|
345b7b66a3 | ||
|
|
8eb2924832 | ||
|
|
5d7debd65e | ||
|
|
7df3dd489f | ||
|
|
0cd058320f | ||
|
|
bcbb185bd7 | ||
|
|
477f3ca72c | ||
|
|
c19acb1694 | ||
|
|
8228943850 | ||
|
|
5b890fb0fb | ||
|
|
7989cec8d4 | ||
|
|
858301aa9a |
4
.github/FUNDING.yml
vendored
4
.github/FUNDING.yml
vendored
@@ -3,10 +3,10 @@
|
||||
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||
patreon: # Replace with a single Patreon username
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: th33xitus
|
||||
ko_fi: dw__0
|
||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
||||
custom: https://paypal.me/dwillner0
|
||||
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1 +1,4 @@
|
||||
.idea
|
||||
.vscode
|
||||
*.code-workspace
|
||||
klipper_repos.txt
|
||||
60
README.md
60
README.md
@@ -1,6 +1,6 @@
|
||||
<p align="center">
|
||||
<a>
|
||||
<img src="https://raw.githubusercontent.com/th33xitus/kiauh/master/resources/screenshots/kiauh.png" alt="KIAUH logo" height="181">
|
||||
<img src="https://raw.githubusercontent.com/dw-0/kiauh/master/resources/screenshots/kiauh.png" alt="KIAUH logo" height="181">
|
||||
<h1 align="center">Klipper Installation And Update Helper</h1>
|
||||
</a>
|
||||
</p>
|
||||
@@ -10,14 +10,14 @@
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a><img src="https://img.shields.io/github/license/th33xitus/kiauh"></a>
|
||||
<a><img src="https://img.shields.io/github/stars/th33xitus/kiauh"></a>
|
||||
<a><img src="https://img.shields.io/github/forks/th33xitus/kiauh"></a>
|
||||
<a><img src="https://img.shields.io/github/languages/top/th33xitus/kiauh?logo=gnubash&logoColor=white"></a>
|
||||
<a><img src="https://img.shields.io/github/v/tag/th33xitus/kiauh"></a>
|
||||
<a><img src="https://img.shields.io/github/license/dw-0/kiauh"></a>
|
||||
<a><img src="https://img.shields.io/github/stars/dw-0/kiauh"></a>
|
||||
<a><img src="https://img.shields.io/github/forks/dw-0/kiauh"></a>
|
||||
<a><img src="https://img.shields.io/github/languages/top/dw-0/kiauh?logo=gnubash&logoColor=white"></a>
|
||||
<a><img src="https://img.shields.io/github/v/tag/dw-0/kiauh"></a>
|
||||
<br />
|
||||
<a><img src="https://img.shields.io/github/last-commit/th33xitus/kiauh"></a>
|
||||
<a><img src="https://img.shields.io/github/contributors/th33xitus/kiauh"></a>
|
||||
<a><img src="https://img.shields.io/github/last-commit/dw-0/kiauh"></a>
|
||||
<a><img src="https://img.shields.io/github/contributors/dw-0/kiauh"></a>
|
||||
</p>
|
||||
|
||||
<hr>
|
||||
@@ -29,25 +29,25 @@
|
||||
### 📋 Prerequisites
|
||||
KIAUH is a script that assists you in installing Klipper on a Linux operating system that has
|
||||
already been flashed to your Raspberry Pi's (or other SBC's) SD card. As a result, you must ensure
|
||||
that you have a functional Linux system on hand. `Raspberry Pi OS Lite (32bit)` is a recommended Linux image
|
||||
that you have a functional Linux system on hand. `Raspberry Pi OS Lite (either 32bit or 64bit)` is a recommended Linux image
|
||||
if you are using a Raspberry Pi. The [official Raspberry Pi Imager](https://www.raspberrypi.com/software/)
|
||||
is the simplest way to flash an image like this to an SD card.
|
||||
|
||||
* Once you downloaded, installed and launched the Raspberry Pi Imager
|
||||
* Once you have downloaded, installed and launched the Raspberry Pi Imager,
|
||||
select `Choose OS -> Raspberry Pi OS (other)`: \
|
||||
<p align="center">
|
||||
<img src="https://raw.githubusercontent.com/th33xitus/kiauh/master/resources/screenshots/rpi_imager1.png" alt="KIAUH logo" height="350">
|
||||
<img src="https://raw.githubusercontent.com/dw-0/kiauh/master/resources/screenshots/rpi_imager1.png" alt="KIAUH logo" height="350">
|
||||
</p>
|
||||
|
||||
* Then select `Raspberry Pi OS Lite (32bit)`:
|
||||
* Then select `Raspberry Pi OS Lite (32bit)` (or 64bit if you want to use that instead):
|
||||
<p align="center">
|
||||
<img src="https://raw.githubusercontent.com/th33xitus/kiauh/master/resources/screenshots/rpi_imager2.png" alt="KIAUH logo" height="350">
|
||||
<img src="https://raw.githubusercontent.com/dw-0/kiauh/master/resources/screenshots/rpi_imager2.png" alt="KIAUH logo" height="350">
|
||||
</p>
|
||||
|
||||
* Back in the Raspberry Pi Imager's main menu, select the corresponding SD card to which
|
||||
you want to flash the image.
|
||||
|
||||
* Make sure to go into the Advaced Option (the cog icon in the lower left corner of the main menu)
|
||||
* Make sure to go into the Advanced Option (the cog icon in the lower left corner of the main menu)
|
||||
and enable SSH and configure Wi-Fi.
|
||||
|
||||
* If you need more help for using the Raspberry Pi Imager, please visit the [official documentation](https://www.raspberrypi.com/documentation/computers/getting-started.html).
|
||||
@@ -64,18 +64,18 @@ distributions based on Debian 11 Bullseye. Read the notes further down below in
|
||||
* **Step 1:** \
|
||||
To download this script, it is necessary to have git installed. If you don't have git already installed, or if you are unsure, run the following command:
|
||||
```shell
|
||||
sudo apt-get install git -y
|
||||
sudo apt-get update && sudo apt-get install git -y
|
||||
```
|
||||
|
||||
* **Step 2:** \
|
||||
Once git is installed, use the following command to download KIAUH into your home-directoy:
|
||||
Once git is installed, use the following command to download KIAUH into your home-directory:
|
||||
|
||||
```shell
|
||||
cd ~ && git clone https://github.com/th33xitus/kiauh.git
|
||||
cd ~ && git clone https://github.com/dw-0/kiauh.git
|
||||
```
|
||||
|
||||
* **Step 3:** \
|
||||
Finally start KIAUH by running the next command:
|
||||
Finally, start KIAUH by running the next command:
|
||||
|
||||
```shell
|
||||
./kiauh/kiauh.sh
|
||||
@@ -125,7 +125,7 @@ prompt and confirm by hitting ENTER.
|
||||
<tr>
|
||||
<th><img src="https://raw.githubusercontent.com/fluidd-core/fluidd/master/docs/assets/images/logo.svg" alt="Fluidd Logo" height="64"></th>
|
||||
<th><img src="https://avatars.githubusercontent.com/u/31575189?v=4" alt="jordanruthe avatar" height="64"></th>
|
||||
<th><img src="https://camo.githubusercontent.com/627be7fc67195b626b298af9b9677d7c58e698c67305e54324cffbe06130d4a4/68747470733a2f2f6f63746f7072696e742e6f72672f6173736574732f696d672f6c6f676f2e706e67" alt="OctoPrint Logo" height="64"></th>
|
||||
<th><img src="https://raw.githubusercontent.com/OctoPrint/OctoPrint/master/docs/images/octoprint-logo.png" alt="OctoPrint Logo" height="64"></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>by <a href="https://github.com/fluidd-core">fluidd-core</a></th>
|
||||
@@ -152,23 +152,26 @@ prompt and confirm by hitting ENTER.
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th><h3></h3></th>
|
||||
<th><h3><a href="https://github.com/Clon1998/mobileraker_companion">Mobileraker's Companion</a></h3></th>
|
||||
<th><h3><a href="https://octoeverywhere.com/?source=kiauh_readme">OctoEverywhere For Klipper</a></h3></th>
|
||||
<th><h3><a href="https://github.com/crysxd/OctoPrint-OctoApp">OctoApp For Klipper</a></h3></th>
|
||||
<th><h3></h3></th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th></th>
|
||||
<th><a href="https://github.com/Clon1998/mobileraker_companion"><img src="https://raw.githubusercontent.com/Clon1998/mobileraker/master/assets/icon/mr_appicon.png" alt="OctoEverywhere Logo" height="64"></th>
|
||||
<th><a href="https://octoeverywhere.com/?source=kiauh_readme"><img src="https://octoeverywhere.com/img/logo.svg" alt="OctoEverywhere Logo" height="64"></a></th>
|
||||
<th></th>
|
||||
<th><a href="https://octoapp.eu/?source=kiauh_readme"><img src="https://octoapp.eu/octoapp.webp" alt="OctoApp Logo" height="64"></a></th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>by <a href="https://github.com/Clon1998">Patrick Schmidt</a></th>
|
||||
<th>by <a href="https://github.com/QuinnDamerell">Quinn Damerell</a></th>
|
||||
<th>by <a href="https://github.com/crysxd">Christian Würthner</a></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
|
||||
|
||||
</table>
|
||||
|
||||
<hr>
|
||||
@@ -176,5 +179,14 @@ prompt and confirm by hitting ENTER.
|
||||
<h2 align="center">✨ Credits ✨</h2>
|
||||
|
||||
* A big thank you to [lixxbox](https://github.com/lixxbox) for that awesome KIAUH-Logo!
|
||||
* Also, a big thank you to everyone who supported my work with a [Ko-fi](https://ko-fi.com/th33xitus) !
|
||||
* Also, a big thank you to everyone who supported my work with a [Ko-fi](https://ko-fi.com/dw__0) !
|
||||
* Last but not least: Thank you to all contributors and members of the Klipper Community who like and share this project!
|
||||
|
||||
<hr>
|
||||
|
||||
<h4 align="center">A special thank you to JetBrains for sponsoring this project with their incredible software!</h4>
|
||||
<p align="center">
|
||||
<a href="https://www.jetbrains.com/community/opensource/#support" target="_blank">
|
||||
<img src="https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.png" alt="JetBrains Logo (Main) logo." height="128">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
@@ -2,6 +2,11 @@
|
||||
|
||||
This document covers possible important changes to KIAUH.
|
||||
|
||||
### 2023-06-17
|
||||
KIAUH has now added support for installing Mobileraker's companion!
|
||||
Mobileraker is a free and Open Source Android and iOS App for Klipper, utilizing the Moonraker API, allowing you
|
||||
to control your printer. Thank you to [Clon1998](https://github.com/Clon1998) for adding this feature!
|
||||
|
||||
### 2023-02-03
|
||||
The installer for MJPG-Streamer got replaced by crowsnest. It is an improved webcam service, utilizing ustreamer.
|
||||
Please have a look here for additional info about crowsnest and how to configure it: https://github.com/mainsail-crew/crowsnest \
|
||||
|
||||
@@ -41,7 +41,7 @@ Execute with:
|
||||
`RUN_SHELL_COMMAND CMD=hello_world`
|
||||
|
||||
### Passing parameters:
|
||||
As of commit [f231fa9](https://github.com/th33xitus/kiauh/commit/f231fa9c69191f23277b4e3319f6b675bfa0ee42) it is also possible to pass optional parameters to a `gcode_shell_command`.
|
||||
As of commit [f231fa9](https://github.com/dw-0/kiauh/commit/f231fa9c69191f23277b4e3319f6b675bfa0ee42) it is also possible to pass optional parameters to a `gcode_shell_command`.
|
||||
The following short example shows storing the extruder temperature into a variable, passing that value with a parameter to a `gcode_shell_command`, which then,
|
||||
once the gcode_macro runs and the gcode_shell_command gets called, executes the `script.sh`. The script then echoes a message to the console (if `verbose: True`)
|
||||
and writes the value of the parameter into a textfile called `test.txt` located in the home directory.
|
||||
|
||||
8
kiauh.sh
8
kiauh.sh
@@ -1,18 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/th33xitus/kiauh #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
# #
|
||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||
#=======================================================================#
|
||||
|
||||
# TODO: upload_log
|
||||
# TODO: all backup functions
|
||||
# TODO: doublecheck that nothing got missed!
|
||||
|
||||
set -e
|
||||
clear
|
||||
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
[mcu]
|
||||
serial: /dev/serial/by-id/<your-mcu-id>
|
||||
|
||||
[virtual_sdcard]
|
||||
path: %GCODES_DIR%
|
||||
on_error_gcode: CANCEL_PRINT
|
||||
|
||||
[printer]
|
||||
kinematics: none
|
||||
max_velocity: 1000
|
||||
|
||||
@@ -1 +1 @@
|
||||
KLIPPER_ARGS="/home/%USER%/klipper/klippy/klippy.py %CFG% -I %PRINTER% -l %LOG% -a %UDS%"
|
||||
KLIPPER_ARGS="%KLIPPER_DIR%/klippy/klippy.py %CFG% -I %PRINTER% -l %LOG% -a %UDS%"
|
||||
@@ -11,7 +11,7 @@ WantedBy=multi-user.target
|
||||
Type=simple
|
||||
User=%USER%
|
||||
RemainAfterExit=yes
|
||||
WorkingDirectory=/home/%USER%/klipper
|
||||
WorkingDirectory=%KLIPPER_DIR%
|
||||
EnvironmentFile=%ENV_FILE%
|
||||
ExecStart=%ENV%/bin/python $KLIPPER_ARGS
|
||||
Restart=always
|
||||
|
||||
@@ -1 +1 @@
|
||||
TELEGRAM_BOT_ARGS="/home/%USER%/moonraker-telegram-bot/bot/main.py -c %CFG% -l %LOG%"
|
||||
TELEGRAM_BOT_ARGS="%TELEGRAM_BOT_DIR%/bot/main.py -c %CFG% -l %LOG%"
|
||||
@@ -9,7 +9,7 @@ WantedBy=multi-user.target
|
||||
[Service]
|
||||
Type=simple
|
||||
User=%USER%
|
||||
WorkingDirectory=/home/%USER%/moonraker-telegram-bot
|
||||
WorkingDirectory=%TELEGRAM_BOT_DIR%
|
||||
EnvironmentFile=%ENV_FILE%
|
||||
ExecStart=%ENV%/bin/python $TELEGRAM_BOT_ARGS
|
||||
Restart=always
|
||||
|
||||
@@ -1 +1 @@
|
||||
MOONRAKER_ARGS="/home/%USER%/moonraker/moonraker/moonraker.py -d %PRINTER_DATA%"
|
||||
MOONRAKER_ARGS="%MOONRAKER_DIR%/moonraker/moonraker.py -d %PRINTER_DATA%"
|
||||
@@ -12,7 +12,7 @@ Type=simple
|
||||
User=%USER%
|
||||
SupplementaryGroups=moonraker-admin
|
||||
RemainAfterExit=yes
|
||||
WorkingDirectory=/home/%USER%/moonraker
|
||||
WorkingDirectory=%MOONRAKER_DIR%
|
||||
EnvironmentFile=%ENV_FILE%
|
||||
ExecStart=%ENV%/bin/python $MOONRAKER_ARGS
|
||||
Restart=always
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/th33xitus/kiauh #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
# #
|
||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||
#=======================================================================#
|
||||
@@ -31,21 +31,30 @@ function backup_before_update() {
|
||||
backup_"${1}"
|
||||
}
|
||||
|
||||
function backup_klipper_config_dir() {
|
||||
function backup_config_dir() {
|
||||
check_for_backup_dir
|
||||
local current_date config_folder_name
|
||||
local current_date config_pathes
|
||||
|
||||
if [[ -d "${KLIPPER_CONFIG}" ]]; then
|
||||
config_pathes=$(get_config_folders)
|
||||
|
||||
if [[ -n "${config_pathes}" ]]; then
|
||||
current_date=$(get_date)
|
||||
config_folder_name="$(echo "${KLIPPER_CONFIG}" | rev | cut -d"/" -f1 | rev)"
|
||||
|
||||
status_msg "Timestamp: ${current_date}"
|
||||
status_msg "Create backup of the Klipper config directory ..."
|
||||
|
||||
mkdir -p "${BACKUP_DIR}/${config_folder_name}/${current_date}"
|
||||
cp -r "${KLIPPER_CONFIG}" "${_}"
|
||||
local i=0 folder folder_name target_dir
|
||||
for folder in ${config_pathes}; do
|
||||
if [[ -d ${folder} ]]; then
|
||||
status_msg "Create backup of ${folder} ..."
|
||||
|
||||
print_confirm "Configuration directory backup complete!"
|
||||
folder_name=$(echo "${folder}" | rev | cut -d"/" -f2 | rev)
|
||||
target_dir="${BACKUP_DIR}/configs/${current_date}/${folder_name}"
|
||||
mkdir -p "${target_dir}"
|
||||
cp -r "${folder}" "${target_dir}"
|
||||
i=$(( i + 1 ))
|
||||
|
||||
ok_msg "Backup created in:\n${target_dir}"
|
||||
fi
|
||||
done
|
||||
else
|
||||
ok_msg "No config directory found! Skipping backup ..."
|
||||
fi
|
||||
@@ -53,27 +62,29 @@ function backup_klipper_config_dir() {
|
||||
|
||||
function backup_moonraker_database() {
|
||||
check_for_backup_dir
|
||||
local current_date databases target_dir regex=".moonraker_database(_[0-9a-zA-Z]+)?"
|
||||
databases=$(find "${HOME}" -maxdepth 1 -type d -regextype posix-extended -regex "${HOME}/${regex}" | sort)
|
||||
local current_date db_pathes
|
||||
|
||||
if [[ -n ${databases} ]]; then
|
||||
db_pathes=$(get_instance_folder_path "database")
|
||||
|
||||
if [[ -n ${db_pathes} ]]; then
|
||||
current_date=$(get_date)
|
||||
target_dir="${BACKUP_DIR}/moonraker_database_backup/${current_date}"
|
||||
|
||||
status_msg "Timestamp: ${current_date}"
|
||||
mkdir -p "${target_dir}"
|
||||
|
||||
for database in ${databases}; do
|
||||
local i=0 database folder_name target_dir
|
||||
for database in ${db_pathes}; do
|
||||
status_msg "Create backup of ${database} ..."
|
||||
cp -r "${database}" "${target_dir}"
|
||||
ok_msg "Done!"
|
||||
done
|
||||
|
||||
print_confirm "Moonraker database backup complete!"
|
||||
folder_name=$(echo "${database}" | rev | cut -d"/" -f2 | rev)
|
||||
target_dir="${BACKUP_DIR}/moonraker_databases/${current_date}/${folder_name}"
|
||||
mkdir -p "${target_dir}"
|
||||
cp -r "${database}" "${target_dir}"
|
||||
i=$(( i + 1 ))
|
||||
|
||||
ok_msg "Backup created in:\n${target_dir}"
|
||||
done
|
||||
else
|
||||
print_error "No Moonraker database found! Skipping backup ..."
|
||||
fi
|
||||
return
|
||||
}
|
||||
|
||||
function backup_klipper() {
|
||||
@@ -186,3 +197,19 @@ function backup_telegram_bot() {
|
||||
print_error "Can't back up MoonrakerTelegramBot directory!\n Not found!"
|
||||
fi
|
||||
}
|
||||
|
||||
function backup_octoeverywhere() {
|
||||
local current_date
|
||||
|
||||
if [[ -d ${OCTOEVERYWHERE_DIR} ]] ; then
|
||||
status_msg "Creating OctoEverywhere backup ..."
|
||||
check_for_backup_dir
|
||||
current_date=$(get_date)
|
||||
status_msg "Timestamp: ${current_date}"
|
||||
mkdir -p "${BACKUP_DIR}/OctoEverywhere-backups/${current_date}"
|
||||
cp -r "${OCTOEVERYWHERE_DIR}" "${_}" && cp -r "${OCTOEVERYWHERE_ENV}" "${_}"
|
||||
print_confirm "OctoEverywhere backup complete!"
|
||||
else
|
||||
print_error "Can't back up OctoEverywhere directory!\n Not found!"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/th33xitus/kiauh #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
# #
|
||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||
#=======================================================================#
|
||||
@@ -105,7 +105,7 @@ function install_crowsnest(){
|
||||
pushd "${HOME}/crowsnest" &> /dev/null || exit 1
|
||||
title_msg "Installer will prompt you for sudo password!"
|
||||
status_msg "Launching crowsnest installer ..."
|
||||
if ! sudo make install; then
|
||||
if ! sudo make install BASE_USER=$USER; then
|
||||
error_msg "Something went wrong! Please try again..."
|
||||
exit 1
|
||||
fi
|
||||
@@ -117,18 +117,22 @@ function install_crowsnest(){
|
||||
|
||||
# Remove func
|
||||
function remove_crowsnest(){
|
||||
if [[ -d "${CROWSNEST_DIR}" ]]; then
|
||||
pushd "${HOME}/crowsnest" &> /dev/null || exit 1
|
||||
title_msg "Uninstaller will prompt you for sudo password!"
|
||||
status_msg "Launching crowsnest uninstaller ..."
|
||||
|
||||
if ! make uninstall; then
|
||||
error_msg "Something went wrong! Please try again..."
|
||||
exit 1
|
||||
fi
|
||||
if [[ -e "${CROWSNEST_DIR}" ]]; then
|
||||
|
||||
status_msg "Removing crowsnest directory ..."
|
||||
rm -rf "${CROWSNEST_DIR}"
|
||||
ok_msg "Directory removed!"
|
||||
fi
|
||||
|
||||
print_confirm "Crowsnest successfully removed!"
|
||||
}
|
||||
|
||||
# Status funcs
|
||||
@@ -197,7 +201,7 @@ function compare_crowsnest_versions() {
|
||||
}
|
||||
|
||||
function install_crowsnest_dependencies() {
|
||||
local packages
|
||||
local packages log_name="Crowsnest"
|
||||
local install_script="${CROWSNEST_DIR}/tools/install.sh"
|
||||
|
||||
### read PKGLIST from official install-script
|
||||
@@ -208,21 +212,11 @@ function install_crowsnest_dependencies() {
|
||||
echo "${cyan}${packages}${white}" | tr '[:space:]' '\n'
|
||||
read -r -a packages <<< "${packages}"
|
||||
|
||||
### Update system package info
|
||||
status_msg "Updating package lists..."
|
||||
if ! sudo apt-get update --allow-releaseinfo-change; then
|
||||
log_error "failure while updating package lists"
|
||||
error_msg "Updating package lists failed!"
|
||||
exit 1
|
||||
fi
|
||||
### Update system package lists if stale
|
||||
update_system_package_lists
|
||||
|
||||
### Install required packages
|
||||
status_msg "Installing required packages..."
|
||||
if ! sudo apt-get install --yes "${packages[@]}"; then
|
||||
log_error "failure while installing required crowsnest packages"
|
||||
error_msg "Installing required packages failed!"
|
||||
exit 1
|
||||
fi
|
||||
install_system_packages "${log_name}" "packages[@]"
|
||||
}
|
||||
|
||||
function update_crowsnest() {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/th33xitus/kiauh #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
# #
|
||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||
#=======================================================================#
|
||||
@@ -52,16 +52,57 @@ function init_flash_process() {
|
||||
esac
|
||||
done
|
||||
|
||||
### step 2: select how the mcu is connected to the host
|
||||
### step 2: select how the mcu is flashed (flash/serialflash)
|
||||
select_flash_command
|
||||
|
||||
### step 3: select how the mcu is connected to the host
|
||||
select_mcu_connection
|
||||
|
||||
### step 3: select which detected mcu should be flashed
|
||||
### step 4: select which detected mcu should be flashed
|
||||
select_mcu_id "${method}"
|
||||
}
|
||||
|
||||
#================================================#
|
||||
#=================== STEP 2 =====================#
|
||||
#================================================#
|
||||
function select_flash_command() {
|
||||
unset flash_command
|
||||
|
||||
top_border
|
||||
echo -e "| How to flash MCU? |"
|
||||
echo -e "| 1) make flash (default) |"
|
||||
echo -e "| 2) make serialflash (stm32flash) |"
|
||||
blank_line
|
||||
back_help_footer
|
||||
|
||||
local choice
|
||||
while true; do
|
||||
read -p "${cyan}###### Flashing command:${white} " -i "1" -e choice
|
||||
case "${choice}" in
|
||||
1)
|
||||
select_msg "Selected 'make flash' command"
|
||||
flash_command="flash"
|
||||
break;;
|
||||
2)
|
||||
select_msg "Selected 'make serialflash' command"
|
||||
flash_command="serialflash"
|
||||
break;;
|
||||
B|b)
|
||||
advanced_menu
|
||||
break;;
|
||||
H|h)
|
||||
clear && print_header
|
||||
show_mcu_flash_command_help
|
||||
break;;
|
||||
*)
|
||||
error_msg "Invalid command!";;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
#================================================#
|
||||
#=================== STEP 3 =====================#
|
||||
#================================================#
|
||||
function select_mcu_connection() {
|
||||
top_border
|
||||
echo -e "| ${yellow}Make sure that the controller board is connected now!${white} |"
|
||||
@@ -70,6 +111,7 @@ function select_mcu_connection() {
|
||||
echo -e "| How is the controller board connected to the host? |"
|
||||
echo -e "| 1) USB |"
|
||||
echo -e "| 2) UART |"
|
||||
echo -e "| 3) USB (DFU mode) |"
|
||||
blank_line
|
||||
back_help_footer
|
||||
|
||||
@@ -85,6 +127,10 @@ function select_mcu_connection() {
|
||||
status_msg "Identifying MCU possibly connected via UART ...\n"
|
||||
get_uart_id || true # continue even after exit code 1
|
||||
break;;
|
||||
3)
|
||||
status_msg "Identifying MCU connected via USB in DFU mode ...\n"
|
||||
get_dfu_id || true # continue even after exit code 1
|
||||
break;;
|
||||
B|b)
|
||||
advanced_menu
|
||||
break;;
|
||||
@@ -107,7 +153,6 @@ function print_detected_mcu_to_screen() {
|
||||
fi
|
||||
|
||||
for mcu in "${mcu_list[@]}"; do
|
||||
mcu=$(echo "${mcu}" | rev | cut -d"/" -f1 | rev)
|
||||
echo -e " ● MCU #${i}: ${cyan}${mcu}${white}"
|
||||
i=$(( i + 1 ))
|
||||
done
|
||||
@@ -115,7 +160,7 @@ function print_detected_mcu_to_screen() {
|
||||
}
|
||||
|
||||
#================================================#
|
||||
#=================== STEP 3 =====================#
|
||||
#=================== STEP 4 =====================#
|
||||
#================================================#
|
||||
function select_mcu_id() {
|
||||
local i=0 sel_index=0 method=${1}
|
||||
@@ -190,7 +235,7 @@ function start_flash_mcu() {
|
||||
local device=${1}
|
||||
do_action_service "stop" "klipper"
|
||||
|
||||
if make flash FLASH_DEVICE="${device}"; then
|
||||
if make ${flash_command} FLASH_DEVICE="${device}"; then
|
||||
ok_msg "Flashing successfull!"
|
||||
else
|
||||
warn_msg "Flashing failed!"
|
||||
@@ -329,6 +374,16 @@ function get_uart_id() {
|
||||
done
|
||||
}
|
||||
|
||||
function get_dfu_id() {
|
||||
unset mcu_list
|
||||
sleep 1
|
||||
mcus=$(lsusb | grep "DFU" | cut -d " " -f 6 2>/dev/null)
|
||||
|
||||
for mcu in ${mcus}; do
|
||||
mcu_list+=("${mcu}")
|
||||
done
|
||||
}
|
||||
|
||||
function show_flash_method_help() {
|
||||
top_border
|
||||
echo -e "| ~~~~~~~~ < ? > Help: Flash MCU < ? > ~~~~~~~~ |"
|
||||
@@ -372,6 +427,36 @@ function show_flash_method_help() {
|
||||
done
|
||||
}
|
||||
|
||||
function show_mcu_flash_command_help() {
|
||||
top_border
|
||||
echo -e "| ~~~~~~~~ < ? > Help: Flash MCU < ? > ~~~~~~~~ |"
|
||||
hr
|
||||
echo -e "| ${cyan}make flash:${white} |"
|
||||
echo -e "| The default command to flash controller board, it |"
|
||||
echo -e "| will detect selected microcontroller and use suitable |"
|
||||
echo -e "| tool for flashing it. |"
|
||||
blank_line
|
||||
echo -e "| ${cyan}make serialflash:${white} |"
|
||||
echo -e "| Special command to flash STM32 microcontrollers in |"
|
||||
echo -e "| DFU mode but connected via serial. stm32flash command |"
|
||||
echo -e "| will be used internally. |"
|
||||
blank_line
|
||||
back_footer
|
||||
|
||||
local choice
|
||||
while true; do
|
||||
read -p "${cyan}###### Please select:${white} " choice
|
||||
case "${choice}" in
|
||||
B|b)
|
||||
clear && print_header
|
||||
select_flash_command
|
||||
break;;
|
||||
*)
|
||||
error_msg "Invalid command!";;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
function show_mcu_connection_help() {
|
||||
top_border
|
||||
echo -e "| ~~~~~~~~ < ? > Help: Flash MCU < ? > ~~~~~~~~ |"
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/th33xitus/kiauh #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
# #
|
||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||
#=======================================================================#
|
||||
@@ -16,21 +16,35 @@ set -e
|
||||
#===================================================#
|
||||
|
||||
function install_fluidd() {
|
||||
### exit early if moonraker not found
|
||||
if [[ -z $(moonraker_systemd) ]]; then
|
||||
local error="Moonraker not installed! Please install Moonraker first!"
|
||||
print_error "${error}" && return
|
||||
local error="Moonraker not installed! It's recommended to install Moonraker first!"
|
||||
print_error "${error}"
|
||||
while true; do
|
||||
local yn
|
||||
read -p "${cyan}###### Proceed to install Fluidd without installing Moonraker? (y/N):${white} " yn
|
||||
case "${yn}" in
|
||||
Y|y|Yes|yes)
|
||||
select_msg "Yes"
|
||||
break;;
|
||||
N|n|No|no|"")
|
||||
select_msg "No"
|
||||
abort_msg "Exiting Fluidd setup ...\n"
|
||||
return;;
|
||||
*)
|
||||
error_msg "Invalid Input!";;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
### checking dependencies
|
||||
local dep=(wget nginx)
|
||||
local dep=(wget nginx unzip)
|
||||
dependency_check "${dep[@]}"
|
||||
### detect conflicting Haproxy and Apache2 installations
|
||||
detect_conflicting_packages
|
||||
|
||||
status_msg "Initializing Fluidd installation ..."
|
||||
### first, we create a backup of the full klipper_config dir - safety first!
|
||||
backup_klipper_config_dir
|
||||
backup_config_dir
|
||||
|
||||
### check for other enabled web interfaces
|
||||
unset SET_LISTEN_PORT
|
||||
@@ -303,19 +317,25 @@ function get_fluidd_status() {
|
||||
}
|
||||
|
||||
function get_local_fluidd_version() {
|
||||
[[ ! -f "${FLUIDD_DIR}/.version" ]] && return
|
||||
|
||||
local versionfile="${FLUIDD_DIR}/.version"
|
||||
local relinfofile="${FLUIDD_DIR}/release_info.json"
|
||||
local version
|
||||
version=$(head -n 1 "${FLUIDD_DIR}/.version")
|
||||
|
||||
if [[ -f ${relinfofile} ]]; then
|
||||
version=$(grep -o '"version":"[^"]*' "${relinfofile}" | grep -o '[^"]*$')
|
||||
elif [[ -f ${versionfile} ]]; then
|
||||
version=$(head -n 1 "${versionfile}")
|
||||
fi
|
||||
|
||||
echo "${version}"
|
||||
}
|
||||
|
||||
function get_remote_fluidd_version() {
|
||||
[[ ! $(dpkg-query -f'${Status}' --show curl 2>/dev/null) = *\ installed ]] && return
|
||||
|
||||
local version
|
||||
version=$(get_fluidd_download_url | rev | cut -d"/" -f2 | rev)
|
||||
echo "${version}"
|
||||
local tags
|
||||
tags=$(curl -s "https://api.github.com/repos/fluidd-core/fluidd/tags" | grep "name" | cut -d'"' -f4)
|
||||
echo "${tags}" | head -1
|
||||
}
|
||||
|
||||
function compare_fluidd_versions() {
|
||||
@@ -341,27 +361,28 @@ function compare_fluidd_versions() {
|
||||
#================================================#
|
||||
|
||||
function get_fluidd_download_url() {
|
||||
local fl_tags tags latest_tag latest_url stable_tag stable_url url
|
||||
local releases_by_tag tags tag unstable_url url
|
||||
|
||||
fl_tags="https://api.github.com/repos/fluidd-core/fluidd/tags"
|
||||
tags=$(curl -s "${fl_tags}" | grep "name" | cut -d'"' -f4)
|
||||
|
||||
### latest download url including pre-releases (alpha, beta, rc)
|
||||
latest_tag=$(echo "${tags}" | head -1)
|
||||
latest_url="https://github.com/fluidd-core/fluidd/releases/download/${latest_tag}/fluidd.zip"
|
||||
|
||||
### get stable fluidd download url
|
||||
stable_tag=$(echo "${tags}" | grep -E "^v([0-9]+\.?){3}$" | head -1)
|
||||
stable_url="https://github.com/fluidd-core/fluidd/releases/download/${stable_tag}/fluidd.zip"
|
||||
### latest stable download url
|
||||
url="https://github.com/fluidd-core/fluidd/releases/latest/download/fluidd.zip"
|
||||
|
||||
read_kiauh_ini "${FUNCNAME[0]}"
|
||||
if [[ ${fluidd_install_unstable} == "true" ]]; then
|
||||
url="${latest_url}"
|
||||
echo "${url}"
|
||||
releases_by_tag="https://api.github.com/repos/fluidd-core/fluidd/tags"
|
||||
tags=$(curl -s "${releases_by_tag}" | grep "name" | cut -d'"' -f4)
|
||||
tag=$(echo "${tags}" | head -1)
|
||||
|
||||
### latest unstable download url including pre-releases (alpha, beta, rc)
|
||||
unstable_url="https://github.com/fluidd-core/fluidd/releases/download/${tag}/fluidd.zip"
|
||||
|
||||
if [[ ${unstable_url} == *"download//"* ]]; then
|
||||
warn_msg "Download URL broken! Falling back to URL of latest stable release!"
|
||||
else
|
||||
url="${stable_url}"
|
||||
echo "${url}"
|
||||
url=${unstable_url}
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "${url}"
|
||||
}
|
||||
|
||||
function fluidd_port_check() {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/th33xitus/kiauh #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
# #
|
||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||
#=======================================================================#
|
||||
@@ -103,7 +103,7 @@ function install_gcode_shell_command() {
|
||||
|
||||
function create_example_shell_command() {
|
||||
### create a backup of the config folder
|
||||
backup_klipper_config_dir
|
||||
backup_config_dir
|
||||
|
||||
local configs regex path
|
||||
regex="${HOME//\//\\/}\/([A-Za-z0-9_]+)\/config\/printer\.cfg"
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/th33xitus/kiauh #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
# #
|
||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||
#=======================================================================#
|
||||
@@ -78,4 +78,13 @@ function set_globals() {
|
||||
CROWSNEST_DIR="${HOME}/crowsnest"
|
||||
CROWSNEST_REPO="https://github.com/mainsail-crew/crowsnest.git"
|
||||
|
||||
#=============== Mobileraker ================#
|
||||
MOBILERAKER_ENV="${HOME}/mobileraker-env"
|
||||
MOBILERAKER_DIR="${HOME}/mobileraker_companion"
|
||||
MOBILERAKER_REPO="https://github.com/Clon1998/mobileraker_companion.git"
|
||||
|
||||
#=============== OCTOAPP ================#
|
||||
OCTOAPP_ENV="${HOME}/octoapp-env"
|
||||
OCTOAPP_DIR="${HOME}/octoapp"
|
||||
OCTOAPP_REPO="https://github.com/crysxd/OctoApp-Plugin.git"
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/th33xitus/kiauh #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
# #
|
||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||
#=======================================================================#
|
||||
@@ -71,7 +71,7 @@ function start_klipper_setup() {
|
||||
### user selection for python version
|
||||
print_dialog_user_select_python_version
|
||||
while true; do
|
||||
read -p "${cyan}###### Select Python version:${white} " input
|
||||
read -p "${cyan}###### Select Python version:${white} " -i "1" -e input
|
||||
case "${input}" in
|
||||
1)
|
||||
select_msg "Python 3.x\n"
|
||||
@@ -244,6 +244,7 @@ function run_klipper_setup() {
|
||||
|
||||
### finalizing the setup with writing instance names to the kiauh.ini
|
||||
set_multi_instance_names
|
||||
mask_disrupting_services
|
||||
|
||||
print_confirm "${confirm}" && return
|
||||
}
|
||||
@@ -295,7 +296,7 @@ function create_klipper_virtualenv() {
|
||||
# @param {string}: python_version - klipper-env python version
|
||||
#
|
||||
function install_klipper_packages() {
|
||||
local packages python_version="${1}"
|
||||
local packages log_name="Klipper" python_version="${1}"
|
||||
local install_script="${KLIPPER_DIR}/scripts/install-debian.sh"
|
||||
|
||||
status_msg "Reading dependencies..."
|
||||
@@ -321,21 +322,11 @@ function install_klipper_packages() {
|
||||
echo "${cyan}${packages}${white}" | tr '[:space:]' '\n'
|
||||
read -r -a packages <<< "${packages}"
|
||||
|
||||
### Update system package info
|
||||
status_msg "Updating package lists..."
|
||||
if ! sudo apt-get update --allow-releaseinfo-change; then
|
||||
log_error "failure while updating package lists"
|
||||
error_msg "Updating package lists failed!"
|
||||
exit 1
|
||||
fi
|
||||
### Update system package lists if stale
|
||||
update_system_package_lists
|
||||
|
||||
### Install required packages
|
||||
status_msg "Installing required packages..."
|
||||
if ! sudo apt-get install --yes "${packages[@]}"; then
|
||||
log_error "failure while installing required klipper packages"
|
||||
error_msg "Installing required packages failed!"
|
||||
exit 1
|
||||
fi
|
||||
install_system_packages "${log_name}" "packages[@]"
|
||||
}
|
||||
|
||||
function create_klipper_service() {
|
||||
@@ -343,6 +334,7 @@ function create_klipper_service() {
|
||||
|
||||
local printer_data
|
||||
local cfg_dir
|
||||
local gcodes_dir
|
||||
local cfg
|
||||
local log
|
||||
local klippy_serial
|
||||
@@ -355,6 +347,7 @@ function create_klipper_service() {
|
||||
|
||||
printer_data="${HOME}/${instance_name}_data"
|
||||
cfg_dir="${printer_data}/config"
|
||||
gcodes_dir="${printer_data}/gcodes"
|
||||
cfg="${cfg_dir}/printer.cfg"
|
||||
log="${printer_data}/logs/klippy.log"
|
||||
klippy_serial="${printer_data}/comms/klippy.serial"
|
||||
@@ -378,25 +371,27 @@ function create_klipper_service() {
|
||||
|
||||
sudo cp "${service_template}" "${service}"
|
||||
sudo cp "${env_template}" "${env_file}"
|
||||
sudo sed -i "s|%USER%|${USER}|g; s|%ENV%|${KLIPPY_ENV}|; s|%ENV_FILE%|${env_file}|" "${service}"
|
||||
sudo sed -i "s|%USER%|${USER}|; s|%LOG%|${log}|; s|%CFG%|${cfg}|; s|%PRINTER%|${klippy_serial}|; s|%UDS%|${klippy_socket}|" "${env_file}"
|
||||
sudo sed -i "s|%USER%|${USER}|g; s|%KLIPPER_DIR%|${KLIPPER_DIR}|; s|%ENV%|${KLIPPY_ENV}|; s|%ENV_FILE%|${env_file}|" "${service}"
|
||||
sudo sed -i "s|%USER%|${USER}|; s|%KLIPPER_DIR%|${KLIPPER_DIR}|; s|%LOG%|${log}|; s|%CFG%|${cfg}|; s|%PRINTER%|${klippy_serial}|; s|%UDS%|${klippy_socket}|" "${env_file}"
|
||||
|
||||
ok_msg "Klipper service file created!"
|
||||
fi
|
||||
|
||||
if [[ ! -f ${cfg} ]]; then
|
||||
write_example_printer_cfg "${cfg}"
|
||||
write_example_printer_cfg "${cfg}" "${gcodes_dir}"
|
||||
fi
|
||||
}
|
||||
|
||||
function write_example_printer_cfg() {
|
||||
local cfg=${1}
|
||||
local gcodes_dir=${2}
|
||||
local cfg_template
|
||||
|
||||
cfg_template="${KIAUH_SRCDIR}/resources/example.printer.cfg"
|
||||
|
||||
status_msg "Creating minimal example printer.cfg ..."
|
||||
if cp "${cfg_template}" "${cfg}"; then
|
||||
sed -i "s|%GCODES_DIR%|${gcodes_dir}|" "${cfg}"
|
||||
ok_msg "Minimal example printer.cfg created!"
|
||||
else
|
||||
error_msg "Couldn't create minimal example printer.cfg!"
|
||||
@@ -590,8 +585,14 @@ function get_remote_klipper_commit() {
|
||||
[[ ! -d ${KLIPPER_DIR} || ! -d "${KLIPPER_DIR}/.git" ]] && return
|
||||
|
||||
local commit
|
||||
local branch
|
||||
|
||||
read_kiauh_ini "${FUNCNAME[0]}"
|
||||
branch="${custom_klipper_repo_branch}"
|
||||
[[ -z ${branch} ]] && branch="master"
|
||||
|
||||
cd "${KLIPPER_DIR}" && git fetch origin -q
|
||||
commit=$(git describe origin/master --always --tags | cut -d "-" -f 1,2)
|
||||
commit=$(git describe "origin/${branch}" --always --tags | cut -d "-" -f 1,2)
|
||||
echo "${commit}"
|
||||
}
|
||||
|
||||
@@ -629,3 +630,34 @@ function get_klipper_python_ver() {
|
||||
version=$("${KLIPPY_ENV}"/bin/python --version 2>&1 | cut -d" " -f2 | cut -d"." -f1)
|
||||
echo "${version}"
|
||||
}
|
||||
|
||||
function mask_disrupting_services() {
|
||||
local brltty="false"
|
||||
local brltty_udev="false"
|
||||
local modem_manager="false"
|
||||
|
||||
[[ $(dpkg -s brltty 2>/dev/null | grep "Status") = *\ installed ]] && brltty="true"
|
||||
[[ $(dpkg -s brltty-udev 2>/dev/null | grep "Status") = *\ installed ]] && brltty_udev="true"
|
||||
[[ $(dpkg -s ModemManager 2>/dev/null | grep "Status") = *\ installed ]] && modem_manager="true"
|
||||
|
||||
status_msg "Installed brltty package detected, masking brltty service ..."
|
||||
if [[ ${brltty} == "true" ]]; then
|
||||
sudo systemctl stop brltty
|
||||
sudo systemctl mask brltty
|
||||
fi
|
||||
ok_msg "brltty service masked!"
|
||||
|
||||
status_msg "Installed brltty-udev package detected, masking brltty-udev service ..."
|
||||
if [[ ${brltty_udev} == "true" ]]; then
|
||||
sudo systemctl stop brltty-udev
|
||||
sudo systemctl mask brltty-udev
|
||||
fi
|
||||
ok_msg "brltty-udev service masked!"
|
||||
|
||||
status_msg "Installed ModemManager package detected, masking ModemManager service ..."
|
||||
if [[ ${modem_manager} == "true" ]]; then
|
||||
sudo systemctl stop ModemManager
|
||||
sudo systemctl mask ModemManager
|
||||
fi
|
||||
ok_msg "ModemManager service masked!"
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/th33xitus/kiauh #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
# #
|
||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||
#=======================================================================#
|
||||
@@ -30,7 +30,7 @@ function install_klipperscreen() {
|
||||
fi
|
||||
|
||||
### first, we create a backup of the full klipper_config dir - safety first!
|
||||
backup_klipper_config_dir
|
||||
backup_config_dir
|
||||
|
||||
### install KlipperScreen
|
||||
klipperscreen_setup
|
||||
@@ -119,6 +119,8 @@ function update_klipperscreen() {
|
||||
old_md5=$(md5sum "${KLIPPERSCREEN_DIR}/scripts/KlipperScreen-requirements.txt" | cut -d " " -f1)
|
||||
|
||||
do_action_service "stop" "KlipperScreen"
|
||||
backup_before_update "klipperscreen"
|
||||
|
||||
cd "${KLIPPERSCREEN_DIR}"
|
||||
git pull origin master -q && ok_msg "Fetch successfull!"
|
||||
git checkout -f master && ok_msg "Checkout successfull"
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/th33xitus/kiauh #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
# #
|
||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||
#=======================================================================#
|
||||
@@ -16,21 +16,35 @@ set -e
|
||||
#===================================================#
|
||||
|
||||
function install_mainsail() {
|
||||
### exit early if moonraker not found
|
||||
if [[ -z $(moonraker_systemd) ]]; then
|
||||
local error="Moonraker not installed! Please install Moonraker first!"
|
||||
print_error "${error}" && return
|
||||
local error="Moonraker not installed! It's recommended to install Moonraker first!"
|
||||
print_error "${error}"
|
||||
while true; do
|
||||
local yn
|
||||
read -p "${cyan}###### Proceed to install Mainsail without installing Moonraker? (y/N):${white} " yn
|
||||
case "${yn}" in
|
||||
Y|y|Yes|yes)
|
||||
select_msg "Yes"
|
||||
break;;
|
||||
N|n|No|no|"")
|
||||
select_msg "No"
|
||||
abort_msg "Exiting Mainsail setup ...\n"
|
||||
return;;
|
||||
*)
|
||||
error_msg "Invalid Input!";;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
### checking dependencies
|
||||
local dep=(wget nginx)
|
||||
local dep=(wget nginx unzip)
|
||||
dependency_check "${dep[@]}"
|
||||
### detect conflicting Haproxy and Apache2 installations
|
||||
detect_conflicting_packages
|
||||
|
||||
status_msg "Initializing Mainsail installation ..."
|
||||
### first, we create a backup of the full klipper_config dir - safety first!
|
||||
#backup_klipper_config_dir
|
||||
backup_config_dir
|
||||
|
||||
### check for other enabled web interfaces
|
||||
unset SET_LISTEN_PORT
|
||||
@@ -157,6 +171,7 @@ function download_mainsail_macros() {
|
||||
}
|
||||
|
||||
function download_mainsail() {
|
||||
local services
|
||||
local url
|
||||
url=$(get_mainsail_download_url)
|
||||
|
||||
@@ -179,8 +194,9 @@ function download_mainsail() {
|
||||
exit 1
|
||||
fi
|
||||
|
||||
### check for moonraker multi-instance and if multi-instance was found, enable mainsails remoteMode
|
||||
if [[ $(moonraker_systemd | wc -w) -gt 1 ]]; then
|
||||
### check for moonraker multi-instance and if no-instance or multi-instance was found, enable mainsails remoteMode
|
||||
services=$(moonraker_systemd)
|
||||
if [[ ( -z "${services}" ) || ( $(echo "${services}" | wc -w) -gt 1 ) ]]; then
|
||||
enable_mainsail_remotemode
|
||||
fi
|
||||
}
|
||||
@@ -308,19 +324,25 @@ function get_mainsail_status() {
|
||||
}
|
||||
|
||||
function get_local_mainsail_version() {
|
||||
[[ ! -f "${MAINSAIL_DIR}/.version" ]] && return
|
||||
|
||||
local versionfile="${MAINSAIL_DIR}/.version"
|
||||
local relinfofile="${MAINSAIL_DIR}/release_info.json"
|
||||
local version
|
||||
version=$(head -n 1 "${MAINSAIL_DIR}/.version")
|
||||
|
||||
if [[ -f ${relinfofile} ]]; then
|
||||
version=$(grep -o '"version":"[^"]*' "${relinfofile}" | grep -o '[^"]*$')
|
||||
elif [[ -f ${versionfile} ]]; then
|
||||
version=$(head -n 1 "${versionfile}")
|
||||
fi
|
||||
|
||||
echo "${version}"
|
||||
}
|
||||
|
||||
function get_remote_mainsail_version() {
|
||||
[[ ! $(dpkg-query -f'${Status}' --show curl 2>/dev/null) = *\ installed ]] && return
|
||||
|
||||
local version
|
||||
version=$(get_mainsail_download_url | rev | cut -d"/" -f2 | rev)
|
||||
echo "${version}"
|
||||
local tags
|
||||
tags=$(curl -s "https://api.github.com/repos/mainsail-crew/mainsail/tags" | grep "name" | cut -d'"' -f4)
|
||||
echo "${tags}" | head -1
|
||||
}
|
||||
|
||||
function compare_mainsail_versions() {
|
||||
@@ -358,7 +380,7 @@ function print_theme_list() {
|
||||
|
||||
function ms_theme_installer_menu() {
|
||||
local theme_list theme_author theme_repo theme_name theme_note theme_url
|
||||
local theme_csv_url="https://raw.githubusercontent.com/mainsail-crew/docs/master/_data/themes.csv"
|
||||
local theme_csv_url="https://raw.githubusercontent.com/mainsail-crew/gb-docs/main/_data/themes.csv"
|
||||
theme_list=$(curl -s -L "${theme_csv_url}")
|
||||
|
||||
top_border
|
||||
@@ -511,27 +533,28 @@ function ms_theme_delete() {
|
||||
#================================================#
|
||||
|
||||
function get_mainsail_download_url() {
|
||||
local ms_tags tags latest_tag latest_url stable_tag stable_url url
|
||||
local releases_by_tag tags tag unstable_url url
|
||||
|
||||
ms_tags="https://api.github.com/repos/mainsail-crew/mainsail/tags"
|
||||
tags=$(curl -s "${ms_tags}" | grep "name" | cut -d'"' -f4)
|
||||
|
||||
### latest download url including pre-releases (alpha, beta, rc)
|
||||
latest_tag=$(echo "${tags}" | head -1)
|
||||
latest_url="https://github.com/mainsail-crew/mainsail/releases/download/${latest_tag}/mainsail.zip"
|
||||
|
||||
### get stable mainsail download url
|
||||
stable_tag=$(echo "${tags}" | grep -E "^v([0-9]+\.?){3}$" | head -1)
|
||||
stable_url="https://github.com/mainsail-crew/mainsail/releases/download/${stable_tag}/mainsail.zip"
|
||||
### latest stable download url
|
||||
url="https://github.com/mainsail-crew/mainsail/releases/latest/download/mainsail.zip"
|
||||
|
||||
read_kiauh_ini "${FUNCNAME[0]}"
|
||||
if [[ ${mainsail_install_unstable} == "true" ]]; then
|
||||
url="${latest_url}"
|
||||
echo "${url}"
|
||||
releases_by_tag="https://api.github.com/repos/mainsail-crew/mainsail/tags"
|
||||
tags=$(curl -s "${releases_by_tag}" | grep "name" | cut -d'"' -f4)
|
||||
tag=$(echo "${tags}" | head -1)
|
||||
|
||||
### latest unstable download url including pre-releases (alpha, beta, rc)
|
||||
unstable_url="https://github.com/mainsail-crew/mainsail/releases/download/${tag}/mainsail.zip"
|
||||
|
||||
if [[ ${unstable_url} == *"download//"* ]]; then
|
||||
warn_msg "Download URL broken! Falling back to URL of latest stable release!"
|
||||
else
|
||||
url="${stable_url}"
|
||||
echo "${url}"
|
||||
url=${unstable_url}
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "${url}"
|
||||
}
|
||||
|
||||
function mainsail_port_check() {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/th33xitus/kiauh #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
# #
|
||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||
#=======================================================================#
|
||||
|
||||
247
scripts/mobileraker.sh
Normal file
247
scripts/mobileraker.sh
Normal file
@@ -0,0 +1,247 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
# #
|
||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||
#=======================================================================#
|
||||
|
||||
#
|
||||
# This file is written and maintained by Patrick Schmidt author of Mobileraker
|
||||
# It is based of the kliperscreen.sh install script!
|
||||
|
||||
|
||||
set -e
|
||||
|
||||
#===================================================#
|
||||
#========== INSTALL MOBILERAKER COMPANION ==========#
|
||||
#===================================================#
|
||||
|
||||
function mobileraker_systemd() {
|
||||
local services
|
||||
services=$(find "${SYSTEMD}" -maxdepth 1 -regextype posix-extended -regex "${SYSTEMD}/mobileraker.service")
|
||||
echo "${services}"
|
||||
}
|
||||
|
||||
function install_mobileraker() {
|
||||
### return early if python version check fails
|
||||
if [[ $(python3_check) == "false" ]]; then
|
||||
local error="Versioncheck failed! Python 3.7 or newer required!\n"
|
||||
error="${error} Please upgrade Python."
|
||||
print_error "${error}" && return
|
||||
fi
|
||||
|
||||
### first, we create a backup of the full klipper_config dir - safety first!
|
||||
backup_config_dir
|
||||
|
||||
### install Mobileraker's Companion
|
||||
mobileraker_setup
|
||||
|
||||
### add Mobileraker's Companion to the update manager in moonraker.conf
|
||||
patch_mobileraker_update_manager
|
||||
|
||||
do_action_service "restart" "mobileraker"
|
||||
}
|
||||
|
||||
function mobileraker_setup() {
|
||||
local dep=(wget curl unzip dfu-util)
|
||||
dependency_check "${dep[@]}"
|
||||
status_msg "Cloning Mobileraker's companion from ${MOBILERAKER_REPO} ..."
|
||||
|
||||
# force remove existing Mobileraker's companion dir
|
||||
[[ -d ${MOBILERAKER_DIR} ]] && rm -rf "${MOBILERAKER_DIR}"
|
||||
|
||||
# clone into fresh Mobileraker's companion dir
|
||||
cd "${HOME}" || exit 1
|
||||
if ! git clone "${MOBILERAKER_REPO}" "${MOBILERAKER_DIR}"; then
|
||||
print_error "Cloning mobileraker's companion from\n ${MOBILERAKER_REPO}\n failed!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
status_msg "Starting installer of Mobileraker's companion ..."
|
||||
if "${MOBILERAKER_DIR}"/scripts/install.sh; then
|
||||
ok_msg "Mobileraker's companion successfully installed!"
|
||||
else
|
||||
print_error "Mobileraker's companion installation failed!"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
#===================================================#
|
||||
#=========== REMOVE MOBILERAKER COMPANION ==========#
|
||||
#===================================================#
|
||||
|
||||
function remove_mobileraker() {
|
||||
### remove Mobileraker's companion dir
|
||||
if [[ -d ${MOBILERAKER_DIR} ]]; then
|
||||
status_msg "Removing Mobileraker's companion directory ..."
|
||||
rm -rf "${MOBILERAKER_DIR}" && ok_msg "Directory removed!"
|
||||
fi
|
||||
|
||||
### remove Mobileraker's companion VENV dir
|
||||
if [[ -d ${MOBILERAKER_ENV} ]]; then
|
||||
status_msg "Removing Mobileraker's companion VENV directory ..."
|
||||
rm -rf "${MOBILERAKER_ENV}" && ok_msg "Directory removed!"
|
||||
fi
|
||||
|
||||
### remove Mobileraker's companion service
|
||||
if [[ -e "${SYSTEMD}/mobileraker.service" ]]; then
|
||||
status_msg "Removing mobileraker service ..."
|
||||
do_action_service "stop" "mobileraker"
|
||||
do_action_service "disable" "mobileraker"
|
||||
sudo rm -f "${SYSTEMD}/mobileraker.service"
|
||||
|
||||
###reloading units
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl reset-failed
|
||||
ok_msg "Mobileraker's companion Service removed!"
|
||||
fi
|
||||
|
||||
|
||||
remove_mobileraker_logs
|
||||
|
||||
print_confirm "Mobileraker's companion successfully removed!"
|
||||
}
|
||||
|
||||
function remove_mobileraker_logs() {
|
||||
local files regex="${HOME//\//\\/}\/([A-Za-z0-9_]+)\/logs\/mobileraker\.log.*"
|
||||
files=$(find "${HOME}" -maxdepth 3 -regextype posix-extended -regex "${regex}" | sort)
|
||||
|
||||
if [[ -n ${files} ]]; then
|
||||
for file in ${files}; do
|
||||
status_msg "Removing ${file} ..."
|
||||
rm -f "${file}"
|
||||
ok_msg "${file} removed!"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
#===================================================#
|
||||
#=========== UPDATE MOBILERAKER COMPANION ==========#
|
||||
#===================================================#
|
||||
|
||||
function update_mobileraker() {
|
||||
local old_md5
|
||||
old_md5=$(md5sum "${MOBILERAKER_DIR}/scripts/mobileraker-requirements.txt" | cut -d " " -f1)
|
||||
|
||||
do_action_service "stop" "mobileraker"
|
||||
cd "${MOBILERAKER_DIR}"
|
||||
git pull origin main -q && ok_msg "Fetch successfull!"
|
||||
git checkout -f main && ok_msg "Checkout successfull"
|
||||
|
||||
if [[ $(md5sum "${MOBILERAKER_DIR}/scripts/mobileraker-requirements.txt" | cut -d " " -f1) != "${old_md5}" ]]; then
|
||||
status_msg "New dependecies detected..."
|
||||
"${MOBILERAKER_ENV}"/bin/pip install -r "${MOBILERAKER_DIR}/scripts/mobileraker-requirements.txt"
|
||||
ok_msg "Dependencies have been installed!"
|
||||
fi
|
||||
|
||||
ok_msg "Update complete!"
|
||||
do_action_service "start" "mobileraker"
|
||||
}
|
||||
|
||||
#===================================================#
|
||||
#=========== MOBILERAKER COMPANION STATUS ==========#
|
||||
#===================================================#
|
||||
|
||||
function get_mobileraker_status() {
|
||||
local sf_count status
|
||||
sf_count="$(mobileraker_systemd | wc -w)"
|
||||
|
||||
### remove the "SERVICE" entry from the data array if a moonraker service is installed
|
||||
local data_arr=(SERVICE "${MOBILERAKER_DIR}" "${MOBILERAKER_ENV}")
|
||||
(( sf_count > 0 )) && unset "data_arr[0]"
|
||||
|
||||
### count+1 for each found data-item from array
|
||||
local filecount=0
|
||||
for data in "${data_arr[@]}"; do
|
||||
[[ -e ${data} ]] && filecount=$(( filecount + 1 ))
|
||||
done
|
||||
|
||||
if (( filecount == ${#data_arr[*]} )); then
|
||||
status="Installed!"
|
||||
elif (( filecount == 0 )); then
|
||||
status="Not installed!"
|
||||
else
|
||||
status="Incomplete!"
|
||||
fi
|
||||
echo "${status}"
|
||||
}
|
||||
|
||||
function get_local_mobileraker_commit() {
|
||||
[[ ! -d ${MOBILERAKER_DIR} || ! -d "${MOBILERAKER_DIR}/.git" ]] && return
|
||||
|
||||
local commit
|
||||
cd "${MOBILERAKER_DIR}"
|
||||
commit="$(git describe HEAD --always --tags | cut -d "-" -f 1,2)"
|
||||
echo "${commit}"
|
||||
}
|
||||
|
||||
function get_remote_mobileraker_commit() {
|
||||
[[ ! -d ${MOBILERAKER_DIR} || ! -d "${MOBILERAKER_DIR}/.git" ]] && return
|
||||
|
||||
local commit
|
||||
cd "${MOBILERAKER_DIR}" && git fetch origin -q
|
||||
commit=$(git describe origin/main --always --tags | cut -d "-" -f 1,2)
|
||||
echo "${commit}"
|
||||
}
|
||||
|
||||
function compare_mobileraker_versions() {
|
||||
local versions local_ver remote_ver
|
||||
local_ver="$(get_local_mobileraker_commit)"
|
||||
remote_ver="$(get_remote_mobileraker_commit)"
|
||||
|
||||
if [[ ${local_ver} != "${remote_ver}" ]]; then
|
||||
versions="${yellow}$(printf " %-14s" "${local_ver}")${white}"
|
||||
versions+="|${green}$(printf " %-13s" "${remote_ver}")${white}"
|
||||
# add moonraker to application_updates_available in kiauh.ini
|
||||
add_to_application_updates "mobileraker"
|
||||
else
|
||||
versions="${green}$(printf " %-14s" "${local_ver}")${white}"
|
||||
versions+="|${green}$(printf " %-13s" "${remote_ver}")${white}"
|
||||
fi
|
||||
|
||||
echo "${versions}"
|
||||
}
|
||||
|
||||
#================================================#
|
||||
#=================== HELPERS ====================#
|
||||
#================================================#
|
||||
|
||||
function patch_mobileraker_update_manager() {
|
||||
local patched moonraker_configs regex
|
||||
regex="${HOME//\//\\/}\/([A-Za-z0-9_]+)\/config\/moonraker\.conf"
|
||||
moonraker_configs=$(find "${HOME}" -maxdepth 3 -type f -regextype posix-extended -regex "${regex}" | sort)
|
||||
|
||||
patched="false"
|
||||
for conf in ${moonraker_configs}; do
|
||||
if ! grep -Eq "^\[update_manager mobileraker\]\s*$" "${conf}"; then
|
||||
### add new line to conf if it doesn't end with one
|
||||
[[ $(tail -c1 "${conf}" | wc -l) -eq 0 ]] && echo "" >> "${conf}"
|
||||
|
||||
### add Mobileraker's Companion update manager section to moonraker.conf
|
||||
status_msg "Adding Mobileraker's Companion to update manager in file:\n ${conf}"
|
||||
/bin/sh -c "cat >> ${conf}" << MOONRAKER_CONF
|
||||
|
||||
[update_manager mobileraker]
|
||||
type: git_repo
|
||||
path: ${HOME}/mobileraker_companion
|
||||
origin: https://github.com/Clon1998/mobileraker_companion.git
|
||||
primary_branch:main
|
||||
managed_services: mobileraker
|
||||
env: ${HOME}/mobileraker-env/bin/python
|
||||
requirements: scripts/mobileraker-requirements.txt
|
||||
install_script: scripts/install.sh
|
||||
MOONRAKER_CONF
|
||||
|
||||
fi
|
||||
|
||||
patched="true"
|
||||
done
|
||||
|
||||
if [[ ${patched} == "true" ]]; then
|
||||
do_action_service "restart" "moonraker"
|
||||
fi
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/th33xitus/kiauh #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
# #
|
||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||
#=======================================================================#
|
||||
@@ -33,7 +33,7 @@ function telegram_bot_setup_dialog() {
|
||||
|
||||
status_msg "Initializing Telegram Bot installation ..."
|
||||
### first, we create a backup of the full klipper_config dir - safety first!
|
||||
backup_klipper_config_dir
|
||||
backup_config_dir
|
||||
|
||||
local moonraker_count user_input=() moonraker_names=()
|
||||
moonraker_count=$(echo "${moonraker_services}" | wc -w )
|
||||
@@ -110,7 +110,7 @@ function telegram_bot_setup_dialog() {
|
||||
}
|
||||
|
||||
function install_telegram_bot_dependencies() {
|
||||
local packages
|
||||
local packages log_name="Telegram Bot"
|
||||
local install_script="${TELEGRAM_BOT_DIR}/scripts/install.sh"
|
||||
|
||||
### read PKGLIST from official install-script
|
||||
@@ -121,21 +121,11 @@ function install_telegram_bot_dependencies() {
|
||||
echo "${cyan}${packages}${white}" | tr '[:space:]' '\n'
|
||||
read -r -a packages <<< "${packages}"
|
||||
|
||||
### Update system package info
|
||||
status_msg "Updating package lists..."
|
||||
if ! sudo apt-get update --allow-releaseinfo-change; then
|
||||
log_error "failure while updating package lists"
|
||||
error_msg "Updating package lists failed!"
|
||||
exit 1
|
||||
fi
|
||||
### Update system package lists if stale
|
||||
update_system_package_lists
|
||||
|
||||
### Install required packages
|
||||
status_msg "Installing required packages..."
|
||||
if ! sudo apt-get install --yes "${packages[@]}"; then
|
||||
log_error "failure while installing required moonraker-telegram-bot packages"
|
||||
error_msg "Installing required packages failed!"
|
||||
exit 1
|
||||
fi
|
||||
install_system_packages "${log_name}" "packages[@]"
|
||||
}
|
||||
|
||||
function create_telegram_bot_virtualenv() {
|
||||
@@ -328,11 +318,11 @@ function write_telegram_bot_service() {
|
||||
else
|
||||
sudo sed -i "s|%INST%|${i}|" "${service}"
|
||||
fi
|
||||
sudo sed -i "s|%USER%|${USER}|g; s|%ENV%|${TELEGRAM_BOT_ENV}|; s|%ENV_FILE%|${env_file}|" "${service}"
|
||||
sudo sed -i "s|%USER%|${USER}|g; s|%TELEGRAM_BOT_DIR%|${TELEGRAM_BOT_DIR}|; s|%ENV%|${TELEGRAM_BOT_ENV}|; s|%ENV_FILE%|${env_file}|" "${service}"
|
||||
|
||||
status_msg "Creating environment file for instance ${i} ..."
|
||||
cp "${env_template}" "${env_file}"
|
||||
sed -i "s|%USER%|${USER}|; s|%CFG%|${cfg}|; s|%LOG%|${log}|" "${env_file}"
|
||||
sed -i "s|%USER%|${USER}|; s|%TELEGRAM_BOT_DIR%|${TELEGRAM_BOT_DIR}|; s|%CFG%|${cfg}|; s|%LOG%|${log}|" "${env_file}"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/th33xitus/kiauh #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
# #
|
||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||
#=======================================================================#
|
||||
@@ -141,7 +141,7 @@ function moonraker_setup_dialog() {
|
||||
}
|
||||
|
||||
function install_moonraker_dependencies() {
|
||||
local packages
|
||||
local packages log_name="Moonraker"
|
||||
local install_script="${MOONRAKER_DIR}/scripts/install-moonraker.sh"
|
||||
|
||||
### read PKGLIST from official install-script
|
||||
@@ -152,21 +152,11 @@ function install_moonraker_dependencies() {
|
||||
echo "${cyan}${packages}${white}" | tr '[:space:]' '\n'
|
||||
read -r -a packages <<< "${packages}"
|
||||
|
||||
### Update system package info
|
||||
status_msg "Updating package lists..."
|
||||
if ! sudo apt-get update --allow-releaseinfo-change; then
|
||||
log_error "failure while updating package lists"
|
||||
error_msg "Updating package lists failed!"
|
||||
exit 1
|
||||
fi
|
||||
### Update system package lists if stale
|
||||
update_system_package_lists
|
||||
|
||||
### Install required packages
|
||||
status_msg "Installing required packages..."
|
||||
if ! sudo apt-get install --yes "${packages[@]}"; then
|
||||
log_error "failure while installing required moonraker packages"
|
||||
error_msg "Installing required packages failed!"
|
||||
exit 1
|
||||
fi
|
||||
install_system_packages "${log_name}" "packages[@]"
|
||||
}
|
||||
|
||||
function create_moonraker_virtualenv() {
|
||||
@@ -370,8 +360,8 @@ function write_moonraker_service() {
|
||||
|
||||
[[ -z ${i} ]] && sudo sed -i "s| %INST%||" "${service}"
|
||||
[[ -n ${i} ]] && sudo sed -i "s|%INST%|${i}|" "${service}"
|
||||
sudo sed -i "s|%USER%|${USER}|g; s|%ENV%|${MOONRAKER_ENV}|; s|%ENV_FILE%|${env_file}|" "${service}"
|
||||
sudo sed -i "s|%USER%|${USER}|; s|%PRINTER_DATA%|${printer_data}|" "${env_file}"
|
||||
sudo sed -i "s|%USER%|${USER}|g; s|%MOONRAKER_DIR%|${MOONRAKER_DIR}|; s|%ENV%|${MOONRAKER_ENV}|; s|%ENV_FILE%|${env_file}|" "${service}"
|
||||
sudo sed -i "s|%USER%|${USER}|; s|%MOONRAKER_DIR%|${MOONRAKER_DIR}|; s|%PRINTER_DATA%|${printer_data}|" "${env_file}"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/th33xitus/kiauh #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
# #
|
||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||
#=======================================================================#
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/th33xitus/kiauh #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
# #
|
||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||
#=======================================================================#
|
||||
@@ -63,7 +63,7 @@ function obico_server_url_prompt() {
|
||||
}
|
||||
|
||||
function moonraker_obico_setup_dialog() {
|
||||
status_msg "Initializing Moonraker-obico installation ..."
|
||||
status_msg "Initializing Obico installation ..."
|
||||
|
||||
local moonraker_count
|
||||
local moonraker_names
|
||||
@@ -73,7 +73,7 @@ function moonraker_obico_setup_dialog() {
|
||||
if (( moonraker_count == 0 )); then
|
||||
### return early if moonraker is not installed
|
||||
local error="Moonraker not installed! Please install Moonraker first!"
|
||||
log_error "Moonraker-obico setup started without Moonraker being installed. Aborting setup."
|
||||
log_error "Obico setup started without Moonraker being installed. Aborting setup."
|
||||
print_error "${error}" && return
|
||||
elif (( moonraker_count > 1 )); then
|
||||
# moonraker_names is valid only in case of multi-instance
|
||||
@@ -85,6 +85,32 @@ function moonraker_obico_setup_dialog() {
|
||||
moonraker_obico_services=$(moonraker_obico_systemd)
|
||||
existing_moonraker_obico_count=$(echo "${moonraker_obico_services}" | wc -w )
|
||||
local allowed_moonraker_obico_count=$(( moonraker_count - existing_moonraker_obico_count ))
|
||||
|
||||
# Allow user to reinstall an incomplete installation.
|
||||
if (( allowed_moonraker_obico_count == 0 && moonraker_count > 0 )) && [[ $(get_moonraker_obico_status) != "Not linked!" ]]; then
|
||||
local yn
|
||||
while true; do
|
||||
echo "${yellow}Obico is already installed.${white}"
|
||||
echo "It is safe to run the install again to repair any issues."
|
||||
echo ""
|
||||
local question="Do you want to reinstall Obico?"
|
||||
read -p "${cyan}###### ${question} (Y/n):${white} " yn
|
||||
case "${yn}" in
|
||||
Y|y|Yes|yes|"")
|
||||
select_msg "Yes"
|
||||
break;;
|
||||
N|n|No|no)
|
||||
select_msg "No"
|
||||
abort_msg "Exiting Obico installation...\n"
|
||||
return;;
|
||||
*)
|
||||
error_msg "Invalid Input!";;
|
||||
esac
|
||||
done
|
||||
# The user responded yes, allow the install to run again.
|
||||
allowed_moonraker_obico_count=1
|
||||
fi
|
||||
|
||||
if (( allowed_moonraker_obico_count > 0 )); then
|
||||
local new_moonraker_obico_count
|
||||
|
||||
@@ -100,31 +126,30 @@ function moonraker_obico_setup_dialog() {
|
||||
done
|
||||
blank_line
|
||||
if (( existing_moonraker_obico_count > 0 )); then
|
||||
printf "|${green}%-55s${white}|\n" " ${existing_moonraker_obico_count} Moonraker-obico instances already installed!"
|
||||
printf "|${green}%-55s${white}|\n" " ${existing_moonraker_obico_count} Obico instances already installed!"
|
||||
for svc in ${moonraker_obico_services}; do
|
||||
printf "|${cyan}%-57s${white}|\n" " ● moonraker-obco-$(get_instance_name "${svc}")"
|
||||
done
|
||||
fi
|
||||
blank_line
|
||||
echo -e "| The setup will apply the same names to |"
|
||||
echo -e "| Moonraker-obico! |"
|
||||
echo -e "| The setup will apply the same names to Obico! |"
|
||||
blank_line
|
||||
echo -e "| Please select the number of Moonraker-obico instances |"
|
||||
echo -e "| to install. Usually one Moonraker-obico instance per |"
|
||||
echo -e "| Please select the number of Obico instances |"
|
||||
echo -e "| to install. Usually one Obico instance per |"
|
||||
echo -e "| Moonraker instance is required, but you may not |"
|
||||
echo -e "| install more Moonraker-obico instances than available |"
|
||||
echo -e "| install more Obico instances than available |"
|
||||
echo -e "| Moonraker instances. |"
|
||||
bottom_border
|
||||
|
||||
### ask for amount of instances
|
||||
local re="^[1-9][0-9]*$"
|
||||
while [[ ! ${new_moonraker_obico_count} =~ ${re} || ${new_moonraker_obico_count} -gt ${allowed_moonraker_obico_count} ]]; do
|
||||
read -p "${cyan}###### Number of new Moonraker-obico instances to set up:${white} " -i "${allowed_moonraker_obico_count}" -e new_moonraker_obico_count
|
||||
read -p "${cyan}###### Number of new Obico instances to set up:${white} " -i "${allowed_moonraker_obico_count}" -e new_moonraker_obico_count
|
||||
### break if input is valid
|
||||
[[ ${new_moonraker_obico_count} =~ ${re} && ${new_moonraker_obico_count} -le ${allowed_moonraker_obico_count} ]] && break
|
||||
### conditional error messages
|
||||
[[ ! ${new_moonraker_obico_count} =~ ${re} ]] && error_msg "Input not a number"
|
||||
(( new_moonraker_obico_count > allowed_moonraker_obico_count )) && error_msg "Number of Moonraker-obico instances larger than installed Moonraker instances"
|
||||
(( new_moonraker_obico_count > allowed_moonraker_obico_count )) && error_msg "Number of Obico instances larger than installed Moonraker instances"
|
||||
done && select_msg "${new_moonraker_obico_count}"
|
||||
else
|
||||
log_error "Internal error. moonraker_count of '${moonraker_count}' not equal or grather than one!"
|
||||
@@ -134,8 +159,8 @@ function moonraker_obico_setup_dialog() {
|
||||
### Step 2: Confirm instance amount
|
||||
local yn
|
||||
while true; do
|
||||
(( new_moonraker_obico_count == 1 )) && local question="Install Moonraker-obico?"
|
||||
(( new_moonraker_obico_count > 1 )) && local question="Install ${new_moonraker_obico_count} Moonraker-obico instances?"
|
||||
(( new_moonraker_obico_count == 1 )) && local question="Install Obico?"
|
||||
(( new_moonraker_obico_count > 1 )) && local question="Install ${new_moonraker_obico_count} Obico instances?"
|
||||
read -p "${cyan}###### ${question} (Y/n):${white} " yn
|
||||
case "${yn}" in
|
||||
Y|y|Yes|yes|"")
|
||||
@@ -143,7 +168,7 @@ function moonraker_obico_setup_dialog() {
|
||||
break;;
|
||||
N|n|No|no)
|
||||
select_msg "No"
|
||||
abort_msg "Exiting Moonraker-obico setup ...\n"
|
||||
abort_msg "Exiting Obico setup ...\n"
|
||||
return;;
|
||||
*)
|
||||
error_msg "Invalid Input!";;
|
||||
@@ -165,12 +190,8 @@ function moonraker_obico_setup_dialog() {
|
||||
fi
|
||||
done
|
||||
|
||||
(( new_moonraker_obico_count > 1 )) && status_msg "Installing ${new_moonraker_obico_count} Moonraker-obico instances ..."
|
||||
(( new_moonraker_obico_count == 1 )) && status_msg "Installing Moonraker-obico ..."
|
||||
|
||||
### Step 4: Install dependencies
|
||||
local dep=(git dfu-util virtualenv python3 python3-pip python3-venv ffmpeg)
|
||||
dependency_check "${dep[@]}"
|
||||
(( new_moonraker_obico_count > 1 )) && status_msg "Installing ${new_moonraker_obico_count} Obico instances ..."
|
||||
(( new_moonraker_obico_count == 1 )) && status_msg "Installing Obico ..."
|
||||
|
||||
### Step 5: Clone the moonraker-obico repo
|
||||
clone_moonraker_obico "${MOONRAKER_OBICO_REPO}"
|
||||
@@ -222,17 +243,16 @@ function moonraker_obico_setup_dialog() {
|
||||
if (( ${#not_linked_instances[@]} > 0 )); then
|
||||
top_border
|
||||
if (( moonraker_count == 1 )); then
|
||||
printf "|${green}%-55s${white}|\n" " Moonraker-obico not linked to the server!"
|
||||
printf "|${green}%-55s${white}|\n" " Obico not linked to the server!"
|
||||
else
|
||||
printf "|${green}%-55s${white}|\n" " ${#not_linked_instances[@]} Moonraker-obico instances not linked to the server!"
|
||||
printf "|${green}%-55s${white}|\n" " ${#not_linked_instances[@]} Obico instances not linked to the server!"
|
||||
for i in "${not_linked_instances[@]}"; do
|
||||
printf "|${cyan}%-57s${white}|\n" " ● moonraker-obico-${moonraker_names[${i}]}"
|
||||
done
|
||||
fi
|
||||
blank_line
|
||||
echo -e "| To link to your Obico Server account, you need to |"
|
||||
echo -e "| obtain the 6-digit verification code in the Obico |"
|
||||
echo -e "| mobile or web app. For more information, visit: |"
|
||||
echo -e "| It will take only 10 seconds to link printer to Obico.|"
|
||||
echo -e "| For more information, visit: |"
|
||||
echo -e "| https://www.obico.io/docs/user-guides/klipper-setup/ |"
|
||||
blank_line
|
||||
echo -e "| If you don't want to link the printer now, you can |"
|
||||
@@ -250,7 +270,7 @@ function moonraker_obico_setup_dialog() {
|
||||
break;;
|
||||
N|n|No|no)
|
||||
select_msg "No"
|
||||
abort_msg "Exiting Moonraker-obico setup ...\n"
|
||||
abort_msg "Exiting Obico setup ...\n"
|
||||
return;;
|
||||
*)
|
||||
error_msg "Invalid Input!";;
|
||||
@@ -273,13 +293,13 @@ function moonraker_obico_setup_dialog() {
|
||||
function clone_moonraker_obico() {
|
||||
local repo=${1}
|
||||
|
||||
status_msg "Cloning Moonraker-obico from ${repo} ..."
|
||||
### force remove existing Moonraker-obico dir
|
||||
status_msg "Cloning Obico from ${repo} ..."
|
||||
### force remove existing Obico dir
|
||||
[[ -d "${MOONRAKER_OBICO_DIR}" ]] && rm -rf "${MOONRAKER_OBICO_DIR}"
|
||||
|
||||
cd "${HOME}" || exit 1
|
||||
if ! git clone "${repo}" "${MOONRAKER_OBICO_DIR}"; then
|
||||
print_error "Cloning Moonraker-obico from\n ${repo}\n failed!"
|
||||
print_error "Cloning Obico from\n ${repo}\n failed!"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
@@ -294,7 +314,7 @@ function moonraker_obico_install() {
|
||||
|
||||
function remove_moonraker_obico_systemd() {
|
||||
[[ -z $(moonraker_obico_systemd) ]] && return
|
||||
status_msg "Removing Moonraker-obico Systemd Services ..."
|
||||
status_msg "Removing Obico Systemd Services ..."
|
||||
|
||||
for service in $(moonraker_obico_systemd | cut -d"/" -f5); do
|
||||
status_msg "Removing ${service} ..."
|
||||
@@ -307,7 +327,7 @@ function remove_moonraker_obico_systemd() {
|
||||
### reloading units
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl reset-failed
|
||||
ok_msg "Moonraker-obico Services removed!"
|
||||
ok_msg "Obico Services removed!"
|
||||
}
|
||||
|
||||
function remove_moonraker_obico_logs() {
|
||||
@@ -339,7 +359,7 @@ function remove_legacy_moonraker_obico_logs() {
|
||||
function remove_moonraker_obico_dir() {
|
||||
[[ ! -d ${MOONRAKER_OBICO_DIR} ]] && return
|
||||
|
||||
status_msg "Removing Moonraker-obico directory ..."
|
||||
status_msg "Removing Obico directory ..."
|
||||
rm -rf "${MOONRAKER_OBICO_DIR}"
|
||||
ok_msg "Directory removed!"
|
||||
}
|
||||
@@ -358,7 +378,7 @@ function remove_moonraker_obico() {
|
||||
remove_moonraker_obico_dir
|
||||
remove_moonraker_obico_env
|
||||
|
||||
print_confirm "Moonraker-obico was successfully removed!"
|
||||
print_confirm "Obico was successfully removed!"
|
||||
return
|
||||
}
|
||||
|
||||
@@ -372,10 +392,12 @@ function update_moonraker_obico() {
|
||||
if [[ ! -d ${MOONRAKER_OBICO_DIR} ]]; then
|
||||
clone_moonraker_obico "${MOONRAKER_OBICO_REPO}"
|
||||
else
|
||||
status_msg "Updating Moonraker-obico ..."
|
||||
status_msg "Updating Obico ..."
|
||||
cd "${MOONRAKER_OBICO_DIR}" && git pull
|
||||
fi
|
||||
|
||||
"${MOONRAKER_OBICO_DIR}/install.sh" -U
|
||||
|
||||
ok_msg "Update complete!"
|
||||
do_action_service "restart" "moonraker-obico"
|
||||
}
|
||||
|
||||
369
scripts/octoapp.sh
Normal file
369
scripts/octoapp.sh
Normal file
@@ -0,0 +1,369 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
# #
|
||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||
#=======================================================================#
|
||||
|
||||
#
|
||||
# This file is written and maintained by Christian Würthner from OctoApp
|
||||
# Please contact me if you need any help!
|
||||
# hello@octoapp.eu
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
#===================================================#
|
||||
#============== Install ============#
|
||||
#===================================================#
|
||||
|
||||
function octoapp_systemd() {
|
||||
local services
|
||||
services=$(find "${SYSTEMD}" -maxdepth 1 -regextype posix-extended -regex "${SYSTEMD}/octoapp(-[0-9a-zA-Z]+)?.service")
|
||||
echo "${services}"
|
||||
}
|
||||
|
||||
function octoapp_setup_dialog() {
|
||||
status_msg "Initializing OctoApp for Klipper installation ..."
|
||||
|
||||
# First, check for moonraker service instances.
|
||||
local moonraker_count
|
||||
local moonraker_names
|
||||
moonraker_count=$(moonraker_systemd | wc -w)
|
||||
if (( moonraker_count == 0 )); then
|
||||
### return early if moonraker is not installed
|
||||
local error="Moonraker not installed! Please install Moonraker first!"
|
||||
log_error "OctoApp setup started without Moonraker being installed. Aborting setup."
|
||||
print_error "${error}" && return
|
||||
elif (( moonraker_count > 1 )); then
|
||||
# moonraker_names is valid only in case of multi-instance
|
||||
read -r -a moonraker_names <<< "$(get_multi_instance_names)"
|
||||
fi
|
||||
|
||||
# Next, check for any existing OctoApp services.
|
||||
local octoapp_services
|
||||
local existing_octoapp_count
|
||||
octoapp_services=$(octoapp_systemd)
|
||||
existing_octoapp_count=$(echo "${octoapp_services}" | wc -w )
|
||||
|
||||
# We need to make the moonraker instance count to the OctoApp service count.
|
||||
local allowed_octoapp_count=$(( moonraker_count - existing_octoapp_count ))
|
||||
if (( allowed_octoapp_count > 0 )); then
|
||||
local new_octoapp_count
|
||||
|
||||
### Step 1: Ask for the number of OctoApp instances to install
|
||||
if (( moonraker_count == 1 )); then
|
||||
ok_msg "Moonraker installation found!\n"
|
||||
new_octoapp_count=1
|
||||
elif (( moonraker_count > 1 )); then
|
||||
top_border
|
||||
printf "|${green}%-55s${white}|\n" " ${moonraker_count} Moonraker instances found!"
|
||||
for name in "${moonraker_names[@]}"; do
|
||||
printf "|${cyan}%-57s${white}|\n" " ● moonraker-${name}"
|
||||
done
|
||||
blank_line
|
||||
if (( existing_octoapp_count > 0 )); then
|
||||
printf "|${green}%-55s${white}|\n" " ${existing_octoapp_count} OctoApp instances already installed!"
|
||||
for svc in ${octoapp_services}; do
|
||||
printf "|${cyan}%-57s${white}|\n" " ● octoapp-$(get_instance_name "${svc}")"
|
||||
done
|
||||
fi
|
||||
blank_line
|
||||
echo -e "| The setup will apply the same names to OctoApp |"
|
||||
blank_line
|
||||
echo -e "| Please select the number of OctoApp instances to |"
|
||||
echo -e "| install. Usually one OctoApp instance per Moonraker |"
|
||||
echo -e "| instance is required, but you may not install more |"
|
||||
echo -e "| OctoApp instances than available Moonraker instances. |"
|
||||
bottom_border
|
||||
|
||||
### ask for amount of instances
|
||||
local re="^[1-9][0-9]*$"
|
||||
while [[ ! ${new_octoapp_count} =~ ${re} || ${new_octoapp_count} -gt ${allowed_octoapp_count} ]]; do
|
||||
read -p "${cyan}###### Number of new OctoApp instances to set up:${white} " -i "${allowed_octoapp_count}" -e new_octoapp_count
|
||||
### break if input is valid
|
||||
[[ ${new_octoapp_count} =~ ${re} && ${new_octoapp_count} -le ${allowed_octoapp_count} ]] && break
|
||||
### conditional error messages
|
||||
[[ ! ${new_octoapp_count} =~ ${re} ]] && error_msg "Input not a number"
|
||||
(( new_octoapp_count > allowed_octoapp_count )) && error_msg "Number of OctoApp instances larger than installed Moonraker instances"
|
||||
done && select_msg "${new_octoapp_count}"
|
||||
else
|
||||
log_error "Internal error. moonraker_count of '${moonraker_count}' not equal or grater than one!"
|
||||
return 1
|
||||
fi # (( moonraker_count == 1 ))
|
||||
fi # (( allowed_octoapp_count > 0 ))
|
||||
|
||||
# Special case for one moonraker instance with OctoApp already installed.
|
||||
# If the user selects the install option again, they might be trying to recover the install
|
||||
# or complete a printer link they didn't finish in the past.
|
||||
# So in this case, we will allow them to run the install script again, since it's safe to run
|
||||
# if the service is already installed, it will repair any missing issues.
|
||||
if (( allowed_octoapp_count == 0 && moonraker_count == 1 )); then
|
||||
local yn
|
||||
while true; do
|
||||
echo "${yellow}OctoApp is already installed.${white}"
|
||||
echo "It is safe to run the install again to repair any issues or if the printer isn't linked, run the printer linking logic again."
|
||||
echo ""
|
||||
local question="Do you want to run the OctoApp recovery or linking logic again?"
|
||||
read -p "${cyan}###### ${question} (Y/n):${white} " yn
|
||||
case "${yn}" in
|
||||
Y|y|Yes|yes|"")
|
||||
select_msg "Yes"
|
||||
break;;
|
||||
N|n|No|no)
|
||||
select_msg "No"
|
||||
abort_msg "Exiting OctoApp setup ...\n"
|
||||
return;;
|
||||
*)
|
||||
error_msg "Invalid Input!";;
|
||||
esac
|
||||
done
|
||||
# The user responded yes, allow the install to run again.
|
||||
allowed_octoapp_count=1
|
||||
fi
|
||||
|
||||
# If there's something to install, do it!
|
||||
if (( allowed_octoapp_count > 0 )); then
|
||||
|
||||
(( new_octoapp_count > 1 )) && status_msg "Installing ${new_octoapp_count} OctoApp instances ..."
|
||||
(( new_octoapp_count == 1 )) && status_msg "Installing OctoApp ..."
|
||||
|
||||
# Ensure the basic system dependencies are installed.
|
||||
local dep=(git dfu-util virtualenv python3 python3-pip python3-venv)
|
||||
dependency_check "${dep[@]}"
|
||||
|
||||
# Close the repo
|
||||
clone_octoapp "${OCTOAPP_REPO}"
|
||||
|
||||
# Call install with the correct args.
|
||||
local instance_cfg_dirs
|
||||
read -r -a instance_cfg_dirs <<< "$(get_instance_folder_path "config")"
|
||||
echo instance_cfg_dirs[0]
|
||||
|
||||
if (( moonraker_count == 1 )); then
|
||||
"${OCTOAPP_DIR}/install.sh" "${instance_cfg_dirs[0]}/moonraker.conf"
|
||||
elif (( moonraker_count > 1 )); then
|
||||
local j=${existing_octoapp_count}
|
||||
|
||||
for (( i=1; i <= new_octoapp_count; i++ )); do
|
||||
"${OCTOAPP_DIR}/install.sh" "${instance_cfg_dirs[${j}]}/moonraker.conf"
|
||||
j=$(( j + 1 ))
|
||||
done && unset j
|
||||
fi # (( moonraker_count == 1 ))
|
||||
fi # (( allowed_octoapp_count > 0 ))
|
||||
}
|
||||
|
||||
function octoapp_install() {
|
||||
"${OCTOAPP_DIR}/install.sh" "$@"
|
||||
}
|
||||
|
||||
#===================================================#
|
||||
#============= Remove ==============#
|
||||
#===================================================#
|
||||
|
||||
function remove_octoapp_systemd() {
|
||||
[[ -z $(octoapp_systemd) ]] && return
|
||||
status_msg "Removing OctoApp Systemd Services ..."
|
||||
|
||||
for service in $(octoapp_systemd | cut -d"/" -f5); do
|
||||
status_msg "Removing ${service} ..."
|
||||
sudo systemctl stop "${service}"
|
||||
sudo systemctl disable "${service}"
|
||||
sudo rm -f "${SYSTEMD}/${service}"
|
||||
ok_msg "Done!"
|
||||
done
|
||||
|
||||
### reloading units
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl reset-failed
|
||||
ok_msg "OctoApp Services removed!"
|
||||
}
|
||||
|
||||
function remove_octoapp_logs() {
|
||||
local files regex="${HOME//\//\\/}\/([A-Za-z0-9_]+)\/logs\/octoapp(-[0-9a-zA-Z]+)?\.log(.*)?"
|
||||
files=$(find "${HOME}" -maxdepth 3 -regextype posix-extended -regex "${regex}" | sort)
|
||||
|
||||
if [[ -n ${files} ]]; then
|
||||
for file in ${files}; do
|
||||
status_msg "Removing ${file} ..."
|
||||
rm -f "${file}"
|
||||
ok_msg "${file} removed!"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
function remove_octoapp_dir() {
|
||||
[[ ! -d ${OCTOAPP_DIR} ]] && return
|
||||
|
||||
status_msg "Removing OctoApp directory ..."
|
||||
rm -rf "${OCTOAPP_DIR}"
|
||||
ok_msg "Directory removed!"
|
||||
}
|
||||
|
||||
function remove_octoapp_config() {
|
||||
# Remove the system config but not the main config, so the printer id doesn't get lost.
|
||||
local files regex="${HOME//\//\\/}\/([A-Za-z0-9_]+)\/config\/octoapp-system(-[0-9a-zA-Z]+)?\.cfg(.*)?"
|
||||
files=$(find "${HOME}" -maxdepth 4 -regextype posix-extended -regex "${regex}" | sort)
|
||||
|
||||
if [[ -n ${files} ]]; then
|
||||
for file in ${files}; do
|
||||
status_msg "Removing ${file} ..."
|
||||
rm -f "${file}"
|
||||
ok_msg "${file} removed!"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
function remove_octoapp_store_dir() {
|
||||
local files regex="${HOME//\//\\/}\/([A-Za-z0-9_]+)\/octoapp-store"
|
||||
files=$(find "${HOME}" -maxdepth 2 -type d -regextype posix-extended -regex "${regex}" | sort)
|
||||
|
||||
if [[ -n ${files} ]]; then
|
||||
for file in ${files}; do
|
||||
status_msg "Removing ${file} ..."
|
||||
rm -rf "${file}"
|
||||
ok_msg "${file} removed!"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
function remove_octoapp_env() {
|
||||
[[ ! -d "${HOME}/octoapp-env" ]] && return
|
||||
|
||||
status_msg "Removing octoapp-env directory ..."
|
||||
rm -rf "${HOME}/octoapp-env"
|
||||
ok_msg "Directory removed!"
|
||||
}
|
||||
|
||||
function remove_octoapp()
|
||||
{
|
||||
remove_octoapp_systemd
|
||||
remove_octoapp_logs
|
||||
remove_octoapp_dir
|
||||
remove_octoapp_env
|
||||
remove_octoapp_config
|
||||
remove_octoapp_store_dir
|
||||
|
||||
print_confirm "OctoApp was successfully removed!"
|
||||
return
|
||||
}
|
||||
|
||||
#===================================================#
|
||||
#============= UPDATE ==============#
|
||||
#===================================================#
|
||||
|
||||
function update_octoapp() {
|
||||
do_action_service "stop" "octoapp"
|
||||
|
||||
if [[ ! -d ${OCTOAPP_DIR} ]]; then
|
||||
clone_octoapp "${OCTOAPP_REPO}"
|
||||
else
|
||||
backup_before_update "octoapp"
|
||||
status_msg "Updating OctoApp for Klipper ..."
|
||||
cd "${OCTOAPP_DIR}" && git pull
|
||||
### read PKGLIST and install possible new dependencies
|
||||
install_octoapp_dependencies
|
||||
### install possible new python dependencies
|
||||
"${OCTOAPP_ENV}"/bin/pip install -r "${OCTOAPP_DIR}/requirements.txt"
|
||||
fi
|
||||
|
||||
ok_msg "Update complete!"
|
||||
do_action_service "restart" "octoapp"
|
||||
}
|
||||
|
||||
function clone_octoapp() {
|
||||
local repo=${1}
|
||||
|
||||
status_msg "Cloning OctoApp from ${repo} ..."
|
||||
|
||||
### force remove existing octoapp dir and clone into fresh octoapp dir
|
||||
[[ -d ${OCTOAPP_DIR} ]] && rm -rf "${OCTOAPP_DIR}"
|
||||
|
||||
cd "${HOME}" || exit 1
|
||||
if ! git clone "${OCTOAPP_REPO}" "${OCTOAPP_DIR}"; then
|
||||
print_error "Cloning OctoApp from\n ${repo}\n failed!"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function install_octoapp_dependencies() {
|
||||
local packages log_name="OctoApp"
|
||||
local install_script="${OCTOAPP_DIR}/install.sh"
|
||||
|
||||
### read PKGLIST from official install-script
|
||||
status_msg "Reading dependencies..."
|
||||
# shellcheck disable=SC2016
|
||||
packages="$(grep "PKGLIST=" "${install_script}" | cut -d'"' -f2 | sed 's/\${PKGLIST}//g' | tr -d '\n')"
|
||||
|
||||
echo "${cyan}${packages}${white}" | tr '[:space:]' '\n'
|
||||
read -r -a packages <<< "${packages}"
|
||||
|
||||
### Update system package lists if stale
|
||||
update_system_package_lists
|
||||
|
||||
### Install required packages
|
||||
install_system_packages "${log_name}" "packages[@]"
|
||||
}
|
||||
|
||||
#===================================================#
|
||||
#============= STATUS ==============#
|
||||
#===================================================#
|
||||
|
||||
function get_octoapp_status() {
|
||||
local status
|
||||
local service_count
|
||||
local octoapp_services
|
||||
|
||||
octoapp_services=$(octoapp_systemd)
|
||||
service_count=$(echo "${octoapp_services}" | wc -w )
|
||||
|
||||
if (( service_count == 0 )); then
|
||||
status="Not installed!"
|
||||
elif [[ ! -d "${OCTOAPP_DIR}" ]]; then
|
||||
status="Incomplete!"
|
||||
else
|
||||
status="Installed!"
|
||||
fi
|
||||
|
||||
echo "${status}"
|
||||
}
|
||||
|
||||
function get_local_octoapp_commit() {
|
||||
[[ ! -d ${OCTOAPP_DIR} || ! -d "${OCTOAPP_DIR}/.git" ]] && return
|
||||
|
||||
local commit
|
||||
cd "${OCTOAPP_DIR}"
|
||||
commit="$(git describe HEAD --always --tags | cut -d "-" -f 1,2)"
|
||||
echo "${commit}"
|
||||
}
|
||||
|
||||
function get_remote_octoapp_commit() {
|
||||
[[ ! -d ${OCTOAPP_DIR} || ! -d "${OCTOAPP_DIR}/.git" ]] && return
|
||||
|
||||
local commit
|
||||
cd "${OCTOAPP_DIR}" && git fetch origin -q
|
||||
commit=$(git describe origin/release --always --tags | cut -d "-" -f 1,2)
|
||||
echo "${commit}"
|
||||
}
|
||||
|
||||
function compare_octoapp_versions() {
|
||||
local versions local_ver remote_ver
|
||||
local_ver="$(get_local_octoapp_commit)"
|
||||
remote_ver="$(get_remote_octoapp_commit)"
|
||||
|
||||
if [[ ${local_ver} != "${remote_ver}" ]]; then
|
||||
versions="${yellow}$(printf " %-14s" "${local_ver}")${white}"
|
||||
versions+="|${green}$(printf " %-13s" "${remote_ver}")${white}"
|
||||
# Add us to the update file, so if the user selects "update all" it includes us.
|
||||
add_to_application_updates "octoapp"
|
||||
else
|
||||
versions="${green}$(printf " %-14s" "${local_ver}")${white}"
|
||||
versions+="|${green}$(printf " %-13s" "${remote_ver}")${white}"
|
||||
fi
|
||||
|
||||
echo "${versions}"
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/th33xitus/kiauh #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
# #
|
||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||
#=======================================================================#
|
||||
@@ -307,7 +307,7 @@ function clone_octoeverywhere() {
|
||||
}
|
||||
|
||||
function install_octoeverywhere_dependencies() {
|
||||
local packages
|
||||
local packages log_name="OctoEverywhere"
|
||||
local install_script="${OCTOEVERYWHERE_DIR}/install.sh"
|
||||
|
||||
### read PKGLIST from official install-script
|
||||
@@ -318,21 +318,11 @@ function install_octoeverywhere_dependencies() {
|
||||
echo "${cyan}${packages}${white}" | tr '[:space:]' '\n'
|
||||
read -r -a packages <<< "${packages}"
|
||||
|
||||
### Update system package info
|
||||
status_msg "Updating package lists..."
|
||||
if ! sudo apt-get update --allow-releaseinfo-change; then
|
||||
log_error "failure while updating package lists"
|
||||
error_msg "Updating package lists failed!"
|
||||
exit 1
|
||||
fi
|
||||
### Update system package lists if stale
|
||||
update_system_package_lists
|
||||
|
||||
### Install required packages
|
||||
status_msg "Installing required packages..."
|
||||
if ! sudo apt-get install --yes "${packages[@]}"; then
|
||||
log_error "failure while installing required octoeverywhere packages"
|
||||
error_msg "Installing required packages failed!"
|
||||
exit 1
|
||||
fi
|
||||
install_system_packages "${log_name}" "packages[@]"
|
||||
}
|
||||
|
||||
#===================================================#
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/th33xitus/kiauh #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
# #
|
||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||
#=======================================================================#
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/th33xitus/kiauh #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
# #
|
||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||
#=======================================================================#
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/th33xitus/kiauh #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
# #
|
||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||
#=======================================================================#
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/th33xitus/kiauh #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
# #
|
||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||
#=======================================================================#
|
||||
@@ -77,10 +77,12 @@ function change_klipper_repo_menu() {
|
||||
error_msg "Invalid command!";;
|
||||
esac
|
||||
done
|
||||
break
|
||||
else
|
||||
status_msg "Set custom Klipper repository to:\n ● Repository: ${repos[${option}]}\n ● Branch: ${branches[${option}]}"
|
||||
set_custom_klipper_repo "${repos[${option}]}" "${branches[${option}]}"
|
||||
ok_msg "This repo will now be used for new Klipper installations!\n"
|
||||
break
|
||||
fi
|
||||
|
||||
elif [[ ${option} =~ ${back} ]]; then
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/th33xitus/kiauh #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
# #
|
||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||
#=======================================================================#
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/th33xitus/kiauh #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
# #
|
||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||
#=======================================================================#
|
||||
@@ -20,12 +20,12 @@ function backup_ui() {
|
||||
echo -e "| Klipper & API: | Touchscreen GUI: |"
|
||||
echo -e "| 1) [Klipper] | 7) [KlipperScreen] |"
|
||||
echo -e "| 2) [Moonraker] | |"
|
||||
echo -e "| 3) [Configuration Folder] | 3rd Party Webinterface: |"
|
||||
echo -e "| 3) [Config Folder] | 3rd Party Webinterface: |"
|
||||
echo -e "| 4) [Moonraker Database] | 8) [OctoPrint] |"
|
||||
echo -e "| | |"
|
||||
echo -e "| Klipper Webinterface: | Other: |"
|
||||
echo -e "| 5) [Mainsail] | 9) [Telegram Bot] |"
|
||||
echo -e "| 6) [Fluidd] | |"
|
||||
echo -e "| 6) [Fluidd] | 10) [OctoEverywhere] |"
|
||||
back_footer
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ function backup_menu() {
|
||||
2)
|
||||
do_action "backup_moonraker" "backup_ui";;
|
||||
3)
|
||||
do_action "backup_klipper_config_dir" "backup_ui";;
|
||||
do_action "backup_config_dir" "backup_ui";;
|
||||
4)
|
||||
do_action "backup_moonraker_database" "backup_ui";;
|
||||
5)
|
||||
@@ -54,6 +54,8 @@ function backup_menu() {
|
||||
do_action "backup_octoprint" "backup_ui";;
|
||||
9)
|
||||
do_action "backup_telegram_bot" "backup_ui";;
|
||||
10)
|
||||
do_action "backup_octoeverywhere" "backup_ui";;
|
||||
B|b)
|
||||
clear; main_menu; break;;
|
||||
*)
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/th33xitus/kiauh #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
# #
|
||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||
#=======================================================================#
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/th33xitus/kiauh #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
# #
|
||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||
#=======================================================================#
|
||||
@@ -27,14 +27,17 @@ function install_ui() {
|
||||
echo -e "| 3) [Mainsail] | 8) [Telegram Bot] |"
|
||||
echo -e "| 4) [Fluidd] | 9) $(obico_install_title) |"
|
||||
echo -e "| | 10) [OctoEverywhere] |"
|
||||
echo -e "| Touchscreen GUI: | |"
|
||||
echo -e "| 5) [KlipperScreen] | Webcam Streamer: |"
|
||||
echo -e "| | 11) [Crowsnest] |"
|
||||
echo -e "| | 11) [Mobileraker] |"
|
||||
echo -e "| Touchscreen GUI: | 12) [OctoApp for Klipper] |"
|
||||
echo -e "| 5) [KlipperScreen] | |"
|
||||
echo -e "| | Webcam Streamer: |"
|
||||
echo -e "| | 13) [Crowsnest] |"
|
||||
back_footer
|
||||
}
|
||||
|
||||
function install_menu() {
|
||||
clear && print_header
|
||||
clear -x && sudo true && clear -x # (re)cache sudo credentials so password prompt doesn't bork ui
|
||||
print_header
|
||||
install_ui
|
||||
|
||||
### save all installed webinterface ports to the ini file
|
||||
@@ -68,6 +71,10 @@ function install_menu() {
|
||||
10)
|
||||
do_action "octoeverywhere_setup_dialog" "install_ui";;
|
||||
11)
|
||||
do_action "install_mobileraker" "install_ui";;
|
||||
12)
|
||||
do_action "octoapp_setup_dialog" "install_ui";;
|
||||
13)
|
||||
do_action "install_crowsnest" "install_ui";;
|
||||
B|b)
|
||||
clear; main_menu; break;;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/th33xitus/kiauh #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
# #
|
||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||
#=======================================================================#
|
||||
@@ -12,10 +12,6 @@
|
||||
set -e
|
||||
|
||||
function main_ui() {
|
||||
echo -e "${yellow}/=======================================================\\"
|
||||
echo -e "| Please read the newest changelog carefully: |"
|
||||
echo -e "| https://git.io/JnmlX |"
|
||||
echo -e "\=======================================================/${white}"
|
||||
top_border
|
||||
echo -e "| $(title_msg "~~~~~~~~~~~~~~~ [ Main Menu ] ~~~~~~~~~~~~~~~") |"
|
||||
hr
|
||||
@@ -25,15 +21,18 @@ function main_ui() {
|
||||
echo -e "| 2) [Update] | Moonraker: $(print_status "moonraker")|"
|
||||
echo -e "| 3) [Remove] | |"
|
||||
echo -e "| 4) [Advanced] | Mainsail: $(print_status "mainsail")|"
|
||||
# echo -e "| 5) [Backup] | Fluidd: $(print_status "fluidd")|"
|
||||
echo -e "| | Fluidd: $(print_status "fluidd")|"
|
||||
echo -e "| 5) [Backup] | Fluidd: $(print_status "fluidd")|"
|
||||
echo -e "| | KlipperScreen: $(print_status "klipperscreen")|"
|
||||
echo -e "| 6) [Settings] | Telegram Bot: $(print_status "telegram_bot")|"
|
||||
echo -e "| | Crowsnest: $(print_status "crowsnest")|"
|
||||
echo -e "| | Obico: $(print_status "moonraker_obico")|"
|
||||
echo -e "| | OctoEverywhere: $(print_status "octoeverywhere")|"
|
||||
echo -e "| | Mobileraker: $(print_status "mobileraker")|"
|
||||
echo -e "| | OctoApp: $(print_status "octoapp")|"
|
||||
echo -e "| | |"
|
||||
echo -e "| $(print_kiauh_version)| Octoprint: $(print_status "octoprint")|"
|
||||
echo -e "| | Octoprint: $(print_status "octoprint")|"
|
||||
hr
|
||||
echo -e "| $(print_kiauh_version)| Changelog: ${magenta}https://git.io/JnmlX${white} |"
|
||||
quit_footer
|
||||
}
|
||||
|
||||
@@ -59,7 +58,7 @@ function print_status() {
|
||||
elif [[ ${status} == "Incomplete!" ]]; then
|
||||
status="${yellow}${status}${white}"
|
||||
elif [[ ${status} == "Not linked!" ]]; then
|
||||
### "Not linked!" is only required for Moonraker-obico
|
||||
### "Not linked!" is only required for Obico for Klipper
|
||||
status="${yellow}${status}${white}"
|
||||
else
|
||||
status="${green}${status}${white}"
|
||||
@@ -114,8 +113,7 @@ function main_menu() {
|
||||
"restart crowsnest") do_action_service "restart" "crowsnest"; main_ui;;
|
||||
update) do_action "update_kiauh" "main_ui";;
|
||||
0)clear && print_header
|
||||
#upload_selection
|
||||
print_error "Function currently disabled! Sorry!"
|
||||
upload_selection
|
||||
main_ui;;
|
||||
1)clear && print_header
|
||||
install_menu
|
||||
@@ -130,8 +128,7 @@ function main_menu() {
|
||||
advanced_menu
|
||||
break;;
|
||||
5)clear && print_header
|
||||
#backup_menu
|
||||
print_error "Function currently disabled! Sorry!"
|
||||
backup_menu
|
||||
main_ui;;
|
||||
6)clear && print_header
|
||||
settings_menu
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/th33xitus/kiauh #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
# #
|
||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||
#=======================================================================#
|
||||
@@ -29,7 +29,9 @@ function remove_ui() {
|
||||
echo -e "| | 12) [Telegram Bot] |"
|
||||
echo -e "| Touchscreen GUI: | 13) [Obico for Klipper] |"
|
||||
echo -e "| 7) [KlipperScreen] | 14) [OctoEverywhere] |"
|
||||
echo -e "| | 15) [NGINX] |"
|
||||
echo -e "| | 15) [Mobileraker] |"
|
||||
echo -e "| | 16) [NGINX] |"
|
||||
echo -e "| | 17) [OctoApp] |"
|
||||
back_footer
|
||||
}
|
||||
|
||||
@@ -69,7 +71,11 @@ function remove_menu() {
|
||||
14)
|
||||
do_action "remove_octoeverywhere" "remove_ui";;
|
||||
15)
|
||||
do_action "remove_mobileraker" "remove_ui";;
|
||||
16)
|
||||
do_action "remove_nginx" "remove_ui";;
|
||||
17)
|
||||
do_action "remove_octoapp" "remove_ui";;
|
||||
B|b)
|
||||
clear; main_menu; break;;
|
||||
*)
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/th33xitus/kiauh #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
# #
|
||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||
#=======================================================================#
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/th33xitus/kiauh #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
# #
|
||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||
#=======================================================================#
|
||||
@@ -33,13 +33,16 @@ function update_ui() {
|
||||
echo -e "| 7) [Telegram Bot] |$(compare_telegram_bot_versions)|"
|
||||
echo -e "| 8) [Obico for Klipper]|$(compare_moonraker_obico_versions)|"
|
||||
echo -e "| 9) [OctoEverywhere] |$(compare_octoeverywhere_versions)|"
|
||||
echo -e "| 10) [Crowsnest] |$(compare_crowsnest_versions)|"
|
||||
echo -e "| 10) [Mobileraker] |$(compare_mobileraker_versions)|"
|
||||
echo -e "| 11) [Crowsnest] |$(compare_crowsnest_versions)|"
|
||||
echo -e "| 12) [OctoApp] |$(compare_octoapp_versions)|"
|
||||
echo -e "| |------------------------------|"
|
||||
echo -e "| 11) [System] | $(check_system_updates) |"
|
||||
echo -e "| 13) [System] | $(check_system_updates) |"
|
||||
back_footer
|
||||
}
|
||||
|
||||
function update_menu() {
|
||||
clear -x && sudo true && clear -x # (re)cache sudo credentials so password prompt doesn't bork ui
|
||||
do_action "" "update_ui"
|
||||
|
||||
local action
|
||||
@@ -67,9 +70,13 @@ function update_menu() {
|
||||
9)
|
||||
do_action "update_octoeverywhere" "update_ui";;
|
||||
10)
|
||||
do_action "update_crowsnest" "update_ui";;
|
||||
do_action "update_mobileraker" "update_ui";;
|
||||
11)
|
||||
do_action "update_system" "update_ui";;
|
||||
do_action "update_crowsnest" "update_ui";;
|
||||
12)
|
||||
do_action "update_octoapp" "update_ui";;
|
||||
13)
|
||||
do_action "upgrade_system_packages" "update_ui";;
|
||||
a)
|
||||
do_action "update_all" "update_ui";;
|
||||
B|b)
|
||||
@@ -123,6 +130,12 @@ function update_all() {
|
||||
[[ "${update_arr[*]}" =~ "octoeverywhere" ]] && \
|
||||
echo -e "| ${cyan}● OctoEverywhere${white} |"
|
||||
|
||||
[[ "${update_arr[*]}" =~ "mobileraker" ]] && \
|
||||
echo -e "| ${cyan}● Mobileraker${white} |"
|
||||
|
||||
[[ "${update_arr[*]}" =~ "octoapp" ]] && \
|
||||
echo -e "| ${cyan}● OctoApp${white} |"
|
||||
|
||||
[[ "${update_arr[*]}" =~ "system" ]] && \
|
||||
echo -e "| ${cyan}● System${white} |"
|
||||
|
||||
@@ -132,8 +145,14 @@ function update_all() {
|
||||
read -p "${cyan}###### Do you want to proceed? (Y/n):${white} " yn
|
||||
case "${yn}" in
|
||||
Y|y|Yes|yes|"")
|
||||
for app in "${update_arr[@]}"; do
|
||||
local update="update_${app}"
|
||||
local component
|
||||
local update
|
||||
for component in "${update_arr[@]}"; do
|
||||
if [[ ${component} == "system" ]]; then
|
||||
update="upgrade_system_packages"
|
||||
else
|
||||
update="update_${component}"
|
||||
fi
|
||||
#shellcheck disable=SC2250
|
||||
$update
|
||||
done
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/th33xitus/kiauh #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
# #
|
||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||
#=======================================================================#
|
||||
@@ -54,7 +54,6 @@ function upload_selection() {
|
||||
[[ ${upload_agreed} == "false" ]] && accept_upload_conditions
|
||||
|
||||
local logfiles
|
||||
local logs_dir="${KLIPPER_LOGS}"
|
||||
local webif_logs="/var/log/nginx"
|
||||
|
||||
function find_logfile() {
|
||||
@@ -64,14 +63,18 @@ function upload_selection() {
|
||||
done
|
||||
}
|
||||
|
||||
find_logfile "kiauh\.log" "/tmp"
|
||||
find_logfile "klippy(-[0-9a-zA-Z]+)?\.log" "${logs_dir}"
|
||||
find_logfile "moonraker(-[0-9a-zA-Z]+)?\.log" "${logs_dir}"
|
||||
find_logfile "telegram(-[0-9a-zA-Z]+)?\.log" "${logs_dir}"
|
||||
local logdir log_dirs
|
||||
log_dirs=$(get_instance_folder_path "logs")
|
||||
for logdir in ${log_dirs}; do
|
||||
find_logfile "klippy(-[0-9a-zA-Z]+)?\.log" "${logdir}"
|
||||
find_logfile "moonraker(-[0-9a-zA-Z]+)?\.log" "${logdir}"
|
||||
find_logfile "telegram(-[0-9a-zA-Z]+)?\.log" "${logdir}"
|
||||
done
|
||||
find_logfile "mainsail.*" "${webif_logs}"
|
||||
find_logfile "fluidd.*" "${webif_logs}"
|
||||
find_logfile "KlipperScreen.log" "/tmp"
|
||||
find_logfile "webcamd\.log(\.[0-9]+)?$" "/var/log"
|
||||
find_logfile "kiauh\.log" "/tmp"
|
||||
|
||||
### draw interface
|
||||
local i=0
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/th33xitus/kiauh #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
# #
|
||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||
#=======================================================================#
|
||||
@@ -20,6 +20,8 @@ function check_euid() {
|
||||
echo -e "${red}"
|
||||
top_border
|
||||
echo -e "| !!! THIS SCRIPT MUST NOT RUN AS ROOT !!! |"
|
||||
echo -e "| |"
|
||||
echo -e "| It will ask for credentials as needed. |"
|
||||
bottom_border
|
||||
echo -e "${white}"
|
||||
exit 1
|
||||
@@ -134,7 +136,7 @@ function init_ini() {
|
||||
echo -e "# File creation date: $(date)"
|
||||
echo -e "#=================================================#"
|
||||
echo -e "# KIAUH - Klipper Installation And Update Helper #"
|
||||
echo -e "# https://github.com/th33xitus/kiauh #"
|
||||
echo -e "# https://github.com/dw-0/kiauh #"
|
||||
echo -e "# DO NOT edit this file! #"
|
||||
echo -e "#=================================================#"
|
||||
echo -e "# KIAUH v4.0.0"
|
||||
@@ -285,7 +287,7 @@ function python3_check() {
|
||||
|
||||
function dependency_check() {
|
||||
local dep=( "${@}" )
|
||||
local packages
|
||||
local packages log_name="dependencies"
|
||||
status_msg "Checking for the following dependencies:"
|
||||
|
||||
#check if package is installed, if not write its name into array
|
||||
@@ -303,12 +305,12 @@ function dependency_check() {
|
||||
done
|
||||
echo
|
||||
|
||||
if sudo apt-get update --allow-releaseinfo-change && sudo apt-get install "${packages[@]}" -y; then
|
||||
ok_msg "Dependencies installed!"
|
||||
else
|
||||
error_msg "Installing dependencies failed!"
|
||||
return 1 # exit kiauh
|
||||
fi
|
||||
# update system package lists if stale
|
||||
update_system_package_lists
|
||||
|
||||
# install required packages
|
||||
install_system_packages "${log_name}" "packages[@]"
|
||||
|
||||
else
|
||||
ok_msg "Dependencies already met!"
|
||||
return
|
||||
@@ -358,27 +360,78 @@ function create_required_folders() {
|
||||
done
|
||||
}
|
||||
|
||||
function update_system_package_lists() {
|
||||
local cache_mtime update_age update_interval silent
|
||||
|
||||
if [[ $1 == '--silent' ]]; then silent="true"; fi
|
||||
|
||||
if [[ -e /var/lib/apt/periodic/update-success-stamp ]]; then
|
||||
cache_mtime="$(stat -c %Y /var/lib/apt/periodic/update-success-stamp)"
|
||||
elif [[ -e /var/lib/apt/lists ]]; then
|
||||
cache_mtime="$(stat -c %Y /var/lib/apt/lists)"
|
||||
else
|
||||
log_warning "Failure determining package cache age, forcing update"
|
||||
cache_mtime=0
|
||||
fi
|
||||
|
||||
update_age="$(($(date +'%s') - cache_mtime))"
|
||||
update_interval=$((48*60*60)) # 48hrs
|
||||
|
||||
# update if cache is greater than update_interval
|
||||
if (( update_age > update_interval )); then
|
||||
if [[ ! ${silent} == "true" ]]; then status_msg "Updating package lists..."; fi
|
||||
if ! sudo apt-get update --allow-releaseinfo-change &>/dev/null; then
|
||||
log_error "Failure while updating package lists!"
|
||||
if [[ ! ${silent} == "true" ]]; then error_msg "Updating package lists failed!"; fi
|
||||
return 1
|
||||
else
|
||||
log_info "Package lists updated successfully"
|
||||
if [[ ! ${silent} == "true" ]]; then status_msg "Updated package lists."; fi
|
||||
fi
|
||||
else
|
||||
log_info "Package lists updated recently, skipping update..."
|
||||
fi
|
||||
}
|
||||
|
||||
function check_system_updates() {
|
||||
local updates_avail info_msg
|
||||
updates_avail=$(apt list --upgradeable 2>/dev/null | sed "1d")
|
||||
local updates_avail status
|
||||
if ! update_system_package_lists --silent; then
|
||||
status="${red}Update check failed! ${white}"
|
||||
else
|
||||
updates_avail="$(apt list --upgradeable 2>/dev/null | sed "1d")"
|
||||
|
||||
if [[ -n ${updates_avail} ]]; then
|
||||
info_msg="${yellow}System upgrade available!${white}"
|
||||
status="${yellow}System upgrade available!${white}"
|
||||
# add system to application_updates_available in kiauh.ini
|
||||
add_to_application_updates "system"
|
||||
else
|
||||
info_msg="${green}System up to date! ${white}"
|
||||
status="${green}System up to date! ${white}"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "${info_msg}"
|
||||
echo "${status}"
|
||||
}
|
||||
|
||||
function update_system() {
|
||||
status_msg "Updating System ..."
|
||||
if sudo apt-get update --allow-releaseinfo-change && sudo apt-get upgrade -y; then
|
||||
print_confirm "Update complete! Check the log above!\n ${yellow}KIAUH will not install any dist-upgrades or\n any packages which have been kept back!${green}"
|
||||
function upgrade_system_packages() {
|
||||
status_msg "Upgrading System ..."
|
||||
update_system_package_lists
|
||||
if sudo apt-get upgrade -y; then
|
||||
print_confirm "Upgrade complete! Check the log above!\n ${yellow}KIAUH will not install any dist-upgrades or\n any packages which have been held back!${green}"
|
||||
else
|
||||
print_error "System update failed! Please watch for any errors printed above!"
|
||||
print_error "System upgrade failed! Please look for any errors printed above!"
|
||||
fi
|
||||
}
|
||||
|
||||
function install_system_packages() {
|
||||
local log_name="$1"
|
||||
local packages=("${!2}")
|
||||
status_msg "Installing packages..."
|
||||
if sudo apt-get install -y "${packages[@]}"; then
|
||||
ok_msg "${log_name^} packages installed!"
|
||||
else
|
||||
log_error "Failure while installing ${log_name,,} packages"
|
||||
error_msg "Installing ${log_name} packages failed!"
|
||||
exit 1 # exit kiauh
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user