summaryrefslogtreecommitdiffstats
path: root/build_tools/clarch/larch/profiles/i686-testing-local/rootoverlay/etc/rc.local
blob: 059c4bfa599cd2b826c40887458e3c61c014157b (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
#!/bin/bash
#
# /etc/rc.local: Local multi-user startup script.
#
. /etc/profile
. ${MV_ROOT}/bin/install_functions.sh

function mysql_check {
	mysql -e "show databases;" 2>/dev/null >/dev/null
	return $?
}

function mythconverg_check {
    mysql mythconverg -e "describe settings;" 2>/dev/null >/dev/null
    return $?
}

function install_db {
    pacman --noconfirm -R mythdb-initial 2>/dev/null > /dev/null
    pacman -S --noconfirm mythdb-initial 2>/dev/null > /dev/null
}


#check network parms
init_network

#check to see if mysql is running
ATTEMPT=0
mysql_check && echo "Installing the initial database" &&install_db
mythconverg_check
status=$?
while [ ! $status = 0  ]
do
    ((ATTEMPT=ATTEMPT+1))
    /etc/rc.d/mysqld stop
    sleep 2
    /etc/rc.d/mysqld start
    mysqlstatus=$?
    if [ $mysqlstatus = 0 ]
    then
	mysql_check && install_db
	mythconverg_check
        status=$?
    fi
    if [ $ATTEMPT = 20 ]
    then
	echo "Could not start mysql or install mythconverg within 20 attempts"
	echo "Aborting install"
	exit 20
    fi
done




#search for remote
init_remote
splash_setup

echo $CMDLINE | grep -qi NoX
if [ $? = 0 ]
then
    echo "No auto X option found"
   # /usr/bin/chvt 2
else
    /root/startx &
fi


# Set up automatically logged in user
if [ -f /.livesys/autologin ]; then
    cp /.livesys/autologin /tmp/newuser
fi