mirror of
				git://git.openwrt.org/openwrt/openwrt.git
				synced 2025-11-03 14:34:27 -05:00 
			
		
		
		
	Package archives built before commit e6bcf1e4ac
("build: add ABI_VERSION to binary package names") lack the SourceName
control file field which caused ipkg-remove to skip such archives.
Add fallback code that matches the files by their basename followed by
an underscore, similar to how the old cleanup code worked.
Fixes: #2067
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
		
	
			
		
			
				
	
	
		
			21 lines
		
	
	
		
			373 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			21 lines
		
	
	
		
			373 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
#!/usr/bin/env bash
 | 
						|
 | 
						|
sourcename="$1"; shift
 | 
						|
 | 
						|
for pkg in "$@"; do
 | 
						|
	tar -Ozxf "$pkg" ./control.tar.gz 2>/dev/null | tar -Ozxf - ./control 2>/dev/null | \
 | 
						|
	while read field value; do
 | 
						|
		if [ "$field" = "SourceName:" ] && [ "$value" = "$sourcename" ]; then
 | 
						|
			rm -vf "$pkg"
 | 
						|
			break
 | 
						|
		fi
 | 
						|
	done
 | 
						|
	case "$pkg" in
 | 
						|
		*/"${sourcename}_"*.ipk)
 | 
						|
			rm -vf "$pkg"
 | 
						|
		;;
 | 
						|
	esac
 | 
						|
done
 | 
						|
 | 
						|
exit 0
 |