summaryrefslogtreecommitdiffstats
path: root/build_tools/archiso-19/mythvantage/airootfs/root/linhes_install/pre_install.sh
blob: f9e9c5a1f6c341a9b3118a923162245c73addb62 (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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#!/bin/bash
#
# /etc/rc.local: Local multi-user startup script.
#
. /etc/rc.conf
. /etc/rc.d/functions
. /etc/profile
. ${MV_ROOT}/bin/install_functions.sh
umount /tmp
clear


ln -s /var-lib-pacman/sync /var/lib/pacman/sync

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
}


#set bootdev.txt for shutdown eject in archiso_shutdown
mount|grep bootmnt|cut -f1 -d" " > /run/initramfs/bootdev.txt
cp -f /usr/bin/eject /run/initramfs/usr/bin/eject

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

#check network parms
stat_busy "Checking network"
init_network
stat_done

stat_busy "Probing network"
request_dhcp &
stat_done

#save some cmdline options
stat_busy "Parsing command line"
parse_cmdline_2_db
bootsplash_setup
stat_done

#search for remote
stat_busy "Checking for remote"
init_remote
stat_done
printhl "Finished"

#creating /myth for live cd
. /usr/MythVantage/bin/mv_config.py
HDIR=`dirname $MYTHHOME`
mkdir -p $HDIR
useradd -b $HDIR -m -p "" -G "audio,disk,optical,wheel,storage,video,users" mythtv
chown -R mythtv.mythtv $MYTHHOME
#creating mountpoint  for live cd
mkdir -p $DATAMOUNT
create_media_dirs.sh $DATAMOUNT
chown -R mythtv.mythtv  $DATAMOUNT/media



printhl "Finished"
systemctl start dbus 
systemctl start avahi-daemon 

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

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