Re: script suggestion for initramfs chapter

"Rainer Fiebig" ([email protected] via blfs-support Mailing List) <[email protected]> Tue, 28 Oct 2025 14:02:25 +0100
Newsgroups gmane.linux.lfs.beyond.support
Message-ID <[email protected]>
Am 27.10.25 um 09:49 schrieb Thomas Seeling ([email protected] via
blfs-support Mailing List):
> Hallo,
> 
> the chapter suggests a script to generate the initrd file, and it
> contains a line with unnecessary pipes.
> 
> |ldd /usr/sbin/$f | sed "s/\t//" | cut -d " " -f1 >> $unsorted|
> 
> I suggest to reduce this to one `awk` invocation:
> 
> |ldd /usr/sbin/$f | awk '{print$1}'|

An other way to simplify (and to reduce redundancy in one go) would be
to just append to "$unsorted" as for example in

for f in $binfiles ; do
	ldd /usr/bin/$f >> $unsorted
	[...]

Then, before "$unsorted" is sorted, remove what's not wanted with a sed:
[...]
# Install libraries
sed -i 's#^[[:blank:]]##g ; s#[[:blank:]].*##g' $unsorted
sort $unsorted | uniq | while read library ; do
[...]


Rainer

-- 
http://lists.linuxfromscratch.org/sympa/info/blfs-support
Unsubscribe: See the above information page