Re: RELENG tarballs
Dimitar Dimitrov <[email protected]>
| Newsgroups | gmane.os.freebsd.security.general |
|---|---|
| Message-ID | <CAE0uqTKODbvP2otOCefWdd6+o8GbUyinBZCphjPhDHKA8iti3g@mail.gmail.com> |
Or, you can use something like this:
This is how I make custom tar.gz archives to update my machines.
arca:~ # cat ./build-release.sh
#!/bin/sh
set -eu
if [ "$(id -u)" -ne 0 ]; then
printf '%s\n' "Error: this script must be run as root." >&2
exit 1
fi
usage() {
printf "Usage: %s <KERNCONF> <FREEBSD-VERSION>\n" "$0"
exit 1
}
case $# in
2)
KERNEL="$1"
VERSION="$2"
;;
*)
usage
;;
esac
sysctl hw.acpi.cpu.cx_lowest=C1
SRC="/usr/src"
{
cd "$SRC" || exit 1
if ! git checkout "releng/$VERSION"; then
printf "Branch releng/%s didn't exist. Exiting..." "$VERSION"
exit 1
fi
eval "$(sh $SRC/sys/conf/newvers.sh -V REVISION)"
eval "$(sh $SRC/sys/conf/newvers.sh -V BRANCH)"
printf "Branch is releng/%s with kernel: %s\n" "$VERSION" "$KERNEL"
git pull
}
if [ "$VERSION" != "$REVISION" ]; then
printf "The branch releng/%s of %s is different from releng/%s\n"
"$REVISION" "$SRC" "$VERSION"
printf "Action: git checkout releng/%s and try again\n" "$VERSION"
exit 1
fi
for ds in "stage/builder/$REVISION/archives"
"stage/builder/$REVISION/world"; do
if ! zfs list "$ds" > /dev/null 2>&1; then
printf "Error: ZFS dataset %s does not exist\n" "$ds" >&2
exit 1
fi
done
KERNDIR="/root/kernels"
WORLD_DIR="/stage/builder/${REVISION}/world"
CLEANUP_LIST="$WORLD_DIR/REMOVE_LIST-$REVISION-$BRANCH.txt"
ARCHIVE="/stage/builder/${REVISION}/archives/FreeBSD-$REVISION-$BRANCH-$KERNEL-$(date
+%Y%m%d)-world.tar.gz"
ETC_ARCHIVE="/stage/builder/${REVISION}/archives/FreeBSD-$REVISION-$BRANCH-$KERNEL-$(date
+%Y%m%d)-etc.tar.gz"
CONF_DIR="/root/src-configs"
SRCCONF_FILE="$CONF_DIR/src-$KERNEL.conf"
if [ ! -f "$SRCCONF_FILE" ]; then
printf "Error: SRCCONF file '%s' not found.\n" "$SRCCONF_FILE" >&2
exit 1
fi
status=""
[ -d "$KERNDIR" ] && status="D"
[ -f "$KERNDIR/$KERNEL" ] && status="${status}F"
case "$status" in
DF)
;;
D)
printf "Error: Kernel config '%s' not found in '%s'\n" "$KERNEL"
"$KERNDIR" >&2
exit 1
;;
*)
printf "Error: Kernel directory '%s' does not exist or is
inaccessible\n" "$KERNDIR" >&2
exit 1
;;
esac
if [ ! -d "$WORLD_DIR" ]; then
printf "Directory %s didn't exist\n" "$WORLD_DIR"
exit 1
fi
chflags -R noschg "$WORLD_DIR"
rm -rf "${WORLD_DIR:?}"/*
cd "$SRC" || exit 1
NCPU=$(sysctl -n hw.ncpu)
make cleanworld cleankernel KERNCONF="$KERNEL" KERNCONFDIR="$KERNDIR"
make -j"$NCPU" buildworld buildkernel KERNCONF="$KERNEL"
KERNCONFDIR="$KERNDIR" SRCCONF="$SRCCONF_FILE"
printf "===> Installing world, kernel and distribution to %s\n" "$WORLD_DIR"
make installworld installkernel DESTDIR="$WORLD_DIR" KERNCONF="$KERNEL"
KERNCONFDIR="$KERNDIR" SRCCONF="$SRCCONF_FILE"
etcupdate build -s /usr/src -M "-j$NCPU SRCCONF=$SRCCONF_FILE
KERNCONF=$KERNEL KERNCONFDIR=$KERNDIR" "$ETC_ARCHIVE"
make list-old-files list-old-libs list-old-dirs SRCCONF="$SRCCONF_FILE" >
"$CLEANUP_LIST"
printf "===> Creating archive: %s\n" "$ARCHIVE"
tar -cf "${ARCHIVE}" -a -p -C "$WORLD_DIR" .
printf "===> Generating SHA256 checksum...\n"
sha256 -q "${ARCHIVE}" > "${ARCHIVE}.sha256"
sha256 -q "${ETC_ARCHIVE}" > "${ETC_ARCHIVE}.sha256"
du -h "${ARCHIVE}"
du -h "${ETC_ARCHIVE}"
printf "DONE. Copy both %s and .sha256 to your flash drive.\n" "$(basename
"${ARCHIVE}")"
sysctl hw.acpi.cpu.cx_lowest=C2
arca:~ # cat upgrade-from-source.sh
#!/bin/sh
if [ "$(id -u)" -ne 0 ]; then
printf '%s\n' "Error: this script must be run as root." >&2
exit 1
fi
usage() {
printf "Usage: %s <BUILDTAR> <BUILDDIST>\n" "$0"
exit 1
}
case $# in
2)
TAR="$1"
ETC="$2"
;;
*)
usage
;;
esac
zfs mount -a
zfs set readonly=off zroot
if [ -d /boot/kernel ]; then
cp -a /boot/kernel /boot/kernel.old
fi
for f in /usr/bin/* /lib/* /libexec/ld-elf.so.1 /sbin/init /var/empty; do
if [ -f "$f" ]; then
chflags noschg "$f"
elif [ -d "$f" ]; then
chflags -R noschg "$f"
fi
done
tar -xzpf "$TAR" -C /
etcupdate -p -t "$ETC"
arca:~ # cat delete-old.sh
#!/bin/sh
set -eu
# must run as root
if [ "$(id -u)" -ne 0 ]; then
printf '%s\n' "Error: this script must be run as root." >&2
exit 1
fi
FILENAME="${1:-}"
if [ -z "$FILENAME" ]; then
printf "Usage: %s REMOVE_LIST_filename\n" "$0"
exit 1
fi
case "$FILENAME" in
REMOVE_LIST*)
;;
*)
printf "Error: Filename '%s' must start with 'REMOVE_LIST'\n"
"$FILENAME"
exit 1
;;
esac
if [ ! -f "$FILENAME" ]; then
printf "File '%s' not found.\n" "$FILENAME"
exit 1
fi
sed -i '' '/^usr\/include/d' "$FILENAME"
while IFS= read -r raw_target; do
[ -z "$raw_target" ] && continue
case "$raw_target" in
/*) target="$raw_target" ;;
*) target="/$raw_target" ;;
esac
if [ -f "$target" ]; then
if ! rm -f "$target" > /dev/null 2>&1; then
chflags noschg "$target"
rm -f "$target"
echo "Deleting file: $target"
else
echo "Deleting file: $target"
fi
elif [ -d "$target" ]; then
if ! rm -rf "$target" > /dev/null 2>&1; then
chflags -R noschg "$target"
rm -rf "$target"
echo "Deleting directory: $target"
else
echo "Deleting directory: $target"
fi
fi
done < "$FILENAME"
DISCLAIMER: This may or may not cover your use case. You must validate the
logic before starting those scripts!
On Wed, Aug 12, 2026 at 5:12 PM Dimitar Dimitrov <[email protected]>
wrote:
> Hello,
> check `man release`
> Cheers,
>
> Dimitar
>
> On Wed, Aug 12, 2026 at 5:05 PM Mars G. Miro <[email protected]>
> wrote:
>
>> Hi All
>>
>> Is there a tarball of the RELENG branches (e.g. 15.1-RELEASE-p2)
>> aside
>> from obtaining it via git/github/gitlab/freebsd-update ?
>>
>> Thanks.
>> --
>> cheers
>> mars
>> ----
>> A failure will not appear until a unit has passed final inspection.
>>
>>
>>