2022-04-25 17:14:02 +00:00
pushd $( dirname $0 )
2022-04-25 18:46:50 +00:00
rm -rf licenses
2020-08-10 15:39:03 +00:00
cp -a 97genesis /usr/lib/dracut/modules.d/
cat /usr/lib/dracut/modules.d/97genesis/install-* > /usr/lib/dracut/modules.d/97genesis/install
2020-08-10 18:49:30 +00:00
chmod +x /usr/lib/dracut/modules.d/97genesis/install /usr/lib/dracut/modules.d/97genesis/installkernel
2020-08-10 15:39:03 +00:00
mkdir -p boot/initramfs
mkdir -p boot/efi/boot
2021-06-24 18:00:19 +00:00
dracut --no-early-microcode --xz -N -m "genesis base" -f boot/initramfs/distribution $( uname -r)
2022-04-25 17:04:45 +00:00
tdir = $( mktemp -d)
tfile = $( mktemp)
cp boot/initramfs/distribution $tdir
2022-04-25 17:11:43 +00:00
pushd $tdir
2022-04-25 17:04:45 +00:00
xzcat distribution| cpio -dumi
rm distribution
find . -type f -exec rpm -qf /{ } \; 2> /dev/null | grep -v 'not owned' | sort -u > $tfile
2022-11-15 16:46:52 +00:00
find . -type f -printf "%p: " -exec rpm -qf /{ } \; 2> /dev/null | grep -v 'not owned' > /tmp/attributedrpmlist
2022-04-25 17:11:43 +00:00
popd
2022-04-25 17:04:45 +00:00
rm -rf $tdir
cp $tfile rpmlist
2022-04-25 17:52:36 +00:00
cp confluent-genesis.spec confluent-genesis-out.spec
2023-01-31 13:58:56 +00:00
python3 getlicenses.py rpmlist > /tmp/tmpliclist
2023-01-31 13:52:32 +00:00
if [ $? -ne 0 ] ; then
exit 1
fi
for lic in $( cat /tmp/tmpliclist) ; do
2022-09-22 13:09:46 +00:00
lo = ${ lic #/usr/share/ }
lo = ${ lo #licenses/ }
2023-06-14 19:47:17 +00:00
lo = ${ lo #doc/ }
2022-09-22 13:09:46 +00:00
fname = $( basename $lo )
dlo = $( dirname $lo )
2022-09-22 13:51:02 +00:00
if [ [ " $dlo " = = *"-lib" * ] ] ; then
2024-01-09 21:08:49 +00:00
dlo = ${ dlo /-lib* }
2022-09-22 13:51:02 +00:00
elif [ [ " $dlo " = = "device-mapper-" * ] ] ; then
dlo = ${ dlo /-* } -mapper
elif [ [ " $dlo " = = "bind-" * ] ] ; then
dlo = ${ dlo /-* }
elif [ [ " $dlo " = = "iproute-" * ] ] ; then
dlo = ${ dlo /-* }
fi
2022-09-22 13:09:46 +00:00
mkdir -p licenses/$dlo
if [ " $fname " = = "lgpl-2.1.txt" ] ; then
2022-09-22 13:51:02 +00:00
fname = COPYING.LIB
2022-09-22 13:09:46 +00:00
fi
2022-09-22 13:51:02 +00:00
cp $lic licenses/$dlo /$fname
lo = $dlo /$fname
2022-09-22 13:09:46 +00:00
echo %license /opt/confluent/genesis/%{ arch} /licenses/$lo >> confluent-genesis-out.spec
2024-01-09 18:32:54 +00:00
if [ " $fname " = = README ] && [ " $dlo " = = "zlib" ] ; then
cp $lic licenses/nss/$fname
echo %license /opt/confluent/genesis/%{ arch} /licenses/nss/$fname >> confluent-genesis-out.spec
fi
2022-04-25 17:52:36 +00:00
done
2022-11-14 21:20:42 +00:00
mkdir -p licenses/ipmitool
cp /usr/share/doc/ipmitool/COPYING licenses/ipmitool
echo %license /opt/confluent/genesis/%{ arch} /licenses/ipmitool/COPYING >> confluent-genesis-out.spec
2023-06-15 13:22:52 +00:00
ln -s /opt/confluent/genesis/%{ arch} /licenses/kernel-core licenses/libbpf
2023-06-14 20:05:08 +00:00
echo /opt/confluent/genesis/%{ arch} /licenses/libbpf >> confluent-genesis-out.spec
2020-08-10 15:39:03 +00:00
cp -f /boot/vmlinuz-$( uname -r) boot/kernel
cp /boot/efi/EFI/BOOT/BOOTX64.EFI boot/efi/boot
2023-01-31 13:52:32 +00:00
find /boot/efi -name grubx64.efi -exec cp { } boot/efi/boot/grubx64.efi \;
2022-02-15 15:32:39 +00:00
mkdir -p ~/rpmbuild/SOURCES/
2022-04-25 18:02:08 +00:00
tar cf ~/rpmbuild/SOURCES/confluent-genesis.tar boot rpmlist licenses
2022-04-25 17:52:36 +00:00
rpmbuild -bb confluent-genesis-out.spec
2020-08-10 15:39:03 +00:00
rm -rf /usr/lib/dracut/modules.d/97genesis
2022-04-25 17:14:02 +00:00
popd
2023-01-31 13:54:03 +00:00
# for rpm in $(cat ../rpmlist); do dnf download --source $rpm; done
2020-08-11 13:54:53 +00:00
# getting src rpms would be nice, but centos isn't consistent..
2020-10-30 16:34:42 +00:00
# /usr/lib/dracut/skipcpio /opt/confluent/genesis/x86_64/boot/initramfs/distribution | xzcat | cpio -dumiv
# rpm -qf $(find . -type f | sed -e 's/^.//') |sort -u|grep -v 'not owned' > ../rpmlist
# for f in $(find . -type f | sed -e 's/^.//'); do echo -n $f:; rpm -qf $f ; done > ../annotedrprmlist
2020-08-13 11:55:28 +00:00
# for i in $(cat rpmlist); do rpm -qi $i|grep Source; done |awk '{print $4}'|sort -u > srcrpmlist
2020-10-30 16:34:42 +00:00
# for i in $(cat ../srcrpmlist); do wget --continue http://vault.centos.org/8.2.2004/BaseOS/Source/SPackages/$i; done
# ls > downloadedsrcpmlist
# diff -u srcpmlist downloadedsrcrpmlist
# diff -u srcrpmlist downloadedsrcpmrlist |grep ^-|grep -v srcrpmlist
# for i in $(diff -u srcrpmlist downloadedsrcpmrlist |grep ^-|grep -v srcrpmlist|sed -e s/-//); do wget --continue http://vault.centos.org/8.2.2004/AppStream/Source/SPackages/$i; done
2020-08-13 11:55:28 +00:00
2020-08-11 13:54:53 +00:00