aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario Limonciello <superm1@gmail.com>2023-11-27 19:15:53 +0000
committerMario Limonciello <superm1@gmail.com>2023-11-27 19:15:53 +0000
commit4fab4e51bee5c5f96a544e93010fef66c701dcff (patch)
treec131635e2aba126bbb8752f1f7fcf5d525d3db41
parentf8c611e72b3e327247eee3c892b407be3ad5ea12 (diff)
parent4124f8f928d51a1437e2fd2636b20d540edc2836 (diff)
downloadlinux-firmware-4fab4e51bee5c5f96a544e93010fef66c701dcff.tar.gz
Merge branch 'rdfind-opt' into 'main'
Make rdfind optional See merge request kernel-firmware/linux-firmware!86
-rw-r--r--Makefile4
-rwxr-xr-xcopy-firmware.sh28
2 files changed, 23 insertions, 9 deletions
diff --git a/Makefile b/Makefile
index f7e63237..c94edffe 100644
--- a/Makefile
+++ b/Makefile
@@ -30,6 +30,10 @@ install:
install -d $(DESTDIR)$(FIRMWAREDIR)
./copy-firmware.sh $(DESTDIR)$(FIRMWAREDIR)
+install-nodedup:
+ install -d $(DESTDIR)$(FIRMWAREDIR)
+ ./copy-firmware.sh --ignore-duplicates $(DESTDIR)$(FIRMWAREDIR)
+
install-xz:
install -d $(DESTDIR)$(FIRMWAREDIR)
./copy-firmware.sh --xz $(DESTDIR)$(FIRMWAREDIR)
diff --git a/copy-firmware.sh b/copy-firmware.sh
index 6f2268b0..6757c6ce 100755
--- a/copy-firmware.sh
+++ b/copy-firmware.sh
@@ -9,6 +9,7 @@ prune=no
# shellcheck disable=SC2209
compress=cat
compext=
+skip_dedup=0
while test $# -gt 0; do
case $1 in
@@ -44,6 +45,11 @@ while test $# -gt 0; do
shift
;;
+ --ignore-duplicates)
+ skip_dedup=1
+ shift
+ ;;
+
-*)
if test "$compress" = "cat"; then
echo "ERROR: unknown command-line option: $1"
@@ -70,8 +76,10 @@ if [ -z "$destdir" ]; then
fi
if ! command -v rdfind >/dev/null; then
- echo "ERROR: rdfind is not installed"
- exit 1
+ if [ "$skip_dedup" != 1 ]; then
+ echo "ERROR: rdfind is not installed. Pass --ignore-duplicates to skip deduplication"
+ exit 1
+ fi
fi
# shellcheck disable=SC2162 # file/folder name can include escaped symbols
@@ -87,13 +95,15 @@ grep -E '^(RawFile|File):' WHENCE | sed -E -e 's/^(RawFile|File): */\1 /;s/"//g'
fi
done
-$verbose "Finding duplicate files"
-rdfind -makesymlinks true -makeresultsfile false "$destdir" >/dev/null
-find "$destdir" -type l | while read -r l; do
- target="$(realpath "$l")"
- $verbose "Correcting path for $l"
- ln -fs "$(realpath --relative-to="$(dirname "$(realpath -s "$l")")" "$target")" "$l"
-done
+if [ "$skip_dedup" != 1 ] ; then
+ $verbose "Finding duplicate files"
+ rdfind -makesymlinks true -makeresultsfile false "$destdir" >/dev/null
+ find "$destdir" -type l | while read -r l; do
+ target="$(realpath "$l")"
+ $verbose "Correcting path for $l"
+ ln -fs "$(realpath --relative-to="$(dirname "$(realpath -s "$l")")" "$target")" "$l"
+ done
+fi
# shellcheck disable=SC2162 # file/folder name can include escaped symbols
grep -E '^Link:' WHENCE | sed -e 's/^Link: *//g;s/-> //g' | while read f d; do