1
0
mirror of https://github.com/bestnite/quadlet-migrator-skill.git synced 2026-04-26 21:01:54 +00:00

Add helper script templates and align reference guidance.

Point helper-script generation at shared templates, tighten prefix-based Quadlet handling, and refresh the bundled Quadlet reference formatting.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-04 17:55:30 +11:00
parent e2372f1b3d
commit 62704d3a2d
13 changed files with 349 additions and 197 deletions
+29
View File
@@ -0,0 +1,29 @@
#!/bin/sh
set -eu
# Copy reviewed Quadlet unit files into the target Quadlet directory.
# Update the variables below before using this template.
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
QUADLET_PREFIX='app-'
QUADLET_TARGET_DIR="${HOME}/.config/containers/systemd"
list_quadlet_files() {
for ext in container pod network volume build image kube; do
for file in "$SCRIPT_DIR"/"$QUADLET_PREFIX"*."$ext"; do
[ -e "$file" ] || continue
printf '%s\n' "$file"
done
done | LC_ALL=C sort -u
}
files=$(list_quadlet_files)
[ -n "$files" ] || {
printf 'No Quadlet files found for prefix %s\n' "$QUADLET_PREFIX" >&2
exit 1
}
mkdir -p -- "$QUADLET_TARGET_DIR"
printf '%s\n' "$files" | while IFS= read -r file; do
install -m 0644 -- "$file" "$QUADLET_TARGET_DIR/$(basename -- "$file")"
done
+11
View File
@@ -0,0 +1,11 @@
#!/bin/sh
set -eu
# Reload systemd after reviewed Quadlet unit changes.
# Update the systemctl_cmd() function below before using this template.
systemctl_cmd() {
systemctl --user "$@"
}
systemctl_cmd daemon-reload
+15
View File
@@ -0,0 +1,15 @@
#!/bin/sh
set -eu
# Restart the reviewed lifecycle unit(s).
# Update the variables and systemctl_cmd() function below before using this template.
LIFECYCLE_UNITS='app-pod.service'
systemctl_cmd() {
systemctl --user "$@"
}
for unit in $LIFECYCLE_UNITS; do
systemctl_cmd restart "$unit"
done
+15
View File
@@ -0,0 +1,15 @@
#!/bin/sh
set -eu
# Start the reviewed lifecycle unit(s).
# Update the variables and systemctl_cmd() function below before using this template.
LIFECYCLE_UNITS='app-pod.service'
systemctl_cmd() {
systemctl --user "$@"
}
for unit in $LIFECYCLE_UNITS; do
systemctl_cmd start "$unit"
done
+15
View File
@@ -0,0 +1,15 @@
#!/bin/sh
set -eu
# Stop the reviewed lifecycle unit(s).
# Update the variables and systemctl_cmd() function below before using this template.
LIFECYCLE_UNITS='app-pod.service'
systemctl_cmd() {
systemctl --user "$@"
}
for unit in $LIFECYCLE_UNITS; do
systemctl_cmd stop "$unit"
done
+37
View File
@@ -0,0 +1,37 @@
#!/bin/sh
set -eu
# Stop the reviewed lifecycle unit(s), then remove installed Quadlet unit files.
# Update the variables and systemctl_cmd() function below before using this template.
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
QUADLET_PREFIX='app-'
QUADLET_TARGET_DIR="${HOME}/.config/containers/systemd"
LIFECYCLE_UNITS='app-pod.service'
systemctl_cmd() {
systemctl --user "$@"
}
list_quadlet_files() {
for ext in container pod network volume build image kube; do
for file in "$SCRIPT_DIR"/"$QUADLET_PREFIX"*."$ext"; do
[ -e "$file" ] || continue
printf '%s\n' "$file"
done
done | LC_ALL=C sort -u
}
files=$(list_quadlet_files)
[ -n "$files" ] || {
printf 'No Quadlet files found for prefix %s\n' "$QUADLET_PREFIX" >&2
exit 1
}
for unit in $LIFECYCLE_UNITS; do
systemctl_cmd stop "$unit" || true
done
printf '%s\n' "$files" | while IFS= read -r file; do
rm -f -- "$QUADLET_TARGET_DIR/$(basename -- "$file")"
done