home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / var / lib / dpkg / info / hdparm.preinst < prev    next >
Encoding:
Text File  |  2009-01-09  |  2.5 KB  |  74 lines

  1. #!/bin/sh
  2.  
  3. # Remove a no-longer used conffile
  4. rm_conffile() {
  5.     CONFFILE="$1"
  6.  
  7.     if [ -e "$CONFFILE" ]; then
  8.         md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
  9.         old_md5sum="`dpkg-query -W -f='${Conffiles}' $PKGNAME | sed -n -e \"\\\\' $CONFFILE'{s/ obsolete$//;s/.* //p}\"`"
  10.         if [ "$md5sum" != "$old_md5sum" ]; then
  11.             echo "Obsolete conffile $CONFFILE has been modified by you."
  12.             echo "Saving as $CONFFILE.dpkg-bak ..."
  13.             mv -f "$CONFFILE" "$CONFFILE".dpkg-bak
  14.         else
  15.             echo "Removing obsolete conffile $CONFFILE ..."
  16.             rm -f "$CONFFILE"
  17.         fi
  18.     fi
  19. }
  20.  
  21. if [ "$1" = install ] || [ "$1" = upgrade ]; then
  22.   if dpkg --compare-versions "$2" le 8.6-1ubuntu1; then
  23.       rm_conffile /etc/init.d/hdparm
  24.       update-rc.d -f hdparm remove >/dev/null 2>&1
  25.   fi
  26.  
  27.   if dpkg --compare-versions "$2" le 6.1-6; then
  28.     if dpkg --compare-versions "$2" gt 6.1-2; then
  29.       for conffile in /etc/init.d/hdparm.dev /etc/default/hdparm /etc/dev.d/block/hdparm.block /etc/dev.d/block/hdparm.dev; do
  30.         [ ! -e "$conffile" ] || rm_conffile "$conffile"
  31.       done
  32.     elif dpkg --compare-versions "$2" lt 5.5-5; then
  33.       update-rc.d -f hdparm remove > /dev/null 2>&1
  34.       if dpkg --compare-versions "$2" lt 5.4-6; then
  35.         [ ! -e /etc/hdparm.conf ] || rm_conffile "/etc/hdparm.conf"
  36.         if dpkg --compare-versions "$2" ge 5.4-3; then
  37.           if [ -e /etc/default/hdparm ]; then  
  38.             echo -n "Moving old /etc/default/hdparm to /etc/hdparm.conf . . "
  39.             mv /etc/default/hdparm /etc/hdparm.conf
  40.             echo "done."
  41.           fi
  42.         fi
  43.       fi
  44.     fi
  45.   fi
  46. fi
  47.  
  48. # Automatically added by dh_installudev
  49. if [ "$1" = install ] || [ "$1" = upgrade ]; then
  50.     if [ -e "/etc/udev/hdparm.rules" ]; then
  51.         if [ "`md5sum \"/etc/udev/hdparm.rules\" | sed -e \"s/ .*//\"`" = \
  52.              "`dpkg-query -W -f='${Conffiles}' hdparm | sed -n -e \"\\\\' /etc/udev/hdparm.rules's/.* //p\"`" ]
  53.         then
  54.             rm -f "/etc/udev/hdparm.rules"
  55.         fi
  56.     fi
  57.     if [ -L "/lib/udev/rules.d/85-hdparm.rules" ]; then
  58.         rm -f "/lib/udev/rules.d/85-hdparm.rules"
  59.     fi
  60. fi
  61. # End automatically added section
  62. # Automatically added by dh_installudev
  63. if [ "$1" = install ] || [ "$1" = upgrade ]; then
  64.     if [ -e "/etc/udev/rules.d/85-hdparm.rules" ]; then
  65.         if [ "`md5sum \"/etc/udev/rules.d/85-hdparm.rules\" | sed -e \"s/ .*//\"`" = \
  66.              "`dpkg-query -W -f='${Conffiles}' hdparm | sed -n -e \"\\\\' /etc/udev/rules.d/85-hdparm.rules's/.* //p\"`" ]
  67.         then
  68.             rm -f "/etc/udev/rules.d/85-hdparm.rules"
  69.         fi
  70.     fi
  71. fi
  72. # End automatically added section
  73.  
  74.