NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: automatic installation of NetBSD



On Sat 06 Jun 2009 at 12:47:19 +0200, Goran wrote:
> I wanna install automatically NetBSD with a simple script. I do such
> with Debian / Ubuntu-Server Linux for years. By this, the most important
> tool is debootstrap.

You can have sysinst create a script of what it did. It is in the
Utility menu (option e, after choosing language and keyboard). Then d:
Logging functions, then b: Scripting.

The script ends up in /tmp/sysinst.sh in the installation-ramdisk.
It looks like this: (and I think one EOF is in a wrong place, actually)

#!/bin/sh
# Script started at: Sat Jun  6 21:12:08 2009

cat <<EOF >>/etc/disktab
xxx|NetBSD installation generated:\
        :dt=unknown:ty=winchester:\
        :nc#2080:nt#16:ns#63:\
        :sc#1008:su#2097152:\
        :se#512:\
        :pa#2097089:oa#63:ta=4.2BSD:ba#8192:fa#1024:ta=4.2BSD:\
        :pb#0:ob#0:tb=unused:\
        :pc#2097089:oc#63:tc=unused:\
        :pd#2097152:od#0:td=unused:\
        :pe#0:oe#0:te=unused:\
        :pf#0:of#0:tf=unused:\
        :pg#0:og#0:tg=unused:\
        :ph#0:oh#0:th=unused:\
        :pi#0:oi#0:ti=unused:\
        :pj#0:oj#0:tj=unused:\
        :pk#0:ok#0:tk=unused:\
        :pl#0:ol#0:tl=unused:\
        :pm#0:om#0:tm=unused:\
        :pn#0:on#0:tn=unused:\
        :po#0:oo#0:to=unused:\
        :pp#0:op#0:tp=unused:
EOF
disklabel -w -r -f /tmp/disktab wd0 'xxx'
/sbin/newfs -V2 -O 1 -b 8192 -f 1024 /dev/rwd0a
/bin/mkdir -p /targetroot/
/sbin/mount -tffs -o async /dev/wd0a /targetroot/
/bin/mkdir -p /targetroot/etc
cat <<EOF >/targetroot/etc/fstab
# NetBSD /etc/fstab
# See /usr/share/examples/fstab/ for more examples.
/dev/wd0a               /       ffs     rw               1 1
kernfs          /kern   kernfs  rw
ptyfs           /dev/pts        ptyfs   rw
procfs          /proc   procfs  rw
/dev/cd0a               /cdrom  cd9660  ro,noauto
/bin/mkdir -p /targetroot/kern
/bin/mkdir -p /targetroot/proc
/bin/mkdir -p /targetroot/dev/pts
/bin/mkdir -p /targetroot/cdrom
EOF
/bin/cp /usr/mdec/boot /targetroot/boot
mkdir -m 755 /mnt2
/sbin/mount -rt cd9660 /dev/cd0a /mnt2
cd /targetroot/
progress -zf /mnt2//i386/binary/sets/kern-GENERIC.tgz tar --chroot -xhepf -
cd /targetroot/
progress -zf /mnt2//i386/binary/sets/base.tgz tar --chroot -xhepf -
cd /targetroot/
progress -zf /mnt2//i386/binary/sets/etc.tgz tar --chroot -xhepf -
cd /targetroot/
progress -zf /mnt2//i386/binary/sets/comp.tgz tar --chroot -xhepf -
cd /targetroot/
progress -zf /mnt2//i386/binary/sets/games.tgz tar --chroot -xhepf -
cd /targetroot/
progress -zf /mnt2//i386/binary/sets/man.tgz tar --chroot -xhepf -
cd /targetroot/
progress -zf /mnt2//i386/binary/sets/misc.tgz tar --chroot -xhepf -
cd /targetroot/
progress -zf /mnt2//i386/binary/sets/tests.tgz tar --chroot -xhepf -
cd /targetroot/
progress -zf /mnt2//i386/binary/sets/text.tgz tar --chroot -xhepf -
cd /targetroot/
progress -zf /mnt2//i386/binary/sets/xbase.tgz tar --chroot -xhepf -
cd /targetroot/
progress -zf /mnt2//i386/binary/sets/xcomp.tgz tar --chroot -xhepf -
cd /targetroot/
progress -zf /mnt2//i386/binary/sets/xetc.tgz tar --chroot -xhepf -
cd /targetroot/
progress -zf /mnt2//i386/binary/sets/xfont.tgz tar --chroot -xhepf -
cd /targetroot/
progress -zf /mnt2//i386/binary/sets/xserver.tgz tar --chroot -xhepf -
/bin/mkdir -p /targetroot/dev
cd /targetroot/dev
/bin/sh MAKEDEV all
/sbin/umount /mnt2
passwd -l root
chpass -s /bin/sh root
if [ $? != 0 ]; then echo "/targetroot/netbsd does not exist!"; fi
if [ $? != 0 ]; then echo "/targetroot/etc does not exist!"; fi
if [ $? != 0 ]; then echo "/targetroot/etc/fstab does not exist!"; fi
if [ $? != 0 ]; then echo "/targetroot/sbin/init does not exist!"; fi
if [ $? != 0 ]; then echo "/targetroot/bin/sh does not exist!"; fi
if [ $? != 0 ]; then echo "/targetroot/etc/rc does not exist!"; fi
if [ $? != 0 ]; then echo "/targetroot/etc/rc.subr does not exist!"; fi
if [ $? != 0 ]; then echo "/targetroot/etc/rc.conf does not exist!"; fi
if [ $? != 0 ]; then echo "/targetroot/dev does not exist!"; fi
if [ $? != 0 ]; then echo "/targetroot/dev/console does not exist!"; fi
if [ $? != 0 ]; then echo "/targetroot/etc/fstab does not exist!"; fi
if [ $? != 0 ]; then echo "/targetroot/sbin/fsck does not exist!"; fi
if [ $? != 0 ]; then echo "/targetroot/sbin/fsck_ffs does not exist!"; fi
if [ $? != 0 ]; then echo "/targetroot/sbin/mount does not exist!"; fi
if [ $? != 0 ]; then echo "/targetroot/sbin/mount_ffs does not exist!"; fi
if [ $? != 0 ]; then echo "/targetroot/sbin/mount_nfs does not exist!"; fi
sed -an -e 's/^rc_configured=NO/rc_configured=YES/;H;$!d;g;w /etc/rc.conf' /etc/
rc.conf
cat <<EOF >>/targetroot/etc/rc.conf
wscons=YES
EOF
sed -an -e '/^ttyE[1-9]/s/off/on/;H;$!d;g;w /etc/ttys' /etc/ttys
/sbin/umount /targetroot/
# Script ended at: Sat Jun  6 23:27:02 2009

-Olaf.
-- 
___ Olaf 'Rhialto' Seibert    -- You author it, and I'll reader it.
\X/ rhialto/at/xs4all.nl      -- Cetero censeo "authored" delendum esse.


Home | Main Index | Thread Index | Old Index