refactor: patch only necessary update manager sections upon webif install
Signed-off-by: Dominik Willner th33xitus@gmail.com
This commit is contained in:
@@ -74,9 +74,12 @@ function install_mainsail(){
|
||||
### symlink nginx log
|
||||
symlink_webui_nginx_log "mainsail"
|
||||
|
||||
### install mainsail/fluidd
|
||||
### install mainsail
|
||||
mainsail_setup
|
||||
|
||||
### add mainsail to the update manager in moonraker.conf
|
||||
patch_mainsail_update_manager
|
||||
|
||||
### install mjpg-streamer
|
||||
[ "${install_mjpg_streamer}" = "true" ] && install_mjpg-streamer
|
||||
|
||||
@@ -490,4 +493,25 @@ function enable_mainsail_remotemode(){
|
||||
[ ! -f "${MAINSAIL_DIR}/config.json" ] && return
|
||||
rm -f "${MAINSAIL_DIR}/config.json"
|
||||
echo -e "{\n \"remoteMode\":true\n}" >> "${MAINSAIL_DIR}/config.json"
|
||||
}
|
||||
|
||||
function patch_mainsail_update_manager(){
|
||||
local moonraker_configs
|
||||
moonraker_configs=$(find "$(get_klipper_cfg_dir)" -type f -name "moonraker.conf")
|
||||
for conf in ${moonraker_configs}; do
|
||||
status_msg "Adding Mainsail to update manager in file:\n ${conf}"
|
||||
### add new line to conf if it doesn't end with one
|
||||
[[ $(tail -c1 "${conf}" | wc -l) -eq 0 ]] && echo "" >> "${conf}"
|
||||
### add Mainsails update manager section to moonraker.conf
|
||||
if grep -Eq "[update_manager mainsail]" "${conf}"; then
|
||||
/bin/sh -c "cat >> ${conf}" << MOONRAKER_CONF
|
||||
|
||||
[update_manager mainsail]
|
||||
type: web
|
||||
channel: stable
|
||||
repo: mainsail-crew/mainsail
|
||||
path: ~/mainsail
|
||||
MOONRAKER_CONF
|
||||
fi
|
||||
done
|
||||
}
|
||||
Reference in New Issue
Block a user