1
1

Allow to specify a separate install location for drivedb.h.

This prevents that update-smart-drivedb overwrites the package
installed file (Debian Bug 976696, Ubuntu Bug 1893202).

configure.ac, Makefile.am: Add '--with-drivedbinstdir' option.
update-smart-drivedb.in: Add '--install' option.
update-smart-drivedb.8.in: Document new functionality.
smartctl.8.in, smartd.8.in: Adjust path names.

git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@5318 4ea69e1a-61f1-4043-bf83-b5c94c648137
Этот коммит содержится в:
chrfranke 2022-02-18 17:23:14 +00:00
родитель 98b87ae6d2
Коммит 2d322aa670
7 изменённых файлов: 83 добавлений и 20 удалений

Просмотреть файл

@ -1,5 +1,16 @@
$Id$
2022-02-18 Christian Franke <franke@computer.org>
Allow to specify a separate install location for drivedb.h.
This prevents that update-smart-drivedb overwrites the package
installed file (Debian Bug 976696, Ubuntu Bug 1893202).
configure.ac, Makefile.am: Add '--with-drivedbinstdir' option.
update-smart-drivedb.in: Add '--install' option.
update-smart-drivedb.8.in: Document new functionality.
smartctl.8.in, smartd.8.in: Adjust path names.
2022-02-16 Douglas Gilbert <dgilbert@interlog.com>
smartctl.cpp: add new --log=tapedevstat to print out SCSI

Просмотреть файл

