diff options
| author | Mario Limonciello <mario.limonciello@amd.com> | 2023-08-30 22:50:04 -0500 |
|---|---|---|
| committer | Mario Limonciello <mario.limonciello@amd.com> | 2023-08-31 10:15:45 -0500 |
| commit | 3e79f6b83bd0d193bbf068b3c8da570f39acc6bb (patch) | |
| tree | fddc7399cdb2901f06b603087a8d3460b4a8404a /copy-firmware.sh | |
| parent | 6c0973144120b604efb7101fc7342c694d4a198f (diff) | |
Create symlinks for all firmware that is duplicate using rdfind
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Diffstat (limited to 'copy-firmware.sh')
| -rwxr-xr-x | copy-firmware.sh | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/copy-firmware.sh b/copy-firmware.sh index 1ae1e37c..59ff976e 100755 --- a/copy-firmware.sh +++ b/copy-firmware.sh @@ -9,12 +9,16 @@ prune=no # shellcheck disable=SC2209 compress=cat compext= +quiet=">/dev/null" +rdfind_results=/dev/null while test $# -gt 0; do case $1 in -v | --verbose) # shellcheck disable=SC2209 verbose=echo + quiet= + rdfind_results=results.txt shift ;; @@ -115,6 +119,12 @@ grep -E '^Link:' WHENCE | sed -e 's/^Link: *//g;s/-> //g' | while read f d; do fi done +$verbose rdfind -makesymlinks true "$destdir" -outputname $rdfind_results "$quiet" +find "$destdir" -type l | while read -r l; do + target="$(realpath "$l")" + ln -fs "$(realpath --relative-to="$(dirname "$(realpath -s "$l")")" "$target")" "$l" +done + exit 0 # vim: et sw=4 sts=4 ts=4 |
