Re: Anyone working on an automated install?

Aleksej Saushev <[email protected]>
Newsgroups gmane.os.netbsd.devel.installation
Message-ID <[email protected]>
Aleksej Saushev <[email protected]> writes:

> Slightly improved version (with comments on potential catches).

Same with bug fixed. I find it characteristic that no-one noticed it.

(I hope that it is clear how to add initial configuration to it.)


-- 
HE CE3OH...
autoinst.sh (application/x-sh, 1.6 KB)
#!/bin/sh
set -e

: ${SD:=vnd0} # default to virtual storage device
: ${SWAPSIZE:=$((2 "*" 1024 "*" 16))} # reserve 16 MB swap

# Path to installation sets:
: ${OBJDIR:=/usr/obj}
: ${RELEASEDIR:=${OBJDIR}/releasedir}
: ${SETSDIR:=${RELEASEDIR}/$(uname -m)/binary/sets}

: ${TMPDIR:=/tmp} # temporary directory

# Disk partitioning
SIZE=$(fdisk ${SD} 2>/dev/null | sed -ne "/^total sectors:/{s/^[^:]*[^0-9]*//;p;q;}")
fdisk -f -v -u -i -0 -a -s 169/64/$(($SIZE - 64)) ${SD}
fdisk -f -c /usr/mdec/mbr ${SD}

# Extract BSD label:
disklabel ${SD} >${TMPDIR}/image.label ||: # ignore error status, the label doesn't exist usually
# Replace partition data in BSD label:
ed -s ${TMPDIR}/image.label <<EOF
/^$/
+,\$d
a
4 partitions:
#        size                    offset     fstype [fsize bsize cpg/sgs]
 a: $(($SIZE - $SWAPSIZE - 64))      64     4.2BSD      0     0     0
 b: ${SWAPSIZE}  $(($SIZE - $SWAPSIZE))       swap
 c: $(($SIZE - 64))                  64     unused      0     0
 d: ${SIZE}                           0     unused      0     0
.
w
q
EOF
# Write BSD label back:
disklabel -R ${SD} ${TMPDIR}/image.label

# Now create file systems, and unpack sets
newfs -O2 ${SD}a
mkdir -p ${TMPDIR}/image.target
mount /dev/${SD}a ${TMPDIR}/image.target

cd ${TMPDIR}/image.target
for s in base etc; do pax -zrpe -f ${SETSDIR}/$s.tgz; done
for s in kern-GENERIC modules; do pax -zrpe -f ${SETSDIR}/$s.tgz; done

# Make it bootable:
cp usr/mdec/boot .
installboot -vf -o timeout=2 /dev/r${SD}a /usr/mdec/bootxx_ffsv2
# ...only make sure that this boot code corresponds to file system in newfs above.

# Wrap up:
sync
cd # don't hold file system
umount ${TMPDIR}/image.target
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.