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