summaryrefslogtreecommitdiff
path: root/language/thai/thailatex/scripts/sync-thailatex.in
blob: d4ed85ee12f4ec4077275f11d36d698aabd82b5b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/sh
# Register/unregister thailatex
# Written by Theppitak Karoonboonyanan <thep@linux.thai.net>
# License: GPL

prefix=@prefix@

EMACSLISPDIR=@emacsdir@/site-lisp

do_install()
{
  echo "Regenerating TeX ls-R ..."
  @TEXHASH@

  # add Emacs macro for activating Thai LaTeX filter
  echo "Installing emacs macro ..."
  if test -f $EMACSLISPDIR/site-start.el; then
    sed -i -e '/thai-latex-setup/d' $EMACSLISPDIR/site-start.el
  fi
  if test -f $EMACSLISPDIR/thai-latex-setup.el; then
    echo '(load-library "thai-latex-setup")' >> $EMACSLISPDIR/site-start.el
  fi
}

do_uninstall()
{
  echo "Regenerating TeX ls-R ..."
  @TEXHASH@

  # remove Emacs macro for activating Thai LaTeX filter
  echo "Uninstalling emacs macro ..."
  if test -f $EMACSLISPDIR/site-start.el; then
    sed -i -e '/thai-latex-setup/d' $EMACSLISPDIR/site-start.el
  fi
}

# Main script

if test -f $EMACSLISPDIR/thai-latex-setup.el; then
  echo "ThaiLaTeX macro exists, so we will enable it."
  do_install
else
  echo "ThaLaTeX macro no longer exists, so we will disable it."
  do_uninstall
fi