mirror of
				https://github.com/xcat2/confluent.git
				synced 2025-10-31 11:22:28 +00:00 
			
		
		
		
	Further advance the confluent diskless support
This commit is contained in:
		| @@ -1,4 +1,5 @@ | ||||
| installroot=$1 | ||||
| destdir=$2 | ||||
|  | ||||
| touch $installroot/.testcap | ||||
| if setcap cap_net_raw+p $installroot/.testcap >& /dev/null; then | ||||
| @@ -7,9 +8,29 @@ else | ||||
|     capsargs="--setopt=tsflags=nocapps" | ||||
| fi | ||||
| rm $installroot/.testcap | ||||
| yum  $capsargs --releasever=8  --installroot=/var/tmp/testgenimage/ --releasever=8.3 install '@minimal-environment' chrony kernel net-tools nfs-utils openssh-server rsync tar util-linux python3 tar dracut dracut-network ethtool parted openssl dhclient openssh-clients bash vim-minimal rpm iputils shim-x64 grub2-efi-x64 | ||||
| dracut -v --xz -N -m "stateless base terminfo" -f boot/initramfs-diskless 4.18.0-240.22.1.el8_3.x86_64 | ||||
| pkglist=$(cat $(dirname $0)/pkglist | tr "\r\n" " ") | ||||
| mydir=$(dirname $0) | ||||
| mkdir -p $installroot/proc $installroot/sys $installroot/dev | ||||
| unshare -f -p -m bash -c " | ||||
| mount -o bind /proc $installroot/proc | ||||
| mount -o bind /sys $installroot/sys | ||||
| mount -o bind /dev $installroot/dev | ||||
| yum  -y $capsargs --releasever=8  --installroot=$installroot install $pkglist | ||||
| cp -a $dirname/dracut $installroot/usr/lib/dracut/modules.d/97diskless | ||||
| chmod a+x $installroot/usr/lib/dracut/modules.d/97diskless/* | ||||
| for kernel in $(ls $installroot/boot/vmlinuz-*|grep -v rescue|sed -e s/.*vmlinuz-//); do | ||||
|     echo -n "Creating diskless initramfs for $kernel" | ||||
|     chroot $installroot dracut -v --xz -N -m "diskless base terminfo" -f boot/initramfs-diskless-$kernel.img $kernel | ||||
| done | ||||
| " | ||||
| latestkernel=$(ls $installroot/boot/vmlinuz-*|grep -v rescue|sed -e s/.*vmlinuz-//|tail -n 1) | ||||
| mkdir -p $destdir/boot/efi/boot $destdir/boot/initramfs | ||||
| cp $installroot/boot/vmlinuz-$latestkernel $destdir/boot/kernel  | ||||
| cp $installroot/boot/initramfs-diskless-$kernel.img $destdir/boot/initramfs/distribution | ||||
| cp $installroot/boot/efi/EFI/BOOT/BOOTX64.EFI $destdir/boot/efi/boot | ||||
| cp $installroot/boot/efi/EFI/centos/grubx64.efi $destdir/boot/efi/boot | ||||
|  | ||||
| # link kernel, initrd, grub, and shim as appropriate | ||||
|  | ||||
| # use xz, minimize https burden and transfer penalty | ||||
| mksquashfs -comp xz | ||||
| mksquashfs $installroot $destdir/rootimg.sfs -comp xz | ||||
|   | ||||
| @@ -129,8 +129,10 @@ for addr in $(grep ^MANAGER: /etc/confluent/confluent.info|awk '{print $2}'|sed | ||||
|         confluent_urls="$confluent_urls $confluent_proto://$addr/confluent-public/os/$confluent_profile/rootimg.sfs" | ||||
|     fi | ||||
| done | ||||
| confluent_mgr=$(grep ^deploy_server: /etc/confluent/confluent.deploycfg| awk '{print $2}') | ||||
| confluent_urls="$confluent_urls https://$confluent_mgr/confluent-public/os/$confluent_profile/rootimg.sfs" | ||||
| mkdir -p /mnt/remoteimg /mnt/remote /mnt/overlay | ||||
| curlmount $confluent_urls /mnt/remoteimg | ||||
| /opt/confluent/bin/urlmount $confluent_urls /mnt/remoteimg | ||||
| mount -o loop,ro /mnt/remoteimg/*.sfs /mnt/remote | ||||
| mount -t tmpfs overlay /mnt/overlay | ||||
| mkdir -p /mnt/overlay/upper /mnt/overlay/work | ||||
|   | ||||
		Reference in New Issue
	
	Block a user