@ -508,7 +508,7 @@ endif
if ENABLE_DRIVEDB
drivedb_DATA = drivedb.h
drivedbinst_DATA = drivedb.h
endif
update-smart-drivedb: update-smart-drivedb.in config.status
@ -591,7 +591,7 @@ smartd.service: smartd.service.in Makefile
# Create empty directories if configured.
# Default install rules no longer create empty directories since automake 1.11.
installdirs-local:
@for d in '$(smartdplugindir)' '$(savestatesdir)' '$(attributelogdir)'; do \
@for d in '$(smartdplugindir)' '$(drivedbdir)' '$(savestatesdir)' '$(attributelogdir)'; do \
test -n "$$d" || continue; \
echo " $(MKDIR_P) '$(DESTDIR)$$d'"; \
$(MKDIR_P) "$(DESTDIR)$$d" || exit 1; \
@ -619,10 +619,16 @@ MAN_FILTER = { \
-e 's|/usr/bin/mail|/usr/bin/$(os_mailer)|g' \
-e 's|RELEASE_6_0_DRIVEDB|$(DRIVEDB_BRANCH)|g' | \
if test -n '$(drivedbdir)'; then \
sed 's|/usr/local/share/smartmontools/drivedb\.h|$(drivedbdir)/drivedb.h|g' ; \
sed -e 's|/usr/local/share/smartmontools/drivedb\.h|$(drivedbinstdir)/drivedb.h|g' \
-e 's|/usr/local/var/lib/smartmontools/drivedb\.h|$(drivedbdir)/drivedb.h|g' ; \
else \
sed '/^\.\\" %IF ENABLE_DRIVEDB/,/^\.\\" %ENDIF ENABLE_DRIVEDB/ s,^,.\\"\# ,' ; \
fi | \
if test '$(drivedbinstdir)' != '$(drivedbdir)'; then \
cat; \
else \
sed '/^\.\\" %IF ENABLE_DB_INSTALL/,/^\.\\" %ENDIF ENABLE_DB_INSTALL/ s,^,.\\"\# ,' ; \
fi | \
if test '$(with_update_smart_drivedb)' = 'yes'; then \
cat; \
else \

Просмотреть файл

@ -187,9 +187,23 @@ AC_ARG_WITH(exampledir,
AC_SUBST(exampledir)
drivedbdir='${datadir}/${PACKAGE}'
drivedbinstdir=
AC_ARG_WITH(drivedbinstdir,
[AS_HELP_STRING([--with-drivedbinstdir@<:@=DIR|yes|no@:>@],
[Optional separate install location of drive database file [no] (yes=DATADIR/smartmontools)])],
[ case "$withval" in
no) ;;
yes) drivedbinstdir=$drivedbdir; drivedbdir='${localstatedir}/lib/${PACKAGE}' ;;
*) drivedbinstdir=$withval; drivedbdir='${localstatedir}/lib/${PACKAGE}' ;;
esac
])
AC_ARG_WITH(drivedbdir,
[AS_HELP_STRING([--with-drivedbdir@<:@=DIR|yes|no@:>@], [Location of drive database file [DATADIR/smartmontools]])],
[AS_HELP_STRING([--with-drivedbdir@<:@=DIR|yes|no@:>@],
[Location of drive database file [DATADIR/smartmontools or LOCALSTATEDIR/lib/smartmontools if separate INSTDIR]])],
[case "$withval" in yes) ;; no) drivedbdir= ;; *) drivedbdir="$withval" ;; esac])
test -n "$drivedbinstdir" || drivedbinstdir=$drivedbdir
AC_SUBST(drivedbinstdir)
AC_SUBST(drivedbdir)
AM_CONDITIONAL(ENABLE_DRIVEDB, [test -n "$drivedbdir"])
@ -893,6 +907,9 @@ info=`
echo "doc file install path: \`eval eval eval echo $docdir\`"
echo "examples install path: \`eval eval eval echo $exampledir\`"
if test -n "$drivedbdir"; then
if test "$drivedbinstdir" != "$drivedbdir"; then
echo "installed drivedb file: \`eval eval eval echo $drivedbinstdir\`/drivedb.h"
fi
echo "drive database file: \`eval eval eval echo $drivedbdir\`/drivedb.h"
if test "$with_update_smart_drivedb" = "yes"; then
echo "database update script: \`eval eval eval echo $sbindir\`/update-smart-drivedb"

Просмотреть файл

@ -1,6 +1,6 @@
.ig
Copyright (C) 2002-10 Bruce Allen
Copyright (C) 2004-21 Christian Franke
Copyright (C) 2004-22 Christian Franke
SPDX-License-Identifier: GPL-2.0-or-later
@ -1933,7 +1933,7 @@ if this option is not specified.
.Sp
If
.\" %IF NOT OS Windows
\fB/usr/local/share/smartmontools/drivedb.h\fP
\fB/usr/local/var/lib/smartmontools/drivedb.h\fP
.\" %ENDIF NOT OS Windows
.\" %IF OS ALL
(Windows: \fBEXEDIR/drivedb.h\fP)
@ -2431,7 +2431,7 @@ done
full path of this executable.
.\" %IF ENABLE_DRIVEDB
.TP
.B /usr/local/share/smartmontools/drivedb.h
.B /usr/local/var/lib/smartmontools/drivedb.h
drive database (see \*(Aq\-B\*(Aq option).
.\" %ENDIF ENABLE_DRIVEDB
.TP

Просмотреть файл

@ -832,7 +832,7 @@ plugin directory for smartd warning script (see \*(Aq\-m\*(Aq directive on
.\" %ENDIF ENABLE_SMARTDPLUGINDIR
.\" %IF ENABLE_DRIVEDB
.TP
.B /usr/local/share/smartmontools/drivedb.h
.B /usr/local/var/lib/smartmontools/drivedb.h
drive database (see \*(Aq\-B\*(Aq option).
.\" %ENDIF ENABLE_DRIVEDB
.TP

Просмотреть файл

@ -1,6 +1,6 @@
.ig
Copyright (C) 2013 Hannes von Haugwitz <hannes@vonhaugwitz.com>
Copyright (C) 2014-21 Christian Franke
Copyright (C) 2014-22 Christian Franke
SPDX-License-Identifier: GPL-2.0-or-later
@ -41,7 +41,7 @@ update-smart-drivedb \- update smartmontools drive database
.\" %ENDIF NOT OS ALL
.B update-smart-drivedb
updates
.B /usr/local/share/smartmontools/drivedb.h
.B /usr/local/var/lib/smartmontools/drivedb.h
or
.I DESTFILE
from branches/RELEASE_6_0_DRIVEDB of smartmontools SVN repository.
@ -84,7 +84,7 @@ The form \*(Aq\-s \-\*(Aq disables the syntax check.
The default is
.BR /usr/local/sbin/smartctl .
.TP
.B \-t [/DIR/]TOOL, \-\-tool [/DIR/]TOOL
.B \-t [DIR/]TOOL, \-\-tool [DIR/]TOOL
Use TOOL for download.
TOOL is one of:
.I curl wget lynx
@ -134,6 +134,15 @@ exist unless \*(Aq\-\-no\-verify\*(Aq is also specified.
Copy from local FILE.
A valid OpenPGP/GPG signature \*(AqFILE.raw.asc\*(Aq must also exist
unless \*(Aq\-\-no\-verify\*(Aq is also specified.
.\" %IF ENABLE_DB_INSTALL
.TP
.B \-\-install
[NEW EXPERIMENTAL UPDATE-SMART-DRIVEDB FEATURE]
Copy from originally installed drive database file.
This is the same as:
.br
\*(Aq\-\-no\-verify \-\-file /usr/local/share/smartmontools/drivedb.h\*(Aq
.\" %ENDIF ENABLE_DB_INSTALL
.TP
.B \-\-trunk
Download from SVN trunk.
@ -186,14 +195,14 @@ Print help text.
Regular update:
.Vb 2
# update-smart-drivedb
/usr/local/share/smartmontools/drivedb.h 7.2/5225 updated to 7.2/5237
/usr/local/var/lib/smartmontools/drivedb.h 7.2/5225 updated to 7.2/5237
.Ve
.PP
Revert to previous version:
.Vb 2
# update-smart-drivedb --force \e
--file /usr/local/share/smartmontools/drivedb.h.old
/usr/local/share/smartmontools/drivedb.h 7.2/5237 downgraded to 7.2/5225
--file /usr/local/var/lib/smartmontools/drivedb.h.old
/usr/local/var/lib/smartmontools/drivedb.h 7.2/5237 downgraded to 7.2/5225
.Ve
.PP
Download the database from SVN trunk to current directory:
@ -214,23 +223,28 @@ full path of this script.
.TP
.B /usr/local/sbin/smartctl
used to check syntax of new drive database.
.\" %IF ENABLE_DB_INSTALL
.TP
.B /usr/local/share/smartmontools/drivedb.h
originally installed drive database.
.\" %ENDIF ENABLE_DB_INSTALL
.TP
.B /usr/local/var/lib/smartmontools/drivedb.h
current drive database.
.TP
.B /usr/local/share/smartmontools/drivedb.h.raw
.B /usr/local/var/lib/smartmontools/drivedb.h.raw
current drive database with unexpanded SVN Id string.
.TP
.B /usr/local/share/smartmontools/drivedb.h.raw.asc
.B /usr/local/var/lib/smartmontools/drivedb.h.raw.asc
signature file.
.TP
.B /usr/local/share/smartmontools/drivedb.h.*old*
.B /usr/local/var/lib/smartmontools/drivedb.h.*old*
previous files.
.TP
.B /usr/local/share/smartmontools/drivedb.h.*error*
.B /usr/local/var/lib/smartmontools/drivedb.h.*error*
new files if rejected due to errors.
.TP
.B /usr/local/share/smartmontools/drivedb.h.lastcheck
.B /usr/local/var/lib/smartmontools/drivedb.h.lastcheck
empty file created if downloaded file was identical.
.Sp
.SH AUTHORS

Просмотреть файл

@ -22,6 +22,8 @@ exec_prefix="@exec_prefix@"
sbindir="@sbindir@"
datarootdir="@datarootdir@"
datadir="@datadir@"
localstatedir="@localstatedir@"
drivedbinstdir="@drivedbinstdir@"
drivedbdir="@drivedbdir@"
# Download tools
@ -57,7 +59,7 @@ Usage: $myname [OPTIONS] [DESTFILE]
-s, --smartctl SMARTCTL
Use SMARTCTL for syntax check ('-s -' to disable)
[default: $default_smartctl]
-t, --tool [/DIR/]TOOL
-t, --tool [DIR/]TOOL
Use TOOL for download: $os_dltools
[default: first one found in $pathinfo]
-u, --url-of LOCATION
@ -69,6 +71,13 @@ Usage: $myname [OPTIONS] [DESTFILE]
trac (Trac code browser)
--url URL Download from URL
--file FILE Copy from local FILE
EOF
test "$drivedbinstdir" = "$drivedbdir" || cat <<EOF
--install Copy from originally installed drive database file
This is the same as:
'--no-verify --file $drivedbinstdir/drivedb.h'
EOF
cat <<EOF
--trunk Download from SVN trunk (requires '--no-verify')
--branch X.Y Download from branches/RELEASE_X_Y_DRIVEDB
--cacert FILE Use CA certificates from FILE to verify the peer
@ -603,6 +612,12 @@ while true; do case $1 in
check_optarg "$@"; shift
file=$1 ;;
--install)
test "$drivedbinstdir" != "$drivedbdir" \
|| error "'$1' is not supported in this configuration"
file="$drivedbinstdir/drivedb.h"
no_verify=t ;;
--dryrun)
dryrun=t ;;