mirror of
				https://git.proxmox.com/git/mirror_linux-firmware
				synced 2025-10-31 00:26:03 +00:00 
			
		
		
		
	Merge branch 'mlimonci/fix-symlinks' into 'main'
Fix symlink creation for some files See merge request kernel-firmware/linux-firmware!54
This commit is contained in:
		
						commit
						b79f31cf75
					
				| @ -9,16 +9,12 @@ prune=no | |||||||
| # shellcheck disable=SC2209 | # shellcheck disable=SC2209 | ||||||
| compress=cat | compress=cat | ||||||
| compext= | compext= | ||||||
| quiet=">/dev/null" |  | ||||||
| rdfind_results=/dev/null |  | ||||||
| 
 | 
 | ||||||
| while test $# -gt 0; do | while test $# -gt 0; do | ||||||
|     case $1 in |     case $1 in | ||||||
|         -v | --verbose) |         -v | --verbose) | ||||||
|             # shellcheck disable=SC2209 |             # shellcheck disable=SC2209 | ||||||
|             verbose=echo |             verbose=echo | ||||||
|             quiet= |  | ||||||
|             rdfind_results=results.txt |  | ||||||
|             shift |             shift | ||||||
|             ;; |             ;; | ||||||
| 
 | 
 | ||||||
| @ -68,6 +64,16 @@ while test $# -gt 0; do | |||||||
|     esac |     esac | ||||||
| done | done | ||||||
| 
 | 
 | ||||||
|  | if [ -z "$destdir" ]; then | ||||||
|  | 	echo "ERROR: destination directory was not specified" | ||||||
|  | 	exit 1 | ||||||
|  | fi | ||||||
|  | 
 | ||||||
|  | if ! which rdfind 2>/dev/null >/dev/null; then | ||||||
|  | 	echo "ERROR: rdfind is not installed" | ||||||
|  | 	exit 1 | ||||||
|  | fi | ||||||
|  | 
 | ||||||
| # shellcheck disable=SC2162 # file/folder name can include escaped symbols | # shellcheck disable=SC2162 # file/folder name can include escaped symbols | ||||||
| grep -E '^(RawFile|File):' WHENCE | sed -E -e 's/^(RawFile|File): */\1 /;s/"//g' | while read k f; do | grep -E '^(RawFile|File):' WHENCE | sed -E -e 's/^(RawFile|File): */\1 /;s/"//g' | while read k f; do | ||||||
|     test -f "$f" || continue |     test -f "$f" || continue | ||||||
| @ -81,6 +87,14 @@ grep -E '^(RawFile|File):' WHENCE | sed -E -e 's/^(RawFile|File): */\1 /;s/"//g' | |||||||
|     fi |     fi | ||||||
| done | 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 | ||||||
|  | 
 | ||||||
| # shellcheck disable=SC2162 # file/folder name can include escaped symbols | # 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 | grep -E '^Link:' WHENCE | sed -e 's/^Link: *//g;s/-> //g' | while read f d; do | ||||||
|     if test -L "$f$compext"; then |     if test -L "$f$compext"; then | ||||||
| @ -119,12 +133,6 @@ grep -E '^Link:' WHENCE | sed -e 's/^Link: *//g;s/-> //g' | while read f d; do | |||||||
|     fi |     fi | ||||||
| done | 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 | exit 0 | ||||||
| 
 | 
 | ||||||
| # vim: et sw=4 sts=4 ts=4 | # vim: et sw=4 sts=4 ts=4 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Mario Limonciello
						Mario Limonciello