~ubuntu-branches/ubuntu/lucid/silo/lucid

« back to all changes in this revision

Viewing changes to debian/packages.d/silo.in

  • Committer: Bazaar Package Importer
  • Author(s): Fabio M. Di Nitto
  • Date: 2007-10-25 09:28:08 UTC
  • mfrom: (15.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20071025092808-1yhj12t7s4zqsfu5
Tags: 1.4.13a+git20070930-1ubuntu1
* Merge from debian unstable, remaining changes:
  - Build with -fno-stack-protector.
  - Change silo.postinst to automatically update the boot block without
    invoking siloconfig and keep asking questions on upgrades.
  - Convert silo.conf to use /dev/disk/by-uuid.
  - Ubuntu maintainer foobar.
  - Fix debian/rules call to dh_installdocs.
  - Drop the requirement of gcc-4.1 and start using default gcc.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
%postinst%
2
 
#!/bin/sh
3
 
 
4
 
convert_to_uuid() {
5
 
  line=$1
6
 
  byuuid=""
7
 
  root=$(echo "$line" | sed 's/.*root=//;s/ .*//')
8
 
  case "$root" in
9
 
    UUID=*|LABEL=*|/dev/disk/*|/dev/mapper/*|/dev/evms/*|/dev/md[0-9]*)
10
 
    ;;
11
 
    /dev/*)
12
 
      if [ -L "$root" ] && readlink "$root" | grep -q "^/dev/mapper/"
13
 
      then
14
 
        :
15
 
      elif [ -b "$root" ]; then
16
 
        uuid=$(/sbin/vol_id -u "$root" || true)
17
 
        if [ -n "$uuid" ]; then
18
 
          byuuid=$(echo "$line" | sed "s#\(.*root=\)[^ ]*#\1/dev/disk/by-uuid/$uuid#")
19
 
        fi
20
 
      fi
21
 
    ;;
22
 
  esac
23
 
  if [ -n "$byuuid" ]; then
24
 
    echo \# "$line"
25
 
    echo "$byuuid"
26
 
  else
27
 
    echo "$line"
28
 
  fi
29
 
}
30
 
 
31
 
convert_silo_conf() {
32
 
  if [ -f silo.conf.uuid ]; then
33
 
        return
34
 
  fi
35
 
  OLDIFS=${IFS}
36
 
  export IFS="Å"
37
 
  cat /boot/silo.conf | { while read line; do
38
 
        case "$line" in
39
 
                *root=*)
40
 
                        convert_to_uuid "$line" >> /boot/silo.conf.uuid
41
 
                ;;
42
 
                *)
43
 
                        echo $line >> /boot/silo.conf.uuid
44
 
                ;;
45
 
        esac
46
 
  done; }
47
 
  export IFS="${OLDIFS}"
48
 
  cp /boot/silo.conf /boot/silo.conf.pre-uuid
49
 
  cp /boot/silo.conf.uuid /boot/silo.conf
50
 
  rm /boot/silo.conf.uuid
51
 
}
52
 
 
53
 
# if we are upgrading there is no real need to invoke siloconfig
54
 
# and we just update.
55
 
if [ -n "$2" ] && [ -f /boot/silo.conf ]; then
56
 
  /sbin/silo -f
57
 
  if dpkg --compare-versions "$2" lt "1.4.13-1ubuntu5"; then
58
 
    convert_silo_conf
59
 
    /sbin/silo -f
60
 
  fi
61
 
else
62
 
  /usr/sbin/siloconfig
63
 
fi
64
 
 
65
 
#DEBHELPER#