~ubuntu-branches/ubuntu/natty/microcode.ctl/natty-updates

« back to all changes in this revision

Viewing changes to debian/update-intel-microcode

  • Committer: Bazaar Package Importer
  • Author(s): Giacomo Catenazzi
  • Date: 2009-10-07 08:16:54 UTC
  • mfrom: (6.1.3 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091007081654-klpb74j9lyyr6603
Tags: 1.17-13
* update-intel-microcode: retrieve the first firmware in the RSS
  applying patch from Hajo Moeller (Closes: #549699)
* remove possible needless dependency on po-debconf (Closes: #539943)

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
# This file is licensed with GPL version 2 (or at your option any later versions)
4
4
# For the full license, see http://fsf.org
5
5
 
 
6
set -e
 
7
 
6
8
# This script will download and update the Intel microcode
7
9
 
8
10
# Check wget
10
12
    echo "wget not found. Please install wget" 1>&2
11
13
    exit 1
12
14
fi
 
15
if ! grep -sq GenuineIntel /proc/cpuinfo; then
 
16
    echo "microcode.ctl: Yet we provide only microcodes for Intel processors" 1>&2
 
17
    echo "Your CPU seems not an Intel processor" 1>&2
 
18
    exit 1
 
19
fi
13
20
 
14
21
REMOTE_RSS='http://feeds.downloadcenter.intel.com/rss/?p=483&lang=eng'
15
 
REMOTE_DATA="$(wget -t 2 -T 20 -nv -q -O - "$REMOTE_RSS" | sed  -nre 's#^.*<IntelDC:Type>Firmware</IntelDC:Type><IntelDC:Version>(200[0-9]*)</IntelDC:Version><IntelDC:Status>latest</IntelDC:Status>.*?<IntelDC:FileURL>([^<]*\1[^<]*)</IntelDC:FileURL>.*$#\1 \2#p' - )"
16
 
if [ "0$?" != "00" ] ; then
 
22
REMOTE_DATA="$(wget -t 2 -T 20 -nv -q -O - "$REMOTE_RSS" | perl -pe 's|^.+?<IntelDC:Type>Firmware</IntelDC:Type><IntelDC:Version>(20[0-9]*)</IntelDC:Version><IntelDC:Status>latest</IntelDC:Status>.+?<IntelDC:FileURL>([^<]*\1[^<]*)</IntelDC:FileURL>.*$|\1 \2\n|' - || echo 'ERROR')"
 
23
if [ "0$REMOTE_DATA" = "0"  -o  "0$REMOTE_DATA" = "0ERROR" ] ; then
17
24
    echo "Error: could not find remote data in $REMOTE_RSS" 1>&2
18
 
    echo "exiting" 1>&2
 
25
    echo "...exiting" 1>&2
19
26
    exit 1
20
27
fi
21
28
REMOTE_FILE=$(echo $REMOTE_DATA | sed -ne 's#^\(.*\) \(http://.*\)$#\2#p' -)
29
36
    echo "Local version: $LOCAL_DATE"
30
37
    echo "Remote version: $REMOTE_DATE"
31
38
 
32
 
    if [ "0$REMOTE_DATE" -le "0$LOCAL_DATE" ] ; then
 
39
    if [ "0$REMOTE_DATE" = "0" ] ; then
 
40
        echo "could not extract the actual data of remote microcode"
 
41
        exit 1
 
42
    elif [ "0$REMOTE_DATE" -le "0$LOCAL_DATE" ] ; then
33
43
        echo "No need to download a new microcode" 1>&2
34
44
        exit 0
35
45
    fi
47
57
esac
48
58
 
49
59
 
50
 
if wget -t 2 -T 20 -nv -q -O - "$REMOTE_FILE" | $FILTER > "$LOCAL_FILE" ; then
 
60
if wget -t 2 -T 20 -nv -q -O - "$REMOTE_FILE" | $FILTER > "$LOCAL_FILE".tmp ; then
 
61
    mv "$LOCAL_FILE".tmp "$LOCAL_FILE"
51
62
    echo "microcode downloaded sucessfully" 1>&2
52
63
else
53
64
    echo "Error on downloading the microcode." 1>&2