#!/bin/bash # --- T2-COPYRIGHT-NOTE-BEGIN --- # T2 SDE: misc/target/initrd.in # Copyright (C) 2004 - 2023 The T2 SDE Project # # This Copyright note is generated by scripts/Create-CopyPatch, # more information can be found in the files COPYING and README. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2. # --- T2-COPYRIGHT-NOTE-END --- # extend_initrd initrd-filename from-dir # adds additional content to an existing initrd (cpio image) extend_initrd() { local initrd=$1 local from=$2 echo "Extending initrd archive ..." echo "Initrd: ${initrd/$build_root/\$root}" echo " from: ${from/$build_root/\$root}" ( # extract archive rm -rf $initrd.dir; mkdir $initrd.dir cd $initrd.dir zstd -d -c $initrd | cpio -i # copy extensions cd $from cp -a . $initrd.dir # create archive cd $initrd.dir find . | cpio -o -H newc | zstd -19 -T0 > $initrd ) # cleanup rm -rf $initrd.dir }