aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKate Ward <kate.ward@forestent.com>2017-08-17 15:16:54 +0200
committerKate Ward <kate.ward@forestent.com>2017-08-17 15:16:54 +0200
commit0f00ef262c8a66ec06ba992a3625643c962af273 (patch)
tree33a002fbf52f9204fc525aa8e60bc936d80eb7ba /lib
parent2eebfa378b69c804284c5e7479b89c6ac2679fa7 (diff)
downloadshflags-0f00ef262c8a66ec06ba992a3625643c962af273.tar.gz
Added support for BusyBox ash shell.
Diffstat (limited to 'lib')
-rwxr-xr-xlib/versions21
1 files changed, 18 insertions, 3 deletions
diff --git a/lib/versions b/lib/versions
index 9a3ffc1..b773d52 100755
--- a/lib/versions
+++ b/lib/versions
@@ -13,7 +13,7 @@
ARGV0=`basename "$0"`
LSB_RELEASE='/etc/lsb-release'
-VERSIONS_SHELLS="/bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/sh /bin/zsh"
+VERSIONS_SHELLS="ash /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/sh /bin/zsh"
TRUE=0
FALSE=1
@@ -105,9 +105,18 @@ versions_osVersion() {
versions_shellVersion() {
shell_=$1
- if [ ! -x "${shell_}" ]; then
+ shell_present_=${FALSE}
+ case "${shell_}" in
+ ash)
+ [ -x '/bin/busybox' ] && shell_present_=${TRUE}
+ ;;
+ *)
+ [ -x "${shell_}" ] && shell_present_=${TRUE}
+ ;;
+ esac
+ if [ ${shell_present_} -eq ${FALSE} ]; then
echo 'not installed'
- return
+ return ${FALSE}
fi
version_=''
@@ -121,6 +130,7 @@ versions_shellVersion() {
## pdksh is covered in versions_shell_ksh()
#[ -z "${version_}" ] && version_=`versions_shell_zsh ${shell_}`
;;
+ ash) version_=`versions_shell_ash ${shell_}` ;;
*/bash) version_=`versions_shell_bash ${shell_}` ;;
*/dash)
# simply assuming Ubuntu Linux until somebody comes up with a better
@@ -138,6 +148,11 @@ versions_shellVersion() {
unset shell_ version_
}
+# The ash shell is included in BusyBox.
+versions_shell_ash() {
+ busybox --help |head -1 |sed 's/BusyBox v\([0-9.]*\) .*/\1/'
+}
+
versions_shell_bash() {
$1 --version 2>&1 |grep 'GNU bash' |sed 's/.*version \([^ ]*\).*/\1/'
}