mirror of
https://github.com/xcat2/confluent.git
synced 2025-01-15 12:17:47 +00:00
38 lines
1.6 KiB
Plaintext
38 lines
1.6 KiB
Plaintext
installroot=$1
|
|
destdir=$2
|
|
|
|
mkdir -p $installroot
|
|
touch $installroot/.testcap
|
|
if setcap cap_net_raw+p $installroot/.testcap >& /dev/null; then
|
|
capsargs=""
|
|
else
|
|
capsargs="--setopt=tsflags=nocapps"
|
|
fi
|
|
rm $installroot/.testcap
|
|
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 $mydir/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-$latestkernel.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 $installroot $destdir/rootimg.sfs -comp xz
|