diff mbox series

[cthon04] fix typo and fix make failure on ubuntu

Message ID 20190329060428.28870-1-yin-jianhong@163.com (mailing list archive)
State New, archived
Headers show
Series [cthon04] fix typo and fix make failure on ubuntu | expand

Commit Message

Jianhong.Yin March 29, 2019, 6:04 a.m. UTC
there's not rpm command on Debian/Ubuntu, get glibc version by
'ldd --version' instead 'rpm -qf /path/file'

based on git://git.linux-nfs.org/projects/steved/cthon04.git
test pass on:
  RHEL-8 RHEL-7 RHEL-6 RHEL-5 and RHEL-4
  Debian-9 Ubuntu-18.10
  OpenSUSE Tumbleweed
  Slackware 14.2

Signed-off-by: Jianhong Yin <yin-jianhong@163.com>
---
 tests.init.sh | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)
diff mbox series

Patch

diff --git a/tests.init.sh b/tests.init.sh
index 778206f..db96f4a 100755
--- a/tests.init.sh
+++ b/tests.init.sh
@@ -1,7 +1,7 @@ 
 #!/bin/sh
 
-OS=${1:-Linux}
-FSTYPE=$${2:-nfs}
+OS=${1:-`uname -s`}
+FSTYPE=${2:-nfs}
 Initfile=tests.init
 
 cat <<\EOF >$Initfile
@@ -38,7 +38,7 @@  MOUNTCMD='./domount -F nfs -o $MNTOPTIONS $SERVER\:$SERVPATH $MNTPOINT'
 CFSMOUNTCMD='./domount -F cachefs -o $MNTOPTIONS $SERVER\:$SERVPATH $MNTPOINT'
 EOF
 ;;
-BSD|SunOS4.x|Tru64UNIX|HPUX|Linux|AIX|MacOSX)
+*BSD|SunOS4.x|Tru64UNIX|HPUX|Linux|AIX|MacOSX)
 cat <<\EOF >>$Initfile
 # Use this mount command if using:
 #	BSD
@@ -89,7 +89,7 @@  DASHN=
 BLC=\\c
 EOF
 ;;
-BSD|SunOS4.x|Linux|Tru64UNIX|MacOSX)
+*BSD|SunOS4.x|Linux|Tru64UNIX|MacOSX)
 cat <<\EOF >>$Initfile
 # Use the next two lines if using:
 #	BSD
@@ -105,7 +105,7 @@  esac
 
 # set PATH
 echo >>$Initfile
-echo -e "# set PATH" >>$Initfile
+echo "# set PATH" >>$Initfile
 case $OS in
 Solaris2.x)
 cat <<\EOF >>$Initfile
@@ -129,7 +129,7 @@  PATH=/bin:/usr/bin:/etc:/usr/etc:/usr/local/bin:/usr/contrib/bin:.
 EOF
 ;;
 
-BSD|SunOS4.x)
+*BSD|SunOS4.x)
 cat <<\EOF >>$Initfile
 # Use this path for:
 #	BSD
@@ -211,10 +211,10 @@  LIBS=`echo -lrpc -lsocket`
 EOF
 ;;
 
-BSD)
+*BSD)
 cat <<\EOF >>$Initfile
 # Use with BSD systems.
-CC=gcc
+CC=cc
 CFLAGS=`echo -Duse_directs -DBSD`
 MOUNT=/sbin/mount
 UMOUNT=/sbin/umount
@@ -375,7 +375,10 @@  LIBS=`echo -lnsl`
 
 EOF
 
-if [ glibc-2.26 = `{ rpm -qf /etc/ld.so.conf; echo glibc-2.26; } | sort | head -n1` ]; then
+glibc_version_base=2.26
+glibc_version_current=`ldd --version|sed -n '1{s/.* //;p}'`
+glibc_version_older=`{ echo $glibc_version_base; echo $glibc_version_current; } | sort | head -n1`
+if [ "$glibc_version_older" = "$glibc_version_base" ]; then
 	cat <<\EOF >>$Initfile
 # Use with Linux glibc > 2.26
 CFLAGS=`echo -DLINUX -DHAVE_SOCKLEN_T -DGLIBC=22 -DMMAP -DSTDARG`
@@ -387,4 +390,3 @@  fi
 ;;
 esac
 
-