Include after AFC, link scripts/ into the config folder

- bd_pa_spoolman.cfg renames AFC's SET_SPOOL_ID, so klipper-macros.cfg
  must be included after [include AFC/*.cfg]; the README said otherwise.
- install.sh links scripts/ as ~/printer_data/config/klipper-macros-scripts
  so the scripts can be edited in Mainsail/Fluidd.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mangavalkandClaude Opus 5.5 committed 2026-10-10 15:28:52 +02:00
1 parent 9dc733b5bb
commit 179bd0991b
5 files changed
+40 -17

No files matched your search

+17 -9
View File
@@ -6,7 +6,8 @@
#
# What it does (safe to run again, Moonraker runs it after every update):
# 1. links extras/*.py into ~/klipper/klippy/extras/
# 2. links macros/ to ~/printer_data/config/klipper-macros
# 2. links macros/ to ~/printer_data/config/klipper-macros and scripts/
# to ~/printer_data/config/klipper-macros-scripts (editable in the web UI)
# 3. makes the shell scripts executable
# 4. adds an [update_manager klipper-macros] section to moonraker.conf
# (once, with a backup of moonraker.conf)
@@ -21,6 +22,7 @@ KLIPPER_DIR="${KLIPPER_DIR:-$HOME/klipper}"
CONFIG_DIR="${CONFIG_DIR:-$HOME/printer_data/config}"
MOONRAKER_CONF="$CONFIG_DIR/moonraker.conf"
LINK_NAME="$CONFIG_DIR/klipper-macros"
SCRIPTS_LINK="$CONFIG_DIR/klipper-macros-scripts"
EXTRAS_DIR="$KLIPPER_DIR/klippy/extras"
ORIGIN="$(git -C "$REPO_DIR" remote get-url origin 2>/dev/null || echo "https://mangavalk.com/mangavalk/klipper-macros.git")"
@@ -36,7 +38,9 @@ if [[ ${1:-} == --uninstall ]]; then
rm "$target" && echo "removed $target"
fi
done
[[ -L $LINK_NAME ]] && rm "$LINK_NAME" && echo "removed $LINK_NAME"
for link in "$LINK_NAME" "$SCRIPTS_LINK"; do
if [[ -L $link ]]; then rm "$link" && echo "removed $link"; fi
done
echo "Remove [include klipper-macros/...] from printer.cfg and the"
echo "[update_manager klipper-macros] section from moonraker.conf yourself,"
echo "then restart the Klipper service."
@@ -61,12 +65,15 @@ if [[ -f $exclude ]]; then
done
fi
# 2. Macros
if [[ -e $LINK_NAME && ! -L $LINK_NAME ]]; then
die "$LINK_NAME exists and is not a link; move it away first"
fi
ln -sfn "$REPO_DIR/macros" "$LINK_NAME"
echo "linked $LINK_NAME"
# 2. Macros and scripts, visible and editable in Mainsail/Fluidd
for pair in "macros:$LINK_NAME" "scripts:$SCRIPTS_LINK"; do
src="$REPO_DIR/${pair%%:*}" link="${pair#*:}"
if [[ -e $link && ! -L $link ]]; then
die "$link exists and is not a link; move it away first"
fi
ln -sfn "$src" "$link"
echo "linked $link"
done
# 3. Scripts
find "$REPO_DIR/macros" "$REPO_DIR/scripts" -name "*.sh" -exec chmod +x {} +
@@ -92,7 +99,8 @@ fi
cat <<EOF
Done. Next steps (see README.md):
1. add to printer.cfg: [include klipper-macros/klipper-macros.cfg]
1. add to printer.cfg, after [include AFC/*.cfg]:
[include klipper-macros/klipper-macros.cfg]
and remove the old includes of the same macro files
2. restart the Klipper SERVICE (not just RESTART), so the new Python
modules are loaded: sudo systemctl restart klipper