diff --git a/misc/ubuntu20.04deploy/custom-installation/firstboot.sh b/misc/ubuntu20.04deploy/custom-installation/firstboot.sh new file mode 100755 index 00000000..5d39121a --- /dev/null +++ b/misc/ubuntu20.04deploy/custom-installation/firstboot.sh @@ -0,0 +1,9 @@ +#!/bin/bash +echo "Confluent first boot is running" +cp -a /etc/confluent/ssh/* /etc/ssh/ +systemctl restart sshd +rootpw=$(grep ^rootpassword: /etc/confluent/confluent.deploycfg |awk '{print $2}') +if [ ! -z "$rootpw" -a "$rootpw" != "null" ]; then + echo root:$rootpw | chpasswd -e +fi +hostnamectl set-hostname $(grep ^NODENAME: /etc/confluent/confluent.info | awk '{print $2}') diff --git a/misc/ubuntu20.04deploy/custom-installation/hooks/casper-bottom.sh b/misc/ubuntu20.04deploy/custom-installation/hooks/casper-bottom.sh index 87071410..bb37d4a2 100755 --- a/misc/ubuntu20.04deploy/custom-installation/hooks/casper-bottom.sh +++ b/misc/ubuntu20.04deploy/custom-installation/hooks/casper-bottom.sh @@ -4,10 +4,13 @@ mkdir -p /root/custom-installation/ssh cp /ssh/* /root/custom-installation/ssh NODENAME=$(grep ^NODENAME: /custom-installation/confluent/confluent.info|awk '{print $2}') MGR=$(grep ^MANAGER: /custom-installation/confluent/confluent.info|head -n 1| awk '{print $2}') +oum=$(umask) +umask 077 chroot . custom-installation/confluent/bin/clortho $NODENAME $MGR > /root/custom-installation/confluent/confluent.apikey MGR=[$MGR] deploycfg=/root/custom-installation/confluent/confluent.deploycfg chroot . usr/bin/curl -f -H "CONFLUENT_NODENAME: $NODENAME" -H "CONFLUENT_APIKEY: $(cat /root//custom-installation/confluent/confluent.apikey)" https://${MGR}/confluent-api/self/deploycfg > $deploycfg +umask $oum nic=$(grep ^MANAGER /custom-installation/confluent/confluent.info|grep fe80::|sed -e s/.*%//|head -n 1) nic=$(ip link |grep ^$nic:|awk '{print $2}') DEVICE=${nic%:} @@ -35,7 +38,7 @@ else fi ipv4s=$(grep ^ipv4_server $deploycfg|awk '{print $2}') osprofile=$(cat /custom-installation/confluent/osprofile) -fcmdline='ds=nocloud-net;s=https://'${ipv4s}'/confluent-public/os/'${osprofile}'/autoinstall/' +fcmdline='quiet autoinstall ds=nocloud-net;s=https://'${ipv4s}'/confluent-public/os/'${osprofile}'/autoinstall/' cons=$(cat /custom-installation/autocons.info) if [ ! -z "$cons" ]; then echo "Installation will proceed on graphics console, autoconsole cannot work during install for Ubuntu" > ${cons%,*} diff --git a/misc/ubuntu20.04deploy/custom-installation/post.sh b/misc/ubuntu20.04deploy/custom-installation/post.sh new file mode 100755 index 00000000..450efdc7 --- /dev/null +++ b/misc/ubuntu20.04deploy/custom-installation/post.sh @@ -0,0 +1,6 @@ +cp -a /root/.ssh /target/root/ +mkdir -p /target/etc/confluent/ssh/sshd_config.d/ +cp /custom-installation/confluent/* /target/etc/confluent/ +cp -a /etc/ssh/ssh_host* /target/etc/confluent/ssh/ +cp -a /etc/ssh/sshd_config.d/confluent.conf /target/etc/confluent/ssh/sshd_config.d/ +cp /custom-installation/firstboot.sh /target/etc/confluent/firstboot.sh diff --git a/misc/ubuntu20.04deploy/scripts/init-premount/confluent b/misc/ubuntu20.04deploy/scripts/init-premount/confluent index fe2f7a1b..bd303839 100755 --- a/misc/ubuntu20.04deploy/scripts/init-premount/confluent +++ b/misc/ubuntu20.04deploy/scripts/init-premount/confluent @@ -10,7 +10,9 @@ while ! grep NODENAME /custom-installation/confluent/confluent.info; do done MGR="[$(grep MANAGER: /custom-installation/confluent/confluent.info | head -n 1 | awk '{print $2}')]" osprofile=$(sed -e 's/.*osprofile=//' -e 's/ .*//' /proc/cmdline) -cons=$(cat /custom-installation/autocons.info) +if [ -f /custom-installation/autocons.info ]; then + cons=$(cat /custom-installation/autocons.info) +fi if [ ! -z "$cons" ]; then echo "Preparing to deploy $osprofile from $MGR" > ${cons%,*} fi @@ -18,7 +20,6 @@ echo "Preparing to deploy $osprofile from $MGR" echo $osprofile > /custom-installation/confluent/osprofile echo URL=http://${MGR}/confluent-public/os/$osprofile/distribution/live.iso >> /conf/param.conf fcmdline="url=http://${MGR}/confluent-public/os/$osprofile/distribution/live.iso" -cons=$(cat /custom-installation/autocons.info) if [ ! -z "$cons" ]; then fcmdline="$fcmdline console=${console#/dev/}" elif grep console= /proc/cmdline; then