summaryrefslogtreecommitdiffstats
path: root/abs/core-testing/LinHES-config-svn
diff options
context:
space:
mode:
authorCecil Hugh Watson <knoppmyth@gmail.com>2009-06-06 21:08:32 (GMT)
committerCecil Hugh Watson <knoppmyth@gmail.com>2009-06-06 21:08:32 (GMT)
commit1801434dc7e6b34c1fb22a7ece0bad3538a5bb20 (patch)
tree83e3ba0c170833b3afcf5f18d4e94ef100f5afd2 /abs/core-testing/LinHES-config-svn
parent816aa5eb71f700980ab5cb4c332c74b831d838a8 (diff)
parenta8b2865581cb2db961008c79ea48f31005b20113 (diff)
downloadlinhes_pkgbuild-1801434dc7e6b34c1fb22a7ece0bad3538a5bb20.zip
linhes_pkgbuild-1801434dc7e6b34c1fb22a7ece0bad3538a5bb20.tar.gz
linhes_pkgbuild-1801434dc7e6b34c1fb22a7ece0bad3538a5bb20.tar.bz2
Merge branch 'HEAD' of ssh://cesman@knoppmyth.net/mount/repository/LinHES-PKGBUILD
Diffstat (limited to 'abs/core-testing/LinHES-config-svn')
-rwxr-xr-xabs/core-testing/LinHES-config-svn/PKGBUILD2
-rwxr-xr-xabs/core-testing/LinHES-config-svn/install_db_chroot.sh136
-rwxr-xr-xabs/core-testing/LinHES-config-svn/install_functions.sh54
-rwxr-xr-xabs/core-testing/LinHES-config-svn/install_proxy.sh4
4 files changed, 125 insertions, 71 deletions
diff --git a/abs/core-testing/LinHES-config-svn/PKGBUILD b/abs/core-testing/LinHES-config-svn/PKGBUILD
index 2927a6e..32645a2 100755
--- a/abs/core-testing/LinHES-config-svn/PKGBUILD
+++ b/abs/core-testing/LinHES-config-svn/PKGBUILD
@@ -1,6 +1,6 @@
pkgname=LinHES-config-svn
pkgver=1.0
-pkgrel=294
+pkgrel=299
conflicts=(MythVantage-config MythVantage-config-dev LinHES-config-dev )
pkgdesc="Install and configure your system"
depends=(bc libstatgrab mysql-python expect curl dnsutils parted sg3_utils nmbscan system-templates )
diff --git a/abs/core-testing/LinHES-config-svn/install_db_chroot.sh b/abs/core-testing/LinHES-config-svn/install_db_chroot.sh
index 1a0131e..808dbb9 100755
--- a/abs/core-testing/LinHES-config-svn/install_db_chroot.sh
+++ b/abs/core-testing/LinHES-config-svn/install_db_chroot.sh
@@ -6,58 +6,112 @@
myhost=$hostname
hostname $myhost
echo $myhost > /etc/hostname
-echo "install_db_chroot hostname is $hostname"
+echo "$0 hostname is $hostname"
. $MV_ROOT/bin/install_functions.sh
#myhost=`cat /etc/hostname`
-#mount -t proc none /proc
-pacman --noconfirm -Sf mysql
-/etc/rc.d/mysqld
-
-status=1
-mysqlstatus=1
-while [ ! $status = 0 ]
-do
- /etc/rc.d/mysqld stop
- sleep 1
- /etc/rc.d/mysqld start
- mysqlstatus=$?
- if [ $mysqlstatus = 0 ]
- then
- mysql -e "show databases;"
- showstatus=$?
- if [ $showstatus = 0 ]
- then
- pacman --noconfirm -R mythdb-initial
- pacman --noconfirm -S mythdb-initial
- $MV_ROOT/bin/restore_default_settings.sh -c load
- DISPLAY=127.0.0.1:0 $MV_ROOT/bin/MythVantage -t restore,default_1
- $MV_ROOT/bin/restore_default_settings.sh -c restore -t syssettings
- $MV_ROOT/bin/systemconfig.sh misc,hostype,this_is_install
-
- update_db_settings HostServiceMythWEB "1"
- echo 'UseMythWEB="1"' >> /etc/systemconfig
-
- #update database to allow user jobs on this host.
- $MV_ROOT/bin/restore_default_settings.sh -c USERJOBALLOW
- $MV_ROOT/bin/restore_default_settings.sh -c ACCESSCONTROL
- if [ -d /data/srv/mysql/mythconverg ]
- #if [ -d /var/lib/mysql/mythconverg ]
- then
+# Before this script is called, the mysqld that facilitated the installation is killed.
+# We need to make sure to stop and start the mysqld that will be used post-install so
+# that the database can be initialized.
+
+/etc/rc.d/mysqld stop
+killall -9 mysqld
+/etc/rc.d/mysqld start
+sleep 1
+
+# Put a limit on how many times we try to (re-)start MySQL
+success_test() {
+ # parameter: number of tries to start mysqld so far
+ PID=`pidof -o %PPID /usr/sbin/mysqld`
+ if [ -z "$PID" ]; then # mysqld isn't running
+ if [ $1 -gt 3 ]; then
+ echo "ERROR: Failed to start MySQL server in $1 attempts."
+ sleep 5
+ exit 1
+ else
+ echo "Tried $1 time(s) to start MySQL server."
+ return 1
+ fi
+ else # mysqld is running
+ return 0
+ fi
+ # should never get here
+ return 1
+}
+
+mysqld_tries=0
+# See if MySQL server is running; try several ways to start it if it's not.
+while true; do
+ success_test $mysqld_tries
+ if [ $? -eq 0 ]; then
+ echo "MySQL server is running"
+ break
+ else
+ echo "MySQL server is not running. Trying to start it."
+ # Maybe it just needs to be started
+ sleep 1
+ /etc/rc.d/mysqld start
+ mysqld_tries=$((mysqld_tries + 1))
+ success_test $mysqld_tries
+ if [ $? -eq 0 ]; then
+ echo "MySQL server has been started"
+ break
+ else
+ echo "MySQL server may not be installed. Trying to install it."
+ # Maybe it's not installed; try (re-)installing it and starting it
+ sleep 1
+ pacman --noconfirm -Sf mysql
+ sleep 1
+ /etc/rc.d/mysqld start
+ mysqld_tries=$((mysqld_tries + 1))
+ success_test $mysqld_tries
+ if [ $? -eq 0 ]; then
+ echo "MySQL server has been installed and started"
+ break
+ else
+ echo "MySQL server would not start, even after (re-)installing it."
+ fi
+ fi
+ fi
+done
+
+# At this point, MySQL server should be up and running
+
+while true; do
+ mysql -e "show databases;"
+
+ if [ $? -eq 0 ]; then
+ pacman --noconfirm -R mythdb-initial
+ pacman --noconfirm -S mythdb-initial
+ $MV_ROOT/bin/restore_default_settings.sh -c load
+ DISPLAY=127.0.0.1:0 $MV_ROOT/bin/MythVantage -t restore,default_1
+ $MV_ROOT/bin/restore_default_settings.sh -c restore -t syssettings
+ $MV_ROOT/bin/systemconfig.sh misc,hostype,this_is_install
+
+ update_db_settings HostServiceMythWEB "1"
+ echo 'UseMythWEB="1"' >> /etc/systemconfig
+
+ #update database to allow user jobs on this host.
+ $MV_ROOT/bin/restore_default_settings.sh -c USERJOBALLOW
+ $MV_ROOT/bin/restore_default_settings.sh -c ACCESSCONTROL
+ #if [ -d /var/lib/mysql/mythconverg ]
+ if [ -d /data/srv/mysql/mythconverg ]; then
# pacman --noconfirm -R webcalendar
# pacman --noconfirm --nodeps -S webcalendar
- status=0
- fi
+ break
+ else
+ echo "Failed to create mythconverg database. Will re-try."
+ sleep 1
+ fi
# if [ $SystemType = "Master_backend" ]
# then
# $MV_ROOT/bin/restore_default_settings.sh -c BECONFIG -s master -a $dbhost
# fi
- fi
+ else
+ echo "Failed to look for databases. Will re-try."
+ sleep 1
fi
done
/etc/rc.d/mysqld stop
#umount /proc
-
-
-
diff --git a/abs/core-testing/LinHES-config-svn/install_functions.sh b/abs/core-testing/LinHES-config-svn/install_functions.sh
index ddade6d..4f6f7ed 100755
--- a/abs/core-testing/LinHES-config-svn/install_functions.sh
+++ b/abs/core-testing/LinHES-config-svn/install_functions.sh
@@ -38,7 +38,7 @@ update_db_settings Theme "$pick"
function splash_setup (){
echo $CMDLINE | grep -q splash=silent
- if [ $? = 0 ]
+ if [ $? -eq 0 ]
then
update_db_settings Hostbootsplash 1
else
@@ -61,7 +61,7 @@ function setupremote {
update_db_settings HostRemoteType "$Remotetype"
#special case for special remote
echo "Starting with support for $Remotetype"
- if [ x$Remotetype = "xdvico" ]
+ if [ "$Remotetype" == "dvico" ]
then
/usr/sbin/lircd -d /dev/usb/hiddev0
else
@@ -79,7 +79,7 @@ echo "Scanning for Hauppauge receiver"
for hpgid in `lspci -nm -d4444: |cut -d" " -f6- |tr -d '"'|tr " " :`
do
line=`grep $hpgid $TEMPLATES/remotes/i2c.id`
- if [ $? = 0 ]
+ if [ $? -eq 0 ]
then
modprobe lirc_i2c
FoundReceiverType=`echo "$line"|cut -d"|" -f2`
@@ -102,7 +102,7 @@ while read line
do
USBID=`echo "$line"|cut -d"|" -f1`
lsusb -d "$USBID" > /dev/null 2>/dev/null
- if [ $? = 0 ]
+ if [ $? -eq 0 ]
then
Remotetype=`echo "$line"|cut -d"|" -f2`
echo "Found $Remotetype"
@@ -111,7 +111,7 @@ do
break
fi
done <$BASE/$TEMPLATES/remotes/receiver_usb.id
-if [ $found_remote = 1 ]
+if [ $found_remote -eq 1 ]
then
scan_for_hpg_receiver
fi
@@ -125,7 +125,7 @@ fi
function rest_of_network () {
#netmask
echo $CMDLINE | grep -q netmask
- if [ $? = 0 ]
+ if [ $? -eq 0 ]
then
TEMPVAR=${CMDLINE#*netmask=}
NETMASK=${TEMPVAR%% *}
@@ -139,7 +139,7 @@ function rest_of_network () {
fi
#gateway
echo $CMDLINE | grep -q gateway
- if [ $? = 0 ]
+ if [ $? -eq 0 ]
then
TEMPVAR=${CMDLINE#*gateway=}
GATEWAY=${TEMPVAR%% *}
@@ -152,7 +152,7 @@ function rest_of_network () {
#dns
echo $CMDLINE | grep -q dns
- if [ $? = 0 ]
+ if [ $? -eq 0 ]
then
TEMPVAR=${CMDLINE#*dns=}
DNS=${TEMPVAR%% *}
@@ -165,7 +165,7 @@ function rest_of_network () {
function init_network {
echo $CMDLINE |grep -q netdev
- if [ $? = 0 ]
+ if [ $? -eq 0 ]
then
TEMPVAR=${CMDLINE#*netdev=}
MYTHDEFAULT=${TEMPVAR%% *}
@@ -176,7 +176,7 @@ function init_network {
echo $CMDLINE | grep -q ip
- if [ $? = 0 ]
+ if [ $? -eq 0 ]
then
update_db_settings HostDefaulteth0 0
update_db_settings HostDefault${MYTHDEFAULT} 1
@@ -187,7 +187,7 @@ function init_network {
TEMPVAR=${CMDLINE#*ip=}
IP=${TEMPVAR%% *}
- if [ x$IP = xdhcp ]
+ if [ "$IP" == "dhcp" ]
then
/sbin/dhcpcd $MYTHDEFAULT
update_db_settings HostUseDHCP${MYTHDEFAULT} 0
@@ -202,11 +202,11 @@ function init_network {
function init_remote {
echo $CMDLINE | grep -q remoteport
- if [ $? = 0 ]
+ if [ $? -eq 0 ]
then
TEMPVAR=${CMDLINE#*remoteport=}
REMOTEPORT=${TEMPVAR%% *}
- if [ x"$ReceiverType" = "xSerial" ]
+ if [ "$ReceiverType" == "Serial" ]
then
if [ -e /dev/$REMOTEPORT ]
then
@@ -220,7 +220,7 @@ function init_remote {
fi
echo $CMDLINE | grep -q remote
- if [ $? = 0 ]
+ if [ $? -eq 0 ]
then
TEMPVAR=${CMDLINE#*remote=}
Remotetype=${TEMPVAR%% *}
@@ -239,7 +239,7 @@ ROOT=$1
DATA=$2
SWAP=$3
-if [ ! x$SWAP = xNO ]
+if [ "$SWAP" != "NO" ]
then
SWAPLINE=",$SWAP,S"
MKSWAPCMD="mkswap /dev/${disk}2"
@@ -248,7 +248,7 @@ if [ ! x$SWAP = xNO ]
MKSWAPCMD=""
fi
-if [ x$DATA = xALL ]
+if [ "$DATA" == "ALL" ]
then
DATALINE=",,,"
EXTRALINE=""
@@ -315,7 +315,7 @@ unmount_it () {
copy_it () {
- if [ x$1 = xALL ]
+ if [ "$1" == "ALL" ]
then
echo "Transferring system"
unsquashfs -f -d /$mountpoint /.livesys/medium/system.sqf
@@ -403,7 +403,7 @@ function find_uuid() {
get_grub_map() {
- rm /tmp/dev.map
+ [ -e /tmp/dev.map ] && rm /tmp/dev.map
/sbin/grub --no-floppy --device-map /tmp/dev.map <<EOF
quit
EOF
@@ -422,17 +422,17 @@ mapdev() {
fi
for dev in $devs
do
- if [ "(" = $(echo $dev | cut -b1) ]; then
+ if [ "(" == $(echo $dev | cut -b1) ]; then
grubdevice="$dev"
else
- if [ "$dev" = "$linuxdevice" ]; then
+ if [ "$dev" == "$linuxdevice" ]; then
device_found=1
break
fi
fi
done
- if [ "$device_found" = "1" ]; then
- if [ "$partition_flag" = "0" ]; then
+ if [ "$device_found" == "1" ]; then
+ if [ "$partition_flag" == "0" ]; then
echo "$grubdevice"
else
grubdevice_stringlen=${#grubdevice}
@@ -461,7 +461,7 @@ dogrub() {
#/usr/sbin/xfs_freeze -f /$mountpoint > /dev/null 2>&1
echo "freezing xfs fs"
/usr/sbin/xfs_freeze -f /$mountpoint
- if [ $? = 0 ]
+ if [ $? -eq 0 ]
then
sleep 40
echo "unfreezing xfs"
@@ -531,7 +531,7 @@ case $1 in
create_fstab
fi
#was 5
- if [ x$3 = xUPGRADE ]
+ if [ "$3" == "UPGRADE" ]
then
if [ ! -f /tmp/etc/KnoppMyth-version ]
then
@@ -558,11 +558,11 @@ case $1 in
SWAPUUID=$FOUNDUUID
FOUNDUUID=""
- if [ x$4 = x ]
+ if [ "$4" == "" ]
then
#upgrade
find_uuid ${2}3
- elif [ x$5 = xFULL_INSTALL ]
+ elif [ "$5" == "FULL_INSTALL" ]
then
#install
find_uuid ${2}3
@@ -585,7 +585,7 @@ case $1 in
if [ -f /tmp/etc/fstab ]
then
grep -q /dev/vg /tmp/etc/fstab
- if [ $? = 0 ]
+ if [ $? -eq 0 ]
then
grep /dev/vg /tmp/etc/fstab >> /$mountpoint/etc/fstab
grep /dev/vg /tmp/etc/fstab | awk -v mount=$mountpoint ' { print "/" mount $2 }' |xargs mkdir
diff --git a/abs/core-testing/LinHES-config-svn/install_proxy.sh b/abs/core-testing/LinHES-config-svn/install_proxy.sh
index 3f626a1..32d01d7 100755
--- a/abs/core-testing/LinHES-config-svn/install_proxy.sh
+++ b/abs/core-testing/LinHES-config-svn/install_proxy.sh
@@ -174,7 +174,7 @@ full_install () {
sleep 1
$run partition_it $disk $rootsize $datasize $swapsize
- echo "Formating $disk" > /tmp/.install_state
+ echo "Formatting $disk" > /tmp/.install_state
progress 2
sleep 1
$run format_it $disk $rootfs $datafs
@@ -294,7 +294,7 @@ function upgrade () {
if [ ! x$rootfs = "xDo_not_format" ]
then
- echo "Formating $disk" > /tmp/.install_state
+ echo "Formatting $disk" > /tmp/.install_state
progress 2
sleep 1
$run format_it $disk $rootfs NO