summaryrefslogtreecommitdiffstats
path: root/abs/extra/mythexport/mythexport.install
blob: 361f1e551cb6be45743b0352dc3993bd6aee4fcf (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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# arg 1:  the new package version
post_install() {
  if [ ! -d /myth/mythexport ];then
  mkdir /myth/mythexport
  fi
  if [ ! -d /var/run/mythtv ];then
  mkdir /var/run/mythtv
  fi
  if [ ! -d /srv/http/.mythtv ];then
  mkdir /srv/http/.mythtv
  fi
  chown -R mythtv:mythtv /myth/mythexport

	mysql -u root mythconverg < /usr/share/mythtv/mythexport.sql
	ln -s /usr/share/mythtv/mythexport /data/srv/httpd/htdocs/
	ln -s /myth/mythexport /usr/share/mythtv/mythexport/video
	ln -s /home/mythtv/.mythtv/config.xml /srv/http/.mythtv
	chown mythtv:mythtv /var/run/mythtv
	chown -R mythtv:mythtv /etc/mythtv

  COUNT=`grep -c "include \"/etc/mythexport/mythexport.lighttpd.include\"" /etc/lighttpd/conf.include`

  if [ $COUNT == 0 ] ; then
    echo "==> Adding mythexport.lighttpd.include to conf.include"
    echo "include \"/etc/mythexport/mythexport.lighttpd.include\"" >> \
         /etc/lighttpd/conf.include
  fi

  echo ""
  echo "==> Forcing a re-read of lighttpd's configuration file."
  echo ""
    /sbin/sv hup /service/lighttpd

  echo ""
  echo "==> Adding the mythexport service to start the mythexport daemon"
    add_service.sh mythexport
  echo ""
  echo "==> Starting MythExport..."
    /sbin/sv start mythexport

  echo ""
  echo "==> For move information on setup and configuration:"
  echo "==> http://www.linhes.org/bugs/projects/linhes/wiki/HOWTO_Setup_MythExport_for_iPod"
  echo ""

}

post_upgrade() {

  COUNT=`grep -c "include \"/etc/mythexport/mythexport.lighttpd.include\"" /etc/lighttpd/conf.include`

  if [ $COUNT == 0 ] ; then
    echo "==> Adding mythexport.lighttpd.include to conf.include"
    echo "include \"/etc/mythexport/mythexport.lighttpd.include\"" >> \
         /etc/lighttpd/conf.include
  fi

  echo ""
  echo "==> Forcing a re-read of lighttpd's configuration file."
  echo ""
    /sbin/sv hup /service/lighttpd

}

pre_remove() {

  remove_service.sh mythexport

}

post_remove() {

  COUNT=`grep -c "include \"/etc/mythexport/mythexport.lighttpd.include\"" /etc/lighttpd/conf.include`

  if [ $COUNT -gt 0 ] ; then
    echo "==> Removing mythexport.lighttpd.include from conf.include"
    sed -e 's#include \"/etc/mythexport/mythexport.lighttpd.include\"##' -i \
         /etc/lighttpd/conf.include
  fi

  echo ""
  echo "==> Forcing re-read of lighttpd's configuration file."
  echo ""
    /sbin/sv hup /service/lighttpd
}



op=$1
shift
$op $*