3 # A file like this is typically copied to /usr/local/etc/rconfig/auto.sh on
4 # the rconfig server and the rconfig demon is run via 'rconfig -s -a'. When
5 # you boot the DragonFly CD you have to bring up the network, typically
6 # via 'dhclient interfacename', then run 'rconfig -a' or
7 # 'rconfig -a ip_of_server' if the server is not on the same LAN.
9 # WARNING! THIS SCRIPT WILL COMPLETELY WIPE THE DISK!
13 set xdisk = $disk$slice
15 # Refuse to do anything if the machine wasn't booted from CD
18 foreach i ( `df / | awk '{ print $1; }'` )
19 if ( $i =~ acd* ) then
24 if ( $cdboot == 0 ) then
25 echo "Aborting auto init script, machine was not booted from CD"
29 # Wipe the disk entirely
32 echo "FDISK - ALL DATA ON THE DRIVE WILL BE LOST"
33 foreach i ( 5 4 3 2 1 )
38 dd if=/dev/zero of=/dev/$disk bs=32k count=16
42 dd if=/dev/zero of=/dev/$xdisk bs=32k count=16
47 disklabel -B -r -w $xdisk
48 disklabel $xdisk > /tmp/disklabel.$xdisk
49 cat >> /tmp/disklabel.$xdisk << EOF
57 disklabel -R $xdisk /tmp/disklabel.$xdisk
64 newfs -U /dev/${xdisk}d
65 newfs -U /dev/${xdisk}e
66 newfs -U /dev/${xdisk}f
67 newfs -U /dev/${xdisk}g
72 mount /dev/${xdisk}a /mnt
78 mount /dev/${xdisk}d /mnt/var
79 mount /dev/${xdisk}e /mnt/tmp
80 mount /dev/${xdisk}f /mnt/usr
81 mount /dev/${xdisk}g /mnt/home
88 cpdup /etc.hdd /mnt/etc
97 ln -s /tmp /mnt/var/tmp
99 cat >/mnt/etc/fstab << EOF
100 # Example fstab based on /README.
102 # Device Mountpoint FStype Options Dump Pass#
103 /dev/${xdisk}a / ufs rw 1 1
104 /dev/${xdisk}b none swap sw 0 0
105 /dev/${xdisk}d /var ufs rw 2 2
106 /dev/${xdisk}e /tmp ufs rw 2 2
107 /dev/${xdisk}f /usr ufs rw 2 2
108 /dev/${xdisk}g /home ufs rw 2 2
109 proc /proc procfs rw 0 0
110 # example MFS remount (for a pristine MFS filesystem do not use -C)
111 #swap /mnt mfs rw,-C,-s=4000 0 0
114 cat >/mnt/etc/rc.conf << EOF
117 sendmail_enable="NONE"
118 dumpdev="/dev/${xdisk}b"
121 if ( ! -d /mnt/root/.ssh ) then
124 cat > /mnt/root/.ssh/authorized_keys << EOF
125 # put your ssh public keys here so you can ssh into the
126 # newly configured machine
129 # Allow public-key-only access to the root account
131 sed -e 's/#PermitRootLogin no/PermitRootLogin without-password/' < /mnt/etc/ssh/sshd_config > /mnt/etc/ssh/sshd_config.new
132 mv -f /mnt/etc/ssh/sshd_config.new /mnt/etc/ssh/sshd_config