[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ipcop-svn
Subject:    [Ipcop-svn] SF.net SVN: ipcop:[7039] ipcop/trunk/make.sh
From:       gespinasse () users ! sourceforge ! net
Date:       2013-05-20 17:47:44
Message-ID: E1UeUBT-0001N7-Vg () sfp-svn-3 ! v30 ! ch3 ! sourceforge ! com
[Download RAW message or body]

Revision: 7039
          http://ipcop.svn.sourceforge.net/ipcop/?rev=7039&view=rev
Author:   gespinasse
Date:     2013-05-20 17:47:43 +0000 (Mon, 20 May 2013)
Log Message:
-----------
Clean make.sh by replacing "type cmd" | cut -d" " -f3 by "type -p cmd"
Answer is empty when command is not installed.

I checked this work even in RHEL3 (bash-2.05)

Modified Paths:
--------------
    ipcop/trunk/make.sh

Modified: ipcop/trunk/make.sh
===================================================================
--- ipcop/trunk/make.sh	2013-05-17 08:59:47 UTC (rev 7038)
+++ ipcop/trunk/make.sh	2013-05-20 17:47:43 UTC (rev 7039)
@@ -398,22 +398,22 @@
 # users are granted access (ie you can't type mount, you have to type /bin/mount)
 # We use bash's type as which may not be available
 # Don't allow bash to use hashing for the commands, or this might not work
-CHMOD=`bash +h -c "type chmod" | cut -d" " -f3`
-CHROOT=`bash +h -c "type chroot" | cut -d" " -f3`
-DU=`bash +h -c "type du" | cut -d" " -f3`
-LN="`bash +h -c "type ln" | cut -d" " -f3` -sf"
-LOSETUP=`bash +h -c "type losetup" | cut -d" " -f3`
-MKDIR="`bash +h -c "type mkdir" | cut -d" " -f3` -p"
-MKNOD="`bash +h -c "type mknod" | cut -d" " -f3`"
-MOUNT=`bash +h -c "type mount" | cut -d" " -f3` > /dev/null 2>&1
+CHMOD=`bash +h -c "type -p chmod"`
+CHROOT=`bash +h -c "type -p chroot"`
+DU=`bash +h -c "type -p du"`
+LN="`bash +h -c "type -p ln"` -sf"
+LOSETUP=`bash +h -c "type -p losetup"`
+MKDIR="`bash +h -c "type -p mkdir"` -p"
+MKNOD=`bash +h -c "type -p mknod"`
+MOUNT=`bash +h -c "type -p mount"`
 BIND="${MOUNT} --bind"
-MV=`bash +h -c "type mv" | cut -d" " -f3`
-NICECMD=`bash +h -c "type nice" | cut -d" " -f3`
-RM="`bash +h -c "type rm" | cut -d" " -f3` -fr"
-UMOUNT=`bash +h -c "type umount" | cut -d" " -f3`
+MV=`bash +h -c "type -p mv"`
+NICECMD=`bash +h -c "type -p nice"`
+RM="`bash +h -c "type -p rm"` -fr"
+UMOUNT=`bash +h -c "type -p umount"`
 
 # Just to warn on SElinux enabled host
-GETENFORCE=`bash +h -c "type getenforce" 2>/dev/null | cut -d" " -f3`
+GETENFORCE=`bash +h -c "type -p getenforce"`
 
 # Who's running this script?
 CURRENT_USER=`id -un`
@@ -422,9 +422,7 @@
 # Find where sudo is if we're doing a non-root build
 if [ x"${CURRENT_USER}" != x"root" ]; then
 	# Do we have sudo?
-	if type sudo > /dev/null 2>&1; then
-		SUDO=`bash +h -c "type sudo" | cut -d" " -f3`
-	fi
+	SUDO=`bash +h -c "type -p sudo"`
 else
 	SUDO=
 fi
@@ -1669,7 +1667,7 @@
 	fi
 
 	# search gcc host path before ccache is made, as ccache installed gcc symlink is \
                found earlier in PATH chain
-	local HOSTGCC=$(bash +h -c "type gcc" | cut -d" " -f3)
+	local HOSTGCC=$(bash +h -c "type -p gcc")
 
 	toolchain_make ccache
 	update-gcc-hash ${HOSTGCC}		# preset the compiler hash with the value of the host \
compiler

This was sent by the SourceForge.net collaborative development platform, the world's \
largest Open Source development site.


------------------------------------------------------------------------------
AlienVault Unified Security Management (USM) platform delivers complete
security visibility with the essential security capabilities. Easily and
efficiently configure, manage, and operate all of your security controls
from a single console and one unified framework. Download a free trial.
http://p.sf.net/sfu/alienvault_d2d
_______________________________________________
Ipcop-svn mailing list
Ipcop-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ipcop-svn


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic