functions.inc.sh: sync with changes in current production server

This commit is contained in:
Silvan Calarco 2024-04-13 16:49:26 +02:00
parent 98683c14fb
commit ffec557d60

View File

@ -116,7 +116,8 @@ function initialize_root_dir() {
mount none -t tmpfs $MOUNTDIR/dev mount none -t tmpfs $MOUNTDIR/dev
mkdir $MOUNTDIR/run mkdir $MOUNTDIR/run
mount -o bind /run $MOUNTDIR/run mount none -t tmpfs $MOUNTDIR/run
cp -a /run/systemd $MOUNTDIR/run/
mkdir $MOUNTDIR/sys mkdir $MOUNTDIR/sys
mount -o bind /sys $MOUNTDIR/sys mount -o bind /sys $MOUNTDIR/sys
@ -138,7 +139,7 @@ function initialize_root_dir() {
#[ $MEDIA = "raw" ] && create_raw_filesystem $LOCALSTATEDIR/$MEDIA_NAME $MEDIA_SIZE 1024k $ROOTFS #[ $MEDIA = "raw" ] && create_raw_filesystem $LOCALSTATEDIR/$MEDIA_NAME $MEDIA_SIZE 1024k $ROOTFS
[ $MEDIA = "raw" ] && create_raw_disk_image $MEDIA_SIZE 1024k [ $MEDIA = "raw" ] && create_raw_disk_image $MEDIA_SIZE 1024k
trap "[ $LOOPDEV ] && losetup -d $LOOPDEV; killall -9 gpg-agent; [ -e $MOUNTDIR/proc/version ] && umount $MOUNTDIR/proc; [ -e $MOUNTDIR/dev/null ] && umount $MOUNTDIR/dev; [ -e $MOUNTDIR/run/systemd ] && umount $MOUNTDIR/run; [ -e $MOUNTDIR/sys/kernel ] && umount $MOUNTDIR/sys; [ \"$MOUNTDIR_TMPFS\" ] && umount $MOUNTDIR_TMPFS" 0 HUP INT QUIT ABRT KILL TERM trap "[ $LOOPDEV ] && losetup -d $LOOPDEV; killall -9 gpg-agent keyboxd; [ -e $MOUNTDIR/proc/version ] && umount $MOUNTDIR/proc; [ -e $MOUNTDIR/dev/null ] && umount $MOUNTDIR/dev; [ -e $MOUNTDIR/run/systemd ] && umount $MOUNTDIR/run; [ -e $MOUNTDIR/sys/kernel ] && umount $MOUNTDIR/sys; [ \"$MOUNTDIR_TMPFS\" ] && umount $MOUNTDIR_TMPFS" 0 HUP INT QUIT ABRT KILL TERM
} }
function create_rpm_database() { function create_rpm_database() {
@ -186,9 +187,9 @@ $RPM_CHROOT_PREFIX $RPM $RPM_ROOT_APPEND --initdb" > ${LOCALSTATEDIR}/${BUILDSCR
function clean_rpm_database() { function clean_rpm_database() {
#echo "Cleaning rpm database" #echo "Cleaning rpm database"
#[ "$MOUNTDIR" != "" -a "$MOUNTDIR" != "/" ] && rm -rf $MOUNTDIR/var/lib/rpm/__db.* #[ "$MOUNTDIR" != "" -a "$MOUNTDIR" != "/" ] && rm -rf $MOUNTDIR/var/lib/rpm/__db.*
echo "Killing any gpg-agent..." echo "Killing any gpg-agent and keyboxd..."
# Kill any gpg-agent daemon spawned daemon preventing umount # Kill any gpg-agent daemon spawned daemon preventing umount
killall -9 gpg-agent killall -9 gpg-agent keyboxd
rm -rf $MOUNTDIR/root/.gnupg rm -rf $MOUNTDIR/root/.gnupg
#chroot $MOUNTDIR /usr/bin/gpgconf --kill gpg-agent || : #chroot $MOUNTDIR /usr/bin/gpgconf --kill gpg-agent || :
} }
@ -333,7 +334,7 @@ function install_kernel() {
if [ "$KERNEL_NOPREPARATION" != "1" ]; then if [ "$KERNEL_NOPREPARATION" != "1" ]; then
install_rpms_by_target "\ install_rpms_by_target "\
Installing and preparing dracut for kernel install..." \ Installing and preparing dracut for kernel install..." \
"dracut module-init-tools" "dracut"
for f in /usr/sbin/dracut /usr/sbin/mkinitrd /sbin/depmod; do for f in /usr/sbin/dracut /usr/sbin/mkinitrd /sbin/depmod; do
mv ${MOUNTDIR}${f} ${MOUNTDIR}${f}.preinst mv ${MOUNTDIR}${f} ${MOUNTDIR}${f}.preinst
@ -1126,7 +1127,7 @@ function produce_media() {
cpio_xz|CPIO_XZ) cpio_xz|CPIO_XZ)
echo "Producing rootfs compressed cpio image $MEDIUM_FILENAME..." echo "Producing rootfs compressed cpio image $MEDIUM_FILENAME..."
(cd $MOUNTDIR (cd $MOUNTDIR
find . -print | cpio -o -Hnewc | xz -c > $LOCALSTATEDIR/$MEDIUM_FILENAME ) find . -print | cpio -o -Hnewc | xz -T4 -c > $LOCALSTATEDIR/$MEDIUM_FILENAME )
;; ;;
squash|SQUASH) squash|SQUASH)
echo "Producing squashfs (default) compressed filesystem image $MEDIUM_FILENAME..." echo "Producing squashfs (default) compressed filesystem image $MEDIUM_FILENAME..."