~ubuntu-branches/ubuntu/precise/pciutils/precise

« back to all changes in this revision

Viewing changes to update-pciids.sh

  • Committer: Bazaar Package Importer
  • Author(s): Anibal Monsalve Salazar
  • Date: 2010-06-26 14:17:57 UTC
  • mfrom: (2.1.18 sid)
  • Revision ID: james.westby@ubuntu.com-20100626141757-xsp7xqv15qotwels
Tags: 1:3.1.7-4
Update pci.ids with snapshot dated 2010-06-12

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
# update-pciids.sh is licensed under the GNU General Public License
4
4
# (GPL) version 2 or above.
5
5
6
 
# Copyright (C) 2008  Anibal Monsalve Salazar <anibal@debian.org>
 
6
# Copyright (C) 2008-2010 Anibal Monsalve Salazar <anibal@debian.org>
7
7
8
8
# This program is free software: you can redistribute it and/or modify
9
9
# it under the terms of the GNU General Public License as published by
23
23
 
24
24
set -e
25
25
 
 
26
#URL="http://pci-ids.ucw.cz/pci.ids"
26
27
URL="http://pciids.sourceforge.net/v2.2/pci.ids"
27
28
FILE="pci.ids"
28
29
 
30
31
MV="/bin/mv"
31
32
SED="/bin/sed"
32
33
GREP="/bin/grep"
33
 
GZIP="/bin/gzip"
34
34
ECHO="/bin/echo"
35
35
CHMOD="/bin/chmod"
 
36
CHOWN="/bin/chown"
36
37
GUNZIP="/bin/gunzip"
37
38
BUNZIP2="/bin/bunzip2"
38
39
TOUCH="/usr/bin/touch"
39
 
PERL="/usr/bin/perl"
40
40
WGET="/usr/bin/wget"
41
41
CURL="/usr/bin/curl"
42
42
LYNX="/usr/bin/lynx"
97
97
    exit 1
98
98
fi
99
99
 
100
 
date=$($GREP "^#.*Date:" $NEWFILE 2> /dev/null | $SED "s/^#.*Date://")
 
100
date=$( $GREP -E "^#[[:space:]]Date:[[:space:]]*" $NEWFILE 2> /dev/null | $SED "s/^#[[:space:]]Date:[[:space:]]*//" )
101
101
 
102
102
if [ -z "$date" ]
103
103
then
105
105
    exit 1
106
106
fi 
107
107
 
108
 
# Reduce by removing subsystem ids and comments
109
 
if [ -n "$BASH_VERSION" ]
110
 
then
111
 
    #$GREP -Ev ^$'\t\t'"|^\s*$|^\s*#" $NEWFILE | $GZIP -9 > $NEWFILE.gz
112
 
    $GREP -Ev ^$'\t\t'"|^\s*$|^\s*#" $NEWFILE > $NEWFILE.tmp
113
 
    mv $NEWFILE.tmp $NEWFILE
114
 
else
115
 
    #$PERL -ne 'print unless /^(\s*#|\s*$|\t\t)/' < $NEWFILE | $GZIP -9 > $NEWFILE.gz
116
 
    $PERL -ne 'print unless /^(\s*#|\s*$|\t\t)/' < $NEWFILE > $NEWFILE.tmp
117
 
    mv $NEWFILE.tmp $NEWFILE
118
 
fi
119
 
 
120
 
#$RM $NEWFILE
121
 
 
122
108
if [ -f $FILE ]
123
109
then
 
110
    $CHOWN --reference="$FILE" "$NEWFILE"
 
111
    $CHMOD --reference="$FILE" "$NEWFILE"
124
112
    [ -f $OLDFILE ] && $RM $OLDFILE
125
113
    $MV $FILE $OLDFILE
126
114
fi
130
118
 
131
119
if [ -f $FILE.gz ]
132
120
then
133
 
    #$CHMOD -f --reference=$FILE.gz $NEWFILE.gz 2> /dev/null || true
134
121
    [ -f $OLDFILE.gz ] && $RM $OLDFILE.gz
135
122
    $MV $FILE.gz $OLDFILE.gz
136
123
fi
137
124
 
138
 
#$MV $NEWFILE.gz $FILE.gz
139
 
#$TOUCH -d "$date" $FILE.gz
140
 
 
141
125
if [ $quiet = "no" ]
142
126
then
143
127
    $ECHO "Downloaded daily snapshot dated $date"