add: user choice for dwc service (init.d or systemd)

This commit is contained in:
th33xitus
2020-09-13 11:25:46 +02:00
parent d9d3006be4
commit 3e35be5681
2 changed files with 48 additions and 2 deletions

View File

@@ -34,6 +34,7 @@ remove_dwc2(){
data_arr=(
/etc/init.d/dwc
/etc/default/dwc
/etc/systemd/system/dwc.service
$DWC2FK_DIR
$DWC_ENV_DIR
$DWC2_DIR
@@ -42,15 +43,24 @@ remove_dwc2(){
if [ "$ERROR_MSG" = "" ]; then
if systemctl is-active dwc -q; then
status_msg "Stopping DWC2-for-Klipper-Socket Service ..."
sudo /etc/init.d/dwc stop && sudo systemctl disable dwc
sudo systemctl stop dwc && sudo systemctl disable dwc
ok_msg "Service stopped!"
fi
#remove if init.d service
if [[ -e /etc/init.d/dwc || -e /etc/default/dwc ]]; then
status_msg "Init.d Service found ..."
status_msg "Removing DWC2-for-Klipper-Socket Service ..."
sudo rm -rf /etc/init.d/dwc /etc/default/dwc
sudo update-rc.d -f dwc remove
ok_msg "DWC2-for-Klipper-Socket Service removed!"
fi
#remove if systemd service
if [ -e /etc/systemd/system/dwc.service ]; then
status_msg "Systemd Service found ..."
status_msg "Removing DWC2-for-Klipper-Socket Service ..."
sudo rm -rf /etc/systemd/system/dwc.service
ok_msg "DWC2-for-Klipper-Socket Service removed!"
fi
if [ -d $DWC2FK_DIR ]; then
status_msg "Removing DWC2-for-Klipper-Socket directory ..."
rm -rf $DWC2FK_DIR && ok_msg "Directory removed!"