|
|
|
|
@ -155,30 +155,28 @@ echo "deb http://archive.ubuntu.com/ubuntu bionic-updates main universe" >> /mnt
|
|
|
|
|
echo "deb-src http://archive.ubuntu.com/ubuntu bionic-updates main universe" >> /mnt/etc/apt/sources.list
|
|
|
|
|
echo "Done."
|
|
|
|
|
|
|
|
|
|
# network configuration should have optional static configuration - not just DHCP, it's very important
|
|
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
|
echo "Writing netplan file..."
|
|
|
|
|
macaddr=$(echo $hostname|md5sum|sed 's/^\(..\)\(..\)\(..\)\(..\)\(..\).*$/02:\1:\2:\3:\4:\5/')
|
|
|
|
|
echo "network:" > /mnt/etc/netplan/bridge.yaml
|
|
|
|
|
echo " version: 2" >> /mnt/etc/netplan/bridge.yaml
|
|
|
|
|
echo " renderer: networkd" >> /mnt/etc/netplan/bridge.yaml
|
|
|
|
|
echo " ethernets:" >> /mnt/etc/netplan/bridge.yaml
|
|
|
|
|
for nic in "$nics"; do
|
|
|
|
|
echo " ${nic}:" >> /mnt/etc/netplan/bridge.yaml
|
|
|
|
|
echo " dhcp4: no" >> /mnt/etc/netplan/bridge.yaml
|
|
|
|
|
done
|
|
|
|
|
echo " bridges:" >> /mnt/etc/netplan/bridge.yaml
|
|
|
|
|
echo " br0:" >> /mnt/etc/netplan/bridge.yaml
|
|
|
|
|
echo " macaddress: ${macaddr}" >> /mnt/etc/netplan/bridge.yaml
|
|
|
|
|
echo " dhcp4: yes" >> /mnt/etc/netplan/bridge.yaml
|
|
|
|
|
echo " parameters:" >> /mnt/etc/netplan/bridge.yaml
|
|
|
|
|
echo " stp: true" >> /mnt/etc/netplan/bridge.yaml
|
|
|
|
|
echo " interfaces:" >> /mnt/etc/netplan/bridge.yaml
|
|
|
|
|
for nic in `echo "$nics"`; do
|
|
|
|
|
echo " - ${nic}" >> /mnt/etc/netplan/bridge.yaml
|
|
|
|
|
done
|
|
|
|
|
echo "Done."
|
|
|
|
|
#echo "network:" > /mnt/etc/netplan/bridge.yaml
|
|
|
|
|
#echo " version: 2" >> /mnt/etc/netplan/bridge.yaml
|
|
|
|
|
#echo " renderer: networkd" >> /mnt/etc/netplan/bridge.yaml
|
|
|
|
|
#echo " ethernets:" >> /mnt/etc/netplan/bridge.yaml
|
|
|
|
|
#for nic in "$nics"; do
|
|
|
|
|
#echo " ${nic}:" >> /mnt/etc/netplan/bridge.yaml
|
|
|
|
|
#echo " dhcp4: no" >> /mnt/etc/netplan/bridge.yaml
|
|
|
|
|
#done
|
|
|
|
|
#echo " bridges:" >> /mnt/etc/netplan/bridge.yaml
|
|
|
|
|
#echo " br0:" >> /mnt/etc/netplan/bridge.yaml
|
|
|
|
|
#echo " macaddress: ${macaddr}" >> /mnt/etc/netplan/bridge.yaml
|
|
|
|
|
#echo " dhcp4: yes" >> /mnt/etc/netplan/bridge.yaml
|
|
|
|
|
#echo " parameters:" >> /mnt/etc/netplan/bridge.yaml
|
|
|
|
|
#echo " stp: true" >> /mnt/etc/netplan/bridge.yaml
|
|
|
|
|
#echo " forward-delay: 0" >> /mnt/etc/netplan/bridge.yaml
|
|
|
|
|
#echo " interfaces:" >> /mnt/etc/netplan/bridge.yaml
|
|
|
|
|
#for nic in `echo "$nics"`; do
|
|
|
|
|
#echo " - ${nic}" >> /mnt/etc/netplan/bridge.yaml
|
|
|
|
|
#done
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
|
echo "Setting up boot pool import service..."
|
|
|
|
|
@ -246,7 +244,7 @@ echo "echo \"Installing linux image, bash, screen, tmux, zfs, vim, sharutils, do
|
|
|
|
|
# preconfigure postfix for no configuration
|
|
|
|
|
#echo "debconf-set-selections <<< \"postfix postfix/main_mailer_type string 'No configuration'\"" >> /mnt/setup-chroot.sh
|
|
|
|
|
#echo "debconf-set-selections <<< \"postfix postfix/mailname string $hostname\"" >> /mnt/setup-chroot.sh
|
|
|
|
|
echo "errors=\$(DEBCONF_FRONTEND='noninteractive' apt install -y --no-install-recommends linux-image-generic 2>&1 1>/dev/null && DEBCONF_FRONTEND='noninteractive' apt install -y vim bridge-utils net-tools bash screen tmux zfs-initramfs dosfstools openssh-server ufw sendmail mailutils docker.io sharutils 2>&1 1>/dev/null)" >> /mnt/setup-chroot.sh
|
|
|
|
|
echo "errors=\$(apt purge -y netplan 2>&1 1>/dev/null && DEBCONF_FRONTEND='noninteractive' apt install -y --no-install-recommends linux-image-generic 2>&1 1>/dev/null && DEBCONF_FRONTEND='noninteractive' apt install -y ifupdown vim bridge-utils net-tools bash screen tmux zfs-initramfs dosfstools openssh-server ufw sendmail mailutils docker.io sharutils 2>&1 1>/dev/null)" >> /mnt/setup-chroot.sh
|
|
|
|
|
|
|
|
|
|
#echo "DEBCONF_FRONTEND='noninteractive' apt install -y --no-install-recommends linux-image-generic && apt install -y vim bash screen tmux zfs-initramfs dosfstools openssh-server ufw sendmail mailutils docker.io sharutils" >> /mnt/setup-chroot.sh
|
|
|
|
|
|
|
|
|
|
@ -256,9 +254,40 @@ echo " exit 1">> /mnt/setup-chroot.sh
|
|
|
|
|
echo "fi">> /mnt/setup-chroot.sh
|
|
|
|
|
echo "echo \"Done.\"" >> /mnt/setup-chroot.sh
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# network configuration should have optional static configuration - not just DHCP, it's very important
|
|
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
|
echo "Writing network interfaces file..."
|
|
|
|
|
macaddr=$(echo $hostname|md5sum|sed 's/^\(..\)\(..\)\(..\)\(..\)\(..\).*$/02:\1:\2:\3:\4:\5/')
|
|
|
|
|
echo "echo \"auto lo br0\" > /etc/network/interfaces" >> /mnt/setup-chroot.sh
|
|
|
|
|
echo "echo \"iface lo inet loopback\" >> /etc/network/interfaces" >> /mnt/setup-chroot.sh
|
|
|
|
|
for nic in "$nics"; do
|
|
|
|
|
echo "echo \"iface ${nic} inet manual\" >> /etc/network/interfaces" >> /mnt/setup-chroot.sh
|
|
|
|
|
done
|
|
|
|
|
echo "echo \"iface br0 inet dhcp\" >> /etc/network/interfaces" >> /mnt/setup-chroot.sh
|
|
|
|
|
echo "echo \" post-up ip link set br0 address $macaddr\" >> /etc/network/interfaces" >> /mnt/setup-chroot.sh
|
|
|
|
|
echo "echo \" bridge_ports $nics\" >> /etc/network/interfaces" >> /mnt/setup-chroot.sh
|
|
|
|
|
echo "echo \" bridge_stp on\" >> /etc/network/interfaces" >> /mnt/setup-chroot.sh
|
|
|
|
|
echo "echo \" dns-nameservers 127.0.0.53\" >> /etc/network/interfaces" >> /mnt/setup-chroot.sh
|
|
|
|
|
echo "echo \"source-directory /etc/network/interfaces.d\" >> /etc/network/interfaces" >> /mnt/setup-chroot.sh
|
|
|
|
|
echo "Done."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# configure docker storage to use zfs
|
|
|
|
|
mkdir -p /mnt/etc/docker
|
|
|
|
|
echo "{\"storage-driver\":\"zfs\"}" > /mnt/etc/docker/daemon.json
|
|
|
|
|
echo "net.ipv6.conf.all.disable_ipv6 = 1" >> /mnt/etc/sysctl.conf
|
|
|
|
|
echo "net.ipv6.conf.default.disable_ipv6 = 1" >> /mnt/etc/sysctl.conf
|
|
|
|
|
echo "net.ipv6.conf.lo.disable_ipv6 = 1" >> /mnt/etc/sysctl.conf
|
|
|
|
|
|
|
|
|
|
echo 'echo ""' >> /mnt/setup-chroot.sh
|
|
|
|
|
echo 'echo "Creating EFI partition..."' >> /mnt/setup-chroot.sh
|
|
|
|
|
@ -413,6 +442,8 @@ echo "service sendmail start" >> /mnt/setup-chroot.sh
|
|
|
|
|
echo "cat \"/home/${admin}/.ssh/id_rsa.pub\" | mail -s \"$hostname SSH key\" -A \"/home/${admin}/.ssh/id_rsa.pub\" admin" >> /mnt/setup-chroot.sh
|
|
|
|
|
# uuencode test.csv test.csv | mail -v -s "Subject test" -r no-reply@mydomain.co.uk recepient@mydomain.co.uk
|
|
|
|
|
|
|
|
|
|
echo "service sendmail stop" >> /mnt/setup-chroot.sh
|
|
|
|
|
|
|
|
|
|
echo "exit 0" >> /mnt/setup-chroot.sh
|
|
|
|
|
|
|
|
|
|
errors=`chmod +x /mnt/setup-chroot.sh 2>&1 1>/dev/null`
|
|
|
|
|
|