From 8acece36525b9039f607ee44cca1ecc5531a12b3 Mon Sep 17 00:00:00 2001
From: chrfranke <chrfranke@4ea69e1a-61f1-4043-bf83-b5c94c648137>
Date: Tue, 29 Jan 2008 18:36:20 +0000
Subject: [PATCH] Replaced 'head [-n] -1' by 'sed 1...' in autogen.sh to avoid
 portability issues.

git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@2455 4ea69e1a-61f1-4043-bf83-b5c94c648137
---
 sm5/CHANGELOG  |  5 ++++-
 sm5/autogen.sh | 11 ++---------
 2 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/sm5/CHANGELOG b/sm5/CHANGELOG
index c273db806..78d9be98f 100644
--- a/sm5/CHANGELOG
+++ b/sm5/CHANGELOG
@@ -1,6 +1,6 @@
 CHANGELOG for smartmontools
 
-$Id: CHANGELOG,v 1.648 2008/01/23 13:43:24 ballen4705 Exp $
+$Id: CHANGELOG,v 1.649 2008/01/29 18:36:20 chrfranke Exp $
 
 The most recent version of this file is:
 http://smartmontools.cvs.sourceforge.net/smartmontools/sm5/CHANGELOG?view=markup
@@ -34,6 +34,9 @@ NOTES FOR FUTURE RELEASES: see TODO file.
 
 <DEVELOPERS: ADDITIONS TO THE CHANGE LOG GO JUST BELOW HERE, PLEASE>
 
+  [CF] Replaced 'head [-n] -1' by 'sed 1...' in autogen.sh to avoid
+       portability issues.
+
   [BA] Fixed autogen.sh script so that it uses 'grep -n 1' if 'grep -1'
        fails.  Needed for Mac OS X 10.4. Uck.
  
diff --git a/sm5/autogen.sh b/sm5/autogen.sh
index 3dacf0c80..249f47e2a 100755
--- a/sm5/autogen.sh
+++ b/sm5/autogen.sh
@@ -1,5 +1,5 @@
 #!/bin/sh
-# $Id: autogen.sh,v 1.17 2008/01/23 13:43:24 ballen4705 Exp $
+# $Id: autogen.sh,v 1.18 2008/01/29 18:36:20 chrfranke Exp $
 #
 # Generate ./configure from config.in and Makefile.in from Makefile.am.
 # This also adds files like missing,depcomp,install-sh to the source
@@ -68,14 +68,7 @@ case "$AUTOMAKE" in
   *automake-1.[78]|*automake17)
     ;;
   *)
-    # first see if we need 'head -1' or 'head -n 1'
-    echo hello | head -1 > /dev/null 2> /dev/null
-    if [ $? ] ; then 
-        ver="`$AUTOMAKE --version | head -n 1 | sed -n 's,^.*\([12]\.[.0-9]*[-pl0-9]*\).*$,\1,p'`"
-    else
-        ver="`$AUTOMAKE --version | head -1 | sed -n 's,^.*\([12]\.[.0-9]*[-pl0-9]*\).*$,\1,p'`"
-    fi
-
+    ver="`$AUTOMAKE --version | sed -n '1s,^.*\([12]\.[.0-9]*[-pl0-9]*\).*$,\1,p'`"
     ver="${ver:-?.?.?}"
     case "$ver" in
       1.[78]*|1.9.[1-6]|1.10) ver= ;;
-- 
GitLab