mirror of
https://github.com/dw-0/kiauh.git
synced 2025-12-24 00:03:42 +05:00
Compare commits
143 Commits
383aa6fa4e
...
v5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d0854c63ad | ||
|
|
8851bd68f8 | ||
|
|
9168ad88a6 | ||
|
|
03c0d46a2e | ||
|
|
8a8afc60ee | ||
|
|
5b68710b23 | ||
|
|
6cee0252ee | ||
|
|
aff63665de | ||
|
|
1ed1e0fc4c | ||
|
|
81ac102644 | ||
|
|
89b48168f4 | ||
|
|
195b7fa926 | ||
|
|
12919c7140 | ||
|
|
e590f668e6 | ||
|
|
075f2d384b | ||
|
|
afdde34721 | ||
|
|
393dd1d5bf | ||
|
|
8170057434 | ||
|
|
985b66d41f | ||
|
|
f95d2586bf | ||
|
|
f5141e7eff | ||
|
|
33113e72e9 | ||
|
|
6f59fd06aa | ||
|
|
56ea43ccb6 | ||
|
|
25e22c993f | ||
|
|
ead521b377 | ||
|
|
3c952ccc12 | ||
|
|
c8f713c00e | ||
|
|
95cf809378 | ||
|
|
c91816d13f | ||
|
|
1a6f06eaf2 | ||
|
|
ea8621af0c | ||
|
|
88742ab496 | ||
|
|
b99e6612e2 | ||
|
|
cf4e915430 | ||
|
|
c901cd1fdf | ||
|
|
da3c37a872 | ||
|
|
8f436646cd | ||
|
|
760f131d1c | ||
|
|
41804f0eaa | ||
|
|
d3c9bcc38c | ||
|
|
7fc36f3e68 | ||
|
|
a4942b9404 | ||
|
|
9e0a8a0081 | ||
|
|
6082528628 | ||
|
|
9e92e4a36a | ||
|
|
7e8f1f3d81 | ||
|
|
234cf2c751 | ||
|
|
3bc98eed13 | ||
|
|
777f5e45e7 | ||
|
|
acf0faf158 | ||
|
|
5c219ec544 | ||
|
|
70055e891e | ||
|
|
e3a0a9dec0 | ||
|
|
1cf81377ee | ||
|
|
aa4ea99c5c | ||
|
|
20ffc82a04 | ||
|
|
0becf9d574 | ||
|
|
ed1bfcdeb4 | ||
|
|
033916216c | ||
|
|
d8f47c0960 | ||
|
|
4978f22101 | ||
|
|
8330f90b56 | ||
|
|
2a08e3eb15 | ||
|
|
a2a3e92b50 | ||
|
|
a58288e7e3 | ||
|
|
3852464ab7 | ||
|
|
d9626adc98 | ||
|
|
4ae5a37ec6 | ||
|
|
935f81aab6 | ||
|
|
b02df9a1e0 | ||
|
|
dbbc87f18e | ||
|
|
243ea6582a | ||
|
|
91cba3637e | ||
|
|
3fc190ff25 | ||
|
|
6ff45aab41 | ||
|
|
b9c9feef3c | ||
|
|
d37d047aaa | ||
|
|
a3fb57aee3 | ||
|
|
8aee23830a | ||
|
|
dd14de9a41 | ||
|
|
1ca1e8ff6f | ||
|
|
12127efa21 | ||
|
|
66a5cdf9b1 | ||
|
|
9b1aba207c | ||
|
|
e274e3c00d | ||
|
|
dd99b0e1a6 | ||
|
|
a616876ace | ||
|
|
4925021aa8 | ||
|
|
e63d9d67ec | ||
|
|
106bf7675f | ||
|
|
a63cf8c9d9 | ||
|
|
02ed3e7da0 | ||
|
|
4427ae94af | ||
|
|
81b7b156b9 | ||
|
|
2df364512b | ||
|
|
dfa0036326 | ||
|
|
425d86a12f | ||
|
|
ff6162d799 | ||
|
|
674c174224 | ||
|
|
a368331693 | ||
|
|
406b64d1e5 | ||
|
|
1b5691f2f5 | ||
|
|
e7eae5a0d1 | ||
|
|
dc561a562c | ||
|
|
55cfe124b2 | ||
|
|
43d6598be6 | ||
|
|
dc026a7a2b | ||
|
|
ac54d04b40 | ||
|
|
c19364360c | ||
|
|
2e6c66e524 | ||
|
|
cd8003add9 | ||
|
|
1f75395063 | ||
|
|
6e1bffa975 | ||
|
|
a8a73249a5 | ||
|
|
4138c71920 | ||
|
|
ec3f93eeda | ||
|
|
afeb2bf02e | ||
|
|
4b17c68454 | ||
|
|
df414ce37e | ||
|
|
975629f097 | ||
|
|
fd2910ba67 | ||
|
|
6b6607c5ab | ||
|
|
b604d93d0c | ||
|
|
7e87f8af32 | ||
|
|
29b5ab00cd | ||
|
|
4cf523a758 | ||
|
|
694a4c20c5 | ||
|
|
a54514c400 | ||
|
|
1d06bf76f3 | ||
|
|
e438081c35 | ||
|
|
9f50f6fdd7 | ||
|
|
0ee0fa3325 | ||
|
|
8547942986 | ||
|
|
d33ac6b15a | ||
|
|
6cd9133a15 | ||
|
|
a929c6983d | ||
|
|
bce92001a6 | ||
|
|
7993b98ee1 | ||
|
|
62296e112e | ||
|
|
a374ac8fac | ||
|
|
f2691f33d3 | ||
|
|
d800d356ca |
15
.editorconfig
Normal file
15
.editorconfig
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 4
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = lf
|
||||||
|
|
||||||
|
[*.py]
|
||||||
|
max_line_length = 88
|
||||||
|
|
||||||
|
[*.{sh,yml,yaml,json}]
|
||||||
|
indent_size = 2
|
||||||
33
.github/workflows/release-ff-and-tag.yml
vendored
Normal file
33
.github/workflows/release-ff-and-tag.yml
vendored
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
name: Release - Fast-Forward and Tag
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
tag_name:
|
||||||
|
description: 'Provide a tag name (e.g. v1.0.0)'
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
ff-and-tag:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
ref: 'master'
|
||||||
|
- name: Merge Fast Forward
|
||||||
|
uses: MaximeHeckel/github-action-merge-fast-forward@v1.1.0
|
||||||
|
with:
|
||||||
|
branchtomerge: origin/develop
|
||||||
|
branch: master
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- name: Create and Push Tag
|
||||||
|
run: |
|
||||||
|
git tag ${{ inputs.tag_name }}
|
||||||
|
git push origin ${{ inputs.tag_name }}
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
9
.gitignore
vendored
9
.gitignore
vendored
@@ -1,4 +1,13 @@
|
|||||||
.idea
|
.idea
|
||||||
.vscode
|
.vscode
|
||||||
|
.pytest_cache
|
||||||
|
.jupyter
|
||||||
|
*.ipynb
|
||||||
|
*.ipynb_checkpoints
|
||||||
|
*.tmp
|
||||||
|
__pycache__
|
||||||
|
.kiauh-env
|
||||||
*.code-workspace
|
*.code-workspace
|
||||||
|
*.iml
|
||||||
|
kiauh.cfg
|
||||||
klipper_repos.txt
|
klipper_repos.txt
|
||||||
|
|||||||
138
README.md
138
README.md
@@ -28,12 +28,12 @@
|
|||||||
|
|
||||||
### 📋 Prerequisites
|
### 📋 Prerequisites
|
||||||
KIAUH is a script that assists you in installing Klipper on a Linux operating system that has
|
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
|
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 (either 32bit or 64bit)` 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/)
|
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.
|
is the simplest way to flash an image like this to an SD card.
|
||||||
|
|
||||||
* Once you have 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)`: \
|
select `Choose OS -> Raspberry Pi OS (other)`: \
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="https://raw.githubusercontent.com/dw-0/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">
|
||||||
@@ -44,7 +44,7 @@ select `Choose OS -> Raspberry Pi OS (other)`: \
|
|||||||
<img src="https://raw.githubusercontent.com/dw-0/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>
|
</p>
|
||||||
|
|
||||||
* Back in the Raspberry Pi Imager's main menu, select the corresponding SD card to which
|
* Back in the Raspberry Pi Imager's main menu, select the corresponding SD card to which
|
||||||
you want to flash the image.
|
you want to flash the image.
|
||||||
|
|
||||||
* Make sure to go into the Advanced 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)
|
||||||
@@ -52,9 +52,9 @@ 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).
|
* 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).
|
||||||
|
|
||||||
These steps **only** apply if you are actually using a Raspberry Pi. In case you want
|
These steps **only** apply if you are actually using a Raspberry Pi. In case you want
|
||||||
to use a different SBC (like an Orange Pi or any other Pi derivates), please look up on how to get an appropriate Linux image flashed
|
to use a different SBC (like an Orange Pi or any other Pi derivates), please look up on how to get an appropriate Linux image flashed
|
||||||
to the SD card before proceeding further (usually done with Balena Etcher in those cases). Also make sure that KIAUH will be able to run
|
to the SD card before proceeding further (usually done with Balena Etcher in those cases). Also make sure that KIAUH will be able to run
|
||||||
and operate on the Linux Distribution you are going to flash. You likely will have the most success with
|
and operate on the Linux Distribution you are going to flash. You likely will have the most success with
|
||||||
distributions based on Debian 11 Bullseye. Read the notes further down below in this document.
|
distributions based on Debian 11 Bullseye. Read the notes further down below in this document.
|
||||||
|
|
||||||
@@ -82,8 +82,8 @@ Finally, start KIAUH by running the next command:
|
|||||||
```
|
```
|
||||||
|
|
||||||
* **Step 4:** \
|
* **Step 4:** \
|
||||||
You should now find yourself in the main menu of KIAUH. You will see several actions to choose from depending
|
You should now find yourself in the main menu of KIAUH. You will see several actions to choose from depending
|
||||||
on what you want to do. To choose an action, simply type the corresponding number into the "Perform action"
|
on what you want to do. To choose an action, simply type the corresponding number into the "Perform action"
|
||||||
prompt and confirm by hitting ENTER.
|
prompt and confirm by hitting ENTER.
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
@@ -101,79 +101,103 @@ prompt and confirm by hitting ENTER.
|
|||||||
|
|
||||||
<h2 align="center">🌐 Sources & Further Information</h2>
|
<h2 align="center">🌐 Sources & Further Information</h2>
|
||||||
|
|
||||||
<table>
|
<table align="center">
|
||||||
<tr>
|
<tr>
|
||||||
<th><h3><a href="https://github.com/Klipper3d/klipper">Klipper</a></h3></th>
|
<th><h3><a href="https://github.com/Klipper3d/klipper">Klipper</a></h3></th>
|
||||||
<th><h3><a href="https://github.com/Arksine/moonraker">Moonraker</a></h3></th>
|
<th><h3><a href="https://github.com/Arksine/moonraker">Moonraker</a></h3></th>
|
||||||
<th><h3><a href="https://github.com/mainsail-crew/mainsail">Mainsail</a></h3></th>
|
<th><h3><a href="https://github.com/mainsail-crew/mainsail">Mainsail</a></h3></th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th><img src="https://raw.githubusercontent.com/Klipper3d/klipper/master/docs/img/klipper-logo.png" alt="Klipper Logo" height="64"></th>
|
<th><img src="https://raw.githubusercontent.com/Klipper3d/klipper/master/docs/img/klipper-logo.png" alt="Klipper Logo" height="64"></th>
|
||||||
<th><img src="https://avatars.githubusercontent.com/u/9563098?v=4" alt="Arksine avatar" height="64"></th>
|
<th><img src="https://avatars.githubusercontent.com/u/9563098?v=4" alt="Arksine avatar" height="64"></th>
|
||||||
<th><img src="https://raw.githubusercontent.com/mainsail-crew/docs/master/assets/img/logo.png" alt="Mainsail Logo" height="64"></th>
|
<th><img src="https://raw.githubusercontent.com/mainsail-crew/docs/master/assets/img/logo.png" alt="Mainsail Logo" height="64"></th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>by <a href="https://github.com/KevinOConnor">KevinOConnor</a></th>
|
<th>by <a href="https://github.com/KevinOConnor">KevinOConnor</a></th>
|
||||||
<th>by <a href="https://github.com/Arksine">Arksine</a></th>
|
<th>by <a href="https://github.com/Arksine">Arksine</a></th>
|
||||||
<th>by <a href="https://github.com/mainsail-crew">mainsail-crew</a></th>
|
<th>by <a href="https://github.com/mainsail-crew">mainsail-crew</a></th>
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th><h3><a href="https://github.com/fluidd-core/fluidd">Fluidd</a></h3></th>
|
|
||||||
<th><h3><a href="https://github.com/jordanruthe/KlipperScreen">KlipperScreen</a></h3></th>
|
|
||||||
<th><h3><a href="https://github.com/OctoPrint/OctoPrint">OctoPrint</a></h3></th>
|
|
||||||
</tr>
|
|
||||||
<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://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>
|
|
||||||
<th>by <a href="https://github.com/jordanruthe">jordanruthe</a></th>
|
|
||||||
<th>by <a href="https://github.com/OctoPrint">OctoPrint</a></th>
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th><h3><a href="https://github.com/nlef/moonraker-telegram-bot">Moonraker-Telegram-Bot</a></h3></th>
|
<th><h3><a href="https://github.com/fluidd-core/fluidd">Fluidd</a></h3></th>
|
||||||
<th><h3><a href="https://github.com/Kragrathea/pgcode">PrettyGCode for Klipper</a></h3></th>
|
<th><h3><a href="https://github.com/jordanruthe/KlipperScreen">KlipperScreen</a></h3></th>
|
||||||
<th><h3><a href="https://github.com/TheSpaghettiDetective/moonraker-obico">Obico for Klipper</a></h3></th>
|
<th><h3><a href="https://github.com/OctoPrint/OctoPrint">OctoPrint</a></h3></th>
|
||||||
|
</tr>
|
||||||
|
<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://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>
|
||||||
|
<th>by <a href="https://github.com/jordanruthe">jordanruthe</a></th>
|
||||||
|
<th>by <a href="https://github.com/OctoPrint">OctoPrint</a></th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th><img src="https://avatars.githubusercontent.com/u/52351624?v=4" alt="nlef avatar" height="64"></th>
|
<th><h3><a href="https://github.com/nlef/moonraker-telegram-bot">Moonraker-Telegram-Bot</a></h3></th>
|
||||||
<th><img src="https://avatars.githubusercontent.com/u/5917231?v=4" alt="Kragrathea avatar" height="64"></th>
|
<th><h3><a href="https://github.com/Kragrathea/pgcode">PrettyGCode for Klipper</a></h3></th>
|
||||||
<th><img src="https://avatars.githubusercontent.com/u/46323662?s=200&v=4" alt="Obico logo" height="64"></th>
|
<th><h3><a href="https://github.com/TheSpaghettiDetective/moonraker-obico">Obico for Klipper</a></h3></th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th><img src="https://avatars.githubusercontent.com/u/52351624?v=4" alt="nlef avatar" height="64"></th>
|
||||||
|
<th><img src="https://avatars.githubusercontent.com/u/5917231?v=4" alt="Kragrathea avatar" height="64"></th>
|
||||||
|
<th><img src="https://avatars.githubusercontent.com/u/46323662?s=200&v=4" alt="Obico logo" height="64"></th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>by <a href="https://github.com/nlef">nlef</a></th>
|
||||||
|
<th>by <a href="https://github.com/Kragrathea">Kragrathea</a></th>
|
||||||
|
<th>by <a href="https://github.com/TheSpaghettiDetective">Obico</a></th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>by <a href="https://github.com/nlef">nlef</a></th>
|
<th><h3><a href="https://github.com/Clon1998/mobileraker_companion">Mobileraker's Companion</a></h3></th>
|
||||||
<th>by <a href="https://github.com/Kragrathea">Kragrathea</a></th>
|
<th><h3><a href="https://octoeverywhere.com/?source=kiauh_readme">OctoEverywhere For Klipper</a></h3></th>
|
||||||
<th>by <a href="https://github.com/TheSpaghettiDetective">Obico</a></th>
|
<th><h3><a href="https://github.com/crysxd/OctoApp-Plugin">OctoApp For Klipper</a></h3></th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th><a href="https://github.com/Clon1998/mobileraker_companion"><img src="https://raw.githubusercontent.com/Clon1998/mobileraker/master/assets/icon/mr_appicon.png" alt="Mobileraker Logo" height="64"></a></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><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>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>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th><h3><a href="https://github.com/Clon1998/mobileraker_companion">Mobileraker's Companion</a></h3></th>
|
<th><h3><a href="https://github.com/staubgeborener/klipper-backup">Klipper-Backup</a></h3></th>
|
||||||
<th><h3><a href="https://octoeverywhere.com/?source=kiauh_readme">OctoEverywhere For Klipper</a></h3></th>
|
<th><h3><a href="https://simplyprint.io/">SimplyPrint for Klipper</a></h3></th>
|
||||||
<th><h3></h3></th>
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<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://github.com/staubgeborener/klipper-backup"><img src="https://avatars.githubusercontent.com/u/28908603?v=4" alt="Staubgeroner Avatar" height="64"></a></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><a href="https://github.com/SimplyPrint"><img src="https://avatars.githubusercontent.com/u/64896552?s=200&v=4" alt="" height="64"></a></th>
|
||||||
<th></th>
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>by <a href="https://github.com/Clon1998">Patrick Schmidt</a></th>
|
<th>by <a href="https://github.com/Staubgeborener">Staubgeborener</a></th>
|
||||||
<th>by <a href="https://github.com/QuinnDamerell">Quinn Damerell</a></th>
|
<th>by <a href="https://github.com/SimplyPrint">SimplyPrint</a></th>
|
||||||
<th></th>
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
|
<h2 align="center">🎖️ Contributors 🎖️</h2>
|
||||||
|
|
||||||
|
<div align="center">
|
||||||
|
<a href="https://github.com/dw-0/kiauh/graphs/contributors">
|
||||||
|
<img src="https://contrib.rocks/image?repo=dw-0/kiauh" alt=""/>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<div align="center">
|
||||||
|
<img src="https://repobeats.axiom.co/api/embed/a1afbda9190c04a90cf4bd3061e5573bc836cb05.svg" alt="Repobeats analytics image"/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
<h2 align="center">✨ Credits ✨</h2>
|
<h2 align="center">✨ Credits ✨</h2>
|
||||||
|
|
||||||
* A big thank you to [lixxbox](https://github.com/lixxbox) for that awesome KIAUH-Logo!
|
* A big thank you to [lixxbox](https://github.com/lixxbox) for that awesome KIAUH-Logo!
|
||||||
|
|||||||
206
README_zh.md
Normal file
206
README_zh.md
Normal file
@@ -0,0 +1,206 @@
|
|||||||
|
# KIAUH - Klipper 安装与更新助手
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<a>
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
一个方便的安装脚本,让安装Klipper(以及更多组件)变得轻松!
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<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/dw-0/kiauh"></a>
|
||||||
|
<a><img src="https://img.shields.io/github/contributors/dw-0/kiauh"></a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
## 📄 使用说明
|
||||||
|
|
||||||
|
### 📋 系统要求
|
||||||
|
KIAUH 是一个帮助您在 Linux 系统上安装 Klipper 的脚本工具,
|
||||||
|
它需要一个已经写入树莓派(或其他单板计算机)SD 卡的 Linux 系统。
|
||||||
|
如果您使用树莓派,推荐使用 `Raspberry Pi OS Lite (32位或64位)` 系统镜像。
|
||||||
|
[官方 Raspberry Pi Imager](https://www.raspberrypi.com/software/) 是将此类镜像写入 SD 卡的最简单方式。
|
||||||
|
|
||||||
|
* 下载、安装并启动 Raspberry Pi Imager 后,
|
||||||
|
选择 `Choose OS -> Raspberry Pi OS (other)`:
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<img src="https://raw.githubusercontent.com/dw-0/kiauh/master/resources/screenshots/rpi_imager1.png" alt="KIAUH logo" height="350">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
* 然后选择 `Raspberry Pi OS Lite (32位)` (或如果您想使用64位版本):
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<img src="https://raw.githubusercontent.com/dw-0/kiauh/master/resources/screenshots/rpi_imager2.png" alt="KIAUH logo" height="350">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
* 返回 Raspberry Pi Imager 主界面,选择对应的 SD 卡作为写入目标。
|
||||||
|
|
||||||
|
* 确保点击左下角的齿轮图标(在主菜单中)
|
||||||
|
启用 SSH 并配置 Wi-Fi。
|
||||||
|
|
||||||
|
* 如果您需要更多关于使用 Raspberry Pi Imager 的帮助,请访问 [官方文档](https://www.raspberrypi.com/documentation/computers/getting-started.html)。
|
||||||
|
|
||||||
|
这些步骤**仅适用于**您实际使用树莓派的情况。如果您想使用其他单板计算机(如香橙派或其他 Pi 衍生产品),
|
||||||
|
请查找如何将合适的 Linux 镜像写入 SD 卡(通常使用 Balena Etcher)。
|
||||||
|
同时确保 KIAUH 能够在您要安装的 Linux 发行版上运行。
|
||||||
|
您在使用基于 Debian 11 Bullseye 的系统时可能会获得最佳体验。
|
||||||
|
请阅读本文档下方的注意事项。
|
||||||
|
|
||||||
|
### 💾 下载并使用 KIAUH
|
||||||
|
|
||||||
|
**📢 免责声明:使用此脚本的风险由您自行承担!**
|
||||||
|
|
||||||
|
* **第一步:**
|
||||||
|
要下载此脚本,需要先安装 git。
|
||||||
|
如果您不确定是否已安装 git,请运行以下命令:
|
||||||
|
```shell
|
||||||
|
sudo apt-get update && sudo apt-get install git -y
|
||||||
|
```
|
||||||
|
|
||||||
|
* **第二步:**
|
||||||
|
安装完 git 后,
|
||||||
|
使用以下命令将 KIAUH 下载到您的主目录:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
cd ~ && git clone https://github.com/dw-0/kiauh.git
|
||||||
|
```
|
||||||
|
|
||||||
|
* **第三步:**
|
||||||
|
最后,通过运行以下命令启动 KIAUH:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
./kiauh/kiauh.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
* **第四步:**
|
||||||
|
您现在应该会看到 KIAUH 的主菜单。
|
||||||
|
根据您的选择,
|
||||||
|
您会看到几个可选操作。
|
||||||
|
要选择某个操作,只需在 "Perform action" 提示后输入对应的数字并按回车键确认。
|
||||||
|
|
||||||
|
## ❗ 注意事项
|
||||||
|
|
||||||
|
### **📋 请查看 [更新日志](docs/changelog.md) 以了解可能的重要更新!**
|
||||||
|
|
||||||
|
- 主要在 Raspberry Pi OS Lite (Debian 10 Buster / Debian 11 Bullseye) 上测试
|
||||||
|
- 其他基于 Debian 的发行版(如 Ubuntu 20 到 22)也可能正常工作
|
||||||
|
- 据报告在 Armbian 上也可用,但未进行详细测试
|
||||||
|
- 在使用此脚本的过程中,
|
||||||
|
您会被要求输入 sudo 密码。
|
||||||
|
因为有几个功能需要 sudo 权限。
|
||||||
|
|
||||||
|
## 🌐 相关资源与更多信息
|
||||||
|
|
||||||
|
<table align="center">
|
||||||
|
<tr>
|
||||||
|
<th><h3><a href="https://github.com/Klipper3d/klipper">Klipper</a></h3></th>
|
||||||
|
<th><h3><a href="https://github.com/Arksine/moonraker">Moonraker</a></h3></th>
|
||||||
|
<th><h3><a href="https://github.com/mainsail-crew/mainsail">Mainsail</a></h3></th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th><img src="https://raw.githubusercontent.com/Klipper3d/klipper/master/docs/img/klipper-logo.png" alt="Klipper Logo" height="64"></th>
|
||||||
|
<th><img src="https://avatars.githubusercontent.com/u/9563098?v=4" alt="Arksine avatar" height="64"></th>
|
||||||
|
<th><img src="https://raw.githubusercontent.com/mainsail-crew/docs/master/assets/img/logo.png" alt="Mainsail Logo" height="64"></th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>由 <a href="https://github.com/KevinOConnor">KevinOConnor</a></th>
|
||||||
|
<th>由 <a href="https://github.com/Arksine">Arksine</a></th>
|
||||||
|
<th>由 <a href="https://github.com/mainsail-crew">mainsail-crew</a></th>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th><h3><a href="https://github.com/fluidd-core/fluidd">Fluidd</a></h3></th>
|
||||||
|
<th><h3><a href="https://github.com/jordanruthe/KlipperScreen">KlipperScreen</a></h3></th>
|
||||||
|
<th><h3><a href="https://github.com/OctoPrint/OctoPrint">OctoPrint</a></h3></th>
|
||||||
|
</tr>
|
||||||
|
<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://raw.githubusercontent.com/OctoPrint/OctoPrint/master/docs/images/octoprint-logo.png" alt="OctoPrint Logo" height="64"></th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>由 <a href="https://github.com/fluidd-core">fluidd-core</a></th>
|
||||||
|
<th>由 <a href="https://github.com/jordanruthe">jordanruthe</a></th>
|
||||||
|
<th>由 <a href="https://github.com/OctoPrint">OctoPrint</a></th>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th><h3><a href="https://github.com/nlef/moonraker-telegram-bot">Moonraker-Telegram-Bot</a></h3></th>
|
||||||
|
<th><h3><a href="https://github.com/Kragrathea/pgcode">PrettyGCode for Klipper</a></h3></th>
|
||||||
|
<th><h3><a href="https://github.com/TheSpaghettiDetective/moonraker-obico">Obico for Klipper</a></h3></th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th><img src="https://avatars.githubusercontent.com/u/52351624?v=4" alt="nlef avatar" height="64"></th>
|
||||||
|
<th><img src="https://avatars.githubusercontent.com/u/5917231?v=4" alt="Kragrathea avatar" height="64"></th>
|
||||||
|
<th><img src="https://avatars.githubusercontent.com/u/46323662?s=200&v=4" alt="Obico logo" height="64"></th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>由 <a href="https://github.com/nlef">nlef</a></th>
|
||||||
|
<th>由 <a href="https://github.com/Kragrathea">Kragrathea</a></th>
|
||||||
|
<th>由 <a href="https://github.com/TheSpaghettiDetective">Obico</a></th>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<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/OctoApp-Plugin">OctoApp For Klipper</a></h3></th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th><a href="https://github.com/Clon1998/mobileraker_companion"><img src="https://raw.githubusercontent.com/Clon1998/mobileraker/master/assets/icon/mr_appicon.png" alt="Mobileraker Logo" height="64"></a></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><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>由 <a href="https://github.com/Clon1998">Patrick Schmidt</a></th>
|
||||||
|
<th>由 <a href="https://github.com/QuinnDamerell">Quinn Damerell</a></th>
|
||||||
|
<th>由 <a href="https://github.com/crysxd">Christian Würthner</a></th>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th><h3><a href="https://github.com/staubgeborener/klipper-backup">Klipper-Backup</a></h3></th>
|
||||||
|
<th><h3><a href="https://simplyprint.io/">SimplyPrint for Klipper</a></h3></th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th><a href="https://github.com/staubgeborener/klipper-backup"><img src="https://avatars.githubusercontent.com/u/28908603?v=4" alt="Staubgeroner Avatar" height="64"></a></th>
|
||||||
|
<th><a href="https://github.com/SimplyPrint"><img src="https://avatars.githubusercontent.com/u/64896552?s=200&v=4" alt="" height="64"></a></th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>由 <a href="https://github.com/Staubgeborener">Staubgeborener</a></th>
|
||||||
|
<th>由 <a href="https://github.com/SimplyPrint">SimplyPrint</a></th>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
## 🎖️ 贡献者
|
||||||
|
|
||||||
|
<div align="center">
|
||||||
|
<a href="https://github.com/dw-0/kiauh/graphs/contributors">
|
||||||
|
<img src="https://contrib.rocks/image?repo=dw-0/kiauh" alt=""/>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div align="center">
|
||||||
|
<img src="https://repobeats.axiom.co/api/embed/a1afbda9190c04a90cf4bd3061e5573bc836cb05.svg" alt="Repobeats analytics image"/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
## ✨ 特别感谢
|
||||||
|
|
||||||
|
* 非常感谢 [lixxbox](https://github.com/lixxbox) 设计了如此出色的 KIAUH 标志!
|
||||||
|
* 同时,非常感谢所有通过 [Ko-fi](https://ko-fi.com/dw__0) 支持我的工作的人!
|
||||||
|
* 最后但同样重要的是:感谢所有为 Klipper 社区做出贡献的成员,以及喜欢和分享这个项目的朋友们!
|
||||||
|
|
||||||
|
<h4 align="center">特别感谢 JetBrains 为本项目提供其出色的软件赞助!</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,13 +2,54 @@
|
|||||||
|
|
||||||
This document covers possible important changes to KIAUH.
|
This document covers possible important changes to KIAUH.
|
||||||
|
|
||||||
|
### 2024-08-31 (v6.0.0-alpha.1)
|
||||||
|
Long time no see, but here we are again!
|
||||||
|
A lot has happened in the background, but now it is time to take it out into the wild.
|
||||||
|
|
||||||
|
#### KIAUH has now reached version 6! Well, at least in an alpha state...
|
||||||
|
|
||||||
|
The project has seen a complete rewrite of the script from scratch in Python.
|
||||||
|
It requires Python 3.8 or newer to run. Because this update is still in an alpha state, bugs may or will occur.
|
||||||
|
During startup, you will be asked if you want to start the new version 6 or the old version 5.
|
||||||
|
As long as version 6 is in a pre-release state, version 5 will still be available. If there are any critical issues
|
||||||
|
with the new version that were overlooked, you can always switch back to the old version.
|
||||||
|
|
||||||
|
In case you selected not to get asked about which version to start (option 3 or 4 in the startup dialog) and you want to
|
||||||
|
revert that decision, you will find a line called `version_to_launch=` within the `.kiauh.ini` file in your home directory.
|
||||||
|
Just delete that line, save the file and restart KIAUH. KIAUH will then ask you again which version you want to start.
|
||||||
|
|
||||||
|
Here is a list of the most important changes to KIAUH in regard to version 6:
|
||||||
|
- The majority of features available in KIAUH v5 are still available; they just got migrated from Bash to Python.
|
||||||
|
- It is now possible to add new/remove instances to/from existing multi-instance installations of Klipper and Moonraker
|
||||||
|
- KIAUH now has an Extension-System. This allows contributors to add new installers to KIAUH without having to modify the main script.
|
||||||
|
- You will now find some of the features that were previously available in the Installer-Menu in the Extensions-Menu.
|
||||||
|
- The current extensions are:
|
||||||
|
- G-Code Shell Command (previously found in the Advanced-Menu)
|
||||||
|
- Mainsail Theme Installer (previously found in the Advanced-Menu)
|
||||||
|
- Klipper-Backup (new in v6!)
|
||||||
|
- Moonraker Telegram Bot (previously found in the Installer-Menu)
|
||||||
|
- PrettyGCode for Klipper (previously found in the Installer-Menu)
|
||||||
|
- Obico for Klipper (previously found in the Installer-Menu)
|
||||||
|
- The following additional extensions are planned, but not yet available:
|
||||||
|
- Spoolman (available in v5 in the Installer-Menu)
|
||||||
|
- OctoApp (available in v5 in the Installer-Menu)
|
||||||
|
- KIAUH has its own config file now
|
||||||
|
- The file has some default values for the currently supported options
|
||||||
|
- There might be more options in the future
|
||||||
|
- It is located in KIAUH's root directory and is called `default.kiauh.cfg`
|
||||||
|
- DO NOT EDIT the default file directly, instead make a copy of it and call it `kiauh.cfg`
|
||||||
|
- Settings changed via the Advanced-Menu will be written to the `kiauh.cfg`
|
||||||
|
- Support for OctoPrint was removed
|
||||||
|
|
||||||
|
Feel free to give version 6 a try and report any bugs or issues you encounter! Every feedback is appreciated.
|
||||||
|
|
||||||
### 2023-06-17
|
### 2023-06-17
|
||||||
KIAUH has now added support for installing Mobileraker's companion!
|
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
|
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!
|
to control your printer. Thank you to [Clon1998](https://github.com/Clon1998) for adding this feature!
|
||||||
|
|
||||||
### 2023-02-03
|
### 2023-02-03
|
||||||
The installer for MJPG-Streamer got replaced by crowsnest. It is an improved webcam service, utilizing ustreamer.
|
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 \
|
Please have a look here for additional info about crowsnest and how to configure it: https://github.com/mainsail-crew/crowsnest \
|
||||||
It's unsure if the previous MJPG-Streamer installer will be updated and make its way back into KIAUH.
|
It's unsure if the previous MJPG-Streamer installer will be updated and make its way back into KIAUH.
|
||||||
A big thanks to [KwadFan](https://github.com/KwadFan) for writing the crowsnest implementation.
|
A big thanks to [KwadFan](https://github.com/KwadFan) for writing the crowsnest implementation.
|
||||||
@@ -115,7 +156,7 @@ membership for example caused issues when installing mjpg-streamer while not usi
|
|||||||
Other issues could occur when trying to flash an MCU on Debian or Ubuntu distributions where a user might not be part
|
Other issues could occur when trying to flash an MCU on Debian or Ubuntu distributions where a user might not be part
|
||||||
of the dialout group by default. A check for the tty group is also done. The tty group is needed for setting
|
of the dialout group by default. A check for the tty group is also done. The tty group is needed for setting
|
||||||
up a linux MCU (currently not yet supported by KIAUH).
|
up a linux MCU (currently not yet supported by KIAUH).
|
||||||
* There is an issue when trying to install Mainsail or Fluidd on Ubuntu 21.10. Permissions on that distro seem to have seen a rework
|
* There is an issue when trying to install Mainsail or Fluidd on Ubuntu 21.10. Permissions on that distro seem to have seen a rework
|
||||||
in comparison to 20.04 and users will be greeted with an "Error 403 - Permission denied" message after installing one of Klippers webinterfaces.
|
in comparison to 20.04 and users will be greeted with an "Error 403 - Permission denied" message after installing one of Klippers webinterfaces.
|
||||||
I still have to figure out a viable solution for that.
|
I still have to figure out a viable solution for that.
|
||||||
|
|
||||||
|
|||||||
39
kiauh.sh
39
kiauh.sh
@@ -10,7 +10,10 @@
|
|||||||
#=======================================================================#
|
#=======================================================================#
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
clear
|
clear -x
|
||||||
|
|
||||||
|
# make sure we have the correct permissions while running the script
|
||||||
|
umask 022
|
||||||
|
|
||||||
### sourcing all additional scripts
|
### sourcing all additional scripts
|
||||||
KIAUH_SRCDIR="$(dirname -- "$(readlink -f "${BASH_SOURCE[0]}")")"
|
KIAUH_SRCDIR="$(dirname -- "$(readlink -f "${BASH_SOURCE[0]}")")"
|
||||||
@@ -54,35 +57,15 @@ function kiauh_update_avail() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function kiauh_update_dialog() {
|
function main() {
|
||||||
[[ ! $(kiauh_update_avail) == "true" ]] && return
|
read_kiauh_ini "${FUNCNAME[0]}"
|
||||||
top_border
|
main_menu
|
||||||
echo -e "|${green} New KIAUH update available! ${white}|"
|
|
||||||
hr
|
|
||||||
echo -e "|${green} View Changelog: https://git.io/JnmlX ${white}|"
|
|
||||||
blank_line
|
|
||||||
echo -e "|${yellow} It is recommended to keep KIAUH up to date. Updates ${white}|"
|
|
||||||
echo -e "|${yellow} usually contain bugfixes, important changes or new ${white}|"
|
|
||||||
echo -e "|${yellow} features. Please consider updating! ${white}|"
|
|
||||||
bottom_border
|
|
||||||
|
|
||||||
local yn
|
|
||||||
read -p "${cyan}###### Do you want to update now? (Y/n):${white} " yn
|
|
||||||
while true; do
|
|
||||||
case "${yn}" in
|
|
||||||
Y|y|Yes|yes|"")
|
|
||||||
do_action "update_kiauh"
|
|
||||||
break;;
|
|
||||||
N|n|No|no)
|
|
||||||
break;;
|
|
||||||
*)
|
|
||||||
deny_action "kiauh_update_dialog";;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
check_if_ratos
|
||||||
check_euid
|
check_euid
|
||||||
init_logfile
|
init_logfile
|
||||||
set_globals
|
set_globals
|
||||||
kiauh_update_dialog
|
read_kiauh_ini
|
||||||
main_menu
|
init_ini
|
||||||
|
main
|
||||||
|
|||||||
@@ -8,22 +8,26 @@ import shlex
|
|||||||
import subprocess
|
import subprocess
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
|
||||||
class ShellCommand:
|
class ShellCommand:
|
||||||
def __init__(self, config):
|
def __init__(self, config):
|
||||||
self.name = config.get_name().split()[-1]
|
self.name = config.get_name().split()[-1]
|
||||||
self.printer = config.get_printer()
|
self.printer = config.get_printer()
|
||||||
self.gcode = self.printer.lookup_object('gcode')
|
self.gcode = self.printer.lookup_object("gcode")
|
||||||
cmd = config.get('command')
|
cmd = config.get("command")
|
||||||
cmd = os.path.expanduser(cmd)
|
cmd = os.path.expanduser(cmd)
|
||||||
self.command = shlex.split(cmd)
|
self.command = shlex.split(cmd)
|
||||||
self.timeout = config.getfloat('timeout', 2., above=0.)
|
self.timeout = config.getfloat("timeout", 2.0, above=0.0)
|
||||||
self.verbose = config.getboolean('verbose', True)
|
self.verbose = config.getboolean("verbose", True)
|
||||||
self.proc_fd = None
|
self.proc_fd = None
|
||||||
self.partial_output = ""
|
self.partial_output = ""
|
||||||
self.gcode.register_mux_command(
|
self.gcode.register_mux_command(
|
||||||
"RUN_SHELL_COMMAND", "CMD", self.name,
|
"RUN_SHELL_COMMAND",
|
||||||
|
"CMD",
|
||||||
|
self.name,
|
||||||
self.cmd_RUN_SHELL_COMMAND,
|
self.cmd_RUN_SHELL_COMMAND,
|
||||||
desc=self.cmd_RUN_SHELL_COMMAND_help)
|
desc=self.cmd_RUN_SHELL_COMMAND_help,
|
||||||
|
)
|
||||||
|
|
||||||
def _process_output(self, eventime):
|
def _process_output(self, eventime):
|
||||||
if self.proc_fd is None:
|
if self.proc_fd is None:
|
||||||
@@ -33,11 +37,11 @@ class ShellCommand:
|
|||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
data = self.partial_output + data.decode()
|
data = self.partial_output + data.decode()
|
||||||
if '\n' not in data:
|
if "\n" not in data:
|
||||||
self.partial_output = data
|
self.partial_output = data
|
||||||
return
|
return
|
||||||
elif data[-1] != '\n':
|
elif data[-1] != "\n":
|
||||||
split = data.rfind('\n') + 1
|
split = data.rfind("\n") + 1
|
||||||
self.partial_output = data[split:]
|
self.partial_output = data[split:]
|
||||||
data = data[:split]
|
data = data[:split]
|
||||||
else:
|
else:
|
||||||
@@ -45,16 +49,19 @@ class ShellCommand:
|
|||||||
self.gcode.respond_info(data)
|
self.gcode.respond_info(data)
|
||||||
|
|
||||||
cmd_RUN_SHELL_COMMAND_help = "Run a linux shell command"
|
cmd_RUN_SHELL_COMMAND_help = "Run a linux shell command"
|
||||||
|
|
||||||
def cmd_RUN_SHELL_COMMAND(self, params):
|
def cmd_RUN_SHELL_COMMAND(self, params):
|
||||||
gcode_params = params.get('PARAMS','')
|
gcode_params = params.get("PARAMS", "")
|
||||||
gcode_params = shlex.split(gcode_params)
|
gcode_params = shlex.split(gcode_params)
|
||||||
reactor = self.printer.get_reactor()
|
reactor = self.printer.get_reactor()
|
||||||
try:
|
try:
|
||||||
proc = subprocess.Popen(
|
proc = subprocess.Popen(
|
||||||
self.command + gcode_params, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
self.command + gcode_params,
|
||||||
|
stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.STDOUT,
|
||||||
|
)
|
||||||
except Exception:
|
except Exception:
|
||||||
logging.exception(
|
logging.exception("shell_command: Command {%s} failed" % (self.name))
|
||||||
"shell_command: Command {%s} failed" % (self.name))
|
|
||||||
raise self.gcode.error("Error running command {%s}" % (self.name))
|
raise self.gcode.error("Error running command {%s}" % (self.name))
|
||||||
if self.verbose:
|
if self.verbose:
|
||||||
self.proc_fd = proc.stdout.fileno()
|
self.proc_fd = proc.stdout.fileno()
|
||||||
@@ -64,7 +71,7 @@ class ShellCommand:
|
|||||||
endtime = eventtime + self.timeout
|
endtime = eventtime + self.timeout
|
||||||
complete = False
|
complete = False
|
||||||
while eventtime < endtime:
|
while eventtime < endtime:
|
||||||
eventtime = reactor.pause(eventtime + .05)
|
eventtime = reactor.pause(eventtime + 0.05)
|
||||||
if proc.poll() is not None:
|
if proc.poll() is not None:
|
||||||
complete = True
|
complete = True
|
||||||
break
|
break
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ trusted_clients:
|
|||||||
cors_domains:
|
cors_domains:
|
||||||
*.lan
|
*.lan
|
||||||
*.local
|
*.local
|
||||||
|
*.internal
|
||||||
*://localhost
|
*://localhost
|
||||||
*://localhost:*
|
*://localhost:*
|
||||||
*://my.mainsail.xyz
|
*://my.mainsail.xyz
|
||||||
|
|||||||
@@ -43,15 +43,17 @@ function backup_config_dir() {
|
|||||||
|
|
||||||
local i=0 folder folder_name target_dir
|
local i=0 folder folder_name target_dir
|
||||||
for folder in ${config_pathes}; do
|
for folder in ${config_pathes}; do
|
||||||
status_msg "Create backup of ${folder} ..."
|
if [[ -d ${folder} ]]; then
|
||||||
|
status_msg "Create backup of ${folder} ..."
|
||||||
|
|
||||||
folder_name=$(echo "${folder}" | rev | cut -d"/" -f2 | rev)
|
folder_name=$(echo "${folder}" | rev | cut -d"/" -f2 | rev)
|
||||||
target_dir="${BACKUP_DIR}/configs/${current_date}/${folder_name}"
|
target_dir="${BACKUP_DIR}/configs/${current_date}/${folder_name}"
|
||||||
mkdir -p "${target_dir}"
|
mkdir -p "${target_dir}"
|
||||||
cp -r "${folder}" "${target_dir}"
|
cp -r "${folder}" "${target_dir}"
|
||||||
i=$(( i + 1 ))
|
i=$(( i + 1 ))
|
||||||
|
|
||||||
ok_msg "Backup created in:\n${target_dir}"
|
ok_msg "Backup created in:\n${target_dir}"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
ok_msg "No config directory found! Skipping backup ..."
|
ok_msg "No config directory found! Skipping backup ..."
|
||||||
@@ -211,3 +213,19 @@ function backup_octoeverywhere() {
|
|||||||
print_error "Can't back up OctoEverywhere directory!\n Not found!"
|
print_error "Can't back up OctoEverywhere directory!\n Not found!"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function backup_spoolman() {
|
||||||
|
local current_date
|
||||||
|
|
||||||
|
if [[ -d ${SPOOLMAN_DIR} ]] ; then
|
||||||
|
status_msg "Creating Spoolman backup ..."
|
||||||
|
check_for_backup_dir
|
||||||
|
current_date=$(get_date)
|
||||||
|
status_msg "Timestamp: ${current_date}"
|
||||||
|
mkdir -p "${BACKUP_DIR}/Spoolman-backups/${current_date}"
|
||||||
|
cp -r "${SPOOLMAN_DIR}" "${_}" && cp -r "${SPOOLMAN_DB_DIR}/spoolman.db" "${_}"
|
||||||
|
print_confirm "Spoolman backup complete!"
|
||||||
|
else
|
||||||
|
print_error "Can't back up Spoolman directory!\n Not found!"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ function install_crowsnest(){
|
|||||||
pushd "${HOME}/crowsnest" &> /dev/null || exit 1
|
pushd "${HOME}/crowsnest" &> /dev/null || exit 1
|
||||||
title_msg "Installer will prompt you for sudo password!"
|
title_msg "Installer will prompt you for sudo password!"
|
||||||
status_msg "Launching crowsnest installer ..."
|
status_msg "Launching crowsnest installer ..."
|
||||||
if ! sudo make install BASE_USER=$USER; then
|
if ! sudo make install; then
|
||||||
error_msg "Something went wrong! Please try again..."
|
error_msg "Something went wrong! Please try again..."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -358,7 +358,6 @@ function get_usb_id() {
|
|||||||
unset mcu_list
|
unset mcu_list
|
||||||
sleep 1
|
sleep 1
|
||||||
mcus=$(find /dev/serial/by-id/* 2>/dev/null)
|
mcus=$(find /dev/serial/by-id/* 2>/dev/null)
|
||||||
mcus+=" $(find /dev/serial/by-path/* 2>/dev/null)"
|
|
||||||
|
|
||||||
for mcu in ${mcus}; do
|
for mcu in ${mcus}; do
|
||||||
mcu_list+=("${mcu}")
|
mcu_list+=("${mcu}")
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ function install_fluidd() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
### checking dependencies
|
### checking dependencies
|
||||||
local dep=(wget nginx)
|
local dep=(wget nginx unzip)
|
||||||
dependency_check "${dep[@]}"
|
dependency_check "${dep[@]}"
|
||||||
### detect conflicting Haproxy and Apache2 installations
|
### detect conflicting Haproxy and Apache2 installations
|
||||||
detect_conflicting_packages
|
detect_conflicting_packages
|
||||||
|
|||||||
@@ -83,4 +83,13 @@ function set_globals() {
|
|||||||
MOBILERAKER_DIR="${HOME}/mobileraker_companion"
|
MOBILERAKER_DIR="${HOME}/mobileraker_companion"
|
||||||
MOBILERAKER_REPO="https://github.com/Clon1998/mobileraker_companion.git"
|
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"
|
||||||
|
|
||||||
|
#=============== Spoolman ================#
|
||||||
|
SPOOLMAN_DIR="${HOME}/Spoolman"
|
||||||
|
SPOOLMAN_DB_DIR="${HOME}/.local/share/spoolman"
|
||||||
|
SPOOLMAN_REPO="https://api.github.com/repos/Donkie/Spoolman/releases/latest"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -280,7 +280,6 @@ function create_klipper_virtualenv() {
|
|||||||
status_msg "Installing $("python${python_version}" -V) virtual environment..."
|
status_msg "Installing $("python${python_version}" -V) virtual environment..."
|
||||||
|
|
||||||
if virtualenv -p "python${python_version}" "${KLIPPY_ENV}"; then
|
if virtualenv -p "python${python_version}" "${KLIPPY_ENV}"; then
|
||||||
(( python_version == 3 )) && "${KLIPPY_ENV}"/bin/pip install -U pip
|
|
||||||
"${KLIPPY_ENV}"/bin/pip install -r "${KLIPPER_DIR}"/scripts/klippy-requirements.txt
|
"${KLIPPY_ENV}"/bin/pip install -r "${KLIPPER_DIR}"/scripts/klippy-requirements.txt
|
||||||
else
|
else
|
||||||
log_error "failure while creating python3 klippy-env"
|
log_error "failure while creating python3 klippy-env"
|
||||||
@@ -304,6 +303,8 @@ function install_klipper_packages() {
|
|||||||
packages=$(grep "PKGLIST=" "${install_script}" | cut -d'"' -f2 | sed 's/\${PKGLIST}//g' | tr -d '\n')
|
packages=$(grep "PKGLIST=" "${install_script}" | cut -d'"' -f2 | sed 's/\${PKGLIST}//g' | tr -d '\n')
|
||||||
### add dfu-util for octopi-images
|
### add dfu-util for octopi-images
|
||||||
packages+=" dfu-util"
|
packages+=" dfu-util"
|
||||||
|
### add pkg-config for rp2040 build
|
||||||
|
packages+=" pkg-config"
|
||||||
### add dbus requirement for DietPi distro
|
### add dbus requirement for DietPi distro
|
||||||
[[ -e "/boot/dietpi/.version" ]] && packages+=" dbus"
|
[[ -e "/boot/dietpi/.version" ]] && packages+=" dbus"
|
||||||
|
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ function update_klipperscreen() {
|
|||||||
git checkout -f master && ok_msg "Checkout successfull"
|
git checkout -f master && ok_msg "Checkout successfull"
|
||||||
|
|
||||||
if [[ $(md5sum "${KLIPPERSCREEN_DIR}/scripts/KlipperScreen-requirements.txt" | cut -d " " -f1) != "${old_md5}" ]]; then
|
if [[ $(md5sum "${KLIPPERSCREEN_DIR}/scripts/KlipperScreen-requirements.txt" | cut -d " " -f1) != "${old_md5}" ]]; then
|
||||||
status_msg "New dependecies detected..."
|
status_msg "New dependencies detected..."
|
||||||
"${KLIPPERSCREEN_ENV}"/bin/pip install -r "${KLIPPERSCREEN_DIR}/scripts/KlipperScreen-requirements.txt"
|
"${KLIPPERSCREEN_ENV}"/bin/pip install -r "${KLIPPERSCREEN_DIR}/scripts/KlipperScreen-requirements.txt"
|
||||||
ok_msg "Dependencies have been installed!"
|
ok_msg "Dependencies have been installed!"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ function install_mainsail() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
### checking dependencies
|
### checking dependencies
|
||||||
local dep=(wget nginx)
|
local dep=(wget nginx unzip)
|
||||||
dependency_check "${dep[@]}"
|
dependency_check "${dep[@]}"
|
||||||
### detect conflicting Haproxy and Apache2 installations
|
### detect conflicting Haproxy and Apache2 installations
|
||||||
detect_conflicting_packages
|
detect_conflicting_packages
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ function update_mobileraker() {
|
|||||||
git checkout -f main && ok_msg "Checkout successfull"
|
git checkout -f main && ok_msg "Checkout successfull"
|
||||||
|
|
||||||
if [[ $(md5sum "${MOBILERAKER_DIR}/scripts/mobileraker-requirements.txt" | cut -d " " -f1) != "${old_md5}" ]]; then
|
if [[ $(md5sum "${MOBILERAKER_DIR}/scripts/mobileraker-requirements.txt" | cut -d " " -f1) != "${old_md5}" ]]; then
|
||||||
status_msg "New dependecies detected..."
|
status_msg "New dependencies detected..."
|
||||||
"${MOBILERAKER_ENV}"/bin/pip install -r "${MOBILERAKER_DIR}/scripts/mobileraker-requirements.txt"
|
"${MOBILERAKER_ENV}"/bin/pip install -r "${MOBILERAKER_DIR}/scripts/mobileraker-requirements.txt"
|
||||||
ok_msg "Dependencies have been installed!"
|
ok_msg "Dependencies have been installed!"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ function moonraker_systemd() {
|
|||||||
###
|
###
|
||||||
# any moonraker client that uses "moonraker" in its own name must be blacklisted using
|
# any moonraker client that uses "moonraker" in its own name must be blacklisted using
|
||||||
# this variable, otherwise they will be falsely recognized as moonraker instances
|
# this variable, otherwise they will be falsely recognized as moonraker instances
|
||||||
blacklist="obico"
|
blacklist="obico|hmi|telegram-bot"
|
||||||
|
|
||||||
ignore="${SYSTEMD}/moonraker-(${blacklist}).service"
|
ignore="${SYSTEMD}/moonraker-(${blacklist}).service"
|
||||||
match="${SYSTEMD}/moonraker(-[0-9a-zA-Z]+)?.service"
|
match="${SYSTEMD}/moonraker(-[0-9a-zA-Z]+)?.service"
|
||||||
@@ -142,12 +142,197 @@ function moonraker_setup_dialog() {
|
|||||||
|
|
||||||
function install_moonraker_dependencies() {
|
function install_moonraker_dependencies() {
|
||||||
local packages log_name="Moonraker"
|
local packages log_name="Moonraker"
|
||||||
local install_script="${MOONRAKER_DIR}/scripts/install-moonraker.sh"
|
local package_json="${MOONRAKER_DIR}/scripts/system-dependencies.json"
|
||||||
|
|
||||||
### read PKGLIST from official install-script
|
### read PKGLIST from official install-script
|
||||||
status_msg "Reading dependencies..."
|
status_msg "Reading dependencies..."
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
packages="$(grep "PKGLIST=" "${install_script}" | cut -d'"' -f2 | sed 's/\${PKGLIST}//g' | tr -d '\n')"
|
packages=$(python3 - << EOF
|
||||||
|
from __future__ import annotations
|
||||||
|
import shlex
|
||||||
|
import re
|
||||||
|
import pathlib
|
||||||
|
import logging
|
||||||
|
|
||||||
|
from typing import Tuple, Dict, List, Any
|
||||||
|
|
||||||
|
def _get_distro_info() -> Dict[str, Any]:
|
||||||
|
try:
|
||||||
|
import distro
|
||||||
|
except ModuleNotFoundError:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
return dict(
|
||||||
|
distro_id=distro.id(),
|
||||||
|
distro_version=distro.version(),
|
||||||
|
aliases=distro.like().split()
|
||||||
|
)
|
||||||
|
release_file = pathlib.Path("/etc/os-release")
|
||||||
|
release_info: Dict[str, str] = {}
|
||||||
|
with release_file.open("r") as f:
|
||||||
|
lexer = shlex.shlex(f, posix=True)
|
||||||
|
lexer.whitespace_split = True
|
||||||
|
for item in list(lexer):
|
||||||
|
if "=" in item:
|
||||||
|
key, val = item.split("=", maxsplit=1)
|
||||||
|
release_info[key] = val
|
||||||
|
return dict(
|
||||||
|
distro_id=release_info.get("ID", ""),
|
||||||
|
distro_version=release_info.get("VERSION_ID", ""),
|
||||||
|
aliases=release_info.get("ID_LIKE", "").split()
|
||||||
|
)
|
||||||
|
|
||||||
|
def _convert_version(version: str) -> Tuple[str | int, ...]:
|
||||||
|
version = version.strip()
|
||||||
|
ver_match = re.match(r"\d+(\.\d+)*((?:-|\.).+)?", version)
|
||||||
|
if ver_match is not None:
|
||||||
|
return tuple([
|
||||||
|
int(part) if part.isdigit() else part
|
||||||
|
for part in re.split(r"\.|-", version)
|
||||||
|
])
|
||||||
|
return (version,)
|
||||||
|
|
||||||
|
class SysDepsParser:
|
||||||
|
def __init__(self, distro_info: Dict[str, Any] | None = None) -> None:
|
||||||
|
if distro_info is None:
|
||||||
|
distro_info = _get_distro_info()
|
||||||
|
self.distro_id: str = distro_info.get("distro_id", "")
|
||||||
|
self.aliases: List[str] = distro_info.get("aliases", [])
|
||||||
|
self.distro_version: Tuple[int | str, ...] = tuple()
|
||||||
|
version = distro_info.get("distro_version")
|
||||||
|
if version:
|
||||||
|
self.distro_version = _convert_version(version)
|
||||||
|
self.vendor: str = ""
|
||||||
|
if pathlib.Path("/etc/rpi-issue").is_file():
|
||||||
|
self.vendor = "raspberry-pi"
|
||||||
|
|
||||||
|
def _parse_spec(self, full_spec: str) -> str | None:
|
||||||
|
parts = full_spec.split(";", maxsplit=1)
|
||||||
|
if len(parts) == 1:
|
||||||
|
return full_spec
|
||||||
|
pkg_name = parts[0].strip()
|
||||||
|
expressions = re.split(r"( and | or )", parts[1].strip())
|
||||||
|
if not len(expressions) & 1:
|
||||||
|
logging.info(
|
||||||
|
f"Requirement specifier is missing an expression "
|
||||||
|
f"between logical operators : {full_spec}"
|
||||||
|
)
|
||||||
|
return None
|
||||||
|
last_result: bool = True
|
||||||
|
last_logical_op: str | None = "and"
|
||||||
|
for idx, exp in enumerate(expressions):
|
||||||
|
if idx & 1:
|
||||||
|
if last_logical_op is not None:
|
||||||
|
logging.info(
|
||||||
|
"Requirement specifier contains sequential logical "
|
||||||
|
f"operators: {full_spec}"
|
||||||
|
)
|
||||||
|
return None
|
||||||
|
logical_op = exp.strip()
|
||||||
|
if logical_op not in ("and", "or"):
|
||||||
|
logging.info(
|
||||||
|
f"Invalid logical operator {logical_op} in requirement "
|
||||||
|
f"specifier: {full_spec}")
|
||||||
|
return None
|
||||||
|
last_logical_op = logical_op
|
||||||
|
continue
|
||||||
|
elif last_logical_op is None:
|
||||||
|
logging.info(
|
||||||
|
f"Requirement specifier contains two seqential expressions "
|
||||||
|
f"without a logical operator: {full_spec}")
|
||||||
|
return None
|
||||||
|
dep_parts = re.split(r"(==|!=|<=|>=|<|>)", exp.strip())
|
||||||
|
req_var = dep_parts[0].strip().lower()
|
||||||
|
if len(dep_parts) != 3:
|
||||||
|
logging.info(f"Invalid comparison, must be 3 parts: {full_spec}")
|
||||||
|
return None
|
||||||
|
elif req_var == "distro_id":
|
||||||
|
left_op: str | Tuple[int | str, ...] = self.distro_id
|
||||||
|
right_op = dep_parts[2].strip().strip("\"'")
|
||||||
|
elif req_var == "vendor":
|
||||||
|
left_op = self.vendor
|
||||||
|
right_op = dep_parts[2].strip().strip("\"'")
|
||||||
|
elif req_var == "distro_version":
|
||||||
|
if not self.distro_version:
|
||||||
|
logging.info(
|
||||||
|
"Distro Version not detected, cannot satisfy requirement: "
|
||||||
|
f"{full_spec}"
|
||||||
|
)
|
||||||
|
return None
|
||||||
|
left_op = self.distro_version
|
||||||
|
right_op = _convert_version(dep_parts[2].strip().strip("\"'"))
|
||||||
|
else:
|
||||||
|
logging.info(f"Invalid requirement specifier: {full_spec}")
|
||||||
|
return None
|
||||||
|
operator = dep_parts[1].strip()
|
||||||
|
try:
|
||||||
|
compfunc = {
|
||||||
|
"<": lambda x, y: x < y,
|
||||||
|
">": lambda x, y: x > y,
|
||||||
|
"==": lambda x, y: x == y,
|
||||||
|
"!=": lambda x, y: x != y,
|
||||||
|
">=": lambda x, y: x >= y,
|
||||||
|
"<=": lambda x, y: x <= y
|
||||||
|
}.get(operator, lambda x, y: False)
|
||||||
|
result = compfunc(left_op, right_op)
|
||||||
|
if last_logical_op == "and":
|
||||||
|
last_result &= result
|
||||||
|
else:
|
||||||
|
last_result |= result
|
||||||
|
last_logical_op = None
|
||||||
|
except Exception:
|
||||||
|
logging.exception(f"Error comparing requirements: {full_spec}")
|
||||||
|
return None
|
||||||
|
if last_result:
|
||||||
|
return pkg_name
|
||||||
|
return None
|
||||||
|
|
||||||
|
def parse_dependencies(self, sys_deps: Dict[str, List[str]]) -> List[str]:
|
||||||
|
if not self.distro_id:
|
||||||
|
logging.info(
|
||||||
|
"Failed to detect current distro ID, cannot parse dependencies"
|
||||||
|
)
|
||||||
|
return []
|
||||||
|
all_ids = [self.distro_id] + self.aliases
|
||||||
|
for distro_id in all_ids:
|
||||||
|
if distro_id in sys_deps:
|
||||||
|
if not sys_deps[distro_id]:
|
||||||
|
logging.info(
|
||||||
|
f"Dependency data contains an empty package definition "
|
||||||
|
f"for linux distro '{distro_id}'"
|
||||||
|
)
|
||||||
|
continue
|
||||||
|
processed_deps: List[str] = []
|
||||||
|
for dep in sys_deps[distro_id]:
|
||||||
|
parsed_dep = self._parse_spec(dep)
|
||||||
|
if parsed_dep is not None:
|
||||||
|
processed_deps.append(parsed_dep)
|
||||||
|
return processed_deps
|
||||||
|
else:
|
||||||
|
logging.info(
|
||||||
|
f"Dependency data has no package definition for linux "
|
||||||
|
f"distro '{self.distro_id}'"
|
||||||
|
)
|
||||||
|
return []
|
||||||
|
# *** SYSTEM DEPENDENCIES START ***
|
||||||
|
system_deps = {
|
||||||
|
"debian": [
|
||||||
|
"python3-virtualenv", "python3-dev", "libopenjp2-7", "libsodium-dev",
|
||||||
|
"zlib1g-dev", "libjpeg-dev", "packagekit",
|
||||||
|
"wireless-tools; distro_id != 'ubuntu' or distro_version <= '24.04'",
|
||||||
|
"iw; distro_id == 'ubuntu' and distro_version >= '24.10'",
|
||||||
|
"python3-libcamera; vendor == 'raspberry-pi' and distro_version >= '11'",
|
||||||
|
"curl", "build-essential"
|
||||||
|
],
|
||||||
|
}
|
||||||
|
# *** SYSTEM DEPENDENCIES END ***
|
||||||
|
parser = SysDepsParser()
|
||||||
|
pkgs = parser.parse_dependencies(system_deps)
|
||||||
|
if pkgs:
|
||||||
|
print(' '.join(pkgs), end="")
|
||||||
|
exit(0)
|
||||||
|
EOF
|
||||||
|
)
|
||||||
|
|
||||||
echo "${cyan}${packages}${white}" | tr '[:space:]' '\n'
|
echo "${cyan}${packages}${white}" | tr '[:space:]' '\n'
|
||||||
read -r -a packages <<< "${packages}"
|
read -r -a packages <<< "${packages}"
|
||||||
@@ -166,7 +351,6 @@ function create_moonraker_virtualenv() {
|
|||||||
[[ -d ${MOONRAKER_ENV} ]] && rm -rf "${MOONRAKER_ENV}"
|
[[ -d ${MOONRAKER_ENV} ]] && rm -rf "${MOONRAKER_ENV}"
|
||||||
|
|
||||||
if virtualenv -p /usr/bin/python3 "${MOONRAKER_ENV}"; then
|
if virtualenv -p /usr/bin/python3 "${MOONRAKER_ENV}"; then
|
||||||
"${MOONRAKER_ENV}"/bin/pip install -U pip
|
|
||||||
"${MOONRAKER_ENV}"/bin/pip install -r "${MOONRAKER_DIR}/scripts/moonraker-requirements.txt"
|
"${MOONRAKER_ENV}"/bin/pip install -r "${MOONRAKER_DIR}/scripts/moonraker-requirements.txt"
|
||||||
else
|
else
|
||||||
log_error "failure while creating python3 moonraker-env"
|
log_error "failure while creating python3 moonraker-env"
|
||||||
|
|||||||
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}"
|
||||||
|
}
|
||||||
281
scripts/spoolman.sh
Normal file
281
scripts/spoolman.sh
Normal file
@@ -0,0 +1,281 @@
|
|||||||
|
#!/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 #
|
||||||
|
#=======================================================================#
|
||||||
|
|
||||||
|
# Error Handling
|
||||||
|
set -e
|
||||||
|
|
||||||
|
function install_spoolman() {
|
||||||
|
|
||||||
|
pushd "${HOME}" &> /dev/null || exit 1
|
||||||
|
|
||||||
|
dependency_check curl jq
|
||||||
|
|
||||||
|
if [[ ! -d "${SPOOLMAN_DIR}" && -z "$(ls -A "${SPOOLMAN_DIR}" 2> /dev/null)" ]]; then
|
||||||
|
status_msg "Downloading spoolman..."
|
||||||
|
setup_spoolman_folder
|
||||||
|
status_msg "Downloading complete"
|
||||||
|
start_install_script
|
||||||
|
advanced_config_prompt
|
||||||
|
else
|
||||||
|
### In case spoolman is "incomplete" rerun install script
|
||||||
|
if get_spoolman_status | grep -q "Incomplete!"; then
|
||||||
|
start_install_script
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
ok_msg "Spoolman already installed"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
enable_moonraker_integration_prompt
|
||||||
|
patch_spoolman_update_manager
|
||||||
|
|
||||||
|
do_action_service "restart" "moonraker"
|
||||||
|
}
|
||||||
|
|
||||||
|
function update_spoolman() {
|
||||||
|
### stop and disable old spoolman service
|
||||||
|
do_action_service "stop" "Spoolman"
|
||||||
|
do_action_service "disable" "Spoolman"
|
||||||
|
|
||||||
|
mv "${SPOOLMAN_DIR}" "${SPOOLMAN_DIR}_old"
|
||||||
|
|
||||||
|
setup_spoolman_folder
|
||||||
|
cp "${SPOOLMAN_DIR}_old/.env" "${SPOOLMAN_DIR}/.env"
|
||||||
|
|
||||||
|
start_install_script
|
||||||
|
|
||||||
|
rm -rf "${SPOOLMAN_DIR}_old"
|
||||||
|
}
|
||||||
|
|
||||||
|
function remove_spoolman(){
|
||||||
|
if [[ -d "${SPOOLMAN_DIR}" ]]; then
|
||||||
|
status_msg "Removing spoolman service..."
|
||||||
|
do_action_service "stop" "Spoolman"
|
||||||
|
do_action_service "disable" "Spoolman"
|
||||||
|
sudo rm -f "${SYSTEMD}/Spoolman.service"
|
||||||
|
sudo systemctl daemon-reload
|
||||||
|
sudo systemctl reset-failed
|
||||||
|
ok_msg "Spoolman service removed!"
|
||||||
|
|
||||||
|
status_msg "Removing spoolman directory..."
|
||||||
|
rm -rf "${SPOOLMAN_DIR}"
|
||||||
|
ok_msg "Spoolman directory removed!"
|
||||||
|
fi
|
||||||
|
|
||||||
|
print_confirm "Spoolman successfully removed!"
|
||||||
|
}
|
||||||
|
|
||||||
|
function update_moonraker_configs() {
|
||||||
|
local 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)
|
||||||
|
|
||||||
|
for conf in ${moonraker_configs}; do
|
||||||
|
if ! grep -Eq "^\[update_manager Spoolman\]\s*$" "${conf}"; then
|
||||||
|
### add new line to conf if it doesn't end with one
|
||||||
|
[[ $(tail -c1 "${conf}" | wc -l) -eq 0 ]] && echo "" >> "${conf}"
|
||||||
|
/bin/sh -c "cat >> ${conf}" << MOONRAKER_CONF
|
||||||
|
${1}
|
||||||
|
MOONRAKER_CONF
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
function enable_moonraker_integration() {
|
||||||
|
local integration_str env_port
|
||||||
|
# get spoolman port from .env
|
||||||
|
env_port=$(grep "^SPOOLMAN_PORT=" "${SPOOLMAN_DIR}/.env" | cut -d"=" -f2)
|
||||||
|
|
||||||
|
integration_str="
|
||||||
|
[spoolman]
|
||||||
|
server: http://$(hostname -I | cut -d" " -f1):${env_port}
|
||||||
|
"
|
||||||
|
|
||||||
|
status_msg "Adding Spoolman integration..."
|
||||||
|
update_moonraker_configs "${integration_str}"
|
||||||
|
}
|
||||||
|
|
||||||
|
function patch_spoolman_update_manager() {
|
||||||
|
local updater_str
|
||||||
|
updater_str="
|
||||||
|
[update_manager Spoolman]
|
||||||
|
type: zip
|
||||||
|
channel: stable
|
||||||
|
repo: Donkie/Spoolman
|
||||||
|
path: ${SPOOLMAN_DIR}
|
||||||
|
virtualenv: .venv
|
||||||
|
requirements: requirements.txt
|
||||||
|
persistent_files:
|
||||||
|
.venv
|
||||||
|
.env
|
||||||
|
managed_services: Spoolman
|
||||||
|
"
|
||||||
|
|
||||||
|
update_moonraker_configs "${updater_str}"
|
||||||
|
|
||||||
|
# add spoolman service to moonraker.asvc
|
||||||
|
local moonraker_asvc regex
|
||||||
|
regex="${HOME//\//\\/}\/([A-Za-z0-9_]+)\/moonraker\.asvc"
|
||||||
|
moonraker_asvc=$(find "${HOME}" -maxdepth 2 -type f -regextype posix-extended -regex "${regex}" | sort)
|
||||||
|
|
||||||
|
if ! grep -q "^Spoolman$" "${moonraker_asvc}"; then
|
||||||
|
status_msg "Adding Spoolman service to moonraker.asvc..."
|
||||||
|
sed -i '$a''Spoolman' "${moonraker_asvc}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function advanced_config_prompt() {
|
||||||
|
local reply
|
||||||
|
while true; do
|
||||||
|
read -erp "${cyan}###### Continue with default configuration? (Y/n):${white} " reply
|
||||||
|
case "${reply}" in
|
||||||
|
Y|y|Yes|yes|"")
|
||||||
|
select_msg "Yes"
|
||||||
|
break;;
|
||||||
|
N|n|No|no)
|
||||||
|
select_msg "No"
|
||||||
|
advanced_config
|
||||||
|
break;;
|
||||||
|
*)
|
||||||
|
error_msg "Invalid Input!\n";;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
function enable_moonraker_integration_prompt() {
|
||||||
|
local reply
|
||||||
|
while true; do
|
||||||
|
read -erp "${cyan}###### Enable Moonraker integration? (Y/n):${white} " reply
|
||||||
|
case "${reply}" in
|
||||||
|
Y|y|Yes|yes|"")
|
||||||
|
select_msg "Yes"
|
||||||
|
enable_moonraker_integration
|
||||||
|
break;;
|
||||||
|
N|n|No|no)
|
||||||
|
select_msg "No"
|
||||||
|
break;;
|
||||||
|
*)
|
||||||
|
error_msg "Invalid Input!\n";;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
function advanced_config() {
|
||||||
|
status_msg "###### Advanced configuration"
|
||||||
|
|
||||||
|
local reply
|
||||||
|
while true; do
|
||||||
|
read -erp "${cyan}###### Select spoolman port (7912):${white} " reply
|
||||||
|
### set default
|
||||||
|
if [[ -z "${reply}" ]]; then
|
||||||
|
reply="7912"
|
||||||
|
fi
|
||||||
|
|
||||||
|
select_msg "${reply}"
|
||||||
|
### check if port is valid
|
||||||
|
if ! [[ "${reply}" =~ ^[0-9]+$ && "${reply}" -ge 1024 && "${reply}" -le 65535 ]]; then
|
||||||
|
error_msg "Invalid port number!\n"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
### update .env
|
||||||
|
sed -i "s/^SPOOLMAN_PORT=.*$/SPOOLMAN_PORT=${reply}/" "${SPOOLMAN_DIR}/.env"
|
||||||
|
do_action_service "restart" "Spoolman"
|
||||||
|
break
|
||||||
|
done
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
function setup_spoolman_folder() {
|
||||||
|
local source_url
|
||||||
|
### get latest spoolman release url
|
||||||
|
source_url="$(curl -s "${SPOOLMAN_REPO}" | jq -r '.assets[] | select(.name == "spoolman.zip").browser_download_url')"
|
||||||
|
|
||||||
|
mkdir -p "${SPOOLMAN_DIR}"
|
||||||
|
curl -sSL "${source_url}" -o /tmp/temp.zip
|
||||||
|
unzip /tmp/temp.zip -d "${SPOOLMAN_DIR}" &> /dev/null
|
||||||
|
rm /tmp/temp.zip
|
||||||
|
|
||||||
|
chmod +x "${SPOOLMAN_DIR}"/scripts/install.sh
|
||||||
|
}
|
||||||
|
|
||||||
|
function start_install_script() {
|
||||||
|
|
||||||
|
pushd "${SPOOLMAN_DIR}" &> /dev/null || exit 1
|
||||||
|
|
||||||
|
if bash ./scripts/install.sh; then
|
||||||
|
ok_msg "Spoolman successfully installed!"
|
||||||
|
else
|
||||||
|
print_error "Spoolman installation failed!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_spoolman_status() {
|
||||||
|
local -a files
|
||||||
|
files=(
|
||||||
|
"${SPOOLMAN_DIR}"
|
||||||
|
"${SYSTEMD}/Spoolman.service"
|
||||||
|
"${SPOOLMAN_DB_DIR}"
|
||||||
|
)
|
||||||
|
|
||||||
|
local count
|
||||||
|
count=0
|
||||||
|
|
||||||
|
for file in "${files[@]}"; do
|
||||||
|
[[ -e "${file}" ]] && count=$(( count +1 ))
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ "${count}" -eq "${#files[*]}" ]]; then
|
||||||
|
echo "Installed"
|
||||||
|
elif [[ "${count}" -gt 0 ]]; then
|
||||||
|
echo "Incomplete!"
|
||||||
|
else
|
||||||
|
echo "Not installed!"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_local_spoolman_version() {
|
||||||
|
[[ ! -d "${SPOOLMAN_DIR}" ]] && return
|
||||||
|
|
||||||
|
local version
|
||||||
|
version=$(grep -o '"version":\s*"[^"]*' "${SPOOLMAN_DIR}"/release_info.json | cut -d'"' -f4)
|
||||||
|
echo "${version}"
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_remote_spoolman_version() {
|
||||||
|
[[ ! -d "${SPOOLMAN_DIR}" ]] && return
|
||||||
|
|
||||||
|
local version
|
||||||
|
version=$(curl -s "${SPOOLMAN_REPO}" | grep -o '"tag_name":\s*"v[^"]*"' | cut -d'"' -f4)
|
||||||
|
echo "${version}"
|
||||||
|
}
|
||||||
|
|
||||||
|
function compare_spoolman_versions() {
|
||||||
|
local local_ver remote_ver
|
||||||
|
local_ver="$(get_local_spoolman_version)"
|
||||||
|
remote_ver="$(get_remote_spoolman_version)"
|
||||||
|
|
||||||
|
if [[ ${local_ver} != "${remote_ver}" ]]; then
|
||||||
|
versions="${yellow}$(printf " %-14s" "${local_ver}")${white}"
|
||||||
|
versions+="|${green}$(printf " %-13s" "${remote_ver}")${white}"
|
||||||
|
# add spoolman to application_updates_available in kiauh.ini
|
||||||
|
add_to_application_updates "spoolman"
|
||||||
|
else
|
||||||
|
versions="${green}$(printf " %-14s" "${local_ver}")${white}"
|
||||||
|
versions+="|${green}$(printf " %-13s" "${remote_ver}")${white}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "${versions}"
|
||||||
|
}
|
||||||
@@ -26,6 +26,7 @@ function backup_ui() {
|
|||||||
echo -e "| Klipper Webinterface: | Other: |"
|
echo -e "| Klipper Webinterface: | Other: |"
|
||||||
echo -e "| 5) [Mainsail] | 9) [Telegram Bot] |"
|
echo -e "| 5) [Mainsail] | 9) [Telegram Bot] |"
|
||||||
echo -e "| 6) [Fluidd] | 10) [OctoEverywhere] |"
|
echo -e "| 6) [Fluidd] | 10) [OctoEverywhere] |"
|
||||||
|
echo -e "| | 11) [Spoolman] |"
|
||||||
back_footer
|
back_footer
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,6 +57,8 @@ function backup_menu() {
|
|||||||
do_action "backup_telegram_bot" "backup_ui";;
|
do_action "backup_telegram_bot" "backup_ui";;
|
||||||
10)
|
10)
|
||||||
do_action "backup_octoeverywhere" "backup_ui";;
|
do_action "backup_octoeverywhere" "backup_ui";;
|
||||||
|
11)
|
||||||
|
do_action "backup_spoolman" "backup_ui";;
|
||||||
B|b)
|
B|b)
|
||||||
clear; main_menu; break;;
|
clear; main_menu; break;;
|
||||||
*)
|
*)
|
||||||
|
|||||||
@@ -19,18 +19,19 @@ function install_ui() {
|
|||||||
echo -e "| all necessary dependencies for the various |"
|
echo -e "| all necessary dependencies for the various |"
|
||||||
echo -e "| functions on a completely fresh system. |"
|
echo -e "| functions on a completely fresh system. |"
|
||||||
hr
|
hr
|
||||||
echo -e "| Firmware & API: | 3rd Party Webinterface: |"
|
echo -e "| Firmware & API: | Other: |"
|
||||||
echo -e "| 1) [Klipper] | 6) [OctoPrint] |"
|
echo -e "| 1) [Klipper] | 7) [PrettyGCode] |"
|
||||||
echo -e "| 2) [Moonraker] | |"
|
echo -e "| 2) [Moonraker] | 8) [Telegram Bot] |"
|
||||||
echo -e "| | Other: |"
|
echo -e "| | 9) $(obico_install_title) |"
|
||||||
echo -e "| Klipper Webinterface: | 7) [PrettyGCode] |"
|
echo -e "| Klipper Webinterface: | 10) [OctoEverywhere] |"
|
||||||
echo -e "| 3) [Mainsail] | 8) [Telegram Bot] |"
|
echo -e "| 3) [Mainsail] | 11) [Mobileraker] |"
|
||||||
echo -e "| 4) [Fluidd] | 9) $(obico_install_title) |"
|
echo -e "| 4) [Fluidd] | 12) [OctoApp for Klipper] |"
|
||||||
echo -e "| | 10) [OctoEverywhere] |"
|
echo -e "| | 13) [Spoolman] |"
|
||||||
echo -e "| | 11) [Mobileraker] |"
|
|
||||||
echo -e "| Touchscreen GUI: | |"
|
echo -e "| Touchscreen GUI: | |"
|
||||||
echo -e "| 5) [KlipperScreen] | Webcam Streamer: |"
|
echo -e "| 5) [KlipperScreen] | Webcam Streamer: |"
|
||||||
echo -e "| | 12) [Crowsnest] |"
|
echo -e "| | 14) [Crowsnest] |"
|
||||||
|
echo -e "| 3rd Party Webinterface: | |"
|
||||||
|
echo -e "| 6) [OctoPrint] | |"
|
||||||
back_footer
|
back_footer
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,6 +73,10 @@ function install_menu() {
|
|||||||
11)
|
11)
|
||||||
do_action "install_mobileraker" "install_ui";;
|
do_action "install_mobileraker" "install_ui";;
|
||||||
12)
|
12)
|
||||||
|
do_action "octoapp_setup_dialog" "install_ui";;
|
||||||
|
13)
|
||||||
|
do_action "install_spoolman" "install_ui";;
|
||||||
|
14)
|
||||||
do_action "install_crowsnest" "install_ui";;
|
do_action "install_crowsnest" "install_ui";;
|
||||||
B|b)
|
B|b)
|
||||||
clear; main_menu; break;;
|
clear; main_menu; break;;
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ function main_ui() {
|
|||||||
echo -e "| | Obico: $(print_status "moonraker_obico")|"
|
echo -e "| | Obico: $(print_status "moonraker_obico")|"
|
||||||
echo -e "| | OctoEverywhere: $(print_status "octoeverywhere")|"
|
echo -e "| | OctoEverywhere: $(print_status "octoeverywhere")|"
|
||||||
echo -e "| | Mobileraker: $(print_status "mobileraker")|"
|
echo -e "| | Mobileraker: $(print_status "mobileraker")|"
|
||||||
|
echo -e "| | OctoApp: $(print_status "octoapp")|"
|
||||||
|
echo -e "| | Spoolman: $(print_status "spoolman")|"
|
||||||
echo -e "| | |"
|
echo -e "| | |"
|
||||||
echo -e "| | Octoprint: $(print_status "octoprint")|"
|
echo -e "| | Octoprint: $(print_status "octoprint")|"
|
||||||
hr
|
hr
|
||||||
@@ -38,7 +40,7 @@ function main_ui() {
|
|||||||
function get_kiauh_version() {
|
function get_kiauh_version() {
|
||||||
local version
|
local version
|
||||||
cd "${KIAUH_SRCDIR}"
|
cd "${KIAUH_SRCDIR}"
|
||||||
version="$(git describe HEAD --always --tags | cut -d "-" -f 1,2)"
|
version="$(git tag -l 'v5*' | tail -1)"
|
||||||
echo "${version}"
|
echo "${version}"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,9 +93,6 @@ function main_menu() {
|
|||||||
clear && print_header
|
clear && print_header
|
||||||
main_ui
|
main_ui
|
||||||
|
|
||||||
### initialize kiauh.ini
|
|
||||||
init_ini
|
|
||||||
|
|
||||||
local action
|
local action
|
||||||
while true; do
|
while true; do
|
||||||
read -p "${cyan}####### Perform action:${white} " action
|
read -p "${cyan}####### Perform action:${white} " action
|
||||||
|
|||||||
@@ -17,20 +17,21 @@ function remove_ui() {
|
|||||||
hr
|
hr
|
||||||
echo -e "| ${yellow}INFO: Configurations and/or any backups will be kept!${white} |"
|
echo -e "| ${yellow}INFO: Configurations and/or any backups will be kept!${white} |"
|
||||||
hr
|
hr
|
||||||
echo -e "| Firmware & API: | 3rd Party Webinterface: |"
|
echo -e "| Firmware & API: | Webcam Streamer: |"
|
||||||
echo -e "| 1) [Klipper] | 8) [OctoPrint] |"
|
echo -e "| 1) [Klipper] | 9) [Crowsnest] |"
|
||||||
echo -e "| 2) [Moonraker] | |"
|
echo -e "| 2) [Moonraker] | 10) [MJPG-Streamer] |"
|
||||||
echo -e "| | Webcam Streamer: |"
|
echo -e "| | |"
|
||||||
echo -e "| Klipper Webinterface: | 9) [Crowsnest] |"
|
echo -e "| Klipper Webinterface: | Other: |"
|
||||||
echo -e "| 3) [Mainsail] | 10) [MJPG-Streamer] |"
|
echo -e "| 3) [Mainsail] | 11) [PrettyGCode] |"
|
||||||
echo -e "| 4) [Mainsail-Config] | |"
|
echo -e "| 4) [Mainsail-Config] | 12) [Telegram Bot] |"
|
||||||
echo -e "| 5) [Fluidd] | Other: |"
|
echo -e "| 5) [Fluidd] | 13) [Obico for Klipper] |"
|
||||||
echo -e "| 6) [Fluidd-Config] | 11) [PrettyGCode] |"
|
echo -e "| 6) [Fluidd-Config] | 14) [OctoEverywhere] |"
|
||||||
echo -e "| | 12) [Telegram Bot] |"
|
|
||||||
echo -e "| Touchscreen GUI: | 13) [Obico for Klipper] |"
|
|
||||||
echo -e "| 7) [KlipperScreen] | 14) [OctoEverywhere] |"
|
|
||||||
echo -e "| | 15) [Mobileraker] |"
|
echo -e "| | 15) [Mobileraker] |"
|
||||||
echo -e "| | 16) [NGINX] |"
|
echo -e "| Touchscreen GUI: | 16) [NGINX] |"
|
||||||
|
echo -e "| 7) [KlipperScreen] | 17) [OctoApp] |"
|
||||||
|
echo -e "| | 18) [Spoolman] |"
|
||||||
|
echo -e "| 3rd Party Webinterface: | |"
|
||||||
|
echo -e "| 8) [OctoPrint] | |"
|
||||||
back_footer
|
back_footer
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,6 +74,10 @@ function remove_menu() {
|
|||||||
do_action "remove_mobileraker" "remove_ui";;
|
do_action "remove_mobileraker" "remove_ui";;
|
||||||
16)
|
16)
|
||||||
do_action "remove_nginx" "remove_ui";;
|
do_action "remove_nginx" "remove_ui";;
|
||||||
|
17)
|
||||||
|
do_action "remove_octoapp" "remove_ui";;
|
||||||
|
18)
|
||||||
|
do_action "remove_spoolman" "remove_ui";;
|
||||||
B|b)
|
B|b)
|
||||||
clear; main_menu; break;;
|
clear; main_menu; break;;
|
||||||
*)
|
*)
|
||||||
|
|||||||
@@ -35,15 +35,17 @@ function update_ui() {
|
|||||||
echo -e "| 9) [OctoEverywhere] |$(compare_octoeverywhere_versions)|"
|
echo -e "| 9) [OctoEverywhere] |$(compare_octoeverywhere_versions)|"
|
||||||
echo -e "| 10) [Mobileraker] |$(compare_mobileraker_versions)|"
|
echo -e "| 10) [Mobileraker] |$(compare_mobileraker_versions)|"
|
||||||
echo -e "| 11) [Crowsnest] |$(compare_crowsnest_versions)|"
|
echo -e "| 11) [Crowsnest] |$(compare_crowsnest_versions)|"
|
||||||
|
echo -e "| 12) [OctoApp] |$(compare_octoapp_versions)|"
|
||||||
|
echo -e "| 13) [Spoolman] |$(compare_spoolman_versions)|"
|
||||||
echo -e "| |------------------------------|"
|
echo -e "| |------------------------------|"
|
||||||
echo -e "| 12) [System] | $(check_system_updates) |"
|
echo -e "| 14) [System] | $(check_system_updates) |"
|
||||||
back_footer
|
back_footer
|
||||||
}
|
}
|
||||||
|
|
||||||
function update_menu() {
|
function update_menu() {
|
||||||
clear -x && sudo true && clear -x # (re)cache sudo credentials so password prompt doesn't bork ui
|
clear -x && sudo true && clear -x # (re)cache sudo credentials so password prompt doesn't bork ui
|
||||||
do_action "" "update_ui"
|
do_action "" "update_ui"
|
||||||
|
|
||||||
local action
|
local action
|
||||||
while true; do
|
while true; do
|
||||||
read -p "${cyan}####### Perform action:${white} " action
|
read -p "${cyan}####### Perform action:${white} " action
|
||||||
@@ -73,6 +75,10 @@ function update_menu() {
|
|||||||
11)
|
11)
|
||||||
do_action "update_crowsnest" "update_ui";;
|
do_action "update_crowsnest" "update_ui";;
|
||||||
12)
|
12)
|
||||||
|
do_action "update_octoapp" "update_ui";;
|
||||||
|
13)
|
||||||
|
do_action "update_spoolman" "update_ui";;
|
||||||
|
14)
|
||||||
do_action "upgrade_system_packages" "update_ui";;
|
do_action "upgrade_system_packages" "update_ui";;
|
||||||
a)
|
a)
|
||||||
do_action "update_all" "update_ui";;
|
do_action "update_all" "update_ui";;
|
||||||
@@ -98,7 +104,7 @@ function update_all() {
|
|||||||
print_confirm "Everything is already up-to-date!"
|
print_confirm "Everything is already up-to-date!"
|
||||||
echo; break
|
echo; break
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo
|
echo
|
||||||
top_border
|
top_border
|
||||||
echo -e "| The following installations will be updated: |"
|
echo -e "| The following installations will be updated: |"
|
||||||
@@ -118,6 +124,9 @@ function update_all() {
|
|||||||
[[ "${update_arr[*]}" =~ "klipperscreen" ]] && \
|
[[ "${update_arr[*]}" =~ "klipperscreen" ]] && \
|
||||||
echo -e "| ${cyan}● KlipperScreen${white} |"
|
echo -e "| ${cyan}● KlipperScreen${white} |"
|
||||||
|
|
||||||
|
[[ "${update_arr[*]}" =~ "spoolman" ]] && \
|
||||||
|
echo -e "| ${cyan}● SpoolMan${white} |"
|
||||||
|
|
||||||
[[ "${update_arr[*]}" =~ "pgc_for_klipper" ]] && \
|
[[ "${update_arr[*]}" =~ "pgc_for_klipper" ]] && \
|
||||||
echo -e "| ${cyan}● PrettyGCode for Klipper${white} |"
|
echo -e "| ${cyan}● PrettyGCode for Klipper${white} |"
|
||||||
|
|
||||||
@@ -128,13 +137,16 @@ function update_all() {
|
|||||||
echo -e "| ${cyan}● OctoEverywhere${white} |"
|
echo -e "| ${cyan}● OctoEverywhere${white} |"
|
||||||
|
|
||||||
[[ "${update_arr[*]}" =~ "mobileraker" ]] && \
|
[[ "${update_arr[*]}" =~ "mobileraker" ]] && \
|
||||||
echo -e "| ${cyan}● Mobileraker${white} |"
|
echo -e "| ${cyan}● Mobileraker${white} |"
|
||||||
|
|
||||||
|
[[ "${update_arr[*]}" =~ "octoapp" ]] && \
|
||||||
|
echo -e "| ${cyan}● OctoApp${white} |"
|
||||||
|
|
||||||
[[ "${update_arr[*]}" =~ "system" ]] && \
|
[[ "${update_arr[*]}" =~ "system" ]] && \
|
||||||
echo -e "| ${cyan}● System${white} |"
|
echo -e "| ${cyan}● System${white} |"
|
||||||
|
|
||||||
bottom_border
|
bottom_border
|
||||||
|
|
||||||
local yn
|
local yn
|
||||||
read -p "${cyan}###### Do you want to proceed? (Y/n):${white} " yn
|
read -p "${cyan}###### Do you want to proceed? (Y/n):${white} " yn
|
||||||
case "${yn}" in
|
case "${yn}" in
|
||||||
|
|||||||
@@ -28,6 +28,21 @@ function check_euid() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function check_if_ratos() {
|
||||||
|
if [[ -n $(which ratos) ]]; then
|
||||||
|
echo -e "${red}"
|
||||||
|
top_border
|
||||||
|
echo -e "| !!! RatOS 2.1 or greater detected !!! |"
|
||||||
|
echo -e "| |"
|
||||||
|
echo -e "| KIAUH does currently not support RatOS. |"
|
||||||
|
echo -e "| If you have any questions, please ask for help on the |"
|
||||||
|
echo -e "| RatRig Community Discord: https://discord.gg/ratrig |"
|
||||||
|
bottom_border
|
||||||
|
echo -e "${white}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
#================================================#
|
#================================================#
|
||||||
#============= MESSAGE FORMATTING ===============#
|
#============= MESSAGE FORMATTING ===============#
|
||||||
#================================================#
|
#================================================#
|
||||||
@@ -178,6 +193,10 @@ function init_ini() {
|
|||||||
echo -e "\nmulti_instance_names=\c" >> "${INI_FILE}"
|
echo -e "\nmulti_instance_names=\c" >> "${INI_FILE}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if ! grep -Eq "^version_to_launch=" "${INI_FILE}"; then
|
||||||
|
echo -e "\nversion_to_launch=\n\c" >> "${INI_FILE}"
|
||||||
|
fi
|
||||||
|
|
||||||
### strip all empty lines out of the file
|
### strip all empty lines out of the file
|
||||||
sed -i "/^[[:blank:]]*$/ d" "${INI_FILE}"
|
sed -i "/^[[:blank:]]*$/ d" "${INI_FILE}"
|
||||||
}
|
}
|
||||||
@@ -362,9 +381,9 @@ function create_required_folders() {
|
|||||||
|
|
||||||
function update_system_package_lists() {
|
function update_system_package_lists() {
|
||||||
local cache_mtime update_age update_interval silent
|
local cache_mtime update_age update_interval silent
|
||||||
|
|
||||||
if [[ $1 == '--silent' ]]; then silent="true"; fi
|
if [[ $1 == '--silent' ]]; then silent="true"; fi
|
||||||
|
|
||||||
if [[ -e /var/lib/apt/periodic/update-success-stamp ]]; then
|
if [[ -e /var/lib/apt/periodic/update-success-stamp ]]; then
|
||||||
cache_mtime="$(stat -c %Y /var/lib/apt/periodic/update-success-stamp)"
|
cache_mtime="$(stat -c %Y /var/lib/apt/periodic/update-success-stamp)"
|
||||||
elif [[ -e /var/lib/apt/lists ]]; then
|
elif [[ -e /var/lib/apt/lists ]]; then
|
||||||
@@ -396,10 +415,10 @@ function update_system_package_lists() {
|
|||||||
function check_system_updates() {
|
function check_system_updates() {
|
||||||
local updates_avail status
|
local updates_avail status
|
||||||
if ! update_system_package_lists --silent; then
|
if ! update_system_package_lists --silent; then
|
||||||
status="${red}Update check failed! ${white}"
|
status="${red}Update check failed! ${white}"
|
||||||
else
|
else
|
||||||
updates_avail="$(apt list --upgradeable 2>/dev/null | sed "1d")"
|
updates_avail="$(apt list --upgradeable 2>/dev/null | sed "1d")"
|
||||||
|
|
||||||
if [[ -n ${updates_avail} ]]; then
|
if [[ -n ${updates_avail} ]]; then
|
||||||
status="${yellow}System upgrade available!${white}"
|
status="${yellow}System upgrade available!${white}"
|
||||||
# add system to application_updates_available in kiauh.ini
|
# add system to application_updates_available in kiauh.ini
|
||||||
@@ -408,7 +427,7 @@ function check_system_updates() {
|
|||||||
status="${green}System up to date! ${white}"
|
status="${green}System up to date! ${white}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "${status}"
|
echo "${status}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user