home *** CD-ROM | disk | FTP | other *** search
/ PC World 2001 April / PCWorld_2001-04_cd.bin / Software / TemaCD / webclean / debian / postinst < prev    next >
Text File  |  2000-12-16  |  2KB  |  66 lines

  1. #!/bin/sh
  2. # postinst script for webcleaner
  3. #
  4. # see: dh_installdeb(1)
  5. set -e
  6.  
  7. . /usr/share/debconf/confmodule
  8. db_version 2.0
  9.  
  10. # summary of how this script can be called:
  11. #        * <postinst> `configure' <most-recently-configured-version>
  12. #        * <old-postinst> `abort-upgrade' <new version>
  13. #        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
  14. #          <new-version>
  15. #        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
  16. #          <failed-install-package> <version> `removing'
  17. #          <conflicting-package> <version>
  18. # for details, see /usr/doc/packaging-manual/
  19. #
  20. # quoting from the policy:
  21. #     Any necessary prompting should almost always be confined to the
  22. #     post-installation script, and should be protected with a conditional
  23. #     so that unnecessary prompting doesn't happen if a package's
  24. #     installation fails and the `postinst' is called with `abort-upgrade',
  25. #     `abort-remove' or `abort-deconfigure'.
  26.  
  27. package=webcleaner
  28. DIRLIST="/usr/lib/python1.5/site-packages/webfilter /usr/lib/python1.5/site-packages/webparser"
  29. FILELIST="WebCleanerConf.py"
  30. SITEPACKAGES="/usr/lib/python1.5/site-packages"
  31. COMMAND="'import sys,py_compile;py_compile.compile(sys.argv[1])'"
  32.  
  33. case "$1" in
  34.     configure|abort-upgrade|abort-remove|abort-deconfigure)
  35.         for i in $DIRLIST ; do
  36.             python -O /usr/lib/python1.5/compileall.py -q $i
  37.             python /usr/lib/python1.5/compileall.py -q $i
  38.         done
  39.     # use /bin/sh -c, otherwise I get a SyntaxError from Python
  40.         for i in $FILELIST; do
  41.             /bin/sh -c "python -O -c $COMMAND $SITEPACKAGES/$i"
  42.             /bin/sh -c "python -c $COMMAND $SITEPACKAGES/$i"
  43.         done
  44.     ;;
  45.     *)
  46.         echo "postinst called with unknown argument \`$1'" >&2
  47.         exit 0
  48.     ;;
  49. esac
  50.  
  51. if [ "$1" = "configure" ]; then
  52.     . /usr/share/debconf/confmodule
  53.     db_version 2.0
  54.     db_get $package/port
  55.     test -n "$RET" || RET="8080"
  56.     sed -e "s/ port=.*/ port=\"$RET\"/" /etc/$package/$package.conf > /etc/$package/$package.conf.tmp
  57.     mv -f /etc/$package/$package.conf.tmp /etc/$package/$package.conf
  58. fi
  59.  
  60. # dh_installdeb will replace this with shell code automatically
  61. # generated by other debhelper scripts.
  62.  
  63. #DEBHELPER#
  64.  
  65. exit 0
  66.