#!/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 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