chore: more clean up

This commit is contained in:
Lars Sjöström 2025-03-17 17:03:52 +01:00
parent a3e2a970f8
commit df3a42da4b
No known key found for this signature in database
2 changed files with 8 additions and 9 deletions

View file

@ -15,9 +15,7 @@ runCommand pname {
erofs-utils
dosfstools
mtools
e2fsprogs
jq
openssl
];
env = {
@ -159,7 +157,7 @@ ${patosPkgs.systemd}/usr/bin/systemd-repart \
--size=auto \
--definitions=./final.repart.d \
--root=$out \
patos-$version.raw > final-repart-output.json
patos-${version}.raw > final-repart-output.json
rm -rf rootfs

View file

@ -11,6 +11,8 @@ in
runCommand "patos-rootfs"
{
inherit version;
buildInputs = [
pkgs.glibc
pkgs.binutils
@ -175,6 +177,9 @@ cp -P ${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt $out/etc/ssl/cert.pem
ln -sf ../cert.pem $out/etc/ssl/certs/ca-certificates.crt
ln -sf ../cert.pem $out/etc/ssl/certs/ca-bundle.crt
# no need for pkgconfig, removing..
rm -rf $out/usr/lib/pkgconfig
# setup default files
${patosPkgs.systemd}/usr/bin/systemd-hwdb --root=$out --usr update
${patosPkgs.systemd}/usr/bin/systemd-tmpfiles --root=$out $out/usr/lib/tmpfiles.d/etc.conf --create
@ -188,13 +193,9 @@ CREDENTIALS_DIRECTORY=$PWD/creds SYSTEMD_CRYPT_PREFIX='$6$' ${patosPkgs.systemd}
chmod 600 $out/etc/shadow
rm -rf creds
# Ephemeral machine-id until registration
ln -sf /run/machine-id $out/etc/machine-id
# remove pkgconfig
rm -rf $out/usr/lib/pkgconfig
### Find and install all shared libs
find $out -type f -executable -exec ldd {} \; | awk '{print $3}' | \
grep -vE "(systemd|glibc|openssl|tpm2|devmapper)" | \
@ -202,7 +203,7 @@ find $out -type f -executable -exec ldd {} \; | awk '{print $3}' | \
find $out -type f -executable -exec chmod 755 {} \;
# FIXME: ELF patching. Is there a better way?
# patch ELFs
find $out -type f -executable -exec patchelf --set-rpath /lib:/usr/lib:/usr/lib/systemd:/usr/lib/cryptsetup {} \;
find $out -type f -executable -exec patchelf --set-interpreter /lib/ld-linux-x86-64.so.2 {} \;
patchelf --remove-rpath $out/usr/lib/ld-linux-x86-64.so.2
@ -211,7 +212,7 @@ patchelf --remove-rpath $out/usr/lib/ld-linux-x86-64.so.2
find $out -type f -executable -exec strip {} \;
find $out -type d -exec chmod 755 {} \;
### install kernel modules
# install kernel modules
cp -r ${patosPkgs.kernel}/lib/modules $out/usr/lib/
find $out/usr/lib/modules -type d -exec chmod 755 {} \;
''