tweaks
This commit is contained in:
@@ -93,40 +93,49 @@ if ! [ "$?" = "0" ]; then
|
||||
fi
|
||||
echo "Done."
|
||||
|
||||
zfs create -o canmount=off -o mountpoint=none rpool/ROOT
|
||||
zfs create -o canmount=off -o mountpoint=none bpool/BOOT
|
||||
zfs create -o canmount=noauto -o mountpoint=/ rpool/ROOT/ubuntu
|
||||
zfs mount rpool/ROOT/ubuntu
|
||||
zfs create -o canmount=noauto -o mountpoint=/boot bpool/BOOT/ubuntu
|
||||
zfs mount bpool/BOOT/ubuntu
|
||||
zfs create rpool/home
|
||||
zfs create -o mountpoint=/root rpool/home/root
|
||||
zfs create -o canmount=off rpool/var
|
||||
zfs create -o canmount=off rpool/var/lib
|
||||
zfs create rpool/var/log
|
||||
zfs create rpool/var/spool
|
||||
zfs create -o com.sun:auto-snapshot=false rpool/var/cache
|
||||
zfs create -o com.sun:auto-snapshot=false rpool/var/tmp
|
||||
chmod 1777 /mnt/var/tmp
|
||||
zfs create rpool/opt
|
||||
zfs create rpool/srv
|
||||
zfs create -o canmount=off rpool/usr
|
||||
zfs create rpool/usr/local
|
||||
zfs create rpool/var/mail
|
||||
zfs create -o com.sun:auto-snapshot=false rpool/var/lib/docker
|
||||
zfs create -o com.sun:auto-snapshot=false rpool/var/lib/nfs
|
||||
zfs create -o com.sun:auto-snapshot=false rpool/tmp
|
||||
chmod 1777 /mnt/tmp
|
||||
exit 0
|
||||
# debootstrap bionic /mnt
|
||||
# zfs set devices=off rpool
|
||||
# echo HOSTNAME > /mnt/etc/hostname
|
||||
# echo "127.0.1.1 $hostname" >> /mnt/etc/hosts
|
||||
# vi /mnt/etc/hosts
|
||||
# echo "deb http://archive.ubuntu.com/ubuntu bionic main universe\ndeb-src http://archive.ubuntu.com/ubuntu bionic main universe\ndeb http://security.ubuntu.com/ubuntu bionic-security main universe\ndeb-src http://security.ubuntu.com/ubuntu bionic-security main universe\ndeb http://archive.ubuntu.com/ubuntu bionic-updates main universe\ndeb-src http://archive.ubuntu.com/ubuntu bionic-updates main universe" > /mnt/etc/apt/sources.list
|
||||
echo ""
|
||||
echo "Setting up main zpool dataset configuration..."
|
||||
errors=`zfs create -o canmount=off -o mountpoint=none rpool/ROOT 2>&1 1>/dev/null && zfs create -o canmount=off -o mountpoint=none bpool/BOOT 2>&1 1>/dev/null && zfs create -o canmount=noauto -o mountpoint=/ rpool/ROOT/ubuntu 2>&1 1>/dev/null && zfs mount rpool/ROOT/ubuntu 2>&1 1>/dev/null && zfs create -o canmount=noauto -o mountpoint=/boot bpool/BOOT/ubuntu 2>&1 1>/dev/null && zfs mount bpool/BOOT/ubuntu 2>&1 1>/dev/null && zfs create rpool/home 2>&1 1>/dev/null && zfs create -o mountpoint=/root rpool/home/root 2>&1 1>/dev/null && zfs create -o canmount=off rpool/var 2>&1 1>/dev/null && zfs create -o canmount=off rpool/var/lib 2>&1 1>/dev/null && zfs create rpool/var/log 2>&1 1>/dev/null && zfs create rpool/var/spool 2>&1 1>/dev/null && zfs create -o com.sun:auto-snapshot=false rpool/var/cache 2>&1 1>/dev/null && zfs create -o com.sun:auto-snapshot=false rpool/var/tmp 2>&1 1>/dev/null && chmod 1777 /mnt/var/tmp 2>&1 1>/dev/null && zfs create rpool/opt 2>&1 1>/dev/null && zfs create rpool/srv 2>&1 1>/dev/null && zfs create -o canmount=off rpool/usr 2>&1 1>/dev/null && zfs create rpool/usr/local 2>&1 1>/dev/null && zfs create rpool/var/mail 2>&1 1>/dev/null && zfs create -o com.sun:auto-snapshot=false rpool/var/lib/docker 2>&1 1>/dev/null && zfs create -o com.sun:auto-snapshot=false rpool/var/lib/nfs 2>&1 1>/dev/null && zfs create -o com.sun:auto-snapshot=false rpool/tmp 2>&1 1>/dev/null && chmod 1777 /mnt/tmp 2>&1 1>/dev/null`
|
||||
|
||||
if ! [ "$?" = "0" ]; then
|
||||
echo "Error setting up ZFS settings - $errors"
|
||||
exit 5
|
||||
fi
|
||||
echo "Done."
|
||||
|
||||
echo ""
|
||||
echo "Starting debian bootstrap..."
|
||||
errors=`debootstrap bionic /mnt 2>&1 1>/dev/null`
|
||||
if ! [ "$?" = "0" ]; then
|
||||
echo "Failed to bootstrap root - $errors"
|
||||
exit 6
|
||||
fi
|
||||
echo "Done."
|
||||
|
||||
echo ""
|
||||
echo "Disabling ZFS devices..."
|
||||
errors=`zfs set devices=off rpool 2>&1 1>/dev/null`
|
||||
if ! [ "$?" = "0" ]; then
|
||||
echo "Failed to set devices=off for root pool- $errors"
|
||||
exit 7
|
||||
fi
|
||||
echo "Done."
|
||||
|
||||
echo ""
|
||||
echo "Setting hostname..."
|
||||
echo HOSTNAME > /mnt/etc/hostname
|
||||
echo "127.0.1.1 $hostname" >> /mnt/etc/hosts
|
||||
echo "Done."
|
||||
|
||||
echo ""
|
||||
echo "Setting default apt repositories"
|
||||
echo "deb http://archive.ubuntu.com/ubuntu bionic main universe\ndeb-src http://archive.ubuntu.com/ubuntu bionic main universe\ndeb http://security.ubuntu.com/ubuntu bionic-security main universe\ndeb-src http://security.ubuntu.com/ubuntu bionic-security main universe\ndeb http://archive.ubuntu.com/ubuntu bionic-updates main universe\ndeb-src http://archive.ubuntu.com/ubuntu bionic-updates main universe" > /mnt/etc/apt/sources.list
|
||||
echo "Done."
|
||||
|
||||
# you really need static config here too!
|
||||
|
||||
echo ""
|
||||
echo "Writing netplan file"
|
||||
macaddr=$(echo $hostname|md5sum|sed 's/^\(..\)\(..\)\(..\)\(..\)\(..\).*$/02:\1:\2:\3:\4:\5/')
|
||||
network="network:\n version: 2\n renderer: networkd\n ethernets:"
|
||||
for nic in "$nicdevices"; do
|
||||
@@ -136,7 +145,8 @@ network="$network\n bridges:\n br0:\n macaddress: ${macaddr}\n dhc
|
||||
for nic in `echo "$nicdevices"`; do
|
||||
network="$network\n - ${nic}"
|
||||
done
|
||||
# echo "$network" > /mnt/etc/netplan/bridge.yaml
|
||||
echo "$network" > /mnt/etc/netplan/bridge.yaml
|
||||
echo "Done."
|
||||
|
||||
# mount --rbind /dev /mnt/dev
|
||||
# mount --rbind /proc /mnt/proc
|
||||
|
||||
Reference in New Issue
Block a user