refactor(klipper): remove init.d support
Signed-off-by: Dominik Willner <th33xitus@gmail.com>
This commit is contained in:
@@ -43,7 +43,6 @@ function klipper_systemd() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function start_klipper_setup() {
|
function start_klipper_setup() {
|
||||||
local klipper_initd_service
|
|
||||||
local klipper_systemd_services
|
local klipper_systemd_services
|
||||||
local python_version
|
local python_version
|
||||||
local instance_count
|
local instance_count
|
||||||
@@ -56,15 +55,9 @@ function start_klipper_setup() {
|
|||||||
status_msg "Initializing Klipper installation ...\n"
|
status_msg "Initializing Klipper installation ...\n"
|
||||||
|
|
||||||
### return early if klipper already exists
|
### return early if klipper already exists
|
||||||
klipper_initd_service=$(find_klipper_initd)
|
|
||||||
klipper_systemd_services=$(klipper_systemd)
|
klipper_systemd_services=$(klipper_systemd)
|
||||||
|
|
||||||
if [[ -n ${klipper_initd_service} ]]; then
|
if [[ -n ${klipper_systemd_services} ]]; 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
|
|
||||||
error="At least one Klipper service is already installed:"
|
error="At least one Klipper service is already installed:"
|
||||||
|
|
||||||
for s in ${klipper_systemd_services}; do
|
for s in ${klipper_systemd_services}; do
|
||||||
@@ -409,26 +402,18 @@ function write_example_printer_cfg() {
|
|||||||
#================================================#
|
#================================================#
|
||||||
|
|
||||||
function remove_klipper_service() {
|
function remove_klipper_service() {
|
||||||
if [[ ! -e "${INITD}/klipper" ]] && [[ -z $(klipper_systemd) ]]; then
|
[[ -z $(klipper_systemd) ]] && return
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
status_msg "Removing Klipper services ..."
|
status_msg "Removing Klipper services ..."
|
||||||
|
|
||||||
if [[ -e "${INITD}/klipper" ]]; then
|
for service in $(klipper_systemd | cut -d"/" -f5); do
|
||||||
sudo systemctl stop klipper
|
status_msg "Removing ${service} ..."
|
||||||
sudo update-rc.d -f klipper remove
|
sudo systemctl stop "${service}"
|
||||||
sudo rm -f "${INITD}/klipper" "${ETCDEF}/klipper"
|
sudo systemctl disable "${service}"
|
||||||
else
|
sudo rm -f "${SYSTEMD}/${service}"
|
||||||
for service in $(klipper_systemd | cut -d"/" -f5); do
|
sudo systemctl daemon-reload
|
||||||
status_msg "Removing ${service} ..."
|
sudo systemctl reset-failed
|
||||||
sudo systemctl stop "${service}"
|
done
|
||||||
sudo systemctl disable "${service}"
|
|
||||||
sudo rm -f "${SYSTEMD}/${service}"
|
|
||||||
sudo systemctl daemon-reload
|
|
||||||
sudo systemctl reset-failed
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
ok_msg "All Klipper services removed!"
|
ok_msg "All Klipper services removed!"
|
||||||
}
|
}
|
||||||
@@ -559,12 +544,6 @@ function get_klipper_status() {
|
|||||||
local sf_count status py_ver
|
local sf_count status py_ver
|
||||||
sf_count="$(klipper_systemd | wc -w)"
|
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)
|
py_ver=$(get_klipper_python_ver)
|
||||||
|
|
||||||
### remove the "SERVICE" entry from the data array if a klipper service is installed
|
### remove the "SERVICE" entry from the data array if a klipper service is installed
|
||||||
|
|||||||
@@ -338,18 +338,6 @@ function fetch_webui_ports() {
|
|||||||
#=================== SYSTEM =====================#
|
#=================== SYSTEM =====================#
|
||||||
#================================================#
|
#================================================#
|
||||||
|
|
||||||
function find_klipper_initd() {
|
|
||||||
local services
|
|
||||||
services=$(find "${INITD}" -maxdepth 1 -regextype posix-extended -regex "${INITD}/klipper(-[^0])?[0-9]*" | sort)
|
|
||||||
echo "${services}"
|
|
||||||
}
|
|
||||||
|
|
||||||
function find_klipper_systemd() {
|
|
||||||
local services
|
|
||||||
services=$(find "${SYSTEMD}" -maxdepth 1 -regextype posix-extended -regex "${SYSTEMD}/klipper(-[0-9a-zA-Z]+)?.service" | sort)
|
|
||||||
echo "${services}"
|
|
||||||
}
|
|
||||||
|
|
||||||
function create_required_folders() {
|
function create_required_folders() {
|
||||||
local printer_data=${1} folders
|
local printer_data=${1} folders
|
||||||
folders=("backup" "certs" "config" "database" "gcodes" "comms" "logs" "systemd")
|
folders=("backup" "certs" "config" "database" "gcodes" "comms" "logs" "systemd")
|
||||||
|
|||||||
Reference in New Issue
Block a user