#!/bin/ksh # Updating NetBSD for dummies # 2011/04/04 # code@dayid.org case $1 in --help) echo "Arguments expected are: --help: displays this help --all: builds tools, distribution, and kernel --part2: does the second half of an upgrade (after reboot)" exit 0 ;; --all) echo "Moving to /usr/src" && cd /usr/src echo "Updating sources from CVS" && cvs update -dP echo "Building tools" && ./build.sh -O ../obj -T ../tools -U -u tools > /usr/src/PROGRESS.txt 2>&1 && TOOLS=0 || TOOLS=1 if [ $TOOLS = 0 ]; then echo "Tools Successful" else echo "Tools FAILED" && exit 1 fi echo "Building distribution" && ./build.sh -O ../obj -T ../tools -U -u distribution >> /usr/src/PROGRESS.txt 2>&1 && DISTRO=0 || DISTRO=1 if [ $DISTRO = 0 ]; then echo "Distribution Successful" else echo "Distribution FAILED" && exit 1 fi echo "Building kernel" && ./build.sh -O ../obj -T ../tools -U -u kernel=GENERICPF >> /usr/src/PROGRESS.txt 2>&1 && KERNEL=0 || KERNEL=1 if [ $KERNEL = 0 ]; then echo "Kernel Successful" else echo "Kernel FAILED" && exit 1 fi cd ../obj/sys/arch/cobalt/compile/GENERICPF sudo mv /netbsd /netbsd.old sudo cp ./netbsd /netbsd echo "Reboot then run --part2" echo -n "Reboot now? " read ANS if [ $ANS = y ] then sudo /sbin/shutdown -fr now fi ;; --part2) cd /usr/src/ sudo ./build.sh -O ../obj -T ../tools -U install=/ && \ sudo /usr/src/usr.sbin/postinstall/postinstall -s /usr/src -d // fix defaults mtree obsolete && \ sudo /usr/sbin/etcupdate -s /usr/src && \ echo "Reboot and you're good!" echo -n "Reboot now? " read ANS if [ $ANS = y ] then sudo /sbin/shutdown -fr now fi ;; *) echo "Try --help if you're not sure what you're doing." ;; esac