mirror of
https://github.com/xcat2/confluent.git
synced 2024-11-24 10:30:22 +00:00
181aa876a7
For older Ubuntu 18, the automated installer is debian-installer. Derive from the prototype debian work, with same limitation about more limited network bringup that we are stuck with from Debian limitations.
98 lines
4.0 KiB
Plaintext
98 lines
4.0 KiB
Plaintext
reverse_uuid() {
|
|
echo $1 | head -c 8 | tail -c 2
|
|
echo $1 | head -c 6 | tail -c 2
|
|
echo $1 | head -c 4 | tail -c 2
|
|
echo $1 | head -c 2 | tail -c 2
|
|
echo $1 | head -c 13 | tail -c 2
|
|
echo $1 | head -c 11 | tail -c 2
|
|
echo $1 | head -c 18 | tail -c 2
|
|
echo $1 | head -c 16 | tail -c 2
|
|
echo $1 | tail -c 18 | sed -e s/-//
|
|
}
|
|
setdebopt() {
|
|
debconf-set $1 $2
|
|
echo d-i $1 $3 $2 >> /preseed.cfg
|
|
}
|
|
|
|
dhuuid=$(reverse_uuid $(cat /sys/devices/virtual/dmi/id/product_uuid))
|
|
dhcpid=$(mktemp)
|
|
mkdir -p /etc/confluent
|
|
cp /tls/* /etc/ssl/certs/
|
|
for nic in $(ip link | grep mtu|grep -v LOOPBACK|cut -d: -f 2|sed -e 's/ //'); do
|
|
ip link set $nic up
|
|
done
|
|
for nic in $(ip link | grep mtu|grep -v LOOPBACK|grep LOWER_UP|cut -d: -f 2|sed -e 's/ //'); do
|
|
if udhcpc -i $nic -p $dhcpid -t 2 -T 2 -n -x 93:0007 -x 97:00$dhuuid -q; then
|
|
/opt/confluent/bin/copernicus > /etc/confluent/confluent.info
|
|
if grep ^MANAGER:.*\\. /etc/confluent/confluent.info ; then
|
|
break
|
|
fi
|
|
fi
|
|
ip -4 flush dev $nic
|
|
done
|
|
mgr=$(grep ^MANAGER:.*\\. /etc/confluent/confluent.info|head -n 1|cut -d: -f 2|sed -e 's/ //')
|
|
nodename=$(grep ^NODENAME: /etc/confluent/confluent.info|head -n 1|cut -d: -f 2|sed -e 's/ //')
|
|
/opt/confluent/bin/clortho $nodename $mgr > /etc/confluent/confluent.apikey
|
|
apikey=$(cat /etc/confluent/confluent.apikey)
|
|
cd /etc/confluent
|
|
wget --header="CONFLUENT_NODENAME: $nodename" --header="CONFLUENT_APIKEY: $apikey" https://$mgr/confluent-api/self/deploycfg
|
|
cd -
|
|
predir=$(mktemp -d)
|
|
cd $predir
|
|
profile=$(grep ^profile: /etc/confluent/deploycfg|cut -d ' ' -f 2)
|
|
wget https://$mgr/confluent-public/os/$profile/scripts/pre.sh
|
|
chmod u+x pre.sh
|
|
wget https://$mgr/confluent-public/os/$profile/preseed.cfg
|
|
mv preseed.cfg /
|
|
setdebopt auto-install/enable true boolean
|
|
setdebopt partman/early_command $predir/pre.sh string
|
|
cd -
|
|
ip -4 a flush dev $nic
|
|
setdebopt netcfg/choose_interface $nic select
|
|
setdebopt netcfg/get_hostname $nodename string
|
|
v4cfgmeth=$(grep ipv4_method: /etc/confluent/deploycfg |cut -d: -f 2|sed -e 's/ //')
|
|
if [ "$v4cfgmeth" = "static" ]; then
|
|
setdebopt netcfg/disable_dhcp true boolean
|
|
v4addr=$(grep ^ipv4_address: /etc/confluent/deploycfg|cut -d: -f 2|sed -e 's/ //')
|
|
v4gw=$(grep ^ipv4_gateway: /etc/confluent/deploycfg|cut -d: -f 2| sed -e 's/ //')
|
|
if [ "$v4gw" = "null" ]; then
|
|
v4gw=""
|
|
fi
|
|
v4nm=$(grep ^ipv4_netmask: /etc/confluent/deploycfg|cut -d: -f 2|sed -e 's/ //')
|
|
setdebopt netcfg/get_netmask $v4nm string
|
|
setdebopt netcfg/get_ipaddress $v4addr string
|
|
setdebopt netcfg/confirm_static true boolean
|
|
if [ ! -z "$v4gw" ]; then
|
|
setdebopt netcfg/get_gateway $v4gw string
|
|
fi
|
|
namesrvs=$(sed -n '/^nameservers:/,/^[^-]/p' /etc/confluent/deploycfg|grep ^- | cut -d ' ' -f 2|sed -e 's/ //')
|
|
for namesrv in "$namesrvs"; do
|
|
setdebopt netcfg/get_nameservers $namesrv string
|
|
done
|
|
elif [ "$v4cfgmeth" = "dhcp" ]; then
|
|
setdebopt netcfg/disable_dhcp false boolean
|
|
setdebopt netcfg/confirm_static false boolean
|
|
fi
|
|
rootpass=$(grep ^rootpassword: /etc/confluent/deploycfg|cut -d ' ' -f 2|sed -e 's/ //')
|
|
if [ "$rootpass" = null ] || [ -z "$rootpass" ]; then
|
|
setdebopt passwd/root-login false boolean
|
|
else
|
|
setdebopt passwd/root-login true boolean
|
|
setdebopt passwd/root-password-crypted $rootpass string
|
|
fi
|
|
setdebopt time/zone $(grep ^timezone: /etc/confluent/deploycfg|cut -d ' ' -f 2|sed -e 's/ //') string
|
|
ntpsrvs=$(sed -n '/^ntpservers:/,/^[^-]/p' /etc/confluent/deploycfg|grep ^- | cut -d ' ' -f 2|sed -e 's/ //')
|
|
for ntpsrv in "$ntpsrvs"; do
|
|
setdebopt clock-setup/ntp true boolean
|
|
setdebopt clock-setup/ntep-server $ntpsrv string
|
|
done
|
|
#setdebopt console-setup/layoutcode $(grep ^keymap: /etc/confluent/deploycfg|cut -d ' ' -f 2) string
|
|
setdebopt debian-installer/locale $(grep ^locale: /etc/confluent/deploycfg|cut -d ' ' -f 2) select
|
|
domainname=$(grep ^dnsdomain: /etc/confluent/deploycfg|cut -d ' ' -f 2)
|
|
if [ ! -z "$domainname" ] && [ "$domainname" != "null" ]; then
|
|
setdebopt netcfg/get_domain $domainname string
|
|
fi
|
|
|
|
|
|
|