refactor(klipper): implement blacklisted service names (#304)

This commit is contained in:
th33xitus
2023-02-28 18:29:21 +01:00
committed by GitHub
parent afe6f7499a
commit d6837af2a2
4 changed files with 48 additions and 52 deletions

View File

@@ -338,18 +338,6 @@ function fetch_webui_ports() {
#=================== 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() {
local printer_data=${1} folders
folders=("backup" "certs" "config" "database" "gcodes" "comms" "logs" "systemd")
@@ -599,7 +587,7 @@ function set_multi_instance_names() {
local names=""
local services
services=$(find_klipper_systemd)
services=$(klipper_systemd)
###
# if value of 'multi_instance_names' is not an empty
@@ -664,7 +652,7 @@ function get_config_folders() {
cfg_dirs+=("${HOME}/${name}_data/config")
fi
done
elif [[ -z ${instance_names} && $(find_klipper_systemd | wc -w) -gt 0 ]]; then
elif [[ -z ${instance_names} && $(klipper_systemd | wc -w) -gt 0 ]]; then
cfg_dirs+=("${HOME}/printer_data/config")
else
cfg_dirs=()
@@ -707,7 +695,7 @@ function get_instance_folder_path() {
fi
fi
done
elif [[ -z ${instance_names} && $(find_klipper_systemd | wc -w) -gt 0 ]]; then
elif [[ -z ${instance_names} && $(klipper_systemd | wc -w) -gt 0 ]]; then
path="${HOME}/printer_data/${folder_name}"
if [[ -d ${path} ]]; then
folder_paths+=("${path}")