infodir=/usr/share/info
filelist=(auctex.info.gz preview-latex.info.gz)

post_install() {
  post_upgrade $1

cat << EOF
==> For GNU Emacs, the recommended way to activate AUCTeX and preview-latex is to add the
==> following lines to your ~/.emacs file:
(load "auctex.el" nil t t)
(load "preview-latex.el" nil t t)
EOF
}

post_upgrade() {
  texconfig-sys rehash 2> /dev/null

  [ -x usr/bin/install-info ] || return 0
  for file in ${filelist[@]}; do
    install-info $infodir/$file $infodir/dir 2> /dev/null
  done
}

pre_remove() {
 texconfig-sys rehash 2> /dev/null

  [ -x usr/bin/install-info ] || return 0
  for file in ${filelist[@]}; do
    install-info --delete $infodir/$file $infodir/dir 2> /dev/null
   done
}
