Skip to content

Instantly share code, notes, and snippets.

@gretel
Last active March 13, 2021 00:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gretel/eb492f5b6b73e1ae7673 to your computer and use it in GitHub Desktop.
Save gretel/eb492f5b6b73e1ae7673 to your computer and use it in GitHub Desktop.
get openbsd distribution files, and update the system in-place. this is very dangerous and you should not do it.
#!/bin/sh
#
#MIRROR=https://ftp.bytemine.net/pub/OpenBSD/snapshots
#MIRROR=https://ftp.hostserver.de/pub/OpenBSD/snapshots
#MIRROR=https://ftp.openbsd.org/pub/OpenBSD/snapshots
MIRROR=https://cdn.openbsd.org/pub/OpenBSD/snapshots
if [ "$1" == "" ]; then
ARCH=`uname -p` # default
echo "using default architecture ${ARCH}!"
else
ARCH=$1
fi
if [ "$2" == "" ]; then
VERSION=`uname -r | sed -e 's/\.//g'` # default
echo "using default version ${VERSION}!"
else
VERSION=$2
fi
URL=${MIRROR}/${ARCH}
echo "ready to retrieve install set for version '${VERSION}/${ARCH}' from '${URL}'?"
read READY
mkdir -p ${ARCH} || exit 2
cd ${ARCH} || exit 2
rm -f index.txt
ftp -i -V -a ${URL}/base${VERSION}.tgz
ftp -i -V -a ${URL}/comp${VERSION}.tgz
ftp -i -V -a ${URL}/man${VERSION}.tgz
ftp -i -V -a ${URL}/pxeboot
ftp -i -V -a ${URL}/bsd
ftp -i -V -a ${URL}/bsd.rd
ftp -i -V -a ${URL}/bsd.mp
ftp -i -V -a ${URL}/xbase${VERSION}.tgz
ftp -i -V -a ${URL}/SHA256
ftp -i -V -a ${URL}/SHA256.sig
ls -ln *tgz *sig bsd* pxeboot > index.txt
cat index.txt
#!/bin/sh
#
set -e
#MIRROR=https://ftp.hostserver.de/pub/OpenBSD/snapshots/packages
#MIRROR=https://ftp.bytemine.net/pub/OpenBSD/snapshots/packages
#MIRROR=https://ftp.openbsd.org/pub/OpenBSD/snapshots/packages
MIRROR=https://cdn.openbsd.org/pub/OpenBSD/snapshots/packages
if [ `id -u` != 0 ]; then
echo "please be a superuser."
exit 1
fi
#echo "current version: `uname -p -r`"
echo "current version: `uname -a`"
if [ "$1" == "" ]; then
ARCH=`uname -p` # default
echo "using default architecture (${ARCH})!"
else
ARCH=$1
fi
if [ "$2" == "" ]; then
VERSION=`uname -r | sed -e 's/\.//g'` # default
echo "using default version (${VERSION})!"
else
VERSION=$2
fi
MARCH=`uname -p`
if [ $MARCH != $ARCH ]; then
echo "selected architecture (${ARCH}) does not match installed one (${MARCH}), are you sure?"
read SURE
fi
echo "ready to upgrade to '${VERSION}/${ARCH}'?"
read READY
cd ${ARCH} || exit
cp /bsd /obsd
cp bsd bsd.rd bsd.mp / || exit
cp /bsd /bsd.sp
cp /bsd.mp /bsd
sync
cp /sbin/reboot /sbin/oreboot
#tar -C / -xzphf xserv${VERSION}.tgz
#tar -C / -xzphf xfont${VERSION}.tgz
#tar -C / -xzphf xshare${VERSION}.tgz
tar -C / -xzphf xbase${VERSION}.tgz
#tar -C / -xzphf game${VERSION}.tgz
tar -C / -xzphf comp${VERSION}.tgz
tar -C / -xzphf man${VERSION}.tgz
tar -C / -xzphf base${VERSION}.tgz # Install last!
#tar -C /tmp -xzphf etc${VERSION}.tgz
sync
#cd /dev
#./MAKEDEV all
cd /tmp
sysmerge -b
#newaliases
mtree -qdef /etc/mtree/4.4BSD.dist -p / -u
cap_mkdb /etc/login.conf
usermod -L dovecot _dovecot
usermod -L unbound _unbound
PKG_PATH=${MIRROR}/${ARCH} \
pkg_add -uUi
sysmerge -p
#sudo pip install --upgrade pip
#sudo pip list --outdated | sed 's/(.*//g' | xargs sudo pip install -U
echo "update done. use '/sbin/oreboot' to reboot."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment