smartmontools/6003-update-smart-drivedb.in-Include-configured-PATH-in-h.patch
2019-09-30 11:17:14 -04:00

88 lines
2.7 KiB
Diff

From d80b89acbcbf619f81410db4b3f9e0a7149cae1e Mon Sep 17 00:00:00 2001
From: chrfranke <authors@smartmontools.org>
Date: Thu, 16 Nov 2017 21:06:57 +0000
Subject: [PATCH 026/291] update-smart-drivedb.in: Include configured PATH in
help and error messages.
git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@4622 4ea69e1a-61f1-4043-bf83-b5c94c648137
---
smartmontools/ChangeLog | 3 +++
smartmontools/update-smart-drivedb.in | 22 ++++++++++++++++++----
2 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/smartmontools/update-smart-drivedb.in b/smartmontools/update-smart-drivedb.in
index aa23437a..44dd4718 100644
--- a/smartmontools/update-smart-drivedb.in
+++ b/smartmontools/update-smart-drivedb.in
@@ -45,10 +45,16 @@ GPG="@gnupg@"
# Smartctl used for syntax check
SMARTCTL="$sbindir/smartctl"
+# PATH information for help and error messages
+@ENABLE_SCRIPTPATH_FALSE@pathinfo='$PATH'
+@ENABLE_SCRIPTPATH_TRUE@pathinfo="'$PATH'"
+
myname=$0
usage()
{
+@ENABLE_SCRIPTPATH_TRUE@ pathinfo="
+@ENABLE_SCRIPTPATH_TRUE@ $pathinfo"
cat <<EOF
smartmontools $VERSION drive database update script
@@ -57,7 +63,7 @@ Usage: $myname [OPTIONS] [DESTFILE]
-s SMARTCTL Use SMARTCTL for syntax check ('-s -' to disable)
[default: $SMARTCTL]
-t TOOL Use TOOL for download: $os_dltools
- [default: first one found in PATH]
+ [default: first one found in $pathinfo]
-u LOCATION Use URL of LOCATION for download:
sf (Sourceforge code browser via HTTPS)
svn (SVN repository via HTTPS) [default]
@@ -85,6 +91,14 @@ error()
exit 1
}
+err_notfound()
+{
+ case $1 in
+ */*) error "$1: not found $2" ;;
+ *) error "$1: not found in $pathinfo $2" ;;
+ esac
+}
+
warning()
{
echo "$myname: (Warning) $*" >&2
@@ -410,7 +424,7 @@ if [ -z "$tool" ]; then
break
fi
done
- test -n "$tool" || error "found none of: $os_dltools"
+ test -n "$tool" || error "found none of '$os_dltools' in $pathinfo"
fi
test -n "$url" || selecturl "svn"
@@ -435,7 +449,7 @@ esac
# Check for smartctl
if [ "$smtctl" != "-" ]; then
"$smtctl" -V >/dev/null 2>&1 \
- || error "$smtctl: not found ('-s -' to ignore)"
+ || err_notfound "$smtctl" "('-s -' to ignore)"
fi
# Check for GnuPG
@@ -443,7 +457,7 @@ if [ -z "$no_verify" ]; then
test -n "$GPG" \
|| error "GnuPG is not available ('--no-verify' to ignore)"
"$GPG" --version >/dev/null 2>&1 \
- || error "$GPG: not found ('--no-verify' to ignore)"
+ || err_notfound "$GPG" "('--no-verify' to ignore)"
fi
# Use destination directory as temp directory for gpg
--
2.19.1