45 lines
1.2 KiB
Bash
Executable File
45 lines
1.2 KiB
Bash
Executable File
#!/bin/sh
|
|
# bump-build.sh - Increment the MontaukOS kernel build number.
|
|
#
|
|
# Reads the current MONTAUK_BUILD_NUMBER from the given header, increments it,
|
|
# and rewrites the header in place. Invoked by kernel/GNUmakefile whenever the
|
|
# kernel or userspace sources change, so the build number reflects real builds.
|
|
#
|
|
# Usage: ./scripts/bump-build.sh <path-to-BuildNo.hpp>
|
|
|
|
set -e
|
|
|
|
HDR="$1"
|
|
if [ -z "$HDR" ] || [ ! -f "$HDR" ]; then
|
|
echo "bump-build.sh: header not found: $HDR" >&2
|
|
exit 1
|
|
fi
|
|
|
|
cur=$(sed -n 's/^#define MONTAUK_BUILD_NUMBER \([0-9][0-9]*\).*/\1/p' "$HDR")
|
|
if [ -z "$cur" ]; then
|
|
echo "bump-build.sh: could not parse MONTAUK_BUILD_NUMBER in $HDR" >&2
|
|
exit 1
|
|
fi
|
|
|
|
next=$((cur + 1))
|
|
|
|
cat > "$HDR" <<EOF
|
|
/*
|
|
* BuildNo.hpp
|
|
* Monotonic kernel build number.
|
|
*
|
|
* This file is the source of truth for the build number. It is regenerated
|
|
* (incremented) by scripts/bump-build.sh whenever the kernel or userspace
|
|
* sources change, via a rule in kernel/GNUmakefile. Do not edit the number
|
|
* by hand; the build system manages it.
|
|
*
|
|
* Copyright (c) 2026 Daniel Hammer
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#define MONTAUK_BUILD_NUMBER $next
|
|
EOF
|
|
|
|
echo " BUILD $cur -> $next"
|