mirror of
https://github.com/dw-0/kiauh.git
synced 2025-12-18 21:24:28 +05:00
Merge pull request #38 from th33xitus/work-fluidd
Fix KIAUH for update to Fluidd
This commit is contained in:
@@ -4,6 +4,10 @@
|
||||
|
||||
---
|
||||
|
||||
## **📋 Please see the [Changelog](docs/changelog.md) for possible important information !**
|
||||
|
||||
---
|
||||
|
||||
## **📢 Disclaimer: Usage of this script happens at your own risk!**
|
||||
|
||||
This script acts as a helping hand for you to get set up in a fast and comfortable way.\
|
||||
@@ -62,7 +66,6 @@ Feel free to check out his work.
|
||||
|
||||
## **📝 Notes:**
|
||||
|
||||
- ### **Important changes to the script will be listed in the [Changelog](docs/changelog.md)**
|
||||
- Tested **only** on Raspberry Pi OS Lite (Debian Buster)
|
||||
- During the use of this script you might be asked for your sudo password. There are several functions involved which need sudo privileges.
|
||||
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
|
||||
This document covers possible important changes to KIAUH.
|
||||
|
||||
### 2020-11-18
|
||||
|
||||
* Some changes to Fluidd caused a little rework on how KIAUH will install/update Fluidd from now on. Please see the [fluidd v1.0.0-rc0 release notes](https://github.com/cadriel/fluidd/releases/tag/v1.0.0-rc.0) for further information about what modifications to the moonraker.conf file exactly had to be done. In a nutshell, KIAUH will now always patch the required entries to the moonraker.conf if not already there.
|
||||
|
||||
### 2020-10-30:
|
||||
|
||||
* The user can now choose to install Klipper as a systemd service.
|
||||
|
||||
@@ -239,8 +239,36 @@ fluidd_setup(){
|
||||
#write fluidd version to file for update check reasons
|
||||
status_msg "Writing Fluidd version to file ..."
|
||||
get_fluidd_ver && echo $FLUIDD_VERSION > $FLUIDD_DIR/version && ok_msg "Done!"
|
||||
#patch moonraker.conf to apply cors domains if needed
|
||||
backup_moonraker_conf
|
||||
patch_moonraker
|
||||
#delete downloaded zip
|
||||
status_msg "Remove downloaded archive ..."
|
||||
rm -rf *.zip && ok_msg "Done!" && ok_msg "Fluidd installation complete!"
|
||||
echo
|
||||
}
|
||||
|
||||
patch_moonraker(){
|
||||
mr_conf=${HOME}/moonraker.conf
|
||||
# looking for a cors_domain entry in moonraker.conf
|
||||
if [ ! "$(grep "^cors_domains:$" $mr_conf)" ]; then
|
||||
#find trusted_clients line number and subtract one, to insert cors_domains later
|
||||
line="$(grep -n "trusted_clients:" $mr_conf | cut -d":" -f1)i"
|
||||
sed -i "$line cors_domains:" $mr_conf
|
||||
mr_restart="true"
|
||||
fi
|
||||
if [ "$(grep "^cors_domains:$" $mr_conf)" ]; then
|
||||
hostname=$(hostname -I | cut -d" " -f1)
|
||||
url1="\ \ \ \ http://*.local"
|
||||
url2="\ \ \ \ http://app.fluidd.xyz"
|
||||
url3="\ \ \ \ https://app.fluidd.xyz"
|
||||
url4="\ \ \ \ http://$hostname:*"
|
||||
#find cors_domains line number and add one, to insert urls later
|
||||
line="$(expr $(grep -n "cors_domains:" $mr_conf | cut -d":" -f1) + 1)i"
|
||||
[ ! "$(grep -E '^\s+http:\/\/\*\.local$' $mr_conf)" ] && sed -i "$line $url1" $mr_conf && mr_restart="true"
|
||||
[ ! "$(grep -E '^\s+http:\/\/app\.fluidd\.xyz$' $mr_conf)" ] && sed -i "$line $url2" $mr_conf && mr_restart="true"
|
||||
[ ! "$(grep -E '^\s+https:\/\/app\.fluidd\.xyz$' $mr_conf)" ] && sed -i "$line $url3" $mr_conf && mr_restart="true"
|
||||
[ ! "$(grep -E '^\s+http:\/\/([0-9]{1,3}\.){3}[0-9]{1,3}' $mr_conf)" ] && sed -i "$line $url4" $mr_conf && mr_restart="true"
|
||||
fi
|
||||
[ "$mr_restart" == "true" ] && restart_moonraker
|
||||
}
|
||||
Reference in New Issue
Block a user