]> git.proxmox.com Git - mirror_smartmontools-debian.git/blobdiff - update-smart-drivedb.in
apply wrap-and-sort
[mirror_smartmontools-debian.git] / update-smart-drivedb.in
index ca728e170820abe70e27f4ec56fab2d8c02c38cf..1b53a52c6521c99cff60cc6c0b73b4c0f5ff4c19 100644 (file)
@@ -2,7 +2,7 @@
 #
 # 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
@@ -12,7 +12,7 @@
 # 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
@@ -39,12 +39,8 @@ DEST="$drivedbdir/drivedb.h"
 # 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 "
@@ -106,8 +102,8 @@ for location in "branches/$BRANCH" "trunk"; do
     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
 
@@ -126,16 +122,16 @@ chmod 0644 "$DEST.new"
 
 # 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"