source: src-qt4/xtrafiles/local/share/pcbsd/scripts/mythtv.sh @ e4d9ea3

9.2-releasereleng/10.0releng/10.0.1releng/10.0.2
Last change on this file since e4d9ea3 was e4d9ea3, checked in by Kris Moore <kris@…>, 12 months ago

Fix a bug enabling mythtv due to missing tzinfo

Thanks Dru!

  • Property mode set to 100755
File size: 2.1 KB
Line 
1#!/bin/sh
2# Script to start mythtv and init
3
4SCRIPT="/usr/local/share/pcbsd/scripts/mythtv.sh"
5
6# Make sure we are running as root
7as_root() {
8        if [ "`id -u`" != "0" ] ; then
9                echo "ERROR: Must be run as root!"
10                exit
11        fi
12}
13
14check_init()
15{
16        if [ ! -e "/var/log/mythinit.log" -o "$1" = "init" ] ; then
17                pc-su xterm -e ${SCRIPT} doinit
18        fi
19}
20
21do_init() 
22{
23        as_root
24        echo "Starting mysql-server..."
25        /usr/local/etc/rc.d/mysql-server stop >/dev/null 2>/dev/null
26        killall -9 mysqld >/dev/null 2>/dev/null
27        killall -9 mysqld_safe >/dev/null 2>/dev/null
28        /usr/local/etc/rc.d/mysql-server start >/dev/null 2>/dev/null
29
30        # Do we need a password?
31        echo "?;" | mysql --user=root >/dev/null 2>/dev/null
32        if [ $? -eq 0 ] ; then PASS="" ; else PASS="-p" ; fi
33       
34        echo "Creating mysql database / user..."
35        mysql --user=root $PASS < /usr/local/share/mythtv/database/mc.sql
36
37        # Enable the tzinfo
38        mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -uroot ${PASS} mysql
39
40        echo "Preparing to start mythtv setup..."
41        do_setup
42
43        echo "Starting MythTV backend..."
44        /usr/local/etc/rc.d/mythbackend stop >/dev/null 2>/dev/null
45        /usr/local/etc/rc.d/mythbackend start >/dev/null 2>/dev/null
46        echo "MythTV configured `date`" > /var/log/mythinit.log
47
48        echo "Finished! Press ENTER to continue."
49        read tmp
50        exit 0
51}
52
53# Run the setup program
54do_setup() 
55{
56        as_root
57        mythtv-setup
58        /usr/local/etc/rc.d/mythbackend stop >/dev/null 2>/dev/null
59        /usr/local/etc/rc.d/mythbackend start >/dev/null 2>/dev/null
60}
61
62check_setup()
63{
64        if [ "$1" = "setup" ] ; then
65                pc-su xterm -e ${SCRIPT} dosetup
66        fi
67}
68
69check_installed()
70{
71        which mythfrontend >/dev/null 2>/dev/null
72        if [ $? -ne 0 ] ; then
73                echo "ERROR: MythTV is not installed!" 
74                exit 1
75        fi
76};
77
78check_backend()
79{
80        # Lets check if the backend is running
81        ps -awwxc | grep mythbackend >/dev/null 2>/dev/null
82        if [ $? -ne 0 ] ; then
83                zenity --question --text "The mythbackend daemon is not running. Do you wish to re-run the configuration? "
84                if [ $? -eq 1 ] ; then
85                        exit 1
86                fi
87                check_setup setup
88                exit 0
89        fi
90};
91
92check_installed
93
94case $1 in
95        doinit) do_init ; exit 0 ;;
96        dosetup) do_setup ; exit 0 ;;
97        *) ;;
98esac
99
100check_init $1
101check_setup $1
102check_backend
103
104mythfrontend
Note: See TracBrowser for help on using the repository browser.