summaryrefslogtreecommitdiffstats
path: root/cmd/zpool_id
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2011-05-06 10:16:04 -0700
committerBrian Behlendorf <[email protected]>2011-05-06 10:16:04 -0700
commit6ee44e32be259706aed9b1439b71971a165b198c (patch)
treeb76da1c5dad00da12dcb5ce92dc285ba51611415 /cmd/zpool_id
parent34b84cb831695b276788493048ea34f8af8d5bdf (diff)
Fix awk usage
The zpool_id and zpool_layout helper scripts have been updated to use the more common /usr/bin/awk symlink. On Fedora/Redhat systems there are both /bin/awk and /usr/bin/awk symlinks to your installed version of awk. On Debian/Ubuntu systems only the /usr/bin/awk symlink exists. Additionally, add the '\<' token to the beginning of the regex pattern to prevent partial matches. This pattern only appears to work with gawk despite the mawk man page claiming to support this extended regex. Thus you will need to have gawk installed to use these optional helper scripts. A comment has been added to the script to reflect this reality.
Diffstat (limited to 'cmd/zpool_id')
-rwxr-xr-xcmd/zpool_id/zpool_id7
1 files changed, 4 insertions, 3 deletions
diff --git a/cmd/zpool_id/zpool_id b/cmd/zpool_id/zpool_id
index c3637847a..f74504cfb 100755
--- a/cmd/zpool_id/zpool_id
+++ b/cmd/zpool_id/zpool_id
@@ -2,7 +2,7 @@
CONFIG=${CONFIG:-/etc/zfs/zdev.conf}
PATH_ID=${PATH_ID:-/lib/udev/path_id}
-AWK=${AWK:-/bin/awk}
+AWK=${AWK:-/usr/bin/awk}
die() {
echo "Error: $*"
@@ -47,8 +47,9 @@ eval `${PATH_ID} ${DEVICE}`
# configuration file which is of the format <device id> <key>.
# Lines starting with #'s are treated as comments and ignored.
# Exact matches are required, wild cards are not supported,
-# and only the first match is returned.
-ID_ZPOOL=`${AWK} "/${ID_PATH}\>/ && !/^#/ { print \\$1; exit }" ${CONFIG}`
+# and only the first match is returned. Also note the following
+# regex pattern only appears to work with gawk, not mawk or awk.
+ID_ZPOOL=`${AWK} "/\<${ID_PATH}\>/ && !/^#/ { print \\$1; exit }" ${CONFIG}`
[ -z ${ID_ZPOOL} ] && die "Missing ID_ZPOOL for ID_PATH: ${ID_PATH}"
if [ ${ID_ZPOOL} ]; then