Skip to content

Instantly share code, notes, and snippets.

@northox
Created April 23, 2017 00:54
Show Gist options
  • Save northox/f4ef509694d1cf440eb27dde48fa9fd0 to your computer and use it in GitHub Desktop.
Save northox/f4ef509694d1cf440eb27dde48fa9fd0 to your computer and use it in GitHub Desktop.
Download and validate OpenBSD snapshot then install /bsd.rd
#!/bin/sh
path=snapshots
url=ftp://openbsd.cs.toronto.edu/pub/OpenBSD/
rel=`uname -r`
major=`echo $rel | sed 's/\..*//'`
minor=`echo $rel | sed 's/.*\.//'`
mkdir -p $path
cd $path
ftp -ia ${url}/snapshots/`uname -m`/{man*tgz,comp*tgz,base*tgz,bsd*,INS*,SHA*} || exit 1
signify -q -C -p /etc/signify/openbsd-${major}${minor}-base.pub -x SHA256.sig *tgz bsd* INS*
if [ $? -eq 0 ]; then
doas cp bsd.rd /
echo "Success: bsd.rd installed ($major.$minor)"
else
let minor=$minor+1
signify -q -C -p /etc/signify/openbsd-${major}${minor}-base.pub -x SHA256.sig *tgz bsd* INS*
if [ $? -eq 0 ]; then
doas cp bsd.rd /
echo "Success: bsd.rd installed ($major.$minor)"
else
echo signify failed
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment