smartmontools-7.2-update-smart-drivedb-quiet.patch 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. commit 56363dff436c12eaa296bbba39dfd65ec3f1f1f2
  2. Author: chrfranke <authors@smartmontools.org>
  3. Date: Sat Nov 6 15:07:18 2021 +0000
  4. update-smart-drivedb.in: Add '-q' option to suppress info messages.
  5. (GH issues/110).
  6. update-smart-drivedb.8.in: Document new option.
  7. git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@5242 4ea69e1a-61f1-4043-bf83-b5c94c648137
  8. --- a/update-smart-drivedb.8.in
  9. +++ b/update-smart-drivedb.8.in
  10. @@ -1,6 +1,6 @@
  11. .ig
  12. Copyright (C) 2013 Hannes von Haugwitz <hannes@vonhaugwitz.com>
  13. -Copyright (C) 2014-20 Christian Franke
  14. +Copyright (C) 2014-21 Christian Franke
  15. SPDX-License-Identifier: GPL-2.0-or-later
  16. @@ -144,6 +144,10 @@ Print the OpenPGP/GPG public key block.
  17. .B \-\-dryrun
  18. Print download commands only.
  19. .TP
  20. +.B \-q
  21. +[NEW EXPERIMENTAL UPDATE-SMART-DRIVEDB FEATURE]
  22. +Suppress info messages.
  23. +.TP
  24. .B \-v
  25. Verbose output.
  26. .Sp
  27. --- a/update-smart-drivedb.in
  28. +++ b/update-smart-drivedb.in
  29. @@ -72,6 +72,7 @@ Usage: $myname [OPTIONS] [DESTFILE]
  30. --no-verify Don't verify signature
  31. --export-key Print the OpenPGP/GPG public key block
  32. --dryrun Print download commands only
  33. + -q Suppress info messages
  34. -v Verbose output
  35. Updates $DRIVEDB
  36. @@ -131,6 +132,11 @@ inpath()
  37. return $rc
  38. }
  39. +iecho()
  40. +{
  41. + test -n "$quiet" || echo "$*"
  42. +}
  43. +
  44. vecho()
  45. {
  46. test -n "$q" || echo "$*"
  47. @@ -522,6 +528,7 @@ mv_all()
  48. smtctl=$SMARTCTL
  49. tool=
  50. urlid="svn"
  51. +quiet=
  52. q="-q"
  53. dryrun=
  54. trunk=
  55. @@ -547,6 +554,9 @@ while true; do case $1 in
  56. shift; test -n "$1" || usage
  57. urlid=$1 ;;
  58. + -q)
  59. + quiet=t ;;
  60. +
  61. -v)
  62. q= ;;
  63. @@ -727,7 +737,7 @@ if [ -f "$DEST" ]; then
  64. then
  65. rm -f "$DEST.new" "$DEST.new.raw" "$DEST.new.raw.asc"
  66. touch "$DEST.lastcheck"
  67. - echo "$DEST is already up to date"
  68. + iecho "$DEST is already up to date"
  69. exit 0
  70. fi
  71. mv_all "$DEST" "" ".old"
  72. @@ -738,4 +748,4 @@ fi
  73. mv_all "$DEST" ".new" ""
  74. -echo "$DEST updated from ${trunk:-branches/$brnch}${no_verify:+ (NOT VERIFIED)}"
  75. +iecho "$DEST updated from ${trunk:-branches/$brnch}${no_verify:+ (NOT VERIFIED)}"