home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / var / lib / dpkg / info / procps.postinst < prev    next >
Encoding:
Text File  |  2009-03-18  |  4.3 KB  |  148 lines

  1. #!/bin/sh
  2. # postinst script for procps
  3. #
  4. # see: dh_installdeb(1)
  5.  
  6. set -e
  7.  
  8. # summary of how this script can be called:
  9. #        * <postinst> `configure' <most-recently-configured-version>
  10. #        * <old-postinst> `abort-upgrade' <new version>
  11. #        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
  12. #          <new-version>
  13. #        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
  14. #          <failed-install-package> <version> `removing'
  15. #          <conflicting-package> <version>
  16. # for details, see http://www.debian.org/doc/debian-policy/ or
  17. # the debian-policy package
  18. #
  19. # quoting from the policy:
  20. #     Any necessary prompting should almost always be confined to the
  21. #     post-installation script, and should be protected with a conditional
  22. #     so that unnecessary prompting doesn't happen if a package's
  23. #     installation fails and the `postinst' is called with `abort-upgrade',
  24. #     `abort-remove' or `abort-deconfigure'.
  25.  
  26. # Remove a no-longer used conffile
  27. rm_conffile()
  28. {
  29.     CONFFILE="$1"
  30.  
  31.     if [ -e "$CONFFILE".dpkg-obsolete ]; then
  32.     echo "Removing obsolete conffile $CONFFILE"
  33.     rm -f "$CONFFILE".dpkg-obsolete
  34.     fi
  35. }
  36.  
  37. # Move a conffile without triggering a dpkg question
  38. mv_conffile() {
  39.   OLDCONFFILE="$1"
  40.   NEWCONFFILE="$2"
  41.  
  42.   if [ -e "$OLDCONFFILE" ]; then
  43.     echo "Preserving user changes to $NEWCONFFILE ..."
  44.     mv -f "$NEWCONFFILE" "$NEWCONFFILE".dpkg-new
  45.     mv -f "$OLDCONFFILE" "$NEWCONFFILE"
  46.   fi
  47. }
  48.  
  49. # update alternative, if it exists
  50. check_alternatives() {
  51.   BINNAME="$1"
  52.   BINPATH="$2"
  53.   MANSEC="$3"
  54.   if [ -e "$BINPATH"/"$BINNAME".procps ] ; then
  55.     update-alternatives --install "$BINPATH"/"$BINNAME" "$BINNAME" \
  56.         "$BINPATH"/"$BINNAME".procps 50 \
  57.         --slave /usr/share/man/man"$MANSEC"/"$BINNAME"."$MANSEC".gz "$BINNAME"."$MANSEC".gz \
  58.         /usr/share/man/man"$MANSEC"/"$BINNAME".procps."$MANSEC".gz
  59.   fi
  60. }
  61. case "$1" in
  62.     configure|abort-remove|abort-deconfigure)
  63.         if [ -e /etc/psdevtab ] ; then
  64.             rm -f /etc/psdevtab
  65.         fi
  66.         if [ -e /etc/psdatabase ] 
  67.         then
  68.             rm -f /etc/psdatabase
  69.         fi
  70.        # Remove old procps init.d script, if it exists Closes: #55137
  71.        if [ -L /etc/rcS.d/S30procps.sh ]
  72.        then
  73.           update-rc.d -f procps.sh remove >/dev/null
  74.        fi
  75.        # and if that didn't work Closes: #92184 (#234306 with -L )
  76.        if [ -L /etc/rcS.d/S30procps.sh ]
  77.        then
  78.            rm -f /etc/rcS.d/S30procps.sh
  79.        fi
  80.        if [ -L /etc/rcS.d/S05procps.sh ]; then
  81.            rm -f /etc/rcS.d/S05procps.sh
  82.        fi
  83.        # Ubuntu had this link at S17, leaving cruft behind on upgrade:
  84.        if [ -L /etc/rcS.d/S17procps.sh ]; then
  85.            rm -f /etc/rcS.d/S17procps.sh
  86.        fi
  87.        # Remove moved procps.sh file, if it is there
  88.        if dpkg --compare-versions "$2" le "1:3.2.7-3"; then
  89.          mv_conffile "/etc/init.d/procps.sh" "/etc/init.d/procps"
  90.        fi
  91.         
  92.         #
  93.         # Now to do the alternatives for w
  94.         update-alternatives --install /usr/bin/w w /usr/bin/w.procps 50 \
  95.             --slave /usr/share/man/man1/w.1.gz w.1.gz /usr/share/man/man1/w.procps.1.gz
  96.         # Do alternatives for uptime kill vmstat and ps, if required
  97.         check_alternatives "uptime" "/usr/bin" "1"
  98.         check_alternatives "kill" "/usr/bin" "1"
  99.         check_alternatives "vmstat" "/usr/bin" "8"
  100.         check_alternatives "ps" "/bin" "1"
  101.         
  102.     if dpkg --compare-versions "$2" lt-nl 1:3.2.7-11ubuntu1; then
  103.         rm_conffile /etc/sysctl.d/10-tcp-timestamps-workaround.conf
  104.     fi
  105.     if dpkg --compare-versions "$2" lt-nl 1:3.2.7-11ubuntu2; then
  106.         rm_conffile /etc/sysctl.d/10-process-security.conf
  107.     fi
  108.     ;;
  109.  
  110.     abort-upgrade)
  111.         # Nothing to do
  112.     ;;
  113.  
  114.     *)
  115.         echo "postinst called with unknown argument \`$1'" >&2
  116.         exit 1
  117.     ;;
  118. esac
  119.  
  120. # dh_installdeb will replace this with shell code automatically
  121. # generated by other debhelper scripts.
  122.  
  123. # Automatically added by dh_installmenu
  124. if [ "$1" = "configure" ] && [ -x "`which update-menus 2>/dev/null`" ]; then
  125.     update-menus
  126. fi
  127. # End automatically added section
  128. # Automatically added by dh_installinit
  129. if [ -x "/etc/init.d/procps" ]; then
  130.     update-rc.d procps start 17 S . >/dev/null
  131.     if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
  132.         invoke-rc.d procps start || exit $?
  133.     else
  134.         /etc/init.d/procps start || exit $?
  135.     fi
  136. fi
  137. # End automatically added section
  138. # Automatically added by dh_makeshlibs
  139. if [ "$1" = "configure" ]; then
  140.     ldconfig
  141. fi
  142. # End automatically added section
  143.  
  144.  
  145. exit 0
  146.  
  147.  
  148.