refactor(mainsail): apply necessary changes for moonraker PR 491
Signed-off-by: Dominik Willner <th33xitus@gmail.com>
This commit is contained in:
@@ -124,9 +124,11 @@ function install_mainsail_macros() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function download_mainsail_macros() {
|
function download_mainsail_macros() {
|
||||||
local ms_cfg="https://raw.githubusercontent.com/mainsail-crew/MainsailOS/master/src/modules/mainsail/filesystem/home/pi/klipper_config/mainsail.cfg"
|
local ms_cfg path configs regex
|
||||||
local configs path
|
|
||||||
configs=$(find "${KLIPPER_CONFIG}" -type f -name "printer.cfg" | sort)
|
ms_cfg="https://raw.githubusercontent.com/mainsail-crew/MainsailOS/master/src/modules/mainsail/filesystem/home/pi/klipper_config/mainsail.cfg"
|
||||||
|
regex="\/home\/${USER}\/([A-Za-z0-9_]+)\/config\/printer\.cfg"
|
||||||
|
configs=$(find "${HOME}" -maxdepth 3 -regextype posix-extended -regex "${regex}" | sort)
|
||||||
|
|
||||||
if [[ -n ${configs} ]]; then
|
if [[ -n ${configs} ]]; then
|
||||||
for config in ${configs}; do
|
for config in ${configs}; do
|
||||||
@@ -219,8 +221,10 @@ function remove_mainsail_logs() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function remove_mainsail_log_symlinks() {
|
function remove_mainsail_log_symlinks() {
|
||||||
local files
|
local files regex
|
||||||
files=$(find "${KLIPPER_LOGS}" -name "mainsail*" 2> /dev/null | sort)
|
|
||||||
|
regex="\/home\/${USER}\/([A-Za-z0-9_]+)\/logs\/mainsail-.*"
|
||||||
|
files=$(find "${HOME}" -maxdepth 3 -regextype posix-extended -regex "${regex}" 2> /dev/null | sort)
|
||||||
|
|
||||||
if [[ -n ${files} ]]; then
|
if [[ -n ${files} ]]; then
|
||||||
for file in ${files}; do
|
for file in ${files}; do
|
||||||
@@ -570,10 +574,11 @@ function enable_mainsail_remotemode() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function patch_mainsail_update_manager() {
|
function patch_mainsail_update_manager() {
|
||||||
local patched="false"
|
local patched moonraker_configs regex
|
||||||
local moonraker_configs
|
regex="\/home\/${USER}\/([A-Za-z0-9_]+)\/config\/moonraker\.conf"
|
||||||
moonraker_configs=$(find "${KLIPPER_CONFIG}" -type f -name "moonraker.conf" | sort)
|
moonraker_configs=$(find "${HOME}" -maxdepth 3 -type f -regextype posix-extended -regex "${regex}" | sort)
|
||||||
|
|
||||||
|
patched="false"
|
||||||
for conf in ${moonraker_configs}; do
|
for conf in ${moonraker_configs}; do
|
||||||
if ! grep -Eq "^\[update_manager mainsail\]$" "${conf}"; then
|
if ! grep -Eq "^\[update_manager mainsail\]$" "${conf}"; then
|
||||||
### add new line to conf if it doesn't end with one
|
### add new line to conf if it doesn't end with one
|
||||||
|
|||||||
Reference in New Issue
Block a user