Merge branch 'th33xitus:master' into whiptail
This commit is contained in:
@@ -221,7 +221,7 @@ restart_MoonrakerTelegramBot(){
|
||||
}
|
||||
|
||||
restart_nginx(){
|
||||
if [ "$(systemctl list-units --full -all -t service --no-legend | grep -F "nginx.service")" ]; then
|
||||
if ls /lib/systemd/system/nginx.service 2>/dev/null 1>&2; then
|
||||
status_msg "Restarting NGINX Service ..."
|
||||
sudo systemctl restart nginx && ok_msg "NGINX Service restarted!"
|
||||
fi
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
system_check_webui(){
|
||||
### check system for installed moonraker service
|
||||
if [ "$(systemctl list-units --full -all -t service --no-legend | grep -F "moonraker.service")" ] || [ "$(systemctl list-units --full -all -t service --no-legend | grep -E "moonraker-[[:digit:]].service")" ]; then
|
||||
if ls /etc/systemd/system/moonraker.service 2>/dev/null 1>&2 || ls /etc/systemd/system | grep -q -E "moonraker-[[:digit:]]+.service"; then
|
||||
moonraker_chk_ok="true"
|
||||
else
|
||||
moonraker_chk_ok="false"
|
||||
fi
|
||||
|
||||
### check system for an installed and enabled octoprint service
|
||||
if systemctl list-unit-files | grep -E "octoprint.*" | grep "enabled" &>/dev/null; then
|
||||
if sudo systemctl list-unit-files | grep -E "octoprint.*" | grep "enabled" &>/dev/null; then
|
||||
OCTOPRINT_ENABLED="true"
|
||||
fi
|
||||
|
||||
@@ -114,12 +114,12 @@ install_webui(){
|
||||
$1_port_check
|
||||
|
||||
### ask user to install mjpg-streamer
|
||||
if [[ ! "$(systemctl list-units --full -all -t service --no-legend | grep -F "webcamd.service")" ]]; then
|
||||
if ls /etc/systemd/system/webcamd.service 2>/dev/null 1>&2; then
|
||||
get_user_selection_mjpg-streamer
|
||||
fi
|
||||
|
||||
### ask user to install the recommended webinterface macros
|
||||
if [[ ! -n $(ls $klipper_cfg_loc/kiauh_macros.cfg) ]] || [[ ! -n $(ls $klipper_cfg_loc/printer_*/kiauh_macros.cfg) ]]; then
|
||||
if ! ls $klipper_cfg_loc/kiauh_macros.cfg 2>/dev/null 1>&2 || ! ls $klipper_cfg_loc/printer_*/kiauh_macros.cfg 2>/dev/null 1>&2; then
|
||||
get_user_selection_kiauh_macros "$IF_NAME2"
|
||||
fi
|
||||
### create /etc/nginx/conf.d/upstreams.conf
|
||||
|
||||
@@ -41,10 +41,10 @@ moonraker_setup_dialog(){
|
||||
shopt -u extglob # disable extended globbing
|
||||
|
||||
### count amount of klipper services
|
||||
if [ "$(systemctl list-units --full -all -t service --no-legend | grep -F "klipper.service")" ]; then
|
||||
if ls /etc/systemd/system/klipper.service 2>/dev/null; then
|
||||
INSTANCE_COUNT=1
|
||||
else
|
||||
INSTANCE_COUNT=$(systemctl list-units --full -all -t service --no-legend | grep -E "klipper-[[:digit:]]+.service" | wc -l)
|
||||
INSTANCE_COUNT=$(ls /etc/systemd/system | grep -E "klipper-[[:digit:]]+.service" | wc -l)
|
||||
fi
|
||||
|
||||
### initial moonraker.conf path check
|
||||
@@ -183,11 +183,10 @@ create_moonraker_service(){
|
||||
### write single instance service
|
||||
write_mr_service
|
||||
### enable instance
|
||||
sudo systemctl enable moonraker.service
|
||||
do_action_service "enable" "moonraker"
|
||||
ok_msg "Single Moonraker instance created!"
|
||||
### launching instance
|
||||
status_msg "Launching Moonraker instance ..."
|
||||
sudo systemctl start moonraker
|
||||
do_action_service "start" "moonraker"
|
||||
else
|
||||
i=1
|
||||
while [ $i -le $INSTANCE_COUNT ]; do
|
||||
@@ -199,12 +198,10 @@ create_moonraker_service(){
|
||||
### write multi instance service
|
||||
write_mr_service
|
||||
### enable instance
|
||||
sudo systemctl enable moonraker-$i.service
|
||||
do_action_service "enable" "moonraker-$i"
|
||||
ok_msg "Moonraker instance #$i created!"
|
||||
### launching instance
|
||||
status_msg "Launching Moonraker instance #$i ..."
|
||||
sudo systemctl start moonraker-$i
|
||||
|
||||
do_action_service "start" "moonraker-$i"
|
||||
### raise values by 1
|
||||
i=$((i+1))
|
||||
done
|
||||
@@ -249,7 +246,7 @@ create_moonraker_conf(){
|
||||
sed -i "s|%UDS%|$KLIPPY_UDS|" $MR_CONF
|
||||
# if host ip is not in the default ip ranges, replace placeholder
|
||||
# otherwise remove placeholder from config
|
||||
if ! grep $LAN $MR_CONF; then
|
||||
if ! grep -q $LAN $MR_CONF; then
|
||||
sed -i "s|%LAN%|$LAN|" $MR_CONF
|
||||
else
|
||||
sed -i "/%LAN%/d" $MR_CONF
|
||||
|
||||
@@ -338,12 +338,10 @@ remove_octoprint(){
|
||||
#############################################################
|
||||
|
||||
remove_nginx(){
|
||||
if [[ $(dpkg-query -f'${Status}' --show nginx 2>/dev/null) = *\ installed ]] ; then
|
||||
if systemctl is-active nginx -q; then
|
||||
status_msg "Stopping Nginx service ..."
|
||||
sudo service nginx stop && sudo systemctl disable nginx
|
||||
ok_msg "Service stopped!"
|
||||
fi
|
||||
if ls /lib/systemd/system/nginx.service 2>/dev/null 1>&2; then
|
||||
status_msg "Stopping Nginx service ..."
|
||||
sudo systemctl stop nginx && sudo systemctl disable nginx
|
||||
ok_msg "Service stopped and disabled!"
|
||||
status_msg "Purging Nginx from system ..."
|
||||
sudo apt-get purge nginx nginx-common -y
|
||||
sudo update-rc.d -f nginx remove
|
||||
|
||||
Reference in New Issue
Block a user