Skip to content

Commit 6896740

Browse files
committed
The Klipper service only needs to be restarted on initial install. On
updates done through Moonraker, the Moonraker service will restart the Klipper service based on the update configuration. This commit enhances the install script to only restart Klipper if it detects that the extensions have not been installed yet.
1 parent bc02ed3 commit 6896740

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

install-v2settling_probe.sh

+19-5
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,27 @@ function check_klipper() {
1818
fi
1919
}
2020

21-
# Step 2: Link extension to Klipper
21+
# Step 2: Check if the extensions are already present.
22+
# This is a way to check if this is the initial installation.
23+
function check_existing() {
24+
local -i existing=0
25+
for extension in ${EXTENSION_LIST}; do
26+
[ -e "${KLIPPER_PATH}/klippy/extras/${extension}" ] && existing=1 || existing=0
27+
[ ${existing} -eq 0 ] && break
28+
done
29+
echo ${existing}
30+
}
31+
32+
# Step 3: Link extension to Klipper
2233
function link_extension() {
2334
echo "Linking extensions to Klipper..."
2435
for extension in ${EXTENSION_LIST}; do
2536
ln -sf "${SRCDIR}/${extension}" "${KLIPPER_PATH}/klippy/extras/${extension}"
2637
done
2738
}
2839

29-
# Step 3: restarting Klipper
30-
function restart_klipper()
31-
{
40+
# Step 4: Optionally, restarting Klipper
41+
function restart_klipper() {
3242
echo "Restarting Klipper..."
3343
sudo systemctl restart klipper
3444
}
@@ -48,5 +58,9 @@ while getopts "k:" arg; do
4858
done
4959

5060
verify_ready
61+
existing_install=$(check_existing)
5162
link_extension
52-
restart_klipper
63+
if [ ${existing_install} -eq 0 ]; then
64+
restart_klipper
65+
fi
66+
exit 0

0 commit comments

Comments
 (0)