scripts

misc scripts and tools
git clone git://git.2f30.org/scripts
Log | Files | Refs

sysbuild (800B)


      1 #!/bin/sh -e
      2 #
      3 # Build OpenBSD from source.  Works with 6.1 and onwards.
      4 #
      5 # Typical usage:
      6 #
      7 # sysbuild k && reboot
      8 # sysbuild w x f && reboot
      9 
     10 K=`sysctl -n kern.osversion | cut -d# -f1`
     11 
     12 upgradekernel() {
     13 	cd /usr/src/sys/arch/$(machine)/compile/$K
     14 	make clean
     15 	make obj
     16 	make config
     17 	make
     18 	make install
     19 	chmod 600 /bsd
     20 }
     21 
     22 upgradeworld() {
     23 	cd /usr/src
     24 	make obj
     25 	make build
     26 }
     27 
     28 upgradexenocara() {
     29 	cd /usr/xenocara
     30 	make bootstrap
     31 	make obj
     32 	make build
     33 }
     34 
     35 finish() {
     36 	sysmerge
     37 	cd /dev && ./MAKEDEV all
     38 	fw_update
     39 }
     40 
     41 usage() {
     42 cat << EOF
     43 usage: sysbuild [k] [w] [x] [f]
     44 k  Upgrade kernel
     45 w  Upgrade world
     46 x  Upgrade xenocara
     47 f  Finalize upgrade
     48 EOF
     49 exit 1
     50 }
     51 
     52 for arg in "$@"; do
     53 	case "$arg" in
     54 	k) upgradekernel ;;
     55 	w) upgradeworld ;;
     56 	x) upgradexenocara ;;
     57 	f) finish ;;
     58 	*) usage ;;
     59 	esac
     60 done