Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
There I "fixed" freebsd-update.
# freebsd-update makes assumptions that don't match the world I live
# in. My local mirror has a 20ms rtt, can probably saturate my 130mbps
# line speed and takes about 2 minutes to fetch all of FreeBSD 10's
# dists; freebsd-update's mirrors are at least 140ms away, and take
# about 4 hours to fetch the changes from 9.1-RELEASE-p10 to
# 10.0-RELEASE.
# freebsd-update is a clever script that downloads a lot of bsdiff
# patches and whole files when patches are not suitable. The result of
# this process is a collection of files in
# /var/db/freebsd-update/files. If the files already exist, it will
# not fetch them again.
# This script provides the entire contents of a given distribution in
# the hashed/gzip'd format that freebsd-update expects, and can
# replace a 4 hour fetch with a 2 minute fetch + 3 minute expand.
# Run this before starting the upgrade to the new version.
mkdir -p named
PARTS="base kernel doc games lib32 src"
echo "==> Extracting all parts"
for p in $PARTS; do
if [ ! -r "${FULL_PATH}" ]; then
echo "Missing file ${FULL_PATH}"
exit 1
echo $p
tar -C named -xf "${FULL_PATH}"
echo "==> supplying files to freebsd-update"
mkdir -p "/var/db/freebsd-update/files/"
find named -type f | while read f; do
HASH=`sha256 -q "$f"`
if [ ! -f "${TARGET}" ]; then
gzip < "$f" > "${TARGET}"

tiny strangeness occured

..8990....9000... done.
Applying patches... done.
Fetching 8030 files... done.
/usr/sbin/freebsd-update: cannot open files/.gz: No such file or directory
Attempting to automatically merge changes in files... done.

I'll update if i find the cause. I think it was missing source dir on first try.

ericx commented Feb 12, 2015

Looks very cool. I will give this a try.
Ever suss the "No such file" issue?

@ericx that just depends on your workdir.
i don't remember specifics off-hand but you need to be in the right place (i.e. the root of the iso, or /dists.., not sure).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment