refactor(klipper): remove init.d support

Signed-off-by: Dominik Willner <th33xitus@gmail.com>
This commit is contained in:
th33xitus
2023-02-28 15:58:04 +01:00
parent 95eb4901ef
commit 4ebe0162d6
2 changed files with 10 additions and 43 deletions

View File

@@ -43,7 +43,6 @@ function klipper_systemd() {
}
function start_klipper_setup() {
local klipper_initd_service
local klipper_systemd_services
local python_version
local instance_count
@@ -56,15 +55,9 @@ function start_klipper_setup() {
status_msg "Initializing Klipper installation ...\n"
### return early if klipper already exists
klipper_initd_service=$(find_klipper_initd)
klipper_systemd_services=$(klipper_systemd)
if [[ -n ${klipper_initd_service} ]]; then
error="Unsupported Klipper SysVinit service detected:"
error="${error}\n ➔ ${klipper_initd_service}"
error="${error}\n Please re-install Klipper with KIAUH!"
log_info "Unsupported Klipper SysVinit service detected: ${klipper_initd_service}"
elif [[ -n ${klipper_systemd_services} ]]; then
if [[ -n ${klipper_systemd_services} ]]; then
error="At least one Klipper service is already installed:"
for s in ${klipper_systemd_services}; do
@@ -409,26 +402,18 @@ function write_example_printer_cfg() {
#================================================#
function remove_klipper_service() {
if [[ ! -e "${INITD}/klipper" ]] && [[ -z $(klipper_systemd) ]]; then
return
fi
[[ -z $(klipper_systemd) ]] && return
status_msg "Removing Klipper services ..."
if [[ -e "${INITD}/klipper" ]]; then
sudo systemctl stop klipper
sudo update-rc.d -f klipper remove
sudo rm -f "${INITD}/klipper" "${ETCDEF}/klipper"
else
for service in $(klipper_systemd | cut -d"/" -f5); do
status_msg "Removing ${service} ..."
sudo systemctl stop "${service}"
sudo systemctl disable "${service}"
sudo rm -f "${SYSTEMD}/${service}"
sudo systemctl daemon-reload
sudo systemctl reset-failed
done
fi
for service in $(klipper_systemd | cut -d"/" -f5); do
status_msg "Removing ${service} ..."
sudo systemctl stop "${service}"
sudo systemctl disable "${service}"
sudo rm -f "${SYSTEMD}/${service}"
sudo systemctl daemon-reload
sudo systemctl reset-failed
done
ok_msg "All Klipper services removed!"
}
@@ -559,12 +544,6 @@ function get_klipper_status() {
local sf_count status py_ver
sf_count="$(klipper_systemd | wc -w)"
### detect an existing "legacy" klipper init.d installation
if [[ $(klipper_systemd | wc -w) -eq 0 ]] \
&& [[ $(find_klipper_initd | wc -w) -ge 1 ]]; then
sf_count=1
fi
py_ver=$(get_klipper_python_ver)
### remove the "SERVICE" entry from the data array if a klipper service is installed