Created
January 31, 2014 10:09
-
-
Save thefloweringash/8729473 to your computer and use it in GitHub Desktop.
There I "fixed" freebsd-update.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# 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 | |
BASEDIR=${1:-${PWD}} | |
PARTS="base kernel doc games lib32 src" | |
echo "==> Extracting all parts" | |
for p in $PARTS; do | |
FULL_PATH="${BASEDIR}/${p}.txz" | |
if [ ! -r "${FULL_PATH}" ]; then | |
echo "Missing file ${FULL_PATH}" | |
exit 1 | |
fi | |
echo $p | |
tar -C named -xf "${FULL_PATH}" | |
done | |
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"` | |
TARGET="/var/db/freebsd-update/files/${HASH}.gz" | |
if [ ! -f "${TARGET}" ]; then | |
gzip < "$f" > "${TARGET}" | |
fi | |
done |
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
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.