diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2020-06-03 11:57:11 +0200 |
---|---|---|
committer | Romain Bouvier <skunnyk@alteroot.org> | 2020-06-04 19:54:45 +0200 |
commit | 29b0a936ce8724567979dd1edbebea9188debd3a (patch) | |
tree | 53274a988b3071abba14af8b5d8b6c8c171b89a6 /scripts | |
parent | bc9a62e08bdbd1460917e2eb44577ad472026738 (diff) | |
download | xfce4-dev-tools-29b0a936ce8724567979dd1edbebea9188debd3a.tar.gz |
xdt-autogen: Improve and simplify linguas detection
The `ls *.po | awk ..` pattern is generally not recommended[0]. Replace
it with a tiny for loop with basename. Use POSIX `tr`[1] to delete the
trailing end-of-line, since `echo -n` is not specified in POSIX[2]. This
also removes the need for awk check.
[0]: https://github.com/koalaman/shellcheck/wiki/SC2012#rationale
[1]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/tr.html
[2]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/echo.html
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/xdt-autogen.in | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/scripts/xdt-autogen.in b/scripts/xdt-autogen.in index 6cd3d4f..222ed3f 100644 --- a/scripts/xdt-autogen.in +++ b/scripts/xdt-autogen.in @@ -44,25 +44,6 @@ if test -z "$EGREP"; then fi fi -awk_tests="gawk mawk nawk awk" -if test -z "$AWK"; then - for a in $awk_tests; do - if type $a >/dev/null 2>&1; then - AWK=$a - break - fi - done -else - if ! type $AWK >/dev/null 2>/dev/null; then - unset AWK - fi -fi -if test -z "$AWK"; then - echo "xdt-autogen: The 'awk' program (one of $awk_tests) is" >&2 - echo " required, but cannot be found." >&2 - exit 1 -fi - ## ## figures out any subdirs that should be configured as a part ## of recursive configure. @@ -194,7 +175,7 @@ for configure_ac_in_file in $CONFIGURE_AC_IN_FILES; do # find out what languages we support conf_dir=`dirname $configure_ac_file` - linguas=`cd "$conf_dir/po" 2>/dev/null && ls *.po 2>/dev/null | $AWK 'BEGIN { FS="."; ORS=" " } { print $1 }'` + linguas=$(echo $(for i in "$conf_dir"/po/*.po; do test -e "$i" && basename -- "$i" .po; done) | tr -d '\n') # and do the substitution tmp=`basename ${configure_ac_in_file}` |