d/shuffle-boot-files: make it POSIX compliant
authorHans van Kranenburg <hans@knorrie.org>
Sat, 16 Jan 2021 18:34:04 +0000 (19:34 +0100)
committerHans van Kranenburg <hans@knorrie.org>
Sun, 28 Feb 2021 18:53:12 +0000 (19:53 +0100)
We want to use sh instead of bash for this program, so we have to get
rid of the back ticks and the ${//} substitution, which is a bash
extension.

Based on a patch by Elliott Mitchell.

Signed-off-by: Hans van Kranenburg <hans@knorrie.org>
debian/shuffle-boot-files

index 683788d40ad951a4efb7e9b5578d8fcef1d67306..5268c2879b917025d887d9b1ff42e2346605a85e 100755 (executable)
@@ -23,9 +23,12 @@ mkdir -p "$dest"
 
 verstring="$(readlink debian/tmp/boot/xen.gz ||
             readlink debian/tmp/boot/xen)"
-verstring="${verstring##*/}"
+verstring="${verstring##*xen-}"
 verstring="${verstring%.gz}"
 
-for f in `cd "$t/boot" && find * -type f -print`; do
-       cp -v "$t/boot/$f" "$dest/${f/$verstring/xen-$version-$flavour}"
+find "$t/boot" -type f -print | while read f; do
+       basename="${f#$t/boot/}"
+       head="${basename%$verstring*}"
+       tail="${basename#*$verstring}"
+       cp -v "$f" "${dest}/${head}${version}-${flavour}${tail}"
 done