@ -45,6 +45,17 @@ domainname=""; while [ -z "$domainname" ]; do domainname=`dialog --no-cancel --i
fqdn = " ${ hostname } . ${ domainname } "
fqdn = " ${ hostname } . ${ domainname } "
nicdevices = "" ; for nic in $( ip -o link show | awk -F': ' '{print $2}' | grep -v '^lo' ) ; do nicdevices = " $nicdevices $nic off " ; done
nicdevices = "" ; for nic in $( ip -o link show | awk -F': ' '{print $2}' | grep -v '^lo' ) ; do nicdevices = " $nicdevices $nic off " ; done
nics = ` dialog --separate-output --no-cancel --no-items --title "Bridged network devices" --checklist "Select the network devices to be bridged to br0:" $height $width ${ window } $nicdevices 2>& 1 1>/dev/tty`
nics = ` dialog --separate-output --no-cancel --no-items --title "Bridged network devices" --checklist "Select the network devices to be bridged to br0:" $height $width ${ window } $nicdevices 2>& 1 1>/dev/tty`
networktype = ` dialog --no-items --no-cancel --title "Network type" --radiolist "Select the network type:" dhcp off static off 2>& 1 1>/dev/tty`
if [ " $networktype " = "static" ] ; then
address = "" ; while [ -z " $address " ] ; do address = ` dialog --no-cancel --inputbox "IP Address:" 8 40 2>& 1 >/dev/tty` ; done
subnet = "" ; while [ -z " $subnet " ] ; do subnet = ` dialog --no-cancel --inputbox "Subnet mask:" 8 40 2>& 1 >/dev/tty` ; done
gateway = "" ; while [ -z " $gateway " ] ; do gateway = ` dialog --no-cancel --inputbox "Gateway:" 8 40 2>& 1 >/dev/tty` ; done
dns1 = "" ; while [ -z " $dns1 " ] ; do dns1 = ` dialog --no-cancel --inputbox "Primary DNS server:" 8 40 2>& 1 >/dev/tty` ; done
dns2 = ` dialog --no-cancel --inputbox "Secondary DNS server:" 8 40 2>& 1 >/dev/tty`
fi
admin = "" ; while [ -z " $admin " ] ; do admin = ` dialog --no-cancel --inputbox "Admin user:" 8 40 2>& 1 >/dev/tty` ; done
admin = "" ; while [ -z " $admin " ] ; do admin = ` dialog --no-cancel --inputbox "Admin user:" 8 40 2>& 1 >/dev/tty` ; done
rootpassword = ""
rootpassword = ""
while [ " $rootpassword " = "" ] ; do
while [ " $rootpassword " = "" ] ; do
@ -430,10 +441,11 @@ echo "chown smmsp:smmsp /var/spool/mqueue-client" >> /mnt/setup-chroot.sh
echo "chmod g+w /var/spool/mqueue-client" >> /mnt/setup-chroot.sh
echo "chmod g+w /var/spool/mqueue-client" >> /mnt/setup-chroot.sh
echo "HOME=\"/root\"" >> /mnt/setup-chroot.sh
echo "HOME=\"/root\"" >> /mnt/setup-chroot.sh
echo " HOSTNAME=\" $hostname \" " >> /mnt/setup-chroot.sh
echo " HOSTNAME=\" $hostname \" " >> /mnt/setup-chroot.sh
echo "echo \"y\\ny\\ny\\n\" | sendmailconfig" >> /mnt/setup-chroot.sh
echo "service sendmail start" >> /mnt/setup-chroot.sh
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
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
# uuencode test.csv test.csv | mail -v -s "Subject test" -r no-reply@mydomain.co.uk recepient@mydomain.co.uk
echo "sendmail -OTimeout.hoststatus=0m -q -v" >> /mnt/setup-chroot.sh
#echo "sendmail -OTimeout.hoststatus=0m -q -v" >> /mnt/setup-chroot.sh
echo "service sendmail stop" >> /mnt/setup-chroot.sh
echo "service sendmail stop" >> /mnt/setup-chroot.sh
@ -463,14 +475,22 @@ for nic in "$nics"; do
echo " iface ${ nic } inet manual " >> /mnt/etc/network/interfaces.d/br0
echo " iface ${ nic } inet manual " >> /mnt/etc/network/interfaces.d/br0
niclist = " $niclist $nic "
niclist = " $niclist $nic "
done
done
if [ " $networktype " = "dhcp" ] ; then
echo "iface br0 inet dhcp" >> /mnt/etc/network/interfaces.d/br0
echo "iface br0 inet dhcp" >> /mnt/etc/network/interfaces.d/br0
#echo " post-up ip link set br0 address $macaddr" >> /mnt/etc/network/interfaces.d/br0
else
echo "iface br0 inet static" >> /mnt/etc/network/interfaces.d/br0
echo " address $address " >> /mnt/etc/network/interfaces.d/br0
echo " netmask $subnet " >> /mnt/etc/network/interfaces.d/br0
echo " gateway $gateway " >> /mnt/etc/network/interfaces.d/br0
sed -ir " s/^#DNS=.*/DNS= ${ dns1 } /g " /mnt/etc/systemd/resolved.conf
if ! [ -z " $dns2 " ] ; then sed -ir " s/^#FallbackDNS=.*/FallbackDNS= ${ dns2 } /g " /mnt/etc/systemd/resolved.conf ; fi
fi
#echo " bridge_hw $macaddr" >> /mnt/etc/network/interfaces.d/br0
#echo " bridge_hw $macaddr" >> /mnt/etc/network/interfaces.d/br0
echo " dns-nameservers 127.0.0.53" >> /mnt/etc/network/interfaces.d/br0
echo " bridge_waitport 0" >> /mnt/etc/network/interfaces.d/br0
echo " bridge_waitport 0" >> /mnt/etc/network/interfaces.d/br0
echo " bridge_fd 0" >> /mnt/etc/network/interfaces.d/br0
echo " bridge_fd 0" >> /mnt/etc/network/interfaces.d/br0
echo " bridge_ports ${ niclist } " >> /mnt/etc/network/interfaces.d/br0
echo " bridge_ports ${ niclist } " >> /mnt/etc/network/interfaces.d/br0
echo " bridge_stp on" >> /mnt/etc/network/interfaces.d/br0
echo " bridge_stp on" >> /mnt/etc/network/interfaces.d/br0
echo " dns-nameservers 127.0.0.53" >> /mnt/etc/network/interfaces.d/br0
echo "source-directory /etc/network/interfaces.d" > /mnt/etc/network/interfaces
echo "source-directory /etc/network/interfaces.d" > /mnt/etc/network/interfaces
echo "Done."
echo "Done."