]>
git.proxmox.com Git - proxmox-backup-restore-image.git/blob - src/build_initramfs.sh
6 BUILDDIR
="build/initramfs"
7 INIT
="../../init-shim-rs/target/x86_64-unknown-linux-gnu/release/init-shim-rs"
9 echo "Using build dir: $BUILDDIR"
13 echo "copying package cache into build-dir"
14 cp -a pkgs
"$BUILDDIR/pkgs"
19 # adds necessary packages to initramfs build root folder
23 if [ -z "$NO_DOWNLOAD" ]; then
26 printf " getting reverse dependencies for '%s'" "$pkg"
27 LOCAL_DEPS
=$
(apt-rdepends
-f Depends
-s Depends
"$pkg" |
grep -v '^ ')
28 DEPS
="$DEPS $LOCAL_DEPS"
30 # debconf and gcc are unnecessary, libboost-regex doesn't install on bullseye
31 DEPS
=$
(echo "$DEPS" |\
32 sed -E 's/debconf(-2\.0)?//g' |\
33 sed -E 's/libboost-regex//g' |\
34 sed -E 's/gcc-.{1,2}-base//g')
36 if [ ! -d "pkgs/$debdir" ]; then
37 mkdir
-p "pkgs/$debdir"
40 if [ -n "$DEPS" ]; then
41 (cd "pkgs/$debdir"; apt-get download
$DEPS)
44 if [ -z "$DOWNLOAD_ONLY" ]; then
45 for deb
in pkgs
/$debdir/*.deb
; do
46 dpkg-deb
-x "$deb" "$ROOT"
52 echo "creating CPIO archive '$1'"
55 find . -print0 | cpio --null -oV --format=newc -F ../$1
59 if [ -z "$DOWNLOAD_ONLY" ]; then
62 chmod a
+x
"$ROOT/init" # just to be sure
64 # tell daemon it's running in the correct environment
65 touch "$ROOT/restore-vm-marker"
68 echo "getting base dependencies"
84 thin-provisioning-tools:amd64 \
87 if [ -z "$DOWNLOAD_ONLY" ]; then
89 echo "install ZFS tool"
90 # install custom ZFS tools (built without libudev)
92 cp -a ..
/zfstools
/sbin
/* "$ROOT/sbin/"
93 cp -a ..
/zfstools
/etc
/* "$ROOT/etc/"
94 cp -a ..
/zfstools
/lib
/* "$ROOT/lib/"
95 cp -a ..
/zfstools
/usr
/* "$ROOT/usr/"
97 echo "cleanup unused data from base dependencies"
98 rm -rf ${ROOT:?}/usr
/share
# contains only docs and debian stuff
99 rm -rf ${ROOT:?}/usr
/local
/include
# header files
100 rm -rf ${ROOT:?}/usr
/local
/share
# mostly ZFS tests
101 rm -f ${ROOT:?}/lib
/x86_64-linux-gnu
/*.a
# static libraries
103 make_cpio
"initramfs.img"
106 echo "getting extra/debug dependencies"
108 # add debug helpers for debug initramfs, packages from above are included too
115 if [ -z "$DOWNLOAD_ONLY" ]; then
116 # leave /usr/share here, it contains necessary stuff for gdb
117 make_cpio
"initramfs-debug.img"