Compare commits
4 Commits
| Author | SHA256 | Date | |
|---|---|---|---|
| f417b62ff4 | |||
| 5b99e758ea | |||
| 2b3488eda9 | |||
| 84c20441c9 |
7057
smartmontools-drivedb.h
Normal file
7057
smartmontools-drivedb.h
Normal file
File diff suppressed because it is too large
Load Diff
@@ -9,6 +9,19 @@
|
||||
|
||||
set -o errexit
|
||||
|
||||
# get_db_version DRIVEDB > VERSION
|
||||
get_db_version()
|
||||
{
|
||||
local v
|
||||
v=`sed -n '/^[ {]*"VERSION: .*"/{
|
||||
s,^[ {]*"VERSION: \([1-9][./0-9]*\)[ "].*$,\1,p
|
||||
q
|
||||
}' "$1"` || return 1
|
||||
test -n "$v" || return 0
|
||||
test "${v%/*}" != "$v" || v="$v/?"
|
||||
echo "$v"
|
||||
}
|
||||
|
||||
VERSION=`sed -n 's/^Version:[[:space:]]*//p' <smartmontools.spec`
|
||||
|
||||
WORKDIR="smartmontools-drivedb_h-update.tmp"
|
||||
@@ -17,7 +30,7 @@ rm -rf "$WORKDIR"
|
||||
mkdir "$WORKDIR"
|
||||
cd "$WORKDIR"
|
||||
|
||||
tar -zxf ../smartmontools-$VERSION.tar.gz smartmontools-$VERSION/update-smart-drivedb.in smartmontools-$VERSION/configure smartmontools-$VERSION/drivedb.h
|
||||
tar --wildcards -zxf ../smartmontools-$VERSION.tar.gz "smartmontools-$VERSION/update-smart-drivedb.*" "smartmontools-$VERSION/configure*" smartmontools-$VERSION/drivedb.h
|
||||
# There can be script update.
|
||||
# TODO: This patch can be generated automatically.
|
||||
if test -f ../smartmontools-update-smart-drivedb.patch ; then
|
||||
@@ -26,7 +39,7 @@ fi
|
||||
|
||||
# Extract expression that derives DRIVEDB_BRANCH from the version string
|
||||
# (from configure, to not include autoconf square brackets):
|
||||
eval "$(sed -n -e '/^[^ ]*drivedb_version=/p; /^DRIVEDB_BRANCH=/,/`/p' <smartmontools-$VERSION/configure)"
|
||||
eval "$(sed -n -e '/^[^ ]*drivedb_version=/p; /^DRIVEDB_BRANCH=/,/^$/p' <smartmontools-$VERSION/configure)"
|
||||
if test -z "$DRIVEDB_BRANCH"; then
|
||||
echo "Unable to derive DRIVEDB_BRANCH from VERSION=$VERSION."
|
||||
cd - >/dev/null
|
||||
@@ -35,7 +48,14 @@ if test -z "$DRIVEDB_BRANCH"; then
|
||||
fi
|
||||
BRANCHNAME=$DRIVEDB_BRANCH
|
||||
|
||||
PCK_TIME=$(date -d "$(sed -n 's/^.*$Id: drivedb.h [0-9][0-9]* \([^ ]* [^ ]*\) .*$/\1/p' <smartmontools-$VERSION/drivedb.h)" +%s)
|
||||
DEF_VERSION=$(get_db_version smartmontools-$VERSION/drivedb.h)
|
||||
if test -f ../smartmontools-drivedb.h ; then
|
||||
PCK_VERSION=$(get_db_version ../smartmontools-drivedb.h)
|
||||
PCK_DRIVEDB=../smartmontools-drivedb.h
|
||||
else
|
||||
PCK_VERSION=$DEF_VERSION
|
||||
PCK_DRIVEDB=smartmontools-$VERSION/drivedb.h
|
||||
fi
|
||||
|
||||
echo "Updating drivedb.h for branch $DRIVEDB_BRANCH."
|
||||
|
||||
@@ -55,15 +75,19 @@ sed "
|
||||
chmod +x update-smart-drivedb-wd
|
||||
# Verification of the downloaded drivedb.h has to be done by the packaged smartctl.
|
||||
# Skip it on the host system, and run it as part of %build stage.
|
||||
./update-smart-drivedb-wd -u trac -s -
|
||||
./update-smart-drivedb-wd -u github -s -
|
||||
if test -f drivedb.h ; then
|
||||
mv drivedb.h smartmontools-drivedb.h
|
||||
fi
|
||||
rm -f "$DEST.lastcheck"
|
||||
rm -f "$DEST.old"
|
||||
|
||||
# Compare time (file in the drivedb branch can be older) and compare
|
||||
# files without Id (files can be equal but committed in two commits).
|
||||
UPD_TIME=$(date -d "$(sed -n 's/^.*$Id: drivedb.h [0-9][0-9]* \([^ ]* [^ ]*\) .*$/\1/p' <../smartmontools-drivedb.h)" +%s)
|
||||
sed '/^.*$Id:/d' <smartmontools-$VERSION/drivedb.h >drivedb-noid.h
|
||||
sed '/^.*$Id:/d' <../smartmontools-drivedb.h >smartmontools-drivedb-noid.h
|
||||
|
||||
UPD_VERSION=$(get_db_version smartmontools-drivedb.h)
|
||||
sed '/"VERSION: /d' <smartmontools-$VERSION/drivedb.h >drivedb-noid.h
|
||||
sed '/"VERSION: /d' <smartmontools-drivedb.h >smartmontools-drivedb-noid.h
|
||||
if cmp -s drivedb-noid.h smartmontools-drivedb-noid.h ; then
|
||||
EQUAL=true
|
||||
else
|
||||
@@ -73,7 +97,17 @@ fi
|
||||
# Return to the OSC repository and perform needed changes.
|
||||
cd - >/dev/null
|
||||
|
||||
if test $EQUAL = true -o \( $UPD_TIME -le $PCK_TIME \) ; then
|
||||
DEF_VER=${DEF_VERSION#*/}
|
||||
if test "$DEF_VER" = "?" ; then
|
||||
DEF_VER=0
|
||||
fi
|
||||
PCK_VER=${PCK_VERSION#*/}
|
||||
if test "$PCK_VER" = "?" ; then
|
||||
PCK_VER=0
|
||||
fi
|
||||
|
||||
UPD_VER=${UPD_VERSION#*/}
|
||||
if test $EQUAL = true -o \( $UPD_VER -le $DEF_VER \) ; then
|
||||
echo "No drivedb.h update available."
|
||||
if test -f smartmontools-drivedb.h ; then
|
||||
osc rm --force smartmontools-drivedb.h
|
||||
|
||||
860
smartmontools-update-smart-drivedb.patch
Normal file
860
smartmontools-update-smart-drivedb.patch
Normal file
@@ -0,0 +1,860 @@
|
||||
Index: smartmontools-7.5/configure.ac
|
||||
===================================================================
|
||||
--- smartmontools-7.5.orig/configure.ac
|
||||
+++ smartmontools-7.5/configure.ac
|
||||
@@ -733,12 +733,8 @@ AC_SUBST([os_nisdomainname])
|
||||
AC_SUBST([os_man_filter])
|
||||
AC_SUBST([os_win32_manifest])
|
||||
|
||||
-# Create drivedb.h update branch name from version: 5.41[.X] -> RELEASE_5_41_DRIVEDB
|
||||
-DRIVEDB_BRANCH=`echo "$drivedb_version" | sed 's,^\([[0-9]]*\.[[0-9]]*\)\..*$,\1,' \
|
||||
- | sed -n 's,^\([[0-9]][[0-9]]*\)\.\([[0-9]][[0-9]]*\)$,RELEASE_\1_\2_DRIVEDB,p'`
|
||||
-if test -z "$DRIVEDB_BRANCH"; then
|
||||
- AC_MSG_ERROR([Unable to create DRIVEDB_BRANCH for version: $drivedb_version])
|
||||
-fi
|
||||
+# drivedb.h update branch
|
||||
+DRIVEDB_BRANCH=$smartmontools_drivedb_version
|
||||
AC_SUBST([DRIVEDB_BRANCH])
|
||||
|
||||
# Enable platform-specific makefile sections
|
||||
Index: smartmontools-7.5/configure
|
||||
===================================================================
|
||||
--- smartmontools-7.5.orig/configure
|
||||
+++ smartmontools-7.5/configure
|
||||
@@ -7813,12 +7813,8 @@ fi
|
||||
|
||||
|
||||
|
||||
-# Create drivedb.h update branch name from version: 5.41[.X] -> RELEASE_5_41_DRIVEDB
|
||||
-DRIVEDB_BRANCH=`echo "$drivedb_version" | sed 's,^\([0-9]*\.[0-9]*\)\..*$,\1,' \
|
||||
- | sed -n 's,^\([0-9][0-9]*\)\.\([0-9][0-9]*\)$,RELEASE_\1_\2_DRIVEDB,p'`
|
||||
-if test -z "$DRIVEDB_BRANCH"; then
|
||||
- as_fn_error $? "Unable to create DRIVEDB_BRANCH for version: $drivedb_version" "$LINENO" 5
|
||||
-fi
|
||||
+# drivedb.h update branch
|
||||
+DRIVEDB_BRANCH=$smartmontools_drivedb_version
|
||||
|
||||
|
||||
# Enable platform-specific makefile sections
|
||||
Index: smartmontools-7.5/update-smart-drivedb.in
|
||||
===================================================================
|
||||
--- smartmontools-7.5.orig/update-smart-drivedb.in
|
||||
+++ smartmontools-7.5/update-smart-drivedb.in
|
||||
@@ -4,12 +4,10 @@
|
||||
#
|
||||
# Home page of code is: https://www.smartmontools.org
|
||||
#
|
||||
-# Copyright (C) 2010-22 Christian Franke
|
||||
+# Copyright (C) 2010-25 Christian Franke
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
#
|
||||
-# $Id: update-smart-drivedb.in 5699 2025-04-25 14:45:35Z chrfranke $
|
||||
-#
|
||||
|
||||
set -e
|
||||
|
||||
@@ -22,6 +20,7 @@ exec_prefix="@exec_prefix@"
|
||||
sbindir="@sbindir@"
|
||||
datarootdir="@datarootdir@"
|
||||
datadir="@datadir@"
|
||||
+# shellcheck disable=SC2034
|
||||
localstatedir="@localstatedir@"
|
||||
drivedbinstdir="@drivedbinstdir@"
|
||||
drivedbdir="@drivedbdir@"
|
||||
@@ -64,10 +63,8 @@ Usage: $myname [OPTIONS] [DESTFILE]
|
||||
[default: first one found in $pathinfo]
|
||||
-u, --url-of LOCATION
|
||||
Use URL of LOCATION for download:
|
||||
- github (GitHub mirror of SVN repository)
|
||||
- sf (Sourceforge code browser)
|
||||
- svn (SVN repository) [default]
|
||||
- svni (SVN repository via HTTP instead of HTTPS)
|
||||
+ github (upstream git repository) [default]
|
||||
+ svn (previous SVN repository)
|
||||
trac (Trac code browser)
|
||||
--url URL Download from URL
|
||||
--file FILE Copy from local FILE
|
||||
@@ -78,8 +75,8 @@ EOF
|
||||
'--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
|
||||
+ --main Download from main branch (requires '--no-verify')
|
||||
+ --branch X.Y Download from branch X.Y
|
||||
--cacert FILE Use CA certificates from FILE to verify the peer
|
||||
--capath DIR Use CA certificate files from DIR to verify the peer
|
||||
--insecure Don't abort download if certificate verification fails
|
||||
@@ -92,8 +89,8 @@ EOF
|
||||
-h, --help Print this help text
|
||||
|
||||
Updates $default_drivedb
|
||||
-or DESTFILE from branches/$default_branch of smartmontools
|
||||
-SVN repository.
|
||||
+or DESTFILE from branch 'drivedb/$default_branch' of smartmontools git
|
||||
+repository.
|
||||
EOF
|
||||
}
|
||||
|
||||
@@ -127,15 +124,12 @@ warning()
|
||||
selecturl()
|
||||
{
|
||||
case $1 in
|
||||
- github) # https://github.com/smartmontools/smartmontools/raw/origin/$branch/smartmontools/drivedb.h
|
||||
- # https://github.com/smartmontools/smartmontools/raw/master/smartmontools/drivedb.h
|
||||
- # redirected to:
|
||||
- url='https://raw.githubusercontent.com/smartmontools/smartmontools/master/smartmontools/drivedb.h' ;;
|
||||
- sf) url='https://sourceforge.net/p/smartmontools/code/HEAD/tree/trunk/smartmontools/drivedb.h?format=raw' ;;
|
||||
- svn) url='https://svn.code.sf.net/p/smartmontools/code/trunk/smartmontools/drivedb.h' ;;
|
||||
- svni) url='http://svn.code.sf.net/p/smartmontools/code/trunk/smartmontools/drivedb.h' ;;
|
||||
- trac) url='https://www.smartmontools.org/export/HEAD/trunk/smartmontools/drivedb.h' ;;
|
||||
- *) error "$1: is none of 'github sf svn svni trac'"
|
||||
+ github) # https://github.com/smartmontools/smartmontools/raw/refs/heads/main/src/drivedb.h
|
||||
+ # redirected to:
|
||||
+ url='https://raw.githubusercontent.com/smartmontools/smartmontools/refs/heads/main/src/drivedb.h' ;;
|
||||
+ svn) url='https://svn.code.sf.net/p/smartmontools/code/trunk/smartmontools/drivedb.h' ;;
|
||||
+ trac) url='https://www.smartmontools.org/browser/src/drivedb.h?format=raw&rev=main' ;;
|
||||
+ *) error "$1: is none of 'github svn trac'"
|
||||
esac
|
||||
}
|
||||
|
||||
@@ -197,6 +191,17 @@ vrun2()
|
||||
return $rc
|
||||
}
|
||||
|
||||
+# rm_f FILE...
|
||||
+rm_f()
|
||||
+{
|
||||
+ while [ $# -ne 0 ]; do
|
||||
+ if [ -f "$1" ]; then
|
||||
+ vrun rm -f "$1"
|
||||
+ fi
|
||||
+ shift
|
||||
+ done
|
||||
+}
|
||||
+
|
||||
# download URL FILE
|
||||
download()
|
||||
{
|
||||
@@ -231,15 +236,6 @@ download()
|
||||
vrun2 "$f" "$tool" -stderr -noredir -source "$u" || rc=$?
|
||||
;;
|
||||
|
||||
- svn*)
|
||||
- vrun "$tool" $q export \
|
||||
- --non-interactive --no-auth-cache \
|
||||
- ${cacert:+--config-option "servers:global:ssl-trust-default-ca=no"} \
|
||||
- ${cacert:+--config-option "servers:global:ssl-authority-files=$cacert"} \
|
||||
- ${insecure:+--trust-server-cert} \
|
||||
- "$u" "$f" || rc=$?
|
||||
- ;;
|
||||
-
|
||||
fetch*) # FreeBSD
|
||||
vrun "$tool" $q --no-redirect \
|
||||
${cacert:+--ca-cert "$cacert"} \
|
||||
@@ -288,115 +284,11 @@ check_file()
|
||||
return 0
|
||||
}
|
||||
|
||||
-# unexpand_svn_id < INFILE > OUTFILE
|
||||
-unexpand_svn_id()
|
||||
-{
|
||||
- sed 's,\$''Id'': drivedb\.h [0-9][0-9]* 2[-0-9]* [012][:0-9]*Z [a-z][a-z0-9]* \$,$''Id''$,'
|
||||
-}
|
||||
-
|
||||
# selectkey BRANCH
|
||||
selectkey()
|
||||
{
|
||||
case $1 in
|
||||
- RELEASE_5_4[0-3]_DRIVEDB|RELEASE_6_[0-6]_DRIVEDB)
|
||||
-# Smartmontools Signing Key (ext. to 2024) <smartmontools-database@listi.jpberlin.de>
|
||||
-# Smartmontools Signing Key (through 2018) <smartmontools-database@listi.jpberlin.de>
|
||||
-# Smartmontools Signing Key (through 2018) <smartmontools-database@lists.sourceforge.net>
|
||||
-# Key ID DFD22559
|
||||
-public_key="\
|
||||
------BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
-
|
||||
-mQENBFgOYoEBCAC93841SlFmpp6640hKUvZ8PbZR6OGnZnMXD6QRVzpibXGZXUDB
|
||||
-f6unujun5Ql4ObAWt6QuRqz5Gk2gF8tcOfN6edR/uK5gyX2rlWVLoZKOV91a3aDI
|
||||
-iIDh018tLWOpHg3VxgHL6f0iMcFogUYnD5zhC5Z2GVhFb/cVpj+ocZWcxQLQGPVv
|
||||
-uZPUQWrvdpFEzcnxPMtJJDqXEChzhrdFTXGm69ERxULOro7yDmG1Y5xWmhdGnPPM
|
||||
-cuCXVVlADz/Gh1w+ay7RqFnzPjqjQmHAuggns467TJEcS0yiX4LJnEoKLyPG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aqz23SGTt
|
||||
-uNuw6EyrcHo7Dy1311GftshI6arsFNJxE2ZNGIfGocRxu9m3Ez+AysWT9sxz/haH
|
||||
-E+d58NTg+/7R8YWS1q+Tk6m8dA0Xyf3tMBsIJfj0zJvuGMbCLmd93Yw4nk76qtSn
|
||||
-9UHbnf76UJN5SctAd8+gK3uO6O4XDcZqC06xkWKl193lzcC8sZJBdI15NszC3y/e
|
||||
-pnILDDMBUNQMBm/XlCYQUetyrJnAVzFGXurtjEXQ/DDnbfy2Z8efoG8rtq7v3fxS
|
||||
-1TC5jSVOIEqOE4TwzRz1Y/dfqSU=
|
||||
-=3Lcg
|
||||
------END PGP PUBLIC KEY BLOCK-----
|
||||
-"
|
||||
- ;;
|
||||
-
|
||||
- RELEASE_7_[0235]_DRIVEDB)
|
||||
+ 7.[0235])
|
||||
# Smartmontools Signing Key (through 2025) <smartmontools-database@listi.jpberlin.de>
|
||||
# Smartmontools Signing Key (through 2020) <smartmontools-database@listi.jpberlin.de>
|
||||
# Key ID 721042C5
|
||||
@@ -488,7 +380,7 @@ Q/qvYlwkbKOdlahjoHrFlkhADSBaO9N1OZp3OYDj
|
||||
"
|
||||
;;
|
||||
|
||||
- *) error "No known public key for branches/$1" ;;
|
||||
+ *) error "No known public key for branch '$1'" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
@@ -542,31 +434,36 @@ gpg_verify()
|
||||
# get_db_version DRIVEDB > VERSION
|
||||
get_db_version()
|
||||
{
|
||||
- local r v x
|
||||
- x=`sed -n '/^[ {]*"VERSION: *[^"]*"/{
|
||||
- s,^[ {]*"VERSION: \([1-9][./0-9]* [^"]*\)".*$,\1,p
|
||||
+ local v
|
||||
+ v=`sed -n '/^[ {]*"VERSION: .*"/{
|
||||
+ s,^[ {]*"VERSION: \([1-9][./0-9]*\)[ "].*$,\1,p
|
||||
q
|
||||
}' "$1"` || return 1
|
||||
- v=${x%% *}
|
||||
test -n "$v" || return 0
|
||||
- if [ "${v%/*}" = "$v" ]; then # trunk: get rev from expanded SVN-Id
|
||||
- r=`echo "$x" | sed -n 's,^[^$]*\$''Id: drivedb\.h \([1-9][0-9]*\) .*$,\1,p'`
|
||||
- test -n "$r" || r="?"
|
||||
- v="$v/$r"
|
||||
- fi
|
||||
+ test "${v%/*}" != "$v" || v="$v/?"
|
||||
echo "$v"
|
||||
}
|
||||
|
||||
-# mv_all PREFIX OLD NEW
|
||||
-mv_all()
|
||||
+# drivedb_mv OLD NEW
|
||||
+drivedb_mv()
|
||||
{
|
||||
- mv -f "${1}${2}" "${1}${3}" && \
|
||||
- mv -f "${1}${2}.raw" "${1}${3}.raw" && \
|
||||
- if [ -f "${1}${2}.raw.asc" ]; then
|
||||
- mv -f "${1}${2}.raw.asc" "${1}${3}.raw.asc"
|
||||
- else
|
||||
- rm -f "${1}${3}.raw.asc"
|
||||
- fi
|
||||
+ local ext nf of
|
||||
+ for ext in "" ".asc" ".raw" ".raw.asc"; do
|
||||
+ of="${drivedb}${1}${ext}"
|
||||
+ nf="${drivedb}${2}${ext}"
|
||||
+ if [ -f "$of" ]; then
|
||||
+ vrun mv -f "$of" "$nf"
|
||||
+ else
|
||||
+ rm_f "$nf"
|
||||
+ fi
|
||||
+ done
|
||||
+}
|
||||
+
|
||||
+# drivedb_error "MESSAGE"
|
||||
+drivedb_error()
|
||||
+{
|
||||
+ drivedb_mv ".new" ".error"
|
||||
+ error "${drivedb}.error${1}"
|
||||
}
|
||||
|
||||
# Parse options
|
||||
@@ -578,7 +475,7 @@ file=
|
||||
quiet=
|
||||
q="-q"
|
||||
dryrun=
|
||||
-trunk=
|
||||
+main=
|
||||
branch=$default_branch
|
||||
cacert=
|
||||
capath=
|
||||
@@ -624,13 +521,16 @@ while true; do case $1 in
|
||||
--dryrun)
|
||||
dryrun=t ;;
|
||||
|
||||
- --trunk)
|
||||
- trunk=t ;;
|
||||
+ --main)
|
||||
+ main=t ;;
|
||||
|
||||
--branch)
|
||||
check_optarg "$@"; shift
|
||||
- branch=`echo "$1" | sed -n 's,^\([567]\)\.\([0-9][0-9]*\)$,RELEASE_\1_\2_DRIVEDB,p'`
|
||||
- test -n "$branch" || error "invalid branch version '$1'" ;;
|
||||
+ branch=$1
|
||||
+ case $branch in
|
||||
+ 5.4[0-3]|6.[0-6]|7.[0235]) ;;
|
||||
+ *) error "invalid branch '$branch'" ;;
|
||||
+ esac ;;
|
||||
|
||||
--cacert)
|
||||
check_optarg "$@"; shift
|
||||
@@ -680,14 +580,26 @@ esac
|
||||
# Check selected source
|
||||
case "${url_of:+url_of}${url:+url}${file:+file}" in
|
||||
''|url_of)
|
||||
- test -n "$url_of" || url_of=svn
|
||||
+ test -n "$url_of" || url_of=github
|
||||
selecturl "$url_of"
|
||||
- if [ -z "$trunk" ]; then # select branch
|
||||
- url=`echo "$url" | sed -e "s,/trunk/,/branches/$branch/," \
|
||||
- -e "s,/master/,/origin/$branch/,"`
|
||||
- elif [ -z "$no_verify" ]; then
|
||||
- error "'--trunk' requires '--no-verify'"
|
||||
- fi ;;
|
||||
+ case $url in
|
||||
+ */main/*|*rev=main*)
|
||||
+ if [ -z "$main" ]; then
|
||||
+ url=`echo "$url" | sed -e "s,/main/,/drivedb/$branch/," \
|
||||
+ -e "s,rev=main,rev=drivedb/$branch,"`
|
||||
+ case $branch in
|
||||
+ [567].*) url=`echo "$url" | sed -e 's,/src/,/smartmontools/,'` ;;
|
||||
+ esac
|
||||
+ elif [ -z "$no_verify" ]; then
|
||||
+ error "'--main' requires '--no-verify'"
|
||||
+ fi
|
||||
+ ;;
|
||||
+ */trunk/*)
|
||||
+ test -z "$main" || error "'--main' is not supported with '-u svn'"
|
||||
+ url=`echo "$url" | sed -e "s,/trunk/,/branches/RELEASE_${branch}_DRIVEDB/," \
|
||||
+ -e 's,_\([0-9]*\)\.\([0-9]*\)_,_\1_\2_,'`;;
|
||||
+ *) error "$url: invalid URL (internal)" ;;
|
||||
+ esac ;;
|
||||
url)
|
||||
test -z "`echo "$url" | sed -e 's,^[a-z][a-z0-9]*:[^ ][^ ]*$,,'`" \
|
||||
|| error "$url: Invalid URL" ;;
|
||||
@@ -697,12 +609,23 @@ esac
|
||||
|
||||
# Determine path of signature file
|
||||
file_asc=
|
||||
+file_raw_asc=
|
||||
url_asc=
|
||||
-if [ -z "$no_verify" ]; then case $url in
|
||||
- '') file_asc="$file.raw.asc" ;;
|
||||
- *\?*) url_asc=`echo "$url" | sed 's,?,.raw.asc?,'` ;;
|
||||
- *) url_asc="$url.raw.asc" ;;
|
||||
-esac; fi
|
||||
+if [ -z "$no_verify" ]; then
|
||||
+ if [ -n "$url" ]; then
|
||||
+ case $branch in
|
||||
+ [567].*) raw=".raw" ;;
|
||||
+ *) raw= ;;
|
||||
+ esac
|
||||
+ case $url in
|
||||
+ *\?*) url_asc=`echo "$url" | sed "s,?,$raw.asc?,"` ;;
|
||||
+ *) url_asc="$url$raw.asc" ;;
|
||||
+ esac
|
||||
+ else
|
||||
+ file_asc="$file.asc"
|
||||
+ file_raw_asc="$file.raw.asc"
|
||||
+ fi
|
||||
+fi
|
||||
|
||||
if [ -z "$file" ]; then
|
||||
if [ -z "$tool" ]; then
|
||||
@@ -727,17 +650,6 @@ if [ -z "$file" ]; then
|
||||
fi
|
||||
|
||||
# Check option compatibility
|
||||
-case "$tool:$url_of" in
|
||||
- svn:svn*) ;;
|
||||
- svn:*) error "'-t svn' requires '-u svn' or '-u svni'" ;;
|
||||
-esac
|
||||
-case "$tool:${capath:+set}" in
|
||||
- svn:set) warning "'--capath' is ignored if '-t svn' is used" ;;
|
||||
-esac
|
||||
-case "$url_of:$insecure" in
|
||||
- svni:t) insecure= ;;
|
||||
- svni:*) error "'-u svni' requires '--insecure'" ;;
|
||||
-esac
|
||||
case "$tool:$insecure" in
|
||||
lynx:t) warning "'--insecure' is ignored if '-t lynx' is used" ;;
|
||||
esac
|
||||
@@ -768,7 +680,7 @@ usageerr=
|
||||
tmpdir=`dirname "$drivedb"`
|
||||
|
||||
# Remove possible garbage from last download
|
||||
-test -n "$dryrun" || rm -f "$drivedb.new" "$drivedb.new.raw" "$drivedb.new.raw.asc" || exit 1
|
||||
+rm_f "$drivedb.new" "$drivedb.new.asc" "$drivedb.new.raw" "$drivedb.new.raw.asc" || exit 1
|
||||
|
||||
if [ -n "$url" ]; then
|
||||
# Download
|
||||
@@ -776,17 +688,17 @@ if [ -n "$url" ]; then
|
||||
rc=0
|
||||
download "$url" "$drivedb.new" || rc=$?
|
||||
if [ $rc != 0 ]; then
|
||||
- rm -f "$drivedb.new"
|
||||
+ rm_f "$drivedb.new"
|
||||
error "drivedb.h: download failed ($tool: exit $rc)"
|
||||
fi
|
||||
|
||||
if [ -n "$url_asc" ]; then
|
||||
- vecho "Download drivedb.h.raw.asc with $tool"
|
||||
+ vecho "Download drivedb.h.asc with $tool"
|
||||
rc=0
|
||||
- download "$url_asc" "$drivedb.new.raw.asc" || rc=$?
|
||||
+ download "$url_asc" "$drivedb.new.asc" || rc=$?
|
||||
if [ $rc != 0 ]; then
|
||||
- rm -f "$drivedb.new" "$drivedb.new.raw.asc"
|
||||
- error "drivedb.h.raw.asc: download failed ($tool: exit $rc) ('--no-verify' to ignore)"
|
||||
+ rm_f "$drivedb.new" "$drivedb.new.asc"
|
||||
+ error "drivedb.h.asc: download failed ($tool: exit $rc) ('--no-verify' to ignore)"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
@@ -794,16 +706,20 @@ else
|
||||
if [ ! -f "$file" ]; then
|
||||
error "$file: file not found"
|
||||
fi
|
||||
- if [ -n "$file_asc" ] && [ ! -f "$file_asc" ]; then
|
||||
- error "$file_asc: file not found ('--no-verify' to ignore)"
|
||||
+ if [ -n "$file_asc" ]; then
|
||||
+ if [ ! -f "$file_asc" ]; then
|
||||
+ test -f "$file_raw_asc" \
|
||||
+ || error "$file_asc, $file_raw_asc: file not found ('--no-verify' to ignore)"
|
||||
+ file_asc=$file_raw_asc
|
||||
+ fi
|
||||
fi
|
||||
|
||||
if ! vrun cp "$file" "$drivedb.new"; then
|
||||
error "$file: copy failed"
|
||||
fi
|
||||
if [ -n "$file_asc" ]; then
|
||||
- if ! vrun cp "$file_asc" "$drivedb.new.raw.asc"; then
|
||||
- rm -f "$drivedb.new"
|
||||
+ if ! vrun cp "$file_asc" "$drivedb.new.asc"; then
|
||||
+ rm_f "$drivedb.new"
|
||||
error "$file_asc: copy failed"
|
||||
fi
|
||||
fi
|
||||
@@ -812,96 +728,65 @@ fi
|
||||
test -z "$dryrun" || exit 0
|
||||
|
||||
# Check files, adjust timestamps and permissions
|
||||
-if ! errmsg=`check_file "$drivedb.new" '/' 10000 1000000`; then
|
||||
- rm -f "$drivedb.new.raw.asc"
|
||||
- mv -f "$drivedb.new" "$drivedb.error"
|
||||
- error "$drivedb.error: $errmsg"
|
||||
-fi
|
||||
+errmsg=`check_file "$drivedb.new" '/' 10000 1000000` \
|
||||
+|| drivedb_error ": $errmsg"
|
||||
touch "$drivedb.new"
|
||||
chmod 0644 "$drivedb.new"
|
||||
|
||||
-if [ -f "$drivedb.new.raw.asc" ]; then
|
||||
- if ! errmsg=`check_file "$drivedb.new.raw.asc" '-' 200 2000`; then
|
||||
- rm -f "$drivedb.new"
|
||||
- mv -f "$drivedb.new.raw.asc" "$drivedb.error.raw.asc"
|
||||
- error "$drivedb.error.raw.asc: $errmsg"
|
||||
- fi
|
||||
- touch "$drivedb.new.raw.asc"
|
||||
- chmod 0644 "$drivedb.new.raw.asc"
|
||||
+if [ -f "$drivedb.new.asc" ]; then
|
||||
+ errmsg=`check_file "$drivedb.new.asc" '-' 200 2000` \
|
||||
+ || drivedb_error ".asc: $errmsg"
|
||||
+ touch "$drivedb.new.asc"
|
||||
+ chmod 0644 "$drivedb.new.asc"
|
||||
fi
|
||||
|
||||
-# Create raw file with unexpanded SVN Id
|
||||
-# (This assumes newlines are LF and not CR/LF)
|
||||
-unexpand_svn_id < "$drivedb.new" > "$drivedb.new.raw"
|
||||
-chmod 0644 "$drivedb.new.raw"
|
||||
-
|
||||
# Check whether installed file is identical
|
||||
-equal=
|
||||
-if [ -f "$drivedb" ]; then
|
||||
- if [ ! -f "$drivedb.raw" ]; then
|
||||
- # Create missing raw file
|
||||
- unexpand_svn_id < "$drivedb" > "$drivedb.raw"
|
||||
- chmod 0644 "$drivedb.raw"
|
||||
- fi
|
||||
- # Ignore missing Id keyword expansion in new file
|
||||
- if cmp "$drivedb.raw" "$drivedb.new.raw" >/dev/null 2>&1 \
|
||||
- && { cmp "$drivedb" "$drivedb.new" >/dev/null 2>&1 \
|
||||
- || cmp "$drivedb.raw" "$drivedb.new" >/dev/null 2>&1; }
|
||||
- then
|
||||
- equal=t
|
||||
- fi
|
||||
-fi
|
||||
+equal=t
|
||||
+cmp "$drivedb" "$drivedb.new" >/dev/null 2>&1 || equal=
|
||||
|
||||
if [ -z "$no_verify" ]; then
|
||||
- # Verify raw file
|
||||
- if ! gpg_verify "$drivedb.new.raw.asc" "$drivedb.new.raw"; then
|
||||
- mv_all "$drivedb" ".new" ".error"
|
||||
+ # Verify new file
|
||||
+ if ! gpg_verify "$drivedb.new.asc" "$drivedb.new"; then
|
||||
test -z "$equal" \
|
||||
|| warning "$drivedb: *** installed file is identical to broken new file ***"
|
||||
- error "$drivedb.error.raw: *** BAD signature or outdated key ***"
|
||||
+ drivedb_error ": *** BAD signature or outdated key ***"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Get version
|
||||
newver=`get_db_version "$drivedb.new"`
|
||||
if [ -z "$newver" ]; then
|
||||
- if [ -z "$force" ]; then
|
||||
- mv_all "$drivedb" ".new" ".error"
|
||||
- error "$drivedb.error: no VERSION information found ('--force' to ignore)"
|
||||
- fi
|
||||
+ test -n "$force" \
|
||||
+ || drivedb_error ": no VERSION information found ('--force' to ignore)"
|
||||
newver="?/?"
|
||||
elif [ "${newver##*/}" = "?" ]; then
|
||||
- if [ -z "$trunk" ]; then
|
||||
- mv_all "$drivedb" ".new" ".error"
|
||||
- error "$drivedb.error: VERSION information is incomplete ('--trunk' to ignore)"
|
||||
- fi
|
||||
+ test -n "$main" \
|
||||
+ || drivedb_error ": VERSION information is incomplete ('--main' to ignore)"
|
||||
fi
|
||||
|
||||
if [ "$smartctl" != "-" ]; then
|
||||
# Check syntax
|
||||
- if ! "$smartctl" -B "$drivedb.new" -P showall >/dev/null; then
|
||||
- mv_all "$drivedb" ".new" ".error"
|
||||
- error "$drivedb.error: rejected by $smartctl, probably no longer compatible"
|
||||
- fi
|
||||
+ "$smartctl" -B "$drivedb.new" -P showall >/dev/null \
|
||||
+ || drivedb_error ": rejected by $smartctl, probably no longer compatible"
|
||||
vecho "$smartctl: syntax OK"
|
||||
fi
|
||||
|
||||
# Always install if missing
|
||||
rm -f "$drivedb.lastcheck"
|
||||
if [ ! -f "$drivedb" ]; then
|
||||
- mv_all "$drivedb" ".new" ""
|
||||
+ drivedb_mv ".new" ""
|
||||
iecho "$drivedb $newver newly installed${no_verify:+ (NOT VERIFIED)}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Keep old file if identical
|
||||
if [ -n "$equal" ]; then
|
||||
- if [ -f "$drivedb.new.raw.asc" ] \
|
||||
- && ! cmp "$drivedb.new.raw.asc" "$drivedb.raw.asc" >/dev/null 2>&1; then
|
||||
- mv -f "$drivedb.new.raw.asc" "$drivedb.raw.asc"
|
||||
- iecho "$drivedb.raw.asc $newver updated"
|
||||
+ if [ -f "$drivedb.new.asc" ] \
|
||||
+ && ! cmp "$drivedb.new.asc" "$drivedb.asc" >/dev/null 2>&1; then
|
||||
+ vrun mv -f "$drivedb.new.asc" "$drivedb.asc"
|
||||
+ iecho "$drivedb.asc $newver updated"
|
||||
fi
|
||||
- rm -f "$drivedb.new" "$drivedb.new.raw" "$drivedb.new.raw.asc"
|
||||
+ rm_f "$drivedb.new" "$drivedb.new.asc" "$drivedb.raw" "$drivedb.raw.asc"
|
||||
touch "$drivedb.lastcheck"
|
||||
iecho "$drivedb $newver is already up to date${no_verify:+ (NOT VERIFIED)}"
|
||||
exit 0
|
||||
@@ -913,12 +798,12 @@ test -n "$oldver" || oldver="?/?"
|
||||
if [ "${newver##*/}" = "?" ] \
|
||||
|| [ "${oldver##*/}" = "?" ] \
|
||||
|| [ "${newver%/*}" != "${oldver%/*}" ]; then
|
||||
- # Always install from trunk or other branch
|
||||
+ # Always install if from main or other branch
|
||||
updmsg="replaced with"
|
||||
elif [ "${newver##*/}" -lt "${oldver##*/}" ]; then
|
||||
# Install older file only if '--force' is used
|
||||
if [ -z "$force" ]; then
|
||||
- rm -f "$drivedb.new" "$drivedb.new.raw" "$drivedb.new.raw.asc"
|
||||
+ rm_f "$drivedb.new" "$drivedb.new.asc"
|
||||
iecho "$drivedb $oldver not downgraded to $newver ('--force' to override)"
|
||||
exit 0
|
||||
fi
|
||||
@@ -927,6 +812,6 @@ else
|
||||
updmsg="updated to"
|
||||
fi
|
||||
|
||||
-mv_all "$drivedb" "" ".old"
|
||||
-mv_all "$drivedb" ".new" ""
|
||||
+drivedb_mv "" ".old"
|
||||
+drivedb_mv ".new" ""
|
||||
iecho "$drivedb $oldver $updmsg $newver${no_verify:+ (NOT VERIFIED)}"
|
||||
Index: smartmontools-7.5/update-smart-drivedb.8.in
|
||||
===================================================================
|
||||
--- smartmontools-7.5.orig/update-smart-drivedb.8.in
|
||||
+++ smartmontools-7.5/update-smart-drivedb.8.in
|
||||
@@ -1,11 +1,9 @@
|
||||
.ig
|
||||
Copyright (C) 2013 Hannes von Haugwitz <hannes@vonhaugwitz.com>
|
||||
-Copyright (C) 2014-23 Christian Franke
|
||||
+Copyright (C) 2014-25 Christian Franke
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
-$Id: update-smart-drivedb.8.in 5605 2024-03-29 17:12:50Z chrfranke $
|
||||
-
|
||||
..
|
||||
.\" Macros borrowed from pages generated with Pod::Man
|
||||
.de Sp \" Vertical space (when we can't use .PP)
|
||||
@@ -25,7 +23,7 @@ $Id: update-smart-drivedb.8.in 5605 2024
|
||||
.\" Use groff extension \(aq (apostrophe quote, ASCII 0x27) if possible
|
||||
.ie \n(.g .ds Aq \(aq
|
||||
.el .ds Aq '
|
||||
-.TH UPDATE-SMART-DRIVEDB 8 "CURRENT_SVN_DATE" "CURRENT_SVN_VERSION" "SMART Monitoring Tools"
|
||||
+.TH UPDATE-SMART-DRIVEDB 8 "@SMARTMONTOOLS_GIT_REV_DATE@" "smartmontools-@SMARTMONTOOLS_GIT_VER_DESC@" "SMART Monitoring Tools"
|
||||
.SH NAME
|
||||
update-smart-drivedb \- update smartmontools drive database
|
||||
.Sp
|
||||
@@ -40,17 +38,20 @@ update-smart-drivedb \- update smartmont
|
||||
.\"! It does not contain info specific to other platforms.]
|
||||
.\"! .PP
|
||||
.\" %ENDIF NOT OS ALL
|
||||
+.PP
|
||||
+[NEW EXPERIMENTAL UPDATE-SMART-DRIVEDB 8.0 CHANGE]
|
||||
+This tool has been considerably modified due to the move of smartmontools
|
||||
+from SourceForge SVN to GitHub.
|
||||
+.PP
|
||||
.B update-smart-drivedb
|
||||
updates
|
||||
.B /usr/local/var/lib/smartmontools/drivedb.h
|
||||
or
|
||||
.I DESTFILE
|
||||
-from branches/RELEASE_6_0_DRIVEDB of smartmontools SVN repository.
|
||||
-.PP
|
||||
+from branch 'drivedb/7.5' of smartmontools git repository.
|
||||
The tools used for downloading are either
|
||||
.BR curl (1),
|
||||
.BR wget (1),
|
||||
-.BR lynx (1),
|
||||
.\" %IF OS FreeBSD
|
||||
.BR fetch (1)
|
||||
[FreeBSD only],
|
||||
@@ -60,13 +61,13 @@ The tools used for downloading are eithe
|
||||
[OpenBSD only],
|
||||
.\" %ENDIF OS OpenBSD
|
||||
or
|
||||
-.BR svn (1).
|
||||
+.BR lynx (1).
|
||||
.PP
|
||||
The downloaded file is verified with OpenPGP/GPG key ID 721042C5.
|
||||
The public key block is included in the script.
|
||||
.PP
|
||||
-The old file is kept if the downloaded file is identical (ignoring
|
||||
-the differences in Id string) otherwise it is moved to
|
||||
+The old file is kept if the downloaded file is identical, otherwise it is
|
||||
+moved to
|
||||
.BR drivedb.h.old .
|
||||
.PP
|
||||
The old file is also kept if the downloaded file reports an older version
|
||||
@@ -87,14 +88,14 @@ The default is
|
||||
.B \-t [DIR/]TOOL, \-\-tool [DIR/]TOOL
|
||||
Use TOOL for download.
|
||||
TOOL is one of:
|
||||
-.I curl wget lynx
|
||||
+.I curl wget
|
||||
.\" %IF OS FreeBSD
|
||||
.I fetch
|
||||
.\" %ENDIF OS FreeBSD
|
||||
.\" %IF OS OpenBSD
|
||||
.I ftp
|
||||
.\" %ENDIF OS OpenBSD
|
||||
-.IR svn .
|
||||
+.IR lynx .
|
||||
The default is the first one found in PATH.
|
||||
If a DIR is also specified, the plain TOOL name must begin with any of the
|
||||
above names.
|
||||
@@ -104,31 +105,25 @@ Use URL of LOCATION for download.
|
||||
LOCATION is one of:
|
||||
.br
|
||||
.I github
|
||||
-(GitHub mirror of SVN repository),
|
||||
-.br
|
||||
-.I sf
|
||||
-(Sourceforge code browser),
|
||||
+(upstream git repository),
|
||||
.br
|
||||
.I svn
|
||||
-(SVN repository),
|
||||
-.br
|
||||
-.I svni
|
||||
-(SVN repository via HTTP instead of HTTPS),
|
||||
+(previous SVN repository),
|
||||
.br
|
||||
.I trac
|
||||
(Trac code browser).
|
||||
.br
|
||||
The default is
|
||||
-.IR svn .
|
||||
+.IR github .
|
||||
.TP
|
||||
.B \-\-url URL
|
||||
Download from URL.
|
||||
-A valid OpenPGP/GPG signature with \*(Aq.raw.asc\*(Aq extension must also
|
||||
+A valid OpenPGP/GPG signature with \*(Aq[.raw].asc\*(Aq extension must also
|
||||
exist unless \*(Aq\-\-no\-verify\*(Aq is also specified.
|
||||
.TP
|
||||
.B \-\-file FILE
|
||||
Copy from local FILE.
|
||||
-A valid OpenPGP/GPG signature \*(AqFILE.raw.asc\*(Aq must also exist
|
||||
+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
|
||||
@@ -139,15 +134,12 @@ This is the same as:
|
||||
\*(Aq\-\-no\-verify \-\-file /usr/local/share/smartmontools/drivedb.h\*(Aq
|
||||
.\" %ENDIF ENABLE_DB_INSTALL
|
||||
.TP
|
||||
-.B \-\-trunk
|
||||
-Download from SVN trunk.
|
||||
-This requires \*(Aq\-\-no\-verify\*(Aq because the trunk versions are not
|
||||
-signed.
|
||||
+.B \-\-main
|
||||
+Download from main branch.
|
||||
+This requires \*(Aq\-\-no\-verify\*(Aq because these versions are not signed.
|
||||
.TP
|
||||
.B \-\-branch X.Y
|
||||
-Download from branches/RELEASE_\fBX\fP_\fBY\fP_DRIVEDB.
|
||||
-This also selects the OpenPGP/GPG key for older branches
|
||||
-(5.40 to 6.6: Key ID DFD22559).
|
||||
+Download from branch X.Y.
|
||||
.TP
|
||||
.B \-\-cacert FILE
|
||||
Use CA certificates from FILE to verify the peer.
|
||||
@@ -157,8 +149,6 @@ Use CA certificate files from DIR to ver
|
||||
.TP
|
||||
.B \-\-insecure
|
||||
Don't abort download if certificate verification fails.
|
||||
-This option is also required if a HTTP URL is selected with \*(Aq\-u\*(Aq
|
||||
-option.
|
||||
.TP
|
||||
.B \-\-no\-verify
|
||||
Don't verify signature with GnuPG.
|
||||
@@ -187,20 +177,20 @@ Print help text.
|
||||
Regular update:
|
||||
.Vb 2
|
||||
# update-smart-drivedb
|
||||
-/usr/local/var/lib/smartmontools/drivedb.h 7.2/5225 updated to 7.2/5237
|
||||
+/usr/local/var/lib/smartmontools/drivedb.h 7.5/5701 updated to 7.5/5706
|
||||
.Ve
|
||||
.PP
|
||||
Revert to previous version:
|
||||
.Vb 2
|
||||
# update-smart-drivedb --force \e
|
||||
--file /usr/local/var/lib/smartmontools/drivedb.h.old
|
||||
-/usr/local/var/lib/smartmontools/drivedb.h 7.2/5237 downgraded to 7.2/5225
|
||||
+/usr/local/var/lib/smartmontools/drivedb.h 7.5/5706 downgraded to 7.5/5701
|
||||
.Ve
|
||||
.PP
|
||||
-Download the database from SVN trunk to current directory:
|
||||
+Download the database from main branch to current directory:
|
||||
.Vb 2
|
||||
-$ update-smart-drivedb --trunk --no-verify -s - -u trac drivedb-trunk.h
|
||||
-drivedb-trunk.h 7.3/5254 newly installed (NOT VERIFIED)
|
||||
+$ update-smart-drivedb --main --no-verify -s - -u trac drivedb-main.h
|
||||
+drivedb-main.h 7.5/? newly installed (NOT VERIFIED)
|
||||
.Ve
|
||||
.Sp
|
||||
.SH "EXIT STATUS"
|
||||
@@ -224,20 +214,20 @@ originally installed drive database.
|
||||
.B /usr/local/var/lib/smartmontools/drivedb.h
|
||||
current drive database.
|
||||
.TP
|
||||
-.B /usr/local/var/lib/smartmontools/drivedb.h.raw
|
||||
-current drive database with unexpanded SVN Id string.
|
||||
-.TP
|
||||
-.B /usr/local/var/lib/smartmontools/drivedb.h.raw.asc
|
||||
+.B /usr/local/var/lib/smartmontools/drivedb.h.asc
|
||||
signature file.
|
||||
.TP
|
||||
-.B /usr/local/var/lib/smartmontools/drivedb.h.*old*
|
||||
+.B /usr/local/var/lib/smartmontools/drivedb.h.old[.asc]
|
||||
previous files.
|
||||
.TP
|
||||
-.B /usr/local/var/lib/smartmontools/drivedb.h.*error*
|
||||
+.B /usr/local/var/lib/smartmontools/drivedb.h.error[.asc]
|
||||
new files if rejected due to errors.
|
||||
.TP
|
||||
.B /usr/local/var/lib/smartmontools/drivedb.h.lastcheck
|
||||
empty file created if downloaded file was identical.
|
||||
+.TP
|
||||
+.B /usr/local/var/lib/smartmontools/drivedb.h.raw[.asc]
|
||||
+no longer used and removed if still present.
|
||||
.Sp
|
||||
.SH AUTHORS
|
||||
\fBChristian Franke\fP.
|
||||
@@ -258,6 +248,4 @@ Alternatively send the info to the smart
|
||||
\fBsmartctl\fP(8), \fBsmartd\fP(8).
|
||||
.Sp
|
||||
.SH PACKAGE VERSION
|
||||
-CURRENT_SVN_VERSION CURRENT_SVN_DATE CURRENT_SVN_REV
|
||||
-.br
|
||||
-$Id: update-smart-drivedb.8.in 5605 2024-03-29 17:12:50Z chrfranke $
|
||||
+smartmontools-@SMARTMONTOOLS_GIT_VER_DESC@ @SMARTMONTOOLS_GIT_REV_DATE@ @SMARTMONTOOLS_GIT_REV@
|
||||
@@ -1,7 +1,22 @@
|
||||
-------------------------------------------------------------------
|
||||
Sat Nov 8 21:51:07 UTC 2025 - Stanislav Brabec <sbrabec@suse.com>
|
||||
|
||||
- update-smart-drivedb: Provide support for the new upstream
|
||||
GitHub repository. (smartmontools-update-smart-drivedb.patch,
|
||||
refactor smartmontools-drivedb_h-update.sh).
|
||||
- update-smart-drivedb: Do not overwrite files in /usr/share. Use
|
||||
/var/lib provided by --with-drivedbinstdir.
|
||||
- Add smartmontools-drivedb.h version 5894 from the branch 7.5.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Sep 24 10:14:42 UTC 2025 - Thorsten Kukuk <kukuk@suse.com>
|
||||
|
||||
- Drop rcsmartd symlink [jsc#PED-266]
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu May 1 10:09:20 UTC 2025 - ecsos <ecsos@opensuse.org>
|
||||
|
||||
- Update to 7.5
|
||||
- Update to 7.5 (jsc#PED-13806).
|
||||
* See NEWS and ChangeLog files for full details
|
||||
- Rebase smartd_service_dont_quit.patch
|
||||
- Rebase harden_smartd.service.patch
|
||||
@@ -45,7 +60,7 @@ Thu Feb 2 14:31:01 UTC 2023 - Hans-Peter Jansen <hpj@urpla.net>
|
||||
-------------------------------------------------------------------
|
||||
Thu Apr 21 11:48:36 UTC 2022 - Dirk Müller <dmueller@suse.com>
|
||||
|
||||
- refresh keyring with new signing key
|
||||
- refresh keyring with new signing key
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Apr 15 15:04:26 UTC 2022 - Stefan Seyfried <seife+obs@b1-systems.com>
|
||||
@@ -120,7 +135,7 @@ Wed Jan 6 12:10:43 UTC 2021 - Dirk Müller <dmueller@suse.com>
|
||||
- NetBSD: Fixed timeout handling.
|
||||
- NetBSD big endian: Fixed ATA register handling.
|
||||
- OpenBSD: Fixed timeout handling.
|
||||
- Windows: Dropped backward compatibility fixes for very old compilers.
|
||||
- Windows: Dropped backward compatibility fixes for very old compilers.
|
||||
- drop smartd-service-novm.patch (upstream)
|
||||
- drop smartmontools-smartd-service.patch
|
||||
(SLE+Leap, now in upstream, bsc#1183699)
|
||||
@@ -287,7 +302,7 @@ Mon Dec 18 04:03:10 UTC 2017 - avindra@opensuse.org
|
||||
-------------------------------------------------------------------
|
||||
Thu Nov 23 13:42:04 UTC 2017 - rbrown@suse.com
|
||||
|
||||
- Replace references to /var/adm/fillup-templates with new
|
||||
- Replace references to /var/adm/fillup-templates with new
|
||||
%_fillupdir macro (boo#1069468)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
@@ -306,7 +321,7 @@ Mon Dec 19 14:49:48 CET 2016 - sbrabec@suse.com
|
||||
https://lists.opensuse.org/opensuse-packaging/2013-05/msg00102.html
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Dec 7 14:57:37 CET 2016- aginies@suse.com
|
||||
Wed Dec 7 14:57:37 CET 2016 - aginies@suse.com
|
||||
|
||||
- update to 6.5 version
|
||||
* Experimental support for NVMe devices on FreeBSD, Linux and Windows.
|
||||
@@ -417,7 +432,7 @@ Tue Oct 7 22:55:04 CEST 2014 - sbrabec@suse.cz
|
||||
-------------------------------------------------------------------
|
||||
Wed Sep 3 13:27:11 CEST 2014 - ro@suse.de
|
||||
|
||||
- re-add sysvinit support in specfile (fix build on sles11)
|
||||
- re-add sysvinit support in specfile (fix build on sles11)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Sep 3 13:01:54 CEST 2014 - ro@suse.de
|
||||
@@ -442,12 +457,12 @@ Wed Sep 3 13:01:54 CEST 2014 - ro@suse.de
|
||||
- Windows: Reworked CSMI port scanning.
|
||||
- QNX: Compile fix.
|
||||
- dropped patches:
|
||||
smartmontools-nobuild-date.patch (code removed upstream)
|
||||
smartmontools-nobuild-date.patch (code removed upstream)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon May 26 15:26:24 UTC 2014 - crrodriguez@opensuse.org
|
||||
|
||||
- Build with large file support in 32 bit systems.
|
||||
- Build with large file support in 32 bit systems.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Dec 5 18:52:44 UTC 2013 - sbrabec@suse.com
|
||||
@@ -474,12 +489,12 @@ Mon Jul 29 18:12:00 CEST 2013 - sbrabec@suse.cz
|
||||
-------------------------------------------------------------------
|
||||
Fri Apr 5 11:24:43 UTC 2013 - idonmez@suse.com
|
||||
|
||||
- Add Source URL, see https://en.opensuse.org/SourceUrls
|
||||
- Add Source URL, see https://en.opensuse.org/SourceUrls
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Apr 3 23:53:45 UTC 2013 - crrodriguez@opensuse.org
|
||||
|
||||
- remove all sysvinit support.
|
||||
- remove all sysvinit support.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Mar 18 18:28:10 CET 2013 - sbrabec@suse.cz
|
||||
@@ -605,7 +620,7 @@ Fri Oct 21 15:54:22 CEST 2011 - sbrabec@suse.cz
|
||||
-------------------------------------------------------------------
|
||||
Mon Oct 10 14:24:33 UTC 2011 - bruno@ioda-net.ch
|
||||
|
||||
- reuse of %makeinstall to build for SLES11_SP1-
|
||||
- reuse of %makeinstall to build for SLES11_SP1-
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sun Oct 9 17:17:45 UTC 2011 - bruno@ioda-net.ch
|
||||
@@ -637,7 +652,7 @@ Sun Oct 9 17:17:45 UTC 2011 - bruno@ioda-net.ch
|
||||
- clean up old patches included in upstream
|
||||
- added systemd upstream configure option
|
||||
- added patch for FSF-address
|
||||
- clean up spec with spec-cleaner-
|
||||
- clean up spec with spec-cleaner-
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Jun 8 20:17:25 CEST 2011 - sbrabec@suse.cz
|
||||
@@ -695,14 +710,14 @@ Tue Sep 28 17:20:37 UTC 2010 - cristian.rodriguez@opensuse.org
|
||||
|
||||
- Fix patch to remove build Dates
|
||||
- Update to a newer version of 5.39.1 branch in order
|
||||
to support libcap-ng so smartd can drop privileges
|
||||
to support libcap-ng so smartd can drop privileges
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sun Aug 29 18:56:43 UTC 2010 - cristian.rodriguez@opensuse.org
|
||||
|
||||
- Do not include build enviroment infon in the binaries
|
||||
including date and time of compilation, makes build-compare
|
||||
happier.
|
||||
happier.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Jun 28 06:38:35 UTC 2010 - jengelh@medozas.de
|
||||
@@ -768,7 +783,7 @@ Mon Aug 10 19:07:54 CEST 2009 - sbrabec@suse.cz
|
||||
Momentus 5400.5 series.
|
||||
* Fix data type bug in checksum test for multi sector logs.
|
||||
* Add USB ID of Seagate FreeAgent Go.
|
||||
* Add experimental feature to log attribute values at each check
|
||||
* Add experimental feature to log attribute values at each check
|
||||
cycle (ATA only).
|
||||
* Heads up about a non backwardly compatible change introduced in
|
||||
draft SAT-2 (sat2r8b.pdf) that will break our existing SAT
|
||||
@@ -994,7 +1009,7 @@ Wed Jan 25 21:41:41 CET 2006 - mls@suse.de
|
||||
Tue Jun 21 01:17:39 CEST 2005 - ro@suse.de
|
||||
|
||||
- use RPM_OPT_FLAGS
|
||||
- build with fPIE/pie
|
||||
- build with fPIE/pie
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Mar 18 14:49:58 CET 2005 - sbrabec@suse.cz
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package smartmontools
|
||||
#
|
||||
# Copyright (c) 2025 SUSE LLC
|
||||
# Copyright (c) 2025 SUSE LLC and contributors
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@@ -37,9 +37,11 @@ Source5: %{name}.generate_smartd_opts.in
|
||||
# SOURCE-FEATURE-SLE smartmontools-drivedb_h-update.sh bnc851276 sbrabec@suse.cz -- Supplementary script to update drivedb.h.
|
||||
Source6: smartmontools-drivedb_h-update.sh
|
||||
# SOURCE-FEATURE-UPSTREAM smartmontools-drivedb.h bnc851276 sbrabec@suse.cz -- Update of drivedb.h. (Following line is handled by smartmontools-drivedb_h-update.sh.)
|
||||
#Source7: smartmontools-drivedb.h
|
||||
Source7: smartmontools-drivedb.h
|
||||
Source8: smartd_generate_opts.path
|
||||
Source9: smartd_generate_opts.service
|
||||
# PATCH-FEATURE-UPSTREAM smartmontools-update-smart-drivedb.patch sbrabec@suse.com -- Support download from smartmontools migrated to github (cummulative patch).
|
||||
Patch1: smartmontools-update-smart-drivedb.patch
|
||||
# PATCH-FEATURE-OPENSUSE smartmontools-suse-default.patch sbrabec@suse.cz -- Define smart SUSE defaults.
|
||||
Patch4: smartmontools-suse-default.patch
|
||||
# PATCH-FIX-OPENSUSE smartmontools-var-lock-subsys.patch sbrabec@suse.cz -- Do not use unsupported /var/lock/subsys.
|
||||
@@ -75,10 +77,10 @@ commands man smartctl and man smartd will provide more information.
|
||||
%autosetup -p1
|
||||
cp -a %{SOURCE2} %{SOURCE5} .
|
||||
# Following line is handled by smartmontools-drivedb_h-update.sh.
|
||||
#cp -a %{SOURCE7} drivedb.h.new
|
||||
cp -a %{SOURCE7} drivedb.h.new
|
||||
#
|
||||
# PATCH-FEATURE-OPENSUSE (sed on smartd.service.in) sbrabec@suse.cz -- Use generated smartd_opts (from SUSE sysconfig file). Systemd smartd.service cannot be smart enough to parse SUSE sysconfig file and generate smartd_opts on fly. And we do not want to launch shell just for it in every boot.
|
||||
sed "s:/usr/local/etc/sysconfig/smartmontools:%{_localstatedir}/lib/smartmontools/smartd_opts:" <smartd.service.in >smartd.service.in.new
|
||||
sed "s:/usr/local/etc/sysconfig/smartmontools:%{_sharedstatedir}/smartmontools/smartd_opts:" <smartd.service.in >smartd.service.in.new
|
||||
if cmp -s smartd.service.in smartd.service.in.new ; then
|
||||
echo "Failed to modify smartd.service.in"
|
||||
exit 1
|
||||
@@ -88,10 +90,20 @@ mv smartd.service.in.new smartd.service.in
|
||||
# Check whether drivedb.h from the tarball is older than drivedb.h.new
|
||||
# If yes, replace it. If not, fail.
|
||||
# PACKAGERS: Don't delete this section. It prevents packaging of outdated smartmontools-drivedb.h.
|
||||
get_db_release()
|
||||
{
|
||||
local v
|
||||
v=`sed -n '/^[ {]*"VERSION: .*"/{
|
||||
s,^[ {]*"VERSION: [1-9][.0-9]*\/\([1-9][0-9]*\)[ "].*$,\1,p
|
||||
q
|
||||
}' "$1"` || return 1
|
||||
if test -z "$v" ; then v=0 ; fi
|
||||
echo "$v"
|
||||
}
|
||||
if test -f drivedb.h.new ; then
|
||||
UPD_TIME=$(date -d "$(sed -n 's/^.*$Id: drivedb.h [0-9][0-9]* \([^ ]* [^ ]*\) .*$/\1/p' <drivedb.h.new)" +%s)
|
||||
PCK_TIME=$(date -d "$(sed -n 's/^.*$Id: drivedb.h [0-9][0-9]* \([^ ]* [^ ]*\) .*$/\1/p' <drivedb.h)" +%s)
|
||||
if test $UPD_TIME -lt $PCK_TIME ; then
|
||||
UPD_RELEASE=$(get_db_release drivedb.h.new)
|
||||
PCK_RELEASE=$(get_db_release drivedb.h)
|
||||
if test $UPD_RELEASE -lt $PCK_RELEASE ; then
|
||||
echo >&2 "Packaging error: Attached smartmontools-drivedb.h is older than the one from the release.
|
||||
Please call \"bash ./smartmontools-drivedb_h-update.sh\" to fix it."
|
||||
exit 1
|
||||
@@ -108,6 +120,7 @@ export LDFLAGS="-pie"
|
||||
--with-selinux\
|
||||
--with-libsystemd\
|
||||
--with-systemdsystemunitdir=%{_unitdir}\
|
||||
--with-drivedbinstdir\
|
||||
--with-savestates \
|
||||
--with-attributelog \
|
||||
--with-nvme-devicescan
|
||||
@@ -121,8 +134,8 @@ sed "s:@prefix@:%{_prefix}:g;s:@localstatedir@:%{_localstatedir}:g;s:@SERVICE@:$
|
||||
mkdir -p %{buildroot}%{_prefix}/lib/smartmontools
|
||||
mkdir -p %{buildroot}%{_fillupdir}
|
||||
cp smartmontools.sysconfig %{buildroot}%{_fillupdir}/sysconfig.smartmontools
|
||||
mkdir -p %{buildroot}%{_localstatedir}/lib/smartmontools
|
||||
touch %{buildroot}%{_localstatedir}/lib/smartmontools/smartd_opts
|
||||
mkdir -p %{buildroot}%{_sharedstatedir}/smartmontools
|
||||
touch %{buildroot}%{_sharedstatedir}/smartmontools/smartd_opts
|
||||
install generate_smartd_opts %{buildroot}%{_prefix}/lib/smartmontools/
|
||||
cat >%{buildroot}%{_sysconfdir}/smart_drivedb.h <<EOF
|
||||
/* smart_drivedb.h: Custom drive database. See also %{_datadir}/smartmontools/drivedb.h. */
|
||||
@@ -130,11 +143,10 @@ EOF
|
||||
cp smartd.service %{buildroot}/%{_unitdir}
|
||||
cp %{SOURCE8} %{buildroot}/%{_unitdir}
|
||||
cp %{SOURCE9} %{buildroot}/%{_unitdir}
|
||||
ln -sf %{_sbindir}/service %{buildroot}%{_sbindir}/rcsmartd
|
||||
# INSTALL file is intended only for packagers.
|
||||
rm %{buildroot}%{_defaultdocdir}/%{name}/INSTALL
|
||||
# Create empty ghost files for files created by update-smart-drivedb.
|
||||
touch %{buildroot}%{_datadir}/smartmontools/drivedb.h.{error,lastcheck,old}
|
||||
touch %{buildroot}%{_sharedstatedir}/smartmontools/drivedb.h{,.{asc,error,error.raw,error.raw.asc,lastcheck,old,old.raw,old.raw.asc,raw,raw.asc}}
|
||||
|
||||
# Check syntax of drivedb.h that may come from a later snapshot (code from update-smart-drivedb)
|
||||
if ./smartctl -B drivedb.h -P showall >/dev/null; then :; else
|
||||
@@ -142,8 +154,8 @@ if ./smartctl -B drivedb.h -P showall >/dev/null; then :; else
|
||||
exit 1
|
||||
fi
|
||||
# Intelligent drivedb.h update, part 0.
|
||||
# Check that drivedb.h has well formed svn RELEASE. We will need it for the intelligent update.
|
||||
DRIVEDB_H_RELEASE_CHECK="$(sed -n 's/^.*$Id: drivedb.h \([0-9][0-9]*\) .*$/\1/p' <%{buildroot}%{_datadir}/smartmontools/drivedb.h)"
|
||||
# Check that drivedb.h has well formed VERSION. We will need it for the intelligent update.
|
||||
DRIVEDB_H_RELEASE_CHECK="$(sed -n 's/^.*VERSION: [0-9][0-9.]*\/\([0-9][0-9]*\).*$/\1/p' <%{buildroot}%{_datadir}/smartmontools/drivedb.h)"
|
||||
# Fail if the file has broken release number.
|
||||
test "$DRIVEDB_H_RELEASE_CHECK" -ge 0
|
||||
# Fail if there is no default_branch= in update-smart-drivedb
|
||||
@@ -151,22 +163,24 @@ grep -q "^default_branch=\"[^\"]*\"$" update-smart-drivedb
|
||||
|
||||
%pre
|
||||
%service_add_pre smartd.service smartd_generate_opts.path smartd_generate_opts.service
|
||||
# These files were generated by update-smart-drivedb before introduction of
|
||||
# transactional updates, but not all were listed in spec as %%ghost.
|
||||
# (16.1 and older updated to 7.5)
|
||||
for EXT in asc error error.raw error.raw.asc lastcheck old old.raw old.raw.asc raw raw.asc ; do
|
||||
rm -f %{_datadir}/smartmontools/drivedb.h.$EXT
|
||||
done
|
||||
# Intelligent drivedb.h update, part 1.
|
||||
# Extract drivedb.h branch for installed version. We will need it in %%post.
|
||||
if test -f %{_sbindir}/update-smart-drivedb ; then
|
||||
if test -f %{_sharedstatedir}/smartmontools/drivedb.h -a -f %{_sbindir}/update-smart-drivedb ; then
|
||||
BRANCH=
|
||||
eval $(grep "^BRANCH=\"[^\"]*\"$" %{_sbindir}/update-smart-drivedb)
|
||||
if test -n "$BRANCH" ; then
|
||||
echo -n "$BRANCH" >%{_datadir}/smartmontools/drivedb.h.branch.rpmtemp
|
||||
default_branch=
|
||||
# BRANCH is old variable name up to 7.2. Starting by 7.3, it is default_branch.
|
||||
eval $(grep "^\(BRANCH\|default_branch\)=\"[^\"]*\"$" %{_sbindir}/update-smart-drivedb)
|
||||
if test -n "$default_branch$BRANCH" ; then
|
||||
mkdir -p %{_sharedstatedir}/smartmontools
|
||||
echo -n "$default_branch$BRANCH" >%{_sharedstatedir}/smartmontools/drivedb.h.branch.rpmtemp
|
||||
fi
|
||||
fi
|
||||
# Save installed drivedb.h. Maybe the sysadmin called update-smart-drivedb,
|
||||
# and the installed drivedb.h may be even newer than the new packaged one.
|
||||
if test -f %{_datadir}/smartmontools/drivedb.h ; then
|
||||
# Be on safe side, remove any potential drivedb.h.rpmsave.
|
||||
rm -f %{_datadir}/smartmontools/drivedb.h.rpmsave
|
||||
ln %{_datadir}/smartmontools/drivedb.h %{_datadir}/smartmontools/drivedb.h.rpmsave
|
||||
fi
|
||||
|
||||
%post
|
||||
# First prepare sysconfig.
|
||||
@@ -174,45 +188,48 @@ fi
|
||||
# Up to Leap 42.3 and SLE 15 SP3 Maintenance Update there was a "Command" meta comment in the sysconfig file.
|
||||
# It is not needed any more, but fillup does not delete it. Do it explicitly. (bsc#1195785, bsc#1196103)
|
||||
sed -i '\@^##[[:space:]]*Command:[[:space:]]*%{_prefix}/lib/smartmontools/generate_smartd_opts$@d' %{_sysconfdir}/sysconfig/smartmontools
|
||||
# Then generate initial %%{_localstatedir}/lib/smartmontools/smartd_opts needed by smartd.service.
|
||||
# Then generate initial %%{_sharedstatedir}/smartmontools/smartd_opts needed by smartd.service.
|
||||
SMARTD_SKIP_INIT=1 %{_prefix}/lib/smartmontools/generate_smartd_opts
|
||||
# No start by default here.. belongs to -presets packages
|
||||
%service_add_post smartd.service smartd_generate_opts.path smartd_generate_opts.service
|
||||
# This file may be kept from <= 7.4 or pre-GitHub 7.5. Drop it, as it is probably incompatible.
|
||||
rm -f %{_datadir}/smartmontools/drivedb.h.rpmsave
|
||||
# Intelligent drivedb.h update, part 2.
|
||||
# Now we have the old system drivedb.h.rpmsave and the new packaged drivedb.h.
|
||||
if test -f %{_datadir}/smartmontools/drivedb.h.rpmsave ; then
|
||||
# Compare their release numbers.
|
||||
DRIVEDB_H_RELEASE_RPM="$(sed -n 's/^.*$Id: drivedb.h \([0-9][0-9]*\) .*$/\1/p' <%{_datadir}/smartmontools/drivedb.h)"
|
||||
DRIVEDB_H_RELEASE_SAVED="$(sed -n 's/^.*$Id: drivedb.h \([0-9][0-9]*\) .*$/\1/p' <%{_datadir}/smartmontools/drivedb.h.rpmsave)"
|
||||
# Note: The SAVED release number may be broken. The test syntax must cover it and replace old file.
|
||||
if test "$DRIVEDB_H_RELEASE_RPM" -lt "${DRIVEDB_H_RELEASE_SAVED:-0}" ; then
|
||||
# If it is an update to the new branch, always replace the database.
|
||||
# Extract drivedb.h branch for the new version to default_branch.
|
||||
eval $(grep "^default_branch=\"[^\"]*\"$" %{_sbindir}/update-smart-drivedb)
|
||||
OLD_BRANCH=
|
||||
if test -f %{_datadir}/smartmontools/drivedb.h.branch.rpmtemp ; then
|
||||
OLD_BRANCH=$(<%{_datadir}/smartmontools/drivedb.h.branch.rpmtemp)
|
||||
fi
|
||||
if test "$default_branch" = "$OLD_BRANCH" ; then
|
||||
# It is safe to keep later version of installed database.
|
||||
mv %{_datadir}/smartmontools/drivedb.h.rpmsave %{_datadir}/smartmontools/drivedb.h
|
||||
smartdb_purge() {
|
||||
rm -f %{_sharedstatedir}/smartmontools/drivedb.h
|
||||
for EXT in asc error error.raw error.raw.asc lastcheck old old.raw old.raw.asc raw raw.asc ; do
|
||||
rm -f %{_sharedstatedir}/smartmontools/drivedb.h.$EXT
|
||||
done
|
||||
}
|
||||
get_db_release()
|
||||
{
|
||||
local v
|
||||
v=`sed -n '/^[ {]*"VERSION: .*"/{
|
||||
s,^[ {]*"VERSION: [1-9][.0-9]*\/\([1-9][0-9]*\)[ "].*$,\1,p
|
||||
q
|
||||
}' "$1"` || return 1
|
||||
if test -z "$v" ; then v=0 ; fi
|
||||
echo "$v"
|
||||
}
|
||||
if test -f %{_sharedstatedir}/smartmontools/drivedb.h.branch.rpmtemp ; then
|
||||
# Extract drivedb.h branch for installed version.
|
||||
default_branch=
|
||||
eval $(grep "default_branch=\"[^\"]*\"$" %{_sbindir}/update-smart-drivedb)
|
||||
if test -n "$default_branch" ; then
|
||||
if test "$default_branch" != "$(cat %{_sharedstatedir}/smartmontools/drivedb.h.branch.rpmtemp)" ; then
|
||||
# incompatible branches
|
||||
smartdb_purge
|
||||
else
|
||||
# Saved file needs to be replaced.
|
||||
rm %{_datadir}/smartmontools/drivedb.h.rpmsave
|
||||
# We returned to the vanilla packages, remove files created by update-smart-drivedb.
|
||||
rm -f %{_datadir}/smartmontools/drivedb.h.{error,lastcheck,old}
|
||||
echo >&2 "%{name} updated to a version that requires new branch of drivedb.h"
|
||||
echo >&2 "Replacing your custom drivedb.h."
|
||||
echo >&2 "You may need to call update-smart-drivedb."
|
||||
# Compare their release numbers.
|
||||
DRIVEDB_H_RELEASE_RPM="$(get_db_release %{_datadir}/smartmontools/drivedb.h)"
|
||||
DRIVEDB_H_RELEASE_UPD="$(get_db_release %{_sharedstatedir}/smartmontools/drivedb.h)"
|
||||
if test "${DRIVEDB_H_RELEASE_RPM:-0}" -ge "${DRIVEDB_H_RELEASE_UPD:-0}" ; then
|
||||
smartdb_purge
|
||||
fi
|
||||
fi
|
||||
else
|
||||
# Saved file is older or equal, or saved file has broken release number.
|
||||
rm %{_datadir}/smartmontools/drivedb.h.rpmsave
|
||||
# We returned to the vanilla packages, remove files created by update-smart-drivedb.
|
||||
rm -f %{_datadir}/smartmontools/drivedb.h.{error,lastcheck,old}
|
||||
fi
|
||||
fi
|
||||
rm -f %{_datadir}/smartmontools/drivedb.h.branch.rpmtemp
|
||||
rm -f %{_sharedstatedir}/smartmontools/drivedb.h.branch.rpmtemp
|
||||
# Before Leap 15 / SLE 15, there was a incorrect configuration of self tests (bsc#1073918).
|
||||
# Perform a fix of this nonsense, even if the noreplace configuration file was edited.
|
||||
if grep -q -F -- '-s S/../.././03 -s L/../(01|02|03|04|05|06|07)/7/01' %{_sysconfdir}/smartd.conf ; then
|
||||
@@ -226,19 +243,27 @@ fi
|
||||
%service_del_postun smartd.service smartd_generate_opts.path smartd_generate_opts.service
|
||||
# Clean all attrlogs and state files.
|
||||
if test "$1" = 0 ; then
|
||||
rm -rf %{_localstatedir}/lib/smartmontools
|
||||
rm -rf %{_sharedstatedir}/smartmontools
|
||||
fi
|
||||
|
||||
%files
|
||||
%doc %{_docdir}/%{name}
|
||||
%dir %{_datadir}/smartmontools
|
||||
%verify(not md5 size mtime) %{_datadir}/smartmontools/drivedb.h
|
||||
%ghost %{_datadir}/smartmontools/drivedb.h.error
|
||||
%ghost %{_datadir}/smartmontools/drivedb.h.lastcheck
|
||||
%ghost %{_datadir}/smartmontools/drivedb.h.old
|
||||
%{_mandir}/man*/*
|
||||
%dir %{_localstatedir}/lib/smartmontools
|
||||
%ghost %{_localstatedir}/lib/smartmontools/smartd_opts
|
||||
%dir %{_sharedstatedir}/smartmontools
|
||||
%ghost %{_sharedstatedir}/smartmontools/smartd_opts
|
||||
%ghost %{_sharedstatedir}/smartmontools/drivedb.h
|
||||
%ghost %{_sharedstatedir}/smartmontools/drivedb.h.asc
|
||||
%ghost %{_sharedstatedir}/smartmontools/drivedb.h.error
|
||||
%ghost %{_sharedstatedir}/smartmontools/drivedb.h.error.raw
|
||||
%ghost %{_sharedstatedir}/smartmontools/drivedb.h.error.raw.asc
|
||||
%ghost %{_sharedstatedir}/smartmontools/drivedb.h.lastcheck
|
||||
%ghost %{_sharedstatedir}/smartmontools/drivedb.h.old
|
||||
%ghost %{_sharedstatedir}/smartmontools/drivedb.h.old.raw
|
||||
%ghost %{_sharedstatedir}/smartmontools/drivedb.h.old.raw.asc
|
||||
%ghost %{_sharedstatedir}/smartmontools/drivedb.h.raw
|
||||
%ghost %{_sharedstatedir}/smartmontools/drivedb.h.raw.asc
|
||||
%{_prefix}/lib/smartmontools
|
||||
%{_unitdir}/*
|
||||
%{_sbindir}/*
|
||||
|
||||
Reference in New Issue
Block a user