refactor: patch only necessary update manager sections upon webif install
Signed-off-by: Dominik Willner th33xitus@gmail.com
This commit is contained in:
@@ -4,9 +4,6 @@ port: %PORT%
|
|||||||
enable_debug_logging: False
|
enable_debug_logging: False
|
||||||
klippy_uds_address: %UDS%
|
klippy_uds_address: %UDS%
|
||||||
|
|
||||||
[database]
|
|
||||||
database_path: %DB%
|
|
||||||
|
|
||||||
[authorization]
|
[authorization]
|
||||||
trusted_clients:
|
trusted_clients:
|
||||||
%LAN%
|
%LAN%
|
||||||
@@ -23,6 +20,9 @@ cors_domains:
|
|||||||
http://*://my.mainsail.xyz
|
http://*://my.mainsail.xyz
|
||||||
http://*://app.fluidd.xyz
|
http://*://app.fluidd.xyz
|
||||||
|
|
||||||
|
[database]
|
||||||
|
database_path: %DB%
|
||||||
|
|
||||||
[file_manager]
|
[file_manager]
|
||||||
config_path: %CFG%
|
config_path: %CFG%
|
||||||
log_path: %LOG%
|
log_path: %LOG%
|
||||||
@@ -34,21 +34,3 @@ log_path: %LOG%
|
|||||||
[update_manager]
|
[update_manager]
|
||||||
channel: dev
|
channel: dev
|
||||||
refresh_interval: 168
|
refresh_interval: 168
|
||||||
|
|
||||||
[update_manager mainsail]
|
|
||||||
type: web
|
|
||||||
repo: mainsail-crew/mainsail
|
|
||||||
path: ~/mainsail
|
|
||||||
|
|
||||||
[update_manager fluidd]
|
|
||||||
type: web
|
|
||||||
repo: fluidd-core/fluidd
|
|
||||||
path: ~/fluidd
|
|
||||||
|
|
||||||
#[update_manager KlipperScreen]
|
|
||||||
#type: git_repo
|
|
||||||
#path: /home/%USER%/KlipperScreen
|
|
||||||
#origin: https://github.com/jordanruthe/KlipperScreen.git
|
|
||||||
#env: /home/%USER%/.KlipperScreen-env/bin/python
|
|
||||||
#requirements: scripts/KlipperScreen-requirements.txt
|
|
||||||
#install_script: scripts/KlipperScreen-install.sh
|
|
||||||
@@ -77,6 +77,9 @@ function install_fluidd(){
|
|||||||
### install fluidd
|
### install fluidd
|
||||||
fluidd_setup
|
fluidd_setup
|
||||||
|
|
||||||
|
### add fluidd to the update manager in moonraker.conf
|
||||||
|
patch_fluidd_update_manager
|
||||||
|
|
||||||
### install mjpg-streamer
|
### install mjpg-streamer
|
||||||
[ "${install_mjpg_streamer}" = "true" ] && install_mjpg-streamer
|
[ "${install_mjpg_streamer}" = "true" ] && install_mjpg-streamer
|
||||||
|
|
||||||
@@ -368,4 +371,25 @@ function select_fluidd_port(){
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function patch_fluidd_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 Fluidd 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 Fluidds update manager section to moonraker.conf
|
||||||
|
if grep -Eq "[update_manager fluidd]" "${conf}"; then
|
||||||
|
/bin/sh -c "cat >> ${conf}" << MOONRAKER_CONF
|
||||||
|
|
||||||
|
[update_manager fluidd]
|
||||||
|
type: web
|
||||||
|
channel: stable
|
||||||
|
repo: fluidd-core/fluidd
|
||||||
|
path: ~/fluidd
|
||||||
|
MOONRAKER_CONF
|
||||||
|
fi
|
||||||
|
done
|
||||||
}
|
}
|
||||||
@@ -28,7 +28,13 @@ function install_klipperscreen(){
|
|||||||
error="${error} Please upgrade Python."
|
error="${error} Please upgrade Python."
|
||||||
print_error "${error}" && return
|
print_error "${error}" && return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
### install KlipperScreen
|
||||||
klipperscreen_setup
|
klipperscreen_setup
|
||||||
|
|
||||||
|
### add klipperscreen to the update manager in moonraker.conf
|
||||||
|
patch_klipperscreen_update_manager
|
||||||
|
|
||||||
do_action_service "restart" "KlipperScreen"
|
do_action_service "restart" "KlipperScreen"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,3 +180,30 @@ function compare_klipperscreen_versions(){
|
|||||||
fi
|
fi
|
||||||
echo "${versions}"
|
echo "${versions}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#================================================#
|
||||||
|
#=================== HELPERS ====================#
|
||||||
|
#================================================#
|
||||||
|
|
||||||
|
function patch_klipperscreen_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 KlipperScreen 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 KlipperScreens update manager section to moonraker.conf
|
||||||
|
if grep -Eq "[update_manager KlipperScreen]" "${conf}"; then
|
||||||
|
/bin/sh -c "cat >> ${conf}" << MOONRAKER_CONF
|
||||||
|
|
||||||
|
[update_manager KlipperScreen]
|
||||||
|
type: git_repo
|
||||||
|
path: ${HOME}/KlipperScreen
|
||||||
|
origin: https://github.com/jordanruthe/KlipperScreen.git
|
||||||
|
env: ${HOME}/.KlipperScreen-env/bin/python
|
||||||
|
requirements: scripts/KlipperScreen-requirements.txt
|
||||||
|
install_script: scripts/KlipperScreen-install.sh
|
||||||
|
MOONRAKER_CONF
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|||||||
@@ -74,9 +74,12 @@ function install_mainsail(){
|
|||||||
### symlink nginx log
|
### symlink nginx log
|
||||||
symlink_webui_nginx_log "mainsail"
|
symlink_webui_nginx_log "mainsail"
|
||||||
|
|
||||||
### install mainsail/fluidd
|
### install mainsail
|
||||||
mainsail_setup
|
mainsail_setup
|
||||||
|
|
||||||
|
### add mainsail to the update manager in moonraker.conf
|
||||||
|
patch_mainsail_update_manager
|
||||||
|
|
||||||
### install mjpg-streamer
|
### install mjpg-streamer
|
||||||
[ "${install_mjpg_streamer}" = "true" ] && install_mjpg-streamer
|
[ "${install_mjpg_streamer}" = "true" ] && install_mjpg-streamer
|
||||||
|
|
||||||
@@ -490,4 +493,25 @@ function enable_mainsail_remotemode(){
|
|||||||
[ ! -f "${MAINSAIL_DIR}/config.json" ] && return
|
[ ! -f "${MAINSAIL_DIR}/config.json" ] && return
|
||||||
rm -f "${MAINSAIL_DIR}/config.json"
|
rm -f "${MAINSAIL_DIR}/config.json"
|
||||||
echo -e "{\n \"remoteMode\":true\n}" >> "${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
|
||||||
}
|
}
|
||||||
@@ -66,7 +66,8 @@ function moonraker_setup_dialog(){
|
|||||||
case "${yn}" in
|
case "${yn}" in
|
||||||
Y|y|Yes|yes|"")
|
Y|y|Yes|yes|"")
|
||||||
select_msg "Yes"
|
select_msg "Yes"
|
||||||
status_msg "Installing ${count} Moonraker instance(s) ... \n"
|
((count == 1)) && status_msg "Installing single Moonraker instance ..."
|
||||||
|
((count > 1)) && status_msg "Installing ${count} Moonraker instances ..."
|
||||||
moonraker_setup "${count}"
|
moonraker_setup "${count}"
|
||||||
break;;
|
break;;
|
||||||
N|n|No|no)
|
N|n|No|no)
|
||||||
|
|||||||
Reference in New Issue
Block a user