copy-firmware.sh 643 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
#
# Copy firmware files based on WHENCE list
#

verbose=:
if [ x"$1" = x"-v" ]; then
    verbose=echo
    shift
fi

destdir="$1"

grep '^File:' WHENCE | sed -e's/^File: *//g' -e's/"//g' | while read f; do
    test -f "$f" || continue
    $verbose "copying file $f"
    mkdir -p $destdir/$(dirname "$f")
    cp -d "$f" $destdir/"$f"
done

grep -E '^Link:' WHENCE | sed -e's/^Link: *//g' -e's/-> //g' | while read f d; do
    test -L "$f" || continue
    test -f "$destdir/$f" && continue
    $verbose "copying link $f"
    mkdir -p $destdir/$(dirname "$f")
    cp -d "$f" $destdir/"$f"
done

exit 0