Enhancement: Remove ashisms - pattern substitution
I've been trying abuild in Ubuntu buster and since it has /bin/sh
symlinked to dash, I tried changing the shebang line /bin/ash
to /bin/sh.
But after changing the shebang line, I'm getting error,
/root/bin/abuild: 2314: /root/bin/abuild: Bad substitution
The responsible part being, ${pkgarch/noarch/$CARCH}
Line 2314 uses this pattern substitution which is not implemented by the dash shell and not a part of POSIX.
Even though I compiled latest ash in Ubuntu and solved my original problem, using a polyfill like _subst
eases logistics for people like who are trying to adapt abuild in other systems.
It also would be great to use the interpreter as /bin/sh instead of /bin/ash.
I tried implementing it in this patch, abuild_pattern_subst.patch