NetBSD-Users archive

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

autoinst.sh for GPT



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

I've prepared a script to automatically install NetBSD on a GPT disk.
It's tuned to work in an environment with constrain set of utilities,
optimized for boot.iso and boot-com.iso.

ftp://ftp.netbsd.org/pub/NetBSD/misc/kamil/autoinst.sh

Q: What does it do?
1. Partitioning GPT (ROOT + SWAP).
2. Fetching sets and unpacking to new disk.
3. Introductory setuping fstab, root password, bootloader, rc.conf
(sshd, dhcpcd, hostname).

Q: Is there a usage() string?
Yes, here you are:
autoinst.sh [-s swap-size-mb] [-S swap-size-blocks] [-r root-password]
[-c console-type] [-C console-speed] [-h host-name] [-p] device-name

Where:
- -s|-S set swap size in megabytes, the rest will be used for root (ffsv2)
- -r set root password from command line (insecure, this is just to
deploy a machine without empty password)
- -c|-C options to tune for serial usage, e.g. inside qemu -nographic
- -h your desired hostname (default: netbsd)
- -p optionally fetch the stable source release of pkgsrc
device-name stands for hardware device name, eg. wd0 or ld0 (virtio)

Q: How to use it to deploy a new installation inside KVM?
1. Create qemu disk
qemu-img create -f qcow2 netbsd7.0_amd64 10G

2. Run installer
qemu-system-x86_64 \
	-enable-kvm \
	-net nic,model=virtio -net user \
	-m 2G \
	-cdrom boot-com.iso \
	-nographic \
	-smp cores=2 \
	-drive file= netbsd7.0_amd64,media=disk,if=virtio \
	-boot d

3. Fetch and run autoinst.sh
Exit to shell from the installer (sysinst), type ctrl-c, and next:
cd /tmp (enter writable directory)
ftp ftp://ftp.netbsd.org/pub/NetBSD/misc/kamil/autoinst.sh
chmod +x autoinst.sh
./autoinst.sh -s 128 -r mypass -c com0 -C 9600 ld0
(take a coffee break)
If everything went OK, just type:
poweroff

4. Run inside your newly installed system
qemu-system-x86_64 \
	-enable-kvm \
	-net nic,model=virtio -net user \
	-m 2G \
	-nographic \
	-smp cores=2 \
	-drive file=netbsd7.0_amd64,media=disk,if=virtio \
	-boot c

Q: Why to bother with sshd and serial?
Because it was designed for two types of environments:
1. A setup without vga/console output, after the system installation.
Every fail will result with an automatic intervention and need to
boostrap installer from scratch.
2. A setup for just console interface through qemu. It's fairy more
suitable for me than vnc.

Q: Where does it come from?
It's a fork of autoinst.sh by asau@ from
ftp://ftp.netbsd.org/pub/NetBSD/misc/asau/autoinst.sh tuned for my
needs. It's rumored to be a descendant of a fossil of real world
deployment script.

Q: Credit? License?
Most credit should go to the author of the original autoinst.sh (asau@).

Please treat my changes to the original version, as a BSD/MIT licensed
work - use it entirely at your own risk.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJWEe4/AAoJEEuzCOmwLnZsvbMP/1m2xK+MQB0d4Jp4yH53s0uL
VlSqmi++4PUZsyEUWRgKnTpSqDM/Jvum2DHseqzvT9txC2wOVLSkgP4pDa5V7pLz
vSTiSnIBcU3O4RJ17SgfGQNR9E2n9fVoCSc/BpnZ4b+3vlWMt8Zw5yRu/rAHTQmO
n2FCFy3Ut+KQf+Zkb8gZNbHbflB9KUVmw2uq8z+OutGdnkAcHyTiVHyhCUnc8ZBj
6GB4knYacxET6MtRnYxDIJ/+2S7ev5bUGCLLCrf7rTIbtnmySsh63WsLylUIjoqu
vgVVjaXpdKkOq5WDU0leLB1skksQhhM7EZzydiUrVl8uzouL/GN4R5R9I3t0/AuU
lEhZ78EtYlt8st8V+eGnB5FFuRW7Yhskc5vekJPvlSoEbCJrcLrkJ9cofaT1ptF3
3gniLW2hVb1ZOx7BUrmc6X0moW07DwmNo0RtqzoDdb3fLr2DtmLgfz4ixNxT0b+B
9DnfrW4ICnbmg0ILqWg/kPLo+B8qEjiGAyhV9MNd729DhSWPWD9CdFAYV9Ml92U+
To4V5d0Ip6H9wI5I3/XoqbQiCNyuWXGxkc2fuIhPw8cFwDd0uzdKdp5XqlIpn/Xa
XUq6shKyQ8HOQy2G3W4OzvqLkQubGzuhjiKeRIclbOVlEnK7KKrkqfdjmRXB/Uxz
ue9xHGs2jh+/oF99Yg9j
=76yM
-----END PGP SIGNATURE-----


Home | Main Index | Thread Index | Old Index