mirror of
https://github.com/xcat2/confluent.git
synced 2025-12-28 03:51:45 +00:00
Add missing pre.d directory to let user know they can use such scripts Preserve console directievs from kernelargs into installed system Retry umount during image2disk, if processes have the filesystem busy. Fix DNS behavior during post phase of installtodisk Invoke confignet properly during firstboot to set up additional interfaces. Have sshd run during the install from '/sysroot', for convenience Fix some cosmetic error output for setupssh
57 lines
2.4 KiB
Bash
57 lines
2.4 KiB
Bash
#!/bin/bash
|
|
. /etc/confluent/functions
|
|
# the image will be used to deploy itself
|
|
# provide both access to image (for parsing metadata)
|
|
# and existing mounts of image (to take advantage of caching)
|
|
mount -o bind /sys /sysroot/sys
|
|
mount -o bind /dev /sysroot/dev
|
|
mount -o bind /dev/pts /sysroot/dev/pts
|
|
mount -o bind /proc /sysroot/proc
|
|
mount -o bind /run /sysroot/run
|
|
|
|
|
|
if [ ! -f /tmp/mountparts.sh ]; then
|
|
mkdir -p /sysroot/run/imginst/sources/_
|
|
mount -o bind /mnt/remote /sysroot/run/imginst/sources/_
|
|
else
|
|
for srcmount in $(cat /tmp/mountparts.sh | awk '{print $2}'); do
|
|
srcname=${srcmount#/dev/mapper/mproot}
|
|
srcdir=$(echo $srcmount | sed -e 's!/dev/mapper/mproot!/mnt/remote!' -e 's!_!/!g')
|
|
mkdir -p /sysroot/run/imginst/sources/$srcname
|
|
mount -o bind $srcdir /sysroot/run/imginst/sources/$srcname
|
|
done
|
|
fi
|
|
cd /sysroot/run
|
|
cp /run/sshd.pid /tmp/dbgssh.pid
|
|
chroot /sysroot/ bash -c "/usr/sbin/sshd"
|
|
chroot /sysroot/ bash -c "source /etc/confluent/functions; run_remote_python getinstalldisk"
|
|
chroot /sysroot/ bash -c "source /etc/confluent/functions; run_remote_parts pre.d"
|
|
for nameserver in $(sed -n '/^nameservers:/,/^[^-]/p' /etc/confluent/confluent.deploycfg|grep ^- | cut -d ' ' -f 2|sed -e 's/ //'); do
|
|
echo "nameserver $nameserver" >> /sysroot/etc/resolv.conf
|
|
done
|
|
#chroot /sysroot/ bash -c "source /etc/confluent/functions; run_remote_python confignet"
|
|
if [ ! -f /sysroot/tmp/installdisk ]; then
|
|
echo 'Unable to find a suitable installation target device, ssh to port 2222 to investigate'
|
|
while [ ! -f /sysroot/tmp/installdisk ]; do
|
|
sleep 1
|
|
done
|
|
fi
|
|
lvm vgchange -a n
|
|
udevadm control -e
|
|
if [ -f /sysroot/etc/lvm/devices/system.devices ]; then
|
|
rm /sysroot/etc/lvm/devices/system.devices
|
|
fi
|
|
chroot /sysroot /usr/lib/systemd/systemd-udevd --daemon
|
|
chroot /sysroot bash -c "source /etc/confluent/functions; run_remote_python image2disk.py"
|
|
echo "Port 22" >> /etc/ssh/sshd_config
|
|
echo 'Match LocalPort 22' >> /etc/ssh/sshd_config
|
|
echo ' ChrootDirectory /sysroot/run/imginst/targ' >> /etc/ssh/sshd_config
|
|
kill $(cat /sysroot/var/run/sshd.pid)
|
|
kill -HUP $(cat /tmp/dbgssh.pid)
|
|
cp /sysroot/etc/pki/ca-trust/source/anchors/* /sysroot/run/imginst/targ/etc/pki/ca-trust/source/anchors/
|
|
chroot /sysroot/run/imginst/targ update-ca-trust
|
|
|
|
chroot /sysroot/run/imginst/targ bash -c "source /etc/confluent/functions; run_remote post.sh"
|
|
chroot /sysroot bash -c "umount \$(tac /proc/mounts|awk '{print \$2}'|grep ^/run/imginst/targ)"
|
|
|