Skip to content

Instantly share code, notes, and snippets.

@gretel
Last active Mar 13, 2021
Embed
What would you like to do?
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