Hiya dears, I'm not sure if this the appropriate place, or if this is something you'd like to consider; but I wanted to look at simplifying the OS upgrade process. Turning this: ------ > cd /usr > make src-create > ... > make buildworld > make buildkernel > ... > make upgrade ------
Into this: ------ > /usr/upgrade Upgrading DragonFly BSD For more information see: `man build` `man config` /usr/src/README /usr/src/UPDATING http://www.dragonflybsd.org/docs/handbook/ It is possible to run this script without root privileges Usage: upgrade [configuration] Configuration is "X86_64_GENERIC" Latest releases: [1] DragonFly_RELEASE_5_6 [2] DragonFly_RELEASE_5_4 [3] DragonFly_RELEASE_5_2 [4] DragonFly_RELEASE_5_0 [5] DragonFly_RELEASE_4_8 Select [1-5]: ------ I've tested it on new installs of 4.8, 5.2, and 5.4, and with installs previously upgraded with `make src-create/src-create-shallow` Anyway, here's the script: ------ #!/bin/sh # ensure PATH contains what we use export PATH=/sbin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin echo 'Upgrading DragonFly BSD' echo '' echo 'For more information see:' echo ' `man build` `man config`' echo ' /usr/src/README /usr/src/UPDATING' echo ' http://www.dragonflybsd.org/docs/handbook/' echo '' errmsg() { echo "Failed: $1"; exit; } # warn if root, or enable non-root usage test `id -u` -eq 0 \ && echo 'It is possible to run this script without root privileges' \ || test `stat -f '%u' /usr/src` -eq 0 -o `stat -f '%u' /usr/obj` -eq 0 \ && su -m root -c "chown -R `id -u` /usr/src; chown -R `id -u` /usr/obj" 2>/dev/null # get KERNCONF KERNCONF="$1" test "$KERNCONF" \ || { echo 'Usage: upgrade [configuration]'; KERNCONF='X86_64_GENERIC'; } echo "Configuration is \"$KERNCONF\"" echo '' # create the base repository test -d /usr/src \ || { su -m root -c "mkdir /usr/src && chown `id -u` /usr/src" \ && cd /usr/src \ && git init >/dev/null \ && git remote add origin git://git.dragonflybsd.org/dragonfly.git; } cd /usr/src # test network connection git ls-remote origin not-here >/dev/null 2>&1 \ || errmsg 'Could not reach git://git.dragonflybsd.org' # list possible releases to choose from RELEASES=`git ls-remote -q | grep 'DragonFly_RELEASE' | tail -5 -r | sed -E 's/.*\/heads\///'` echo 'Latest releases:' echo "$RELEASES" | cat -n | sed -E 's/^ +([0-9]+)./ [\1] /' echo '' printf 'Select [1-5]: '; read choice # choice is acceptable number in range 1-5 test $choice -ge 1 -a $choice -le 5 2>/dev/null \ && echo "$RELEASES" | head -"$choice" 2>/dev/null >&2 \ || { echo 'Requires a number [1-5]'; exit; } CHOICE=`echo "$RELEASES" | head -"$choice" | tail -1` # install git fetch --depth=1 origin "$CHOICE" \ || errmsg 'git fetch' \ && git checkout "$CHOICE" \ || errmsg 'git checkout' \ && test -f "/usr/src/sys/config/$KERNCONF" \ || errmsg "Configuration \"$KERNCONF\" not in /usr/src/sys/config" \ && make -j`sysctl -n hw.ncpu` buildworld \ || errmsg 'make buildworld' \ && make -j`sysctl -n hw.ncpu` buildkernel KERNCONF="$KERNCONF" \ || errmsg 'make buildkernel' \ && su -m root -c "make installkernel KERNCONF='$KERNCONF'" \ || errmsg 'make installkernel' \ && su -m root -c 'make installworld' \ || errmsg 'make installworld' \ && su -m root -c 'make upgrade' \ || errmsg 'make upgrade' ------
