mirror of
https://github.com/theupriser/steamify-cachyos.git
synced 2026-10-03 17:41:58 +02:00
chore: Move the bundle tool to .github/tools/bundle.sh
Update its repo-root path and all references (workflow, README, AGENTS.md).
This commit is contained in:
1 parent
9d27239d00
commit
2d80e16e6f
5 files changed
+9
-8
No files matched your search
Executable
+49
@@ -0,0 +1,49 @@
|
||||
#!/bin/bash
|
||||
# Build a single-file version of the wizard for `curl | bash` use:
|
||||
# .github/tools/bundle.sh [output] (default: dist/setup-gamescope-boot.sh)
|
||||
#
|
||||
# Inlines lib/*.sh in the order setup-gamescope-boot.sh sources them and
|
||||
# wraps the entry point's body in main(), so bash has read the whole file
|
||||
# before anything runs. That lets the bundle reattach stdin to the terminal
|
||||
# when it was piped in by curl, so the interactive menu still works.
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/../.."
|
||||
|
||||
out="${1:-dist/setup-gamescope-boot.sh}"
|
||||
entry=setup-gamescope-boot.sh
|
||||
mkdir -p "$(dirname "$out")"
|
||||
|
||||
# Library order, taken from the entry point's source loop.
|
||||
libs=$(grep -oP '^for lib in \K.*(?=; do$)' "$entry")
|
||||
[[ -n "$libs" ]] || { echo "bundle: can't find the lib source loop in $entry" >&2; exit 1; }
|
||||
|
||||
version="v$(grep -oP '^VERSION=\K.*' "$entry"), $(git describe --always --dirty 2>/dev/null || echo unknown)"
|
||||
|
||||
{
|
||||
# Header comment and `set` line of the entry point, up to the source loop.
|
||||
sed -n '1,/^SCRIPT_DIR=/p' "$entry" | sed '$d'
|
||||
echo "# Single-file build ($version), generated by .github/tools/bundle.sh - edit the"
|
||||
echo "# sources in the repository instead: https://github.com/theupriser/cachyos-gamescope-boot"
|
||||
echo
|
||||
for lib in $libs; do
|
||||
echo "# ----- lib/$lib.sh -----"
|
||||
# Drop each module's shebang and its "Sourced by ..." boilerplate.
|
||||
sed -e '1{/^#!/d}' -e '/^# Sourced by setup-gamescope-boot.sh/d' "lib/$lib.sh"
|
||||
echo
|
||||
done
|
||||
echo "# ----- setup-gamescope-boot.sh -----"
|
||||
echo "main() {"
|
||||
# Everything after the source loop is the entry point's body.
|
||||
sed -n '/^for lib in /,$p' "$entry" | sed '1,/^done$/d' | sed 's/^/ /; s/^ $//'
|
||||
echo "}"
|
||||
echo
|
||||
echo "# Piped in via curl, bash reads this very file from stdin. Give the menu"
|
||||
echo "# the terminal instead - on the same line as main and exit: bash has read"
|
||||
echo "# this line in full, so it never reads further script from the terminal."
|
||||
echo 'reattach_tty() { if [[ ! -t 0 && -z "${WIZARD_KEEP_STDIN:-}" ]]; then { exec </dev/tty; } 2>/dev/null || true; fi; }'
|
||||
echo 'reattach_tty; main "$@"; exit $?'
|
||||
} > "$out"
|
||||
|
||||
chmod +x "$out"
|
||||
bash -n "$out"
|
||||
echo "Wrote $out ($version)"
|
||||
@@ -1,4 +1,4 @@
|
||||
# Builds the single-file wizard (tools/bundle.sh) and publishes it as the
|
||||
# Builds the single-file wizard (.github/tools/bundle.sh) and publishes it as the
|
||||
# asset of the rolling "latest" release, for:
|
||||
# curl -fsSL https://github.com/theupriser/cachyos-gamescope-boot/releases/download/latest/setup-gamescope-boot.sh | bash
|
||||
# Pull requests only build and check it.
|
||||
@@ -22,7 +22,7 @@ jobs:
|
||||
fetch-depth: 0 # for the version in the bundle's header
|
||||
|
||||
- name: Build
|
||||
run: tools/bundle.sh dist/setup-gamescope-boot.sh
|
||||
run: .github/tools/bundle.sh dist/setup-gamescope-boot.sh
|
||||
|
||||
- name: Check
|
||||
run: |
|
||||
|
||||
Reference in new issue
Block a user