#
# smartmontools drive database update script
#
-# Copyright (C) 2010-11 Christian Franke <smartmontools-support@lists.sourceforge.net>
+# Copyright (C) 2010-14 Christian Franke <smartmontools-support@lists.sourceforge.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# You should have received a copy of the GNU General Public License
# (for example COPYING); If not, see <http://www.gnu.org/licenses/>.
#
-# $Id: update-smart-drivedb.in 3294 2011-03-16 21:36:58Z chrfranke $
+# $Id: update-smart-drivedb.in 4019 2014-12-06 20:12:50Z chrfranke $
#
set -e
# Smartctl used for syntax check
SMARTCTL="$sbindir/smartctl"
-# Trac repository browser (does not return HTTP 404 errors)
-#SRCEXPR='http://sourceforge.net/apps/trac/smartmontools/export/HEAD/$location/smartmontools/drivedb.h'
-
-# ViewVC repository browser
-SRCEXPR='http://smartmontools.svn.sourceforge.net/viewvc/smartmontools/$location/smartmontools/drivedb.h?revision=HEAD'
-
+# Download URL for sourceforge code browser
+SRCEXPR='http://sourceforge.net/p/smartmontools/code/HEAD/tree/$location/smartmontools/drivedb.h?format=raw'
# Parse options
q="-q "
errmsg="download from $location failed (HTTP error)"
continue
fi
- if grep -i 'ViewVC Exception' "$DEST.new" >/dev/null; then
- errmsg="download from $location failed (ViewVC error)"
+ if grep -i '<title>.*Error has Occurred' "$DEST.new" >/dev/null; then
+ errmsg="download from $location failed (SF code browser error)"
continue
fi
# Check syntax
rm -f "$DEST.error"
-if $SMARTCTL -B "$DEST.new" -P showall >/dev/null; then :; else
+if "$SMARTCTL" -B "$DEST.new" -P showall >/dev/null; then :; else
mv "$DEST.new" "$DEST.error"
echo "$DEST.error: rejected by $SMARTCTL, probably no longer compatible" >&2
exit 1
fi
-# Keep old file if identical, ignore differences in Id string
+# Keep old file if identical
rm -f "$DEST.lastcheck"
if [ -f "$DEST" ]; then
- if cat "$DEST" | sed 's|\$''Id''[^$]*\$|$''Id''$|' | cmp - "$DEST.new" >/dev/null; then
+ if cmp "$DEST" "$DEST.new" >/dev/null 2>/dev/null; then
rm -f "$DEST.new"
touch "$DEST.lastcheck"
echo "$DEST is already up to date"