42 lines
1.3 KiB
Bash
42 lines
1.3 KiB
Bash
#!/bin/sh
|
|
# build.sh — example custom build script for zeta-makepkg.
|
|
#
|
|
# Invoked from the extracted source directory. The tool sets:
|
|
# $DESTDIR → staging tree root (e.g. /tmp/zeta-makepkg/hooks-demo-.../stage)
|
|
#
|
|
# This script installs a small command under usr/bin/ and a post-transaction
|
|
# hook under usr/share/zeta/hooks/. A hook is a pure-data Lua file:
|
|
#
|
|
# return {
|
|
# order = 50,
|
|
# trigger = { op = "install", type = "package", target = { "hooks-demo" } },
|
|
# action = { when = "post", exec = "true", description = "example hook" },
|
|
# }
|
|
#
|
|
# zeta-makepkg scans the stage for usr/share/zeta/hooks/*.hook, validates the
|
|
# format, and merges the paths into the generated `files` whitelist.
|
|
|
|
set -eu
|
|
|
|
echo "==> Building hooks-demo (custom)"
|
|
|
|
# Install a tiny command
|
|
mkdir -p "$DESTDIR/usr/bin"
|
|
cat > "$DESTDIR/usr/bin/hooks-demo" <<'EOF'
|
|
#!/bin/sh
|
|
echo "hooks-demo: post-transaction hooks are working"
|
|
EOF
|
|
chmod 755 "$DESTDIR/usr/bin/hooks-demo"
|
|
|
|
# Install a post-transaction hook (pure data, no side effects)
|
|
mkdir -p "$DESTDIR/usr/share/zeta/hooks"
|
|
cat > "$DESTDIR/usr/share/zeta/hooks/hooks-demo.hook" <<'EOF'
|
|
return {
|
|
order = 50,
|
|
trigger = { op = "install", type = "package", target = { "hooks-demo" } },
|
|
action = { when = "post", exec = "true", description = "example hook" },
|
|
}
|
|
EOF
|
|
|
|
echo "==> Install complete"
|