review install
[zfsinstaller.git] / zfsinstall.sh
index f78c88f26de1403dccb4515aaf821aa294ddde26..6d86850273c3bebc3da02b3cec0c2fccc2ab4ce6 100644 (file)
@@ -33,40 +33,40 @@ echo partitioning ${DESTDISK}
 echo =============
 
 gpart create -s gpt ${DESTDISK}
-gpart add -a 1m -t freebsd-boot -s 128k -l boot ${DESTDISK}
-gpart add -a 1m -s 32G -t freebsd-swap -l swap ${DESTDISK}
+gpart add -a 4k -t freebsd-boot -s 512k -l gptboot0 ${DESTDISK}
 gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ${DESTDISK}
-gpart add -a 1m -t freebsd-zfs -l syszfs ${DESTDISK}
+gpart add -a 1m -s 32G -t freebsd-swap -l swap0 ${DESTDISK}
+gpart add -a 1m -t freebsd-zfs -l zfs0 ${DESTDISK}
+gpart set -a active ${DESTDISK}
 
-gpart show ${DESTDISK}  1>/dev/null
+gpart show ${DESTDISK}  
 
 sysctl vfs.zfs.min_auto_ashift=12
 
 echo set up zfs pool: ${ZPOOL} alt mount: ${DESTDIR}
 echo =================
 
-zpool create  -m none -f -R ${DESTDIR} ${ZPOOL} ${DESTDISK}p3
+zpool create  -m none -f -R ${DESTDIR} ${ZPOOL} ${DESTDISK}p3 ada1
 if [ "${?}" -ne 0 ]; then
        echo "unable to create zpool"
        exit 1
 fi
 
 
-for I in ROOT VAR HOME; do
+for I in ROOT VAR HOME DATA; do
        zfs create -o mountpoint=none -o canmount=off  ${ZPOOL}/${I}
 done
 
 zfs create -o atime=off -o mountpoint=/ ${ZPOOL}/ROOT/master
+
 zfs create -o mountpoint=/usr/obj ${ZPOOL}/ROOT/obj
 zfs create -o compression=off -o mountpoint=/usr/src ${ZPOOL}/ROOT/src
+zfs create -o mountpoint=/usr/doc -o compression=on ${ZPOOL}/ROOT/doc
 # useless ? as far /tmp mountpoint will be mounted by tmpfs
 zfs create -o mountpoint=/tmp ${ZPOOL}/ROOT/tmp
 
 zfs create -o mountpoint=/usr/local ${ZPOOL}/LOCAL
 zfs create -o mountpoint=/usr/local/etc ${ZPOOL}/LOCAL/config
-zfs create -o copies=1 -o mountpoint=/usr/src -o compression=off ${ZPOOL}/src
-zfs create -o copies=1 -o mountpoint=/usr/doc -o compression=on ${ZPOOL}/doc
-zfs create -o copies=1 -o mountpoint=/usr/obj -o compression=on ${ZPOOL}/obj
 
 
 zfs create -o mountpoint=/var ${ZPOOL}/VAR/master
@@ -80,6 +80,7 @@ zfs create -o exec=off -o setuid=off -o mountpoint=/var/tmp ${ZPOOL}/VAR/tmp
 
 zfs create -o mountpoint=/usr/home ${ZPOOL}/HOME/master
 
+zpool set bootfs=${ZPOOL}/ROOT/master ${ZPOOL}
 
 chmod 1777 ${DESTDIR}/tmp ${DESTDIR}/var/tmp
 
@@ -96,7 +97,7 @@ echo =======================================
 
 
 for I in base.txz kernel.txz lib32.txz; do
-       fetch http://ftp.freebsd.org/pub/FreeBSD/snapshots/amd64/12.0-ALPHA8/${I}
+       fetch http://ftp.freebsd.org/pub/FreeBSD/releases/amd64/12.0-BETA2/${I}
        tar --unlink -pJxf ${I} -C ${DESTDIR}
 done
 
@@ -104,7 +105,7 @@ echo writing configuration files
 echo ==========================
 
 cat << EOF >> ${DESTDIR}/etc/fstab
-/dev/${DESTDISK}p2 none        swap    sw  0   0
+/dev/${DESTDISK}p3 none        swap    sw  0   0
 tmpfs  /tmp    tmpfs   rw,mode=1777    0       0
 EOF
 
@@ -120,34 +121,31 @@ EOF
 cat << EOF >> ${DESTDIR}/etc/rc.conf
 sshd_enable="YES"
 sendmail_enable="NONE"
-kld_list="vmm cuse4bsd cpuctl filemon"
+kld_list="vmm cuse4bsd cpuctl filemon"
 ntpd_enable="YES"
 # Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
 dumpdev="AUTO"
 zfs_enable="YES"
 EOF
 
-cd ${SCRIPTBASE}
-for I in resolv.conf rc.conf.local; do
-       if [ -r "${I}" ]; then
-               echo installing ${I}
-               install -o root -g wheel -m 0644  ${I} ${DESTDIR}/etc/
-       fi
-done
-
-for I in loader.conf.local; do
-       if [ -r "${I}" ]; then
-               echo installing ${I}
-               install -o root -g wheel -m 0644 ${I} ${DESTDIR}/boot/
-       fi
+COPYCAT="/etc"
+cd ${SCRIPTBASE}${COPYCAT} || exit 1
+echo installing files into ${COPYCAT}
+for I in *.conf*; do
+        if [ -r "${I}" -a -f ${I} ]; then
+                install -o root -g wheel -m 0644  ${I} ${DESTDIR}${COPYCAT}/
+        fi
 done
-
-echo installing rc.conf.d
-install -o root -g wheel -d -m 0755 ${DESTDIR}/etc/rc.conf.d 
-if [ -d "./rc.conf.d" ]; then 
-       echo installing files into rc.conf.d
-       install -o root -g wheel -m 0644 ./rc.conf.d/* ${DESTDIR}/etc/rc.conf.d/
-fi
+COPYCAT="/etc/rc.conf.d"
+cd ${SCRIPTBASE}${COPYCAT} || exit 1
+install -o root -g wheel -d -m 0755 ${DESTDIR}${COPYCAT} || exit 1
+echo installing files into ${COPYCAT}
+install  -o root -g wheel -m 0644 * ${DESTDIR}${COPYCAT}/
+COPYCAT="/etc/rc.conf.d/network"
+cd ${SCRIPTBASE}${COPYCAT} || exit 1
+install -o root -g wheel -d -m 0755 ${DESTDIR}${COPYCAT} || exit 1
+echo installing files into ${COPYCAT}
+install  -o root -g wheel -m 0644 * ${DESTDIR}${COPYCAT}/
 
 chroot ${DESTDIR} passwd
 chroot ${DESTDIR} adduser