2020-04-30 21:28:40 +00:00
|
|
|
cd /root
|
|
|
|
cat /tls/*.0 > /root/etc/ssl/certs/ca-certificates.crt
|
|
|
|
mkdir -p /root/custom-installation/ssh
|
2020-05-19 16:22:46 +00:00
|
|
|
mkdir -p /root/custom-installation/tls
|
2020-04-30 21:28:40 +00:00
|
|
|
cp /ssh/* /root/custom-installation/ssh
|
2020-05-19 16:22:46 +00:00
|
|
|
cp /tls/* /root/custom-installation/tls
|
2020-04-30 21:28:40 +00:00
|
|
|
NODENAME=$(grep ^NODENAME: /custom-installation/confluent/confluent.info|awk '{print $2}')
|
2020-06-30 20:15:01 +00:00
|
|
|
MGR=$(grep ^EXTMGRINFO: /custom-installation/confluent/confluent.info |awk -F'|' '{print $1 " " $3}'|grep " 1$" | head -n 1 | awk '{print $2}')
|
2020-04-30 21:28:40 +00:00
|
|
|
MGR=$(grep ^MANAGER: /custom-installation/confluent/confluent.info|head -n 1| awk '{print $2}')
|
2020-06-30 20:15:01 +00:00
|
|
|
MGTIFACE=$(grep $MGR /custom-installation/confluent/confluent.info | grep ^EXTMGRINFO: | head -n 1 | awk -F'|' '{print $2}')
|
2020-05-01 20:41:01 +00:00
|
|
|
oum=$(umask)
|
2020-04-30 21:28:40 +00:00
|
|
|
deploycfg=/root/custom-installation/confluent/confluent.deploycfg
|
2023-08-11 17:44:37 +00:00
|
|
|
netcfgfile=$deploycfg
|
|
|
|
umask 077
|
|
|
|
if [ -e /tmp/cnflnthmackeytmp ]; then
|
|
|
|
netcfgfile=/tmp/idnttmp
|
|
|
|
hmackeyfile=/tmp/cnflnthmackeytmp
|
|
|
|
#echo -n $(grep ^apitoken: /tmp/identdata/cnflnt.yml|awk '{print $2}') > $hmackeyfile
|
|
|
|
passfile=/tmp/cnflnttmppassfile
|
|
|
|
passcrypt=/tmp/cnflntcryptfile
|
|
|
|
hmacfile=/tmp/cnflnthmacfile
|
|
|
|
chroot . ln -sf /custom-installation/confluent/bin/clortho custom-installation/confluent/bin/genpasshmac
|
|
|
|
cp $hmackeyfile tmp
|
|
|
|
chroot . custom-installation/confluent/bin/genpasshmac $passfile $passcrypt $hmacfile $hmackeyfile
|
|
|
|
chroot . curl -f -H "CONFLUENT_NODENAME: $NODENAME" -H "CONFLUENT_CRYPTHMAC: $(cat /root/$hmacfile)" -d @/tmp/cnflntcryptfile https://$MGR/confluent-api/self/registerapikey
|
|
|
|
cp /root/$passfile /root/custom-installation/confluent/confluent.apikey
|
|
|
|
DEVICE=$(cat /tmp/autodetectnic)
|
|
|
|
else
|
|
|
|
chroot . custom-installation/confluent/bin/clortho $NODENAME $MGR > /root/custom-installation/confluent/confluent.apikey
|
|
|
|
MGR=[$MGR]
|
|
|
|
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%:}
|
|
|
|
fi
|
2020-06-30 20:15:01 +00:00
|
|
|
if [ -z "$MGTIFACE" ]; then
|
|
|
|
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
|
|
|
|
else
|
2021-09-15 16:20:08 +00:00
|
|
|
chroot . usr/bin/curl -f -H "CONFLUENT_MGTIFACE: $MGTIFACE" -H "CONFLUENT_NODENAME: $NODENAME" -H "CONFLUENT_APIKEY: $(cat /root//custom-installation/confluent/confluent.apikey)" https://${MGR}/confluent-api/self/deploycfg > $deploycfg
|
2020-06-30 20:15:01 +00:00
|
|
|
fi
|
2020-05-01 20:41:01 +00:00
|
|
|
umask $oum
|
2023-08-11 18:34:12 +00:00
|
|
|
ipv4m=$(grep ^ipv4_method $netcfgfile|awk '{print$2}')
|
2020-04-30 21:28:40 +00:00
|
|
|
. /scripts/functions
|
|
|
|
if [ "$ipv4m" = "dhcp" ]; then
|
|
|
|
IP=dhcp
|
|
|
|
configure_networking
|
|
|
|
elif [ "$ipv4m" = "static" ]; then
|
2023-08-11 19:01:55 +00:00
|
|
|
v4addr=$(grep ^ipv4_address: $netcfgfile| sed -e 's!/.*!!')
|
2020-04-30 21:28:40 +00:00
|
|
|
v4addr=${v4addr#ipv4_address: }
|
2023-08-11 18:34:12 +00:00
|
|
|
v4gw=$(grep ^ipv4_gateway: $netcfgfile)
|
2020-04-30 21:28:40 +00:00
|
|
|
v4gw=${v4gw#ipv4_gateway: }
|
|
|
|
if [ "$v4gw" = "null" ]; then
|
|
|
|
v4gw=""
|
|
|
|
fi
|
2023-08-11 18:34:12 +00:00
|
|
|
v4nm=$(grep ipv4_netmask: $netcfgfile)
|
2020-04-30 21:28:40 +00:00
|
|
|
v4nm=${v4nm#ipv4_netmask: }
|
2020-05-19 20:23:36 +00:00
|
|
|
dnsdomain=$(grep ^dnsdomain: $deploycfg)
|
|
|
|
dnsdomain=${dnsdomain#dnsdomain: }
|
2020-05-20 13:40:16 +00:00
|
|
|
if [ "$dnsdomain" = "null" ]; then dnsdomain=""; fi
|
2020-04-30 21:28:40 +00:00
|
|
|
dns=$(grep -A1 ^nameservers: $deploycfg|head -n 2|tail -n 1|sed -e 's/^- //'|sed -e "s/''//")
|
2020-05-19 20:23:36 +00:00
|
|
|
{
|
|
|
|
echo "DEVICE='$DEVICE'"
|
|
|
|
echo "PROTO='none'"
|
|
|
|
echo "IPV4PROTO='none'"
|
|
|
|
echo "IPV4ADDR='$v4addr'"
|
|
|
|
echo "IPV4NETMASK='$v4nm'"
|
|
|
|
echo "IPV4BROADCAST='$v4nm'"
|
|
|
|
echo "IPV4GATEWAY='$v4gw'"
|
|
|
|
echo "IPV4DNS1='$dns'"
|
|
|
|
echo "HOSTNAME='$NODENAME'"
|
|
|
|
echo "DNSDOMAIN='$dnsdomain'"
|
2020-05-19 21:09:26 +00:00
|
|
|
echo "DOMAINSEARCH='$dnsdomain'"
|
2020-05-19 20:23:36 +00:00
|
|
|
} > "/run/net-$DEVICE.conf"
|
2020-04-30 21:28:40 +00:00
|
|
|
configure_networking
|
|
|
|
else
|
|
|
|
IP=off
|
|
|
|
fi
|
2020-05-15 20:06:57 +00:00
|
|
|
ipv4s=$(grep ^deploy_server $deploycfg|awk '{print $2}')
|
2020-04-30 21:28:40 +00:00
|
|
|
osprofile=$(cat /custom-installation/confluent/osprofile)
|
2020-05-02 02:04:32 +00:00
|
|
|
fcmdline="$(cat /custom-installation/confluent/cmdline.orig) autoinstall ds=nocloud-net;s=https://${ipv4s}/confluent-public/os/${osprofile}/autoinstall/"
|
|
|
|
if [ -f /custom-installation/autocons.info ]; then
|
|
|
|
cons=$(cat /custom-installation/autocons.info)
|
|
|
|
fi
|
2020-05-01 14:10:31 +00:00
|
|
|
if [ ! -z "$cons" ]; then
|
2020-05-19 16:22:46 +00:00
|
|
|
echo "Installation will proceed on graphics console, autoconsole not supported during autoinstall phase" > ${cons%,*}
|
2020-05-20 18:46:26 +00:00
|
|
|
echo "Progress can be checked by using ssh to access and running the screendump command" > ${cons%,*}
|
2020-06-03 20:22:41 +00:00
|
|
|
echo ${cons%,*} > /root/tmp/autoconsdev
|
2020-05-01 14:10:31 +00:00
|
|
|
#fcmdline="$fcmdline console=${cons#/dev/}"
|
|
|
|
fi
|
|
|
|
echo $fcmdline > /custom-installation/confluent/fakecmdline
|
2020-04-30 21:28:40 +00:00
|
|
|
/scripts/casper-bottom/58server_network
|