From 3cc7a26ef6ce5928401162cff95e8a860c8daa36 Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Sun, 4 Jan 2009 10:42:01 -0600
Subject: Only check for VGA cards by nvidia, instead of all things nvidia.

---
 abs/core-testing/LinHES-config/xconfig.sh | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/abs/core-testing/LinHES-config/xconfig.sh b/abs/core-testing/LinHES-config/xconfig.sh
index db03e6f..ef3e836 100755
--- a/abs/core-testing/LinHES-config/xconfig.sh
+++ b/abs/core-testing/LinHES-config/xconfig.sh
@@ -12,8 +12,9 @@ function Xvalues {
         VGACARDTYPE=vesa
     else
         VGACARDTYPE=`lspci|grep -i vga|sort -r|head -n 1| cut -d: -f3|cut -d" " -f 2`
-        CARDID=`lspci -n |grep 10de | cut -d" " -f3 |cut -d: -f2    `
-        VENDORID=`lspci -n |grep 10de | cut -d" " -f3 |cut -d: -f1`
+        VGAPCIID=`lspci|grep -i vga|sort -r|head -n 1| cut -d" " -f1`
+        CARDID=`lspci -n |grep $VGAPCIID|grep 10de | cut -d" " -f3 |cut -d: -f2    `
+        VENDORID=`lspci -n |grep $VGAPCIID|grep 10de | cut -d" " -f3 |cut -d: -f1`
     fi
     echo $VGACARDTYPE
     currentmode=`cat $BASE/etc/X11/xorg.conf |grep Modes|awk -Fs ' { print $2 } '`
@@ -142,9 +143,9 @@ echo "#doing the advanced" > /tmp/options
                             HS="#Hsync edid used "
                             VR="#Vertrefresh edid used "
                     fi
-                
+
                 echo "Option \"ForceMonitors\" \"$ConnectedMonitor\"" >> /tmp/options
-                
+
                 sed -e "s/^.*Modes.*$/\t $ML/" \
                 -e "/INSERT MODELINE/r  $TEMPLATES/xorg/modeline.$Xcatagory" \
                 -e "s/^.*DisplaySize.*$/  $DS/" \
@@ -175,13 +176,14 @@ function setupX {
 			    #nvidia check right here
                             grep -q $CARDID $NVIDIA_96XX
                             if [ $? = 0 ]
-                            then 
+                            then
                                 #install 96xx drivers
-                                echo "installing nvidia 96xx drivers" 
+                                echo "installing nvidia 96xx drivers"
                                 pacman --noconfirm  -R libgl-dri > /dev/null 2>&1
                                 pacman --noconfirm  -S nvidia-96xx nvidia-96xx-utils  > /dev/null 2>&1
                             else
                                 #install latest drivers
+                                echo "installing current nvidia drivers"
                                 pacman --noconfirm  -R libgl-dri > /dev/null 2>&1
                                 pacman --noconfirm  -S nvidia nvidia-utils > /dev/null 2>&1
                             fi
@@ -214,7 +216,7 @@ function setupX {
     *)      XCONF=/root/xorg.conf.new
             X -configure
             grep -v Modes  $XCONF | sed -e '/Depth.*16/a Modes "800x600"' -e '/Depth.*24/a Modes "800x600"' -e 's/dev\/mouse/dev\/psaux/g'> $XORG_CONF
-            rm -f $XCONF 2>&1 > /dev/null 
+            rm -f $XCONF 2>&1 > /dev/null
         ;;
         esac
     fi
-- 
cgit v0.12


From 29e945b91760568116a21e0076fae046b33a2663 Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Sun, 4 Jan 2009 12:49:09 -0600
Subject: Add more useful debugging output. Cleanup some error messages.
 introduce cp_and_log function. introduce kill_dhcp_chroot fix umounting of
 /new_boot fix copying of mdadm.conf

---
 abs/core-testing/LinHES-config/PKGBUILD            |   2 +-
 .../LinHES-config/install_db_chroot.sh             |  18 ++-
 .../LinHES-config/install_functions.sh             |   3 +
 abs/core-testing/LinHES-config/install_proxy.sh    | 155 +++++++++++++--------
 abs/core-testing/LinHES-config/networkconfig.sh    |  20 ++-
 .../LinHES-config/restore_km_db_chroot.sh          |   8 +-
 abs/core-testing/LinHES-config/systemconfig.sh     |  96 ++++++++-----
 7 files changed, 199 insertions(+), 103 deletions(-)

diff --git a/abs/core-testing/LinHES-config/PKGBUILD b/abs/core-testing/LinHES-config/PKGBUILD
index 68f88c9..1a9a0be 100755
--- a/abs/core-testing/LinHES-config/PKGBUILD
+++ b/abs/core-testing/LinHES-config/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=LinHES-config
 pkgver=1.0
-pkgrel=115
+pkgrel=141
 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 )
diff --git a/abs/core-testing/LinHES-config/install_db_chroot.sh b/abs/core-testing/LinHES-config/install_db_chroot.sh
index 1ec8cec..5dcef79 100755
--- a/abs/core-testing/LinHES-config/install_db_chroot.sh
+++ b/abs/core-testing/LinHES-config/install_db_chroot.sh
@@ -1,10 +1,17 @@
 #!/bin/bash
 . /etc/profile
 . /etc/systemconfig
-#myhost=`cat /etc/hostname`
+
+
 myhost=$hostname
 hostname $myhost
-mount -t proc none /proc
+echo $myhost > /etc/hostname
+echo "install_db_chroot 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
 
@@ -32,20 +39,23 @@ do
             then
                 $MV_ROOT/bin/restore_default_settings.sh  -c  BECONFIG  -s master  -a $dbhost
             fi
+            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
-	 #   pacman --noconfirm -R webcalendar
+   	     # pacman --noconfirm -R webcalendar
          #   pacman --noconfirm --nodeps  -S webcalendar
 	    status=0
 	   fi
    	fi
     fi
 done
-#/etc/rc.d/mysqld stop
+/etc/rc.d/mysqld stop
 #umount /proc
 
 
diff --git a/abs/core-testing/LinHES-config/install_functions.sh b/abs/core-testing/LinHES-config/install_functions.sh
index d976dbb..f9b2a4c 100755
--- a/abs/core-testing/LinHES-config/install_functions.sh
+++ b/abs/core-testing/LinHES-config/install_functions.sh
@@ -13,6 +13,7 @@ BASE=""
 
 function update_db_settings () {
 
+ echo "setting database value $1 to $2 for $hostname"
  $MYSQLCMD_C "delete from settings where value='${1}' and hostname=\"$hostname\";"
  $MYSQLCMD_C "REPLACE INTO  settings set value='${1}', data='${2}' , hostname=\"$hostname\";"
 }
@@ -289,6 +290,8 @@ mount_it () {
 unmount_it () {
         umount /dev/${disk}1
         umount /dev/${disk}3
+        umount \/$mountpoint/myth
+        umount  \/$mountpoint
 }
 
 
diff --git a/abs/core-testing/LinHES-config/install_proxy.sh b/abs/core-testing/LinHES-config/install_proxy.sh
index f251c70..f950b83 100755
--- a/abs/core-testing/LinHES-config/install_proxy.sh
+++ b/abs/core-testing/LinHES-config/install_proxy.sh
@@ -1,5 +1,6 @@
 #!/bin/bash
 #chroot  and /tmp
+export TERM=vt100
 MVHOSTNAME=larch5
 . /etc/profile
 TEMP_TEMPLATES=/tmp/templates
@@ -19,6 +20,19 @@ BACKUPFILE="/myth/backup/mythconverg.sql.gz"
 #TEMPNET="Hostip"$default_interface
 #eval MYTHIP=\$${TEMPNET}
 
+function cp_and_log () {
+    ls $1 2>&1 >/dev/null
+    status=$?
+    if [ $status = 0 ]
+    then
+        echo "copying $1 to $2"
+        cp -rfp $1 $2
+    else
+        echo "$1 is not present, skipping..."
+    fi
+
+}
+
 
 progress () {
 mypercent=`echo "$1" | cut -d. -f1`
@@ -73,7 +87,7 @@ function upgrade_mount_search {
     if [ $? = 1  ]
     then
         mkdir -p /new_boot/root/backup
-        cp -f /tmp/mythconverg.sql.gz  /new_boot/root/backup/mythconverg.sql.gz
+        cp_and_log  /tmp/mythconverg.sql.gz  /new_boot/root/backup/mythconverg.sql.gz
         BACKUPFILE="/root/backup/mythconverg.sql.gz"
         echo "setting BACKUPFILE to $BACKUPFILE"
     fi
@@ -119,37 +133,48 @@ full_install () {
     echo "Configuring system" > /tmp/.install_state
         progress 100
         sleep 1
-        cp -f /etc/systemconfig "$mountpoint"/etc
+        cp_and_log  /etc/systemconfig "$mountpoint"/etc
         #run save syssettings to save settings, then copy to new mountpoint
         $MV_ROOT/bin/restore_default_settings.sh  -c save -t syssettings -h $MVHOSTNAME -d localhost
         SE=$TEMPLATES/settings/syssettings
         mkdir -p ${mountpoint}$SE
-        cp -rp $SE/*  ${mountpoint}$SE/
+        #cp -rp  $SE/*  ${mountpoint}$SE/
+        cp_and_log "$SE/*"  "${mountpoint}$SE/"
         chown root:mythtv "$mountpoint"/etc/systemconfig
         chown -R mythtv:mythtv ${mountpoint}$SE
 
         chmod -R 775   ${mountpoint}$SE
         chmod 775 "$mountpoint"/etc/systemconfig
         #copy over any updates that might have occured
-        cp -f $MV_ROOT/bin/*.sh "$mountpoint"$MV_ROOT/bin/
+        #cp -rp   $MV_ROOT/bin/*.sh "$mountpoint"$MV_ROOT/bin/
+        cp_and_log   "$MV_ROOT/bin/*.sh" "$mountpoint"$MV_ROOT/bin/
         chmod -R 755 ${mountpoint}/root
-        cp /etc/mtab "$mountpoint"/etc/mtab
+        cp_and_log /etc/mtab "$mountpoint"/etc/mtab
+     #   cp_and_log /etc/hostname "$mountpoint"/etc/hostname
         apply_new_auth
 
 
     if  [ $SystemType = "Master_backend" -o $SystemType = "Standalone"  ]
     then
             #installing DB to local machine
-                #turn off old live database, so the chroot one can start
+            #turn off old live database, so the chroot one can start
+            echo "---------------------CHROOT INSTALLDB-------------------------"
             /etc/rc.d/mysqld stop
             mount --bind /dev "$mountpoint/dev"
-            chroot "$mountpoint"   "$MV_ROOT/bin/install_db_chroot.sh"  >  /tmp/chrootdb.out
+            mount --bind /proc "$mountpoint/proc"
+            chroot "$mountpoint"   "$MV_ROOT/bin/install_db_chroot.sh" 2>&1 |tee /tmp/chrootdb.out
+            #chroot "$mountpoint"   "$MV_ROOT/bin/install_db_chroot.sh"
             chroot "$mountpoint" $MV_ROOT/bin/systemconfig.sh misc,hostype,network,advanced,this_is_install
             echo "stopping mysql in chroot"
             chroot "$mountpoint" /etc/rc.d/mysqld stop
-            umount "$mountpoint/dev"
-
-            #/etc/rc.d/mysqld start
+            kill_dhcp_chroot
+            sleep 2
+            lsof |grep new_boot
+            umount -l "$mountpoint/dev"
+            umount -l "$mountpoint/proc"
+
+            echo "---------------------END CHROOT INSTALLDB-------------------------"
+            /etc/rc.d/mysqld start
     else
             #update remotedb with this host settings
             chroot "$mountpoint" DISPLAY=127.0.0.1:0  /usr/local/bin/MythVantage -t  restore,default_1
@@ -168,8 +193,9 @@ full_install () {
     touch $mountpoint/home/mythtv/.configure && chmod 777 $mountpoint/home/mythtv/.configure
 
     echo "Done" > /tmp/.install_state
-    cp /tmp/mythvantage_install.log  $mountpoint/var/log/
-    $run unmount_it $disk
+    cp_and_log /tmp/mythvantage_install.log  $mountpoint/var/log/
+    $run umount_it $disk
+
 }
 
 function createsquashlist(){
@@ -207,8 +233,8 @@ function upgrade () {
         echo "STARTSIZE=$startsize">/tmp/.startsize.io
         echo "Upgrading $hostname" > /tmp/.install_state
         sleep 1
-        cp -rf /tmp/etc /new_boot/etc.old
-        cp -rf  /tmp/oss /new_boot/var/lib/oss.old
+        cp_and_log  /tmp/etc /new_boot/etc.old
+        cp_and_log   /tmp/oss /new_boot/var/lib/oss.old
 
 
         SQUASHLIST="/tmp/.squashlist"
@@ -216,17 +242,18 @@ function upgrade () {
         $run copy_it $disk $SQUASHLIST
         #copy back ssh keys
 
-#        cp -rp /data/var/cache/pacman/pkg/* /new_boot/data/var/cache/pacman/pkg/
-        cp -fp /new_boot/etc.old/ssh/*.pub   /new_boot/etc/ssh/
-        cp -fp /new_boot/etc.old/ssh/*.key   /new_boot/etc/ssh/
-        cp -fp /new_boot/etc.old/ssh/*key   /new_boot/etc/ssh/
-        cp -fp /new_boot/etc.old/mdadm.conf /new_boot/etc/
+#        cp_and_log -rp /data/var/cache/pacman/pkg/* /new_boot/data/var/cache/pacman/pkg/
+        cp_and_log  "/new_boot/etc.old/ssh/*.pub"   /new_boot/etc/ssh/
+        cp_and_log "/new_boot/etc.old/ssh/*.key"   /new_boot/etc/ssh/
+        cp_and_log "/new_boot/etc.old/ssh/*key"  /new_boot/etc/ssh/
+        cp_and_log  /new_boot/etc.old/mdadm/mdadm.conf /new_boot/etc/
+        cp_and_log /new_boot/etc.old/asound.state /new_boot/etc/
         if [ ! -f /tmp/etc/KnoppMyth-version ]
         then
             #passwd/shadow/group
-            cp -fp /new_boot/etc.old/passwd /new_boot/etc/
-            cp -fp /new_boot/etc.old/shadow /new_boot/etc/
-            cp -fp /new_boot/etc.old/group   /new_boot/etc/
+            cp_and_log  /new_boot/etc.old/passwd /new_boot/etc/
+            cp_and_log  /new_boot/etc.old/shadow /new_boot/etc/
+            cp_and_log  /new_boot/etc.old/group   /new_boot/etc/
         fi
 
         if [  x$rootfs = "xDo_not_format" ]
@@ -236,7 +263,7 @@ function upgrade () {
         $run fstab_fix_it $disk UPGRADE
 
 	    #this is here to copy in the systemconfig file as soon as possible.
-        cp -f /etc/systemconfig "$mountpoint"/etc
+        cp_and_log  /etc/systemconfig "$mountpoint"/etc/systemconfig
 
         echo "Writing boot sector" > /tmp/.install_state
         progress 99
@@ -245,8 +272,8 @@ function upgrade () {
         echo "Configuring system" > /tmp/.install_state
         progress
         sleep 1
-        cp /etc/mtab "$mountpoint"/etc/mtab
-        cp -f /etc/systemconfig "$mountpoint"/etc
+        cp_and_log /etc/mtab "$mountpoint"/etc/mtab
+        cp_and_log  /etc/systemconfig "$mountpoint"/etc
 #make sure mythconverg.sql.gz is present
         backup_sql_check
         if [ $? = 1 ]
@@ -261,7 +288,8 @@ function upgrade () {
             $MV_ROOT/bin/restore_default_settings.sh  -c save -t syssettings -h $MVHOSTNAME -d localhost
             SE=$TEMPLATES/settings/syssettings
             mkdir -p ${mountpoint}$SE
-            cp -rp $SE/*  ${mountpoint}$SE/
+            #cp -rfp  $SE/*  ${mountpoint}$SE/
+            cp_and_log "$SE/*"  "${mountpoint}$SE/"
             chown root:mythtv "$mountpoint"/etc/systemconfig
             chown -R mythtv:mythtv ${mountpoint}$SE
             chmod -R 775   ${mountpoint}$SE
@@ -273,7 +301,7 @@ function upgrade () {
 
 
 
-        cp -f $MV_ROOT/bin/*.sh "$mountpoint"$MV_ROOT/bin/
+        cp_and_log  "$MV_ROOT/bin/*.sh" "$mountpoint"$MV_ROOT/bin/
         chmod -R 755 ${mountpoint}/root
         chown root:mythtv "$mountpoint"/etc/systemconfig
         chmod 775 "$mountpoint"/etc/systemconfig
@@ -293,7 +321,10 @@ function upgrade () {
             echo "--------------------------------"
             echo "clean upgrade installing new database"
             echo "--------------------------------"
-            chroot "$mountpoint"   "$MV_ROOT/bin/install_db_chroot.sh"  >  /tmp/chrootdb.out
+            chroot "$mountpoint"   "$MV_ROOT/bin/install_db_chroot.sh"  |tee /tmp/chrootdb.out
+            echo "############################################"
+            echo "End Installing new database/clean"
+            echo "############################################"
         else
         #proceed as normal
             if [ -f "$mountpoint"/$BACKUPFILE ]
@@ -301,13 +332,19 @@ function upgrade () {
                 echo "--------------------------------"
                 echo "Restoring database"
                 echo "--------------------------------"
-                chroot "$mountpoint"   "$MV_ROOT/bin/restore_km_db_chroot.sh" "$BACKUPFILE"  >  /tmp/chrootdb_km.out
+                chroot "$mountpoint"   "$MV_ROOT/bin/restore_km_db_chroot.sh" "$BACKUPFILE"  |tee   /tmp/chrootdb_km.out
+                echo "############################################"
+                echo "End Restoring database"
+                echo "############################################"
             else
                 echo "--------------------------------"
                 echo "Couldn't find backup file, installing new database"
                 echo "--------------------------------"
                 touch /tmp/.upgrade_db_failed
-                chroot "$mountpoint"   "$MV_ROOT/bin/install_db_chroot.sh"  >  /tmp/chrootdb.out
+                chroot "$mountpoint"   "$MV_ROOT/bin/install_db_chroot.sh"  |tee  /tmp/chrootdb.out
+                echo "############################################"
+                echo "End Installing new database"
+                echo "############################################"
             fi
         fi
 
@@ -326,14 +363,14 @@ function upgrade () {
         chroot "$mountpoint" $MV_ROOT/bin/systemconfig.sh misc,hostype,network,advanced,this_is_install
         chroot "$mountpoint" $MV_ROOT/bin/systemconfig.sh advanced,this_is_install
         apply_new_auth
-
-        umount "$mountpoint/dev"
-        umount "$mountpoint/proc"
+        kill_dhcp_chroot
+        umount -l "$mountpoint/dev"
+        umount -l "$mountpoint/proc"
 
     echo "Done" > /tmp/.install_state
-    cp /tmp/mythvantage_install.log  $mountpoint/var/log/
+    cp_and_log /tmp/mythvantage_install.log  $mountpoint/var/log/
 
-    $run unmount_it $disk
+    $run umount_it $disk
     /etc/rc.d/mysqld start
 }
 
@@ -349,22 +386,22 @@ function netboot-full_install () {
     ${MV_ROOT}/bin/xconfig.sh
 }
 
-function killdhcp () {
-if [ -f /etc/dhcpc/dhcpcd-eth0.pid ]
-        then
-            pid=`cat /etc/dhcpc/dhcpcd-eth0.pid`
-            kill -9 $pid
-            rm -f /etc/dhcpc/dhcpcd-eth0.pid
-            rm -f /var/run/dhcpcd*
-        fi
-if [ -f /var/run/dhcpcd-eth0.pid ]
-        then
-            pid=`cat /var/run/dhcpcd-eth0.pid`
-            kill -9 $pid
-            rm -f /var/run/dhcpcd-eth0.pid*
-        fi
-ip address flush dev eth0
-}
+# function killdhcp () {
+# if [ -f /etc/dhcpc/dhcpcd-eth0.pid ]
+#         then
+#             pid=`cat /etc/dhcpc/dhcpcd-eth0.pid`
+#             kill -9 $pid
+#             rm -f /etc/dhcpc/dhcpcd-eth0.pid
+#             rm -f /var/run/dhcpcd*
+#         fi
+# if [ -f /var/run/dhcpcd-eth0.pid ]
+#         then
+#             pid=`cat /var/run/dhcpcd-eth0.pid`
+#             kill -9 $pid
+#             rm -f /var/run/dhcpcd-eth0.pid*
+#         fi
+# ip address flush dev eth0
+# }
 
 
 
@@ -402,17 +439,17 @@ echo "-----------------------------------------------------------------------3--
                 then
                 ###########ADD templates
                     mkdir -p $TEMP_TEMPLATES
-                    cp -pr /new_boot/$TEMPLATES  $TEMP_TEMPLATES
+                    cp_and_log  /new_boot/$TEMPLATES  $TEMP_TEMPLATES
                     SANE_SYSETTINGS
-                    cp -rp $TEMP_TEMPLATES/settings $TEMPLATES/
-                    cp /new_boot/etc/systemconfig /etc/systemconfig
-                    cp -rf  /new_boot/etc /tmp/etc
-                    cp -rf /new_boot/var/lib/oss  /tmp/oss
-                    [ -e /tmp/etc/mdadm.conf ] && cp -rf /tmp/etc/mdadm.conf /etc/
+                    cp_and_log  $TEMP_TEMPLATES/settings $TEMPLATES/
+                    cp_and_log /new_boot/etc/systemconfig /etc/systemconfig
+                    cp_and_log   /new_boot/etc /tmp/etc
+                    cp_and_log  /new_boot/var/lib/oss  /tmp/oss
+                    [ -e /tmp/etc/mdadm.conf ] && cp_and_log  /tmp/etc/mdadm.conf /etc/
                     $MV_ROOT/bin/restore_default_settings.sh -c restore -t syssettings -h $MVHOSTNAME  -d 127.0.0.1
                 else
-                    cp -rf  /new_boot/etc /tmp/etc
-                    [ -e /tmp/etc/mdadm.conf ] && cp -rf /tmp/etc/mdadm.conf /etc/
+                    cp_and_log   /new_boot/etc /tmp/etc
+                    [ -e /tmp/etc/mdadm.conf ] && cp_and_log  /tmp/etc/mdadm.conf /etc/
                     #now we search for the timezone and try to update
                     TZREGION=`cat /tmp/etc/timezone | cut -d"/" -f1`
                     TZSUB=`cat /tmp/etc/timezone | cut -d"/" -f2 -`
diff --git a/abs/core-testing/LinHES-config/networkconfig.sh b/abs/core-testing/LinHES-config/networkconfig.sh
index 5611265..38b819a 100644
--- a/abs/core-testing/LinHES-config/networkconfig.sh
+++ b/abs/core-testing/LinHES-config/networkconfig.sh
@@ -8,7 +8,8 @@ ETCNETDIR=$BASE/etc/net/ifaces
 
 function kill_dhcp ()
 {
-for i in ${BASE}/etc/dhcpc/dhcpcd-*.pid
+#for i in ${BASE}/etc/dhcpc/dhcpcd-*.pid
+for i in ${BASE}/var/run/dhcpcd-*.pid
 do
     if [ -f ${i} ]
     then
@@ -33,6 +34,23 @@ done
 
 }
 
+function kill_dhcp_chroot ()
+{
+#for i in ${BASE}/etc/dhcpc/dhcpcd-*.pid
+for i in ${mountpoint}/var/run/dhcpcd-*.pid
+do
+    if [ -f ${i} ]
+    then
+        pid=`cat ${i}`
+        kill -9 $pid
+        rm -f ${i}
+    fi
+done
+
+}
+
+
+
 function setup_nameserver(){
 grep -q $1 ${BASE}/etc/resolv.conf
 status=$?
diff --git a/abs/core-testing/LinHES-config/restore_km_db_chroot.sh b/abs/core-testing/LinHES-config/restore_km_db_chroot.sh
index 7ff6faf..71328f2 100644
--- a/abs/core-testing/LinHES-config/restore_km_db_chroot.sh
+++ b/abs/core-testing/LinHES-config/restore_km_db_chroot.sh
@@ -1,8 +1,8 @@
 #!/bin/bash
 . /etc/profile
 . /etc/systemconfig
-set -x
-#myhost=`cat /etc/hostname`
+. $MV_ROOT/bin/install_functions.sh
+
 myhost=$hostname
 hostname $myhost
 mount -t proc none /proc
@@ -35,6 +35,8 @@ if  [ $SystemType = "Master_backend" -o $SystemType = "Standalone"  ]
                         echo "restoring old database"
                         gunzip -c $DBFILE > /tmp/mythconverg.sql
                         mysql  mythconverg < /tmp/mythconverg.sql
+                        update_db_settings HostServiceMythWEB "1"
+                        echo 'UseMythWEB="1"' >> /etc/systemconfig
                    else
                         echo "Could not restore old database, mythconverg.sql is missing."
                         touch /tmp/.upgrade_db_failed
@@ -52,7 +54,7 @@ if  [ $SystemType = "Master_backend" -o $SystemType = "Standalone"  ]
         exit 0
     fi
 
-#/etc/rc.d/mysqld stop
+/etc/rc.d/mysqld stop
 #umount /proc
 
 
diff --git a/abs/core-testing/LinHES-config/systemconfig.sh b/abs/core-testing/LinHES-config/systemconfig.sh
index 3aac497..948137a 100755
--- a/abs/core-testing/LinHES-config/systemconfig.sh
+++ b/abs/core-testing/LinHES-config/systemconfig.sh
@@ -41,6 +41,17 @@ else
 fi
 
 
+function cp_and_log () {
+    if [ -e $1 ]
+    then
+        echo "copying $1 to $2"
+        cp -rfp "$1" "$2"
+    else
+        echo "$1 is not present, skipping..."
+    fi
+
+}
+
 
 #-----------------------------------------------------
 
@@ -55,14 +66,14 @@ function setupmysql  {
 #                dbhost=`ifconfig  | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'|head -n1`
                 dbhost=`ifconfig  | grep -C1 $default_interface| grep -v $default_interface | cut -d: -f2 | awk '{ print $1}'`
                 sed -e "s/^dbhost=.*$/dbhost=\"$dbhost\"/" /etc/systemconfig >/tmp/systemconfig.old
-                cp /tmp/systemconfig.old ${BASE}/etc/systemconfig
+                cp_and_log /tmp/systemconfig.old ${BASE}/etc/systemconfig
                 ##logic to change master_serverip and backend_serverip  in db
                 ${BASE}${MV_ROOT}/bin/restore_default_settings.sh  -c BECONFIG -s master -a $dbhost
             else
 
                 dbhost=$MYTHIP
                 sed -e "s/^dbhost=.*$/dbhost=\"$dbhost\"/" /etc/systemconfig >/tmp/systemconfig.old
-                cp /tmp/systemconfig.old ${BASE}/etc/systemconfig
+                cp_and_log /tmp/systemconfig.old ${BASE}/etc/systemconfig
                 #logic to change dbhost in db
                 ${BASE}${MV_ROOT}/bin/restore_default_settings.sh -c BECONFIG -s master -a $dbhost
             fi
@@ -96,7 +107,7 @@ function setupmysql  {
         rm ${BASE}${MV_ROOT}/bin/mythtv/.mythtv/mysql.txt
         if [ -f ${BASE}/home/mythtv/templates/mysql.txt ]
         then
-            cp ${BASE}/home/mythtv/templates/mysql.txt $MYSQLTXT
+            cp_and_log ${BASE}/home/mythtv/templates/mysql.txt $MYSQLTXT
         fi
 
         chmod 755 $MYSQLTXT
@@ -151,7 +162,7 @@ ln -s "/usr/share/zoneinfo/$timezone"  ${BASE}/etc/localtime
        # echo CLOCK="UTC" > ${BASE}/etc/conf.dclock
        # echo CLOCK_SYSTOCH="yes" >> ${BASE}/etc/conf.d/clock
        # echo TIMEZONE="$timezone" >> ${BASE}/etc/conf.d/clock
-cp $TEMPLATES/rc.conf /etc/rc.conf
+cp_and_log $TEMPLATES/rc.conf /etc/rc.conf
 
 }
 
@@ -173,7 +184,7 @@ function setupreceiver {
    Hauppauge) echo "setup hauppauge reciever (lirc_i2c)"
               sed -i -e '/.*#lirc/d' ${BASE}/etc/modules.mythvantage
               echo "lirc_i2c   #lirc" >> ${BASE}/etc/modules.mythvantage
-              cp $TEMPLATES/modules/lirc_i2c.conf ${BASE}/etc/modprobe.d/lirc_i2c.conf
+              cp_and_log $TEMPLATES/modules/lirc_i2c.conf ${BASE}/etc/modprobe.d/lirc_i2c.conf
               rmmod lirc_i2c 2>/dev/null
               load-modules-mythvantage.sh
              ;;
@@ -198,7 +209,7 @@ function setupremote {
                 do
                         cat $i >> ${BASE}/etc/lircd.conf
                 done
-		cp -f lircrc* $BASE/etc/lircrc 2> /dev/null
+                cp -f lircrc* $BASE/etc/lircrc 2> /dev/null
                 if [ -f $TEMPLATES/LCD/$LCDtype/lircrc ]
                 then
                     cat $TEMPLATES/LCD/$LCDtype/lircrc >> /etc/lircrc
@@ -258,7 +269,7 @@ function setupevrouter {
                 x ) echo "empty evrouter"
                     ;;
                 * ) echo "setup evrouter for $EvrouterConfig "
-                    cp $TEMPLATES/evrouter/$EvrouterConfig /etc/evrouter.cfg
+                    cp_and_log $TEMPLATES/evrouter/$EvrouterConfig /etc/evrouter.cfg
                     daemon_add="evrouter Xvfb $daemon_remove"
 
                     ;;
@@ -296,7 +307,7 @@ function setupLCD {
 
             if [ -f $TEMPLATES/LCD/$LCDtype/LCDd.conf ]
             then
-                cp -f $TEMPLATES/LCD/$LCDtype/LCDd.conf /etc
+                cp_and_log  $TEMPLATES/LCD/$LCDtype/LCDd.conf /etc
                # install="lcdproc $install"
                 daemon_add="lcdd $daemon_add"
                 load-modules-mythvantage.sh
@@ -316,7 +327,7 @@ function setupLCD {
 
 
 function scrubnfs {
-	   cp /etc/fstab $TEMPLATES/fstab.conf.template
+	   cp_and_log /etc/fstab $TEMPLATES/fstab.conf.template
        grep -v nfs   $TEMPLATES/fstab.conf.template > ${BASE}/etc/fstab
    }
 
@@ -341,8 +352,11 @@ function setupncidclient
 }
 
 function setupnciddaemon {
-    cp -f /etc/ncid/ncidd.conf $TEMPLATES/ncidd.conf.template
-    sed -e "s/.*set ttyport.*$/set ttyport =  \/dev\/$nciddSerialPort /" $TEMPLATES/ncidd.conf.template >${BASE}/etc/ncid/ncidd.conf
+    if [ x$Runncidd = x1 ]
+    then
+        cp_and_log /etc/ncid/ncidd.conf $TEMPLATES/ncidd.conf.template
+        sed -e "s/.*set ttyport.*$/set ttyport =  \/dev\/$nciddSerialPort /" $TEMPLATES/ncidd.conf.template >${BASE}/etc/ncid/ncidd.conf
+    fi
 
 }
 
@@ -454,12 +468,14 @@ then
 fi
     for i in $remove
     do
-    echo "-----------$i --------------"
-    grep -q $i $PKGBLACKLIST
-    if [ $? = 1 ]
+    if [ ! x$i = xnone ]
     then
-        pacman -Q $i 2>/dev/null
-        #VAR=`pacman -Q $i  2>&1 `
+        echo "-----------$i --------------"
+        grep -q $i $PKGBLACKLIST
+        if [ $? = 1 ]
+        then
+            pacman -Q $i 2>/dev/null
+            #VAR=`pacman -Q $i  2>&1 `
             if [ $? = 0 ]
             then
                     if [ $i = "mythweb$postfix" ]
@@ -471,31 +487,35 @@ fi
                     echo removed $i
                     fi
             fi
-    else
-        echo "$i is black listed"
+        else
+            echo "$i is black listed"
+        fi
     fi
     done
- # fi
+
 
     for i in $install
     do
-    echo "-----------$i --------------"
-    grep -q $i $PKGBLACKLIST
-    if [ $? = 1 ]
+    if [ ! x$i = xnone ]
     then
-            pacman -Q $i 2>/dev/null
-            #VAR=`pacman -Q $i  2>&1 `
-  #            echo $VAR |grep -vq error:
+        echo "-----------$i --------------"
+        grep -q $i $PKGBLACKLIST
+        if [ $? = 1 ]
+        then
+                pacman -Q $i 2>/dev/null
+                #VAR=`pacman -Q $i  2>&1 `
+    #            echo $VAR |grep -vq error:
 
-            if [ ! $? = 0 ]
-            then
-                    pacman --noconfirm -Sf $i
-                    echo installed $i
-	    else
-		    echo "$i already installed"
-            fi
-    else
-      echo "$i is black listed"
+                if [ ! $? = 0 ]
+                then
+                        pacman --noconfirm -Sf $i
+                        echo installed $i
+            else
+                echo "$i already installed"
+                fi
+        else
+        echo "$i is black listed"
+        fi
     fi
     done
 }
@@ -942,7 +962,13 @@ function reloadfe(){
    then
     killall -9 mythlcdserver
    fi
-   kill -s USR1 $PID
+   if [  x = x$PID ]
+   then
+       echo "Mythfrontend not running, will not reload"
+   else
+        kill -s USR1 $PID
+   fi
+   exit 0
 
 }
 
-- 
cgit v0.12


From 3c1ea88bae105c29600c0da55e009e8ef4ea0c45 Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Sun, 4 Jan 2009 14:18:02 -0600
Subject: bump to .05

---
 abs/core-testing/LinHES-config/LinHES-release | 2 +-
 abs/core-testing/LinHES-config/PKGBUILD       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/abs/core-testing/LinHES-config/LinHES-release b/abs/core-testing/LinHES-config/LinHES-release
index 0e9e72b..45d0c7a 100644
--- a/abs/core-testing/LinHES-config/LinHES-release
+++ b/abs/core-testing/LinHES-config/LinHES-release
@@ -1 +1 @@
-LinHES R6.00.04 
+LinHES R6.00.05 
diff --git a/abs/core-testing/LinHES-config/PKGBUILD b/abs/core-testing/LinHES-config/PKGBUILD
index 1a9a0be..bafc5b1 100755
--- a/abs/core-testing/LinHES-config/PKGBUILD
+++ b/abs/core-testing/LinHES-config/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=LinHES-config
 pkgver=1.0
-pkgrel=141
+pkgrel=142
 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 )
-- 
cgit v0.12

