From 3c4a93caae5163c0bb80d149da1d74e2fcabb4c6 Mon Sep 17 00:00:00 2001 From: James Meyer Date: Thu, 4 Dec 2008 10:12:07 -0600 Subject: check to make sure mysql& mythconverg are working before starting the install. Currently it's limited to 20 attempts before aborting. closes FS#23 --- .../i686-testing-REMOTE/rootoverlay/etc/rc.local | 46 ++++++++++++++++++++-- .../rootoverlay/etc/rc.local | 46 ++++++++++++++++++++-- .../i686-testing-local/rootoverlay/etc/rc.local | 46 ++++++++++++++++++++-- 3 files changed, 129 insertions(+), 9 deletions(-) diff --git a/build_tools/clarch/larch/profiles/i686-testing-REMOTE/rootoverlay/etc/rc.local b/build_tools/clarch/larch/profiles/i686-testing-REMOTE/rootoverlay/etc/rc.local index fe7cfa6..1047ce4 100755 --- a/build_tools/clarch/larch/profiles/i686-testing-REMOTE/rootoverlay/etc/rc.local +++ b/build_tools/clarch/larch/profiles/i686-testing-REMOTE/rootoverlay/etc/rc.local @@ -5,13 +5,53 @@ . /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 && 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 + -#install initial database -pacman -S --noconfirm mythdb-initial 2>/dev/null #search for remote init_remote @@ -26,7 +66,7 @@ else fi -# Set up automatically logged in user (larch live system only) +# Set up automatically logged in user if [ -f /.livesys/autologin ]; then cp /.livesys/autologin /tmp/newuser fi diff --git a/build_tools/clarch/larch/profiles/i686-testing-local-httpd/rootoverlay/etc/rc.local b/build_tools/clarch/larch/profiles/i686-testing-local-httpd/rootoverlay/etc/rc.local index fe7cfa6..1047ce4 100755 --- a/build_tools/clarch/larch/profiles/i686-testing-local-httpd/rootoverlay/etc/rc.local +++ b/build_tools/clarch/larch/profiles/i686-testing-local-httpd/rootoverlay/etc/rc.local @@ -5,13 +5,53 @@ . /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 && 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 + -#install initial database -pacman -S --noconfirm mythdb-initial 2>/dev/null #search for remote init_remote @@ -26,7 +66,7 @@ else fi -# Set up automatically logged in user (larch live system only) +# Set up automatically logged in user if [ -f /.livesys/autologin ]; then cp /.livesys/autologin /tmp/newuser fi diff --git a/build_tools/clarch/larch/profiles/i686-testing-local/rootoverlay/etc/rc.local b/build_tools/clarch/larch/profiles/i686-testing-local/rootoverlay/etc/rc.local index fe7cfa6..1047ce4 100755 --- a/build_tools/clarch/larch/profiles/i686-testing-local/rootoverlay/etc/rc.local +++ b/build_tools/clarch/larch/profiles/i686-testing-local/rootoverlay/etc/rc.local @@ -5,13 +5,53 @@ . /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 && 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 + -#install initial database -pacman -S --noconfirm mythdb-initial 2>/dev/null #search for remote init_remote @@ -26,7 +66,7 @@ else fi -# Set up automatically logged in user (larch live system only) +# Set up automatically logged in user if [ -f /.livesys/autologin ]; then cp /.livesys/autologin /tmp/newuser fi -- cgit v0.12