switch to reproducible cpio instead of bsdcpio

This commit is contained in:
Tobias Powalowski 2023-03-15 12:03:32 +01:00
parent 29eec08034
commit b76022f280
5 changed files with 8 additions and 8 deletions

View file

@ -199,14 +199,14 @@ _set_hostname() {
# patch mkinitcpio to preserve permissions and use bsdcpio
# Result is this code:
# find . | bsdcpio --quiet -o -H newc |
# find . | cpio --reproducible --quiet -o -H newc |
# $compress "${COMPRESSION_OPTIONS[@]}" > "$compressout")
# pipeprogs=("find" "bsdcpio" "$compress")
_fix_initramfs_permissions() {
echo "Preserving permissions and bsdcpio usage in mkinitcpio run..."
sed -i -e 's#find . -mindepth 1 -printf .*#find . | LANG=C bsdcpio --quiet -o -H newc |#g' "${1}"/usr/bin/mkinitcpio
sed -i -e 's#find . -mindepth 1 -printf .*#find . -mindepth 1 | cpio --reproducible --quiet -o -H newc |#g' "${1}"/usr/bin/mkinitcpio
sed -i -e '/sort -z |/d' "${1}"/usr/bin/mkinitcpio
sed -i -e '/LANG=C bsdtar .*/d' "${1}"/usr/bin/mkinitcpio
sed -i -e 's#pipeprogs=.*#pipeprogs=\("find" "bsdcpio" "$compress"\)#g' "${1}"/usr/bin/mkinitcpio
sed -i -e 's#pipeprogs=.*#pipeprogs=\("find" "cpio" "$compress"\)#g' "${1}"/usr/bin/mkinitcpio
}
# vim: set ft=sh ts=4 sw=4 et:

View file

@ -240,7 +240,7 @@ _create_initramfs() {
# https://www.kernel.org/doc/Documentation/filesystems/ramfs-rootfs-initramfs.txt
# compress image with zstd
cd "${_W_DIR}"/tmp || exit 1
find . | LANG=C bsdcpio --quiet -o -H newc | zstd --rm -T0> ${_RAM}/${_INITRD} &
find . -mindepth 1 | cpio --reproducible --quiet -o -H newc | zstd --rm -T0> ${_RAM}/${_INITRD} &
sleep 2
while pgrep -x zstd &>/dev/null; do
_clean_kernel_cache

View file

@ -7,7 +7,7 @@ build ()
map add_binary head id cksum tail test uptime w who whoami xargs \
swapon uniq seq fdisk sfdisk cfdisk parted free less \
chgrp chown dialog dmesg egrep fgrep stty sync hdparm \
dirname chroot expr bzip2 su sdparm tput \
dirname chroot expr bzip2 su sdparm tput bsdtar bsdcpio \
losetup mkfifo mknod readlink lzmadec lzop xz last wall mesg utmpdump \
xzdec switch_root pivot_root chcpu ctrlaltdel gdisk sgdisk cgdisk fixparts findmnt \
lsfd lsblk swaplabel cal chrt col colcrt colrm column fallocate flock getopt \

View file

@ -6,7 +6,7 @@ build ()
{
apps="head id cksum tail test uptime w who whoami xargs \
swapon uniq seq fdisk sfdisk cfdisk parted free less \
chgrp dialog dmesg egrep fgrep stty sync hdparm \
chgrp dialog dmesg egrep fgrep stty sync hdparm bsdtar bsdcpio\
dirname chroot expr bunzip2 bzcat bzip2 su sdparm tput \
losetup mkfifo mknod lzmadec lzop lzma lzcat unlzma unxz xzcat \
lastb last wall mesg utmpdump xzdec switch_root pivot_root chcpu ctrlaltdel \

View file

@ -16,10 +16,10 @@ build ()
### add basic apps
map add_binary init agetty basename mount umount clear env printf gawk tty bash rbash \
partprobe cp dir du ls mv rm sed grep kill killall more ps pwd rmdir true cat \
mkdir echo false sleep kmod pidof touch chmod find wc uname bsdtar yes awk halt \
mkdir echo false sleep kmod pidof touch chmod find wc uname yes awk halt \
shutdown reboot poweroff insmod modprobe sh dd sort zstd date tee mktemp \
install pgrep mkfs.btrfs rmmod mountpoint gzip ldconfig nscd ln top df cut \
stat tr passwd od tar bsdcpio
stat tr passwd od tar cpio
### add nano
add_binary nano