wip
This commit is contained in:
39
dist/make-seed.sh
vendored
Executable file
39
dist/make-seed.sh
vendored
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
usage() {
|
||||
echo "Usage: make-seed.sh <pubkey-file> [output.iso]"
|
||||
echo "Creates a seed ISO with the given SSH public key."
|
||||
exit 1
|
||||
}
|
||||
|
||||
[ "${1:-}" ] || usage
|
||||
|
||||
PUBKEY_FILE="$1"
|
||||
OUTPUT="${2:-seed.iso}"
|
||||
|
||||
if [ ! -f "$PUBKEY_FILE" ]; then
|
||||
echo "error: public key file not found: $PUBKEY_FILE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TMPDIR=$(mktemp -d)
|
||||
trap 'rm -rf "$TMPDIR"' EXIT
|
||||
|
||||
cp "$PUBKEY_FILE" "$TMPDIR/authorized_keys"
|
||||
|
||||
if command -v mkisofs >/dev/null 2>&1; then
|
||||
ISO_CMD="mkisofs"
|
||||
elif command -v genisoimage >/dev/null 2>&1; then
|
||||
ISO_CMD="genisoimage"
|
||||
else
|
||||
echo "error: mkisofs or genisoimage required"
|
||||
echo " linux: sudo apt install genisoimage"
|
||||
echo " macos: brew install cdrtools"
|
||||
echo " nix: nix shell nixpkgs#cdrtools"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
"$ISO_CMD" -quiet -V SEEDCONFIG -J -R -o "$OUTPUT" "$TMPDIR"
|
||||
|
||||
echo "seed ISO created: $OUTPUT"
|
||||
Reference in New Issue
Block a user