From 377f128ba76142d64572d51aba4e9d0a1e613561 Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Wed, 6 May 2009 18:23:44 -0500
Subject: LinHES-config: adding new python install scripts into the mix.

---
 abs/core-testing/LinHES-config/PKGBUILD         |   10 +-
 abs/core-testing/LinHES-config/install_proxy.sh |  794 +++------------
 abs/core-testing/LinHES-config/mv_config.py     |   16 +
 abs/core-testing/LinHES-config/mv_install.py    | 1246 +++++++++++++++++++++++
 4 files changed, 1400 insertions(+), 666 deletions(-)
 mode change 100644 => 100755 abs/core-testing/LinHES-config/PKGBUILD
 create mode 100755 abs/core-testing/LinHES-config/mv_config.py
 create mode 100755 abs/core-testing/LinHES-config/mv_install.py

diff --git a/abs/core-testing/LinHES-config/PKGBUILD b/abs/core-testing/LinHES-config/PKGBUILD
old mode 100644
new mode 100755
index c035c80..b6c2628
--- a/abs/core-testing/LinHES-config/PKGBUILD
+++ b/abs/core-testing/LinHES-config/PKGBUILD
@@ -1,12 +1,12 @@
 pkgname=LinHES-config
 pkgver=1.0
-pkgrel=402
+pkgrel=403
 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 rsync )
 arch=('i686')
 
-source=(mythinstall.bin myth_user_call file_time_offset.py install-ui.xml install_proxy.sh install_functions.sh systemconfig.sh install_db_chroot.sh restore_default_settings.sh xconfig.sh timezip.py soundconfig.sh LinHES-release issue MythVantage.sh create_master.sh build_diskless.sh networkconfig.sh timezone.bin autocard.py restore_km_db_chroot.sh README ir_config.sh)
+source=(mv_install.py mv_config.py mythinstall.bin myth_user_call file_time_offset.py install-ui.xml install_proxy.sh install_functions.sh systemconfig.sh install_db_chroot.sh restore_default_settings.sh xconfig.sh timezip.py soundconfig.sh LinHES-release issue MythVantage.sh create_master.sh build_diskless.sh networkconfig.sh timezone.bin autocard.py restore_km_db_chroot.sh README ir_config.sh)
 
 install=LinHES.install
 build() {
@@ -39,8 +39,10 @@ build() {
     install -m 0755 timezone.bin $MVDIR/bin/timezone.bin
     install -m 0755 timezip.py $MVDIR/bin/timezip.py
     install -m 0755 autocard.py $MVDIR/bin/autocard.py
-    
-    
+    install -m 0755 mv_config.py $MVDIR/bin/mv_config.py
+    install -m 0755 mv_install.py $MVDIR/bin/mv_install.py
+
+
     install -m 0755 README $MVDIR/README
 
     mkdir -p $startdir/pkg/usr/bin
diff --git a/abs/core-testing/LinHES-config/install_proxy.sh b/abs/core-testing/LinHES-config/install_proxy.sh
index d39f712..cb387b9 100755
--- a/abs/core-testing/LinHES-config/install_proxy.sh
+++ b/abs/core-testing/LinHES-config/install_proxy.sh
@@ -17,685 +17,155 @@ run=$MV_ROOT/bin/install_functions.sh
 CMDLINE=$(cat /proc/cmdline)
 BACKUPFILE="/myth/backup/mythconverg.sql.gz"
 
-#TEMPNET="Hostip"$default_interface
-#eval MYTHIP=\$${TEMPNET}
-function create_chroot_mnt_points() {
-
-    echo "Creating directory for media in chroot"
-    mkdir -p $mountpoint/media/cdrom
-    mkdir -p $mountpoint/media/dvd
-    mkdir -p $mountpoint/mnt
-
-}
-function cp_and_log () {
-    ls $1 >/dev/null 2>&1
-    status=$?
-    if [ $status = 0 ]
-    then
-        echo "copying $1 to $2"
-        cp -rfp $1 $2
-    else
-        echo "$1 is not present, skipping..."
-    fi
-
-}
-
-function mdadm_find () {
-
-    PREFIX=$1
-    if [ -e $PREFIX/etc/KnoppMyth-version ]
-    then
-        MDADM_CONF="/etc/mdadm/mdadm.conf"
-    else
-        MDADM_CONF="/etc/mdadm.conf"
-    fi
-    echo "Using $MDADM_CONF"
-}
 
 progress () {
-mypercent=`echo "$1" | cut -d. -f1`
-if [  x$mypercent = x ]
-then
-echo "" > /tmp/.install_percent
-else
-echo "${mypercent}% complete" > /tmp/.install_percent
-fi
-
-
-}
-
-function apply_new_auth () {
-#check if file is present
-    if  [ -f  /root/myth_user_call.out ]
+    mypercent=`echo "$1" | cut -d. -f1`
+    if [  x$mypercent = x ]
     then
-        #read in file, running each command in chroot
-        exec 4</root/myth_user_call.out
-        while read LINE <&4
-        do
-            if [ ! x"$LINE" = x ]
-            then
-                #run commands in chroot
-                chroot "$mountpoint"   $MV_ROOT/bin/myth_user_call -i $LINE > /tmp/user_auth.update
-            fi
-        done
-        rm -f /root/myth_user_call.out
+    echo "" > /tmp/.install_percent
     else
-        echo "No new password changes to apply"
+    echo "${mypercent}% complete" > /tmp/.install_percent
     fi
 }
 
 
-function backup_sql_check {
-    if [ -f ${mountpoint}${BACKUPFILE} ]
-    then
-        echo "found ${mountpoint}${BACKUPFILE} "
-        rc=0
-    else
-        echo "did not find ${mountpoint}${BACKUPFILE} "
-        rc=1
-    fi
-    return $rc
-}
-
-function mdadm_assemble_all {
-
-        mdadm_find /tmp
-        mdadm --assemble --scan -c /tmp${MDADM_CONF}
-        MDLIST=`grep ARRAY /tmp${MDADM_CONF}|tr -s [:space:]|cut -d" " -f2`
-        for array in $MDLIST
-        do
-            echo "assembling array $array"
-            mdadm --assemble -c /tmp${MDADM_CONF} $array
-            sleep 2
-            fsck -p $array
-        done
-
-}
-
-function upgrade_mount_search {
-
-    MYTH_P=`cat /tmp/etc/fstab |grep -E /myth[[:space:]] | awk ' {print $1 '} `
-    umount $mountpoint/myth
-
-    #should probably just mdadm all the time
-    echo $MYTH_P |grep -q \/md.
-    if [ $? = 0 ]
-    then
-        mdadm_assemble_all
-    fi
-
-    echo $MYTH_P |grep -q UUID
-    if [ $? = 0 ]
-    then
-        MUUID=`echo $MYTH_P|cut -d= -f2|tr -d \"`
-        echo blkid $MUUID
-        blkid -t UUID=$MUUID
-        if [ ! $? = 0 ]
-        then
-            echo "couldn't find $MUUID, starting md support"
-            mdadm_assemble_all
-        fi
-        mount -U $MUUID $mountpoint/myth
-        echo mount -U    $MUUID $mountpoint/myth
-        MYTHMOUNT=`blkid -t UUID=$MUUID|cut -d: -f1`
-        MYTHMOUNT=`basename $MYTHMOUNT`
-        echo "MYTHMOUNT is $MYTHMOUNT"
-    else
-        mount $MYTH_P $mountpoint/myth
-        echo mount $MYTH_P $mountpoint/myth
-        MYTHMOUNT=`basename $MYTH_P`
-        echo "MYTHMOUNT is $MYTHMOUNT"
-    fi
-    sleep 2
-    backup_sql_check
-    if [ $? = 1  ]
-    then
-        mkdir -p /new_boot/root/backup
-        if [ ! -e /tmp/mythconverg.sql.gz ]
-        then
-            echo "Couldn't find ANY database to restore, upgrade will continue but a new database will be installed."
-        else
-            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
-    fi
-    return 0
-}
-
-
-full_install () {
-    if [ -f /tmp/.this_is_upgrade ]
-    then
-        rm /tmp/.this_is_upgrade
-    fi
-    echo "Partitioning $disk" > /tmp/.install_state
-    progress 1
-    sleep 1
-    $run partition_it $disk $rootsize $datasize $swapsize
-
-    echo "Formating $disk" > /tmp/.install_state
-        progress 2
-    sleep 1
-    $run format_it $disk $rootfs $datafs
-
-    echo "Preparing $disk" > /tmp/.install_state
-    progress 3
-    sleep 1
-    $run mount_it $disk
-
-    startsize=`statgrab -M disk.|grep $disk.write_bytes|cut -d= -f 2|tr -d " "`
-
-    echo "STARTSIZE=$startsize">/tmp/.startsize.io
-    echo "Creating $hostname" > /tmp/.install_state
-
-    sleep 1
-        $run copy_it $disk ALL
-        rm $mountpoint/etc/fstab
-        $run fstab_fix_it $disk $rootfs $datafs FULL_INSTALL
-        echo "Configuring system" > /tmp/.install_state
-        progress 100
-    #progress 99
-    sleep 1
-    $run grub_it $disk
-
-
-        #echo "Configuring system" > /tmp/.install_state
-        #progress 100
-        sleep 1
-        cp_and_log  /etc/systemconfig "$mountpoint"/etc
-        cp_and_log /root/xorg.conf.install "$mountpoint"/etc/X11/xorg.conf.install
-        #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_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
-        mkdir -p "$mountpoint"/var/log/mythtv
-        chown mythtv "$mountpoint"/var/log/mythtv
-        #copy over any updates that might have occured
-        #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
-        create_chroot_mnt_points
-        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
-            echo "---------------------CHROOT INSTALLDB-------------------------"
-            /etc/rc.d/mysqld stop
-            mount --bind /dev "$mountpoint/dev"
-            mount --bind /proc "$mountpoint/proc"
-            mount -t sysfs none $mountpoint/sys
-            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,user,this_is_install
-            echo "stopping mysql in chroot"
-            chroot "$mountpoint" /etc/rc.d/mysqld stop
-            kill_dhcp_chroot
-            sleep 2
-            lsof |grep new_boot
-            umount -l "$mountpoint/dev"
-            umount -l "$mountpoint/proc"
-            umount -l "$mountpoint/sys"
-
-            echo "---------------------END CHROOT INSTALLDB-------------------------"
-            /etc/rc.d/mysqld start
-    else
-            #update remotedb with this host settings
-            mount --bind /dev "$mountpoint/dev"
-            mount --bind /proc "$mountpoint/proc"
-            mount -t sysfs none $mountpoint/sys
-            chroot "$mountpoint" DISPLAY=127.0.0.1:0  /usr/local/bin/MythVantage -t  restore,default_1
-            chroot "$mountpoint" $MV_ROOT/bin/restore_default_settings.sh -c restore -t syssettings
-            if [ !  $? = 0 ]
-            then
-                touch $mountpoint/tmp/.dbsysfailed
-                chmod 777 $mountpoint/tmp/.dbsysfailed
-            else
-            #Run second time
-            chroot "$mountpoint" $MV_ROOT/bin/systemconfig.sh misc,hostype,network,advanced,user,this_is_install
-            chroot "$mountpoint" $MV_ROOT/bin/restore_default_settings.sh -c  ACCESSCONTROL
-            umount -l "$mountpoint/dev"
-            umount -l "$mountpoint/proc"
-            umount -l "$mountpoint/sys"
-            fi
-    fi
-    chroot "$mountpoint" $MV_ROOT/bin/systemconfig.sh advanced,user
-    touch $mountpoint/home/mythtv/.configure && chmod 777 $mountpoint/home/mythtv/.configure
-
-    echo "Done" > /tmp/.install_state
-    cp_and_log /tmp/mythvantage_install.log  $mountpoint/var/log/
-    $run umount_it $disk
-
-}
-
-function createsquashlist(){
-if [ -f $1 ]
-then
-    rm -f
-$1
-fi
-for i in bin boot etc home lib opt root sbin usr var data
-do
-echo $i >> $1
-done
-
-
-}
-
-
-
-
-function upgrade () {
-    touch /tmp/.this_is_upgrade
-
-    if [ ! x$rootfs = "xDo_not_format" ]
-    then
-        echo "Formating
-        $disk" > /tmp/.install_state
-            progress 2
-            sleep 1
-            $run format_it $disk $rootfs NO
-    fi
-    echo "Preparing $disk" > /tmp/.install_state
-        progress 3
-        sleep 1
-        $run mount_it $disk
-        startsize=`statgrab -M disk.|grep $disk.write_bytes|cut -d= -f 2|tr -d " "`
-        echo "STARTSIZE=$startsize">/tmp/.startsize.io
-        echo "Upgrading $hostname" > /tmp/.install_state
-        sleep 1
-        cp_and_log  /tmp/etc /new_boot/etc.old
-        cp_and_log   /tmp/oss /new_boot/var/lib/oss.old
-
-
-        SQUASHLIST="/tmp/.squashlist"
-        createsquashlist $SQUASHLIST
-        $run copy_it $disk $SQUASHLIST
-        #copy back ssh keys
-
-#        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/
-        mdadm_find /tmp
-        cp_and_log /tmp${MDADM_CONF} /new_boot/etc
-        #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_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
-        mkdir -p "$mountpoint"/var/log/mythtv
-        chown mythtv "$mountpoint"/var/log/mythtv
-        if [  x$rootfs = "xDo_not_format" ]
-        then
-            rootfs=`grep \/\  /tmp/etc/fstab |awk ' { print $3 } '`
-        fi
-        #this is here to copy in the systemconfig file as soon as possible.
-        cp_and_log  /etc/systemconfig "$mountpoint"/etc/systemconfig
-        echo "Configuring system" > /tmp/.install_state
-        progress 100
-        backup_sql_check
-        if [ $? = 1 ]
-        then
-            upgrade_mount_search
-        fi
-        echo $run fstab_fix_it $disk UPGRADE $MYTHMOUNT
-        $run fstab_fix_it $disk UPGRADE $MYTHMOUNT
-        create_chroot_mnt_points
-
-        #echo "Writing boot sector" > /tmp/.install_state
-        #progress 99
-        sleep 1
-        $run grub_it $disk
-        #echo "Configuring system" > /tmp/.install_state
-        #progress 100
-        sleep 1
-        cp_and_log /etc/mtab "$mountpoint"/etc/mtab
-        cp_and_log  /etc/systemconfig "$mountpoint"/etc
-        cp_and_log /root/xorg.conf.install "$mountpoint"/etc/X11/xorg.conf.install
-#make sure mythconverg.sql.gz is present
-        #backup_sql_check
-        #if [ $? = 1 ]
-        #then
-        #    upgrade_mount_search
-        #fi
-        echo $CMDLINE | grep -q clean_upgrade
-        status=$?
-        if [  -f /tmp/etc/KnoppMyth-version -o  $status = 0 ]
-        then
-            #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 -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
-            if [ ! $status = 0 ]
-            then
-                touch $mountpoint/home/mythtv/.kmupgrade && chmod 777 $mountpoint/home/mythtv/.kmupgrade
-            fi
-        fi
-
-
-
-        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
-        #mount /proc and /dev
-         mount --bind /dev "$mountpoint/dev"
-         mount --bind /proc "$mountpoint/proc"
-
-        chroot "$mountpoint" $MV_ROOT/bin/systemconfig.sh misc,hostype,network,advanced,user,this_is_install
-        #wrap this in a network check_network, no need to update the db if the import worked.
-        #####  do I need to start mysql?
-        /etc/rc.d/mysqld stop
-        if  [ $SystemType = "Master_backend" -o $SystemType = "Standalone"  ]
-        then
-            echo $CMDLINE | grep -q clean_upgrade
-            status=$?
-            if [ $status = 0 ]
-            then
-            #new db as part of clean upgrade
-                echo "--------------------------------"
-                echo "clean upgrade installing new database"
-                echo "--------------------------------"
-                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 ]
-                then
-                    echo "--------------------------------"
-                    echo "Restoring database with $BACKUPFILE"
-                    echo "--------------------------------"
-                    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"  |tee  /tmp/chrootdb.out
-                    echo "############################################"
-                    echo "End Installing new database"
-                    echo "############################################"
-                fi
-            fi
-        fi
-
-        if [  -f /tmp/etc/KnoppMyth-version ]
-        then
-           chroot "$mountpoint" $MV_ROOT/bin/restore_default_settings.sh -c restore -t hostsettings
-        #change permissions of /myth (only needed on km->linhes)
-           chown -R mythtv:mythtv $mountpoint/myth
-           chown -R root:root $mountpoint/myth/backup
-        else
-           chroot "$mountpoint" $MV_ROOT/bin/restore_default_settings.sh -c restore -t syssettings
-        fi
-        #
-        #Run second time
-        chroot "$mountpoint" $MV_ROOT/bin/systemconfig.sh misc,hostype,network,advanced,user,this_is_install
-        chroot "$mountpoint" $MV_ROOT/bin/systemconfig.sh advanced,this_is_install
-        echo "stopping mysql in chroot"
-        chroot "$mountpoint" /etc/rc.d/mysqld stop
-        apply_new_auth
-        kill_dhcp_chroot
-        umount -l "$mountpoint/dev"
-        umount -l "$mountpoint/proc"
-
-    echo "Done" > /tmp/.install_state
-    cp_and_log /tmp/mythvantage_install.log  $mountpoint/var/log/
-
-    $run umount_it $disk
-    /etc/rc.d/mysqld start
-}
-
-function netboot-full_install () {
-    TEMPVAR=${CMDLINE#*nfsroot=}
-    NFSROOT=${TEMPVAR%% *}
-    NFSROOT=`echo $NFSROOT|cut -d: -f1`
-    MAC=`/sbin/ifconfig eth0|grep HWaddr| cut -d: -f2-|awk '{ print $3}'|tr : -`
-    URL="http://$NFSROOT:1337/diskless.py?HOSTNAME=$hostname&MAC=$MAC"
-    echo "calling $URL"
-    echo "Starting" > /tmp/.install_state
-    curl $URL
-    ${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 SANE_SYSETTINGS () {
-sed -e '/HOSTrootfstype/d' \
-        -e '/HOSTrootfstype/d' \
-        -e '/HOSTdatafstype/d' \
-        -e '/HOSTOSsize/d'  \
-        -e '/HostUseALLdata/d'  \
-        -e '/HOSTDATAsize/d'    \
-        -e '/HOSTuprootfstype/d'    \
-        -e '/HostUseSWAP/d' \
-        -e '/HOSTSWAPsize/d  ' /tmp/templates/settings/syssettings/settings.txt  >  /tmp/settings.new
-    mv  /tmp/settings.new /tmp/templates/settings/syssettings/settings.txt
-}
-
 case $1 in
-        full_install_it )         full_install       ;;
-
-        NETBOOT)
-echo "-----------------------------------------------------------------------3-----"
-         netboot-full_install   ;;
-
-        find_update)
-
-            #TRY TO mount first partition of drive
-            #copy /etc/systemconfig to live,  import settings into db
-            #umount drive
-            echo $CMDLINE | grep -q clean_upgrade
-            if [ $? = 1 ]
-            then
-                $run mount_it $disk
-                [ -e "/new_boot/root/backup/mythconverg.sql.gz" ] && cp /new_boot/root/backup/mythconverg.sql.gz /tmp
-
-
-                if [ -f /new_boot/etc/systemconfig ]
-                then
-                ###########ADD templates
-                    mkdir -p $TEMP_TEMPLATES
-                    cp_and_log  /new_boot/$TEMPLATES  $TEMP_TEMPLATES
-                    SANE_SYSETTINGS
-                    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_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 -`
-
-
-                    if [  $TZREGION = $TZSUB ]
-                    then
-                            $run update_db_it  HostTimeZoneRegion "$TZREGION"
-                    else
-                            $run update_db_it  HostTimeZoneRegion "$TZREGION"
-                            $run update_db_it  HostTimeZoneRegion_$TZREGION "$TZSUB"
-                    fi
-                fi
-                backup_sql_check
-                echo $?
-                upgrade_mount_search
-                echo $?
-                $run umount_it $disk
-            fi
+    full_install_it )
+             mv_install.py --rootdisk=$disk --rootfs=$rootfs --rootsize=$rootsize --datafs=$datafs --datasize=$datasize --datadisk=$disk --swapsize=$swapsize -c full_install
             ;;
 
-        upgrade_it)
-                upgrade
+    NETBOOT)
+            echo "-----------------------------------------------------------------------3-----"
+            netboot-full_install
             ;;
-        disk_model_it)
-                        model="unknown"
-                            size="xxx"
-                        case $2 in
 
-                            h* )
-                                    model=`cat /proc/ide/$2/model`
-                                    ;;
-                            s*)     model=`sginfo /dev/$2|grep Product|awk ' { print $2 } '`
-                                    ;;
-                        esac
-                        size=`parted /dev/$2  print |grep Disk|awk  ' { print $3 } '  `
-                        echo ""$model" $size " >/tmp/model
+    find_update)
+            mv_install.py --rootdisk=$disk -c find_upgrade
             ;;
-        network_check_it)
-                        #Should never return from check_network
-                        case $2 in
-                                setup_network)
-                                         vnc_check
-                                         install_network_setup
-                                ;;
-
-                                check_self)
-                                            myipdefault=`ifconfig  | grep -C1 $default_interface| grep -v $default_interface | cut -d: -f2 | awk '{ print $1}'`
-                                            echo "network check myself"
-                                            ifconfig
-                                            ping -c 1 $myipdefault
-                                            if [ ! $? = 0 ]
-                                            then
-                                                exit 3
-                                                #can't ping yourself
-                                            fi
-                                ;;
-                                check_gw)
-                                            #check gateway
-                                            echo "network check gateway"
-                                            /sbin/route -n
-                                            mygwdefault=`/sbin/route -n  |grep $default_interface|grep UG|awk '{ print $2}'`
-                                            echo "Default gateway seems to be $mygwdefault"
-                                            if  [ !  x$mygwdefault = x ]
-                                            then
-                                                sleep 2
-                                                ping -c 5 $mygwdefault
-                                                if [ ! $? = 0 ]
-                                                then
-                                                    exit 4
-                                                fi
-                                            fi
-                                ;;
-                                check_ns)
-                                            #check nameserver
-                                                    echo " network check nameserver"
-                                                    mydns=`cat /etc/resolv.conf|grep nameserver|head -1|awk '{ print $2}'`
-                                                    ping -c 1 $mydns
-                                                    if [ ! $? = 0 ]
-                                                    then
-                                                        exit 5
-                                                    fi
-                                ;;
-                                check_names)
-                                            echo "network check resolve names"
-                                            host google.com
-                                            if [ ! $? = 0 ]
-                                            then
-                                                exit 6
-                                            fi
-                                ;;
-                                host_names)
-                                            #if host is found, then check to see if it's online
-                                            #if hoip matchs my ip assume it's ok
-                                            echo "network check my hostname $hostname"
-                                            hout=`host $hostname|head -n1`
-                                            status=$?
-                                            hoip=`echo $hout|awk  '{print $4}'`
-                                            if [ $hoip = found: ]
-                                            then
-                                                status=1
-                                            fi
 
-                                            unkownhost=`host unkown.linhes.org |head -n1 `
-                                            unkownhostip=`echo $unkownhost |awk  '{print $4}'`
-
-                                            #found host, now grab the ip
-                                            if [ $status = 0 ]
-                                            then
-                                                hoip=`echo $hout|awk  '{print $4}'`
-                                                /sbin/ifconfig -a |grep -q $hoip
-                                                if [  $? = 0 ]
-                                                then
-                                                    echo "DNS ip matches on of my ips $hoip"
-                                                    status=0
-                                                else
-                                                    if [ $unkownhostip = $hoip ]
-                                                    then
-                                                        echo "Bad DNS returning false hits"
-                                                        echo "Assuming hostname is OK"
-                                                        echo "DNS unknown: $unkownhostip"
-                                                        echo "    HOSTDNS: $hoip       "
-                                                        /sbin/ifconfig -a |grep "inet addr"
-                                                    else
-                                                        echo "IP in DNS but doesn't match mine, hostname is not safe to use"
-                                                        echo "DNS:$hoip"
-                                                        echo "HOST: "
-                                                        /sbin/ifconfig -a |grep "inet addr"
-                                                        status=7
-                                                     fi
-                                                fi
-                                            else
-                                              echo "Couldn't find hostname in DNS, must be safe to use"
-                                              status=0
-                                            fi
-                                            exit $status
-                                ;;
+    upgrade_it)
+            mv_install.py --rootdisk=$disk --rootfs=$rootfs -c upgrade
+            ;;
 
-                            esac
-                        exit 0
+    disk_model_it)
+            model="unknown"
+            size="xxx"
+            case $2 in
+                h* )
+                        model=`cat /proc/ide/$2/model`
+                        ;;
+                s*)     model=`sginfo /dev/$2|grep Product|awk ' { print $2 } '`
+                        ;;
+            esac
+            size=`parted /dev/$2  print |grep Disk|awk  ' { print $3 } '  `
+            echo ""$model" $size " >/tmp/model
             ;;
 
+    network_check_it)
+            #Should never return from check_network
+            case $2 in
+                    setup_network)
+                                vnc_check
+                                install_network_setup
+                    ;;
+
+                    check_self)
+                                myipdefault=`ifconfig  | grep -C1 $default_interface| grep -v $default_interface | cut -d: -f2 | awk '{ print $1}'`
+                                echo "network check myself"
+                                ifconfig
+                                ping -c 1 $myipdefault
+                                if [ ! $? = 0 ]
+                                then
+                                    exit 3
+                                    #can't ping yourself
+                                fi
+                    ;;
+                    check_gw)
+                                #check gateway
+                                echo "network check gateway"
+                                /sbin/route -n
+                                mygwdefault=`/sbin/route -n  |grep $default_interface|grep UG|awk '{ print $2}'`
+                                echo "Default gateway seems to be $mygwdefault"
+                                if  [ !  x$mygwdefault = x ]
+                                then
+                                    sleep 2
+                                    ping -c 5 $mygwdefault
+                                    if [ ! $? = 0 ]
+                                    then
+                                        exit 4
+                                    fi
+                                fi
+                    ;;
+                    check_ns)
+                                #check nameserver
+                                        echo " network check nameserver"
+                                        mydns=`cat /etc/resolv.conf|grep nameserver|head -1|awk '{ print $2}'`
+                                        ping -c 1 $mydns
+                                        if [ ! $? = 0 ]
+                                        then
+                                            exit 5
+                                        fi
+                    ;;
+                    check_names)
+                                echo "network check resolve names"
+                                host google.com
+                                if [ ! $? = 0 ]
+                                then
+                                    exit 6
+                                fi
+                    ;;
+                    host_names)
+                                #if host is found, then check to see if it's online
+                                #if hoip matchs my ip assume it's ok
+                                echo "network check my hostname $hostname"
+                                hout=`host $hostname|head -n1`
+                                status=$?
+                                hoip=`echo $hout|awk  '{print $4}'`
+                                if [ $hoip = found: ]
+                                then
+                                    status=1
+                                fi
+
+                                unkownhost=`host unkown.linhes.org |head -n1 `
+                                unkownhostip=`echo $unkownhost |awk  '{print $4}'`
+
+                                #found host, now grab the ip
+                                if [ $status = 0 ]
+                                then
+                                    hoip=`echo $hout|awk  '{print $4}'`
+                                    /sbin/ifconfig -a |grep -q $hoip
+                                    if [  $? = 0 ]
+                                    then
+                                        echo "DNS ip matches on of my ips $hoip"
+                                        status=0
+                                    else
+                                        if [ $unkownhostip = $hoip ]
+                                        then
+                                            echo "Bad DNS returning false hits"
+                                            echo "Assuming hostname is OK"
+                                            echo "DNS unknown: $unkownhostip"
+                                            echo "    HOSTDNS: $hoip       "
+                                            /sbin/ifconfig -a |grep "inet addr"
+                                        else
+                                            echo "IP in DNS but doesn't match mine, hostname is not safe to use"
+                                            echo "DNS:$hoip"
+                                            echo "HOST: "
+                                            /sbin/ifconfig -a |grep "inet addr"
+                                            status=7
+                                            fi
+                                    fi
+                                else
+                                    echo "Couldn't find hostname in DNS, must be safe to use"
+                                    status=0
+                                fi
+                                exit $status
+                    ;;
+
+                esac
+            exit 0
+        ;;
 
-        * )
+    * )
         if [ -f /tmp/.install_state ]
         then
                 state=`cat /tmp/.install_state`
@@ -709,7 +179,7 @@ echo "-----------------------------------------------------------------------3--
 
                 if [ -f /tmp/.startsize.io ]
                 then
-                     . /tmp/.startsize.io
+                    . /tmp/.startsize.io
                     #finding the drive
                     ddrive=`df |  grep $mountpoint | head -n1 | awk -F/ ' { print $3 } ' | cut -d" " -f 1|cut -b1,2,3 `
                     used=`statgrab -M disk.|grep ${ddrive}.write_bytes|cut -d= -f 2|tr -d " "`
@@ -740,7 +210,7 @@ echo "-----------------------------------------------------------------------3--
                 fi
             fi
         fi
-        ;;
+    ;;
 esac
 
 
diff --git a/abs/core-testing/LinHES-config/mv_config.py b/abs/core-testing/LinHES-config/mv_config.py
new file mode 100755
index 0000000..02cf1d9
--- /dev/null
+++ b/abs/core-testing/LinHES-config/mv_config.py
@@ -0,0 +1,16 @@
+# -*- coding: utf-8 -*-
+SYSTEMTYPE="LinHES"
+MVHOSTNAME="larch5"
+MOUNTPOINT="/new_boot"
+DATAMOUNT="/myth"
+MYTHHOME="/home/mythtv"
+SQUASHFILE="/tmp/.squashlist"
+SQUASHLIST=("bin","boot","etc","home","lib","opt","root","sbin","usr","var","data")
+NOOPDEBUG="TRUE"
+BACKUPFILE="mythconverg.sql.gz"
+BACKUPPATH="/myth/backup/"
+TEMP_TEMPLATES="/tmp/templates"
+
+
+
+
diff --git a/abs/core-testing/LinHES-config/mv_install.py b/abs/core-testing/LinHES-config/mv_install.py
new file mode 100755
index 0000000..f9359e4
--- /dev/null
+++ b/abs/core-testing/LinHES-config/mv_install.py
@@ -0,0 +1,1246 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+import sys , os, commands , shutil,glob,time
+import getopt,re
+import logging
+try:
+    import parted
+except:
+    print "module parted not found"
+
+def usage():
+    print "help text:"
+    print "example usage:  --rootdisk=sda --rootfs=ext4 --rootsize=34240 --datafs=ext4 --datasize=3400 --datadisk=sda --swapsize=340 -c full_install"
+
+def clean_upgrade():
+    return False
+
+def progress(pgnum):
+    progressline=str(pgnum)+ " complete"
+    logging.debug("Progress: %s" , pgnum)
+    f = open('/tmp/.install_percent', 'w')
+    f.write(progressline)
+    f.close()
+
+def update_status(status):
+    logging.debug("Status: %s" , status)
+    f = open('/tmp/.install_state', 'w')
+    f.write(str(status))
+    f.close()
+
+def kill_dhcp_chroot():
+    logging.debug("Killing off chroot dhcpcd")
+    stddir=os.getcwd()
+    piddir=("%s/var/run/") %data_config.MOUNTPOINT
+    try:
+        os.chdir(piddir)
+        for FILE in glob.glob("dhcpcd-*.pid"):
+            f=open(FILE,'r')
+            pid=f.readline()
+            f.close
+            cmd="kill -9 %s" %pid
+            runcmd(cmd)
+            os.remove(FILE)
+        os.chdir(stddir)
+    except:
+        pass
+
+def statgrab(disk):
+    cmd="statgrab -M disk. |grep %s.write_bytes" % hostoptions["rootdisk"]
+    out=commands.getoutput(cmd)
+    try:
+        prewritebytes=out.split("=")[1].strip()
+    except:
+        prewritebytes="1024"
+    outline="STARTSIZE=%s" %prewritebytes
+    f = open('/tmp/.startsize.io', 'w')
+    f.write(str(outline))
+    f.close()
+
+def backup_sql_check():
+    logging.debug("Searching for backup file")
+    try:
+        hostoptions["backupfile"]
+    except:
+        logging.debug("Backup file var is empty")
+        return False
+    if os.path.exists(hostoptions["backupfile"]):
+        logging.debug("Backup file %s is present",hostoptions["backupfile"])
+        return True
+    else:
+        logging.debug("Backup file %s is NOT present",hostoptions["backupfile"])
+        return False
+
+def mdadm_find(PREFIX):
+    logging.debug("Searching for mdadm.conf")
+    if os.path.exists(PREFIX+"/etc/KnoppMyth-version"):
+        mdadmconf="/etc/mdadm/mdadm.conf"
+    else:
+        mdadmconf="/etc/mdadm.conf"
+    logging.debug("Using %s for mdadm.conf",mdadmconf)
+    return mdadmconf
+
+def mdadm_assemble_all():
+    # read mdadm.conf and start the arrays
+    #ARRAY /dev/md5 uuid=19464854:03f71b1b:e0df2edd:246cc977
+    logging.debug("Starting mdadm support")
+    mdadmconf_file=mdadm_find("/tmp")
+    cmd="cdadm --assemble --scan -c /tmp/%s" %mdadmconf_file
+    runcmd(cmd)
+    mdadm_contents=''
+    try:
+        f=open(mdadmconf_file, 'r')
+        mdadm_contents=f.readlines
+        f.close()
+    except:
+        logging.debug("     Couldn't open mdadmconf file")
+    for line in mdadm_contents:
+        if line.startswith("ARRAY"):
+            logging.debug("     Found MD array: %s",line)
+            array=line.split()[1]
+            logging.info("      assembling array: %s",array)
+            cmd="mdadm --assemble -c /tmp%s %s" %(mdadmconf_file,array)
+            runcmd(cmd)
+            time.sleep(2)
+            cmd="fsck -p %s" %array
+            runcmd
+
+def copy_updates():
+    try:
+        MVROOT=os.environ["MV_ROOT"]
+    except:
+        logging.debug("MVROOT was not defined, using the default value")
+        MVROOT="/usr/MythVantage"
+    cp_and_log2(MVROOT+"/bin/",data_config.MOUNTPOINT+MVROOT+"/bin","*.sh")
+    cp_and_log2(MVROOT+"/bin/",data_config.MOUNTPOINT+MVROOT+"/bin","*.py")
+
+def timezone_to_db(timefile):
+    logging.info("LOOK TIMEZONE TO DB needs to be completed")
+
+
+def cp_and_log(srcfile,destfile):
+    #return
+    if not os.path.exists(srcfile):
+        logging.info("%s is not present, skipping...",srcfile)
+    else:
+        cmd=("rsync -arvp %s %s") %(srcfile,destfile)
+        runcmd(cmd)
+        #if os.path.isdir(srcfile):
+            #logging.info("Copying directory %s to %s",srcfile,destfile)
+            #try:
+                #shutil.copytree(srcfile,destfile)
+            #except:
+                #logging.debug("Couldn't copy directory %s  using file by file", srcfile)
+                #try:
+                    #stddir=os.getcwd()
+                    #os.chdir(srcfile)
+                    #for FILE in glob.glob("*"):
+                        #print FILE
+                        #shutil.copy2(FILE, destfile+"/"+FILE)
+                    #os.chdir(stddir)
+                #except:
+                    #logging.info("Dir File by file failed: %s", srcfile)
+
+        #elif os.path.isfile(srcfile):
+            #logging.info("Copying File %s to %s",srcfile,destfile)
+            #try:
+                #shutil.copy(srcfile,destfile)
+            #except:
+                #logging.info("Couldn't copy file %s",srcfile)
+        #else:
+            #logging.debug("Src file is not a file or a directory")
+
+def cp_and_log2(srcfile,destfile,fileglob):
+    #return
+    logging.debug("cp_and_log2")
+    logging.debug("%s , %s , %s" ,srcfile ,destfile, fileglob)
+
+    if not os.path.exists(srcfile):
+        logging.info("%s is not present, skipping...",srcfile)
+    else:
+        if fileglob=='':
+            cmd=("rsync -arvp %s %s") %(srcfile,destfile)
+            runcmd(cmd)
+        else:
+            fileglob="*"
+            cmd=("rsync -arvp %s/%s %s") %(srcfile,fileglob,destfile)
+            runcmd(cmd)
+        #if os.path.isdir(srcfile):
+                #logging.info("Copying directory %s to %s",srcfile,destfile)
+                #try:
+                    #shutil.copytree(srcfile,destfile)
+                #except:
+                    #logging.debug("Couldn't copy directory %s  using file by file", srcfile)
+                    #try:
+                        #stddir=os.getcwd()
+                        #os.chdir(srcfile)
+                        #for FILE in glob.glob(fileglob):
+                            #logging.debug("copying file %s to %s" ,FILE,destfile+FILE)
+                            #shutil.copy2(FILE, destfile+FILE)
+                        #os.chdir(stddir)
+                    #except:
+                        #logging.info("Dir File by file failed: %s", srcfile)
+        #elif os.path.isfile(srcfile):
+            #logging.info("Copying File %s to %s",srcfile,destfile)
+            #try:
+                #shutil.copy(srcfile,destfile)
+            #except:
+                #logging.info("Couldn't copy file %s",srcfile)
+        #else:
+            #logging.debug("Src file is not a file or a directory")
+
+def runcmd(cmd):
+    if data_config.NOOPDEBUG=="FALSE":
+        pass
+    else:
+        cmd="echo "+cmd
+    logging.debug("    %s",cmd)
+    cmdout=commands.getoutput(cmd)
+    logging.debug("    %s",cmdout)
+    return cmdout
+
+def mysqldb(cmd,inchroot):
+    if cmd=="start":
+        mycmd="  /etc/rc.d/mysqld start"
+    elif cmd=="stop":
+        mycmd="  /etc/rc.d/mysqld stop"
+    if inchroot=="chroot":
+        mycmd="  chroot %s" %mycmd
+    runcmd(mycmd)
+
+
+def mount_bind_chroot():
+    logging.debug("Mounting dev/proc/sysfs for chroot")
+    cmd="  mount --bind /dev %s" %data_config.MOUNTPOINT+"/dev"
+    runcmd(cmd)
+    cmd="  mount --bind /proc %s" %data_config.MOUNTPOINT+"/proc"
+    runcmd(cmd)
+    cmd="  mount -t sysfs none  %s" %data_config.MOUNTPOINT+"/sys"
+    runcmd(cmd)
+
+def umount_bind_chroot():
+    logging.debug("UnMounting dev/proc/sysfs for chroot")
+    cmd="  umount -l %s" %data_config.MOUNTPOINT+"/dev"
+    runcmd(cmd)
+    cmd="  umount -l %s" %data_config.MOUNTPOINT+"/proc"
+    runcmd(cmd)
+    cmd="  umount -l %s" %data_config.MOUNTPOINT+"/sys"
+    runcmd(cmd)
+
+
+def partitions_removeall(diskdevice,label):
+    logging.info("Removing all partitions for %s  %s" ,label,diskdevice)
+    device=parted.getDevice(diskdevice)
+    partdisk=parted.Disk(device)
+    partdisk.deleteAllPartitions()
+    if data_config.NOOPDEBUG=="FALSE":
+        partdisk.commit()
+
+    for partition in partdisk.partitions:
+            print "type: %s" %partition.type
+
+def create_partitions(diskdevice,size,ptype,startsector):
+    logging.debug("_____Create partitions______")
+    if size=="NO":
+        logging.info("Size is 0, skipping")
+        return "NO"
+    partlist = []
+    newstart=0
+    totalused=0
+    device=parted.getDevice(diskdevice)
+    partdisk=parted.Disk(device)
+    for partition in partdisk.partitions:
+            if partition.type != parted.PARTITION_FREESPACE:
+                partlist.append((partition,
+                            partition.path,
+                            partition.getFlag(parted.PARTITION_BOOT),
+                            partition.geometry.start,
+                            partition.geometry.end,
+                            partition.geometry.length,
+                            partition.type,
+                            partition.fileSystem))
+    for slice in partlist:
+        (usedpartition, usedpath, usedbootable, usedstart, usedend, usedlength, usedtype, usedfs) = slice
+        #Start the new partition one after the end of last
+        newstart=usedend+1
+
+    if  startsector==0:
+        newstart=0
+    if size=="ALL":
+        logging.debug("     Using the rest of the disk  %s",(device.length-newstart) )
+        try:
+            geom = parted.Geometry(device=device, start=newstart, length=(device.length-newstart))
+        except:
+            logging.info("An error occured, probably invalid parition size")
+            return
+    else:
+        # convert size in MB to a length on the device in sectors
+        length = (int(size) * (1024 * 1024)) / device.sectorSize
+        logging.debug("Size is %s",length)
+        try:
+            geom = parted.Geometry(device=device, start=newstart, length=length)
+        except:
+            logging.info("An error occured, probably invalid parition size")
+            return
+    #collect device constraint
+    constraint = device.getConstraint()
+    # new partition
+    if ptype=="NORMAL":
+        newpart = parted.Partition(disk=partdisk,type=parted.PARTITION_NORMAL, geometry=geom)
+    elif ptype=="SWAP":
+        newpart = parted.Partition(disk=partdisk,type=parted.PARTITION_NORMAL, geometry=geom)
+
+    #add the partition to the disk and commit changes
+    partdisk.addPartition(partition=newpart, constraint=constraint)
+    if data_config.NOOPDEBUG=="FALSE":
+        partdisk.commit()
+    logging.info("created partition %s of %dMB and added it to %s" %
+                (newpart.getDeviceNodeName(), newpart.getSize(), diskdevice))
+    return newpart.getDeviceNodeName()
+
+
+def partition_disk():
+    global hostoptions
+    logging.info("Partitioning")
+    logging.debug("____start of partition_disk____")
+    rootdisk=hostoptions["rootdisk"]
+    datadisk=hostoptions["datadisk"]
+    label="root"
+    partitions_removeall("/dev/"+rootdisk,label)
+    label="data"
+    partitions_removeall("/dev/"+datadisk,label)
+    hostoptions["rootpartition"]=create_partitions("/dev/"+rootdisk,hostoptions["rootsize"],"NORMAL",0)
+    hostoptions["swappartition"]=create_partitions("/dev/"+rootdisk,hostoptions["swapsize"],"SWAP",1)
+    if datadisk!=rootdisk:
+        hostoptions["datapartition"]=create_partitions("/dev/"+datadisk,hostoptions["datasize"],"NORMAL",0)
+    else:
+        hostoptions["datapartition"]=create_partitions("/dev/"+datadisk,hostoptions["datasize"],"NORMAL",1)
+    time.sleep(5)
+
+def fscmd(fstype):
+    fscmds = {"reiserfs":"mkreiserfs -1 -l ROOT" , "xfs": "mkfs -t xfs -f" , "ext3": "mkfs.ext3","jfs":"mkfs.jfs -q","ext4":"mkfs.ext4","Do_not_format":"noformat","no_format":"noformat"}
+    try:
+        rc=fscmds[fstype]
+    except:
+        logging.critical(" %s is not a valid fs type, exiting now",fstype)
+        sys.exit(3)
+    return rc
+
+
+def format_disk(install_type):
+    logging.info("______Starting Disk Format______")
+    rootfs=fscmd(hostoptions["rootfs"])
+    datafs=fscmd(hostoptions["datafs"])
+
+    rootdisk=hostoptions["rootdisk"]
+    datadisk=hostoptions["datadisk"]
+    rootpartition=hostoptions["rootpartition"]
+    datapartition=hostoptions["datapartition"]
+    if install_type!="upgrade":
+        swapsize=hostoptions["swapsize"]
+        swappartition=hostoptions["swappartition"]
+
+    logging.debug("     Format command for rootfs  %s : %s ", rootfs,rootpartition)
+    if ( rootfs != "noformat"):
+        logging.info("Starting format of %s",rootpartition)
+        cmd="  %s /dev/%s" %( rootfs , rootpartition)
+        #os.system(cmd)
+        runcmd(cmd)
+    else:
+        logging.info("Will not format root partition: %s",rootpartition)
+
+    logging.debug("     Format command for datafs  %s : %s ", datafs,datapartition)
+    if (datafs != "noformat"):
+        logging.info("Starting format of %s",datapartition)
+        cmd="  %s /dev/%s" %( datafs , datapartition)
+        #os.system(cmd)
+        runcmd(cmd)
+    else:
+        logging.info("Will not format data partition: %s", datapartition)
+
+    if install_type=="install":
+        if (hostoptions["swapsize"] != "NO"):
+            logging.info("Starting format for swap %s",swappartition)
+            cmd="  mkswap /dev/%s" % swappartition
+            #os.system(cmd)
+            runcmd(cmd)
+        else:
+            logging.debug("     Swap is set to NO, will not run mkswap")
+
+    logging.debug("_____End of format______")
+
+
+def mount_it():
+    logging.info("______Mounting disk______")
+#   Create mount points
+    try:
+        mountpoint=data_config.MOUNTPOINT
+        mp=mountpoint
+        logging.info("Creating mountpoints %s",mp)
+        os.makedirs(mp)
+    except OSError:
+        logging.debug("     Could not create %s",mp)
+
+#   Mount root
+    cmd="mount /dev/%s %s"  %(hostoptions["rootpartition"],mountpoint)
+    runcmd(cmd)
+    #logging.debug(cmd)
+    #cmdout=commands.getoutput(cmd)
+    #logging.debug(cmdout)
+#   Mount data
+#make mountpoint after mounting /
+    try:
+        mountpoint=data_config.MOUNTPOINT
+        datapoint=data_config.DATAMOUNT
+        mp=mountpoint+datapoint
+        logging.info("Creating mountpoints %s",mp)
+        os.makedirs(mp)
+    except OSError:
+        logging.debug("     Could not create %s",mp)
+
+    cmd="mount /dev/%s %s"  %(hostoptions["datapartition"],mp)
+    runcmd(cmd)
+    #logging.debug(cmd)
+    #cmdout=commands.getoutput(cmd)
+    #logging.debug(cmdout)
+
+def unmount_it():
+    logging.info("______Unmounting disk______")
+    cmd="umount  %s"  %(data_config.MOUNTPOINT+data_config.DATAMOUNT)
+    runcmd(cmd)
+    time.sleep(2)
+
+    cmd="swapoff /dev/%s" %(hostoptions["swappartition"])
+    runcmd(cmd)
+
+    cmd="sync"
+    runcmd(cmd)
+
+    cmd="umount   %s"  %(data_config.MOUNTPOINT)
+    runcmd(cmd)
+    cmd="sync"
+    runcmd(cmd)
+
+
+def create_squashlist():
+    logging.debug("Creating squashlist")
+    squashfile=data_config.SQUASHFILE
+    f = open(squashfile, 'w')
+    for i in data_config.SQUASHLIST:
+        f.write(i)
+        f.write("\n")
+        logging.debug(i)
+    f.close()
+
+
+def copy_it(install_type):
+    logging.info("______Transferring to disk______")
+    logging.debug(  install_type)
+    if ( install_type == "install"):
+        logging.info("Transferring system")
+        cmd="  unsquashfs -f -d %s /.livesys/medium/system.sqf" %(data_config.MOUNTPOINT)
+        runcmd(cmd)
+        #logging.debug(cmd)
+        #cmdout=commands.getoutput(cmd)
+
+    if ( install_type == "upgrade"):
+        logging.info("Upgrading system")
+        create_squashlist()
+        cmd="  unsquashfs -e %s -f -d %s /.livesys/medium/system.sqf" %(data_config.SQUASHFILE , data_config.MOUNTPOINT)
+        runcmd(cmd)
+        #logging.debug(cmd)
+        #cmdout=commands.getoutput(cmd)
+#   Create the missing dir
+    i=("sys","proc","dev","tmp","mnt","media","media/cdrom","media/dvd","var/log/mythtv")
+    mountpoint=data_config.MOUNTPOINT
+    for item in i:
+        try:
+            mp=mountpoint+"/"+item
+            logging.info("Creating mountpoints %s",mp)
+            os.makedirs(mp)
+        except OSError:
+            logging.debug("     __Could not create %s",mp)
+#   General fixup
+    cmd="chmod 777 %s/tmp" %(data_config.MOUNTPOINT)
+    runcmd(cmd)
+    cmd="mknod %s/dev/null c 1 5" %(data_config.MOUNTPOINT)
+    runcmd(cmd)
+    cmd="mknod %s/dev/console c 5 1" %(data_config.MOUNTPOINT)
+    runcmd(cmd)
+    cmd="chmod +s  %s/usr/bin/Xorg" %(data_config.MOUNTPOINT)
+    runcmd(cmd)
+    cmd="chmod +s  %s/usr/bin/crontab" %(data_config.MOUNTPOINT)
+    runcmd(cmd)
+    cmd="chmod +s  %s/usr/bin/sudo" %(data_config.MOUNTPOINT)
+    runcmd(cmd)
+    cmd="chmod +s  %s/bin/mount" %(data_config.MOUNTPOINT)
+    runcmd(cmd)
+    logging.debug("__End of copy_it__")
+
+def create_fstab(extralines):
+    logging.debug("______Creating new fstab file_______")
+    logging.info("Creating new fstab file")
+    fstabfile=data_config.MOUNTPOINT+"/etc/fstab"
+    fstab_list=[]
+    f = open(fstabfile, 'w')
+    line="# <file system>        <dir>         <type>    <options>          <dump> <pass> \n"
+    fstab_list.append(line)
+    line="none                   /dev/pts      devpts    defaults            0      0 \n"
+    fstab_list.append(line)
+    line="none                   /dev/shm      tmpfs     defaults            0      0\n"
+    fstab_list.append(line)
+    line="/dev/cdrom /media/cdrom   auto    ro,user,noauto,unhide   0      0\n"
+    fstab_list.append(line)
+    line="/dev/dvd /media/dvd   auto    ro,user,noauto,unhide   0      0\n"
+    fstab_list.append(line)
+    line="UUID=ROOTUID /  auto defaults,noatime 0 1\n"
+    fstab_list.append(line)
+    line="UUID=DATAUID %s  auto defaults,noatime 0 1\n" %(data_config.DATAMOUNT)
+    fstab_list.append(line)
+    line="UUID=SWAPUID swap swap defaults  0 0 \n"
+    fstab_list.append(line)
+    for vline in extralines:
+        fstab_list.append(vline)
+    for outline in fstab_list:
+        logging.debug(outline)
+        f.write(outline)
+    f.close()
+
+def find_uuid(partition):
+    logging.info("Finding the UUID for %s...",partition)
+    cmd="blkid -s UUID /dev/%s" %partition
+    tmpuuid=runcmd(cmd)
+    splituuid=tmpuuid.partition("=")
+    uuid=splituuid[2].replace('"',"")
+    logging.info("The uuid is %s",uuid)
+    return uuid.strip()
+
+def pick_out_vg():
+    logging.info("Searching for Volume Groups in old fstab")
+    vglines=[]
+    f = open("/tmp/etc/fstab", 'r')
+    oldfscontents=f.readlines()
+    for line in oldfscontents:
+        if line.startswith("/dev/vg"):
+            vglines.append(line)
+            templine=line.split()
+            mdir=templine[1]
+            if not os.path.exists (mdir):
+                logging.debug("Creating dir %s for VG mount",mdir)
+                os.makedirs (mdir)
+#               Might need to os.chown to mythtv:users
+            else:
+                logging.debug("Directory %s for VG mount already present",mdir)
+    return vglines
+
+def fstab_it(install_type):
+    logging.info("______Checking fstab______")
+    kmvg=[]
+    fstabfile=data_config.MOUNTPOINT+"/etc/fstab"
+#   Check for knoppmyth install, if found create new
+    if install_type=="upgrade":
+        if os.path.exists("/tmp/etc/KnoppMyth-version"):
+            logging.debug("     KnoppMyth-Version found, creating new fstab")
+            kmvg=pick_out_vg()
+            create_fstab(kmvg)
+        elif os.path.exists("/tmp/etc/fstab"):
+                logging.debug("     Upgrade and not Knoppmyth, using old fstab")
+                cp_and_log("/tmp/etc/fstab",fstabfile)
+#   Catch all for creating new fstab
+    if not os.path.exists(data_config.MOUNTPOINT+"/etc"):
+        os.makedirs(data_config.MOUNTPOINT+"/etc")
+    if not os.path.exists(fstabfile):
+       create_fstab(kmvg)
+
+    logging.info("____UUID check for %s" , "swap")
+    swapuuid=find_uuid(hostoptions["swappartition"])
+
+    logging.info("____UUID check for %s" , "data")
+    datauuid=find_uuid(hostoptions["datapartition"])
+
+    logging.info("____UUID check for %s" , "root")
+    rootuuid=find_uuid(hostoptions["rootpartition"])
+
+    fstabfile=data_config.MOUNTPOINT+"/etc/fstab"
+    logging.info("Correcting UUID's in %s",fstabfile)
+    f = open(fstabfile, 'r')
+    oldfscontents=f.readlines()
+    newfstab=[]
+    f.close
+    for line in oldfscontents:
+        if line.startswith("UUID"):
+            templine=line.split()
+            if ( templine[1] == "/"):
+                logging.debug("     Found Root fstab line:")
+                logging.debug(      templine)
+                templine[0]="UUID=%s" %(rootuuid)
+                newline=''
+                for i in templine:
+                    newline+=i
+                    newline+="    "
+                newline+="\n"
+                logging.debug("     New fstab line:")
+                logging.debug(      newline)
+                newfstab.append(newline)
+
+            if ( templine[1] == data_config.DATAMOUNT):
+                logging.debug("     Found DATA mount")
+                logging.debug(      templine)
+                templine[0]="UUID=%s" %(datauuid)
+                newline=''
+                for i in templine:
+                    newline+=i
+                    newline+="    "
+                newline+="\n"
+                logging.debug("     New fstab line:")
+                logging.debug(      newline)
+                newfstab.append(newline)
+
+            if ( templine[1] == "swap"):
+                if len(swapuuid) <= 5:
+                    logging.debug("     swapp uuid is to small")
+                else:
+                    logging.debug("     Found swap partition")
+                    logging.debug(      templine)
+                    templine[0]="UUID=%s" %(swapuuid)
+                    newline=''
+                    for i in templine:
+                        newline+=i
+                        newline+="    "
+                    newline+="\n"
+                    logging.debug("     New fstab line:")
+                    logging.debug(      newline)
+                    newfstab.append(newline)
+        else:
+            logging.debug("     Line didn't match, adding to newfstab:")
+            logging.debug(      line)
+            newfstab.append(line)
+    logging.info("Writing out newfstab")
+    logging.debug("______This is the new fstab_____")
+    f = open(fstabfile, 'w')
+    for line in newfstab:
+        logging.debug(line)
+        f.write(line)
+        #f.write("\n")
+    f.close()
+
+def grub_it():
+    logging.info("______Start of grub install______")
+    cmd="  grub-install --recheck --no-floppy --root-directory=%s \"(hd0)\" "  % data_config.MOUNTPOINT
+    logging.info("Running grub-install")
+    runcmd(cmd)
+    rootuuid=find_uuid(hostoptions["rootpartition"])
+    cmd="  mkinitcpio -g %s/boot/kernel26.img" % data_config.MOUNTPOINT
+    logging.info("Running mkinitcpio")
+    runcmd(cmd)
+    logging.info("Adding root uuid to grub menu")
+    grubfile=data_config.MOUNTPOINT+"/boot/grub/menu.lst"
+    try:
+        f = open(grubfile, 'r')
+        oldgrub=f.readlines()
+        newgrub=[]
+        f.close
+        for line in oldgrub:
+            if line.startswith("kernel"):
+                templine=line.split()
+                logging.debug("     Found kernel Root grubline:")
+                logging.debug(      templine)
+                templine[2]="root=/dev/disk/by-uuid/%s" %(rootuuid)
+                newline=''
+                for i in templine:
+                    newline+=i
+                    newline+="    "
+                newline+="\n"
+                logging.debug("     New grub menu.lst  line:")
+                logging.debug(      newline)
+                newgrub.append(newline)
+            else:
+                logging.debug("Line didn't match, adding to newgrub:")
+                logging.debug(      line)
+                newgrub.append(     line)
+        logging.info("Writing out new grub file")
+        logging.debug("______This is the new grub_____")
+        f = open(grubfile, 'w')
+        for line in newgrub:
+            logging.debug(line)
+            f.write(line)
+        f.close()
+    except:
+        logging.debug("Couldn't open grub file")
+
+def fix_permissions():
+    logging.info("Fixing permissions")
+    SE=os.environ["TEMPLATES"]+"/settings/syssettings"
+    cmd="  chmod -R 755  %s" %(data_config.MOUNTPOINT+SE)
+    runcmd(cmd)
+    cmd="  chmod 755  %s" %(data_config.MOUNTPOINT+"/etc/systemconfig")
+    runcmd(cmd)
+    cmd="  chmod 755  %s" %(data_config.MOUNTPOINT+"/root")
+    runcmd(cmd)
+    cmd="  chown root:mythtv  %s" %(data_config.MOUNTPOINT+"/etc/systemconfig")
+    runcmd(cmd)
+    cmd="  chown -R mythtv:mythtv  %s" %(data_config.MOUNTPOINT+SE)
+    runcmd(cmd)
+    cmd="  chown -R mythtv:mythtv  %s" %(data_config.MOUNTPOINT+"/var/log/mythtv")
+    runcmd(cmd)
+
+def apply_new_auth():
+    logging.info("_____Applying Password updates_______")
+    passfile="/root/myth_user_call.out"
+    try:
+        MVROOT=os.environ["MV_ROOT"]
+    except:
+        logging.debug("MVROOT was not defined, using the default value")
+        MVROOT="/usr/MythVantage"
+    if data_config.NOOPDEBUG=="FALSE":
+        cmdprefix="chroot " + data_config.MOUNTPOINT + " " + MVROOT+"/bin/myth_user_call -i "
+    else:
+        cmdprefix="echo chroot " + data_config.MOUNTPOINT + " " + MVROOT+"/bin/myth_user_call -i "
+    try:
+        f = open(passfile, 'r')
+        passcmds=f.readlines()
+        f.close
+        for cmd in passcmds:
+            execmd=cmdprefix+cmd
+#            Using os.system because runcmd fails
+            logging.debug(execmd)
+            os.system(execmd)
+    except:
+        logging.debug("Applying password updates failed, couldn't open %s",passfile)
+    logging.debug
+
+def swapsearch():
+#currently unused!
+    partlist = []
+    stddir=os.getcwd()
+    os.chdir("/sys/block")
+    partitionlist=glob.glob("*")
+    for item in partitionlist:
+            try:
+                newitem=item.strip().rpartition(" ")[2]
+                if (not newitem=='') and  (not newitem.startswith("loop")):
+                    path="/dev/"+newitem.strip()
+                    path=path.strip()
+                    device = parted.getDevice(path)
+                    (cylinders, heads, sectors) = device.biosGeometry
+                    sizeInBytes = device.length * device.sectorSize
+                    disk = parted.Disk(device)
+                    for partition in disk.partitions:
+                        if partition.type == parted.PARTITION_PROTECTED or \
+                        partition.type == parted.PARTITION_METADATA or \
+                        partition.type == parted.PARTITION_FREESPACE:
+                            continue
+
+                        partlist.append((partition,
+                                        partition.path,
+                                        partition.getFlag(parted.PARTITION_BOOT),
+                                        partition.geometry.start,
+                                        partition.geometry.end,
+                                        partition.geometry.length,
+                                        partition.type,
+                                        partition.fileSystem))
+                    for slice in partlist:
+                        (partition, path, bootable, start, end, length, type, fs) = slice
+                        if partition.getFlag(parted.PARTITION_SWAP) or fs.type=="linux-swap":
+                            print "found swap"
+                            print path
+            except:
+                pass
+    os.chdir(stddir)
+
+def sane_settings(file):
+    #Remove some settings from file_name
+    removeline=("HOSTrootfstype", "HOSTrootfstype", "HOSTdatafstype", "HOSTOSsize", "HostUseALLdata", "HOSTDATAsize", "HOSTuprootfstype", "HostUseSWAP", "HOSTSWAPsize")
+    logging.debug("__Running sane settings")
+    try:
+        f = open(file, 'r')
+        filecontents=f.readlines()
+        f.close
+    except:
+        logging.debug("     Couldn't find file %s to sane",file)
+    try:
+        f = open(file,'w')
+        for line in filecontents:
+            for item in removeline:
+                if line.startsize(line.strip()):
+                    logging.debug("     Found a line to remove in %s, %s",file,line)
+                else:
+                    f.write(line)
+    except:
+        logging.debug("     Couldn't open file %s for writing",file)
+    logging.debug("     __End  sane settings")
+
+def restore_default_settings():
+    try:
+        MVROOT=os.environ["MV_ROOT"]
+    except:
+        logging.debug("     MVROOT was not defined, using the default value")
+        MVROOT="/usr/MythVantage"
+    logging.info("Saving syssettings")
+    cmd="%s/bin/restore_default_settings.sh -c save -t syssettings -h %s -d localhost" %(MVROOT,data_config.MVHOSTNAME)
+    runcmd(cmd)
+    SE=os.environ["TEMPLATES"]+"/settings/syssettings/"
+    cp_and_log(SE,data_config.MOUNTPOINT+SE)
+    cp_and_log("/etc/mtab",data_config.MOUNTPOINT+"/etc/mtab")
+    copy_updates()
+    fix_permissions()
+
+def full_install(hostoptions):
+    logging.info("______Start of full install______")
+
+    try:
+        os.remove("/tmp/.this_is_upgrade")
+    except OSError:
+        logging.debug("     File /tmp/.this_is_upgrade not present, couldn't delete it")
+        pass
+#   Partition disk
+    statusmsg="Partitioning %s"  %( hostoptions["rootdisk"])
+    update_status(statusmsg)
+    progress(1)
+    if data_config.NOOPDEBUG=="FALSE":
+         partition_disk()
+    else:
+        logging.debug("     Debug mode, skipping partitioning step")
+
+#   Format disk
+    statusmsg="Preparing  %s"  %( hostoptions["rootdisk"])
+    update_status(statusmsg)
+    progress(2)
+    format_disk()
+
+
+#   Mount partitions
+    statusmsg="Mounting  %s"  %( hostoptions["rootdisk"])
+    update_status(statusmsg)
+    progress(3)
+    mount_it()
+
+#   Find number of bytes written to disk before starting copy.  This is used
+#   to have a somewhat decent progress indication.
+    statgrab( hostoptions["rootdisk"])
+    msg="Creating %s" %(systemconfig["hostname"])
+    update_status(msg)
+
+#   Copy system to disk
+    copy_it("install")
+#   Remove old fstab so that a new one is created
+    fstabfile=data_config.MOUNTPOINT+"/etc/fstab"
+    try:
+        os.remove(fstabfile)
+    except OSError:
+        logging.debug("     ERROR: deleting %s",fstabfile)
+    fstab_it("full_install")
+#   Configure system
+    msg="Configuring system"
+    update_status(msg)
+    progress(98)
+    grub_it()
+#   Configuring the system
+    logging.info("______Configuring system________")
+    cp_and_log("/etc/systemconfig",data_config.MOUNTPOINT+"/etc/systemconfig")
+    cp_and_log("/root/xorg.conf.install",data_config.MOUNTPOINT+"/etc/X11/xorg.conf.install")
+    restore_default_settings()
+    #try:
+        #MVROOT=os.environ["MV_ROOT"]
+    #except:
+        #logging.debug("     MVROOT was not defined, using the default value")
+        #MVROOT="/usr/MythVantage"
+    #logging.info("Saving syssettings")
+    #cmd="%s/bin/restore_default_settings.sh -c save -t syssettings -h %s -d localhost" %(MVROOT,data_config.MVHOSTNAME)
+    #runcmd(cmd)
+    #SE=os.environ["TEMPLATES"]+"/settings/syssettings"
+    #cp_and_log(SE,data_config.MOUNTPOINT+SE)
+    #cp_and_log("/etc/mtab",data_config.MOUNTPOINT+"/etc/mtab")
+    #cp_and_log2(MVROOT+"/bin/",data_config.MOUNTPOINT+MVROOT+"/bin/","*.sh")
+    #cp_and_log2(MVROOT+"/bin/",data_config.MOUNTPOINT+MVROOT+"/bin/","*.py")
+    #fix_permissions()
+    apply_new_auth()
+    if ( systemconfig["SystemType"] == "Master_backend" or  systemconfig["SystemType"] == "Standalone" ):
+#       This install will need a DB, so install it
+        logging.info("______Installing Database in CHROOT________")
+        mysqldb("stop",'')
+        mount_bind_chroot()
+        cmd="  chroot %s %s/bin/install_db_chroot.sh |tee /tmp/chrootdb.out" %(data_config.MOUNTPOINT,MVROOT)
+        runcmd(cmd)
+        logging.info("Running systemconfig in chroot")
+        cmd="  chroot %s %s/bin/systemconfig.sh misc,hostype,network,advanced,user,this_is_install" %(data_config.MOUNTPOINT,MVROOT)
+        runcmd(cmd)
+        mysqldb("stop","chroot")
+        kill_dhcp_chroot()
+        logging.info("____End Database in CHROOT____")
+        mysqldb("start",'')
+        umount_bind_chroot()
+    else:
+        logging.info("______No database required, continuing configuration________")
+        mount_bind_chroot()
+        cmd="  chroot %s DISPLAY=127.0.0.1:0 %s/bin/MythVantage -t restore,default 1" %(data_config.MOUNTPOINT,MVROOT)
+        runcmd(cmd)
+#       Need to check for to touch  /tmp/.dbsysfailed
+        cmd="  chroot %s %s/bin/restore_default_settings.sh -c restore  -t syssettings " %(data_config.MOUNTPOINT,MVROOT)
+        runcmd(cmd)
+        if ( 'x' == '1' ):
+            logging.debug("touching /tmp/.dbsysfailed")
+        else:
+            cmd="  chroot %s %s/bin/systemconfig.sh misc,hostype,network,advanced,user,this_is_install" %(data_config.MOUNTPOINT,MVROOT)
+            runcmd(cmd)
+            cmd="  chroot %s %s/bin/restore_default_settings.sh -c ACCESSCONTROL " %(data_config.MOUNTPOINT,MVROOT)
+            runcmd(cmd)
+        umount_bind_chroot()
+    cmd="  chroot %s %s/bin/systemconfig.sh advanced,user" %(data_config.MOUNTPOINT,MVROOT)
+    runcmd(cmd)
+    cmd="  touch %s%s/.configure" %(data_config.MOUNTPOINT,data_config.MYTHHOME)
+    runcmd(cmd)
+    cmd="  chmod 777 %s%s/.configure" %(data_config.MOUNTPOINT,data_config.MYTHHOME)
+    runcmd(cmd)
+    msg="Done"
+    update_status(msg)
+    cp_and_log("/tmp/mythvantage_install.log",data_config.MOUNTPOINT+"/var/log/mythvantage_install.log")
+    cp_and_log("/tmp/mv_debug.log",data_config.MOUNTPOINT+"/var/log/mv_debug.log")
+    unmount_it()
+    logging.debug("_____End of full install_____")
+
+def find_upgrade():
+    logging.info("_____Start of find_upgrade_____")
+    global hostoptions
+    #try to mount first partition of disk
+    #copy old /etc/systemconfig to live, import settings into db
+    #umount drive.
+    #check for clean upgrade
+    if ( clean_upgrade() ):
+        logging.info("Clean upgrade requested, not using old data")
+        return
+    mount_it()
+    oldbackupfile=data_config.MOUNTPOINT+"/root/backup/"+data_config.BACKUPFILE
+    newbackupfile="/tmp/"+data_config.BACKUPFILE
+    if os.path.exists(oldbackupfile):
+        logging.debug("Setting backup file to %s",newbackupfile)
+        hostoptions["backupfile"]=newbackupfile
+        cp_and_log(oldbackupfile,newbackupfile)
+
+    srcfile=data_config.MOUNTPOINT+"/etc/systemconfig"
+    logging.info("Searching for systemconfig file %s",srcfile)
+    if os.path.exists(srcfile):
+        logging.info("Found systemconfig file %s",srcfile)
+        TEMPLATES=os.environ["TEMPLATES"]+"/settings/syssettings"
+        cp_and_log2(data_config.MOUNTPOINT+TEMPLATES,data_config.TEMP_TEMPLATES,'')
+        sane_settings("/tmp/templates/settings/syssettings/settings.txt")
+        cp_and_log2(data_config.TEMP_TEMPLATES,TEMPLATES,'')
+        cp_and_log(srcfile,"/etc/systemconfig")
+        cp_and_log(data_config.MOUNTPOINT+"/etc/","/tmp/etc/")
+        cp_and_log(data_config.MOUNTPOINT+"/var/lib/oss/","/tmp/oss")
+        cp_and_log("/tmp/etc/mdadm.conf","/etc/mdadm.conf")
+    else:
+         logging.info("Could not find systemconfig file %s",srcfile)
+         cp_and_log(data_config.MOUNTPOINT+"/etc/","/tmp/etc/")
+         cp_and_log("/tmp/etc/mdadm.conf","/etc")
+         timezone_to_db("/tmp/etc/timezone")
+    unmount_it()
+    logging.debug("End of find_upgrade")
+
+def upgrade_mount_search():
+    #Search for data/myth partition based on contents of fstab
+    logging.debug("______Start of upgrade_mount_search_____")
+    cmd="umount %s%s"  %(data_config.MOUNTPOINT,data_config.DATAMOUNT)
+    runcmd(cmd)
+    fstab_list=[]
+    fstab_data_mount=''
+    try:
+        f = open("/tmp/etc/fstab", 'r')
+        oldfscontents=f.readlines()
+        f.close()
+        ##    ['UUID=', '/myth', 'auto', 'defaults,noatime', '0', '1']
+        #for line in oldfscontents:
+            #mountdir=line.split()
+            #if mountdir[1]==(data_config.DATAMOUNT):
+                #fstablist.append(mountdir)
+    except:
+        logging.debug("    Couldn't open /tmp/etc/fstab")
+    for line in oldfscontents:
+        if line.startswith("#"):
+            continue
+        mountdir=line.split()
+        try:
+            if mountdir[1]==(data_config.DATAMOUNT):
+                fstablist.append(mountdir)
+        except:
+            continue
+    #search fstab for data/myth mountpoint
+    for i in fstab_list:
+        if i[1]==data_config.DATAMOUNT:
+            fstab_data_mount=i[0]
+            break
+
+    #start software raid support if needed
+    for i in fstab_list:
+        if i[0].startswith("/dev/md"):
+            logging.debug("    starting software raid support")
+            mdadm_assemble_all
+
+
+    if re.search("UUID",fstab_data_mount):
+        fstab_data_uuid=fstab_data_mount.split("=")[1]
+        cmd="blkid -t UUID=%s" %fstab_data_uuid
+        retcode = call(cmd, shell=True)
+        if retcode != 0:
+            logging.debug("    Couldn't find uuid %s , starting md support",fstab_data_uuid)
+            mdadm_assemble_all
+        #hoping everything is up and running and data/myth will be available for mount
+        cmd="mount -U %s %s" %(fstab_data_uuid,data_config.MOUNTPOINT)
+        runcmd(cmd)
+        cmd="blkid -t UUID=%s|cut -d: -f1" %fstab_data_uuid
+        logging.debug(cmd)
+        datadisk=commands.getoutput(cmd)
+        cmd="basename %s" %datadisk
+        datadisk=commands.getoutput(cmd)
+    else:
+        cmd="mount  %s %s" %(fstab_data_mount,data_config.MOUNTPOINT)
+        runcmd(cmd)
+        cmd="basename %s" %fstab_data_mount
+        datadisk=commands.getoutput(cmd)
+    time.sleep(3)
+#    hostoptions["backupfile"]=data_config.BACKUPPATH+data_config.BACKUPFILE
+    if not backup_sql_check():
+        newbackupfile="/tmp/"+data_config.BACKUPFILE
+        if os.path.exists(newbackupfile):
+            logging.debug("Setting backup file to %s",newbackupfile)
+            hostoptions["backupfile"]=newbackupfile
+        else:
+            logging.info("Couldn't find any database to restore, upgrade will continue with a new database")
+
+
+
+def upgrade(hostoptions):
+#    unmount_it()
+#    find_upgrade()
+    try:
+        MVROOT=os.environ["MV_ROOT"]
+    except:
+        logging.debug("MVROOT was not defined, using the default value")
+        MVROOT="/usr/MythVantage"
+    logging.info("______Start of upgrade______")
+    cmd="touch /tmp/.this_is_upgrade"
+    runcmd(cmd)
+    if hostoptions["rootfs"] == "Do_not_format":
+        logging.info("Will not format root filesystem")
+    else:
+        statusmsg="Preparing  %s"  %( hostoptions["rootdisk"])
+        update_status(statusmsg)
+        progress(2)
+        format_disk("upgrade")
+    #sys.exit(2)
+    statusmsg="Mounting  %s"  %( hostoptions["rootdisk"])
+    update_status(statusmsg)
+    progress(3)
+    mount_it()
+    hostoptions["backupfile"]=data_config.MOUNTPOINT+data_config.BACKUPPATH+data_config.BACKUPFILE
+    statgrab( hostoptions["rootdisk"])
+    msg="Upgrading %s" %(systemconfig["hostname"])
+    update_status(msg)
+    time.sleep(3)
+    copy_it("upgrade")
+
+    cp_and_log("/tmp/etc/",data_config.MOUNTPOINT+"/etc.old/")
+    cp_and_log("/tmp/oss",data_config.MOUNTPOINT+"/var/lib/oss.old")
+    srcfile="%s/etc.old/ssh/" %(data_config.MOUNTPOINT)
+    destfile="%s/etc/ssh/" %(data_config.MOUNTPOINT)
+    cp_and_log2(srcfile,destfile,'*.pub')
+    cp_and_log2(srcfile,destfile,'*.key')
+    cp_and_log2(srcfile,destfile,'*key')
+    mdfile=mdadm_find("/tmp")
+    cp_and_log("/tmp"+mdfile,data_config.MOUNTPOINT+"/etc")
+    srcfile="%s/etc.old/asound.state" %(data_config.MOUNTPOINT)
+    destfile="%s/etc/asound.state" %(data_config.MOUNTPOINT)
+    cp_and_log(srcfile,destfile)
+    if not os.path.exists("tmp/etc/KnoppMyth-version"):
+        logging.debug("    standard upgrade, restoring auth files")
+        cp_and_log(data_config.MOUNTPOINT+"/etc.old/passwd",data_config.MOUNTPOINT+"/etc/passwd")
+        cp_and_log(data_config.MOUNTPOINT+"/etc.old/shadow",data_config.MOUNTPOINT+"/etc/shadow")
+        cp_and_log(data_config.MOUNTPOINT+"/etc.old/group",data_config.MOUNTPOINT+"/etc/group")
+    msg="Configuring system"
+
+    update_status(msg)
+    progress(98)
+    logging.info("______Configuring system________")
+    cp_and_log("/etc/systemconfig",data_config.MOUNTPOINT+"/etc/systemconfig")
+    if not backup_sql_check():
+        upgrade_mount_search()
+    fstab_it("upgrade")
+    time.sleep(1)
+    grub_it()
+    time.sleep(1)
+    #needed to get around a bug with pacman
+    cp_and_log("/root/xorg.conf.install",data_config.MOUNTPOINT+"/etc/X11/xorg.conf.install")
+    cp_and_log("/etc/mtab",data_config.MOUNTPOINT+"/etc/mtab")
+    if clean_upgrade() or os.path.exists("/tmp/etc/KnoppMyth-version"):
+        logging.debug("clean upgrade or knoppmyth upgrade detected, running restore settings")
+        restore_default_settings()
+        if clean_upgrade():
+            file="%s/%s/.kmupgrade" %(data_config.MOUNTPOINT,data_config.MYTHHOME)
+            cmd="touch %s && chmod 777 %s" %(file,file)
+            runcmd(cmd)
+    copy_updates()
+    fix_permissions()
+    mount_bind_chroot()
+    logging.info("Running systemconfig in chroot")
+    cmd="  chroot %s %s/bin/systemconfig.sh misc,hostype,network,advanced,user,this_is_install" %(data_config.MOUNTPOINT,MVROOT)
+    runcmd(cmd)
+    mysqldb("stop","")
+    if ( systemconfig["SystemType"] == "Master_backend" or  systemconfig["SystemType"] == "Standalone" ):
+        if clean_upgrade() or not backup_sql_check():
+            logging.info("Installing new database")
+            cmd="  chroot %s %s/bin/install_db_chroot.sh |tee /tmp/chrootdb.out" %(data_config.MOUNTPOINT,MVROOT)
+            runcmd(cmd)
+        else:
+            logging.info("Restoring database")
+            cmd="  chroot %s %s/bin/restore_km_db_chroot.sh %s|tee /tmp/chrootdb.out" %(data_config.MOUNTPOINT,MVROOT,hostoptions["backupfile"])
+            runcmd(cmd)
+
+    if os.path.exists("/tmp/etc/KnoppMyth-version"):
+        cmd="  chroot %s %s/bin/restore_default_settings.sh -c restore  -t hostsettings " %(data_config.MOUNTPOINT,MVROOT)
+        runcmd(cmd)
+        logging.debug("Correcting permissions because of km->linhes upgrade")
+        cmd="  chown -R mythtv:mythtv  %s" %(data_config.MOUNTPOINT+data_config.DATAMOUNT)
+        runcmd(cmd)
+        cmd="  chown -R root:root  %s" %(data_config.MOUNTPOINT+data_config.DATAMOUNT+"/backup")
+        runcmd(cmd)
+    else:
+        cmd="  chroot %s %s/bin/restore_default_settings.sh -c restore  -t syssettings " %(data_config.MOUNTPOINT,MVROOT)
+        runcmd(cmd)
+
+    logging.info("Running systemconfig in chroot 2nd time")
+    cmd="  chroot %s %s/bin/systemconfig.sh misc,hostype,network,advanced,user,this_is_install" %(data_config.MOUNTPOINT,MVROOT)
+    runcmd(cmd)
+    logging.info("Running systemconfig in chroot")
+    cmd="  chroot %s %s/bin/systemconfig.sh advanced" %(data_config.MOUNTPOINT,MVROOT)
+    runcmd(cmd)
+    mysqldb("stop",'chroot')
+    apply_new_auth()
+    kill_dhcp_chroot()
+    umount_bind_chroot()
+    cp_and_log("/tmp/mythvantage_install.log",data_config.MOUNTPOINT+"/var/log/mythvantage_install.log")
+    cp_and_log("/tmp/mv_debug.log",data_config.MOUNTPOINT+"/var/log/mv_debug.log")
+    unmount_it()
+    msg="Done"
+    update_status(msg)
+    mysqldb("start",'')
+
+
+
+
+def main(argv):
+    global hostoptions
+    try:
+        opts, args = getopt.getopt(argv, 'c:h' , ["help", "rootdisk=", "rootfs=" , "rootsize=" , "datafs=" , "datasize=", "datadisk=" , "swapsize=" , "datapartition=" ] )
+    except getopt.GetoptError,why:
+        print why
+        usage()
+        sys.exit(2)
+    hostoptions = {"op": 'null'}
+    for opt, arg in opts:
+        if opt in ("-h", "--help"):
+            usage()
+            sys.exit(0)
+        elif opt in ( "--rootdisk"):
+            hostoptions["rootdisk"] = arg
+            hostoptions["rootpartition"]=arg+str(1)
+        elif opt in ("--rootfs"):
+            hostoptions["rootfs"] = arg
+        elif opt in ("--rootsize"):
+            hostoptions["rootsize"] = arg
+        elif opt in ("--datafs"):
+            hostoptions["datafs"] = arg
+        elif opt in ("--datasize"):
+            hostoptions["datasize"] = arg
+        elif opt in ("--datadisk"):
+            hostoptions["datadisk"] = arg
+        elif opt in ("--datapartition"):
+            hostoptions["datapartition"] = arg
+        elif opt in ("--swapsize"):
+            hostoptions["swapsize"]  = arg
+
+        elif opt in ("-c"):
+            validop=["full_install","upgrade","netboot","find_upgrade"]
+            if arg not in validop:
+                logging.critical("-c %s is not a valid option",arg)
+                sys.exit(2)
+            else:
+                hostoptions["op"]  = arg
+    try:
+        hostoptions["datadisk"]
+    except:
+        hostoptions["datadisk"]=hostoptions["rootdisk"]
+        hostoptions["datapartition"]=hostoptions["datadisk"]+str(3)
+    try:
+        hostoptions["datapartition"]
+    except:
+        hostoptions["datapartition"]=hostoptions["datadisk"]+str(3)
+    hostoptions["swappartition"] = hostoptions["rootdisk"] + str(2)
+
+
+    if ( hostoptions["op"]  == "full_install" ) :
+        full_install(hostoptions)
+    elif (hostoptions["op"]  == "upgrade" ) :
+        hostoptions["datafs"]="no_format"
+        find_upgrade()
+        upgrade(hostoptions)
+    elif (hostoptions["op"]  == "find_upgrade" ) :
+        find_upgrade()
+    return hostoptions
+
+
+#____________________________________________setup the logging______________________________________________________
+LOG_FILENAME = '/tmp/mv_status.log'
+DEBUGLOG='/tmp/mv_debug.log'
+logging.basicConfig(level=logging.DEBUG,
+                    format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
+                    datefmt='%m-%d %H:%M',
+                    filename=DEBUGLOG,
+                    filemode='w')
+# define a Handler which writes INFO messages or higher to the sys.stderr
+console = logging.StreamHandler()
+console.setLevel(logging.INFO)
+# set a format which is simpler for console use
+#formatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s')
+formatter = logging.Formatter("%(message)s")
+# tell the handler to use this format
+console.setFormatter(formatter)
+# add the handler to the root logger
+logging.getLogger('').addHandler(console)
+
+#infoformatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
+infoformatter = logging.Formatter("%(message)s")
+infofile = logging.FileHandler(LOG_FILENAME,'w')
+infofile.setFormatter(infoformatter)
+infofile.setLevel(logging.INFO)
+logging.getLogger('').addHandler(infofile)
+
+#Read in systemconfig
+global systemconfig
+systemconfig = {}
+file_name = "/etc/systemconfig"
+config_file= open(file_name)
+
+for line in config_file:
+    line = line.strip()
+    if line and line[0] is not "#" and line[-1] is not "=":
+        var,val = line.rsplit("=",1)
+        val=val.strip('"')
+        systemconfig[var.strip()] = val.strip()
+
+
+if __name__ == "__main__":
+    config_file="mv_config"
+    data_config = __import__(config_file, globals(), locals(), [])
+
+    cmdoptions = main(sys.argv[1:])
+    logging.debug("______cmd line options______")
+    for i in cmdoptions.items():
+        logging.debug (i)
+    logging.debug("______systemconfig______")
+    for i in systemconfig.items():
+        logging.debug(i)
+    logging.debug("______hostoptions______")
+    for i in hostoptions.items():
+        logging.debug(i)
+    pass
+
-- 
cgit v0.12


From 8a534e20213dc2030ceb4aaf4979e6d4833e5f42 Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Wed, 6 May 2009 18:26:36 -0500
Subject: LinHES-config: cleanup and formatting of the PKGBUILD

---
 abs/core-testing/LinHES-config/PKGBUILD | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/abs/core-testing/LinHES-config/PKGBUILD b/abs/core-testing/LinHES-config/PKGBUILD
index b6c2628..1e091e3 100755
--- a/abs/core-testing/LinHES-config/PKGBUILD
+++ b/abs/core-testing/LinHES-config/PKGBUILD
@@ -17,18 +17,15 @@ build() {
     mkdir  $startdir/pkg/etc/profile.d
     install -m 0755 MythVantage.sh  $startdir/pkg/etc/profile.d/MythVantage.sh
     mkdir -p $MVDIR/bin
- #   mkdir -p $MVDIR/templates
     mkdir -p $MVDIR/etc
 
-#copy in all the installer specific stuff
-#    rsync -r --exclude=.svn ../templates $MVDIR/
+    #copy in all the installer specific stuff
     install -m0700 myth_user_call  $MVDIR/bin/myth_user_call
     install -m 0755 install_proxy.sh  $MVDIR/bin/install_proxy.sh
     install -m 0755 install_functions.sh  $MVDIR/bin/install_functions.sh
     install -m 0755 systemconfig.sh  $MVDIR/bin/systemconfig.sh
     install -m 0755 xconfig.sh  $MVDIR/bin/xconfig.sh
     install -m 0755 ir_config.sh  $MVDIR/bin/ir_config.sh
-#    install -m 0755 live-install.sh $MVDIR/bin/live-install.sh
     install -m 0755 install_db_chroot.sh $MVDIR/bin/install_db_chroot.sh
     install -m 0755 restore_km_db_chroot.sh $MVDIR/bin/restore_km_db_chroot.sh
     install -m 0755 restore_default_settings.sh $MVDIR/bin/restore_default_settings.sh
@@ -42,28 +39,24 @@ build() {
     install -m 0755 mv_config.py $MVDIR/bin/mv_config.py
     install -m 0755 mv_install.py $MVDIR/bin/mv_install.py
 
-
+    #README file displayed on install
     install -m 0755 README $MVDIR/README
 
     mkdir -p $startdir/pkg/usr/bin
     install -m 0755 file_time_offset.py $startdir/pkg/usr/bin/file_time_offset.py
-    #copy in the branding stuff
+
+    #Copy in the branding stuff
     install -m 0755 LinHES-release $startdir/pkg/etc/LinHES-release
     install -m 0755 issue $startdir/pkg/etc/issue
 
-# copy over the ui files
+    # copy over the ui files
     install -m 0755 install-ui.xml $startdir/pkg/usr/share/mythtv/themes/default/
 
-#copy in the binaries
-    #install -g mythtv -m 4750 mythinstall.bin $MVDIR/bin/MythVantage
+    #copy in the binaries
     install  -m 4755 mythinstall.bin $MVDIR/bin/MythVantage
     cd $MVDIR/bin
     ln -s MythVantage mythvantage
     ln -s MythVantage mythinstall
     cd -
-#    install -g mythtv -m 4750 mythbeselect.bin $MVDIR/bin/mythbeselect
-
-#    install -m 0755 startx $startdir/pkg/root/startx
-#    install -m 0755 live-install.sh $startdir/pkg/root/live-install.sh
 }
 
-- 
cgit v0.12


From 90526da2ccdf869b149317b4990b6a7fe9ced932 Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Wed, 6 May 2009 19:44:33 -0500
Subject: LinHES-config: list python-parted in the depends line

---
 abs/core-testing/LinHES-config/PKGBUILD | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/abs/core-testing/LinHES-config/PKGBUILD b/abs/core-testing/LinHES-config/PKGBUILD
index 1e091e3..64929f0 100755
--- a/abs/core-testing/LinHES-config/PKGBUILD
+++ b/abs/core-testing/LinHES-config/PKGBUILD
@@ -1,9 +1,9 @@
 pkgname=LinHES-config
 pkgver=1.0
-pkgrel=403
+pkgrel=405
 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 rsync )
+depends=(bc libstatgrab  mysql-python expect curl dnsutils parted sg3_utils nmbscan system-templates rsync python-parted )
 arch=('i686')
 
 source=(mv_install.py mv_config.py mythinstall.bin myth_user_call file_time_offset.py install-ui.xml install_proxy.sh install_functions.sh systemconfig.sh install_db_chroot.sh restore_default_settings.sh xconfig.sh timezip.py soundconfig.sh LinHES-release issue MythVantage.sh create_master.sh build_diskless.sh networkconfig.sh timezone.bin autocard.py restore_km_db_chroot.sh README ir_config.sh)
-- 
cgit v0.12


From a068650007ddd8a5fe3d868d92d237116c5f691c Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Wed, 6 May 2009 20:11:22 -0500
Subject: mv_config: remove debugging ops

---
 abs/core-testing/LinHES-config/mv_config.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/abs/core-testing/LinHES-config/mv_config.py b/abs/core-testing/LinHES-config/mv_config.py
index 02cf1d9..969e12d 100755
--- a/abs/core-testing/LinHES-config/mv_config.py
+++ b/abs/core-testing/LinHES-config/mv_config.py
@@ -6,7 +6,7 @@ DATAMOUNT="/myth"
 MYTHHOME="/home/mythtv"
 SQUASHFILE="/tmp/.squashlist"
 SQUASHLIST=("bin","boot","etc","home","lib","opt","root","sbin","usr","var","data")
-NOOPDEBUG="TRUE"
+NOOPDEBUG="FALSE"
 BACKUPFILE="mythconverg.sql.gz"
 BACKUPPATH="/myth/backup/"
 TEMP_TEMPLATES="/tmp/templates"
-- 
cgit v0.12


From 246c0471433375b63988e3fb2ca69c1670bed340 Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Wed, 6 May 2009 20:29:05 -0500
Subject: mv_install: add install type for format_disk. Add try:except for
 MVROOT on full_install

---
 abs/core-testing/LinHES-config/PKGBUILD      | 2 +-
 abs/core-testing/LinHES-config/mv_install.py | 7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/abs/core-testing/LinHES-config/PKGBUILD b/abs/core-testing/LinHES-config/PKGBUILD
index 64929f0..44fe66f 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=405
+pkgrel=407
 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 rsync python-parted )
diff --git a/abs/core-testing/LinHES-config/mv_install.py b/abs/core-testing/LinHES-config/mv_install.py
index f9359e4..33a74a4 100755
--- a/abs/core-testing/LinHES-config/mv_install.py
+++ b/abs/core-testing/LinHES-config/mv_install.py
@@ -787,6 +787,11 @@ def restore_default_settings():
 
 def full_install(hostoptions):
     logging.info("______Start of full install______")
+    try:
+        MVROOT=os.environ["MV_ROOT"]
+    except:
+        logging.debug("     MVROOT was not defined, using the default value")
+        MVROOT="/usr/MythVantage"
 
     try:
         os.remove("/tmp/.this_is_upgrade")
@@ -806,7 +811,7 @@ def full_install(hostoptions):
     statusmsg="Preparing  %s"  %( hostoptions["rootdisk"])
     update_status(statusmsg)
     progress(2)
-    format_disk()
+    format_disk("install")
 
 
 #   Mount partitions
-- 
cgit v0.12


From 8ae2b89f966938986b7389721363f1ddffc9ae40 Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Thu, 7 May 2009 09:20:33 -0500
Subject: mv_install: Add space to either side of =,  remove etc.old before
 recreating it.

---
 abs/core-testing/LinHES-config/PKGBUILD      |   2 +-
 abs/core-testing/LinHES-config/mv_install.py | 487 ++++++++++++++-------------
 2 files changed, 247 insertions(+), 242 deletions(-)

diff --git a/abs/core-testing/LinHES-config/PKGBUILD b/abs/core-testing/LinHES-config/PKGBUILD
index 44fe66f..b20af81 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=407
+pkgrel=410
 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 rsync python-parted )
diff --git a/abs/core-testing/LinHES-config/mv_install.py b/abs/core-testing/LinHES-config/mv_install.py
index 33a74a4..a945e34 100755
--- a/abs/core-testing/LinHES-config/mv_install.py
+++ b/abs/core-testing/LinHES-config/mv_install.py
@@ -1,7 +1,7 @@
 #!/usr/bin/python
 # -*- coding: utf-8 -*-
-import sys , os, commands , shutil,glob,time
-import getopt,re
+import sys , os, commands , glob, time
+import getopt, re, MySQLdb
 import logging
 try:
     import parted
@@ -16,7 +16,7 @@ def clean_upgrade():
     return False
 
 def progress(pgnum):
-    progressline=str(pgnum)+ " complete"
+    progressline = str(pgnum) + " complete"
     logging.debug("Progress: %s" , pgnum)
     f = open('/tmp/.install_percent', 'w')
     f.write(progressline)
@@ -30,15 +30,15 @@ def update_status(status):
 
 def kill_dhcp_chroot():
     logging.debug("Killing off chroot dhcpcd")
-    stddir=os.getcwd()
-    piddir=("%s/var/run/") %data_config.MOUNTPOINT
+    stddir = os.getcwd()
+    piddir = ("%s/var/run/") %data_config.MOUNTPOINT
     try:
         os.chdir(piddir)
         for FILE in glob.glob("dhcpcd-*.pid"):
-            f=open(FILE,'r')
-            pid=f.readline()
+            f = open(FILE,'r')
+            pid = f.readline()
             f.close
-            cmd="kill -9 %s" %pid
+            cmd = "kill -9 %s" %pid
             runcmd(cmd)
             os.remove(FILE)
         os.chdir(stddir)
@@ -46,13 +46,13 @@ def kill_dhcp_chroot():
         pass
 
 def statgrab(disk):
-    cmd="statgrab -M disk. |grep %s.write_bytes" % hostoptions["rootdisk"]
-    out=commands.getoutput(cmd)
+    cmd = "statgrab -M disk. |grep %s.write_bytes" % hostoptions["rootdisk"]
+    out = commands.getoutput(cmd)
     try:
-        prewritebytes=out.split("=")[1].strip()
+        prewritebytes = out.split("=")[1].strip()
     except:
-        prewritebytes="1024"
-    outline="STARTSIZE=%s" %prewritebytes
+        prewritebytes = "1024"
+    outline = "STARTSIZE=%s" %prewritebytes
     f = open('/tmp/.startsize.io', 'w')
     f.write(str(outline))
     f.close()
@@ -74,9 +74,9 @@ def backup_sql_check():
 def mdadm_find(PREFIX):
     logging.debug("Searching for mdadm.conf")
     if os.path.exists(PREFIX+"/etc/KnoppMyth-version"):
-        mdadmconf="/etc/mdadm/mdadm.conf"
+        mdadmconf = "/etc/mdadm/mdadm.conf"
     else:
-        mdadmconf="/etc/mdadm.conf"
+        mdadmconf = "/etc/mdadm.conf"
     logging.debug("Using %s for mdadm.conf",mdadmconf)
     return mdadmconf
 
@@ -84,33 +84,33 @@ def mdadm_assemble_all():
     # read mdadm.conf and start the arrays
     #ARRAY /dev/md5 uuid=19464854:03f71b1b:e0df2edd:246cc977
     logging.debug("Starting mdadm support")
-    mdadmconf_file=mdadm_find("/tmp")
-    cmd="cdadm --assemble --scan -c /tmp/%s" %mdadmconf_file
+    mdadmconf_file = mdadm_find("/tmp")
+    cmd = "cdadm --assemble --scan -c /tmp/%s" %mdadmconf_file
     runcmd(cmd)
-    mdadm_contents=''
+    mdadm_contents = ''
     try:
-        f=open(mdadmconf_file, 'r')
-        mdadm_contents=f.readlines
+        f = open(mdadmconf_file, 'r')
+        mdadm_contents = f.readlines
         f.close()
     except:
         logging.debug("     Couldn't open mdadmconf file")
     for line in mdadm_contents:
         if line.startswith("ARRAY"):
             logging.debug("     Found MD array: %s",line)
-            array=line.split()[1]
+            array = line.split()[1]
             logging.info("      assembling array: %s",array)
-            cmd="mdadm --assemble -c /tmp%s %s" %(mdadmconf_file,array)
+            cmd = "mdadm --assemble -c /tmp%s %s" %(mdadmconf_file,array)
             runcmd(cmd)
             time.sleep(2)
-            cmd="fsck -p %s" %array
+            cmd = "fsck -p %s" %array
             runcmd
 
 def copy_updates():
     try:
-        MVROOT=os.environ["MV_ROOT"]
+        MVROOT = os.environ["MV_ROOT"]
     except:
         logging.debug("MVROOT was not defined, using the default value")
-        MVROOT="/usr/MythVantage"
+        MVROOT = "/usr/MythVantage"
     cp_and_log2(MVROOT+"/bin/",data_config.MOUNTPOINT+MVROOT+"/bin","*.sh")
     cp_and_log2(MVROOT+"/bin/",data_config.MOUNTPOINT+MVROOT+"/bin","*.py")
 
@@ -123,7 +123,7 @@ def cp_and_log(srcfile,destfile):
     if not os.path.exists(srcfile):
         logging.info("%s is not present, skipping...",srcfile)
     else:
-        cmd=("rsync -arvp %s %s") %(srcfile,destfile)
+        cmd = ("rsync -arvp %s %s") %(srcfile,destfile)
         runcmd(cmd)
         #if os.path.isdir(srcfile):
             #logging.info("Copying directory %s to %s",srcfile,destfile)
@@ -159,11 +159,11 @@ def cp_and_log2(srcfile,destfile,fileglob):
         logging.info("%s is not present, skipping...",srcfile)
     else:
         if fileglob=='':
-            cmd=("rsync -arvp %s %s") %(srcfile,destfile)
+            cmd = ("rsync -arvp %s %s") %(srcfile,destfile)
             runcmd(cmd)
         else:
-            fileglob="*"
-            cmd=("rsync -arvp %s/%s %s") %(srcfile,fileglob,destfile)
+            fileglob = "*"
+            cmd = ("rsync -arvp %s/%s %s") %(srcfile,fileglob,destfile)
             runcmd(cmd)
         #if os.path.isdir(srcfile):
                 #logging.info("Copying directory %s to %s",srcfile,destfile)
@@ -193,45 +193,45 @@ def runcmd(cmd):
     if data_config.NOOPDEBUG=="FALSE":
         pass
     else:
-        cmd="echo "+cmd
+        cmd = "echo "+cmd
     logging.debug("    %s",cmd)
-    cmdout=commands.getoutput(cmd)
+    cmdout = commands.getoutput(cmd)
     logging.debug("    %s",cmdout)
     return cmdout
 
 def mysqldb(cmd,inchroot):
     if cmd=="start":
-        mycmd="  /etc/rc.d/mysqld start"
+        mycmd = "  /etc/rc.d/mysqld start"
     elif cmd=="stop":
-        mycmd="  /etc/rc.d/mysqld stop"
+        mycmd = "  /etc/rc.d/mysqld stop"
     if inchroot=="chroot":
-        mycmd="  chroot %s" %mycmd
+        mycmd = "  chroot %s" %mycmd
     runcmd(mycmd)
 
 
 def mount_bind_chroot():
     logging.debug("Mounting dev/proc/sysfs for chroot")
-    cmd="  mount --bind /dev %s" %data_config.MOUNTPOINT+"/dev"
+    cmd = "  mount --bind /dev %s" %data_config.MOUNTPOINT+"/dev"
     runcmd(cmd)
-    cmd="  mount --bind /proc %s" %data_config.MOUNTPOINT+"/proc"
+    cmd = "  mount --bind /proc %s" %data_config.MOUNTPOINT+"/proc"
     runcmd(cmd)
-    cmd="  mount -t sysfs none  %s" %data_config.MOUNTPOINT+"/sys"
+    cmd = "  mount -t sysfs none  %s" %data_config.MOUNTPOINT+"/sys"
     runcmd(cmd)
 
 def umount_bind_chroot():
     logging.debug("UnMounting dev/proc/sysfs for chroot")
-    cmd="  umount -l %s" %data_config.MOUNTPOINT+"/dev"
+    cmd = "  umount -l %s" %data_config.MOUNTPOINT+"/dev"
     runcmd(cmd)
-    cmd="  umount -l %s" %data_config.MOUNTPOINT+"/proc"
+    cmd = "  umount -l %s" %data_config.MOUNTPOINT+"/proc"
     runcmd(cmd)
-    cmd="  umount -l %s" %data_config.MOUNTPOINT+"/sys"
+    cmd = "  umount -l %s" %data_config.MOUNTPOINT+"/sys"
     runcmd(cmd)
 
 
 def partitions_removeall(diskdevice,label):
     logging.info("Removing all partitions for %s  %s" ,label,diskdevice)
-    device=parted.getDevice(diskdevice)
-    partdisk=parted.Disk(device)
+    device = parted.getDevice(diskdevice)
+    partdisk = parted.Disk(device)
     partdisk.deleteAllPartitions()
     if data_config.NOOPDEBUG=="FALSE":
         partdisk.commit()
@@ -245,10 +245,10 @@ def create_partitions(diskdevice,size,ptype,startsector):
         logging.info("Size is 0, skipping")
         return "NO"
     partlist = []
-    newstart=0
-    totalused=0
-    device=parted.getDevice(diskdevice)
-    partdisk=parted.Disk(device)
+    newstart = 0
+    totalused = 0
+    device = parted.getDevice(diskdevice)
+    partdisk = parted.Disk(device)
     for partition in partdisk.partitions:
             if partition.type != parted.PARTITION_FREESPACE:
                 partlist.append((partition,
@@ -262,10 +262,10 @@ def create_partitions(diskdevice,size,ptype,startsector):
     for slice in partlist:
         (usedpartition, usedpath, usedbootable, usedstart, usedend, usedlength, usedtype, usedfs) = slice
         #Start the new partition one after the end of last
-        newstart=usedend+1
+        newstart = usedend+1
 
     if  startsector==0:
-        newstart=0
+        newstart = 0
     if size=="ALL":
         logging.debug("     Using the rest of the disk  %s",(device.length-newstart) )
         try:
@@ -303,24 +303,24 @@ def partition_disk():
     global hostoptions
     logging.info("Partitioning")
     logging.debug("____start of partition_disk____")
-    rootdisk=hostoptions["rootdisk"]
-    datadisk=hostoptions["datadisk"]
-    label="root"
+    rootdisk = hostoptions["rootdisk"]
+    datadisk = hostoptions["datadisk"]
+    label = "root"
     partitions_removeall("/dev/"+rootdisk,label)
-    label="data"
+    label = "data"
     partitions_removeall("/dev/"+datadisk,label)
-    hostoptions["rootpartition"]=create_partitions("/dev/"+rootdisk,hostoptions["rootsize"],"NORMAL",0)
-    hostoptions["swappartition"]=create_partitions("/dev/"+rootdisk,hostoptions["swapsize"],"SWAP",1)
+    hostoptions["rootpartition"] = create_partitions("/dev/"+rootdisk,hostoptions["rootsize"],"NORMAL",0)
+    hostoptions["swappartition"] = create_partitions("/dev/"+rootdisk,hostoptions["swapsize"],"SWAP",1)
     if datadisk!=rootdisk:
-        hostoptions["datapartition"]=create_partitions("/dev/"+datadisk,hostoptions["datasize"],"NORMAL",0)
+        hostoptions["datapartition"] = create_partitions("/dev/"+datadisk,hostoptions["datasize"],"NORMAL",0)
     else:
-        hostoptions["datapartition"]=create_partitions("/dev/"+datadisk,hostoptions["datasize"],"NORMAL",1)
+        hostoptions["datapartition"] = create_partitions("/dev/"+datadisk,hostoptions["datasize"],"NORMAL",1)
     time.sleep(5)
 
 def fscmd(fstype):
-    fscmds = {"reiserfs":"mkreiserfs -1 -l ROOT" , "xfs": "mkfs -t xfs -f" , "ext3": "mkfs.ext3","jfs":"mkfs.jfs -q","ext4":"mkfs.ext4","Do_not_format":"noformat","no_format":"noformat"}
+    fscmds = {"reiserfs":"mkreiserfs -q -l ROOT" , "xfs": "mkfs -t xfs -f" , "ext3": "mkfs.ext3","jfs":"mkfs.jfs -q","ext4":"mkfs.ext4","Do_not_format":"noformat","no_format":"noformat"}
     try:
-        rc=fscmds[fstype]
+        rc = fscmds[fstype]
     except:
         logging.critical(" %s is not a valid fs type, exiting now",fstype)
         sys.exit(3)
@@ -329,21 +329,21 @@ def fscmd(fstype):
 
 def format_disk(install_type):
     logging.info("______Starting Disk Format______")
-    rootfs=fscmd(hostoptions["rootfs"])
-    datafs=fscmd(hostoptions["datafs"])
+    rootfs = fscmd(hostoptions["rootfs"])
+    datafs = fscmd(hostoptions["datafs"])
 
-    rootdisk=hostoptions["rootdisk"]
-    datadisk=hostoptions["datadisk"]
-    rootpartition=hostoptions["rootpartition"]
-    datapartition=hostoptions["datapartition"]
+    rootdisk = hostoptions["rootdisk"]
+    datadisk = hostoptions["datadisk"]
+    rootpartition = hostoptions["rootpartition"]
+    datapartition = hostoptions["datapartition"]
     if install_type!="upgrade":
-        swapsize=hostoptions["swapsize"]
-        swappartition=hostoptions["swappartition"]
+        swapsize = hostoptions["swapsize"]
+        swappartition = hostoptions["swappartition"]
 
     logging.debug("     Format command for rootfs  %s : %s ", rootfs,rootpartition)
     if ( rootfs != "noformat"):
         logging.info("Starting format of %s",rootpartition)
-        cmd="  %s /dev/%s" %( rootfs , rootpartition)
+        cmd = "  %s /dev/%s" %( rootfs , rootpartition)
         #os.system(cmd)
         runcmd(cmd)
     else:
@@ -352,7 +352,7 @@ def format_disk(install_type):
     logging.debug("     Format command for datafs  %s : %s ", datafs,datapartition)
     if (datafs != "noformat"):
         logging.info("Starting format of %s",datapartition)
-        cmd="  %s /dev/%s" %( datafs , datapartition)
+        cmd = "  %s /dev/%s" %( datafs , datapartition)
         #os.system(cmd)
         runcmd(cmd)
     else:
@@ -361,7 +361,7 @@ def format_disk(install_type):
     if install_type=="install":
         if (hostoptions["swapsize"] != "NO"):
             logging.info("Starting format for swap %s",swappartition)
-            cmd="  mkswap /dev/%s" % swappartition
+            cmd = "  mkswap /dev/%s" % swappartition
             #os.system(cmd)
             runcmd(cmd)
         else:
@@ -374,15 +374,15 @@ def mount_it():
     logging.info("______Mounting disk______")
 #   Create mount points
     try:
-        mountpoint=data_config.MOUNTPOINT
-        mp=mountpoint
+        mountpoint = data_config.MOUNTPOINT
+        mp = mountpoint
         logging.info("Creating mountpoints %s",mp)
         os.makedirs(mp)
     except OSError:
         logging.debug("     Could not create %s",mp)
 
 #   Mount root
-    cmd="mount /dev/%s %s"  %(hostoptions["rootpartition"],mountpoint)
+    cmd = "mount /dev/%s %s"  %(hostoptions["rootpartition"],mountpoint)
     runcmd(cmd)
     #logging.debug(cmd)
     #cmdout=commands.getoutput(cmd)
@@ -390,15 +390,15 @@ def mount_it():
 #   Mount data
 #make mountpoint after mounting /
     try:
-        mountpoint=data_config.MOUNTPOINT
-        datapoint=data_config.DATAMOUNT
-        mp=mountpoint+datapoint
+        mountpoint = data_config.MOUNTPOINT
+        datapoint = data_config.DATAMOUNT
+        mp = mountpoint+datapoint
         logging.info("Creating mountpoints %s",mp)
         os.makedirs(mp)
     except OSError:
         logging.debug("     Could not create %s",mp)
 
-    cmd="mount /dev/%s %s"  %(hostoptions["datapartition"],mp)
+    cmd = "mount /dev/%s %s"  %(hostoptions["datapartition"],mp)
     runcmd(cmd)
     #logging.debug(cmd)
     #cmdout=commands.getoutput(cmd)
@@ -406,25 +406,25 @@ def mount_it():
 
 def unmount_it():
     logging.info("______Unmounting disk______")
-    cmd="umount  %s"  %(data_config.MOUNTPOINT+data_config.DATAMOUNT)
+    cmd = "umount  %s"  %(data_config.MOUNTPOINT+data_config.DATAMOUNT)
     runcmd(cmd)
     time.sleep(2)
 
-    cmd="swapoff /dev/%s" %(hostoptions["swappartition"])
+    cmd = "swapoff /dev/%s" %(hostoptions["swappartition"])
     runcmd(cmd)
 
-    cmd="sync"
+    cmd = "sync"
     runcmd(cmd)
 
-    cmd="umount   %s"  %(data_config.MOUNTPOINT)
+    cmd = "umount   %s"  %(data_config.MOUNTPOINT)
     runcmd(cmd)
-    cmd="sync"
+    cmd = "sync"
     runcmd(cmd)
 
 
 def create_squashlist():
     logging.debug("Creating squashlist")
-    squashfile=data_config.SQUASHFILE
+    squashfile = data_config.SQUASHFILE
     f = open(squashfile, 'w')
     for i in data_config.SQUASHLIST:
         f.write(i)
@@ -438,7 +438,7 @@ def copy_it(install_type):
     logging.debug(  install_type)
     if ( install_type == "install"):
         logging.info("Transferring system")
-        cmd="  unsquashfs -f -d %s /.livesys/medium/system.sqf" %(data_config.MOUNTPOINT)
+        cmd = "  unsquashfs -f -d %s /.livesys/medium/system.sqf" %(data_config.MOUNTPOINT)
         runcmd(cmd)
         #logging.debug(cmd)
         #cmdout=commands.getoutput(cmd)
@@ -446,58 +446,58 @@ def copy_it(install_type):
     if ( install_type == "upgrade"):
         logging.info("Upgrading system")
         create_squashlist()
-        cmd="  unsquashfs -e %s -f -d %s /.livesys/medium/system.sqf" %(data_config.SQUASHFILE , data_config.MOUNTPOINT)
+        cmd = "  unsquashfs -e %s -f -d %s /.livesys/medium/system.sqf" %(data_config.SQUASHFILE , data_config.MOUNTPOINT)
         runcmd(cmd)
         #logging.debug(cmd)
         #cmdout=commands.getoutput(cmd)
 #   Create the missing dir
-    i=("sys","proc","dev","tmp","mnt","media","media/cdrom","media/dvd","var/log/mythtv")
-    mountpoint=data_config.MOUNTPOINT
+    i = ("sys","proc","dev","tmp","mnt","media","media/cdrom","media/dvd","var/log/mythtv")
+    mountpoint = data_config.MOUNTPOINT
     for item in i:
         try:
-            mp=mountpoint+"/"+item
+            mp = mountpoint+"/"+item
             logging.info("Creating mountpoints %s",mp)
             os.makedirs(mp)
         except OSError:
             logging.debug("     __Could not create %s",mp)
 #   General fixup
-    cmd="chmod 777 %s/tmp" %(data_config.MOUNTPOINT)
+    cmd = "chmod 777 %s/tmp" %(data_config.MOUNTPOINT)
     runcmd(cmd)
-    cmd="mknod %s/dev/null c 1 5" %(data_config.MOUNTPOINT)
+    cmd = "mknod %s/dev/null c 1 5" %(data_config.MOUNTPOINT)
     runcmd(cmd)
-    cmd="mknod %s/dev/console c 5 1" %(data_config.MOUNTPOINT)
+    cmd = "mknod %s/dev/console c 5 1" %(data_config.MOUNTPOINT)
     runcmd(cmd)
-    cmd="chmod +s  %s/usr/bin/Xorg" %(data_config.MOUNTPOINT)
+    cmd = "chmod +s  %s/usr/bin/Xorg" %(data_config.MOUNTPOINT)
     runcmd(cmd)
-    cmd="chmod +s  %s/usr/bin/crontab" %(data_config.MOUNTPOINT)
+    cmd = "chmod +s  %s/usr/bin/crontab" %(data_config.MOUNTPOINT)
     runcmd(cmd)
-    cmd="chmod +s  %s/usr/bin/sudo" %(data_config.MOUNTPOINT)
+    cmd = "chmod +s  %s/usr/bin/sudo" %(data_config.MOUNTPOINT)
     runcmd(cmd)
-    cmd="chmod +s  %s/bin/mount" %(data_config.MOUNTPOINT)
+    cmd = "chmod +s  %s/bin/mount" %(data_config.MOUNTPOINT)
     runcmd(cmd)
     logging.debug("__End of copy_it__")
 
 def create_fstab(extralines):
     logging.debug("______Creating new fstab file_______")
     logging.info("Creating new fstab file")
-    fstabfile=data_config.MOUNTPOINT+"/etc/fstab"
-    fstab_list=[]
+    fstabfile = data_config.MOUNTPOINT+"/etc/fstab"
+    fstab_list = []
     f = open(fstabfile, 'w')
-    line="# <file system>        <dir>         <type>    <options>          <dump> <pass> \n"
+    line = "# <file system>        <dir>         <type>    <options>          <dump> <pass> \n"
     fstab_list.append(line)
-    line="none                   /dev/pts      devpts    defaults            0      0 \n"
+    line = "none                   /dev/pts      devpts    defaults            0      0 \n"
     fstab_list.append(line)
-    line="none                   /dev/shm      tmpfs     defaults            0      0\n"
+    line = "none                   /dev/shm      tmpfs     defaults            0      0\n"
     fstab_list.append(line)
-    line="/dev/cdrom /media/cdrom   auto    ro,user,noauto,unhide   0      0\n"
+    line = "/dev/cdrom /media/cdrom   auto    ro,user,noauto,unhide   0      0\n"
     fstab_list.append(line)
-    line="/dev/dvd /media/dvd   auto    ro,user,noauto,unhide   0      0\n"
+    line = "/dev/dvd /media/dvd   auto    ro,user,noauto,unhide   0      0\n"
     fstab_list.append(line)
-    line="UUID=ROOTUID /  auto defaults,noatime 0 1\n"
+    line = "UUID=ROOTUID /  auto defaults,noatime 0 1\n"
     fstab_list.append(line)
-    line="UUID=DATAUID %s  auto defaults,noatime 0 1\n" %(data_config.DATAMOUNT)
+    line = "UUID=DATAUID %s  auto defaults,noatime 0 1\n" %(data_config.DATAMOUNT)
     fstab_list.append(line)
-    line="UUID=SWAPUID swap swap defaults  0 0 \n"
+    line = "UUID=SWAPUID swap swap defaults  0 0 \n"
     fstab_list.append(line)
     for vline in extralines:
         fstab_list.append(vline)
@@ -508,23 +508,23 @@ def create_fstab(extralines):
 
 def find_uuid(partition):
     logging.info("Finding the UUID for %s...",partition)
-    cmd="blkid -s UUID /dev/%s" %partition
-    tmpuuid=runcmd(cmd)
-    splituuid=tmpuuid.partition("=")
-    uuid=splituuid[2].replace('"',"")
+    cmd = "blkid -s UUID /dev/%s" %partition
+    tmpuuid = runcmd(cmd)
+    splituuid = tmpuuid.partition("=")
+    uuid = splituuid[2].replace('"',"")
     logging.info("The uuid is %s",uuid)
     return uuid.strip()
 
 def pick_out_vg():
     logging.info("Searching for Volume Groups in old fstab")
-    vglines=[]
+    vglines = []
     f = open("/tmp/etc/fstab", 'r')
-    oldfscontents=f.readlines()
+    oldfscontents = f.readlines()
     for line in oldfscontents:
         if line.startswith("/dev/vg"):
             vglines.append(line)
-            templine=line.split()
-            mdir=templine[1]
+            templine = line.split()
+            mdir = templine[1]
             if not os.path.exists (mdir):
                 logging.debug("Creating dir %s for VG mount",mdir)
                 os.makedirs (mdir)
@@ -535,13 +535,13 @@ def pick_out_vg():
 
 def fstab_it(install_type):
     logging.info("______Checking fstab______")
-    kmvg=[]
-    fstabfile=data_config.MOUNTPOINT+"/etc/fstab"
+    kmvg = []
+    fstabfile = data_config.MOUNTPOINT+"/etc/fstab"
 #   Check for knoppmyth install, if found create new
     if install_type=="upgrade":
         if os.path.exists("/tmp/etc/KnoppMyth-version"):
             logging.debug("     KnoppMyth-Version found, creating new fstab")
-            kmvg=pick_out_vg()
+            kmvg = pick_out_vg()
             create_fstab(kmvg)
         elif os.path.exists("/tmp/etc/fstab"):
                 logging.debug("     Upgrade and not Knoppmyth, using old fstab")
@@ -553,28 +553,28 @@ def fstab_it(install_type):
        create_fstab(kmvg)
 
     logging.info("____UUID check for %s" , "swap")
-    swapuuid=find_uuid(hostoptions["swappartition"])
+    swapuuid = find_uuid(hostoptions["swappartition"])
 
     logging.info("____UUID check for %s" , "data")
-    datauuid=find_uuid(hostoptions["datapartition"])
+    datauuid = find_uuid(hostoptions["datapartition"])
 
     logging.info("____UUID check for %s" , "root")
-    rootuuid=find_uuid(hostoptions["rootpartition"])
+    rootuuid = find_uuid(hostoptions["rootpartition"])
 
-    fstabfile=data_config.MOUNTPOINT+"/etc/fstab"
+    fstabfile = data_config.MOUNTPOINT+"/etc/fstab"
     logging.info("Correcting UUID's in %s",fstabfile)
     f = open(fstabfile, 'r')
-    oldfscontents=f.readlines()
-    newfstab=[]
+    oldfscontents = f.readlines()
+    newfstab = []
     f.close
     for line in oldfscontents:
         if line.startswith("UUID"):
-            templine=line.split()
+            templine = line.split()
             if ( templine[1] == "/"):
                 logging.debug("     Found Root fstab line:")
                 logging.debug(      templine)
-                templine[0]="UUID=%s" %(rootuuid)
-                newline=''
+                templine[0] = "UUID=%s" %(rootuuid)
+                newline = ''
                 for i in templine:
                     newline+=i
                     newline+="    "
@@ -586,8 +586,8 @@ def fstab_it(install_type):
             if ( templine[1] == data_config.DATAMOUNT):
                 logging.debug("     Found DATA mount")
                 logging.debug(      templine)
-                templine[0]="UUID=%s" %(datauuid)
-                newline=''
+                templine[0] = "UUID=%s" %(datauuid)
+                newline = ''
                 for i in templine:
                     newline+=i
                     newline+="    "
@@ -602,8 +602,8 @@ def fstab_it(install_type):
                 else:
                     logging.debug("     Found swap partition")
                     logging.debug(      templine)
-                    templine[0]="UUID=%s" %(swapuuid)
-                    newline=''
+                    templine[0] = "UUID=%s" %(swapuuid)
+                    newline = ''
                     for i in templine:
                         newline+=i
                         newline+="    "
@@ -626,27 +626,27 @@ def fstab_it(install_type):
 
 def grub_it():
     logging.info("______Start of grub install______")
-    cmd="  grub-install --recheck --no-floppy --root-directory=%s \"(hd0)\" "  % data_config.MOUNTPOINT
+    cmd = "  grub-install --recheck --no-floppy --root-directory=%s \"(hd0)\" "  % data_config.MOUNTPOINT
     logging.info("Running grub-install")
     runcmd(cmd)
-    rootuuid=find_uuid(hostoptions["rootpartition"])
-    cmd="  mkinitcpio -g %s/boot/kernel26.img" % data_config.MOUNTPOINT
+    rootuuid = find_uuid(hostoptions["rootpartition"])
+    cmd = "  mkinitcpio -g %s/boot/kernel26.img" % data_config.MOUNTPOINT
     logging.info("Running mkinitcpio")
     runcmd(cmd)
     logging.info("Adding root uuid to grub menu")
-    grubfile=data_config.MOUNTPOINT+"/boot/grub/menu.lst"
+    grubfile = data_config.MOUNTPOINT+"/boot/grub/menu.lst"
     try:
         f = open(grubfile, 'r')
-        oldgrub=f.readlines()
-        newgrub=[]
+        oldgrub = f.readlines()
+        newgrub = []
         f.close
         for line in oldgrub:
             if line.startswith("kernel"):
-                templine=line.split()
+                templine = line.split()
                 logging.debug("     Found kernel Root grubline:")
                 logging.debug(      templine)
-                templine[2]="root=/dev/disk/by-uuid/%s" %(rootuuid)
-                newline=''
+                templine[2] = "root=/dev/disk/by-uuid/%s" %(rootuuid)
+                newline = ''
                 for i in templine:
                     newline+=i
                     newline+="    "
@@ -670,38 +670,38 @@ def grub_it():
 
 def fix_permissions():
     logging.info("Fixing permissions")
-    SE=os.environ["TEMPLATES"]+"/settings/syssettings"
-    cmd="  chmod -R 755  %s" %(data_config.MOUNTPOINT+SE)
+    SE = os.environ["TEMPLATES"]+"/settings/syssettings"
+    cmd = "  chmod -R 755  %s" %(data_config.MOUNTPOINT+SE)
     runcmd(cmd)
-    cmd="  chmod 755  %s" %(data_config.MOUNTPOINT+"/etc/systemconfig")
+    cmd = "  chmod 755  %s" %(data_config.MOUNTPOINT+"/etc/systemconfig")
     runcmd(cmd)
-    cmd="  chmod 755  %s" %(data_config.MOUNTPOINT+"/root")
+    cmd = "  chmod 755  %s" %(data_config.MOUNTPOINT+"/root")
     runcmd(cmd)
-    cmd="  chown root:mythtv  %s" %(data_config.MOUNTPOINT+"/etc/systemconfig")
+    cmd = "  chown root:mythtv  %s" %(data_config.MOUNTPOINT+"/etc/systemconfig")
     runcmd(cmd)
-    cmd="  chown -R mythtv:mythtv  %s" %(data_config.MOUNTPOINT+SE)
+    cmd = "  chown -R mythtv:mythtv  %s" %(data_config.MOUNTPOINT+SE)
     runcmd(cmd)
-    cmd="  chown -R mythtv:mythtv  %s" %(data_config.MOUNTPOINT+"/var/log/mythtv")
+    cmd = "  chown -R mythtv:mythtv  %s" %(data_config.MOUNTPOINT+"/var/log/mythtv")
     runcmd(cmd)
 
 def apply_new_auth():
     logging.info("_____Applying Password updates_______")
-    passfile="/root/myth_user_call.out"
+    passfile = "/root/myth_user_call.out"
     try:
-        MVROOT=os.environ["MV_ROOT"]
+        MVROOT = os.environ["MV_ROOT"]
     except:
         logging.debug("MVROOT was not defined, using the default value")
-        MVROOT="/usr/MythVantage"
+        MVROOT = "/usr/MythVantage"
     if data_config.NOOPDEBUG=="FALSE":
-        cmdprefix="chroot " + data_config.MOUNTPOINT + " " + MVROOT+"/bin/myth_user_call -i "
+        cmdprefix = "chroot " + data_config.MOUNTPOINT + " " + MVROOT+"/bin/myth_user_call -i "
     else:
-        cmdprefix="echo chroot " + data_config.MOUNTPOINT + " " + MVROOT+"/bin/myth_user_call -i "
+        cmdprefix = "echo chroot " + data_config.MOUNTPOINT + " " + MVROOT+"/bin/myth_user_call -i "
     try:
         f = open(passfile, 'r')
-        passcmds=f.readlines()
+        passcmds = f.readlines()
         f.close
         for cmd in passcmds:
-            execmd=cmdprefix+cmd
+            execmd = cmdprefix+cmd
 #            Using os.system because runcmd fails
             logging.debug(execmd)
             os.system(execmd)
@@ -712,15 +712,15 @@ def apply_new_auth():
 def swapsearch():
 #currently unused!
     partlist = []
-    stddir=os.getcwd()
+    stddir = os.getcwd()
     os.chdir("/sys/block")
-    partitionlist=glob.glob("*")
+    partitionlist = glob.glob("*")
     for item in partitionlist:
             try:
-                newitem=item.strip().rpartition(" ")[2]
+                newitem = item.strip().rpartition(" ")[2]
                 if (not newitem=='') and  (not newitem.startswith("loop")):
-                    path="/dev/"+newitem.strip()
-                    path=path.strip()
+                    path = "/dev/"+newitem.strip()
+                    path = path.strip()
                     device = parted.getDevice(path)
                     (cylinders, heads, sectors) = device.biosGeometry
                     sizeInBytes = device.length * device.sectorSize
@@ -750,11 +750,11 @@ def swapsearch():
 
 def sane_settings(file):
     #Remove some settings from file_name
-    removeline=("HOSTrootfstype", "HOSTrootfstype", "HOSTdatafstype", "HOSTOSsize", "HostUseALLdata", "HOSTDATAsize", "HOSTuprootfstype", "HostUseSWAP", "HOSTSWAPsize")
+    removeline = ("HOSTrootfstype", "HOSTrootfstype", "HOSTdatafstype", "HOSTOSsize", "HostUseALLdata", "HOSTDATAsize", "HOSTuprootfstype", "HostUseSWAP", "HOSTSWAPsize")
     logging.debug("__Running sane settings")
     try:
         f = open(file, 'r')
-        filecontents=f.readlines()
+        filecontents = f.readlines()
         f.close
     except:
         logging.debug("     Couldn't find file %s to sane",file)
@@ -772,14 +772,14 @@ def sane_settings(file):
 
 def restore_default_settings():
     try:
-        MVROOT=os.environ["MV_ROOT"]
+        MVROOT = os.environ["MV_ROOT"]
     except:
         logging.debug("     MVROOT was not defined, using the default value")
-        MVROOT="/usr/MythVantage"
+        MVROOT = "/usr/MythVantage"
     logging.info("Saving syssettings")
-    cmd="%s/bin/restore_default_settings.sh -c save -t syssettings -h %s -d localhost" %(MVROOT,data_config.MVHOSTNAME)
+    cmd = "%s/bin/restore_default_settings.sh -c save -t syssettings -h %s -d localhost" %(MVROOT,data_config.MVHOSTNAME)
     runcmd(cmd)
-    SE=os.environ["TEMPLATES"]+"/settings/syssettings/"
+    SE = os.environ["TEMPLATES"]+"/settings/syssettings/"
     cp_and_log(SE,data_config.MOUNTPOINT+SE)
     cp_and_log("/etc/mtab",data_config.MOUNTPOINT+"/etc/mtab")
     copy_updates()
@@ -788,10 +788,10 @@ def restore_default_settings():
 def full_install(hostoptions):
     logging.info("______Start of full install______")
     try:
-        MVROOT=os.environ["MV_ROOT"]
+        MVROOT = os.environ["MV_ROOT"]
     except:
         logging.debug("     MVROOT was not defined, using the default value")
-        MVROOT="/usr/MythVantage"
+        MVROOT = "/usr/MythVantage"
 
     try:
         os.remove("/tmp/.this_is_upgrade")
@@ -799,7 +799,7 @@ def full_install(hostoptions):
         logging.debug("     File /tmp/.this_is_upgrade not present, couldn't delete it")
         pass
 #   Partition disk
-    statusmsg="Partitioning %s"  %( hostoptions["rootdisk"])
+    statusmsg = "Partitioning %s"  %( hostoptions["rootdisk"])
     update_status(statusmsg)
     progress(1)
     if data_config.NOOPDEBUG=="FALSE":
@@ -808,14 +808,14 @@ def full_install(hostoptions):
         logging.debug("     Debug mode, skipping partitioning step")
 
 #   Format disk
-    statusmsg="Preparing  %s"  %( hostoptions["rootdisk"])
+    statusmsg = "Preparing  %s"  %( hostoptions["rootdisk"])
     update_status(statusmsg)
     progress(2)
     format_disk("install")
 
 
 #   Mount partitions
-    statusmsg="Mounting  %s"  %( hostoptions["rootdisk"])
+    statusmsg = "Mounting  %s"  %( hostoptions["rootdisk"])
     update_status(statusmsg)
     progress(3)
     mount_it()
@@ -823,20 +823,20 @@ def full_install(hostoptions):
 #   Find number of bytes written to disk before starting copy.  This is used
 #   to have a somewhat decent progress indication.
     statgrab( hostoptions["rootdisk"])
-    msg="Creating %s" %(systemconfig["hostname"])
+    msg = "Creating %s" %(systemconfig["hostname"])
     update_status(msg)
 
 #   Copy system to disk
     copy_it("install")
 #   Remove old fstab so that a new one is created
-    fstabfile=data_config.MOUNTPOINT+"/etc/fstab"
+    fstabfile = data_config.MOUNTPOINT+"/etc/fstab"
     try:
         os.remove(fstabfile)
     except OSError:
         logging.debug("     ERROR: deleting %s",fstabfile)
     fstab_it("full_install")
 #   Configure system
-    msg="Configuring system"
+    msg = "Configuring system"
     update_status(msg)
     progress(98)
     grub_it()
@@ -865,10 +865,10 @@ def full_install(hostoptions):
         logging.info("______Installing Database in CHROOT________")
         mysqldb("stop",'')
         mount_bind_chroot()
-        cmd="  chroot %s %s/bin/install_db_chroot.sh |tee /tmp/chrootdb.out" %(data_config.MOUNTPOINT,MVROOT)
+        cmd = "  chroot %s %s/bin/install_db_chroot.sh |tee /tmp/chrootdb.out" %(data_config.MOUNTPOINT,MVROOT)
         runcmd(cmd)
         logging.info("Running systemconfig in chroot")
-        cmd="  chroot %s %s/bin/systemconfig.sh misc,hostype,network,advanced,user,this_is_install" %(data_config.MOUNTPOINT,MVROOT)
+        cmd = "  chroot %s %s/bin/systemconfig.sh misc,hostype,network,advanced,user,this_is_install" %(data_config.MOUNTPOINT,MVROOT)
         runcmd(cmd)
         mysqldb("stop","chroot")
         kill_dhcp_chroot()
@@ -878,26 +878,26 @@ def full_install(hostoptions):
     else:
         logging.info("______No database required, continuing configuration________")
         mount_bind_chroot()
-        cmd="  chroot %s DISPLAY=127.0.0.1:0 %s/bin/MythVantage -t restore,default 1" %(data_config.MOUNTPOINT,MVROOT)
+        cmd = "  chroot %s DISPLAY=127.0.0.1:0 %s/bin/MythVantage -t restore,default 1" %(data_config.MOUNTPOINT,MVROOT)
         runcmd(cmd)
 #       Need to check for to touch  /tmp/.dbsysfailed
-        cmd="  chroot %s %s/bin/restore_default_settings.sh -c restore  -t syssettings " %(data_config.MOUNTPOINT,MVROOT)
+        cmd = "  chroot %s %s/bin/restore_default_settings.sh -c restore  -t syssettings " %(data_config.MOUNTPOINT,MVROOT)
         runcmd(cmd)
         if ( 'x' == '1' ):
             logging.debug("touching /tmp/.dbsysfailed")
         else:
-            cmd="  chroot %s %s/bin/systemconfig.sh misc,hostype,network,advanced,user,this_is_install" %(data_config.MOUNTPOINT,MVROOT)
+            cmd = "  chroot %s %s/bin/systemconfig.sh misc,hostype,network,advanced,user,this_is_install" %(data_config.MOUNTPOINT,MVROOT)
             runcmd(cmd)
-            cmd="  chroot %s %s/bin/restore_default_settings.sh -c ACCESSCONTROL " %(data_config.MOUNTPOINT,MVROOT)
+            cmd = "  chroot %s %s/bin/restore_default_settings.sh -c ACCESSCONTROL " %(data_config.MOUNTPOINT,MVROOT)
             runcmd(cmd)
         umount_bind_chroot()
-    cmd="  chroot %s %s/bin/systemconfig.sh advanced,user" %(data_config.MOUNTPOINT,MVROOT)
+    cmd = "  chroot %s %s/bin/systemconfig.sh advanced,user" %(data_config.MOUNTPOINT,MVROOT)
     runcmd(cmd)
-    cmd="  touch %s%s/.configure" %(data_config.MOUNTPOINT,data_config.MYTHHOME)
+    cmd = "  touch %s%s/.configure" %(data_config.MOUNTPOINT,data_config.MYTHHOME)
     runcmd(cmd)
-    cmd="  chmod 777 %s%s/.configure" %(data_config.MOUNTPOINT,data_config.MYTHHOME)
+    cmd = "  chmod 777 %s%s/.configure" %(data_config.MOUNTPOINT,data_config.MYTHHOME)
     runcmd(cmd)
-    msg="Done"
+    msg = "Done"
     update_status(msg)
     cp_and_log("/tmp/mythvantage_install.log",data_config.MOUNTPOINT+"/var/log/mythvantage_install.log")
     cp_and_log("/tmp/mv_debug.log",data_config.MOUNTPOINT+"/var/log/mv_debug.log")
@@ -915,18 +915,18 @@ def find_upgrade():
         logging.info("Clean upgrade requested, not using old data")
         return
     mount_it()
-    oldbackupfile=data_config.MOUNTPOINT+"/root/backup/"+data_config.BACKUPFILE
-    newbackupfile="/tmp/"+data_config.BACKUPFILE
+    oldbackupfile = data_config.MOUNTPOINT+"/root/backup/"+data_config.BACKUPFILE
+    newbackupfile = "/tmp/"+data_config.BACKUPFILE
     if os.path.exists(oldbackupfile):
         logging.debug("Setting backup file to %s",newbackupfile)
-        hostoptions["backupfile"]=newbackupfile
+        hostoptions["backupfile"] = newbackupfile
         cp_and_log(oldbackupfile,newbackupfile)
 
-    srcfile=data_config.MOUNTPOINT+"/etc/systemconfig"
+    srcfile = data_config.MOUNTPOINT+"/etc/systemconfig"
     logging.info("Searching for systemconfig file %s",srcfile)
     if os.path.exists(srcfile):
-        logging.info("Found systemconfig file %s",srcfile)
-        TEMPLATES=os.environ["TEMPLATES"]+"/settings/syssettings"
+        logging.info("Found systemconfig file %fs",srcfile)
+        TEMPLATES = os.environ["TEMPLATES"]+"/settings/syssettings"
         cp_and_log2(data_config.MOUNTPOINT+TEMPLATES,data_config.TEMP_TEMPLATES,'')
         sane_settings("/tmp/templates/settings/syssettings/settings.txt")
         cp_and_log2(data_config.TEMP_TEMPLATES,TEMPLATES,'')
@@ -945,13 +945,13 @@ def find_upgrade():
 def upgrade_mount_search():
     #Search for data/myth partition based on contents of fstab
     logging.debug("______Start of upgrade_mount_search_____")
-    cmd="umount %s%s"  %(data_config.MOUNTPOINT,data_config.DATAMOUNT)
+    cmd = "umount %s%s"  %(data_config.MOUNTPOINT,data_config.DATAMOUNT)
     runcmd(cmd)
-    fstab_list=[]
-    fstab_data_mount=''
+    fstab_list = []
+    fstab_data_mount = ''
     try:
         f = open("/tmp/etc/fstab", 'r')
-        oldfscontents=f.readlines()
+        oldfscontents = f.readlines()
         f.close()
         ##    ['UUID=', '/myth', 'auto', 'defaults,noatime', '0', '1']
         #for line in oldfscontents:
@@ -972,7 +972,7 @@ def upgrade_mount_search():
     #search fstab for data/myth mountpoint
     for i in fstab_list:
         if i[1]==data_config.DATAMOUNT:
-            fstab_data_mount=i[0]
+            fstab_data_mount = i[0]
             break
 
     #start software raid support if needed
@@ -983,85 +983,86 @@ def upgrade_mount_search():
 
 
     if re.search("UUID",fstab_data_mount):
-        fstab_data_uuid=fstab_data_mount.split("=")[1]
-        cmd="blkid -t UUID=%s" %fstab_data_uuid
+        fstab_data_uuid = fstab_data_mount.split("=")[1]
+        cmd = "blkid -t UUID=%s" %fstab_data_uuid
         retcode = call(cmd, shell=True)
         if retcode != 0:
             logging.debug("    Couldn't find uuid %s , starting md support",fstab_data_uuid)
             mdadm_assemble_all
         #hoping everything is up and running and data/myth will be available for mount
-        cmd="mount -U %s %s" %(fstab_data_uuid,data_config.MOUNTPOINT)
+        cmd = "mount -U %s %s" %(fstab_data_uuid,data_config.MOUNTPOINT)
         runcmd(cmd)
-        cmd="blkid -t UUID=%s|cut -d: -f1" %fstab_data_uuid
+        cmd = "blkid -t UUID=%s|cut -d: -f1" %fstab_data_uuid
         logging.debug(cmd)
-        datadisk=commands.getoutput(cmd)
-        cmd="basename %s" %datadisk
-        datadisk=commands.getoutput(cmd)
+        datadisk = commands.getoutput(cmd)
+        cmd = "basename %s" %datadisk
+        datadisk = commands.getoutput(cmd)
     else:
-        cmd="mount  %s %s" %(fstab_data_mount,data_config.MOUNTPOINT)
+        cmd = "mount  %s %s" %(fstab_data_mount,data_config.MOUNTPOINT)
         runcmd(cmd)
-        cmd="basename %s" %fstab_data_mount
-        datadisk=commands.getoutput(cmd)
+        cmd = "basename %s" %fstab_data_mount
+        datadisk = commands.getoutput(cmd)
     time.sleep(3)
 #    hostoptions["backupfile"]=data_config.BACKUPPATH+data_config.BACKUPFILE
     if not backup_sql_check():
-        newbackupfile="/tmp/"+data_config.BACKUPFILE
+        newbackupfile = "/tmp/"+data_config.BACKUPFILE
         if os.path.exists(newbackupfile):
             logging.debug("Setting backup file to %s",newbackupfile)
-            hostoptions["backupfile"]=newbackupfile
+            hostoptions["backupfile"] = newbackupfile
         else:
             logging.info("Couldn't find any database to restore, upgrade will continue with a new database")
 
 
 
 def upgrade(hostoptions):
-#    unmount_it()
-#    find_upgrade()
+
     try:
-        MVROOT=os.environ["MV_ROOT"]
+        MVROOT = os.environ["MV_ROOT"]
     except:
         logging.debug("MVROOT was not defined, using the default value")
-        MVROOT="/usr/MythVantage"
+        MVROOT = "/usr/MythVantage"
     logging.info("______Start of upgrade______")
-    cmd="touch /tmp/.this_is_upgrade"
+    cmd = "touch /tmp/.this_is_upgrade"
     runcmd(cmd)
     if hostoptions["rootfs"] == "Do_not_format":
         logging.info("Will not format root filesystem")
     else:
-        statusmsg="Preparing  %s"  %( hostoptions["rootdisk"])
+        statusmsg = "Preparing  %s"  %( hostoptions["rootdisk"])
         update_status(statusmsg)
         progress(2)
         format_disk("upgrade")
     #sys.exit(2)
-    statusmsg="Mounting  %s"  %( hostoptions["rootdisk"])
+    statusmsg = "Mounting  %s"  %( hostoptions["rootdisk"])
     update_status(statusmsg)
     progress(3)
     mount_it()
-    hostoptions["backupfile"]=data_config.MOUNTPOINT+data_config.BACKUPPATH+data_config.BACKUPFILE
+    hostoptions["backupfile"] = data_config.MOUNTPOINT+data_config.BACKUPPATH+data_config.BACKUPFILE
     statgrab( hostoptions["rootdisk"])
-    msg="Upgrading %s" %(systemconfig["hostname"])
+    msg = "Upgrading %s" %(systemconfig["hostname"])
     update_status(msg)
     time.sleep(3)
     copy_it("upgrade")
+    cmd = "rm -rf %s/etc.old" %data_config.MOUNTPOINT
+    runcmd(cmd)
 
     cp_and_log("/tmp/etc/",data_config.MOUNTPOINT+"/etc.old/")
     cp_and_log("/tmp/oss",data_config.MOUNTPOINT+"/var/lib/oss.old")
-    srcfile="%s/etc.old/ssh/" %(data_config.MOUNTPOINT)
-    destfile="%s/etc/ssh/" %(data_config.MOUNTPOINT)
+    srcfile = "%s/etc.old/ssh/" %(data_config.MOUNTPOINT)
+    destfile = "%s/etc/ssh/" %(data_config.MOUNTPOINT)
     cp_and_log2(srcfile,destfile,'*.pub')
     cp_and_log2(srcfile,destfile,'*.key')
     cp_and_log2(srcfile,destfile,'*key')
-    mdfile=mdadm_find("/tmp")
+    mdfile = mdadm_find("/tmp")
     cp_and_log("/tmp"+mdfile,data_config.MOUNTPOINT+"/etc")
-    srcfile="%s/etc.old/asound.state" %(data_config.MOUNTPOINT)
-    destfile="%s/etc/asound.state" %(data_config.MOUNTPOINT)
+    srcfile = "%s/etc.old/asound.state" %(data_config.MOUNTPOINT)
+    destfile = "%s/etc/asound.state" %(data_config.MOUNTPOINT)
     cp_and_log(srcfile,destfile)
     if not os.path.exists("tmp/etc/KnoppMyth-version"):
         logging.debug("    standard upgrade, restoring auth files")
         cp_and_log(data_config.MOUNTPOINT+"/etc.old/passwd",data_config.MOUNTPOINT+"/etc/passwd")
         cp_and_log(data_config.MOUNTPOINT+"/etc.old/shadow",data_config.MOUNTPOINT+"/etc/shadow")
         cp_and_log(data_config.MOUNTPOINT+"/etc.old/group",data_config.MOUNTPOINT+"/etc/group")
-    msg="Configuring system"
+    msg = "Configuring system"
 
     update_status(msg)
     progress(98)
@@ -1080,43 +1081,43 @@ def upgrade(hostoptions):
         logging.debug("clean upgrade or knoppmyth upgrade detected, running restore settings")
         restore_default_settings()
         if clean_upgrade():
-            file="%s/%s/.kmupgrade" %(data_config.MOUNTPOINT,data_config.MYTHHOME)
-            cmd="touch %s && chmod 777 %s" %(file,file)
+            file = "%s/%s/.kmupgrade" %(data_config.MOUNTPOINT,data_config.MYTHHOME)
+            cmd = "touch %s && chmod 777 %s" %(file,file)
             runcmd(cmd)
     copy_updates()
     fix_permissions()
     mount_bind_chroot()
     logging.info("Running systemconfig in chroot")
-    cmd="  chroot %s %s/bin/systemconfig.sh misc,hostype,network,advanced,user,this_is_install" %(data_config.MOUNTPOINT,MVROOT)
+    cmd = "  chroot %s %s/bin/systemconfig.sh misc,hostype,network,advanced,user,this_is_install" %(data_config.MOUNTPOINT,MVROOT)
     runcmd(cmd)
     mysqldb("stop","")
     if ( systemconfig["SystemType"] == "Master_backend" or  systemconfig["SystemType"] == "Standalone" ):
         if clean_upgrade() or not backup_sql_check():
             logging.info("Installing new database")
-            cmd="  chroot %s %s/bin/install_db_chroot.sh |tee /tmp/chrootdb.out" %(data_config.MOUNTPOINT,MVROOT)
+            cmd = "  chroot %s %s/bin/install_db_chroot.sh |tee /tmp/chrootdb.out" %(data_config.MOUNTPOINT,MVROOT)
             runcmd(cmd)
         else:
             logging.info("Restoring database")
-            cmd="  chroot %s %s/bin/restore_km_db_chroot.sh %s|tee /tmp/chrootdb.out" %(data_config.MOUNTPOINT,MVROOT,hostoptions["backupfile"])
+            cmd = "  chroot %s %s/bin/restore_km_db_chroot.sh %s|tee /tmp/chrootdb.out" %(data_config.MOUNTPOINT,MVROOT,hostoptions["backupfile"])
             runcmd(cmd)
 
     if os.path.exists("/tmp/etc/KnoppMyth-version"):
-        cmd="  chroot %s %s/bin/restore_default_settings.sh -c restore  -t hostsettings " %(data_config.MOUNTPOINT,MVROOT)
+        cmd = "  chroot %s %s/bin/restore_default_settings.sh -c restore  -t hostsettings " %(data_config.MOUNTPOINT,MVROOT)
         runcmd(cmd)
         logging.debug("Correcting permissions because of km->linhes upgrade")
-        cmd="  chown -R mythtv:mythtv  %s" %(data_config.MOUNTPOINT+data_config.DATAMOUNT)
+        cmd = "  chown -R mythtv:mythtv  %s" %(data_config.MOUNTPOINT+data_config.DATAMOUNT)
         runcmd(cmd)
-        cmd="  chown -R root:root  %s" %(data_config.MOUNTPOINT+data_config.DATAMOUNT+"/backup")
+        cmd = "  chown -R root:root  %s" %(data_config.MOUNTPOINT+data_config.DATAMOUNT+"/backup")
         runcmd(cmd)
     else:
-        cmd="  chroot %s %s/bin/restore_default_settings.sh -c restore  -t syssettings " %(data_config.MOUNTPOINT,MVROOT)
+        cmd = "  chroot %s %s/bin/restore_default_settings.sh -c restore  -t syssettings " %(data_config.MOUNTPOINT,MVROOT)
         runcmd(cmd)
 
     logging.info("Running systemconfig in chroot 2nd time")
-    cmd="  chroot %s %s/bin/systemconfig.sh misc,hostype,network,advanced,user,this_is_install" %(data_config.MOUNTPOINT,MVROOT)
+    cmd = "  chroot %s %s/bin/systemconfig.sh misc,hostype,network,advanced,user,this_is_install" %(data_config.MOUNTPOINT,MVROOT)
     runcmd(cmd)
     logging.info("Running systemconfig in chroot")
-    cmd="  chroot %s %s/bin/systemconfig.sh advanced" %(data_config.MOUNTPOINT,MVROOT)
+    cmd = "  chroot %s %s/bin/systemconfig.sh advanced" %(data_config.MOUNTPOINT,MVROOT)
     runcmd(cmd)
     mysqldb("stop",'chroot')
     apply_new_auth()
@@ -1125,7 +1126,7 @@ def upgrade(hostoptions):
     cp_and_log("/tmp/mythvantage_install.log",data_config.MOUNTPOINT+"/var/log/mythvantage_install.log")
     cp_and_log("/tmp/mv_debug.log",data_config.MOUNTPOINT+"/var/log/mv_debug.log")
     unmount_it()
-    msg="Done"
+    msg = "Done"
     update_status(msg)
     mysqldb("start",'')
 
@@ -1147,7 +1148,7 @@ def main(argv):
             sys.exit(0)
         elif opt in ( "--rootdisk"):
             hostoptions["rootdisk"] = arg
-            hostoptions["rootpartition"]=arg+str(1)
+            hostoptions["rootpartition"] = arg+str(1)
         elif opt in ("--rootfs"):
             hostoptions["rootfs"] = arg
         elif opt in ("--rootsize"):
@@ -1164,7 +1165,7 @@ def main(argv):
             hostoptions["swapsize"]  = arg
 
         elif opt in ("-c"):
-            validop=["full_install","upgrade","netboot","find_upgrade"]
+            validop = ["full_install","upgrade","netboot","find_upgrade"]
             if arg not in validop:
                 logging.critical("-c %s is not a valid option",arg)
                 sys.exit(2)
@@ -1173,19 +1174,19 @@ def main(argv):
     try:
         hostoptions["datadisk"]
     except:
-        hostoptions["datadisk"]=hostoptions["rootdisk"]
-        hostoptions["datapartition"]=hostoptions["datadisk"]+str(3)
+        hostoptions["datadisk"] = hostoptions["rootdisk"]
+        hostoptions["datapartition"] = hostoptions["datadisk"]+str(3)
     try:
         hostoptions["datapartition"]
     except:
-        hostoptions["datapartition"]=hostoptions["datadisk"]+str(3)
-    hostoptions["swappartition"] = hostoptions["rootdisk"] + str(2)
+        hostoptions["datapartition"] = hostoptions["datadisk"]+str(3)
+    hostoptions["swappartition"]  =  hostoptions["rootdisk"] + str(2)
 
 
     if ( hostoptions["op"]  == "full_install" ) :
         full_install(hostoptions)
     elif (hostoptions["op"]  == "upgrade" ) :
-        hostoptions["datafs"]="no_format"
+        hostoptions["datafs"] = "no_format"
         find_upgrade()
         upgrade(hostoptions)
     elif (hostoptions["op"]  == "find_upgrade" ) :
@@ -1195,7 +1196,7 @@ def main(argv):
 
 #____________________________________________setup the logging______________________________________________________
 LOG_FILENAME = '/tmp/mv_status.log'
-DEBUGLOG='/tmp/mv_debug.log'
+DEBUGLOG = '/tmp/mv_debug.log'
 logging.basicConfig(level=logging.DEBUG,
                     format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
                     datefmt='%m-%d %H:%M',
@@ -1223,18 +1224,22 @@ logging.getLogger('').addHandler(infofile)
 global systemconfig
 systemconfig = {}
 file_name = "/etc/systemconfig"
-config_file= open(file_name)
+try:
+    config_file = open(file_name)
+except:
+    logging.debug("%s could not be opened",file_name)
+    config_file=''
 
 for line in config_file:
     line = line.strip()
     if line and line[0] is not "#" and line[-1] is not "=":
         var,val = line.rsplit("=",1)
-        val=val.strip('"')
+        val = val.strip('"')
         systemconfig[var.strip()] = val.strip()
 
 
 if __name__ == "__main__":
-    config_file="mv_config"
+    config_file = "mv_config"
     data_config = __import__(config_file, globals(), locals(), [])
 
     cmdoptions = main(sys.argv[1:])
-- 
cgit v0.12


From d2558b37e5c93dff5ee88519d416686b9df1a40b Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Thu, 7 May 2009 12:49:08 -0500
Subject: mv_install: add support for reading timezone on km upgrades.  Fix
 backupsql check path

---
 abs/core-testing/LinHES-config/PKGBUILD         |  2 +-
 abs/core-testing/LinHES-config/install_proxy.sh |  6 +++-
 abs/core-testing/LinHES-config/mv_install.py    | 46 ++++++++++++++++++++-----
 3 files changed, 43 insertions(+), 11 deletions(-)

diff --git a/abs/core-testing/LinHES-config/PKGBUILD b/abs/core-testing/LinHES-config/PKGBUILD
index b20af81..a85f158 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=410
+pkgrel=418
 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 rsync python-parted )
diff --git a/abs/core-testing/LinHES-config/install_proxy.sh b/abs/core-testing/LinHES-config/install_proxy.sh
index cb387b9..b9d6b67 100755
--- a/abs/core-testing/LinHES-config/install_proxy.sh
+++ b/abs/core-testing/LinHES-config/install_proxy.sh
@@ -201,7 +201,11 @@ case $1 in
             cond2=$(echo "$percent > 98" |bc  )
             if [ $cond2 -eq 1  ]
             then
-            percent=98
+                percent=98
+            fi
+            if  [  x"${state}" =  "xDone" ]
+            then
+                percent=100
             fi
             cond3=$(echo "$percent < 3" |bc )
             if [ $cond3 -eq 0   ]
diff --git a/abs/core-testing/LinHES-config/mv_install.py b/abs/core-testing/LinHES-config/mv_install.py
index a945e34..678cf3e 100755
--- a/abs/core-testing/LinHES-config/mv_install.py
+++ b/abs/core-testing/LinHES-config/mv_install.py
@@ -15,8 +15,19 @@ def usage():
 def clean_upgrade():
     return False
 
+def update_db(value,data):
+    db = MySQLdb.connect(host="localhost", user="mythtv", passwd="[REDACTED] db="mythconverg")
+    try:
+        cursor = db.cursor()
+        cursor.execute("DELETE FROM settings where value=%s and hostname=%s;",(value,data_config.MVHOSTNAME))
+        cursor.execute("REPLACE INTO  settings set value=%s,data=%s,hostname=%s;" ,(value,data,data_config.MVHOSTNAME))
+        logging.debug("Updated database  with %s,%s",data,value)
+    except  MySQLdb.Error, e:
+        logging.debug("Unable to update database with %s,%s",data,value)
+
+
 def progress(pgnum):
-    progressline = str(pgnum) + " complete"
+    progressline = str(pgnum) + "% complete"
     logging.debug("Progress: %s" , pgnum)
     f = open('/tmp/.install_percent', 'w')
     f.write(progressline)
@@ -64,11 +75,11 @@ def backup_sql_check():
     except:
         logging.debug("Backup file var is empty")
         return False
-    if os.path.exists(hostoptions["backupfile"]):
-        logging.debug("Backup file %s is present",hostoptions["backupfile"])
+    if os.path.exists(data_config.MOUNTPOINT+hostoptions["backupfile"]):
+        logging.debug("Backup file %s is present",data_config.MOUNTPOINT+hostoptions["backupfile"])
         return True
     else:
-        logging.debug("Backup file %s is NOT present",hostoptions["backupfile"])
+        logging.debug("Backup file %s is NOT present",data_config.MOUNTPOINT+hostoptions["backupfile"])
         return False
 
 def mdadm_find(PREFIX):
@@ -90,7 +101,7 @@ def mdadm_assemble_all():
     mdadm_contents = ''
     try:
         f = open(mdadmconf_file, 'r')
-        mdadm_contents = f.readlines
+        mdadm_contents = f.readlines()
         f.close()
     except:
         logging.debug("     Couldn't open mdadmconf file")
@@ -115,7 +126,23 @@ def copy_updates():
     cp_and_log2(MVROOT+"/bin/",data_config.MOUNTPOINT+MVROOT+"/bin","*.py")
 
 def timezone_to_db(timefile):
-    logging.info("LOOK TIMEZONE TO DB needs to be completed")
+    logging.info("importing timezone needs")
+    try:
+        f = open(timefile)
+        timezonecontents = f.readline().strip()
+        f.close
+    except:
+        logging.debug("Couldn't open /tmp/etc/timezone, will not set the timezone")
+        return
+    tzsplit = timezonecontents.partition('/')
+    print tzsplit
+    if tzsplit[2]  == '' :
+        update_db("HostTimeZoneRegion", tzsplit[0])
+    else:
+        update_db("HostTimeZoneRegion", tzsplit[0])
+        tztemp="HostTimeZoneRegion_%s" % tzsplit[0]
+        update_db(tztemp,tzsplit[2])
+
 
 
 def cp_and_log(srcfile,destfile):
@@ -1008,6 +1035,7 @@ def upgrade_mount_search():
         newbackupfile = "/tmp/"+data_config.BACKUPFILE
         if os.path.exists(newbackupfile):
             logging.debug("Setting backup file to %s",newbackupfile)
+            cp_and_log(newbackupfile,data_config.MOUNTPOINT+newbackupfile)
             hostoptions["backupfile"] = newbackupfile
         else:
             logging.info("Couldn't find any database to restore, upgrade will continue with a new database")
@@ -1036,7 +1064,7 @@ def upgrade(hostoptions):
     update_status(statusmsg)
     progress(3)
     mount_it()
-    hostoptions["backupfile"] = data_config.MOUNTPOINT+data_config.BACKUPPATH+data_config.BACKUPFILE
+    hostoptions["backupfile"] = data_config.BACKUPPATH+data_config.BACKUPFILE
     statgrab( hostoptions["rootdisk"])
     msg = "Upgrading %s" %(systemconfig["hostname"])
     update_status(msg)
@@ -1201,7 +1229,7 @@ logging.basicConfig(level=logging.DEBUG,
                     format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
                     datefmt='%m-%d %H:%M',
                     filename=DEBUGLOG,
-                    filemode='w')
+                    filemode='a')
 # define a Handler which writes INFO messages or higher to the sys.stderr
 console = logging.StreamHandler()
 console.setLevel(logging.INFO)
@@ -1241,7 +1269,7 @@ for line in config_file:
 if __name__ == "__main__":
     config_file = "mv_config"
     data_config = __import__(config_file, globals(), locals(), [])
-
+    logging.debug("___________START OF DEBUG_________________________")
     cmdoptions = main(sys.argv[1:])
     logging.debug("______cmd line options______")
     for i in cmdoptions.items():
-- 
cgit v0.12


From 6aec480f40e73de0b179d0a91aa484266190f52b Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Sat, 9 May 2009 14:46:39 -0500
Subject: mv_install: white space cleanup

---
 abs/core-testing/LinHES-config/PKGBUILD      |   2 +-
 abs/core-testing/LinHES-config/mv_install.py | 623 +++++++++++++--------------
 2 files changed, 289 insertions(+), 336 deletions(-)

diff --git a/abs/core-testing/LinHES-config/PKGBUILD b/abs/core-testing/LinHES-config/PKGBUILD
index a85f158..0fc6ae9 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=418
+pkgrel=419
 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 rsync python-parted )
diff --git a/abs/core-testing/LinHES-config/mv_install.py b/abs/core-testing/LinHES-config/mv_install.py
index 678cf3e..83563aa 100755
--- a/abs/core-testing/LinHES-config/mv_install.py
+++ b/abs/core-testing/LinHES-config/mv_install.py
@@ -1,7 +1,7 @@
 #!/usr/bin/python
 # -*- coding: utf-8 -*-
-import sys , os, commands , glob, time
-import getopt, re, MySQLdb
+import sys,  os,  commands,  glob,  time
+import getopt,  re,  MySQLdb
 import logging
 try:
     import parted
@@ -15,27 +15,27 @@ def usage():
 def clean_upgrade():
     return False
 
-def update_db(value,data):
-    db = MySQLdb.connect(host="localhost", user="mythtv", passwd="[REDACTED] db="mythconverg")
+def update_db(value, data):
+    db = MySQLdb.connect(host="localhost",  user="mythtv",  passwd="[REDACTED]  db="mythconverg")
     try:
         cursor = db.cursor()
-        cursor.execute("DELETE FROM settings where value=%s and hostname=%s;",(value,data_config.MVHOSTNAME))
-        cursor.execute("REPLACE INTO  settings set value=%s,data=%s,hostname=%s;" ,(value,data,data_config.MVHOSTNAME))
-        logging.debug("Updated database  with %s,%s",data,value)
-    except  MySQLdb.Error, e:
-        logging.debug("Unable to update database with %s,%s",data,value)
+        cursor.execute("DELETE FROM settings where value=%s and hostname=%s;", (value, data_config.MVHOSTNAME))
+        cursor.execute("REPLACE INTO  settings set value=%s, data=%s, hostname=%s;", (value, data, data_config.MVHOSTNAME))
+        logging.debug("Updated database  with %s, %s", data, value)
+    except  MySQLdb.Error,  e:
+        logging.debug("Unable to update database with %s, %s", data, value)
 
 
 def progress(pgnum):
     progressline = str(pgnum) + "% complete"
-    logging.debug("Progress: %s" , pgnum)
-    f = open('/tmp/.install_percent', 'w')
+    logging.debug("Progress: %s",  pgnum)
+    f = open('/tmp/.install_percent',  'w')
     f.write(progressline)
     f.close()
 
 def update_status(status):
-    logging.debug("Status: %s" , status)
-    f = open('/tmp/.install_state', 'w')
+    logging.debug("Status: %s",  status)
+    f = open('/tmp/.install_state',  'w')
     f.write(str(status))
     f.close()
 
@@ -46,9 +46,9 @@ def kill_dhcp_chroot():
     try:
         os.chdir(piddir)
         for FILE in glob.glob("dhcpcd-*.pid"):
-            f = open(FILE,'r')
+            f = open(FILE, 'r')
             pid = f.readline()
-            f.close
+            f.close()
             cmd = "kill -9 %s" %pid
             runcmd(cmd)
             os.remove(FILE)
@@ -64,7 +64,7 @@ def statgrab(disk):
     except:
         prewritebytes = "1024"
     outline = "STARTSIZE=%s" %prewritebytes
-    f = open('/tmp/.startsize.io', 'w')
+    f = open('/tmp/.startsize.io',  'w')
     f.write(str(outline))
     f.close()
 
@@ -76,10 +76,10 @@ def backup_sql_check():
         logging.debug("Backup file var is empty")
         return False
     if os.path.exists(data_config.MOUNTPOINT+hostoptions["backupfile"]):
-        logging.debug("Backup file %s is present",data_config.MOUNTPOINT+hostoptions["backupfile"])
+        logging.debug("Backup file %s is present", data_config.MOUNTPOINT+hostoptions["backupfile"])
         return True
     else:
-        logging.debug("Backup file %s is NOT present",data_config.MOUNTPOINT+hostoptions["backupfile"])
+        logging.debug("Backup file %s is NOT present", data_config.MOUNTPOINT+hostoptions["backupfile"])
         return False
 
 def mdadm_find(PREFIX):
@@ -88,7 +88,7 @@ def mdadm_find(PREFIX):
         mdadmconf = "/etc/mdadm/mdadm.conf"
     else:
         mdadmconf = "/etc/mdadm.conf"
-    logging.debug("Using %s for mdadm.conf",mdadmconf)
+    logging.debug("Using %s for mdadm.conf", mdadmconf)
     return mdadmconf
 
 def mdadm_assemble_all():
@@ -100,17 +100,17 @@ def mdadm_assemble_all():
     runcmd(cmd)
     mdadm_contents = ''
     try:
-        f = open(mdadmconf_file, 'r')
+        f = open(mdadmconf_file,  'r')
         mdadm_contents = f.readlines()
         f.close()
     except:
         logging.debug("     Couldn't open mdadmconf file")
     for line in mdadm_contents:
         if line.startswith("ARRAY"):
-            logging.debug("     Found MD array: %s",line)
+            logging.debug("     Found MD array: %s", line)
             array = line.split()[1]
-            logging.info("      assembling array: %s",array)
-            cmd = "mdadm --assemble -c /tmp%s %s" %(mdadmconf_file,array)
+            logging.info("      assembling array: %s", array)
+            cmd = "mdadm --assemble -c /tmp%s %s" %(mdadmconf_file, array)
             runcmd(cmd)
             time.sleep(2)
             cmd = "fsck -p %s" %array
@@ -120,118 +120,71 @@ def copy_updates():
     try:
         MVROOT = os.environ["MV_ROOT"]
     except:
-        logging.debug("MVROOT was not defined, using the default value")
+        logging.debug("MVROOT was not defined,  using the default value")
         MVROOT = "/usr/MythVantage"
-    cp_and_log2(MVROOT+"/bin/",data_config.MOUNTPOINT+MVROOT+"/bin","*.sh")
-    cp_and_log2(MVROOT+"/bin/",data_config.MOUNTPOINT+MVROOT+"/bin","*.py")
+    cp_and_log2(MVROOT+"/bin/", data_config.MOUNTPOINT+MVROOT+"/bin", "*.sh")
+    cp_and_log2(MVROOT+"/bin/", data_config.MOUNTPOINT+MVROOT+"/bin", "*.py")
 
 def timezone_to_db(timefile):
     logging.info("importing timezone needs")
     try:
         f = open(timefile)
         timezonecontents = f.readline().strip()
-        f.close
+        f.close()
     except:
         logging.debug("Couldn't open /tmp/etc/timezone, will not set the timezone")
         return
     tzsplit = timezonecontents.partition('/')
     print tzsplit
     if tzsplit[2]  == '' :
-        update_db("HostTimeZoneRegion", tzsplit[0])
+        update_db("HostTimeZoneRegion",  tzsplit[0])
     else:
-        update_db("HostTimeZoneRegion", tzsplit[0])
+        update_db("HostTimeZoneRegion",  tzsplit[0])
         tztemp="HostTimeZoneRegion_%s" % tzsplit[0]
-        update_db(tztemp,tzsplit[2])
+        update_db(tztemp, tzsplit[2])
 
 
 
-def cp_and_log(srcfile,destfile):
+def cp_and_log(srcfile, destfile):
     #return
     if not os.path.exists(srcfile):
-        logging.info("%s is not present, skipping...",srcfile)
+        logging.info("%s is not present,  skipping...", srcfile)
     else:
-        cmd = ("rsync -arvp %s %s") %(srcfile,destfile)
+        cmd = ("rsync -arvp %s %s") %(srcfile, destfile)
         runcmd(cmd)
-        #if os.path.isdir(srcfile):
-            #logging.info("Copying directory %s to %s",srcfile,destfile)
-            #try:
-                #shutil.copytree(srcfile,destfile)
-            #except:
-                #logging.debug("Couldn't copy directory %s  using file by file", srcfile)
-                #try:
-                    #stddir=os.getcwd()
-                    #os.chdir(srcfile)
-                    #for FILE in glob.glob("*"):
-                        #print FILE
-                        #shutil.copy2(FILE, destfile+"/"+FILE)
-                    #os.chdir(stddir)
-                #except:
-                    #logging.info("Dir File by file failed: %s", srcfile)
-
-        #elif os.path.isfile(srcfile):
-            #logging.info("Copying File %s to %s",srcfile,destfile)
-            #try:
-                #shutil.copy(srcfile,destfile)
-            #except:
-                #logging.info("Couldn't copy file %s",srcfile)
-        #else:
-            #logging.debug("Src file is not a file or a directory")
-
-def cp_and_log2(srcfile,destfile,fileglob):
+
+def cp_and_log2(srcfile, destfile, fileglob):
     #return
     logging.debug("cp_and_log2")
-    logging.debug("%s , %s , %s" ,srcfile ,destfile, fileglob)
+    logging.debug("%s,  %s,  %s", srcfile, destfile,  fileglob)
 
     if not os.path.exists(srcfile):
-        logging.info("%s is not present, skipping...",srcfile)
+        logging.info("%s is not present,  skipping...", srcfile)
     else:
-        if fileglob=='':
-            cmd = ("rsync -arvp %s %s") %(srcfile,destfile)
+        if fileglob == '':
+            cmd = ("rsync -arvp %s %s") %(srcfile, destfile)
             runcmd(cmd)
         else:
             fileglob = "*"
-            cmd = ("rsync -arvp %s/%s %s") %(srcfile,fileglob,destfile)
+            cmd = ("rsync -arvp %s/%s %s") %(srcfile, fileglob, destfile)
             runcmd(cmd)
-        #if os.path.isdir(srcfile):
-                #logging.info("Copying directory %s to %s",srcfile,destfile)
-                #try:
-                    #shutil.copytree(srcfile,destfile)
-                #except:
-                    #logging.debug("Couldn't copy directory %s  using file by file", srcfile)
-                    #try:
-                        #stddir=os.getcwd()
-                        #os.chdir(srcfile)
-                        #for FILE in glob.glob(fileglob):
-                            #logging.debug("copying file %s to %s" ,FILE,destfile+FILE)
-                            #shutil.copy2(FILE, destfile+FILE)
-                        #os.chdir(stddir)
-                    #except:
-                        #logging.info("Dir File by file failed: %s", srcfile)
-        #elif os.path.isfile(srcfile):
-            #logging.info("Copying File %s to %s",srcfile,destfile)
-            #try:
-                #shutil.copy(srcfile,destfile)
-            #except:
-                #logging.info("Couldn't copy file %s",srcfile)
-        #else:
-            #logging.debug("Src file is not a file or a directory")
 
 def runcmd(cmd):
-    if data_config.NOOPDEBUG=="FALSE":
+    if data_config.NOOPDEBUG == "FALSE":
         pass
     else:
         cmd = "echo "+cmd
-    logging.debug("    %s",cmd)
+    logging.debug("    %s", cmd)
     cmdout = commands.getoutput(cmd)
-    logging.debug("    %s",cmdout)
+    logging.debug("    %s", cmdout)
     return cmdout
 
-def mysqldb(cmd,inchroot):
-    if cmd=="start":
+def mysqldb(cmd, inchroot):
+    if cmd == "start":
         mycmd = "  /etc/rc.d/mysqld start"
-    elif cmd=="stop":
+    elif cmd == "stop":
         mycmd = "  /etc/rc.d/mysqld stop"
-    if inchroot=="chroot":
+    if inchroot == "chroot":
         mycmd = "  chroot %s" %mycmd
     runcmd(mycmd)
 
@@ -255,21 +208,21 @@ def umount_bind_chroot():
     runcmd(cmd)
 
 
-def partitions_removeall(diskdevice,label):
-    logging.info("Removing all partitions for %s  %s" ,label,diskdevice)
+def partitions_removeall(diskdevice, label):
+    logging.info("Removing all partitions for %s  %s", label, diskdevice)
     device = parted.getDevice(diskdevice)
     partdisk = parted.Disk(device)
     partdisk.deleteAllPartitions()
-    if data_config.NOOPDEBUG=="FALSE":
+    if data_config.NOOPDEBUG == "FALSE":
         partdisk.commit()
 
     for partition in partdisk.partitions:
-            print "type: %s" %partition.type
+        print "type: %s" %partition.type
 
-def create_partitions(diskdevice,size,ptype,startsector):
+def create_partitions(diskdevice, size, ptype, startsector):
     logging.debug("_____Create partitions______")
-    if size=="NO":
-        logging.info("Size is 0, skipping")
+    if size == "NO":
+        logging.info("Size is 0,  skipping")
         return "NO"
     partlist = []
     newstart = 0
@@ -277,52 +230,52 @@ def create_partitions(diskdevice,size,ptype,startsector):
     device = parted.getDevice(diskdevice)
     partdisk = parted.Disk(device)
     for partition in partdisk.partitions:
-            if partition.type != parted.PARTITION_FREESPACE:
-                partlist.append((partition,
-                            partition.path,
-                            partition.getFlag(parted.PARTITION_BOOT),
-                            partition.geometry.start,
-                            partition.geometry.end,
-                            partition.geometry.length,
-                            partition.type,
-                            partition.fileSystem))
+        if partition.type != parted.PARTITION_FREESPACE:
+            partlist.append((partition,
+                        partition.path,
+                        partition.getFlag(parted.PARTITION_BOOT),
+                        partition.geometry.start,
+                        partition.geometry.end,
+                        partition.geometry.length,
+                        partition.type,
+                        partition.fileSystem))
     for slice in partlist:
-        (usedpartition, usedpath, usedbootable, usedstart, usedend, usedlength, usedtype, usedfs) = slice
+        (usedpartition,  usedpath,  usedbootable,  usedstart,  usedend,  usedlength,  usedtype,  usedfs) = slice
         #Start the new partition one after the end of last
         newstart = usedend+1
 
-    if  startsector==0:
+    if  startsector == 0:
         newstart = 0
-    if size=="ALL":
-        logging.debug("     Using the rest of the disk  %s",(device.length-newstart) )
+    if size == "ALL":
+        logging.debug("     Using the rest of the disk  %s", (device.length-newstart) )
         try:
-            geom = parted.Geometry(device=device, start=newstart, length=(device.length-newstart))
+            geom = parted.Geometry(device=device,  start=newstart,  length=(device.length-newstart))
         except:
-            logging.info("An error occured, probably invalid parition size")
+            logging.info("An error occured,  probably invalid parition size")
             return
     else:
         # convert size in MB to a length on the device in sectors
         length = (int(size) * (1024 * 1024)) / device.sectorSize
-        logging.debug("Size is %s",length)
+        logging.debug("Size is %s", length)
         try:
-            geom = parted.Geometry(device=device, start=newstart, length=length)
+            geom = parted.Geometry(device=device,  start=newstart,  length=length)
         except:
-            logging.info("An error occured, probably invalid parition size")
+            logging.info("An error occured,  probably invalid parition size")
             return
     #collect device constraint
     constraint = device.getConstraint()
     # new partition
-    if ptype=="NORMAL":
-        newpart = parted.Partition(disk=partdisk,type=parted.PARTITION_NORMAL, geometry=geom)
-    elif ptype=="SWAP":
-        newpart = parted.Partition(disk=partdisk,type=parted.PARTITION_NORMAL, geometry=geom)
+    if ptype == "NORMAL":
+        newpart = parted.Partition(disk=partdisk, type=parted.PARTITION_NORMAL,  geometry=geom)
+    elif ptype == "SWAP":
+        newpart = parted.Partition(disk=partdisk, type=parted.PARTITION_NORMAL,  geometry=geom)
 
     #add the partition to the disk and commit changes
-    partdisk.addPartition(partition=newpart, constraint=constraint)
-    if data_config.NOOPDEBUG=="FALSE":
+    partdisk.addPartition(partition=newpart,  constraint=constraint)
+    if data_config.NOOPDEBUG == "FALSE":
         partdisk.commit()
     logging.info("created partition %s of %dMB and added it to %s" %
-                (newpart.getDeviceNodeName(), newpart.getSize(), diskdevice))
+                (newpart.getDeviceNodeName(),  newpart.getSize(),  diskdevice))
     return newpart.getDeviceNodeName()
 
 
@@ -333,23 +286,23 @@ def partition_disk():
     rootdisk = hostoptions["rootdisk"]
     datadisk = hostoptions["datadisk"]
     label = "root"
-    partitions_removeall("/dev/"+rootdisk,label)
+    partitions_removeall("/dev/"+rootdisk, label)
     label = "data"
-    partitions_removeall("/dev/"+datadisk,label)
-    hostoptions["rootpartition"] = create_partitions("/dev/"+rootdisk,hostoptions["rootsize"],"NORMAL",0)
-    hostoptions["swappartition"] = create_partitions("/dev/"+rootdisk,hostoptions["swapsize"],"SWAP",1)
-    if datadisk!=rootdisk:
-        hostoptions["datapartition"] = create_partitions("/dev/"+datadisk,hostoptions["datasize"],"NORMAL",0)
+    partitions_removeall("/dev/"+datadisk, label)
+    hostoptions["rootpartition"] = create_partitions("/dev/"+rootdisk, hostoptions["rootsize"], "NORMAL", 0)
+    hostoptions["swappartition"] = create_partitions("/dev/"+rootdisk, hostoptions["swapsize"], "SWAP", 1)
+    if datadisk != rootdisk:
+        hostoptions["datapartition"] = create_partitions("/dev/"+datadisk, hostoptions["datasize"], "NORMAL", 0)
     else:
-        hostoptions["datapartition"] = create_partitions("/dev/"+datadisk,hostoptions["datasize"],"NORMAL",1)
+        hostoptions["datapartition"] = create_partitions("/dev/"+datadisk, hostoptions["datasize"], "NORMAL", 1)
     time.sleep(5)
 
 def fscmd(fstype):
-    fscmds = {"reiserfs":"mkreiserfs -q -l ROOT" , "xfs": "mkfs -t xfs -f" , "ext3": "mkfs.ext3","jfs":"mkfs.jfs -q","ext4":"mkfs.ext4","Do_not_format":"noformat","no_format":"noformat"}
+    fscmds = {"reiserfs":"mkreiserfs -q -l ROOT",  "xfs": "mkfs -t xfs -f",  "ext3": "mkfs.ext3", "jfs":"mkfs.jfs -q", "ext4":"mkfs.ext4", "Do_not_format":"noformat", "no_format":"noformat"}
     try:
         rc = fscmds[fstype]
     except:
-        logging.critical(" %s is not a valid fs type, exiting now",fstype)
+        logging.critical(" %s is not a valid fs type,  exiting now", fstype)
         sys.exit(3)
     return rc
 
@@ -363,36 +316,36 @@ def format_disk(install_type):
     datadisk = hostoptions["datadisk"]
     rootpartition = hostoptions["rootpartition"]
     datapartition = hostoptions["datapartition"]
-    if install_type!="upgrade":
+    if install_type != "upgrade":
         swapsize = hostoptions["swapsize"]
         swappartition = hostoptions["swappartition"]
 
-    logging.debug("     Format command for rootfs  %s : %s ", rootfs,rootpartition)
+    logging.debug("     Format command for rootfs  %s : %s ",  rootfs, rootpartition)
     if ( rootfs != "noformat"):
-        logging.info("Starting format of %s",rootpartition)
-        cmd = "  %s /dev/%s" %( rootfs , rootpartition)
+        logging.info("Starting format of %s", rootpartition)
+        cmd = "  %s /dev/%s" %( rootfs,  rootpartition)
         #os.system(cmd)
         runcmd(cmd)
     else:
-        logging.info("Will not format root partition: %s",rootpartition)
+        logging.info("Will not format root partition: %s", rootpartition)
 
-    logging.debug("     Format command for datafs  %s : %s ", datafs,datapartition)
+    logging.debug("     Format command for datafs  %s : %s ",  datafs, datapartition)
     if (datafs != "noformat"):
-        logging.info("Starting format of %s",datapartition)
-        cmd = "  %s /dev/%s" %( datafs , datapartition)
+        logging.info("Starting format of %s", datapartition)
+        cmd = "  %s /dev/%s" %( datafs,  datapartition)
         #os.system(cmd)
         runcmd(cmd)
     else:
-        logging.info("Will not format data partition: %s", datapartition)
+        logging.info("Will not format data partition: %s",  datapartition)
 
-    if install_type=="install":
+    if install_type == "install":
         if (hostoptions["swapsize"] != "NO"):
-            logging.info("Starting format for swap %s",swappartition)
+            logging.info("Starting format for swap %s", swappartition)
             cmd = "  mkswap /dev/%s" % swappartition
             #os.system(cmd)
             runcmd(cmd)
         else:
-            logging.debug("     Swap is set to NO, will not run mkswap")
+            logging.debug("     Swap is set to NO,  will not run mkswap")
 
     logging.debug("_____End of format______")
 
@@ -403,13 +356,13 @@ def mount_it():
     try:
         mountpoint = data_config.MOUNTPOINT
         mp = mountpoint
-        logging.info("Creating mountpoints %s",mp)
+        logging.info("Creating mountpoints %s", mp)
         os.makedirs(mp)
     except OSError:
-        logging.debug("     Could not create %s",mp)
+        logging.debug("     Could not create %s", mp)
 
 #   Mount root
-    cmd = "mount /dev/%s %s"  %(hostoptions["rootpartition"],mountpoint)
+    cmd = "mount /dev/%s %s"  %(hostoptions["rootpartition"], mountpoint)
     runcmd(cmd)
     #logging.debug(cmd)
     #cmdout=commands.getoutput(cmd)
@@ -420,12 +373,12 @@ def mount_it():
         mountpoint = data_config.MOUNTPOINT
         datapoint = data_config.DATAMOUNT
         mp = mountpoint+datapoint
-        logging.info("Creating mountpoints %s",mp)
+        logging.info("Creating mountpoints %s", mp)
         os.makedirs(mp)
     except OSError:
-        logging.debug("     Could not create %s",mp)
+        logging.debug("     Could not create %s", mp)
 
-    cmd = "mount /dev/%s %s"  %(hostoptions["datapartition"],mp)
+    cmd = "mount /dev/%s %s"  %(hostoptions["datapartition"], mp)
     runcmd(cmd)
     #logging.debug(cmd)
     #cmdout=commands.getoutput(cmd)
@@ -452,7 +405,7 @@ def unmount_it():
 def create_squashlist():
     logging.debug("Creating squashlist")
     squashfile = data_config.SQUASHFILE
-    f = open(squashfile, 'w')
+    f = open(squashfile,  'w')
     for i in data_config.SQUASHLIST:
         f.write(i)
         f.write("\n")
@@ -473,20 +426,20 @@ def copy_it(install_type):
     if ( install_type == "upgrade"):
         logging.info("Upgrading system")
         create_squashlist()
-        cmd = "  unsquashfs -e %s -f -d %s /.livesys/medium/system.sqf" %(data_config.SQUASHFILE , data_config.MOUNTPOINT)
+        cmd = "  unsquashfs -e %s -f -d %s /.livesys/medium/system.sqf" %(data_config.SQUASHFILE,  data_config.MOUNTPOINT)
         runcmd(cmd)
         #logging.debug(cmd)
         #cmdout=commands.getoutput(cmd)
 #   Create the missing dir
-    i = ("sys","proc","dev","tmp","mnt","media","media/cdrom","media/dvd","var/log/mythtv")
+    i = ("sys", "proc", "dev", "tmp", "mnt", "media", "media/cdrom", "media/dvd", "var/log/mythtv")
     mountpoint = data_config.MOUNTPOINT
     for item in i:
         try:
             mp = mountpoint+"/"+item
-            logging.info("Creating mountpoints %s",mp)
+            logging.info("Creating mountpoints %s", mp)
             os.makedirs(mp)
         except OSError:
-            logging.debug("     __Could not create %s",mp)
+            logging.debug("     __Could not create %s", mp)
 #   General fixup
     cmd = "chmod 777 %s/tmp" %(data_config.MOUNTPOINT)
     runcmd(cmd)
@@ -509,20 +462,20 @@ def create_fstab(extralines):
     logging.info("Creating new fstab file")
     fstabfile = data_config.MOUNTPOINT+"/etc/fstab"
     fstab_list = []
-    f = open(fstabfile, 'w')
+    f = open(fstabfile,  'w')
     line = "# <file system>        <dir>         <type>    <options>          <dump> <pass> \n"
     fstab_list.append(line)
     line = "none                   /dev/pts      devpts    defaults            0      0 \n"
     fstab_list.append(line)
     line = "none                   /dev/shm      tmpfs     defaults            0      0\n"
     fstab_list.append(line)
-    line = "/dev/cdrom /media/cdrom   auto    ro,user,noauto,unhide   0      0\n"
+    line = "/dev/cdrom /media/cdrom   auto    ro, user, noauto, unhide   0      0\n"
     fstab_list.append(line)
-    line = "/dev/dvd /media/dvd   auto    ro,user,noauto,unhide   0      0\n"
+    line = "/dev/dvd /media/dvd   auto    ro, user, noauto, unhide   0      0\n"
     fstab_list.append(line)
-    line = "UUID=ROOTUID /  auto defaults,noatime 0 1\n"
+    line = "UUID=ROOTUID /  auto defaults, noatime 0 1\n"
     fstab_list.append(line)
-    line = "UUID=DATAUID %s  auto defaults,noatime 0 1\n" %(data_config.DATAMOUNT)
+    line = "UUID=DATAUID %s  auto defaults, noatime 0 1\n" %(data_config.DATAMOUNT)
     fstab_list.append(line)
     line = "UUID=SWAPUID swap swap defaults  0 0 \n"
     fstab_list.append(line)
@@ -534,18 +487,18 @@ def create_fstab(extralines):
     f.close()
 
 def find_uuid(partition):
-    logging.info("Finding the UUID for %s...",partition)
+    logging.info("Finding the UUID for %s...", partition)
     cmd = "blkid -s UUID /dev/%s" %partition
     tmpuuid = runcmd(cmd)
     splituuid = tmpuuid.partition("=")
-    uuid = splituuid[2].replace('"',"")
-    logging.info("The uuid is %s",uuid)
+    uuid = splituuid[2].replace('"', "")
+    logging.info("The uuid is %s", uuid)
     return uuid.strip()
 
 def pick_out_vg():
     logging.info("Searching for Volume Groups in old fstab")
     vglines = []
-    f = open("/tmp/etc/fstab", 'r')
+    f = open("/tmp/etc/fstab",  'r')
     oldfscontents = f.readlines()
     for line in oldfscontents:
         if line.startswith("/dev/vg"):
@@ -553,47 +506,47 @@ def pick_out_vg():
             templine = line.split()
             mdir = templine[1]
             if not os.path.exists (mdir):
-                logging.debug("Creating dir %s for VG mount",mdir)
+                logging.debug("Creating dir %s for VG mount", mdir)
                 os.makedirs (mdir)
 #               Might need to os.chown to mythtv:users
             else:
-                logging.debug("Directory %s for VG mount already present",mdir)
+                logging.debug("Directory %s for VG mount already present", mdir)
     return vglines
 
 def fstab_it(install_type):
     logging.info("______Checking fstab______")
     kmvg = []
     fstabfile = data_config.MOUNTPOINT+"/etc/fstab"
-#   Check for knoppmyth install, if found create new
-    if install_type=="upgrade":
+#   Check for knoppmyth install,  if found create new
+    if install_type == "upgrade":
         if os.path.exists("/tmp/etc/KnoppMyth-version"):
-            logging.debug("     KnoppMyth-Version found, creating new fstab")
+            logging.debug("     KnoppMyth-Version found,  creating new fstab")
             kmvg = pick_out_vg()
             create_fstab(kmvg)
         elif os.path.exists("/tmp/etc/fstab"):
-                logging.debug("     Upgrade and not Knoppmyth, using old fstab")
-                cp_and_log("/tmp/etc/fstab",fstabfile)
+            logging.debug("     Upgrade and not Knoppmyth,  using old fstab")
+            cp_and_log("/tmp/etc/fstab", fstabfile)
 #   Catch all for creating new fstab
     if not os.path.exists(data_config.MOUNTPOINT+"/etc"):
         os.makedirs(data_config.MOUNTPOINT+"/etc")
     if not os.path.exists(fstabfile):
-       create_fstab(kmvg)
+        create_fstab(kmvg)
 
-    logging.info("____UUID check for %s" , "swap")
+    logging.info("____UUID check for %s",  "swap")
     swapuuid = find_uuid(hostoptions["swappartition"])
 
-    logging.info("____UUID check for %s" , "data")
+    logging.info("____UUID check for %s",  "data")
     datauuid = find_uuid(hostoptions["datapartition"])
 
-    logging.info("____UUID check for %s" , "root")
+    logging.info("____UUID check for %s",  "root")
     rootuuid = find_uuid(hostoptions["rootpartition"])
 
     fstabfile = data_config.MOUNTPOINT+"/etc/fstab"
-    logging.info("Correcting UUID's in %s",fstabfile)
-    f = open(fstabfile, 'r')
+    logging.info("Correcting UUID's in %s", fstabfile)
+    f = open(fstabfile,  'r')
     oldfscontents = f.readlines()
     newfstab = []
-    f.close
+    f.close()
     for line in oldfscontents:
         if line.startswith("UUID"):
             templine = line.split()
@@ -639,12 +592,12 @@ def fstab_it(install_type):
                     logging.debug(      newline)
                     newfstab.append(newline)
         else:
-            logging.debug("     Line didn't match, adding to newfstab:")
+            logging.debug("     Line didn't match,  adding to newfstab:")
             logging.debug(      line)
             newfstab.append(line)
     logging.info("Writing out newfstab")
     logging.debug("______This is the new fstab_____")
-    f = open(fstabfile, 'w')
+    f = open(fstabfile,  'w')
     for line in newfstab:
         logging.debug(line)
         f.write(line)
@@ -663,10 +616,10 @@ def grub_it():
     logging.info("Adding root uuid to grub menu")
     grubfile = data_config.MOUNTPOINT+"/boot/grub/menu.lst"
     try:
-        f = open(grubfile, 'r')
+        f = open(grubfile,  'r')
         oldgrub = f.readlines()
         newgrub = []
-        f.close
+        f.close()
         for line in oldgrub:
             if line.startswith("kernel"):
                 templine = line.split()
@@ -682,12 +635,12 @@ def grub_it():
                 logging.debug(      newline)
                 newgrub.append(newline)
             else:
-                logging.debug("Line didn't match, adding to newgrub:")
+                logging.debug("Line didn't match,  adding to newgrub:")
                 logging.debug(      line)
                 newgrub.append(     line)
         logging.info("Writing out new grub file")
         logging.debug("______This is the new grub_____")
-        f = open(grubfile, 'w')
+        f = open(grubfile,  'w')
         for line in newgrub:
             logging.debug(line)
             f.write(line)
@@ -717,23 +670,23 @@ def apply_new_auth():
     try:
         MVROOT = os.environ["MV_ROOT"]
     except:
-        logging.debug("MVROOT was not defined, using the default value")
+        logging.debug("MVROOT was not defined,  using the default value")
         MVROOT = "/usr/MythVantage"
-    if data_config.NOOPDEBUG=="FALSE":
+    if data_config.NOOPDEBUG == "FALSE":
         cmdprefix = "chroot " + data_config.MOUNTPOINT + " " + MVROOT+"/bin/myth_user_call -i "
     else:
         cmdprefix = "echo chroot " + data_config.MOUNTPOINT + " " + MVROOT+"/bin/myth_user_call -i "
     try:
-        f = open(passfile, 'r')
+        f = open(passfile,  'r')
         passcmds = f.readlines()
-        f.close
+        f.close()
         for cmd in passcmds:
             execmd = cmdprefix+cmd
 #            Using os.system because runcmd fails
             logging.debug(execmd)
             os.system(execmd)
     except:
-        logging.debug("Applying password updates failed, couldn't open %s",passfile)
+        logging.debug("Applying password updates failed,  couldn't open %s", passfile)
     logging.debug
 
 def swapsearch():
@@ -743,72 +696,72 @@ def swapsearch():
     os.chdir("/sys/block")
     partitionlist = glob.glob("*")
     for item in partitionlist:
-            try:
-                newitem = item.strip().rpartition(" ")[2]
-                if (not newitem=='') and  (not newitem.startswith("loop")):
-                    path = "/dev/"+newitem.strip()
-                    path = path.strip()
-                    device = parted.getDevice(path)
-                    (cylinders, heads, sectors) = device.biosGeometry
-                    sizeInBytes = device.length * device.sectorSize
-                    disk = parted.Disk(device)
-                    for partition in disk.partitions:
-                        if partition.type == parted.PARTITION_PROTECTED or \
-                        partition.type == parted.PARTITION_METADATA or \
-                        partition.type == parted.PARTITION_FREESPACE:
-                            continue
-
-                        partlist.append((partition,
-                                        partition.path,
-                                        partition.getFlag(parted.PARTITION_BOOT),
-                                        partition.geometry.start,
-                                        partition.geometry.end,
-                                        partition.geometry.length,
-                                        partition.type,
-                                        partition.fileSystem))
-                    for slice in partlist:
-                        (partition, path, bootable, start, end, length, type, fs) = slice
-                        if partition.getFlag(parted.PARTITION_SWAP) or fs.type=="linux-swap":
-                            print "found swap"
-                            print path
-            except:
-                pass
+        try:
+            newitem = item.strip().rpartition(" ")[2]
+            if (not newitem == '') and  (not newitem.startswith("loop")):
+                path = "/dev/"+newitem.strip()
+                path = path.strip()
+                device = parted.getDevice(path)
+                (cylinders,  heads,  sectors) = device.biosGeometry
+                sizeInBytes = device.length * device.sectorSize
+                disk = parted.Disk(device)
+                for partition in disk.partitions:
+                    if partition.type == parted.PARTITION_PROTECTED or \
+                    partition.type == parted.PARTITION_METADATA or \
+                    partition.type == parted.PARTITION_FREESPACE:
+                        continue
+
+                    partlist.append((partition,
+                                    partition.path,
+                                    partition.getFlag(parted.PARTITION_BOOT),
+                                    partition.geometry.start,
+                                    partition.geometry.end,
+                                    partition.geometry.length,
+                                    partition.type,
+                                    partition.fileSystem))
+                for slice in partlist:
+                    (partition,  path,  bootable,  start,  end,  length,  type,  fs) = slice
+                    if partition.getFlag(parted.PARTITION_SWAP) or fs.type == "linux-swap":
+                        print "found swap"
+                        print path
+        except:
+            pass
     os.chdir(stddir)
 
 def sane_settings(file):
     #Remove some settings from file_name
-    removeline = ("HOSTrootfstype", "HOSTrootfstype", "HOSTdatafstype", "HOSTOSsize", "HostUseALLdata", "HOSTDATAsize", "HOSTuprootfstype", "HostUseSWAP", "HOSTSWAPsize")
+    removeline = ("HOSTrootfstype",  "HOSTrootfstype",  "HOSTdatafstype",  "HOSTOSsize",  "HostUseALLdata",  "HOSTDATAsize",  "HOSTuprootfstype",  "HostUseSWAP",  "HOSTSWAPsize")
     logging.debug("__Running sane settings")
     try:
-        f = open(file, 'r')
+        f = open(file,  'r')
         filecontents = f.readlines()
-        f.close
+        f.close()
     except:
-        logging.debug("     Couldn't find file %s to sane",file)
+        logging.debug("     Couldn't find file %s to sane", file)
     try:
-        f = open(file,'w')
+        f = open(file, 'w')
         for line in filecontents:
             for item in removeline:
                 if line.startsize(line.strip()):
-                    logging.debug("     Found a line to remove in %s, %s",file,line)
+                    logging.debug("     Found a line to remove in %s,  %s", file, line)
                 else:
                     f.write(line)
     except:
-        logging.debug("     Couldn't open file %s for writing",file)
+        logging.debug("     Couldn't open file %s for writing", file)
     logging.debug("     __End  sane settings")
 
 def restore_default_settings():
     try:
         MVROOT = os.environ["MV_ROOT"]
     except:
-        logging.debug("     MVROOT was not defined, using the default value")
+        logging.debug("     MVROOT was not defined,  using the default value")
         MVROOT = "/usr/MythVantage"
     logging.info("Saving syssettings")
-    cmd = "%s/bin/restore_default_settings.sh -c save -t syssettings -h %s -d localhost" %(MVROOT,data_config.MVHOSTNAME)
+    cmd = "%s/bin/restore_default_settings.sh -c save -t syssettings -h %s -d localhost" %(MVROOT, data_config.MVHOSTNAME)
     runcmd(cmd)
     SE = os.environ["TEMPLATES"]+"/settings/syssettings/"
-    cp_and_log(SE,data_config.MOUNTPOINT+SE)
-    cp_and_log("/etc/mtab",data_config.MOUNTPOINT+"/etc/mtab")
+    cp_and_log(SE, data_config.MOUNTPOINT+SE)
+    cp_and_log("/etc/mtab", data_config.MOUNTPOINT+"/etc/mtab")
     copy_updates()
     fix_permissions()
 
@@ -817,22 +770,22 @@ def full_install(hostoptions):
     try:
         MVROOT = os.environ["MV_ROOT"]
     except:
-        logging.debug("     MVROOT was not defined, using the default value")
+        logging.debug("     MVROOT was not defined,  using the default value")
         MVROOT = "/usr/MythVantage"
 
     try:
         os.remove("/tmp/.this_is_upgrade")
     except OSError:
-        logging.debug("     File /tmp/.this_is_upgrade not present, couldn't delete it")
+        logging.debug("     File /tmp/.this_is_upgrade not present,  couldn't delete it")
         pass
 #   Partition disk
     statusmsg = "Partitioning %s"  %( hostoptions["rootdisk"])
     update_status(statusmsg)
     progress(1)
-    if data_config.NOOPDEBUG=="FALSE":
-         partition_disk()
+    if data_config.NOOPDEBUG == "FALSE":
+        partition_disk()
     else:
-        logging.debug("     Debug mode, skipping partitioning step")
+        logging.debug("     Debug mode,  skipping partitioning step")
 
 #   Format disk
     statusmsg = "Preparing  %s"  %( hostoptions["rootdisk"])
@@ -860,7 +813,7 @@ def full_install(hostoptions):
     try:
         os.remove(fstabfile)
     except OSError:
-        logging.debug("     ERROR: deleting %s",fstabfile)
+        logging.debug("     ERROR: deleting %s", fstabfile)
     fstab_it("full_install")
 #   Configure system
     msg = "Configuring system"
@@ -869,65 +822,65 @@ def full_install(hostoptions):
     grub_it()
 #   Configuring the system
     logging.info("______Configuring system________")
-    cp_and_log("/etc/systemconfig",data_config.MOUNTPOINT+"/etc/systemconfig")
-    cp_and_log("/root/xorg.conf.install",data_config.MOUNTPOINT+"/etc/X11/xorg.conf.install")
+    cp_and_log("/etc/systemconfig", data_config.MOUNTPOINT+"/etc/systemconfig")
+    cp_and_log("/root/xorg.conf.install", data_config.MOUNTPOINT+"/etc/X11/xorg.conf.install")
     restore_default_settings()
     #try:
         #MVROOT=os.environ["MV_ROOT"]
     #except:
-        #logging.debug("     MVROOT was not defined, using the default value")
+        #logging.debug("     MVROOT was not defined,  using the default value")
         #MVROOT="/usr/MythVantage"
     #logging.info("Saving syssettings")
-    #cmd="%s/bin/restore_default_settings.sh -c save -t syssettings -h %s -d localhost" %(MVROOT,data_config.MVHOSTNAME)
+    #cmd="%s/bin/restore_default_settings.sh -c save -t syssettings -h %s -d localhost" %(MVROOT, data_config.MVHOSTNAME)
     #runcmd(cmd)
     #SE=os.environ["TEMPLATES"]+"/settings/syssettings"
-    #cp_and_log(SE,data_config.MOUNTPOINT+SE)
-    #cp_and_log("/etc/mtab",data_config.MOUNTPOINT+"/etc/mtab")
-    #cp_and_log2(MVROOT+"/bin/",data_config.MOUNTPOINT+MVROOT+"/bin/","*.sh")
-    #cp_and_log2(MVROOT+"/bin/",data_config.MOUNTPOINT+MVROOT+"/bin/","*.py")
+    #cp_and_log(SE, data_config.MOUNTPOINT+SE)
+    #cp_and_log("/etc/mtab", data_config.MOUNTPOINT+"/etc/mtab")
+    #cp_and_log2(MVROOT+"/bin/", data_config.MOUNTPOINT+MVROOT+"/bin/", "*.sh")
+    #cp_and_log2(MVROOT+"/bin/", data_config.MOUNTPOINT+MVROOT+"/bin/", "*.py")
     #fix_permissions()
     apply_new_auth()
     if ( systemconfig["SystemType"] == "Master_backend" or  systemconfig["SystemType"] == "Standalone" ):
-#       This install will need a DB, so install it
+#       This install will need a DB,  so install it
         logging.info("______Installing Database in CHROOT________")
-        mysqldb("stop",'')
+        mysqldb("stop", '')
         mount_bind_chroot()
-        cmd = "  chroot %s %s/bin/install_db_chroot.sh |tee /tmp/chrootdb.out" %(data_config.MOUNTPOINT,MVROOT)
+        cmd = "  chroot %s %s/bin/install_db_chroot.sh |tee /tmp/chrootdb.out" %(data_config.MOUNTPOINT, MVROOT)
         runcmd(cmd)
         logging.info("Running systemconfig in chroot")
-        cmd = "  chroot %s %s/bin/systemconfig.sh misc,hostype,network,advanced,user,this_is_install" %(data_config.MOUNTPOINT,MVROOT)
+        cmd = "  chroot %s %s/bin/systemconfig.sh misc, hostype, network, advanced, user, this_is_install" %(data_config.MOUNTPOINT, MVROOT)
         runcmd(cmd)
-        mysqldb("stop","chroot")
+        mysqldb("stop", "chroot")
         kill_dhcp_chroot()
         logging.info("____End Database in CHROOT____")
-        mysqldb("start",'')
+        mysqldb("start", '')
         umount_bind_chroot()
     else:
-        logging.info("______No database required, continuing configuration________")
+        logging.info("______No database required,  continuing configuration________")
         mount_bind_chroot()
-        cmd = "  chroot %s DISPLAY=127.0.0.1:0 %s/bin/MythVantage -t restore,default 1" %(data_config.MOUNTPOINT,MVROOT)
+        cmd = "  chroot %s DISPLAY=127.0.0.1:0 %s/bin/MythVantage -t restore, default 1" %(data_config.MOUNTPOINT, MVROOT)
         runcmd(cmd)
 #       Need to check for to touch  /tmp/.dbsysfailed
-        cmd = "  chroot %s %s/bin/restore_default_settings.sh -c restore  -t syssettings " %(data_config.MOUNTPOINT,MVROOT)
+        cmd = "  chroot %s %s/bin/restore_default_settings.sh -c restore  -t syssettings " %(data_config.MOUNTPOINT, MVROOT)
         runcmd(cmd)
         if ( 'x' == '1' ):
             logging.debug("touching /tmp/.dbsysfailed")
         else:
-            cmd = "  chroot %s %s/bin/systemconfig.sh misc,hostype,network,advanced,user,this_is_install" %(data_config.MOUNTPOINT,MVROOT)
+            cmd = "  chroot %s %s/bin/systemconfig.sh misc, hostype, network, advanced, user, this_is_install" %(data_config.MOUNTPOINT, MVROOT)
             runcmd(cmd)
-            cmd = "  chroot %s %s/bin/restore_default_settings.sh -c ACCESSCONTROL " %(data_config.MOUNTPOINT,MVROOT)
+            cmd = "  chroot %s %s/bin/restore_default_settings.sh -c ACCESSCONTROL " %(data_config.MOUNTPOINT, MVROOT)
             runcmd(cmd)
         umount_bind_chroot()
-    cmd = "  chroot %s %s/bin/systemconfig.sh advanced,user" %(data_config.MOUNTPOINT,MVROOT)
+    cmd = "  chroot %s %s/bin/systemconfig.sh advanced, user" %(data_config.MOUNTPOINT, MVROOT)
     runcmd(cmd)
-    cmd = "  touch %s%s/.configure" %(data_config.MOUNTPOINT,data_config.MYTHHOME)
+    cmd = "  touch %s%s/.configure" %(data_config.MOUNTPOINT, data_config.MYTHHOME)
     runcmd(cmd)
-    cmd = "  chmod 777 %s%s/.configure" %(data_config.MOUNTPOINT,data_config.MYTHHOME)
+    cmd = "  chmod 777 %s%s/.configure" %(data_config.MOUNTPOINT, data_config.MYTHHOME)
     runcmd(cmd)
     msg = "Done"
     update_status(msg)
-    cp_and_log("/tmp/mythvantage_install.log",data_config.MOUNTPOINT+"/var/log/mythvantage_install.log")
-    cp_and_log("/tmp/mv_debug.log",data_config.MOUNTPOINT+"/var/log/mv_debug.log")
+    cp_and_log("/tmp/mythvantage_install.log", data_config.MOUNTPOINT+"/var/log/mythvantage_install.log")
+    cp_and_log("/tmp/mv_debug.log", data_config.MOUNTPOINT+"/var/log/mv_debug.log")
     unmount_it()
     logging.debug("_____End of full install_____")
 
@@ -935,55 +888,55 @@ def find_upgrade():
     logging.info("_____Start of find_upgrade_____")
     global hostoptions
     #try to mount first partition of disk
-    #copy old /etc/systemconfig to live, import settings into db
+    #copy old /etc/systemconfig to live,  import settings into db
     #umount drive.
     #check for clean upgrade
     if ( clean_upgrade() ):
-        logging.info("Clean upgrade requested, not using old data")
+        logging.info("Clean upgrade requested,  not using old data")
         return
     mount_it()
     oldbackupfile = data_config.MOUNTPOINT+"/root/backup/"+data_config.BACKUPFILE
     newbackupfile = "/tmp/"+data_config.BACKUPFILE
     if os.path.exists(oldbackupfile):
-        logging.debug("Setting backup file to %s",newbackupfile)
+        logging.debug("Setting backup file to %s", newbackupfile)
         hostoptions["backupfile"] = newbackupfile
-        cp_and_log(oldbackupfile,newbackupfile)
+        cp_and_log(oldbackupfile, newbackupfile)
 
     srcfile = data_config.MOUNTPOINT+"/etc/systemconfig"
-    logging.info("Searching for systemconfig file %s",srcfile)
+    logging.info("Searching for systemconfig file %s", srcfile)
     if os.path.exists(srcfile):
-        logging.info("Found systemconfig file %fs",srcfile)
+        logging.info("Found systemconfig file %fs", srcfile)
         TEMPLATES = os.environ["TEMPLATES"]+"/settings/syssettings"
-        cp_and_log2(data_config.MOUNTPOINT+TEMPLATES,data_config.TEMP_TEMPLATES,'')
+        cp_and_log2(data_config.MOUNTPOINT+TEMPLATES, data_config.TEMP_TEMPLATES, '')
         sane_settings("/tmp/templates/settings/syssettings/settings.txt")
-        cp_and_log2(data_config.TEMP_TEMPLATES,TEMPLATES,'')
-        cp_and_log(srcfile,"/etc/systemconfig")
-        cp_and_log(data_config.MOUNTPOINT+"/etc/","/tmp/etc/")
-        cp_and_log(data_config.MOUNTPOINT+"/var/lib/oss/","/tmp/oss")
-        cp_and_log("/tmp/etc/mdadm.conf","/etc/mdadm.conf")
+        cp_and_log2(data_config.TEMP_TEMPLATES, TEMPLATES, '')
+        cp_and_log(srcfile, "/etc/systemconfig")
+        cp_and_log(data_config.MOUNTPOINT+"/etc/", "/tmp/etc/")
+        cp_and_log(data_config.MOUNTPOINT+"/var/lib/oss/", "/tmp/oss")
+        cp_and_log("/tmp/etc/mdadm.conf", "/etc/mdadm.conf")
     else:
-         logging.info("Could not find systemconfig file %s",srcfile)
-         cp_and_log(data_config.MOUNTPOINT+"/etc/","/tmp/etc/")
-         cp_and_log("/tmp/etc/mdadm.conf","/etc")
-         timezone_to_db("/tmp/etc/timezone")
+        logging.info("Could not find systemconfig file %s", srcfile)
+        cp_and_log(data_config.MOUNTPOINT+"/etc/", "/tmp/etc/")
+        cp_and_log("/tmp/etc/mdadm.conf", "/etc")
+        timezone_to_db("/tmp/etc/timezone")
     unmount_it()
     logging.debug("End of find_upgrade")
 
 def upgrade_mount_search():
     #Search for data/myth partition based on contents of fstab
     logging.debug("______Start of upgrade_mount_search_____")
-    cmd = "umount %s%s"  %(data_config.MOUNTPOINT,data_config.DATAMOUNT)
+    cmd = "umount %s%s"  %(data_config.MOUNTPOINT, data_config.DATAMOUNT)
     runcmd(cmd)
     fstab_list = []
     fstab_data_mount = ''
     try:
-        f = open("/tmp/etc/fstab", 'r')
+        f = open("/tmp/etc/fstab",  'r')
         oldfscontents = f.readlines()
         f.close()
-        ##    ['UUID=', '/myth', 'auto', 'defaults,noatime', '0', '1']
+        ##    ['UUID=',  '/myth',  'auto',  'defaults, noatime',  '0',  '1']
         #for line in oldfscontents:
             #mountdir=line.split()
-            #if mountdir[1]==(data_config.DATAMOUNT):
+            #if mountdir[1] == (data_config.DATAMOUNT):
                 #fstablist.append(mountdir)
     except:
         logging.debug("    Couldn't open /tmp/etc/fstab")
@@ -992,13 +945,13 @@ def upgrade_mount_search():
             continue
         mountdir=line.split()
         try:
-            if mountdir[1]==(data_config.DATAMOUNT):
+            if mountdir[1] == (data_config.DATAMOUNT):
                 fstablist.append(mountdir)
         except:
             continue
     #search fstab for data/myth mountpoint
     for i in fstab_list:
-        if i[1]==data_config.DATAMOUNT:
+        if i[1] == data_config.DATAMOUNT:
             fstab_data_mount = i[0]
             break
 
@@ -1009,15 +962,15 @@ def upgrade_mount_search():
             mdadm_assemble_all
 
 
-    if re.search("UUID",fstab_data_mount):
+    if re.search("UUID", fstab_data_mount):
         fstab_data_uuid = fstab_data_mount.split("=")[1]
         cmd = "blkid -t UUID=%s" %fstab_data_uuid
-        retcode = call(cmd, shell=True)
+        retcode = call(cmd,  shell=True)
         if retcode != 0:
-            logging.debug("    Couldn't find uuid %s , starting md support",fstab_data_uuid)
+            logging.debug("    Couldn't find uuid %s,  starting md support", fstab_data_uuid)
             mdadm_assemble_all
         #hoping everything is up and running and data/myth will be available for mount
-        cmd = "mount -U %s %s" %(fstab_data_uuid,data_config.MOUNTPOINT)
+        cmd = "mount -U %s %s" %(fstab_data_uuid, data_config.MOUNTPOINT)
         runcmd(cmd)
         cmd = "blkid -t UUID=%s|cut -d: -f1" %fstab_data_uuid
         logging.debug(cmd)
@@ -1025,7 +978,7 @@ def upgrade_mount_search():
         cmd = "basename %s" %datadisk
         datadisk = commands.getoutput(cmd)
     else:
-        cmd = "mount  %s %s" %(fstab_data_mount,data_config.MOUNTPOINT)
+        cmd = "mount  %s %s" %(fstab_data_mount, data_config.MOUNTPOINT)
         runcmd(cmd)
         cmd = "basename %s" %fstab_data_mount
         datadisk = commands.getoutput(cmd)
@@ -1034,11 +987,11 @@ def upgrade_mount_search():
     if not backup_sql_check():
         newbackupfile = "/tmp/"+data_config.BACKUPFILE
         if os.path.exists(newbackupfile):
-            logging.debug("Setting backup file to %s",newbackupfile)
-            cp_and_log(newbackupfile,data_config.MOUNTPOINT+newbackupfile)
+            logging.debug("Setting backup file to %s", newbackupfile)
+            cp_and_log(newbackupfile, data_config.MOUNTPOINT+newbackupfile)
             hostoptions["backupfile"] = newbackupfile
         else:
-            logging.info("Couldn't find any database to restore, upgrade will continue with a new database")
+            logging.info("Couldn't find any database to restore,  upgrade will continue with a new database")
 
 
 
@@ -1047,7 +1000,7 @@ def upgrade(hostoptions):
     try:
         MVROOT = os.environ["MV_ROOT"]
     except:
-        logging.debug("MVROOT was not defined, using the default value")
+        logging.debug("MVROOT was not defined,  using the default value")
         MVROOT = "/usr/MythVantage"
     logging.info("______Start of upgrade______")
     cmd = "touch /tmp/.this_is_upgrade"
@@ -1073,29 +1026,29 @@ def upgrade(hostoptions):
     cmd = "rm -rf %s/etc.old" %data_config.MOUNTPOINT
     runcmd(cmd)
 
-    cp_and_log("/tmp/etc/",data_config.MOUNTPOINT+"/etc.old/")
-    cp_and_log("/tmp/oss",data_config.MOUNTPOINT+"/var/lib/oss.old")
+    cp_and_log("/tmp/etc/", data_config.MOUNTPOINT+"/etc.old/")
+    cp_and_log("/tmp/oss", data_config.MOUNTPOINT+"/var/lib/oss.old")
     srcfile = "%s/etc.old/ssh/" %(data_config.MOUNTPOINT)
     destfile = "%s/etc/ssh/" %(data_config.MOUNTPOINT)
-    cp_and_log2(srcfile,destfile,'*.pub')
-    cp_and_log2(srcfile,destfile,'*.key')
-    cp_and_log2(srcfile,destfile,'*key')
+    cp_and_log2(srcfile, destfile, '*.pub')
+    cp_and_log2(srcfile, destfile, '*.key')
+    cp_and_log2(srcfile, destfile, '*key')
     mdfile = mdadm_find("/tmp")
-    cp_and_log("/tmp"+mdfile,data_config.MOUNTPOINT+"/etc")
+    cp_and_log("/tmp"+mdfile, data_config.MOUNTPOINT+"/etc")
     srcfile = "%s/etc.old/asound.state" %(data_config.MOUNTPOINT)
     destfile = "%s/etc/asound.state" %(data_config.MOUNTPOINT)
-    cp_and_log(srcfile,destfile)
-    if not os.path.exists("tmp/etc/KnoppMyth-version"):
-        logging.debug("    standard upgrade, restoring auth files")
-        cp_and_log(data_config.MOUNTPOINT+"/etc.old/passwd",data_config.MOUNTPOINT+"/etc/passwd")
-        cp_and_log(data_config.MOUNTPOINT+"/etc.old/shadow",data_config.MOUNTPOINT+"/etc/shadow")
-        cp_and_log(data_config.MOUNTPOINT+"/etc.old/group",data_config.MOUNTPOINT+"/etc/group")
+    cp_and_log(srcfile, destfile)
+    if not os.path.exists("/tmp/etc/KnoppMyth-version"):
+        logging.debug("    standard upgrade,  restoring auth files")
+        cp_and_log(data_config.MOUNTPOINT+"/etc.old/passwd", data_config.MOUNTPOINT+"/etc/passwd")
+        cp_and_log(data_config.MOUNTPOINT+"/etc.old/shadow", data_config.MOUNTPOINT+"/etc/shadow")
+        cp_and_log(data_config.MOUNTPOINT+"/etc.old/group", data_config.MOUNTPOINT+"/etc/group")
     msg = "Configuring system"
 
     update_status(msg)
     progress(98)
     logging.info("______Configuring system________")
-    cp_and_log("/etc/systemconfig",data_config.MOUNTPOINT+"/etc/systemconfig")
+    cp_and_log("/etc/systemconfig", data_config.MOUNTPOINT+"/etc/systemconfig")
     if not backup_sql_check():
         upgrade_mount_search()
     fstab_it("upgrade")
@@ -1103,34 +1056,34 @@ def upgrade(hostoptions):
     grub_it()
     time.sleep(1)
     #needed to get around a bug with pacman
-    cp_and_log("/root/xorg.conf.install",data_config.MOUNTPOINT+"/etc/X11/xorg.conf.install")
-    cp_and_log("/etc/mtab",data_config.MOUNTPOINT+"/etc/mtab")
+    cp_and_log("/root/xorg.conf.install", data_config.MOUNTPOINT+"/etc/X11/xorg.conf.install")
+    cp_and_log("/etc/mtab", data_config.MOUNTPOINT+"/etc/mtab")
     if clean_upgrade() or os.path.exists("/tmp/etc/KnoppMyth-version"):
-        logging.debug("clean upgrade or knoppmyth upgrade detected, running restore settings")
+        logging.debug("clean upgrade or knoppmyth upgrade detected,  running restore settings")
         restore_default_settings()
         if clean_upgrade():
-            file = "%s/%s/.kmupgrade" %(data_config.MOUNTPOINT,data_config.MYTHHOME)
-            cmd = "touch %s && chmod 777 %s" %(file,file)
+            file = "%s/%s/.kmupgrade" %(data_config.MOUNTPOINT, data_config.MYTHHOME)
+            cmd = "touch %s && chmod 777 %s" %(file, file)
             runcmd(cmd)
     copy_updates()
     fix_permissions()
     mount_bind_chroot()
     logging.info("Running systemconfig in chroot")
-    cmd = "  chroot %s %s/bin/systemconfig.sh misc,hostype,network,advanced,user,this_is_install" %(data_config.MOUNTPOINT,MVROOT)
+    cmd = "  chroot %s %s/bin/systemconfig.sh misc, hostype, network, advanced, user, this_is_install" %(data_config.MOUNTPOINT, MVROOT)
     runcmd(cmd)
-    mysqldb("stop","")
+    mysqldb("stop", "")
     if ( systemconfig["SystemType"] == "Master_backend" or  systemconfig["SystemType"] == "Standalone" ):
         if clean_upgrade() or not backup_sql_check():
             logging.info("Installing new database")
-            cmd = "  chroot %s %s/bin/install_db_chroot.sh |tee /tmp/chrootdb.out" %(data_config.MOUNTPOINT,MVROOT)
+            cmd = "  chroot %s %s/bin/install_db_chroot.sh |tee /tmp/chrootdb.out" %(data_config.MOUNTPOINT, MVROOT)
             runcmd(cmd)
         else:
             logging.info("Restoring database")
-            cmd = "  chroot %s %s/bin/restore_km_db_chroot.sh %s|tee /tmp/chrootdb.out" %(data_config.MOUNTPOINT,MVROOT,hostoptions["backupfile"])
+            cmd = "  chroot %s %s/bin/restore_km_db_chroot.sh %s|tee /tmp/chrootdb.out" %(data_config.MOUNTPOINT, MVROOT, hostoptions["backupfile"])
             runcmd(cmd)
 
     if os.path.exists("/tmp/etc/KnoppMyth-version"):
-        cmd = "  chroot %s %s/bin/restore_default_settings.sh -c restore  -t hostsettings " %(data_config.MOUNTPOINT,MVROOT)
+        cmd = "  chroot %s %s/bin/restore_default_settings.sh -c restore  -t hostsettings " %(data_config.MOUNTPOINT, MVROOT)
         runcmd(cmd)
         logging.debug("Correcting permissions because of km->linhes upgrade")
         cmd = "  chown -R mythtv:mythtv  %s" %(data_config.MOUNTPOINT+data_config.DATAMOUNT)
@@ -1138,25 +1091,25 @@ def upgrade(hostoptions):
         cmd = "  chown -R root:root  %s" %(data_config.MOUNTPOINT+data_config.DATAMOUNT+"/backup")
         runcmd(cmd)
     else:
-        cmd = "  chroot %s %s/bin/restore_default_settings.sh -c restore  -t syssettings " %(data_config.MOUNTPOINT,MVROOT)
+        cmd = "  chroot %s %s/bin/restore_default_settings.sh -c restore  -t syssettings " %(data_config.MOUNTPOINT, MVROOT)
         runcmd(cmd)
 
     logging.info("Running systemconfig in chroot 2nd time")
-    cmd = "  chroot %s %s/bin/systemconfig.sh misc,hostype,network,advanced,user,this_is_install" %(data_config.MOUNTPOINT,MVROOT)
+    cmd = "  chroot %s %s/bin/systemconfig.sh misc, hostype, network, advanced, user, this_is_install" %(data_config.MOUNTPOINT, MVROOT)
     runcmd(cmd)
     logging.info("Running systemconfig in chroot")
-    cmd = "  chroot %s %s/bin/systemconfig.sh advanced" %(data_config.MOUNTPOINT,MVROOT)
+    cmd = "  chroot %s %s/bin/systemconfig.sh advanced" %(data_config.MOUNTPOINT, MVROOT)
     runcmd(cmd)
-    mysqldb("stop",'chroot')
+    mysqldb("stop", 'chroot')
     apply_new_auth()
     kill_dhcp_chroot()
     umount_bind_chroot()
-    cp_and_log("/tmp/mythvantage_install.log",data_config.MOUNTPOINT+"/var/log/mythvantage_install.log")
-    cp_and_log("/tmp/mv_debug.log",data_config.MOUNTPOINT+"/var/log/mv_debug.log")
+    cp_and_log("/tmp/mythvantage_install.log", data_config.MOUNTPOINT+"/var/log/mythvantage_install.log")
+    cp_and_log("/tmp/mv_debug.log", data_config.MOUNTPOINT+"/var/log/mv_debug.log")
     unmount_it()
     msg = "Done"
     update_status(msg)
-    mysqldb("start",'')
+    mysqldb("start", '')
 
 
 
@@ -1164,14 +1117,14 @@ def upgrade(hostoptions):
 def main(argv):
     global hostoptions
     try:
-        opts, args = getopt.getopt(argv, 'c:h' , ["help", "rootdisk=", "rootfs=" , "rootsize=" , "datafs=" , "datasize=", "datadisk=" , "swapsize=" , "datapartition=" ] )
-    except getopt.GetoptError,why:
+        opts,  args = getopt.getopt(argv,  'c:h',  ["help",  "rootdisk=",  "rootfs=",  "rootsize=",  "datafs=",  "datasize=",  "datadisk=",  "swapsize=",  "datapartition=" ] )
+    except getopt.GetoptError, why:
         print why
         usage()
         sys.exit(2)
     hostoptions = {"op": 'null'}
-    for opt, arg in opts:
-        if opt in ("-h", "--help"):
+    for opt,  arg in opts:
+        if opt in ("-h",  "--help"):
             usage()
             sys.exit(0)
         elif opt in ( "--rootdisk"):
@@ -1193,9 +1146,9 @@ def main(argv):
             hostoptions["swapsize"]  = arg
 
         elif opt in ("-c"):
-            validop = ["full_install","upgrade","netboot","find_upgrade"]
+            validop = ["full_install", "upgrade", "netboot", "find_upgrade"]
             if arg not in validop:
-                logging.critical("-c %s is not a valid option",arg)
+                logging.critical("-c %s is not a valid option", arg)
                 sys.exit(2)
             else:
                 hostoptions["op"]  = arg
@@ -1243,7 +1196,7 @@ logging.getLogger('').addHandler(console)
 
 #infoformatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
 infoformatter = logging.Formatter("%(message)s")
-infofile = logging.FileHandler(LOG_FILENAME,'w')
+infofile = logging.FileHandler(LOG_FILENAME, 'w')
 infofile.setFormatter(infoformatter)
 infofile.setLevel(logging.INFO)
 logging.getLogger('').addHandler(infofile)
@@ -1255,20 +1208,20 @@ file_name = "/etc/systemconfig"
 try:
     config_file = open(file_name)
 except:
-    logging.debug("%s could not be opened",file_name)
-    config_file=''
+    logging.debug("%s could not be opened", file_name)
+    config_file = ''
 
 for line in config_file:
     line = line.strip()
     if line and line[0] is not "#" and line[-1] is not "=":
-        var,val = line.rsplit("=",1)
+        var, val = line.rsplit("=", 1)
         val = val.strip('"')
         systemconfig[var.strip()] = val.strip()
 
 
 if __name__ == "__main__":
     config_file = "mv_config"
-    data_config = __import__(config_file, globals(), locals(), [])
+    data_config = __import__(config_file,  globals(),  locals(),  [])
     logging.debug("___________START OF DEBUG_________________________")
     cmdoptions = main(sys.argv[1:])
     logging.debug("______cmd line options______")
-- 
cgit v0.12


From bfaf9249b90f35129cfc614b1086d27eb10aa29a Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Sun, 31 May 2009 21:11:43 -0500
Subject: Linhes-config: systemconfig.py and hostype.py

---
 abs/core-testing/LinHES-config/hostype.py      |  6 ++
 abs/core-testing/LinHES-config/systemconfig.py | 88 ++++++++++++++++++++++++++
 2 files changed, 94 insertions(+)
 create mode 100644 abs/core-testing/LinHES-config/hostype.py
 create mode 100755 abs/core-testing/LinHES-config/systemconfig.py

diff --git a/abs/core-testing/LinHES-config/hostype.py b/abs/core-testing/LinHES-config/hostype.py
new file mode 100644
index 0000000..928c038
--- /dev/null
+++ b/abs/core-testing/LinHES-config/hostype.py
@@ -0,0 +1,6 @@
+# -*- coding: utf-8 -*-
+import logging
+
+def hostypeprint(systemconfig):
+    print "hostran"
+    print systemconfig["Hostipeth0"]
\ No newline at end of file
diff --git a/abs/core-testing/LinHES-config/systemconfig.py b/abs/core-testing/LinHES-config/systemconfig.py
new file mode 100755
index 0000000..88961f6
--- /dev/null
+++ b/abs/core-testing/LinHES-config/systemconfig.py
@@ -0,0 +1,88 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+import sys,  os,  commands,  glob,  time
+import getopt,  re,  MySQLdb
+import logging
+import hostype
+
+#____________________________________________setup the logging______________________________________________________
+LOG_FILENAME = '/tmp/systemconfig.log'
+DEBUGLOG = '/tmp/systemconfig_debug.log'
+logging.basicConfig(level=logging.DEBUG,
+                    format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
+                    datefmt='%m-%d %H:%M',
+                    filename=DEBUGLOG,
+                    filemode='a')
+# define a Handler which writes INFO messages or higher to the sys.stderr
+console = logging.StreamHandler()
+console.setLevel(logging.DEBUG)
+# set a format which is simpler for console use
+#formatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s')
+formatter = logging.Formatter("%(message)s")
+# tell the handler to use this format
+console.setFormatter(formatter)
+# add the handler to the root logger
+logging.getLogger('').addHandler(console)
+
+#infoformatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
+infoformatter = logging.Formatter("%(message)s")
+infofile = logging.FileHandler(LOG_FILENAME, 'w')
+infofile.setFormatter(infoformatter)
+infofile.setLevel(logging.INFO)
+logging.getLogger('').addHandler(infofile)
+
+
+def usage():
+    logging.info("tell people how to use this")
+
+def main(argv):
+    global cmdmodule
+    try:
+        opts,  args = getopt.getopt(argv,  'c:hm:',  ["help","modules" ] )
+    except getopt.GetoptError, why:
+        print why
+        usage()
+        print "exception haappen"
+        sys.exit(2)
+    cmdmodule = {"op": 'null'}
+    for opt,  arg in opts:
+        if opt in ("-h",  "--help"):
+            usage()
+            sys.exit(0)
+        elif opt in ("-m"):
+            for i in arg.split(","):
+                cmdmodule[i]=True
+
+    if cmdmodule["hostype"]:
+        hostype.hostypeprint(systemconfig)
+
+
+if __name__ == "__main__":
+    config_file = "mv_config"
+    data_config = __import__(config_file,  globals(),  locals(),  [])
+    #Read in systemconfig
+    global systemconfig
+    systemconfig = {}
+    file_name = "/etc/systemconfig"
+    try:
+        config_file = open(file_name)
+    except:
+        logging.critical("%s could not be opened", file_name)
+        sys.exit(1)
+
+    for line in config_file:
+        line = line.strip()
+        if line and line[0] is not "#" and line[-1] is not "=":
+            var, val = line.rsplit("=", 1)
+            val = val.strip('"')
+            systemconfig[var.strip()] = val.strip()
+
+    logging.debug("______START OF DEBUG______")
+    main(sys.argv[1:])
+    logging.debug("______cmd line options______")
+    for i in cmdmodule.items():
+        logging.debug (i)
+    logging.debug("______systemconfig______")
+    for i in systemconfig.items():
+        logging.debug(i)
+    pass
-- 
cgit v0.12


From 45e93081254e4ff4a8da05b82e79e0645a40bcad Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Sun, 31 May 2009 21:12:28 -0500
Subject: Adding pyc to the git ignore file

---
 .gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitignore b/.gitignore
index 30bd13f..6815683 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,3 +15,4 @@ pkg
 mythbeselect.bin
 mythinstall.bin
 srclinks.*
+*.pyc
-- 
cgit v0.12


From 0275dd9b652a2bc4cce6011c49ee5a1595bb8fd0 Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Sun, 31 May 2009 22:31:49 -0500
Subject: LinHES-config:  adding more python modules. Most things are not
 python, but network.sh is still used by install.

---
 abs/core-testing/LinHES-config/hostype.py        | 147 +++++++++-
 abs/core-testing/LinHES-config/ir.py             |  41 +++
 abs/core-testing/LinHES-config/mv_advanced.py    | 352 +++++++++++++++++++++++
 abs/core-testing/LinHES-config/mv_common.py      |  94 ++++++
 abs/core-testing/LinHES-config/mv_config.py      |   1 +
 abs/core-testing/LinHES-config/mv_ir.py          | 288 +++++++++++++++++++
 abs/core-testing/LinHES-config/mv_misc.py        | 167 +++++++++++
 abs/core-testing/LinHES-config/mv_network.py     | 277 ++++++++++++++++++
 abs/core-testing/LinHES-config/mv_screensaver.py | 199 +++++++++++++
 abs/core-testing/LinHES-config/mv_software.py    |  41 +++
 abs/core-testing/LinHES-config/mv_webuser.py     |  19 ++
 abs/core-testing/LinHES-config/systemconfig.py   | 116 +++++++-
 abs/core-testing/LinHES-config/webuser.py        |  23 ++
 13 files changed, 1748 insertions(+), 17 deletions(-)
 create mode 100644 abs/core-testing/LinHES-config/ir.py
 create mode 100644 abs/core-testing/LinHES-config/mv_advanced.py
 create mode 100644 abs/core-testing/LinHES-config/mv_common.py
 create mode 100644 abs/core-testing/LinHES-config/mv_ir.py
 create mode 100644 abs/core-testing/LinHES-config/mv_misc.py
 create mode 100644 abs/core-testing/LinHES-config/mv_network.py
 create mode 100644 abs/core-testing/LinHES-config/mv_screensaver.py
 create mode 100644 abs/core-testing/LinHES-config/mv_software.py
 create mode 100644 abs/core-testing/LinHES-config/mv_webuser.py
 create mode 100644 abs/core-testing/LinHES-config/webuser.py

diff --git a/abs/core-testing/LinHES-config/hostype.py b/abs/core-testing/LinHES-config/hostype.py
index 928c038..4dde3dc 100644
--- a/abs/core-testing/LinHES-config/hostype.py
+++ b/abs/core-testing/LinHES-config/hostype.py
@@ -1,6 +1,147 @@
 # -*- coding: utf-8 -*-
-import logging
+import logging, mv_common
+import os
+
+config_file = "mv_config"
+data_config = __import__(config_file, globals(), locals(), [])
+
+def setup_ntp(usepool,ntpserver):
+    if usepool:
+        logging.info("Setting ntp server to %s",ntpserver)
+        print '''sed -i "s/pool.ntp.org/$dbhost/g" ${BASE}/etc/ntp.conf'''
+    else:
+        logging.info("Not changing ntp configuration")
+
+def setup_avahi(templates):
+    file="/etc/avahi/services/mysql.service"
+    if not os.path.exists(file):
+        logging.debug("    copying in mysql.service for avahi")
+        try:
+            os.makedirs("/etc/avahi/services")
+        except:
+            logging.debug("    Couldn't create /etc/avahi/services")
+        mv_common.cp_and_log(template+"/mysql.service",file)
+        cmd="sudo sv restart avahi"
+        mv_common.runcmd(cmd)
+
+def remove_avahi_service():
+    file="/etc/avahi/services/mysql.service"
+    if os.path.exists(file):
+        logging.debug("    Removing avahi mysql.service file")
+        cmd="rm -rf %s" %file
+        runcmd(cmd)
+        cmd="sudo sv restart avahi"
+        mv_common.runcmd(cmd)
+
+def setup_db():
+    logging.debug("    Setting up the database")
+
+def setup_mysqlnetwork():
+    logging.debug("    Setting up mysql network")
+
+def setup_mysql():
+    logging.debug("    Configuring mysql")
+
+def setup_func_key():
+    if data_config.SYSTEMTYPE == "MythVantage":
+        logging.debug("    Grabbing the key for Func")
+        cmd="/usr/MythVantage/bin/grabkey.py"
+        mv_common.runcmd(cmd)
+
+def setup_func_minion(dbhost):
+    logging.info("    Setting up the func minion:")
+    logging.debug("   certmaster is %s:",dbhost)
+    cmd='''sed -i "s/^certmaster.*$/certmaster = %s/" /etc/func/minion.conf ''' %dbhost
+    mv_common.runcmd(cmd)
+
+def setup_syslog(dbhost):
+    logging.debug("    Setting syslog to log to %s",dbhost)
+    cmd ='''sed -i "s/^destination d_remote.*$/destination d_remote \{tcp\(\"%s\" port\(514\)\) \;\} \;/" /etc/syslog-ng.conf''' %dbhost
+    return
 
 def hostypeprint(systemconfig):
-    print "hostran"
-    print systemconfig["Hostipeth0"]
\ No newline at end of file
+    logging.debug("______Start of hostype config_____")
+    mv_common.services(systemconfig)
+    install_list=''
+    remove_list=''
+    daemon_list=''
+    daemon_remove_list=''
+
+    if systemconfig["SystemType"] == "Standalone":
+        logging.info("Stand alone system being configured")
+        setup_ntp(False,"null")
+        remove_avahi_service()
+        if systemconfig["hostypec"]:
+            setup_db()
+        install_list=("mysql", "mythdb-initial", "avahi", "portmap", "nfs-utils", "local-website", "myth2ipod", "mythtv-status")
+        daemon_list=("mysql", "mythbackend", "avahi", "portmap", "nfs-utils", "netfs", "lighttpd")
+
+    elif systemconfig["SystemType"] == "Master_backend":
+        logging.info("Master backend system being configured")
+        setup_ntp(False,"null")
+        setup_avahi(systemconfig["TEMPLATES"])
+        install_list=("mysql", "mythdb-initial", "avahi", "portmap", "nfs-utils", "local-website", "myth2ipod", "mythtv-status")
+        daemon_list=("mysql", "mythbackend", "avahi", "portmap", "nfs-utils", "netfs", "lighttpd")
+        if data_config.SYSTEMTYPE == "MythVantage":
+            install_list.append('func')
+            install_list.append('certmaster')
+            daemon_list.append('certmaster')
+
+    elif systemconfig["SystemType"] == "Slave_backend":
+        logging.info("Slave backend  system being configured")
+        setup_ntp(True,systemconfig["dbhost"])
+        remove_avahi_service()
+        if systemconfig["hostypec"]:
+            setup_db()
+        install_list=("portmap", "nfs-utils", "local-website", "avahi", 'libmysqlclient')
+        daemon_list=("mythbackend", "portmap", "nfs-utils", "netfs", "lighttpd", "avahi")
+        daemon_remove_list=('mysql')
+        if data_config.SYSTEMTYPE == "MythVantage":
+            install_list.remove("local-website")
+            daemon_list.remove("lighttpd")
+            install_list.append('func')
+            daemon_list.append('funcd')
+            remove_list.append("lighttpd")
+
+
+    elif systemconfig["SystemType"] == "Frontend_only":
+        logging.info("Frontend only system being configured")
+        setup_ntp(True,systemconfig["dbhost"])
+        remove_avahi_service()
+        install_list=("mysql-clients", "libmysqlclient",  "avahi", "portmap", "nfs-utils", "local-website")
+        remove_list=("mysql")
+        daemon_list=("mysql", "mythbackend", "avahi", "portmap", "nfs-utils", "netfs", "lighttpd")
+        daemon_remove_list=("mysql", "mythbackend")
+        if data_config.SYSTEMTYPE == "MythVantage":
+            install_list.remove("local-website")
+            daemon_list.remove("lighttpd")
+            install_list.append('func')
+            daemon_list.append('funcd')
+            remove_list.append("lighttpd")
+
+
+
+    for pkg in install_list:
+        mv_common.pacinstall(pkg)
+    for pkg in remove_list:
+        mv_common.pacinstall(pkg)
+    for daemon in daemon_list:
+        mv_common.add_service(daemon)
+    for daemon in daemon_remove_list:
+        mv_common.remove_service(daemon)
+    if systemconfig["RunFrontend"] == "1":
+        logging.debug("   Will run the frontend")
+        mv_common.add_service("frontend")
+        mv_common.add_service("hal")
+    else:
+        logging.debug("   Will NOT run the frontend")
+        mv_common.remove_service("frontend")
+        mv_common.remove_service("hal")
+
+    setup_mysqlnetwork()
+    setup_mysql()
+    if data_config.SYSTEMTYPE == "MythVantage":
+        setup_func_minion(dbhost)
+        setup_func_key()
+        setup_syslog(systemconfig["dbhost"])
+    logging.debug("__End of hostype config")
diff --git a/abs/core-testing/LinHES-config/ir.py b/abs/core-testing/LinHES-config/ir.py
new file mode 100644
index 0000000..a6723ce
--- /dev/null
+++ b/abs/core-testing/LinHES-config/ir.py
@@ -0,0 +1,41 @@
+# -*- coding: utf-8 -*-
+import logging, mv_common
+import os, re
+
+def setup_ir(systemconfig, data_config):
+    logging.info("____Start of Software install____")
+    default_disabled = ("mythphone", "mytharchive", "mythbrowser", "mythnews",
+                        "mythgame", "mythflix", "mythweather",
+                        "mythappletrailers", "mythstream", "mythvodka")
+
+    default_installed=("mythcontrols", "mythgallery", "mythmovies",
+                        "mythmusic", "mythsmolt", "mythvideo")
+    other_pkg=("miro", "xe", "romdb", "xine", "dvdcss", "webmin")
+
+    for pkg in default_disabled:
+        try:
+            if systemconfig[pkg] == "1":
+                mv_common.pacinstall(pkg)
+            else:
+                mv_common.pacremove(pkg)
+        except:
+            logging.debug("  ERROR-- %s is not defined", pkg)
+
+    for pkg in default_installed:
+        try:
+            if systemconfig[pkg] == "0":
+                mv_common.pacremove(pkg)
+            else:
+                mv_common.pacinstall(pkg)
+        except:
+            logging.debug("  ERROR-- %s is not defined", pkg)
+
+    for pkg in other_pkg:
+        try:
+            if systemconfig[pkg] == "1":
+                mv_common.pacinstall(pkg)
+            elif systemconfig[pkg] == "0":
+                mv_common.pacremove(pkg)
+        except:
+            logging.debug("   ERROR-- %s is not defined", pkg)
+    logging.info("__End Software ")
\ No newline at end of file
diff --git a/abs/core-testing/LinHES-config/mv_advanced.py b/abs/core-testing/LinHES-config/mv_advanced.py
new file mode 100644
index 0000000..67692a4
--- /dev/null
+++ b/abs/core-testing/LinHES-config/mv_advanced.py
@@ -0,0 +1,352 @@
+# -*- coding: utf-8 -*-
+import logging, os, re
+import mv_common
+
+def setup_pacman(create_link):
+    if create_link:
+        logging.info("    Creating pacman link")
+        logging.info("    LOOK")
+    else:
+        logging.info("    Pacman link will not be created")
+    return
+
+def setup_ncid_client(dbhost,templatefile):
+    #This always runs
+    logging.debug("    Configuring ncid client with server %s",dbhost)
+    cmd = '''sed -e "s/^set Host.*$/set Host %s /" %s >/etc/ncid/ncid.conf''' %(dbhost, templatefile)
+    return
+
+def setup_ncid_daemon(port,templatefile,Runncidd):
+    logging.info("    Configuring callerid daemon")
+    if Runncidd == "1":
+        logging.debug("    Port: %s",port)
+        mv_common.cp_and_log("/etc/ncid/ncidd.conf",templatefile)
+        cmd = '''sed -e "s/.*set ttyport.*$/set ttyport =  \/dev\/%s /" %s >/etc/ncid/ncidd.conf''' %(port,templatefile)
+        mv_common.runcmd(cmd)
+        mv_common.pacinstall("ncidd")
+        mv_common.add_service("ncidd")
+    else:
+        logging.debug("    Callerid will not run")
+        mv_common.pacremove("ncidd")
+        mv_common.remove_service("ncidd")
+    return
+
+def setup_splash(Usebootsplash):
+    if Usebootsplash == "1":
+        logging.info("    Enabling splash")
+        cmd = ''' sed -i "s/^default.*0/default 1/g" /boot/grub/menu.lst'''
+        mv_common.runcmd(cmd)
+    else:
+        logging.info("    Disabling splash")
+        cmd = ''' sed -i "s/^default.*1/default 0/g" /boot/grub/menu.lst'''
+        mv_common.runcmd(cmd)
+    return
+
+def setup_hobbit(UseHobbit,SystemType,dbhost):
+    if UseHobbit == "1":
+        if SystemType == "Standalone" or SystemType == "Master_backend":
+            logging.info("    Installing hobbit server")
+            mv_common.pacinstall("hobbitserver")
+            mv_common.add_service("hobbit")
+        else:
+            logging.info("    Installing hobbit client")
+            mv_common.pacinstall("hobbit-client")
+            setup_hobbit_client(dbhost)
+            mv_common.add_service("hobbit-client")
+
+    else:
+            logging.info("    Removing Hobbit")
+            mv_common.pacremove("hobbit")
+            mv_common.pacremove("hobbit-client")
+            mv_common.remove_service("hobbit-client")
+            mv_common.remove_service("hobbitserver")
+            cmd = "rm -f /data/srv/httpd/htdocs/hobbit/index.html"
+            mv_common.runcmd(cmd)
+    return
+
+def setup_hobbit_client(dbhost):
+    logging.info("    Configuring hobbit client")
+    logging.debug("   hobbit server is %s:", dbhost)
+    cmd='''sed -i "s/^BBDISP.*$/BBDISP=%s/g" /data/srv/hobbit/client/etc/hobbitclient.cfg ''' %dbhost
+    mv_common.runcmd(cmd)
+    return
+
+def setup_evrouter(UseEvrouter,EvrouterConfig,template):
+    if UseEvrouter == "1":
+        logging.info("    Configuring everouter")
+        logging.debug("    EvrouterConfig is %s:",EvrouterConfig)
+        if EvrouterConfig == "tinker":
+            logging.debug("    tinker mode, not changing the config")
+            return
+        mv_common.pacinstall("evrouter")
+        mv_common.pacinstall("Xvfb")
+        mv_common.cp_and_log(template+EvrouterConfig,"/etc/evrouter.cfg")
+        mv_common.add_service("evrouter")
+        mv_common.add_service("Xvfb")
+    else:
+        logging.info("    Not using evrouter")
+        mv_common.pacremove("evrouter")
+        mv_common.remove_service("evrouter")
+        mv_common.remove_service("Xvfb")
+
+    return
+
+def setup_DNSmasq(RunDHCP,ip,gw,nameserver):
+    if RunDHCP == "1":
+        logging.info("    Configuring dhcp server(dnsmasq)")
+        logging.debug("    ip: %s", ip)
+        logging.debug("    gw: %s", gw)
+        logging.debug("    ns: %s", nameserver)
+        mv_common.pacinstall("dnsmasq")
+        mv_common.pacinstall("mvpmc")
+        mv_common.add_service("dnsmasq")
+        logging.debug("    Setting default route to my gw: %s",gw)
+        try:
+            f = open("/etc/dnsmasq.conf",'r')
+            dnsconf = f.readlines()
+            f.close()
+        except:
+                logging.info("   Couldn't open dnsmasq.conf")
+                return
+        for line in dnsconf:
+            outline = line
+            if re.match("^dhcp-option=3",line):
+                logging.debug("    Setting default route to my gw: %s",gw)
+                outline = "dhcp-option=3,%s\n" %gw
+            if re.match("^dhcp-option=6",line):
+                logging.debug("    Setting dns to my ip: %s",ip)
+                outline = "dhcp-option=6,%s\n" %ip
+            f.write(outline)
+        f.close()
+
+        logging.debug("    change nfsroot to my ip:%s",ip)
+        cmd = '''sed -i "s/nfsroot=.*:/nfsroot=%s:/g" /data/srv/tftp/pxelinux.cfg/default''' %ip
+        mv_common.runcmd(cmd)
+
+        logging.debug("    Adding 127.0.0.1 to resolv.conf")
+        logging.debug("    other nameserver is %s",nameserver)
+        try:
+            f = open("/etc/resolv.conf",'r')
+            dns = f.readlines()
+            f.close()
+        except:
+                dns=''
+                logging.debug("   Couldn't open resolv.conf for reading")
+        try:
+            f = open("/etc/resolv.conf",'w')
+            line="search lan\n"
+            f.write(line)
+            line="nameserver 127.0.0.1\n"
+            f.write(line)
+            line="nameserver %s\n" %nameserver
+            f.write(line)
+            for line in dns:
+                f.write(line)
+            f.close()
+        except:
+                logging.debug("   Couldn't open resolv.conf for writing")
+
+        logging.debug("    setup dongle.config")
+        cmd = ''' sed -i "s/mvpmc -f .*/mvpmc -f \/etc\/helvR10.fon -s %s \& /" /data/srv/tftp/dongle.bin.config ''' %ip
+        #COMMAND="%s/mvpmc -f .*/mvpmc -f \/etc\/helvR10.fon -s ${ip} \& /"
+        #ex ${BASE}/data/srv/tftp/dongle.bin.config <<EOF
+        mv_common.runcmd(cmd)
+    else:
+        logging.info("    removing dhcp server(dnsmasq)")
+        mv_common.pacremove("dnsmasq")
+        mv_common.pacremove("mvpmc")
+        mv_common.remove_service("dnsmasq")
+    return
+
+def setup_mythweb(UseMythWEB):
+    if UseMythWEB == "1":
+        logging.info("    Activating mythweb")
+        mv_common.pacinstall("lighttpd")
+        mv_common.pacinstall("mythweb")
+        mv_common.add_service("lighttpd")
+    else:
+        logging.info("    Removing mythweb")
+        mv_common.pacremove("lighttpd")
+        mv_common.pacremove("mythweb")
+        mv_common.remove_service("lighttpd")
+    return
+
+def setup_samba(systemconfig,data_config):
+    mythhome = data_config.MYTHHOME
+    if systemconfig["UseSamba"] == "1":
+        logging.info("    Activating windows file sharing")
+        usersamba=mythhome+"/templates/smb.conf"
+        mv_common.pacinstall("samba")
+        if not os.path.exists("/etc/samba"):
+            logging.debug("    Creating directory /etc/samba")
+            try:
+                os.makedirs("/etc/samba")
+            except:
+                pass
+
+        if os.path.exists(usersamba):
+            logging.debug("    Using user provided config file %s",usersamba)
+            cmd = "install -D -m755  %s /etc/samba/smb.conf" %usersamba
+            mv_common.runcmd(cmd)
+        else:
+            Samba_media = systemconfig["Samba_media"]
+            Samba_home = systemconfig["Samba_home"]
+            if systemconfig["Samba_mediareadonly"] == "1":
+                smreadonly = "yes"
+            else:
+                smreadonly = "no"
+
+            if systemconfig["Samba_homereadonly"] == "1":
+                shreadonly = "yes"
+            else:
+                shreadonly = "no"
+            domain = systemconfig["Samba_domain"]
+            servername = systemconfig["hostname"]
+
+            try:
+                f = open(systemconfig["TEMPLATES"]+"/samba/smb.conf.template",'r')
+                t_smbconf = f.readlines()
+                f.close()
+            except:
+                logging.info("   Couldn't open samba template file")
+                return
+
+            try:
+                f = open("/etc/samba/smb.conf",'w')
+            except:
+                logging.info("   Couldn't open samba file")
+                return
+
+            for line in t_smbconf:
+                outline = line
+                if re.match("^.*workgroup", line):
+                    logging.debug("    Setting workgroup to %s",domain)
+                    outline="workgroup = %s\n" %domain
+                    logging.debug("     %s",outline)
+                if re.match("^.* server string",line):
+                    logging.debug("    Setting server name to %s",servername)
+                    outline="server string = %s\n" %servername
+                    logging.debug("     %s",outline)
+                f.write(outline)
+            outline="include =  %s/templates/user.shares \n" %mythhome
+            f.write(outline)
+            if Samba_media == "1":
+                outline="include =  /etc/samba/smb.conf.media\n"
+                f.write(outline)
+            if Samba_home == "1":
+                outline="include =  /etc/samba/smb.conf.home\n"
+                f.write(outline)
+            f.close()
+            logging.info("    Writing smb.conf.media")
+            try:
+                f = open("/etc/samba/smb.conf.media","w")
+            except:
+                logging.info("    Couldn't open smb.conf.media")
+                return
+            medialines='''
+[%s]
+path = %s
+public = yes
+only guest = yes
+writeable  = %s
+printable = no
+force user = mythtv
+force group = mythtv
+create mask = 0755''' %(data_config.SMEDIA,data_config.DATAMOUNT,smreadonly)
+            f.write(medialines)
+            f.close
+            logging.debug("     %s",medialines)
+            logging.info("    Writing smb.conf.home")
+            try:
+                    f = open("/etc/samba/smb.conf.home","w")
+            except:
+                logging.info("    Couldn't open smb.conf.home")
+                return
+            homelines='''
+[home]
+path = %s
+public = yes
+only guest = yes
+writeable  = %s
+printable = no
+force user = mythtv
+force group = mythtv
+create mask = 0755 ''' %(data_config.MYTHHOME,shreadonly)
+            f.write(homelines)
+            f.close
+            logging.debug("     %s",homelines)
+
+
+        mv_common.add_service("nmbd")
+        mv_common.add_service("smbd")
+    else:
+        logging.info("  Removing windows file sharing")
+        mv_common.remove_service("smbd")
+        mv_common.remove_service("nmbd")
+        mv_common.pacremove("samba")
+        mv_common.pacinstall("smbclient")
+    return
+
+def setup_NFSshares(UseNFS,templatefile):
+    if UseNFS == "1":
+        logging.info("    Activating NFS server")
+        mv_common.pacinstall("nfs-utils")
+        mv_common.pacinstall("portmap")
+        cmd = '''sed -e "s/REPLACEME/*/g" %s  >/etc/exports''' %templatefile
+        mv_common.add_service("nfsd")
+        mv_common.add_service("nfs-utils")
+        mv_common.add_service("portmap")
+    else:
+        logging.info("    Removing NFS server")
+        mv_common.remove_service("nfsd")
+    return
+
+def setup_dyndns(DDnsEnable):
+    if DDnsEnable == "1":
+        logging.info("    Installing Dynamic DNS client")
+        mv_common.pacinstall("inadyn")
+        mv_common.add_service("inadyn")
+    else:
+        logging.info("    Removing Dynamic DNS client")
+        mv_common.pacremove("inadyn")
+        mv_common.remove_service("inadyn")
+
+
+def setup_advanced(systemconfig,data_config):
+    logging.info("____Start of advanced configuration____")
+    create_link = False
+    if systemconfig["SystemType"] == "Master_backend":
+        create_link = True
+    setup_pacman(create_link)
+    setup_ncid_client(systemconfig["dbhost"],
+                      systemconfig["TEMPLATES"]+"/ncid.conf.template")
+
+    setup_ncid_daemon(systemconfig["nciddSerialPort"],
+                      systemconfig["TEMPLATES"]+"/ncidd.conf.template",
+                      systemconfig["Runncidd"])
+
+    setup_splash(systemconfig["Usebootsplash"])
+    if data_config.SYSTEMTYPE == "MythVantage":
+        setup_hobbit(systemconfig["UseHobbit"],
+                    systemconfig["SystemType"],
+                    systemconfig["dbhost"])
+
+    setup_evrouter(systemconfig["UseEvrouter"],
+                   systemconfig["EvrouterConfig"],
+                   systemconfig["TEMPLATES"])
+    systemconfig["mythip"]="192.168.100.myip"
+    systemconfig["mythgw"]="192.168.100.mygw"
+    systemconfig["mythdns"]="192.168.100.100"
+
+    setup_DNSmasq(systemconfig["RunDHCP"],
+                  systemconfig["mythip"],
+                  systemconfig["mythgw"],
+                  systemconfig["mythdns"])
+
+    setup_mythweb(systemconfig["UseMythWEB"])
+    setup_samba(systemconfig,data_config)
+    setup_NFSshares(systemconfig["UseNFS"],
+                systemconfig["TEMPLATES"]+"/exports.template")
+
+    setup_dyndns(systemconfig["DDnsEnable"])
+
diff --git a/abs/core-testing/LinHES-config/mv_common.py b/abs/core-testing/LinHES-config/mv_common.py
new file mode 100644
index 0000000..3ae7edb
--- /dev/null
+++ b/abs/core-testing/LinHES-config/mv_common.py
@@ -0,0 +1,94 @@
+# -*- coding: utf-8 -*-
+import logging, os
+import commands
+config_file = "mv_config"
+data_config = __import__(config_file, globals(), locals(), [])
+
+def runcmd(cmd):
+    if data_config.NOOPDEBUG=="FALSE":
+        pass
+    else:
+        cmd = "echo "+cmd
+    logging.debug("    %s",cmd)
+    cmdout = commands.getoutput(cmd)
+    logging.debug("    %s",cmdout)
+    return cmdout
+
+
+def services(systemconfig):
+    logging.debug("______Start of services______")
+    logging.debug("__End services")
+
+def cp_and_log(srcfile,destfile):
+    #return
+    if not os.path.exists(srcfile):
+        logging.info("%s is not present, skipping...",srcfile)
+    else:
+        cmd = ("rsync -arhp %s %s") %(srcfile,destfile)
+        runcmd(cmd)
+
+
+def add_service(daemon):
+    logging.info("    Adding service %s",daemon)
+
+def remove_service(daemon):
+    logging.info("    Removing service %s",daemon)
+
+def pacinstall(pkg):
+    logging.info("    Installing %s",pkg)
+    #extra pkg check
+    if pkg == "xine":
+        pacinstall("xine-ui")
+    elif pkg == "dvdcss":
+        pacinstall("libdvdcss")
+    elif pkg == "webmin":
+        add_service("webmin")
+
+def pacremove(pkg):
+    logging.info("    Removing %s",pkg)
+    if pkg == "xine":
+        pacremove("xine-ui")
+    elif pkg == "dvdcss":
+        pacremove("libdvdcss")
+    elif pkg == "webmin":
+        remove_service("webmin")
+
+
+def reloadfe():
+    logging.info("    Reloading frontend")
+    logging.info("    LOOK Reloading frontend")
+    #function reloadfe(){
+    #PID=`ps -ef |grep mythfrontend|grep -v grep |awk  '{print $2 }'`
+    #/usr/bin/backend_control.sh  clearcache  behost $dbhost
+    #if [ x$RESTART_LCD = xtrue ]
+    #then
+        #killall -9 mythlcdserver
+    #fi
+    #if [  x = x$PID ]
+    #then
+        #echo "Mythfrontend not running, will not reload"
+    #else
+            #kill -s USR1 $PID
+    #fi
+    return
+
+def restartfe():
+    logging.info("    Restarting frontend")
+    cmd="killall -9 mythfrontend"
+    runcmd(cmd)
+    cmd="killall -9 welcome"
+    runcmd(cmd)
+    return
+
+def udev_trigger():
+    logging.info("    Triggering udev")
+    cmd = "udevadm settle"
+    runcmd(cmd)
+    cmd = "udevadm trigger"
+    runcmd(cmd)
+    cmd = "udevadm settle"
+    runcmd(cmd)
+    cmd = "udevadm trigger"
+    runcmd(cmd)
+
+
diff --git a/abs/core-testing/LinHES-config/mv_config.py b/abs/core-testing/LinHES-config/mv_config.py
index 969e12d..d5a247d 100755
--- a/abs/core-testing/LinHES-config/mv_config.py
+++ b/abs/core-testing/LinHES-config/mv_config.py
@@ -10,6 +10,7 @@ NOOPDEBUG="FALSE"
 BACKUPFILE="mythconverg.sql.gz"
 BACKUPPATH="/myth/backup/"
 TEMP_TEMPLATES="/tmp/templates"
+SMEDIA="/myth"
 
 
 
diff --git a/abs/core-testing/LinHES-config/mv_ir.py b/abs/core-testing/LinHES-config/mv_ir.py
new file mode 100644
index 0000000..cbc18a2
--- /dev/null
+++ b/abs/core-testing/LinHES-config/mv_ir.py
@@ -0,0 +1,288 @@
+# -*- coding: utf-8 -*-
+import logging, mv_common
+import os, re , glob
+from time import time, localtime, strftime
+import time
+
+def setup_lirc_links(mythhome):
+    logging.debug("    Creating links for lirc")
+    if not os.path.exists(mythhome+"/.mythtv"):
+        logging.debug("    Creating %s/.mythtv",mythhome)
+        try:
+            os.mkdir(mythhome+"/.mythtv")
+        except:
+            logging.debug("   Couldn't create .mythtv ")
+            return
+        os.chown(mythhome+"/.mythtv","mythtv","mythtv")
+
+    if not os.path.exists(mythhome+"/.mythtv/lircrc"):
+        logging.debug("    Creating symlink for myth lircrc")
+        os.symlink("/etc/lircrc",mythhome+"/.mythtv/lircrc")
+    else:
+        logging.debug("    %s/lircrc already present",mythhome)
+
+    if not os.path.exists(mythhome+"/.lircrc"):
+        logging.debug("    Creating symlink for lircrc")
+        os.symlink("/etc/lircrc",mythhome+"/.lircrc")
+    else:
+        logging.debug("    %s/.lircrc already present",mythhome)
+
+def scrub_modules(filename,module):
+    logging.debug("    scrubbing %s from %s",module,filename)
+    cmd = '''sed -i -e '/.*#%s/d' %s''' %(module,filename)
+    mv_common.runcmd(cmd)
+
+def add_module(filename,module):
+    logging.debug("    adding  %s to %s",module,filename)
+    cmd = ''' echo %s >> %s ''' %(module,filename)
+    mv_common.runcmd(cmd)
+
+def unload_all_lirc():
+    logging.debug("    Unloading all lirc modules")
+    cmd = "sv stop lircd"
+    mv_common.runcmd(cmd)
+    cmd = "killall -9 lircd"
+    mv_common.runcmd(cmd)
+    cmd = '''modprobe -r $(lsmod |grep ^lirc |awk '{print $1}') '''
+    mv_common.runcmd(cmd)
+
+
+
+def include_file( incfile,filename):
+    logging.debug("     including %s within %s",filename,incfile)
+    try:
+        f = open( incfile, 'a')
+    except:
+        logging.debug("    Couldn't open %s for writing",incfile)
+        return
+    line = '''include "%s" ''' %filename
+    logging.debug("   %s",line)
+    f.write(line)
+    f.write("\n")
+    f.close()
+
+def setup_ir_remote(Remotetype,templates):
+    logging.debug("    Setup of remote type %s",Remotetype)
+    if Remotetype == "no_remote":
+        mv_common.remove_service(lircd)
+    elif Remotetype == "tinker":
+        pass
+    else:
+        currenttime = strftime("%b-%d-%Y-%H:%M:%S", localtime())
+        cmd = "mv /etc/lircd.conf /etc/lircd.conf-%s" %currenttime
+        mv_common.runcmd(cmd)
+        cmd = "mv /etc/lircrc /etc/lircrc-%s" %currenttime
+        mv_common.runcmd(cmd)
+        files = templates + "/remotes/" + Remotetype + "/lircd*"
+        logging.debug("    Using %s",files)
+        for filename in glob.glob(files):
+            # Ignore subfolders
+            if os.path.isdir (filename):
+                logging.debug("    %s is a dir, skipping",filename)
+                continue
+            include_file("/etc/lircd.conf",filename)
+        files = templates + "/remotes/" + Remotetype + "/lircrc*"
+        logging.debug("    Using %s",files)
+        for filename in glob.glob(files):
+            # Ignore subfolders
+            if os.path.isdir (filename):
+                logging.debug("    %s is a dir, skipping",filename)
+                continue
+            include_file("/etc/lircrc",filename)
+        cmd =  "chmod 755 /etc/lircrc"
+        mv_common.runcmd(cmd)
+        mv_common.add_service("lircd")
+
+
+def setup_ir_receiver(ReceiverType,TEMPLATES):
+    logging.info("    Configuring receiver %s", ReceiverType)
+    if ReceiverType == "Serial":
+        scrub_modules("/etc/modules.mythvantage","lirc")
+        add_module("/etc/modules/.mythvantage","lirc_serial    #lirc")
+        cmd = "load-modules-mythvantage.sh"
+        mv_common.runcmd(cmd)
+        mv_common.remove_service("igdaemon")
+        mv_common.remove_service("tatir")
+
+    elif ReceiverType == "Usb-imon":
+        scrub_modules("/etc/modules.mythvantage","lirc")
+        add_module("/etc/modules/.mythvantage","lirc_imon    #lirc")
+        cmd = "load-modules-mythvantage.sh"
+        mv_common.runcmd(cmd)
+        mv_common.remove_service("igdaemon")
+        mv_common.remove_service("tatir")
+
+    elif ReceiverType == "Hauppauge":
+        scrub_modules("/etc/modules.mythvantage","lirc")
+        add_module("/etc/modules/.mythvantage","lirc_i2c    #lirc")
+        mv_common.cp_and_log(TEMPLATES+"/modules/lirc_i2c.conf" ,
+                             "/etc/modprobe.d/lirc_i2c.conf")
+        cmd = "rmmod lirc_i2c"
+        mv_common.runcmd(cmd)
+        cmd = "load-modules-mythvantage.sh"
+        mv_common.runcmd(cmd)
+        mv_common.remove_service("igdaemon")
+        mv_common.remove_service("tatir")
+
+    elif ReceiverType == "iguanaIR-usb":
+        scrub_modules("/etc/modules.mythvantage","lirc")
+        mv_common.add_service("igdaemon")
+        mv_common.remove_service("tatir")
+
+    elif ReceiverType == "tatir":
+        scrub_modules("/etc/modules.mythvantage","lirc")
+        mv_common.add_service("tatir")
+        mv_common.remove_service("igdaemon")
+
+    else:
+        logging.debug("    didn't match receiver, using genric case")
+        scrub_modules("/etc/modules.mythvantage","lirc")
+        mv_common.remove_service("igdaemon")
+        mv_common.remove_service("tatir")
+
+def setup_blaster_proto(HostBlasterType,Hostnumblaster,TEMPLATES,systemconfig):
+    logging.debug("    Start of setup_blaster_proto")
+    logging.debug("    HostBlasterType: %s", HostBlasterType)
+    logging.debug("    Hostnumblaster: %s" , Hostnumblaster)
+    if not HostBlasterType == "pvr150" and not HostBlasterType == "None":
+        for i in range(int(Hostnumblaster)):
+            try:
+                proto = systemconfig["HostTransmitproto_"+str(i+1)]
+                logging.debug("    proto: %s",proto)
+            except:
+               logging.info("    unkown proto for %s",i+1)
+               continue
+            template=TEMPLATES+"/transmit/%s/lircd.conf" %proto
+            if os.path.exists(template):
+                logging.debug("    include blaster template: %s",proto)
+                include_file("/etc/lircd.conf",template)
+            else:
+                logging.debug("    template: %s is not present",template)
+    logging.info("------NEED TO SETUP CHANGE_CHANNEL------")
+
+
+def setup_blaster_transmiter(HostBlasterType):
+    logging.debug("    Start of setup_blaster_transmiter")
+    logging.info("    HostBlasterType : %s", HostBlasterType)
+
+    if  HostBlasterType == "Receiver":
+        logging.info("    Blaster is receiver, skipping module config for Blaster")
+        return
+
+    if HostBlasterType == "no blaster":
+        scrub_modules("/etc/modules.mythvantage","blaster")
+    elif HostBlasterType == "Serial":
+        scrub_modules("/etc/modules.mythvantage","blaster")
+        add_module("/etc/modules/.mythvantage","lirc_serial    #blaster")
+        cmd = "load-modules-mythvantage.sh"
+        mv_common.runcmd(cmd)
+    elif HostBlasterType == "pvr150":
+        scrub_modules("/etc/modules.mythvantage", "blaster")
+        scrub_modules("/etc/modules.mythvantage", "lirc")
+        add_module("/etc/modules/.mythvantage", "lirc_pvr150    #blaster")
+        add_module("/etc/modules/.mythvantage", "lirc_pvr150    #lirc")
+        cmd = "rmmod lirc_i2c"
+        mv_common.runcmd(cmd)
+        cmd = "load-modules-mythvantage.sh"
+        mv_common.runcmd(cmd)
+    else:
+        scrub_modules("/etc/modules.mythvantage","blaster")
+
+def setup_lcd(LCDtype, TEMPLATES, Remotetype):
+    logging.debug("    Start of setup_lcd")
+    logging.debug("    LCDType: %s", LCDtype)
+    logging.debug("    Remotetype: %s", Remotetype)
+    if LCDtype == "tinker":
+        logging.info("   tinker mode detected")
+        return
+
+    if LCDtype == "no_lcd":
+        logging.info("    Disabling LCD support")
+        cmd = "sv stop lcdd"
+        mv_common.runcmd(cmd)
+        #sometimes it doesn't want to die
+        cmd = "killall -9 LCDd"
+        mv_common.runcmd(cmd)
+        cmd = "load-modules-mythvantage.sh  UNLOAD LCD"
+        mv_common.runcmd(cmd)
+        scrub_modules("/etc/modules.mythvantage", "LCD")
+        mv_common.remove_service("lcdd")
+    else:
+        lcdmodule="%s/LCD/%s/modules" %(TEMPLATES,LCDtype)
+        if os.path.exists(lcdmodule):
+            logging.debug("    Adding module for LCD")
+            scrub_modules("/etc/modules.mythvantage", "LCD")
+            cmd = "cat %s >> /etc/modules.mythvantage" %lcdmodule
+        if Remotetype != "tinker":
+            lcdlirc = "%s/LCD/%s" %(TEMPLATES,LCDtype)
+            if os.path.exists(lcdlirc+"/lircrc"):
+                logging.debug("    LCD seems to support lirc")
+                #setup the lirc aspect of the lcd
+                #copied from setup_ir_remote
+                files = lcdlirc+"/lircd*"
+                logging.debug("    Using %s",files)
+                for filename in glob.glob(files):
+                    # Ignore subfolders
+                    if os.path.isdir (filename):
+                        logging.debug("    %s is a dir, skipping",filename)
+                        continue
+                    include_file("/etc/lircd.conf",filename)
+                files = lcdlirc+"/lircrc*"
+                logging.debug("    Using %s",files)
+                for filename in glob.glob(files):
+                    # Ignore subfolders
+                    if os.path.isdir (filename):
+                        logging.debug("    %s is a dir, skipping",filename)
+                        continue
+                    include_file("/etc/lircrc",filename)
+                cmd =  "chmod 755 /etc/lircrc"
+                mv_common.runcmd(cmd)
+
+def setup_ir(systemconfig, data_config):
+    rc = False
+    logging.info("____Start of IR____")
+    if systemconfig["Remotetype"] == "tinker":
+        logging.info("    Tinker mode detected")
+    else:
+        if not systemconfig["HostBlasterType"]:
+            HostBlasterType = "unknown"
+            Hostnumblaster = "0"
+        else:
+            HostBlasterType = systemconfig["HostBlasterType"]
+            Hostnumblaster  = systemconfig["Hostnumblaster"]
+
+        if systemconfig["HostBlasterType"] == "pvr150":
+            remotetype = "hauppauge-blaster"
+            logging.debug("    pvr150 blaster selected, setting remote to hauppauge-blaster")
+        else:
+            remotetype = systemconfig["Remotetype"]
+
+        setup_ir_remote(remotetype,systemconfig["TEMPLATES"])
+        setup_lirc_links(data_config.MYTHHOME)
+
+        if systemconfig["ReceiverType"]:
+            setup_ir_receiver(systemconfig["ReceiverType"],
+                              systemconfig["TEMPLATES"])
+        else:
+            setup_ir_receiver("unknown", systemconfig["TEMPLATES"])
+        unload_all_lirc()
+        setup_blaster_proto(HostBlasterType,
+                            Hostnumblaster,
+                            systemconfig["TEMPLATES"],
+                            systemconfig)
+        setup_blaster_transmiter(HostBlasterType)
+        cmd = "load-modules-mythvantage.sh"
+        mv_common.runcmd(cmd)
+        time.sleep(2)
+        mv_common.udev_trigger()
+        cmd="sv start lircd"
+        mv_common.runcmd(cmd)
+        rc = True
+    if systemconfig["LCDtype"]:
+        setup_lcd(systemconfig["LCDtype"],
+                  systemconfig["TEMPLATES"],
+                  systemconfig["Remotetype"])
+    else:
+        logging.debug("    LCD not defined")
+    logging.info("__End IR ")
+    return rc
\ No newline at end of file
diff --git a/abs/core-testing/LinHES-config/mv_misc.py b/abs/core-testing/LinHES-config/mv_misc.py
new file mode 100644
index 0000000..e792f67
--- /dev/null
+++ b/abs/core-testing/LinHES-config/mv_misc.py
@@ -0,0 +1,167 @@
+# -*- coding: utf-8 -*-
+import logging, mv_common
+import os, re
+from urllib2 import Request, urlopen, URLError, HTTPError
+
+config_file = "mv_config"
+data_config = __import__(config_file, globals(), locals(), [])
+
+def setup_zip(MVROOT,zipcode):
+    logging.debug("____Setting up the zipcode____")
+
+    if zipcode:
+        cmd="%s/bin/restore_default_settings.sh -c ZIP -c %s" %(MVROOT,zipcode)
+        #Let's also speed things up for those in North America
+        #LOOK REVISIT
+        print "mkdir /usr/bin/perlbin/vendor/tv_grabbers_non_na"
+        print "mv  /usr/bin/perlbin/vendor/tv_grab_*  /usr/bin/perlbin/vendor/tv_grabbers_non_na"
+        print "mv  /usr/bin/perlbin/vendor/tv_grabbers_non_na/tv_grab_na*  /usr/bin/perlbin/vendor/"
+    else:
+        logging.debug("    Zipcode is not set")
+
+    logging.debug("__End of zipcode")
+
+def setup_tz(timezone,TEMPLATES):
+    logging.debug("____Setting up the timezone____")
+
+    if not timezone:
+        timezone="unknown"
+    logging.debug("    Setting timezone to %s",timezone)
+    try:
+        logging.debug("    Removeing /etc/localtime")
+        os.remove("/etc/localtime")
+    except:
+        logging.debug("    Couldn't remove /etc/localtime")
+        pass
+
+    srclink="/usr/share/zoneinfo/%s" %timezone
+    logging.debug("    symlinking %s to /etc/localtime",srclink)
+    os.symlink(srclink,"/etc/localtime")
+    print '''sed -e "s~^TIMEZONE=.*$~TIMEZONE=\"${timezone}\"~" ${BASE}/etc/rc.conf > $TEMPLATES/rc.conf'''
+
+    if os.path.exists("/etc/php/php.ini"):
+        logging.debug("Changing timezone for php")
+        print '''sed -i "s/^.*date.timezone.*$/date.timezone=${timezone}/" ${BASE}/etc/php/php.ini'''
+
+    mv_common.cp_and_log(TEMPLATES+"/rc.conf","/etc/rc.conf")
+    logging.debug("__End of timezone")
+
+def setup_nfs(systemconfig):
+    nfslist=[]
+    logging.debug("____Setting up nfs____")
+    scrubnfs(systemconfig["TEMPLATES"])
+
+    if systemconfig["HaveCentralNFS"] == "yes":
+        logging.debug("   Using a Central NFS server")
+        if systemconfig["NFSserver"] == "file:nfsmap":
+        #if it's a file check for it, failure results in downloading attempt from MBE
+            nfsmap_file=data_config.MYTHHOME+"/templates/nfsmap"
+            if not os.path.exists(nfsmap_file):
+                logging.debug("    Couldn't find local %s",nfsmap_file)
+                logging.info("    Trying to download nfsmap from MBE")
+                nfsmap_file = download_nfsmap(systemconfig["dbhost"])
+            nfslist = process_nfsmap_file(nfsmap_file)
+        # if it's an ip  parse ip and download file
+        elif re.search(systemconfig["NFSserver"],":nfsmap"):
+            ip=systemconfig["NFSserver"].split(":")[0]
+            nfsmap_file = download_nfsmap(ip)
+            nfslist = process_nfsmap_file(nfsmap_file)
+        #else treat it as a single mount point
+        else:
+            item = (systemconfig["NFSserver"] , systemconfig["NFSmount"])
+            nfslist.append(item)
+        setup_nfs_fstab(nfslist)
+
+    logging.debug("__End of nfs")
+
+def setup_sleep(systemconfig):
+    logging.debug("____Setting up sleep____")
+    autoshutdown = systemconfig["AutoShutdown"]
+    stime1 = systemconfig["Shutdowntime"]
+    stime2 = systemconfig["Shutdowntime2"]
+    cstime1=''
+
+    if autoshutdown == "1" :
+        if  not stime1 == "-1" :
+            cstime1 = stime1
+            cshutdown = cstime1
+        if  not stime2 == "-1" :
+            if cstime1 :
+                cshutdown = "%s,%s" %(cstime1,stime2)
+            else:
+                cshutdown = stime2
+        logging.debug("    Shutdown time at %s",cshutdown)
+        cmd='''sed -e "s/HOUR/%s/g" %s/cron.template | crontab - -u mythtv''' %(cshutdown,systemconfig["TEMPLATES"])
+        mv_common.runcmd(cmd)
+    else:
+        logging.info("    Shutdown not enabled")
+        cmd='''sed -e "/00 HOUR.*/d" %s/cron.template | crontab - -u mythtv''' %systemconfig["TEMPLATES"]
+        mv_common.runcmd(cmd)
+
+    logging.debug("__End of  sleep")
+
+
+def process_nfsmap_file(mapfile):
+    logging.debug("   processing nfsmap file %s",mapfile)
+    nfslist = []
+    try:
+        f = open(mapfile,"r")
+        for line in f.readlines():
+            if line.startswith("#"):
+                continue
+            item = line.split()
+            if len(item) <= 1 :
+                continue
+            logging.debug("    %s",item)
+            nfslist.append(item)
+    except :
+        logging.debug("Couldn't read file %s, or some other error",mapfile)
+    return nfslist
+
+def scrubnfs(templates):
+    logging.info("    Scrubbing nfs")
+    mv_common.cp_and_log("/etc/fstab",templates+"/fstab.conf.template")
+    #used this sed cmd because it's clean and took me forever to figure out =)
+    cmd='''sed '/^#STARTSCRUB.*$/,/^#ENDSCRUB.*$/d' %s/fstab.conf.template > /etc/fstab''' %templates
+    mv_common.runcmd(cmd)
+
+def download_nfsmap(ip):
+    nfsmap_file="/tmp/nfsmap"
+    myurl="http://%s:1337/templates/nfsmap" %ip
+    req = Request(myurl)
+    try:
+        f = urlopen(req)
+        logging.info("    downloading %s", myurl)
+        local_file = open(nfsmap_file, "w")
+        #Write to our local file
+        local_file.write(f.read())
+        local_file.close()
+    #handle errors
+    except HTTPError, e:
+        logging.info("    File download failed")
+        logging.debug("    %s", myurl)
+        logging.debug("   HTTP Error: %s", e.code)
+    except URLError, e:
+        logging.info("    File download failed")
+        logging.debug("   %s",myurl)
+        logging.debug("   URL Error: %s ", e.reason)
+
+    return nfsmap_file
+
+def setup_nfs_fstab(nfslist):
+    logging.info("   Adding nfs paths to fstab")
+    try:
+        f = open('/etc/fstab', 'a')
+        line = "#STARTSCRUB --------------anything in this block will be scrubbed\n"
+        f.write(line)
+        for s, m in nfslist:
+            line = "%s %s    nfs \n" %(s,m)
+            logging.debug("    %s",line)
+            f.write(line)
+        line = "#ENDSCRUB\n"
+        f.write(line)
+        f.close()
+    except:
+        logging.debug("    Couldn't open /etc/fstab")
+    logging.debug("   Done adding nfs paths to fstab")
+
diff --git a/abs/core-testing/LinHES-config/mv_network.py b/abs/core-testing/LinHES-config/mv_network.py
new file mode 100644
index 0000000..71bc442
--- /dev/null
+++ b/abs/core-testing/LinHES-config/mv_network.py
@@ -0,0 +1,277 @@
+# -*- coding: utf-8 -*-
+import sys , os, commands , glob, time, re
+import logging
+import mv_common
+global etcnetdir
+etcnetdir = "/etc/net/ifaces"
+
+
+def setup_MYTH_IP(systemconfig):
+    default_interface = systemconfig["default_interface"]
+    try:
+        defaultip = systemconfig["Hostip"+default_interface]
+    except:
+        logging.debug("    Error occured finding the defaultip")
+        defaultip = "127.0.0.1"
+    logging.info("    Using %s as default ip", defaultip)
+    return defaultip
+
+def setup_MYTH_DHCP(systemconfig):
+    default_interface = systemconfig["default_interface"]
+    try:
+        defaultdhcp = systemconfig["HostUSEDHCP"+default_interface]
+    except:
+        logging.debug("    Error occured finding default dhcp")
+        defaultdhcp = "0"
+    logging.info("    Using %s as dhcp value for %s", default_interface, defaultdhcp)
+    return defaultdhcp
+
+def flush(netdev):
+    logging.debug("    Flushing %s",netdev)
+    cmd = '''ip address flush dev %s''' %netdev
+    mv_common.runcmd(cmd)
+
+def kill_dhcp(basedir):
+    logging.debug("    _Start of kill_dhcp")
+    logging.debug("    Killing off dhcpd")
+    stddir = os.getcwd()
+    piddir = ("%s/var/run/") %basedir
+    try:
+        os.chdir(piddir)
+        for FILE in glob.glob("dhcpcd-*.pid"):
+            f = open(FILE,'r')
+            pid = f.readline()
+            f.close
+            cmd = "kill -9 %s" %pid
+            mv_common.runcmd(cmd)
+            os.remove(FILE)
+        os.chdir(stddir)
+    except:
+        pass
+
+def setup_nameserver(dns):
+    logging.info("    Adding %s for DNS", dns)
+    logging.info("-----------NEED TO SETUP setup_nameserver")
+    #grep -q $1 ${BASE}/etc/resolv.conf
+    #status=$?
+    #if [ ! $status = 0 ]
+    #then
+        #echo "nameserver $1" >> ${BASE}/etc/resolv.conf
+    #fi
+
+
+def setup_hostname(systemconfig):
+    logging.debug("   _Start of setup_hostname")
+    try:
+        hostname = systemconfig["hostname"]
+    except:
+        logging.info("    Hostname could not be set")
+        logging.info("    Using default value of me")
+        hostname = "me"
+    logging.info("    Setting the hostname to %s", hostname)
+    cmd = "cat /etc/hosts | grep -v 127.0.0.1 | grep -v %s > /tmp/hosts" %hostname
+    mv_common.runcmd(cmd)
+    if systemconfig["mythdhcp"] == "1" :
+        logging.debug("    not using dhcp")
+        cmd = ''' echo 127.0.0.1 localhost  > /etc/hosts '''
+        mv_common.runcmd(cmd)
+        cmd = ''' echo %s %s  > /etc/hosts ''' %(systemconfig["mythip"], systemconfig["hostname"])
+        mv_common.runcmd(cmd)
+    else:
+        cmd = ''' echo 127.0.0.1 %s localhost  > /etc/hosts ''' %systemconfig["hostname"]
+        mv_common.runcmd(cmd)
+    cmd = '''cat /tmp/hosts >> /etc/hosts '''
+    mv_common.runcmd(cmd)
+
+def setup_interface(netdev,systemconfig):
+    logging.debug("    _Start of setup_interface for %s",netdev)
+    nettrans = {'Hostip':'ip',
+                'Hostnetmask':'netmask',
+                'HostActive':'isactive',
+                'HostDNS':'dns',
+                'HostUSEDHCP':'UseDHCP',
+                'HostGW':'GW',
+                'HostMTU':'mtu',
+                'HOST_iswireless':"wireless",
+                'HostESSID':'ESSID',
+                'HostKey':'key',
+                'HostUseEncryption':'ENCRYPT'}
+    netinfo = {}
+    #populate the netinfo dict
+    for netitem in nettrans:
+        if systemconfig[netitem+netdev]:
+            netinfo[nettrans[netitem]] = systemconfig[netitem+netdev]
+        else:
+            netinfo[nettrans[netitem]] = False
+        logging.debug("     %s:%s",netitem,netinfo[nettrans[netitem]])
+    logging.info("    %s wireless: %s", netdev,netinfo["wireless"])
+    try:
+        os.makedirs(etcnetdir)
+    except:
+        logging.debug("   Could not create %s",etcnetdir)
+
+    optionfile=etcnetdir+"/"+netdev+"/options"
+    if not os.path.exists(optionfile):
+        os.makedirs(etcnetdir+"/"+netdev)
+        mv_common.cp_and_log(systemconfig["TEMPLATES"]+"/etcnet/eth/options", optionfile)
+
+    if netinfo["isactive"] == "1" :
+        change_iface_state(netdev,"enabled")
+    else:
+        change_iface_state(netdev,"disabled")
+
+    if netinfo["wireless"] == "1" :
+        logging.info("    Enabling wireless extensions")
+        cmd = ''' sed -i -e 's/^CONFIG_WIRELESS=.*$/CONFIG_WIRLESS=yes/g'  %s/%s/options''' %(etcnetdir,netdev)
+        mv_common.runcmd(cmd)
+        #set the key and essid
+        cmd = '''  echo "essid  %s" > %s/%s/iwconfig ''' %(netinfo["ESSID"], etcnetdir, netdev)
+        mv_common.runcmd(cmd)
+        if netinfo["ENCRYPT"] == "1":
+            logging.info("    Enabling encryption")
+            cmd = '''echo "key %s" >>  %s/%s/iwconfig ''' %(netinfo["KEY"], etcnetdir, netdev)
+            mv_common.runcmd(cmd)
+    else:
+        logging.info("  Disabling wireless extensions")
+        cmd = '''sed -i -e 's/^CONFIG_WIRLESS=.*$/CONFIG_WIRLESS=no/g' %s/%s/options''' %(etcnetdir, netdev)
+        mv_common.runcmd(cmd)
+
+    if netinfo["UseDHCP"] == "0" :
+        logging.info("   Enabling DHCP support")
+        cmd = ''' sed -i -e 's/^BOOTPROTO=.*$/BOOTPROTO=dhcp/g' %s/%s/options''' %(etcnetdir, netdev)
+        mv_common.runcmd(cmd)
+    else:
+        logging.info("   Using static ip address of %s",netinfo["ip"])
+        cmd = ''' sed -i -e 's/^BOOTPROTO=.*$/BOOTPROTO=static/g' %s/%s/options''' %(etcnetdir, netdev)
+        mv_common.runcmd(cmd)
+        cmd = '''echo "default via %s" > %s/%s/ipv4route''' %(netinfo["GW"], etcnetdir, netdev)
+        mv_common.runcmd(cmd)
+        cmd = '''echo "%s%s" > %s/%s/ipv4address ''' %(netinfo["ip"], netinfo["netmask"], etcnetdir, netdev)
+        mv_common.runcmd(cmd)
+        setup_nameserver(netinfo["dns"])
+
+    if netinfo["mtu"] :
+        logging.info("    Setting mtu to %s", netinfo["mtu"])
+        cmd = '''sed -i '/^mtu.*$/d' %s/%s/iplink''' %(etcnetdir,netdev)
+        mv_common.runcmd(cmd)
+        cmd = ''' echo "mtu %s" >> %s/%s/iplink''' %(netinfo["mtu"], etcnetdir,netdev)
+        mv_common.runcmd(cmd)
+    else:
+        logging.info("    Using default mtu value")
+        cmd = '''sed -i '/^mtu.*$/d' %s/%s/iplink''' %(etcnetdir,netdev)
+        mv_common.runcmd(cmd)
+
+
+def change_iface_state(netdev, state):
+    if state == "enabled":
+        logging.info("    Activating %s", netdev)
+        cmd = '''sed -i -e 's/^ONBOOT=.*$/ONBOOT=yes/g' %s/%s/options''' %(etcnetdir,netdev)
+        mv_common.runcmd(cmd)
+        cmd = '''sed -i -e 's/^DISABLED=.*$/DISABLED=no/g' %s/%s/options ''' %(etcnetdir,netdev)
+        mv_common.runcmd(cmd)
+    else:
+        logging.info("    Disabling %s", netdev)
+        cmd = '''sed -i -e 's/^ONBOOT=.*$/ONBOOT=no/g' %s/%s/options''' %(etcnetdir,netdev)
+        mv_common.runcmd(cmd)
+        cmd = '''sed -i -e 's/^DISABLED=.*$/DISABLED=yes/g' %s/%s/options ''' %(etcnetdir,netdev)
+        mv_common.runcmd(cmd)
+        cmd = "/sbin/ifconfig %s down" %netdev
+        mv_common.runcmd(cmd)
+        cmd = "ip address flush %s" %netdev
+        mv_common.runcmd(cmd)
+
+def find_active(systemconfig):
+    interfacelist=('eth0', 'eth1', 'wlan0', 'wlan1')
+    logging.debug("    _Start of find_active")
+    try:
+        os.remove("/etc/resolv.conf")
+    except:
+        logging.debug("    couldn't remove /etc/resolv.conf")
+
+    if systemconfig["mythdhcp"] == "1":
+        cmd = ''' echo search lan > /etc/resolv.conf '''
+        mv_common.runcmd(cmd)
+        cmd = ''' echo nameserver 127.0.0.1 >> /etc/resolv.conf '''
+        mv_common.runcmd(cmd)
+
+    for netdev in interfacelist:
+        currentnet = "HostActive" + netdev
+        try:
+            systemconfig[currentnet]
+        except:
+            logging.debug("    %s is not defined",currentnet)
+            continue
+        if systemconfig[currentnet] == "1" :
+            setup_interface(netdev,systemconfig)
+        else:
+            change_iface_state(netdev, "disabled")
+
+def vnc_netboot_check():
+    logging.debug("    Start of VNC/NETBOOT check")
+    vnc = False
+    netboot = False
+    try:
+        f = open('/proc/cmdline', 'r')
+        bootoptions = f.readlines()
+        f.close()
+    except:
+        logging.debug("    Couldn't open /proc/cmdline")
+        logging.debug("    Assuming it's ok to fiddle with the network")
+        return True
+    bootoptions =  bootoptions[0]
+    if re.match("vnc",bootoptions) != None :
+        logging.debug("    Found VNC option")
+        vnc = True
+    if re.match("nfsroot",bootoptions) != None :
+        logging.debug("    Found netboot option")
+        netboot = True
+
+    return (vnc or netboot)
+
+def start_network():
+    if not vnc_netboot_check():
+        logging.info("    Restarting network")
+        cmd ="/etc/net/scripts/network.init reload"
+        mv_common.runcmd(cmd)
+        cmd ="/etc/net/scripts/network.init reload"
+        mv_common.runcmd(cmd)
+    else:
+        logging.info("    Will not restart network due to netboot/vnc")
+
+
+def stop_network():
+    if not vnc_netboot_check():
+        logging.info("    Stopping network")
+        cmd ="/etc/net/scripts/network.init stop"
+        mv_common.runcmd(cmd)
+        kill_dhcp("")
+        interfacelist=('eth0', 'eth1', 'wlan0', 'wlan1')
+        for i in interfacelist:
+            flush(i)
+    else:
+        logging.info("    Will not stop network due to netboot/vnc")
+    pass
+
+
+
+def setup_network (systemconfig):
+    logging.info("____Start of network____")
+    logging.info("    Setting up the network")
+    setup_hostname(systemconfig)
+    find_active(systemconfig)
+    logging.info("__End of network")
+
+
+
+##this is used by the install process to start the network
+def install_network_setup(systemconfig):
+    logging.info("____Start of network_install____")
+    logging.info("    Setting up the network")
+    #setup_MYTH_vars
+    setup_hostname(systemconfig)
+    stop_network()
+    find_active(systemconfig)
+    start_network()
+    logging.info("__End of network")
+
+
diff --git a/abs/core-testing/LinHES-config/mv_screensaver.py b/abs/core-testing/LinHES-config/mv_screensaver.py
new file mode 100644
index 0000000..eb81792
--- /dev/null
+++ b/abs/core-testing/LinHES-config/mv_screensaver.py
@@ -0,0 +1,199 @@
+# -*- coding: utf-8 -*-
+import logging, mv_common
+import re
+import os
+
+
+def mplayer_saver_check (cmd,templatefile):
+    logging.debug("    Checking for heartbeat command in mplayer.conf")
+    mplayerconf = "/etc/mplayer/mplayer.conf"
+    if not os.path.exists(mplayerconf):
+        logging.debug("    copying in mplayer template file")
+        mv_common.cp_and_log(templatefile, mplayerconf)
+
+    try:
+        f = open(mplayerconf, 'r')
+        mplayerconf_contents = f.readlines()
+        f.close()
+    except:
+        logging.debug("    Couldn't open %s for reading",mplayerconf)
+        mplayerconf_contents = "#\n"
+
+    try:
+        f = open(mplayerconf, 'w')
+    except:
+        logging.debug("    Couldn't open %s for writing",mplayerconf)
+        return
+
+    for line in mplayerconf_contents:
+        if re.match("^.*stop-xscreensaver",line):
+            continue
+        elif re.match("^.*heartbeat-cmd",line):
+            continue
+        else:
+            f.write(line)
+
+    f.write("stop-xscreensaver = 0\n")
+    line='''heartbeat-cmd="%s"\n''' %cmd
+    f.write(line)
+    f.close()
+
+
+def killxscreensaver():
+    logging.info("   Stopping xscreensaver")
+    cmd="xscreensaver-command --exit "
+    mv_common.runcmd(cmd)
+    cmd="killall xscreensaver "
+    mv_common.runcmd(cmd)
+
+def killgscreensaver():
+    logging.info("    Stopping gnome-screensaver")
+    cmd="gnome-screensaver-command --exit "
+    mv_common.runcmd(cmd)
+    cmd="killall gnome-screensaver "
+    mv_common.runcmd(cmd)
+
+
+def setup_x_screensaver(idle,theme,screenconfigfile,templatefile):
+    logging.info("    Configuring X screensaver")
+    killgscreensaver()
+    logging.debug("    Why can't xscreensaver have a nice configuration !")
+
+    if not os.path.exists(screenconfigfile):
+        logging.debug("   copying in new template file")
+        mv_common.cp_and_log(templatefile,screenconfigfile)
+
+    try:
+        f = open(screenconfigfile, 'r')
+        screenconfigcontents=f.readlines()
+        f.close()
+    except:
+        logging.info("Couldn't open %s for reading",screenconfigfile)
+        return
+    try:
+        f = open(screenconfigfile, 'w')
+    except:
+        logging.info("Couldn't open %s for writing",screenconfigfile)
+        return
+
+    startline=0
+    foundline=0
+
+    for k, line in enumerate(screenconfigcontents):
+        if re.match("programs:",line):
+            startline = k
+        if re.search(theme,line):
+            foundline = k
+    themenumber=foundline-startline-2
+
+    for line in screenconfigcontents:
+        if re.match("selected.*$",line):
+            continue
+
+        if re.match("timeout",line):
+            logging.info("    Setting idletime to %s",idle)
+            outline = "timeout:   0:%s:00 \n" %idle
+            f.write(outline)
+        elif re.match("mode",line):
+            if theme == "Random":
+                logging.info("    Setting theme to %s", "Random")
+                outline = "mode:    random \n"
+                f.write(outline)
+                outline = "selected:    -1 \n"
+                f.write(outline)
+                continue
+
+            elif theme == "Blank":
+                logging.info("    Setting theme to %s", "blank")
+                outline = "mode:    blank \n"
+                f.write(outline)
+                outline = "selected:    -1 \n"
+                f.write(outline)
+                continue
+
+            else:
+                logging.info("    Setting theme to %s", theme)
+                outline = "mode:    one\n"
+                f.write(outline)
+                logging.debug("    Theme number is %s",themenumber)
+                outline = "selected:    %s\n" %themenumber
+                f.write(outline)
+                continue
+
+        else:
+            outline = line
+            f.write(outline)
+    f.close()
+    logging.debug("__End of xscreensaver")
+
+def setup_gnome_screensaver(theme,idletime):
+    logging.info("    Configuring gnome screensaver")
+
+    logging.info("    Disabling lock screen")
+    cmd='''gconftool-2 --direct   --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory  --type bool   --set /apps/gnome-screensaver/lock_enabled false'''
+    mv_common.runcmd(cmd)
+
+    logging.info("    Setting idletime to %s",idletime)
+    cmd='''gconftool-2 --direct  --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory  --type int -s "/apps/gnome-screensaver/idle_delay" %s''' %idletime
+    mv_common.runcmd(cmd)
+
+    logging.info("    Setting mode to single")
+    cmd='''gconftool-2 --direct  --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory  --type string -s "/apps/gnome-screensaver/mode" single'''
+    mv_common.runcmd(cmd)
+
+    if theme == "Random":
+        logging.info("    setting theme to random")
+        cmd='''gconftool-2 --direct  --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory  --type string -s "/apps/gnome-screensaver/mode" random'''
+        mv_common.runcmd(cmd)
+
+    elif theme == "Blank":
+        logging.info("    setting theme to blank")
+        cmd='''gconftool-2 --direct  --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory  --type string -s "/apps/gnome-screensaver/themes" blank'''
+        mv_common.runcmd(cmd)
+
+    else:
+        logging.info("    setting theme to %s",theme)
+        cmd='''gconftool-2  --direct  --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory --set --type list --list-type=string /apps/gnome-screensaver/themes [screensavers-%s]''' %theme
+        mv_common.runcmd(cmd)
+
+    killxscreensaver()
+    logging.info("__End gnome screensaver")
+
+
+
+
+def setup_screensaver (systemconfig,data_config):
+    logging.info("____Start of screensaver configuration____")
+    screensavertype = systemconfig["Screensavertype"]
+    theme = systemconfig["Screensavertheme"]
+    idletime = systemconfig["Screensaveridle"]
+    configfile = data_config.MYTHHOME+"/.xscreensaver"
+    templatefile = systemconfig["TEMPLATES"]+"/xscreensaver.template"
+    mtemplate = systemconfig["TEMPLATES"]+"/mplayer.conf.template"
+
+    if screensavertype == "xscreensaver":
+        mv_common.pacinstall("xscreensaver")
+        mv_common.pacremove("gnome-screensaver")
+        setup_x_screensaver(idletime, theme, configfile, templatefile)
+        mplayer_saver_check("/usr/bin/xscreensaver-command -deactivate &",mtemplate)
+
+    elif screensavertype == "gscreensaver":
+        mv_common.pacinstall("xscreensaver")
+        mv_common.pacinstall("gnome-screensaver")
+        setup_gnome_screensaver(theme,idletime)
+        mplayer_saver_check("/usr/bin/gnome-screensaver-command -p &",mtemplate)
+
+    elif screensavertype == "none":
+        mv_common.pacremove("xscreensaver")
+        mv_common.pacremove("gnome-screensaver")
+        killgscreensaver()
+        killxscreensaver()
+
+    elif screensavertype == "tinker" :
+        logging.debug("    screensaver tinker mode detected")
+    else:
+        logging.debug("   Unknown screensaver")
+    logging.info("__End of screensaver")
+
+
+
diff --git a/abs/core-testing/LinHES-config/mv_software.py b/abs/core-testing/LinHES-config/mv_software.py
new file mode 100644
index 0000000..83d7c86
--- /dev/null
+++ b/abs/core-testing/LinHES-config/mv_software.py
@@ -0,0 +1,41 @@
+# -*- coding: utf-8 -*-
+import logging, mv_common
+import os, re
+
+def setup_software(systemconfig, data_config):
+    logging.info("____Start of Software install____")
+    default_disabled = ("mythphone", "mytharchive", "mythbrowser", "mythnews",
+                        "mythgame", "mythflix", "mythweather",
+                        "mythappletrailers", "mythstream", "mythvodka")
+
+    default_installed=("mythcontrols", "mythgallery", "mythmovies",
+                        "mythmusic", "mythsmolt", "mythvideo")
+    other_pkg=("miro", "xe", "romdb", "xine", "dvdcss", "webmin")
+
+    for pkg in default_disabled:
+        try:
+            if systemconfig[pkg] == "1":
+                mv_common.pacinstall(pkg)
+            else:
+                mv_common.pacremove(pkg)
+        except:
+            logging.debug("  ERROR-- %s is not defined", pkg)
+
+    for pkg in default_installed:
+        try:
+            if systemconfig[pkg] == "0":
+                mv_common.pacremove(pkg)
+            else:
+                mv_common.pacinstall(pkg)
+        except:
+            logging.debug("  ERROR-- %s is not defined", pkg)
+
+    for pkg in other_pkg:
+        try:
+            if systemconfig[pkg] == "1":
+                mv_common.pacinstall(pkg)
+            elif systemconfig[pkg] == "0":
+                mv_common.pacremove(pkg)
+        except:
+            logging.debug("   ERROR-- %s is not defined", pkg)
+    logging.info("__End Software ")
\ No newline at end of file
diff --git a/abs/core-testing/LinHES-config/mv_webuser.py b/abs/core-testing/LinHES-config/mv_webuser.py
new file mode 100644
index 0000000..026121f
--- /dev/null
+++ b/abs/core-testing/LinHES-config/mv_webuser.py
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+import logging, mv_common
+#import os
+
+def setup_web_auth(UseMythWEB_auth):
+    if UseMythWEB_auth == str(1):
+        #enable auth
+        logging.info("Enabling authorization for mythweb")
+        cmd='''sed -i "s/^.*include.*auth-inc.conf.*$/include \\"\/etc\/lighttpd\/auth-inc.conf\\"/g" /etc/lighttpd/lighttpd.conf'''
+        mv_common.runcmd(cmd)
+    else:
+        #disable auth
+        logging.info("Disabling authorization for mythweb")
+        cmd='''sed -i "s/^.*include.*auth-inc.conf.*$/#include \\"\/etc\/lighttpd\/auth-inc.conf\\"/g" /etc/lighttpd/lighttpd.conf'''
+        mv_common.runcmd(cmd)
+    logging.debug("Restarting lighttpd")
+    cmd="sudo sv restart lighttpd"
+    mv_common.runcmd(cmd)
+
diff --git a/abs/core-testing/LinHES-config/systemconfig.py b/abs/core-testing/LinHES-config/systemconfig.py
index 88961f6..1df4c39 100755
--- a/abs/core-testing/LinHES-config/systemconfig.py
+++ b/abs/core-testing/LinHES-config/systemconfig.py
@@ -3,8 +3,8 @@
 import sys,  os,  commands,  glob,  time
 import getopt,  re,  MySQLdb
 import logging
-import hostype
-
+import mv_common , mv_network
+import inspect
 #____________________________________________setup the logging______________________________________________________
 LOG_FILENAME = '/tmp/systemconfig.log'
 DEBUGLOG = '/tmp/systemconfig_debug.log'
@@ -12,10 +12,10 @@ logging.basicConfig(level=logging.DEBUG,
                     format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
                     datefmt='%m-%d %H:%M',
                     filename=DEBUGLOG,
-                    filemode='a')
+                    filemode='w')
 # define a Handler which writes INFO messages or higher to the sys.stderr
 console = logging.StreamHandler()
-console.setLevel(logging.DEBUG)
+console.setLevel(logging.INFO)
 # set a format which is simpler for console use
 #formatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s')
 formatter = logging.Formatter("%(message)s")
@@ -35,16 +35,28 @@ logging.getLogger('').addHandler(infofile)
 def usage():
     logging.info("tell people how to use this")
 
+def setup_x(systemconfig):
+    cmd = "%s/bin/xconfig.sh" %systemconfig["MVROOT"]
+    mv_common.runcmd(cmd)
+
 def main(argv):
+    try:
+        MVROOT = os.environ["MV_ROOT"]
+    except:
+        logging.debug("MVROOT was not defined, using the default value")
+        MVROOT = "/usr/MythVantage"
+
     global cmdmodule
+    global systemconfig
+    systemconfig["MVROOT"]=MVROOT
+    cmdmodule={"misc":False , "sleep":False , "hostype":False , "hostypec":False , "advanced":False , "audio":False , "network":False , "advancedX":False , "webuser":False , "restartfe":False , "reloadfe":False , "ddns":False , "screensaver":False , "ir":False , "this_is_install":False , "user":False, "software":False}
     try:
         opts,  args = getopt.getopt(argv,  'c:hm:',  ["help","modules" ] )
     except getopt.GetoptError, why:
         print why
         usage()
-        print "exception haappen"
+        print "exception happened"
         sys.exit(2)
-    cmdmodule = {"op": 'null'}
     for opt,  arg in opts:
         if opt in ("-h",  "--help"):
             usage()
@@ -53,11 +65,77 @@ def main(argv):
             for i in arg.split(","):
                 cmdmodule[i]=True
 
+    if cmdmodule["this_is_install"] or cmdmodule["hostypec"]:
+        systemconfig["hostypec"] = True
+
+    systemconfig["mythip"] = mv_network.setup_MYTH_IP(systemconfig)
+    systemconfig["mythdhcp"] = mv_network.setup_MYTH_DHCP(systemconfig)
+
     if cmdmodule["hostype"]:
+        import hostype
+        cmdmodule["advancedX"] = False
+        setup_x(systemconfig)
+        cmdmodule["ir"] = True
         hostype.hostypeprint(systemconfig)
 
+    if cmdmodule["network"]:
+        mv_network.setup_network(systemconfig)
+
+
+
+    if cmdmodule["ir"] == True:
+        import mv_ir
+        restartfe = mv_ir.setup_ir(systemconfig,data_config)
+        if restartfe == True:
+            logging.debug("    Setting the frontend to restart due to lirc change")
+            cmdmodule["restartfe"] = True
+
+    if cmdmodule["audio"] == True:
+        logging.debug("______Start of Audio Configuration______")
+        if not systemconfig["Audiotype"] == "tinker":
+            cmd="%s/bin/soundconfig.sh -t real -i %s -d %s" %(MVROOT,systemconfig["Audiotype"],systemconfig["SoundDevice"])
+            mv_common.runcmd(cmd)
+        else:
+            logging.debug("    Tinker mode(audio), not changing configuration")
+        logging.debug("__End of audio")
+
+    if cmdmodule["misc"]:
+        import mv_misc
+        mv_misc.setup_zip(MVROOT,systemconfig["zipcode"])
+        mv_misc.setup_tz(systemconfig["timezone"],systemconfig["TEMPLATES"])
+        mv_misc.setup_nfs(systemconfig)
+
+    if cmdmodule["sleep"]:
+        mv_misc.setup_sleep(systemconfig)
+
+    if cmdmodule["webuser"]:
+        import mv_webuser
+        mv_webuser.setup_web_auth(systemconfig["UseMythWEB_auth"])
+
+    if cmdmodule["screensaver"]:
+        import mv_screensaver
+        mv_screensaver.setup_screensaver(systemconfig, data_config)
+
+    if cmdmodule["advanced"]:
+        import mv_advanced
+        mv_advanced.setup_advanced(systemconfig, data_config)
+
+    if cmdmodule["software"]:
+        import mv_software
+        mv_software.setup_software(systemconfig, data_config)
+
+    if cmdmodule["advancedX"]:
+        setup_x(systemconfig)
+
+    if cmdmodule["restartfe"]:
+        mv_common.restartfe()
+
+    if cmdmodule["reloadfe"]:
+        mv_common.reloadfe()
+
 
 if __name__ == "__main__":
+
     config_file = "mv_config"
     data_config = __import__(config_file,  globals(),  locals(),  [])
     #Read in systemconfig
@@ -76,13 +154,23 @@ if __name__ == "__main__":
             var, val = line.rsplit("=", 1)
             val = val.strip('"')
             systemconfig[var.strip()] = val.strip()
-
+    systemconfig["TEMPLATES"] = os.environ["TEMPLATES"]
     logging.debug("______START OF DEBUG______")
     main(sys.argv[1:])
-    logging.debug("______cmd line options______")
-    for i in cmdmodule.items():
-        logging.debug (i)
-    logging.debug("______systemconfig______")
-    for i in systemconfig.items():
-        logging.debug(i)
-    pass
+    #logging.debug("______cmd line options______")
+    #for i in cmdmodule.items():
+        #logging.debug (i)
+    #logging.debug("______systemconfig______")
+    #for i in systemconfig.items():
+        #logging.debug(i)
+    #pass
+
+
+
+
+
+
+
+
+
+
diff --git a/abs/core-testing/LinHES-config/webuser.py b/abs/core-testing/LinHES-config/webuser.py
new file mode 100644
index 0000000..1a91bf2
--- /dev/null
+++ b/abs/core-testing/LinHES-config/webuser.py
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+import logging, mv_common
+#import os
+
+
+config_file = "mv_config"
+data_config = __import__(config_file, globals(), locals(), [])
+
+def setup_web_auth(UseMythWEB_auth):
+    if UseMythWEB_auth == 1:
+        #enable auth
+        logging.info("Enabling authorization for mythweb")
+        cmd='''sed -ie "s/^.*include.*auth-inc.conf.*$/include \"\/etc\/lighttpd\/auth-inc.conf\"/g" /etc/lighttpd/lighttpd.conf'''
+        mv_common.runcmd(cmd)
+    else
+        #disable auth
+        logging.info("Disabling authorization for mythweb")
+        cmd='''sed -ie "s/^.*include.*auth-inc.conf.*$/#include \"\/etc\/lighttpd\/auth-inc.conf\"/g" /etc/lighttpd/lighttpd.conf'''
+        mv_common.runcmd(cmd)
+    logging.debug("Restarting lighttpd")
+    cmd="sudo sv restart lighttpd"
+    mv_common.runcmd(cmd)
+
-- 
cgit v0.12


From b859b1baafe3d3a899c5f9c70a039327c57663e6 Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Mon, 1 Jun 2009 15:22:13 -0500
Subject: LinHES-config:  Addition of smolt.py to run from systemconfig

---
 abs/core-testing/LinHES-config/mv_smolt.py | 59 ++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)
 create mode 100644 abs/core-testing/LinHES-config/mv_smolt.py

diff --git a/abs/core-testing/LinHES-config/mv_smolt.py b/abs/core-testing/LinHES-config/mv_smolt.py
new file mode 100644
index 0000000..e4fbaee
--- /dev/null
+++ b/abs/core-testing/LinHES-config/mv_smolt.py
@@ -0,0 +1,59 @@
+# -*- coding: utf-8 -*-
+import logging
+import mv_common
+
+def read_release(stype):
+    if stype == "LinHES":
+        rfile = "/etc/LinHES-release"
+    else:
+        rfile = "/etc/MythVantage-release"
+
+    try:
+        f= open(rfile,'r')
+        releasename = f.readlines()[0]
+        f.close()
+    except:
+        logging.debug("    Couldn't open %s",rfile)
+        releasename = "unknown"
+
+    return releasename
+
+
+def setup_smolt_type(SystemType,Remotetype,RunFrontend,mythhome,stype):
+    logging.debug("____Start of setup_smolt_type____")
+    releasename = read_release(stype)
+
+    if SystemType == "Standalone":
+        smoltsystem = 6
+        MVRELEASE="%s (Standalone)" %releasename
+    elif SystemType == "Master_backend":
+        if RunFrontend == "1":
+            smoltsystem = 2
+            MVRELEASE="%s (MBE with Frontend)" %releasename
+        else:
+            smoltsystem=1
+            MVRELEASE="%s (MBE)" %releasename
+    elif SystemType == "Slave_backend":
+        if RunFrontend == "1" :
+            smoltsystem = 4
+            MVRELEASE="%s (SLAVE  with Frontend)" %releasename
+        else:
+            smoltsystem = 5
+            MVRELEASE="%s (SLAVE)" %releasename
+    elif SystemType == "Frontend_only":
+        smoltsystem = 3
+        MVRELEASE="%s ( Frontend only)" %releasename
+
+    logging.info("    smolt type is %s : %s", MVRELEASE,smoltsystem)
+    smoltfile = mythhome+"/.mythtv/smolt.info"
+    cmd = ''' echo  "%s" > /etc/os_myth_release ''' %MVRELEASE
+    mv_common.runcmd(cmd)
+
+    cmd = '''echo "systemtype=%s" > %s''' %(smoltsystem,smoltfile)
+    mv_common.runcmd(cmd)
+
+    cmd = '''echo "remote=%s" >> %s ''' %(Remotetype,smoltfile)
+    mv_common.runcmd(cmd)
+
+    logging.debug("__End of setup_smolt_type")
+
-- 
cgit v0.12


From aa8cbfddbec8df7338a629fd96e6cfce0bb64ed7 Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Mon, 1 Jun 2009 15:22:46 -0500
Subject: LinHES-config:  lineup debugging output

---
 abs/core-testing/LinHES-config/hostype.py        |   4 +-
 abs/core-testing/LinHES-config/mv_common.py      | 101 +++++++++++++++++------
 abs/core-testing/LinHES-config/mv_ir.py          |   4 +-
 abs/core-testing/LinHES-config/mv_network.py     |  27 +++---
 abs/core-testing/LinHES-config/mv_screensaver.py |   2 +-
 abs/core-testing/LinHES-config/mv_software.py    |   2 +-
 abs/core-testing/LinHES-config/mv_webuser.py     |   6 +-
 7 files changed, 99 insertions(+), 47 deletions(-)

diff --git a/abs/core-testing/LinHES-config/hostype.py b/abs/core-testing/LinHES-config/hostype.py
index 4dde3dc..0bbd16e 100644
--- a/abs/core-testing/LinHES-config/hostype.py
+++ b/abs/core-testing/LinHES-config/hostype.py
@@ -60,7 +60,7 @@ def setup_syslog(dbhost):
     return
 
 def hostypeprint(systemconfig):
-    logging.debug("______Start of hostype config_____")
+    logging.info("______Start of hostype config_____")
     mv_common.services(systemconfig)
     install_list=''
     remove_list=''
@@ -144,4 +144,4 @@ def hostypeprint(systemconfig):
         setup_func_minion(dbhost)
         setup_func_key()
         setup_syslog(systemconfig["dbhost"])
-    logging.debug("__End of hostype config")
+    logging.info("__End of hostype config\n")
diff --git a/abs/core-testing/LinHES-config/mv_common.py b/abs/core-testing/LinHES-config/mv_common.py
index 3ae7edb..64ff2d6 100644
--- a/abs/core-testing/LinHES-config/mv_common.py
+++ b/abs/core-testing/LinHES-config/mv_common.py
@@ -10,10 +10,9 @@ def runcmd(cmd):
     else:
         cmd = "echo "+cmd
     logging.debug("    %s",cmd)
-    cmdout = commands.getoutput(cmd)
+    cmdout = commands.getstatusoutput(cmd)
     logging.debug("    %s",cmdout)
-    return cmdout
-
+    return cmdout[0]
 
 def services(systemconfig):
     logging.debug("______Start of services______")
@@ -30,12 +29,34 @@ def cp_and_log(srcfile,destfile):
 
 def add_service(daemon):
     logging.info("    Adding service %s",daemon)
+    cmd = "add_service.sh %s" %daemon
+    runcmd(cmd)
 
 def remove_service(daemon):
     logging.info("    Removing service %s",daemon)
+    cmd = "remove_service.sh %s" %daemon
+    runcmd(cmd)
+
+def pkg_blacklist_check(pkg):
+    cmd = '''grep -q %s /etc/blacklist.package''' %pkg
+    rc = runcmd(cmd)
+    if rc == 0:
+        return True
+    else:
+        return False
+
+def pkg_installed_check(pkg):
+    logging.debug("    Checking if %sis installed",pkg)
+    cmd = "pacman -Q %s " %pkg
+    rc = runcmd(cmd)
+    if rc == 0:
+        return True
+    else:
+        return False
+
 
 def pacinstall(pkg):
-    logging.info("    Installing %s",pkg)
+    logging.info("    Checking %s for install",pkg)
     #extra pkg check
     if pkg == "xine":
         pacinstall("xine-ui")
@@ -44,8 +65,18 @@ def pacinstall(pkg):
     elif pkg == "webmin":
         add_service("webmin")
 
+    if  not pkg_blacklist_check(pkg):
+        if pkg_installed_check(pkg):
+            logging.info("    %s is already installed, will not install",pkg)
+        else:
+            logging.info("    Installing %s",pkg)
+            cmd ='''pacman --noconfirm -Sf %s ''' %pkg
+            runcmd(cmd)
+    else:
+        logging.info("    %s is blacklisted, will not install",pkg)
+
 def pacremove(pkg):
-    logging.info("    Removing %s",pkg)
+    logging.info("    Checking %s for removal",pkg)
     if pkg == "xine":
         pacremove("xine-ui")
     elif pkg == "dvdcss":
@@ -53,32 +84,52 @@ def pacremove(pkg):
     elif pkg == "webmin":
         remove_service("webmin")
 
+    if  not pkg_blacklist_check(pkg):
+        if not pkg_installed_check(pkg):
+            logging.info("    %s is not installed, will not remove",pkg)
+        else:
+            logging.info("    Removing %s",pkg)
+            cmd ='''pacman --noconfirm -R  %s ''' %pkg
+    else:
+        logging.info("    %s is blacklisted, will not remove",pkg)
+
+def getpid(process):
+    return commands.getoutput('pidof %s' % process)
+
+
+def restartLCD(RESTART_LCD):
+    if  RESTART_LCD :
+        logging.info("    Restarting lcd server")
+        cmd = "killall -9 mythlcdserver"
+        runcmd(cmd)
+    else:
+        logging.debug("    Not restarting MYTHLCD server")
+
 
-def reloadfe():
-    logging.info("    Reloading frontend")
-    logging.info("    LOOK Reloading frontend")
-    #function reloadfe(){
-    #PID=`ps -ef |grep mythfrontend|grep -v grep |awk  '{print $2 }'`
-    #/usr/bin/backend_control.sh  clearcache  behost $dbhost
-    #if [ x$RESTART_LCD = xtrue ]
-    #then
-        #killall -9 mythlcdserver
-    #fi
-    #if [  x = x$PID ]
-    #then
-        #echo "Mythfrontend not running, will not reload"
-    #else
-            #kill -s USR1 $PID
-    #fi
-    return
-
-def restartfe():
+def reloadfe(dbhost,RESTART_LCD):
+    logging.debug("____Start of reloadfe____")
+    logging.info("    Clearing Backend cache")
+    cmd = '''/usr/bin/backend_control.sh  clearcache  behost %s''' %dbhost
+    runcmd(cmd)
+    restartLCD(RESTART_LCD)
+    for pid in getpid("mythfrontend"):
+        cmd = ''' kill -s USR1 %s ''' %pid
+        #runcmd(cmd)
+        logging.info("    Reloading frontend with pid of %s",pid)
+
+    logging.debug("__End of reloadfe\n")
+
+
+def restartfe(RESTART_LCD):
+    logging.debug("____Start of restartfe____")
     logging.info("    Restarting frontend")
+    restartLCD(RESTART_LCD)
     cmd="killall -9 mythfrontend"
     runcmd(cmd)
     cmd="killall -9 welcome"
     runcmd(cmd)
-    return
+    logging.debug("__End of restartfe\n")
+
 
 def udev_trigger():
     logging.info("    Triggering udev")
diff --git a/abs/core-testing/LinHES-config/mv_ir.py b/abs/core-testing/LinHES-config/mv_ir.py
index cbc18a2..b3552c5 100644
--- a/abs/core-testing/LinHES-config/mv_ir.py
+++ b/abs/core-testing/LinHES-config/mv_ir.py
@@ -277,12 +277,12 @@ def setup_ir(systemconfig, data_config):
         mv_common.udev_trigger()
         cmd="sv start lircd"
         mv_common.runcmd(cmd)
-        rc = True
+        rc = [ True , True ]
     if systemconfig["LCDtype"]:
         setup_lcd(systemconfig["LCDtype"],
                   systemconfig["TEMPLATES"],
                   systemconfig["Remotetype"])
     else:
         logging.debug("    LCD not defined")
-    logging.info("__End IR ")
+    logging.info("__End IR\n")
     return rc
\ No newline at end of file
diff --git a/abs/core-testing/LinHES-config/mv_network.py b/abs/core-testing/LinHES-config/mv_network.py
index 71bc442..77ee2d8 100644
--- a/abs/core-testing/LinHES-config/mv_network.py
+++ b/abs/core-testing/LinHES-config/mv_network.py
@@ -13,7 +13,7 @@ def setup_MYTH_IP(systemconfig):
     except:
         logging.debug("    Error occured finding the defaultip")
         defaultip = "127.0.0.1"
-    logging.info("    Using %s as default ip", defaultip)
+    logging.debug("    Using %s as default ip", defaultip)
     return defaultip
 
 def setup_MYTH_DHCP(systemconfig):
@@ -23,7 +23,7 @@ def setup_MYTH_DHCP(systemconfig):
     except:
         logging.debug("    Error occured finding default dhcp")
         defaultdhcp = "0"
-    logging.info("    Using %s as dhcp value for %s", default_interface, defaultdhcp)
+    logging.debug("    Using %s as dhcp value for %s", default_interface, defaultdhcp)
     return defaultdhcp
 
 def flush(netdev):
@@ -51,13 +51,12 @@ def kill_dhcp(basedir):
 
 def setup_nameserver(dns):
     logging.info("    Adding %s for DNS", dns)
-    logging.info("-----------NEED TO SETUP setup_nameserver")
-    #grep -q $1 ${BASE}/etc/resolv.conf
-    #status=$?
-    #if [ ! $status = 0 ]
-    #then
-        #echo "nameserver $1" >> ${BASE}/etc/resolv.conf
-    #fi
+    cmd = '''grep -q %s /etc/resolv.conf''' %dns
+    status = mv_common.runcmd(cmd)
+    if  not status == 0 :
+        cmd =  ''' echo "nameserver %s" >> /etc/resolv.conf ''' %dns
+        mv_common.runcmd(cmd)
+
 
 
 def setup_hostname(systemconfig):
@@ -132,16 +131,16 @@ def setup_interface(netdev,systemconfig):
             cmd = '''echo "key %s" >>  %s/%s/iwconfig ''' %(netinfo["KEY"], etcnetdir, netdev)
             mv_common.runcmd(cmd)
     else:
-        logging.info("  Disabling wireless extensions")
+        logging.info("    Disabling wireless extensions")
         cmd = '''sed -i -e 's/^CONFIG_WIRLESS=.*$/CONFIG_WIRLESS=no/g' %s/%s/options''' %(etcnetdir, netdev)
         mv_common.runcmd(cmd)
 
     if netinfo["UseDHCP"] == "0" :
-        logging.info("   Enabling DHCP support")
+        logging.info("    Enabling DHCP support")
         cmd = ''' sed -i -e 's/^BOOTPROTO=.*$/BOOTPROTO=dhcp/g' %s/%s/options''' %(etcnetdir, netdev)
         mv_common.runcmd(cmd)
     else:
-        logging.info("   Using static ip address of %s",netinfo["ip"])
+        logging.info("    Using static ip address of %s",netinfo["ip"])
         cmd = ''' sed -i -e 's/^BOOTPROTO=.*$/BOOTPROTO=static/g' %s/%s/options''' %(etcnetdir, netdev)
         mv_common.runcmd(cmd)
         cmd = '''echo "default via %s" > %s/%s/ipv4route''' %(netinfo["GW"], etcnetdir, netdev)
@@ -259,7 +258,7 @@ def setup_network (systemconfig):
     logging.info("    Setting up the network")
     setup_hostname(systemconfig)
     find_active(systemconfig)
-    logging.info("__End of network")
+    logging.info("__End of network\n")
 
 
 
@@ -272,6 +271,6 @@ def install_network_setup(systemconfig):
     stop_network()
     find_active(systemconfig)
     start_network()
-    logging.info("__End of network")
+    logging.info("__End of network install \n")
 
 
diff --git a/abs/core-testing/LinHES-config/mv_screensaver.py b/abs/core-testing/LinHES-config/mv_screensaver.py
index eb81792..2da970c 100644
--- a/abs/core-testing/LinHES-config/mv_screensaver.py
+++ b/abs/core-testing/LinHES-config/mv_screensaver.py
@@ -193,7 +193,7 @@ def setup_screensaver (systemconfig,data_config):
         logging.debug("    screensaver tinker mode detected")
     else:
         logging.debug("   Unknown screensaver")
-    logging.info("__End of screensaver")
+    logging.info("__End of screensaver\n")
 
 
 
diff --git a/abs/core-testing/LinHES-config/mv_software.py b/abs/core-testing/LinHES-config/mv_software.py
index 83d7c86..047a235 100644
--- a/abs/core-testing/LinHES-config/mv_software.py
+++ b/abs/core-testing/LinHES-config/mv_software.py
@@ -38,4 +38,4 @@ def setup_software(systemconfig, data_config):
                 mv_common.pacremove(pkg)
         except:
             logging.debug("   ERROR-- %s is not defined", pkg)
-    logging.info("__End Software ")
\ No newline at end of file
+    logging.info("__End Software\n ")
\ No newline at end of file
diff --git a/abs/core-testing/LinHES-config/mv_webuser.py b/abs/core-testing/LinHES-config/mv_webuser.py
index 026121f..a8517a8 100644
--- a/abs/core-testing/LinHES-config/mv_webuser.py
+++ b/abs/core-testing/LinHES-config/mv_webuser.py
@@ -3,17 +3,19 @@ import logging, mv_common
 #import os
 
 def setup_web_auth(UseMythWEB_auth):
+    logging.info("____Start of setup_web_auth____")
     if UseMythWEB_auth == str(1):
         #enable auth
-        logging.info("Enabling authorization for mythweb")
+        logging.info("    Enabling authorization for mythweb")
         cmd='''sed -i "s/^.*include.*auth-inc.conf.*$/include \\"\/etc\/lighttpd\/auth-inc.conf\\"/g" /etc/lighttpd/lighttpd.conf'''
         mv_common.runcmd(cmd)
     else:
         #disable auth
-        logging.info("Disabling authorization for mythweb")
+        logging.info("    Disabling authorization for mythweb")
         cmd='''sed -i "s/^.*include.*auth-inc.conf.*$/#include \\"\/etc\/lighttpd\/auth-inc.conf\\"/g" /etc/lighttpd/lighttpd.conf'''
         mv_common.runcmd(cmd)
     logging.debug("Restarting lighttpd")
     cmd="sudo sv restart lighttpd"
     mv_common.runcmd(cmd)
+    logging.info("__End of webauth\n")
 
-- 
cgit v0.12


From af488dcf5c3d0354003910b3af841827980250a8 Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Mon, 1 Jun 2009 15:23:07 -0500
Subject: LinHES-config: add "all" module and smolt

---
 abs/core-testing/LinHES-config/systemconfig.py | 41 +++++++++++++++++++++++---
 1 file changed, 37 insertions(+), 4 deletions(-)

diff --git a/abs/core-testing/LinHES-config/systemconfig.py b/abs/core-testing/LinHES-config/systemconfig.py
index 1df4c39..f8521d4 100755
--- a/abs/core-testing/LinHES-config/systemconfig.py
+++ b/abs/core-testing/LinHES-config/systemconfig.py
@@ -49,7 +49,8 @@ def main(argv):
     global cmdmodule
     global systemconfig
     systemconfig["MVROOT"]=MVROOT
-    cmdmodule={"misc":False , "sleep":False , "hostype":False , "hostypec":False , "advanced":False , "audio":False , "network":False , "advancedX":False , "webuser":False , "restartfe":False , "reloadfe":False , "ddns":False , "screensaver":False , "ir":False , "this_is_install":False , "user":False, "software":False}
+    restartlcd = False
+    cmdmodule={"misc":False , "sleep":False , "hostype":False , "hostypec":False , "advanced":False , "audio":False , "network":False , "advancedX":False , "webuser":False , "restartfe":False , "reloadfe":False , "ddns":False , "screensaver":False , "ir":False , "this_is_install":False , "user":False, "software":False, "smolt":False, "all":False}
     try:
         opts,  args = getopt.getopt(argv,  'c:hm:',  ["help","modules" ] )
     except getopt.GetoptError, why:
@@ -67,16 +68,35 @@ def main(argv):
 
     if cmdmodule["this_is_install"] or cmdmodule["hostypec"]:
         systemconfig["hostypec"] = True
+        cmdmodule["smolt"] = True
 
     systemconfig["mythip"] = mv_network.setup_MYTH_IP(systemconfig)
     systemconfig["mythdhcp"] = mv_network.setup_MYTH_DHCP(systemconfig)
 
+    if cmdmodule["all"]:
+        logging.info("***    WILL RUN ALL MODULES   ***")
+        cmdmodule["hostype"] = True
+        cmdmodule["ir"]= True
+        cmdmodule["network"] = True
+        cmdmodule["audio"] = True
+        cmdmodule["misc"] = True
+        cmdmodule["sleep"] = True
+        cmdmodule["webuser"] = True
+        cmdmodule["screensaver"] = True
+        cmdmodule["advanced"] = True
+        cmdmodule["software"] = True
+        cmdmodule["advancedX"] = True
+        cmdmodule["smolt"] = True
+
+
+
     if cmdmodule["hostype"]:
         import hostype
         cmdmodule["advancedX"] = False
         setup_x(systemconfig)
         cmdmodule["ir"] = True
         hostype.hostypeprint(systemconfig)
+        cmdmodule["smolt"] = True
 
     if cmdmodule["network"]:
         mv_network.setup_network(systemconfig)
@@ -85,10 +105,14 @@ def main(argv):
 
     if cmdmodule["ir"] == True:
         import mv_ir
-        restartfe = mv_ir.setup_ir(systemconfig,data_config)
+        restart = mv_ir.setup_ir(systemconfig,data_config)
+        restartfe = restart[0]
+        restartlcd = restart[1]
         if restartfe == True:
             logging.debug("    Setting the frontend to restart due to lirc change")
             cmdmodule["restartfe"] = True
+        cmdmodule["smolt"] = True
+
 
     if cmdmodule["audio"] == True:
         logging.debug("______Start of Audio Configuration______")
@@ -128,10 +152,19 @@ def main(argv):
         setup_x(systemconfig)
 
     if cmdmodule["restartfe"]:
-        mv_common.restartfe()
+        mv_common.restartfe(restartlcd)
 
     if cmdmodule["reloadfe"]:
-        mv_common.reloadfe()
+        mv_common.reloadfe(systemconfig["dbhost"],restartlcd)
+
+    if cmdmodule["smolt"]:
+        import mv_smolt
+        mv_smolt.setup_smolt_type(systemconfig["SystemType"],
+                                  systemconfig["Remotetype"],
+                                  systemconfig["RunFrontend"],
+                                  data_config.MYTHHOME,
+                                  data_config.SYSTEMTYPE)
+
 
 
 if __name__ == "__main__":
-- 
cgit v0.12


From d9d928e1890f4c841889d2362b988466b85904cd Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Mon, 1 Jun 2009 15:23:30 -0500
Subject: LinHES-config: cleanup

---
 abs/core-testing/LinHES-config/mv_advanced.py | 31 ++++++++++++++++++++++++---
 abs/core-testing/LinHES-config/mv_misc.py     | 31 ++++++++++++++++-----------
 2 files changed, 46 insertions(+), 16 deletions(-)

diff --git a/abs/core-testing/LinHES-config/mv_advanced.py b/abs/core-testing/LinHES-config/mv_advanced.py
index 67692a4..f5a0f29 100644
--- a/abs/core-testing/LinHES-config/mv_advanced.py
+++ b/abs/core-testing/LinHES-config/mv_advanced.py
@@ -5,7 +5,32 @@ import mv_common
 def setup_pacman(create_link):
     if create_link:
         logging.info("    Creating pacman link")
-        logging.info("    LOOK")
+        #LOOK
+        #This is not implmented yet, below is the bash code for reference
+        #if [ ! x$1 = x ]
+    #then
+        #ln -s ${BASE}/data/var ${BASE}/data/srv/httpd/htdocs/repo
+        #echo "creating the link for the pacman repo mirror"
+    #fi
+
+    #for i in mv-core mv-core-testing mv-extra mv-extra-testing
+    #do
+        #echo "[$i]"  > ${BASE}/etc/pacman.d/$i
+        ##add mirror if needed
+        #if [ x$PKG_MIRROR = x1 ]
+        #then
+            #echo " Server = http://$dbhost/repo/$i " >> ${BASE}/etc/pacman.d/$i
+        #fi
+        ##add user templates
+        #USERTEMPLATES="/data/home/mythtv/templates"
+        #if [ -f $USERTEMPLATES/sources/$i ]
+        #then
+            #echo "Adding user  $i"
+            #cat $USERTEMPLATES/sources/$i  >> ${BASE}/etc/pacman.d/$i
+        #fi
+        #cat $TEMPLATES/sources/$i  >> ${BASE}/etc/pacman.d/$i
+        #echo "setting local mirror to $dbhost for $i "
+    #done
     else:
         logging.info("    Pacman link will not be created")
     return
@@ -106,7 +131,7 @@ def setup_DNSmasq(RunDHCP,ip,gw,nameserver):
             dnsconf = f.readlines()
             f.close()
         except:
-                logging.info("   Couldn't open dnsmasq.conf")
+                logging.info("    Couldn't open dnsmasq.conf")
                 return
         for line in dnsconf:
             outline = line
@@ -349,4 +374,4 @@ def setup_advanced(systemconfig,data_config):
                 systemconfig["TEMPLATES"]+"/exports.template")
 
     setup_dyndns(systemconfig["DDnsEnable"])
-
+    logging.info("__End of advanced configuration\n")
diff --git a/abs/core-testing/LinHES-config/mv_misc.py b/abs/core-testing/LinHES-config/mv_misc.py
index e792f67..eba7b57 100644
--- a/abs/core-testing/LinHES-config/mv_misc.py
+++ b/abs/core-testing/LinHES-config/mv_misc.py
@@ -11,15 +11,18 @@ def setup_zip(MVROOT,zipcode):
 
     if zipcode:
         cmd="%s/bin/restore_default_settings.sh -c ZIP -c %s" %(MVROOT,zipcode)
+        mv_common.runcmd(cmd)
         #Let's also speed things up for those in North America
-        #LOOK REVISIT
-        print "mkdir /usr/bin/perlbin/vendor/tv_grabbers_non_na"
-        print "mv  /usr/bin/perlbin/vendor/tv_grab_*  /usr/bin/perlbin/vendor/tv_grabbers_non_na"
-        print "mv  /usr/bin/perlbin/vendor/tv_grabbers_non_na/tv_grab_na*  /usr/bin/perlbin/vendor/"
+        cmd="mkdir /usr/bin/perlbin/vendor/tv_grabbers_non_na"
+        mv_common.runcmd(cmd)
+        cmd="mv  /usr/bin/perlbin/vendor/tv_grab_*  /usr/bin/perlbin/vendor/tv_grabbers_non_na"
+        mv_common.runcmd(cmd)
+        cmd="mv  /usr/bin/perlbin/vendor/tv_grabbers_non_na/tv_grab_na*  /usr/bin/perlbin/vendor/"
+        mv_common.runcmd(cmd)
     else:
         logging.debug("    Zipcode is not set")
 
-    logging.debug("__End of zipcode")
+    logging.debug("__End of zipcode\n")
 
 def setup_tz(timezone,TEMPLATES):
     logging.debug("____Setting up the timezone____")
@@ -37,22 +40,24 @@ def setup_tz(timezone,TEMPLATES):
     srclink="/usr/share/zoneinfo/%s" %timezone
     logging.debug("    symlinking %s to /etc/localtime",srclink)
     os.symlink(srclink,"/etc/localtime")
-    print '''sed -e "s~^TIMEZONE=.*$~TIMEZONE=\"${timezone}\"~" ${BASE}/etc/rc.conf > $TEMPLATES/rc.conf'''
+    cmd = '''sed -e "s~^TIMEZONE=.*$~TIMEZONE=\"%s\"~" /etc/rc.conf > $TEMPLATES/rc.conf''' %timezone
+    mv_common.runcmd(cmd)
 
     if os.path.exists("/etc/php/php.ini"):
         logging.debug("Changing timezone for php")
-        print '''sed -i "s/^.*date.timezone.*$/date.timezone=${timezone}/" ${BASE}/etc/php/php.ini'''
+        cmd = '''sed -i "s/^.*date.timezone.*$/date.timezone=%s/" ${BASE}/etc/php/php.ini''' %timezone
+        mv_common.runcmd(cmd)
 
     mv_common.cp_and_log(TEMPLATES+"/rc.conf","/etc/rc.conf")
-    logging.debug("__End of timezone")
+    logging.debug("__End of timezone\n")
 
 def setup_nfs(systemconfig):
     nfslist=[]
-    logging.debug("____Setting up nfs____")
+    logging.info("____Start of setup_nfs____")
     scrubnfs(systemconfig["TEMPLATES"])
 
     if systemconfig["HaveCentralNFS"] == "yes":
-        logging.debug("   Using a Central NFS server")
+        logging.debug("    Using a Central NFS server")
         if systemconfig["NFSserver"] == "file:nfsmap":
         #if it's a file check for it, failure results in downloading attempt from MBE
             nfsmap_file=data_config.MYTHHOME+"/templates/nfsmap"
@@ -72,7 +77,7 @@ def setup_nfs(systemconfig):
             nfslist.append(item)
         setup_nfs_fstab(nfslist)
 
-    logging.debug("__End of nfs")
+    logging.info("__End of nfs\n")
 
 def setup_sleep(systemconfig):
     logging.debug("____Setting up sleep____")
@@ -98,7 +103,7 @@ def setup_sleep(systemconfig):
         cmd='''sed -e "/00 HOUR.*/d" %s/cron.template | crontab - -u mythtv''' %systemconfig["TEMPLATES"]
         mv_common.runcmd(cmd)
 
-    logging.debug("__End of  sleep")
+    logging.debug("__End of  sleep\n")
 
 
 def process_nfsmap_file(mapfile):
@@ -149,7 +154,7 @@ def download_nfsmap(ip):
     return nfsmap_file
 
 def setup_nfs_fstab(nfslist):
-    logging.info("   Adding nfs paths to fstab")
+    logging.info("    Adding nfs paths to fstab")
     try:
         f = open('/etc/fstab', 'a')
         line = "#STARTSCRUB --------------anything in this block will be scrubbed\n"
-- 
cgit v0.12


From 958a4c40386321b8c9008c42afd6d911d9009962 Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Thu, 4 Jun 2009 08:41:18 -0500
Subject: LinHes-config:  Removing unused files

---
 abs/core-testing/LinHES-config/hostype.py | 147 ------------------------------
 abs/core-testing/LinHES-config/ir.py      |  41 ---------
 abs/core-testing/LinHES-config/webuser.py |  23 -----
 3 files changed, 211 deletions(-)
 delete mode 100644 abs/core-testing/LinHES-config/hostype.py
 delete mode 100644 abs/core-testing/LinHES-config/ir.py
 delete mode 100644 abs/core-testing/LinHES-config/webuser.py

diff --git a/abs/core-testing/LinHES-config/hostype.py b/abs/core-testing/LinHES-config/hostype.py
deleted file mode 100644
index 0bbd16e..0000000
--- a/abs/core-testing/LinHES-config/hostype.py
+++ /dev/null
@@ -1,147 +0,0 @@
-# -*- coding: utf-8 -*-
-import logging, mv_common
-import os
-
-config_file = "mv_config"
-data_config = __import__(config_file, globals(), locals(), [])
-
-def setup_ntp(usepool,ntpserver):
-    if usepool:
-        logging.info("Setting ntp server to %s",ntpserver)
-        print '''sed -i "s/pool.ntp.org/$dbhost/g" ${BASE}/etc/ntp.conf'''
-    else:
-        logging.info("Not changing ntp configuration")
-
-def setup_avahi(templates):
-    file="/etc/avahi/services/mysql.service"
-    if not os.path.exists(file):
-        logging.debug("    copying in mysql.service for avahi")
-        try:
-            os.makedirs("/etc/avahi/services")
-        except:
-            logging.debug("    Couldn't create /etc/avahi/services")
-        mv_common.cp_and_log(template+"/mysql.service",file)
-        cmd="sudo sv restart avahi"
-        mv_common.runcmd(cmd)
-
-def remove_avahi_service():
-    file="/etc/avahi/services/mysql.service"
-    if os.path.exists(file):
-        logging.debug("    Removing avahi mysql.service file")
-        cmd="rm -rf %s" %file
-        runcmd(cmd)
-        cmd="sudo sv restart avahi"
-        mv_common.runcmd(cmd)
-
-def setup_db():
-    logging.debug("    Setting up the database")
-
-def setup_mysqlnetwork():
-    logging.debug("    Setting up mysql network")
-
-def setup_mysql():
-    logging.debug("    Configuring mysql")
-
-def setup_func_key():
-    if data_config.SYSTEMTYPE == "MythVantage":
-        logging.debug("    Grabbing the key for Func")
-        cmd="/usr/MythVantage/bin/grabkey.py"
-        mv_common.runcmd(cmd)
-
-def setup_func_minion(dbhost):
-    logging.info("    Setting up the func minion:")
-    logging.debug("   certmaster is %s:",dbhost)
-    cmd='''sed -i "s/^certmaster.*$/certmaster = %s/" /etc/func/minion.conf ''' %dbhost
-    mv_common.runcmd(cmd)
-
-def setup_syslog(dbhost):
-    logging.debug("    Setting syslog to log to %s",dbhost)
-    cmd ='''sed -i "s/^destination d_remote.*$/destination d_remote \{tcp\(\"%s\" port\(514\)\) \;\} \;/" /etc/syslog-ng.conf''' %dbhost
-    return
-
-def hostypeprint(systemconfig):
-    logging.info("______Start of hostype config_____")
-    mv_common.services(systemconfig)
-    install_list=''
-    remove_list=''
-    daemon_list=''
-    daemon_remove_list=''
-
-    if systemconfig["SystemType"] == "Standalone":
-        logging.info("Stand alone system being configured")
-        setup_ntp(False,"null")
-        remove_avahi_service()
-        if systemconfig["hostypec"]:
-            setup_db()
-        install_list=("mysql", "mythdb-initial", "avahi", "portmap", "nfs-utils", "local-website", "myth2ipod", "mythtv-status")
-        daemon_list=("mysql", "mythbackend", "avahi", "portmap", "nfs-utils", "netfs", "lighttpd")
-
-    elif systemconfig["SystemType"] == "Master_backend":
-        logging.info("Master backend system being configured")
-        setup_ntp(False,"null")
-        setup_avahi(systemconfig["TEMPLATES"])
-        install_list=("mysql", "mythdb-initial", "avahi", "portmap", "nfs-utils", "local-website", "myth2ipod", "mythtv-status")
-        daemon_list=("mysql", "mythbackend", "avahi", "portmap", "nfs-utils", "netfs", "lighttpd")
-        if data_config.SYSTEMTYPE == "MythVantage":
-            install_list.append('func')
-            install_list.append('certmaster')
-            daemon_list.append('certmaster')
-
-    elif systemconfig["SystemType"] == "Slave_backend":
-        logging.info("Slave backend  system being configured")
-        setup_ntp(True,systemconfig["dbhost"])
-        remove_avahi_service()
-        if systemconfig["hostypec"]:
-            setup_db()
-        install_list=("portmap", "nfs-utils", "local-website", "avahi", 'libmysqlclient')
-        daemon_list=("mythbackend", "portmap", "nfs-utils", "netfs", "lighttpd", "avahi")
-        daemon_remove_list=('mysql')
-        if data_config.SYSTEMTYPE == "MythVantage":
-            install_list.remove("local-website")
-            daemon_list.remove("lighttpd")
-            install_list.append('func')
-            daemon_list.append('funcd')
-            remove_list.append("lighttpd")
-
-
-    elif systemconfig["SystemType"] == "Frontend_only":
-        logging.info("Frontend only system being configured")
-        setup_ntp(True,systemconfig["dbhost"])
-        remove_avahi_service()
-        install_list=("mysql-clients", "libmysqlclient",  "avahi", "portmap", "nfs-utils", "local-website")
-        remove_list=("mysql")
-        daemon_list=("mysql", "mythbackend", "avahi", "portmap", "nfs-utils", "netfs", "lighttpd")
-        daemon_remove_list=("mysql", "mythbackend")
-        if data_config.SYSTEMTYPE == "MythVantage":
-            install_list.remove("local-website")
-            daemon_list.remove("lighttpd")
-            install_list.append('func')
-            daemon_list.append('funcd')
-            remove_list.append("lighttpd")
-
-
-
-    for pkg in install_list:
-        mv_common.pacinstall(pkg)
-    for pkg in remove_list:
-        mv_common.pacinstall(pkg)
-    for daemon in daemon_list:
-        mv_common.add_service(daemon)
-    for daemon in daemon_remove_list:
-        mv_common.remove_service(daemon)
-    if systemconfig["RunFrontend"] == "1":
-        logging.debug("   Will run the frontend")
-        mv_common.add_service("frontend")
-        mv_common.add_service("hal")
-    else:
-        logging.debug("   Will NOT run the frontend")
-        mv_common.remove_service("frontend")
-        mv_common.remove_service("hal")
-
-    setup_mysqlnetwork()
-    setup_mysql()
-    if data_config.SYSTEMTYPE == "MythVantage":
-        setup_func_minion(dbhost)
-        setup_func_key()
-        setup_syslog(systemconfig["dbhost"])
-    logging.info("__End of hostype config\n")
diff --git a/abs/core-testing/LinHES-config/ir.py b/abs/core-testing/LinHES-config/ir.py
deleted file mode 100644
index a6723ce..0000000
--- a/abs/core-testing/LinHES-config/ir.py
+++ /dev/null
@@ -1,41 +0,0 @@
-# -*- coding: utf-8 -*-
-import logging, mv_common
-import os, re
-
-def setup_ir(systemconfig, data_config):
-    logging.info("____Start of Software install____")
-    default_disabled = ("mythphone", "mytharchive", "mythbrowser", "mythnews",
-                        "mythgame", "mythflix", "mythweather",
-                        "mythappletrailers", "mythstream", "mythvodka")
-
-    default_installed=("mythcontrols", "mythgallery", "mythmovies",
-                        "mythmusic", "mythsmolt", "mythvideo")
-    other_pkg=("miro", "xe", "romdb", "xine", "dvdcss", "webmin")
-
-    for pkg in default_disabled:
-        try:
-            if systemconfig[pkg] == "1":
-                mv_common.pacinstall(pkg)
-            else:
-                mv_common.pacremove(pkg)
-        except:
-            logging.debug("  ERROR-- %s is not defined", pkg)
-
-    for pkg in default_installed:
-        try:
-            if systemconfig[pkg] == "0":
-                mv_common.pacremove(pkg)
-            else:
-                mv_common.pacinstall(pkg)
-        except:
-            logging.debug("  ERROR-- %s is not defined", pkg)
-
-    for pkg in other_pkg:
-        try:
-            if systemconfig[pkg] == "1":
-                mv_common.pacinstall(pkg)
-            elif systemconfig[pkg] == "0":
-                mv_common.pacremove(pkg)
-        except:
-            logging.debug("   ERROR-- %s is not defined", pkg)
-    logging.info("__End Software ")
\ No newline at end of file
diff --git a/abs/core-testing/LinHES-config/webuser.py b/abs/core-testing/LinHES-config/webuser.py
deleted file mode 100644
index 1a91bf2..0000000
--- a/abs/core-testing/LinHES-config/webuser.py
+++ /dev/null
@@ -1,23 +0,0 @@
-# -*- coding: utf-8 -*-
-import logging, mv_common
-#import os
-
-
-config_file = "mv_config"
-data_config = __import__(config_file, globals(), locals(), [])
-
-def setup_web_auth(UseMythWEB_auth):
-    if UseMythWEB_auth == 1:
-        #enable auth
-        logging.info("Enabling authorization for mythweb")
-        cmd='''sed -ie "s/^.*include.*auth-inc.conf.*$/include \"\/etc\/lighttpd\/auth-inc.conf\"/g" /etc/lighttpd/lighttpd.conf'''
-        mv_common.runcmd(cmd)
-    else
-        #disable auth
-        logging.info("Disabling authorization for mythweb")
-        cmd='''sed -ie "s/^.*include.*auth-inc.conf.*$/#include \"\/etc\/lighttpd\/auth-inc.conf\"/g" /etc/lighttpd/lighttpd.conf'''
-        mv_common.runcmd(cmd)
-    logging.debug("Restarting lighttpd")
-    cmd="sudo sv restart lighttpd"
-    mv_common.runcmd(cmd)
-
-- 
cgit v0.12


From 7036c362b23d65f562b4ae44c7267fb2e89b2d11 Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Thu, 4 Jun 2009 08:42:27 -0500
Subject: LinHes-config:  Adding ssh user module

---
 abs/core-testing/LinHES-config/systemconfig.py | 24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/abs/core-testing/LinHES-config/systemconfig.py b/abs/core-testing/LinHES-config/systemconfig.py
index f8521d4..7e5e3b1 100755
--- a/abs/core-testing/LinHES-config/systemconfig.py
+++ b/abs/core-testing/LinHES-config/systemconfig.py
@@ -82,20 +82,21 @@ def main(argv):
         cmdmodule["misc"] = True
         cmdmodule["sleep"] = True
         cmdmodule["webuser"] = True
+        cmdmodule["ddns"] = True
         cmdmodule["screensaver"] = True
         cmdmodule["advanced"] = True
         cmdmodule["software"] = True
         cmdmodule["advancedX"] = True
         cmdmodule["smolt"] = True
-
+        cmdmodule["user"] = True
 
 
     if cmdmodule["hostype"]:
-        import hostype
+        import mv_hostype
         cmdmodule["advancedX"] = False
         setup_x(systemconfig)
         cmdmodule["ir"] = True
-        hostype.hostypeprint(systemconfig)
+        mv_hostype.hostypeprint(systemconfig)
         cmdmodule["smolt"] = True
 
     if cmdmodule["network"]:
@@ -136,6 +137,9 @@ def main(argv):
         import mv_webuser
         mv_webuser.setup_web_auth(systemconfig["UseMythWEB_auth"])
 
+    if cmdmodule["ddns"]:
+        print " LOOK FOR DDNS"
+
     if cmdmodule["screensaver"]:
         import mv_screensaver
         mv_screensaver.setup_screensaver(systemconfig, data_config)
@@ -165,7 +169,17 @@ def main(argv):
                                   data_config.MYTHHOME,
                                   data_config.SYSTEMTYPE)
 
-
+    if cmdmodule["user"]:
+        logging.info("____Start of ssh user____")
+        if systemconfig["rootSSH"] == "1" :
+            logging.info("    Allowing ssh access for root")
+            cmd = '''sed -i "s/^.*PermitRootLogin.*$/PermitRootLogin yes/" /etc/ssh/sshd_config'''
+            mv_common.runcmd(cmd)
+        else:
+            logging.info("    Removing ssh access for root")
+            cmd = '''sed -i "s/^.*PermitRootLogin.*$/PermitRootLogin no/" /etc/ssh/sshd_config'''
+            mv_common.runcmd(cmd)
+        logging.info("__End of ssh user\n")
 
 if __name__ == "__main__":
 
@@ -173,7 +187,7 @@ if __name__ == "__main__":
     data_config = __import__(config_file,  globals(),  locals(),  [])
     #Read in systemconfig
     global systemconfig
-    systemconfig = {}
+    systemconfig = {"hostypec":False}
     file_name = "/etc/systemconfig"
     try:
         config_file = open(file_name)
-- 
cgit v0.12


From c4fb1a3c13043bc6c2dd7fee59e6477ad3fb5f19 Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Thu, 4 Jun 2009 08:42:55 -0500
Subject: linhes-config:  convert systemconfig.sh to nothing but a proxy for
 systemconfig.py

---
 abs/core-testing/LinHES-config/systemconfig.sh | 1444 +-----------------------
 1 file changed, 1 insertion(+), 1443 deletions(-)

diff --git a/abs/core-testing/LinHES-config/systemconfig.sh b/abs/core-testing/LinHES-config/systemconfig.sh
index 54d3b01..4f58ee2 100755
--- a/abs/core-testing/LinHES-config/systemconfig.sh
+++ b/abs/core-testing/LinHES-config/systemconfig.sh
@@ -4,1453 +4,11 @@
 #Any changes made to config files will be removed when systemconfig.sh is run
 #
 #JM
-###################################################################
-#set -x
-. /etc/profile
-#MVRELEASE=`cat /etc/mythvantage-release  |cut -d" " -f -2`
-MVRELEASE=`cat /etc/LinHES-release  `
 echo $@ >/tmp/systemconfig.call
 echo "----------------------start of systemconfig $@ ----------------------"
-BASE=""
-
-#TEMPLATES="/usr/share/templates"
 . /etc/profile
-MYTHHOME=$BASE/home/mythtv
 . $MV_ROOT/bin/networkconfig.sh
-PACMAN="pacman --noconfirm"
 postfix=`cat ${BASE}/usr/local/share/mythtv/.releasetype`
-PKGBLACKLIST=$BASE/etc/blacklist.package
-
-if [ x$1 = x"Mysql_only" ]
-    then
-    rm -f /tmp/mysql.txt
-        sed -e "s/^DBHostName=.*$/DBHostName=$2/" $TEMPLATES/mysql.txt > /tmp/mysql.txt
-        exit 0
-    fi
-
-
-if [ -f /etc/systemconfig ]
-then
-    . /etc/systemconfig
-    setup_MYTH_vars
-TEMPNET="Hostip"$default_interface
-echo $TEMPNET
-eval MYTHIP=\$${TEMPNET}
-else
-    echo "could not find /etc/systemconfig"
-    exit 1
-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
-
-}
-
-
-#-----------------------------------------------------
-
-
-function setupmysql  {
-#setup mysql.txt to find the database servers
-echo "running setup mysql"
-        if [ $SystemType = "Master_backend" ]
-        then
-            if [ $MYTHDHCP = 0 ]
-            then
-                #this grabs eth0, as that is all thats supported.
-#                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_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_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
-        fi
-
-        if [ $SystemType = "Slave_backend" ]
-        then
-            if [ $MYTHDHCP = 0 ]
-            then
-                #this grabs eth0, as that is all thats supported.
-                #slavehost=`ifconfig  | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'|head -n1`
-                slavehost=`ifconfig  | grep -C1 $default_interface| grep -v $default_interface | cut -d: -f2 | awk '{ print $1}'`
-                ##logic to change backend_serverip in db
-                ${BASE}${MV_ROOT}/bin/restore_default_settings.sh  -c BECONFIG -s slave  -a $slavehost
-            else
-                slavehost=$MYTHIP
-
-                #logic to change backend_serverif in db
-                ${BASE}${MV_ROOT}/bin/restore_default_settings.sh -c BECONFIG -s slave  -a $slavehost
-            fi
-        fi
-
-        MYSQLTXT=${BASE}/usr/share/mythtv/mysql.txt
-        if [ $SystemType = "Standalone" ]
-        then
-            sed -e "s/^DBHostName=.*$/DBHostName="localhost"/" $TEMPLATES/mysql.txt > $MYSQLTXT
-        else
-            sed -e "s/^DBHostName=.*$/DBHostName=$dbhost/" $TEMPLATES/mysql.txt > $MYSQLTXT
-        fi
-        rm ${BASE}/home/mythtv/.mythtv/mysql.txt
-        rm ${BASE}${MV_ROOT}/bin/mythtv/.mythtv/mysql.txt
-        if [ -f ${BASE}/home/mythtv/templates/mysql.txt ]
-        then
-            cp_and_log ${BASE}/home/mythtv/templates/mysql.txt $MYSQLTXT
-        fi
-
-        chmod 755 $MYSQLTXT
-        chown mythtv $MYSQLTXT
-
-}
-
-function setupmysqlnetwork(){
-MFILE=etc/my.cnf
-grep "#skip-networking" $BASE/$MFILE
-status=$?
-
-
-
-    if [ $SystemType = "Standalone" ]
-        then
-            sed -ie "s/^#skip-networking/skip-networking/g" $BASE/$MFILE
-            if [ $status = 0 ]
-            then
-                sudo sv restart mysql
-            echo "restarting mysql with   no network"
-            fi
-
-        fi
-
-    if [ $SystemType = "Master_backend" ]
-    then
-        sed -ie "s/^skip-networking/#skip-networking/g" $BASE/$MFILE
-            if [ $status = 1 ]
-            then
-                sudo sv restart mysql
-                echo "restarting mysql with  network"
-            fi
-
-    fi
-
-
-}
-
-
-function settimezone {
-#set the timezone
-if [  x"$timezone" = x ]
-then
-    timezone="unknown"
-fi
-rm ${BASE}/etc/localtime
-echo $timezone
-ln -s "/usr/share/zoneinfo/$timezone"  ${BASE}/etc/localtime
-        sed -e "s~^TIMEZONE=.*$~TIMEZONE=\"${timezone}\"~" ${BASE}/etc/rc.conf > $TEMPLATES/rc.conf
-
-
-if [ -f ${BASE}/etc/php/php.ini ]
-then
-    echo "changing timezone in php.ini"
-    sed -i "s/^.*date.timezone.*$/date.timezone=${timezone}/" ${BASE}/etc/php/php.ini
-fi
-
-
-
-cp_and_log $TEMPLATES/rc.conf ${BASE}/etc/rc.conf
-#Check for Atomic Ant
-if grep disablemodules=agpart,intel_agp /proc/cmdline >/dev/null
-then
-    cat /etc/rc.conf |  sed -e '/MOD_BLACKLIST/ c\MOD_BLACKLIST=($ALSABLACKLIST agpart intel_agp)' > /etc/rc.conf.aa
-    mv /etc/rc.conf /etc/rc.conf.preaa
-    mv /etc/rc.conf.aa /etc/rc.conf
-# else
-# 	exit 1
-fi
-
-}
-
-
-# function setupreceiver {
-# case $ReceiverType in
-#     tinker) echo "do nothing"
-#             ;;
-#     Serial) echo "setup serial lirc"
-#             sed -i -e '/.*#lirc/d' ${BASE}/etc/modules.mythvantage
-#             echo "lirc_serial   #lirc" >> ${BASE}/etc/modules.mythvantage
-#             load-modules-mythvantage.sh
-#             ;;
-#     Usb-imon) echo "setup receiver-usb-imon"
-#             sed -i -e '/.*#lirc/d' ${BASE}/etc/modules.mythvantage
-#             echo "lirc_imon     #lirc" >> ${BASE}/etc/modules.mythvantage
-#             load-modules-mythvantage.sh
-#             ;;
-# 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_and_log $TEMPLATES/modules/lirc_i2c.conf ${BASE}/etc/modprobe.d/lirc_i2c.conf
-#             rmmod lirc_i2c 2>/dev/null
-#             load-modules-mythvantage.sh
-#             ;;
-#         *)   sed -i -e '/.*#lirc/d' ${BASE}/etc/modules.mythvantage
-#             ;;
-#     esac
-#
-#
-# }
-
-
-function setupevrouter {
-    if [  x$UseEvrouter  = x1 ]
-    then
-        case x$EvrouterConfig in
-            xtinker )
-                    echo "do nothing for evrouter"
-                    ;;
-                x ) echo "empty evrouter"
-                    ;;
-                * ) echo "setup evrouter for $EvrouterConfig "
-                    cp_and_log $TEMPLATES/evrouter/$EvrouterConfig /etc/evrouter.cfg
-                    daemon_add="evrouter Xvfb $daemon_add"
-
-                    ;;
-        esac
-    else
-    # disable evrouter
-    daemon_remove="evrouter Xvfb $daemon_remove"
-    fi
-
-
-
-
-}
-
-
-
-function scrubnfs {
-    cp_and_log /etc/fstab $TEMPLATES/fstab.conf.template
-
-   sed '/^#STARTSCRUB.*$/,/^#ENDSCRUB.*$/d'  $TEMPLATES/fstab.conf.template > ${BASE}/etc/fstab
-}
-
-function setupfstab () {
-#    	setupfstab $NFSserver $NFSshare $NFSmount
-        echo "#STARTSCRUB --------------anything in this block will be scrubbed" >>  ${BASE}/etc/fstab
-        echo "$1 $2  nfs" >> ${BASE}/etc/fstab
-        if [ ! -e "$2" ]
-        then
-        mkdir -p "$2"
-        chown mythtv:mythtv "$2"
-        fi
-        if [ x$DCONFIG = x  ]
-        then
-            mount $2 &
-        fi
-        echo "#ENDSCRUB" >> ${BASE}/etc/fstab
-}
-
-function setupncidclient
-{
-    sed -e "s/^set Host.*$/set Host $dbhost /" $TEMPLATES/ncid.conf.template >${BASE}/etc/ncid/ncid.conf
-}
-
-function setupnciddaemon {
-    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
-
-}
-
-function setupntp () {
-        #this is used for backend or standlone types
-        if [  $1 = "1" ]
-                then
-                        #MBE/STD use deafult
-                        echo "Not changing ntp config"
-                else
-                        #echo "server $dbhost" >> ${BASE}/etc/ntp.conf
-                        echo "setting ntp to $dbhost"
-                        sed -i "s/pool.ntp.org/$dbhost/g" ${BASE}/etc/ntp.conf
-                fi
-
-
-}
-
-function setupplugins (){
-
-pkglistinstall=""
-pkglistremove=""
-#default enabled
-for i in mythcontrols mythgallery mythmovies mythmusic mythsmolt mythvideo
-do
-    eval pkgvalue=\$${i}
-    if [ x$pkgvalue = x ]
-    then
-        pkglistinstall="$pkglistinstall $i$postfix"
-    else
-        if [ x$pkgvalue = x1 ]
-        then
-            pkglistinstall="$pkglistinstall $i$postfix"
-        else
-            pkglistremove="$pkglistremove $i$postfix"
-        fi
-    fi
-done
-
-#default disabled
-for i in mythphone mytharchive mythbrowser mythnews mythgame mythflix mythweather mythappletrailers mythstream mythvodka
-do
-    eval pkgvalue=\$${i}
-    if [ x$pkgvalue = x ]
-    then
-        pkglistremove="$pkglistremove $i$postfix"
-    else
-        if [ x$pkgvalue = x1 ]
-        then
-            pkglistinstall="$pkglistinstall $i$postfix"
-        else
-            pkglistremove="$pkglistremove $i$postfix"
-        fi
-    fi
-done
-#everything else
-for i in  miro xe romdb xine dvdcss webmin
-do
-    eval pkgvalue=\$${i}
-    case $i in
-        xine)
-                if [ x$pkgvalue = x1 ]
-                then
-                    pkglistinstall="$pkglistinstall xine-ui"
-                else
-                    pkglistremove="$pkglistremove xine-ui"
-                fi
-            ;;
-        dvdcss)
-                if [ x$pkgvalue = x1 ]
-                then
-                    pkglistinstall="$pkglistinstall libdvdcss"
-                else
-                    pkglistremove="$pkglistremove libdvdcss"
-                fi
-            ;;
-        webmin)
-                ##Daemon_add is here because webmin is on the software page instead of the advanced screen
-                if [ x$pkgvalue = x1 ]
-                then
-                    pkglistinstall="$pkglistinstall webmin"
-                    daemon_add="webmin $daemon_add"
-                else
-                    pkglistremove="$pkglistremove webmin"
-                    daemon_remove="webmin $daemon_remove"
-                fi
-                ;;
-        *)
-            if [ x$pkgvalue = x1 ]
-            then
-                pkglistinstall="$pkglistinstall $i"
-            else
-                pkglistremove="$pkglistremove $i"
-            fi
-        ;;
-esac
-
-done
-
-
-install="$pkglistinstall $install"
-remove="$pkglistremove $remove"
-
-}
-
-function LCDcheck () {
-case x$LCDtype in
-    xtinker) echo "do nothing lcd "
-            ;;
-    xno_lcd) echo "no  lcd "
-                    ;;
-    xxosd) install="xosd lcdproc $install"
-            ;;
-        x) echo "lcd empty "
-        ;;
-*)
-    install="lcdproc $install"
-    ;;
-esac
-}
-
-
-function packages () {
-#see which plugins need to be installed
-echo "  Starting to install Packages"
-setupplugins
-LCDcheck
-if [ ! -f $PKGBLACKLIST ]
-then
-    touch $PKGBLACKLIST
-fi
-    for i in $remove
-    do
-    if [ ! x$i = xnone ]
-    then
-        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" ]
-                    then
-                    pacman --noconfirm -R mythweb$postfix
-                    echo removed $i
-                    else
-                    pacman --noconfirm -Rs $i
-                    echo removed $i
-                    fi
-            fi
-        else
-            echo "$i is black listed"
-        fi
-    fi
-    done
-
-
-    for i in $install
-    do
-    if [ ! x$i = xnone ]
-    then
-        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"
-        fi
-    fi
-    done
-}
-
-function daemons {
-echo "Daemons on boot"
-
-    for i in $daemon_remove
-    do
-        sv check $i 1>/dev/null
-            status=$?
-    if [ $status -eq 0 ]
-    then
-        sv down $i
-    fi
-            remove_service.sh $i
-    done
-
-
-    for i in $daemon_add
-    do
-        sv check $i 1>/dev/null
-        status=$?
-        add_service.sh $i
-
-        if [ $status -eq 0 ]
-        then
-                    case $i in
-                        mysql*) sv hup $i
-                                        ;;
-                        mythback*) sv hup $i
-                                        ;;
-                        lirc* ) sv hup $i
-                                        ;;
-                        frontend) sv check frontend 1>/dev/null
-                                        ;;
-
-                        smbd ) sv hup $i
-                                        ;;
-                        nmbd ) sv hup $i
-                                        ;;
-                        evrouter) sv restart $i
-                                    ;;
-                    *)     sv down $i
-                            sleep 1
-                            sv up $i
-                        ;;
-            esac
-                fi
-
-        done
-
-}
-
-
-function services
-{
-ser_install=""
-ser_daemon_add=""
-ser_remove=""
-ser_daemon_remove=""
-if [ x$UseEvrouter = x1 ]
-then
-    ser_daemon_add="evrouter Xvfb $ser_daemon_add"
-else
-    ser_daemon_remove="evrouter Xvfb $ser_remove"
-fi
-
-if [ x$RunDHCP = x1 ]
-then
-        ser_daemon_add="dnsmasq  $ser_daemon_add"
-        ser_install="dnsmasq mvpmc  $ser_install"
-
-else
-        ser_daemon_remove="dnsmasq  $ser_daemon_remove"
-        ser_remove="dnsmasq mvpmc  $ser_remove"
-fi
-
-if [ x$RunFrontend = x1 ]
-then
-        ser_daemon_add="frontend hal   $ser_daemon_add"
-        ser_install=" $ser_install"
-        showX=true
-else
-        ser_daemon_remove="frontend hal  $ser_daemon_remove"
-        ser_remove="$ser_remove"
-fi
-
-if [ x$UseMythWEB = x1 ]
-then
-            ser_install="lighttpd  mythweb$postfix $ser_install"
-            ser_daemon_add="lighttpd $ser_daemon_add"
-else
-        ser_remove="mythweb$postfix $ser_remove"
-        ser_daemon_remove="$ser_daemon_remove"
-fi
-
-#samba
-if [ x$UseSamba = x1 ]
-then
-        ser_install="samba $ser_install"
-        ser_daemon_add="nmbd smbd $ser_daemon_add "
-        if [ x$Samba_mediareadonly = x1 ]
-            then
-                smreadonly="no"
-                else
-                smreadonly="yes"
-        fi
-
-        if [ x$Samba_homereadonly = x1 ]
-            then
-                shreadonly="no"
-                else
-                shreadonly="yes"
-        fi
-
-        if [ ! -d ${BASE}/etc/samba ]
-        then
-            mkdir ${BASE}/etc/samba
-        fi
-
-        if [  -f ${MYTHHOME}/templates/smb.conf  ]
-        then
-            install -D -m755  ${MYTHHOME}/templates/smb.conf   ${BASE}/etc/samba/smb.conf
-        else
-            sed -e "s/^.*workgroup =.*$/ workgroup = $Samba_domain/g " \
-                -e "s/^.*server string = .*$/ server string = $hostname/g" $TEMPLATES/samba/smb.conf.template > ${BASE}/etc/samba/smb.conf
-
-            if [ x$Samba_media = "x1" ]
-            then
-                echo "include =  /etc/samba/smb.conf.media" >> ${BASE}/etc/samba/smb.conf
-                sed -e "s/^.*writeable.*$/writeable = $smreadonly/g" $TEMPLATES/samba/smb.conf.media > ${BASE}/etc/samba/smb.conf.media
-            fi
-
-            if [ x$Samba_home = "x1" ]
-            then
-                echo "include =  /etc/samba/smb.conf.home" >> ${BASE}/etc/samba/smb.conf
-                sed -e "s/^.*writeable.*$/writeable = $shreadonly/g" $TEMPLATES/samba/smb.conf.home > ${BASE}/etc/samba/smb.conf.home
-
-            fi
-
-        fi
-else
-        ser_remove="samba $ser_remove"
-        ser_install="smbclient $ser_install"
-        ser_daemon_remove="smbd nmbd  $ser_daemon_remove"
-fi
-
-
-if [ x$UseNFS = x1 ]
-then
-    ser_install="nfs-utils portmap $ser_install"
-    ser_daemon_add="nfsd nfs-utils portmap $ser_daemon_add"
-    sed -e "s/REPLACEME/*/g" $TEMPLATES/exports.template > ${BASE}/etc/exports
-
-else
-    ser_remove="$ser_remove"
-    ser_daemon_remove="nfsd  $ser_daemon_remove"
-fi
-
-if [ x$Runncidd = x1 ]
-then
-        ser_daemon_add="ncidd ncid $ser_daemon_add"
-        ser_install="ncid $ser_install"
-else
-        ser_daemon_remove="ncidd ncid $ser_daemon_remove"
-        ser_remove="ncid $ser_remove"
-fi
-
-
-if [ x$UseEvrouter = x1 ]
-then
-        ser_install="evrouter Xvfb $ser_install"
-else
-        ser_remove="evrouter $ser_remove"
-fi
-
-
-if [ x$DDnsEnable = x1 ]
-then
-        ser_daemon_add="inadyn $ser_daemon_add"
-        ser_install="inadyn $ser_install"
-else
-        ser_daemon_remove="inadyn $ser_daemon_remove"
-        ser_remove="inadyn $ser_remove"
-fi
-
-case x$Screensavertype in
-    xxscreensaver)   ser_install="xscreensaver $ser_install"
-                    ser_remove="gnome-screensaver $ser_remove"
-                ;;
-    xgscreensaver)  ser_install="xscreensaver gnome-screensaver $ser_install"
-
-                ;;
-    xnone) ser_remove="gnome-screensaver xscreensaver $ser_remove"
-                ;;
-
-    xtinker) echo "tinker mode for screensaver"
-    ;;
-
-    esac
-
-
-
-#Setting the default, just to avoid the or statement..
-#if [ x$UseHobbit = x ]
-#then
-#    UseHobbit=0
-#fi
-
-#if [ x$UseHobbit = x1 ]
-#then
-#    case $SystemType in
-#        Standalone|Master_backend )
-#           ser_daemon_add="hobbit $ser_daemon_add"
-#           ser_install="hobbitserver $ser_install"
-#        ;;
-#
-#        *)   ser_daemon_add="hobbit-client $ser_daemon_add"
-#              ser_install="hobbit-client $ser_install"
-#        ;;
-#        esac
-#else
-#           ser_daemon_remove="hobbit hobbit-client $ser_daemon_remove"
-#           ser_remove="hobbit-client hobbitserver $ser_remove"
-#            rm -f /data/srv/httpd/htdocs/hobbit/index.html
-#
-# fi
-
-
-
-}
-
-
-
-function setupsleep {
-if [ x$AutoShutdown = x1  ]
-then
-    cronshutdowntime=""
-    if  [ x$Shutdowntime != x-1 ]
-    then
-        cronshutdowntime=$Shutdowntime
-    fi
-    if [ x$Shutdowntime2 != x-1 ]
-    then
-        if [ x$cronshutdowntime = x ]
-        then
-            cronshutdowntime=$Shutdowntime2
-        else
-            cronshutdowntime="${cronshutdowntime},${Shutdowntime2}"
-        fi
-    fi
-
-    sed -e "s/HOUR/$cronshutdowntime/g" $TEMPLATES/cron.template | crontab - -u mythtv
-else
-    sed -e "/00 HOUR.*/d" $TEMPLATES/cron.template | crontab - -u mythtv
-fi
-
-}
-
-
-function setuppacman () {
-#setup link to httpd dir
-echo "Configuring pacman"
-if [ ! x$1 = x ]
-    then
-        ln -s ${BASE}/data/var ${BASE}/data/srv/httpd/htdocs/repo
-        echo "creating the link for the pacman repo mirror"
-    fi
-
-    for i in mv-core mv-core-testing mv-extra mv-extra-testing
-    do
-        echo "[$i]"  > ${BASE}/etc/pacman.d/$i
-        #add mirror if needed
-        if [ x$PKG_MIRROR = x1 ]
-        then
-            echo " Server = http://$dbhost/repo/$i " >> ${BASE}/etc/pacman.d/$i
-        fi
-        #add user templates
-        USERTEMPLATES="/data/home/mythtv/templates"
-        if [ -f $USERTEMPLATES/sources/$i ]
-        then
-            echo "Adding user  $i"
-            cat $USERTEMPLATES/sources/$i  >> ${BASE}/etc/pacman.d/$i
-        fi
-        cat $TEMPLATES/sources/$i  >> ${BASE}/etc/pacman.d/$i
-        echo "setting local mirror to $dbhost for $i "
-    done
-
-    #sed -e "s/REPLACEME/$dbhost/g"  $TEMPLATES/sources/svc_pkg > /etc/pacman.d/svc_pkg
-
-
-}
-
-
-function setupzipcode () {
-    if [ ! x$zipcode = x ]
-    then
-        ${MV_ROOT}/bin/restore_default_settings.sh -c ZIP  -z $zipcode
-    #Let's also speed things up for those in North America
-    mkdir /usr/bin/perlbin/vendor/tv_grabbers_non_na
-    mv /usr/bin/perlbin/vendor/tv_grab_*  /usr/bin/perlbin/vendor/tv_grabbers_non_na
-    mv  /usr/bin/perlbin/vendor/tv_grabbers_non_na/tv_grab_na*  /usr/bin/perlbin/vendor/
-    fi
-}
-
-function process_nfsmap () {
-#first look for a local copy of nfsmap
-if [ $1 = noip ]
-then
-    if [ -f /data/home/mythtv/templates/nfsmap ]
-    then
-        NFSMAP="/data/home/mythtv/templates/nfsmap"
-    else
-        mv -f /tmp/nfsmap /tmp/nfsmap.old
-        wget -O /tmp/nfsmap http://$dbhost:1337/templates/nfsmap
-        if [ $? = 0 ]
-        then
-            NFSMAP="/tmp/nfsmap"
-        fi
-    fi
-else
-        mv -f /tmp/nfsmap /tmp/nfsmap.old
-        wget -O /tmp/nfsmap http://$1:1337/templates/nfsmap
-        if [ $? = 0 ]
-        then
-            NFSMAP="/tmp/nfsmap"
-        fi
-fi
-
-    if [ -f $NFSMAP ]
-    then
-        #read in file
-        while read line
-        do
-            NFSserver=`echo "$line"|cut -d" " -f1`
-            NFSmount=`echo "$line"|cut  -d" " -f2`
-            setupfstab $NFSserver $NFSmount
-        done <$NFSMAP
-    else
-        echo "couldn't find nfsmap"
-
-    fi
-}
-
-function setupcnfs () {
-    scrubnfs
-        if [ $HaveCentralNFS = "yes" ]
-    then
-            case x$NFSserver in
-                xfile:nfsmap )
-                                process_nfsmap noip
-                                ;;
-            *:nfsmap )
-                                nfsmapip=`echo "$NFSserver" | cut -d: -f1 `
-                                process_nfsmap $nfsmapip
-                                ;;
-                *)  setupfstab $NFSserver $NFSmount
-                esac
-
-        #if [ ! x"$NFSserver" = "xfile:nfsmap" ]
-            #then
-            #    setupfstab $NFSserver $NFSmount
-            #else
-            #    process_nfsmap
-            #fi
-        else
-            echo "fe_nfs"
-            #if no central nfs found, then use the mbe.
-            if [ $SystemType = "Frontend_only" ]
-            then
-                setupfstab ${dbhost}:/myth /myth
-            fi
-    fi
-
-}
-
-function setupbootsplash () {
-
-if  [ x$Usebootsplash = x1 ]
-then
-    COMMAND="%s/^default.*0/default 1/g"
-else
-    COMMAND="%s/^default.*1/default 0/g"
-fi
-
-ex ${BASE}/boot/grub/menu.lst <<EOF
-:$COMMAND
-:wq
-EOF
-
-}
-
-function setuphobbitclient () {
-COMMAND="%s/^BBDISP=.*$/BBDISP=$dbhost/g"
-
-
-ex ${BASE}/data/srv/hobbit/client/etc/hobbitclient.cfg <<EOF
-:$COMMAND
-:wq
-EOF
-
-}
-
-function setupSyslog () {
-COMMAND="%s/^destination d_remote.*$/destination d_remote \{tcp\(\"${dbhost}\" port\(514\)\) \;\} \;/"
-ex ${BASE}/etc/syslog-ng.conf <<EOF
-:$COMMAND
-:wq
-EOF
-
-
-
-
-}
-
-function setupfuncminion () {
-COMMAND="%s/^certmaster.*$/certmaster = ${dbhost}/"
-ex ${BASE}/etc/func/minion.conf <<EOF
-:$COMMAND
-:wq
-EOF
-}
-
-function setupDNSMASQ(){
-if [ x$RunDHCP = x1   ]
-then
-    echo "DNSMASQ setup"
-
-#set default route to my GW
-COMMAND="%s/^dhcp-option=3.*$/dhcp-option=3,${route}/"
-ex ${BASE}/etc/dnsmasq.conf <<EOF
-:$COMMAND
-:wq
-EOF
-
-#setup dns to my ip
-COMMAND="%s/^dhcp-option=6.*$/dhcp-option=6,${ip}/"
-ex ${BASE}/etc/dnsmasq.conf <<EOF
-:$COMMAND
-:wq
-EOF
-
-
-#change nfsroot to my ip
-COMMAND="%s/nfsroot=.*:/nfsroot=${ip}:/"
-ex ${BASE}/data/srv/tftp/pxelinux.cfg/default <<EOF
-:$COMMAND
-:wq
-EOF
-
-#add 127.0.0.1 to /etc/resolv.conf
-        echo "search lan" > ${BASE}/etc/resolv.conf
-        echo "nameserver 127.0.0.1" >> ${BASE}/etc/resolv.conf
-        echo "nameserver $nameserver" >> ${BASE}/etc/resolv.conf
-fi
-
-#setup dongle.config
-COMMAND="%s/mvpmc -f .*/mvpmc -f \/etc\/helvR10.fon -s ${ip} \& /"
-ex ${BASE}/data/srv/tftp/dongle.bin.config <<EOF
-:$COMMAND
-:wq
-EOF
-
-
-
-#setup dongle.config
-
-}
-
-function reloadfe(){
-PID=`ps -ef |grep mythfrontend|grep -v grep |awk  '{print $2 }'`
-/usr/bin/backend_control.sh  clearcache  behost $dbhost
-if [ x$RESTART_LCD = xtrue ]
-then
-    killall -9 mythlcdserver
-fi
-if [  x = x$PID ]
-then
-    echo "Mythfrontend not running, will not reload"
-else
-        kill -s USR1 $PID
-fi
-exit 0
-
-}
-
-
-function setup_db (){
-
-            install="mysql avahi"
-            daemon_add="mysql"
-            packages
-            daemons
-status=1
-mysqlstatus=1
-while [ ! $status = 0  ]
-do
-    sv stop mysql
-    sleep 1
-    sv  start mysql
-    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
-            if [ $SystemType = "Master_backend" ]
-            then
-                $MV_ROOT/bin/restore_default_settings.sh  -c  BECONFIG  -s master  -a $dbhost
-            fi
-            #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 ]
-    then
-        pacman --noconfirm -R webcalendar
-            pacman --noconfirm --nodeps  -S webcalendar
-        status=0
-    fi
-    fi
-    fi
-done
-}
-
-function setup_web_auth {
-    if [ x$UseMythWEB_auth = x1 ]
-    then
-        #enable auth
-        sed -ie "s/^.*include.*auth-inc.conf.*$/include \"\/etc\/lighttpd\/auth-inc.conf\"/g" /etc/lighttpd/lighttpd.conf
-    else
-        #disable auth
-        sed -ie "s/^.*include.*auth-inc.conf.*$/#include \"\/etc\/lighttpd\/auth-inc.conf\"/g" /etc/lighttpd/lighttpd.conf
-    fi
-    sudo sv restart lighttpd
-
-}
-
-
-function mplayer_saver_check () {
-    if [ ! -f $BASE/etc/mplayer/mplayer.conf ]
-    then
-        mkdir -p $BASE/etc/mplayer
-        touch $BASE/etc/mplayer/mplayer.conf
-        #cp -f $TEMPLATES/mplayer.conf.template $BASE/etc/mplayer/mplayer.conf
-    fi
-    grep -q stop-xscreensaver  $BASE/etc/mplayer/mplayer.conf
-    if [ $? = 0 ]
-    then
-        sed -i "s/^.*stop-xscreensaver.*$/stop-xscreensaver = 1 / g" $BASE/etc/mplayer/mplayer.conf
-    else
-        echo  stop-xscreensaver = 1 >> $BASE/etc/mplayer/mplayer.conf
-    fi
-    grep -q heartbeat-cmd  $BASE/etc/mplayer/mplayer.conf
-    if [ $? = 0 ]
-    then
-       sed -i '/^.*heartbeat-cmd.*$/d' $BASE/etc/mplayer/mplayer.conf
-       #sed -i "s/^.*heartbeat-cmd.*$/heartbeat-cmd=\"$1\"/ g" $BASE/etc/mplayer/mplayer.conf
-    fi
-    echo  "heartbeat-cmd = \"$1\"" >> $BASE/etc/mplayer/mplayer.conf
-}
-
-
-
-function killxscreensaver {
-    xscreensaver-command --exit &
-    killall xscreensaver &
-}
-
-function killgscreensaver(){
-    gnome-screensaver-command --exit &
-    killall gnome-screensaver &
-}
-
-
-function setupscreensaver {
-#copy in template
-
-case x$Screensavertype in
-    xxscreensaver)
-                killgscreensaver
-                #why can't it have a nice conf tool like gconf
-                if [ ! -f  $MYTHHOME/.xscreensaver ]
-                then
-                    #copy in template
-                    cp -f $TEMPLATES/xscreensaver.template $MYTHHOME/.xscreensaver
-                fi
-                #change the idle
-                    sed -i "s/^timeout.*$/timeout:    0:$Screensaveridle:00/g" $MYTHHOME/.xscreensaver
-
-                #set the mode
-                    case x$Screensavertheme in
-                    xRandom)
-                      sed -i "s/^mode.*$/mode:     random/g" $MYTHHOME/.xscreensaver
-                    ;;
-                    xBlank)
-                        sed -i "s/^mode.*$/mode:    blank/g" $MYTHHOME/.xscreensaver
-                    ;;
-                    *)  sed -i "s/^mode.*$/mode:    one/g" $MYTHHOME/.xscreensaver
-                        #set the theme
-                        start=`awk '/programs/{print NR" "}' $MYTHHOME/.xscreensaver`
-                        ss=`awk  '/'$Screensavertheme'/{print NR" "}' $MYTHHOME/.xscreensaver`
-                        sspos=$((ss-start-1))
-                        sed -i "s/^selected.*$/selected:   $sspos/g" $MYTHHOME/.xscreensaver
-
-                    ;;
-                 esac
-                mplayer_saver_check "/usr/bin/xscreensaver-command -deactivate &"
-                ;;
-    xgscreensaver)
-                gconftool-2 --direct   --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory  --type bool   --set /apps/gnome-screensaver/lock_enabled false
-                gconftool-2 --direct  --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory  --type int -s "/apps/gnome-screensaver/idle_delay" $Screensaveridle
-                gconftool-2 --direct  --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory  --type string -s "/apps/gnome-screensaver/mode" single
-
-                case x$Screensavertheme in
-                    xRandom)
-                        gconftool-2 --direct  --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory  --type string -s "/apps/gnome-screensaver/mode" random
-
-                    ;;
-                    xBlank)
-                        gconftool-2 --direct  --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory  --type string -s "/apps/gnome-screensaver/themes" blank
-                    ;;
-
-                    *)
-                     gconftool-2  --direct  --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory --set --type list --list-type=string /apps/gnome-screensaver/themes [screensavers-$Screensavertheme]
-                     ;;
-                 esac
-                mplayer_saver_check "/usr/bin/gnome-screensaver-command -p &"
-                killxscreensaver
-                ;;
-    xnone)       killgscreensaver
-                killxscreensaver
-                ;;
-
-    xtinker) echo "tinker mode for setupscreensaver"
-    ;;
-
-    esac
-
-#
-# #start it if not already running.
-#     if [ x$XScreensaver = x1 ]
-#     then
-#         #check if it's running, it not start it.
-#         if [ ! x$MV_NEW_INSTALL = "xtrue" ]
-#         then
-#             su - mythtv -c "/usr/bin/gnome-screensaver "
-#         fi
-#     else
-#         #kill it
-#         gnome-screensaver-command --exit &
-#         killall gnome-screensaver &
-#     fi
-
-
-
-}
-#----------------------------------------------------MAIN PROGRAM-------------------------------------------
-#misc,sleep,hostype,advanced,audio
-eval LAST=\$$#
-LIST=`echo $LAST | tr , " " `
-
-hosttypechange="false"
-
-
-for i in  $LIST
-do
-echo $i
-case $i in
-    misc) showmisc="true"
-        ;;
-    sleep) showsleep="true"
-        ;;
-    hostype) showhost="true"
-            showX="true"
-        ;;
-    hostypec) hosttypechange="true"
-            ;;
-    advanced) showadvanced="true"
-        ;;
-    audio) showaudio="true"
-        ;;
-    network) shownetwork="true"
-        ;;
-    advancedX)  showX="true"
-        ;;
-    webuser)  setup_web_auth
-        ;;
-    restartfe)  killall -9 mythfrontend
-                killall -9 mythwelcome
-                exit 0
-        ;;
-    reloadfe)  reloadfe
-        ;;
-    ddns) services
-        install=$ser_install
-        remove=$ser_remove
-        daemon_add=$ser_daemon_add
-        daemon_remove=$ser_daemon_remove
-        ;;
-     screensaver)
-        services
-        install=$ser_install
-        remove=$ser_remove
-        daemon_add=$ser_daemon_add
-        daemon_remove=$ser_daemon_remove
-        showscreensaver="true"
-        ;;
-     ir)
-        showir="true"
-        ;;
-
-    this_is_install) MV_NEW_INSTALL="true"
-        ;;
-    user)
-            if [ x$rootSSH = "x1" ]
-            then
-                sed -i "s/^.*PermitRootLogin.*$/PermitRootLogin yes/" $BASE/etc/ssh/sshd_config
-            else
-                sed -i "s/^.*PermitRootLogin.*$/PermitRootLogin no/" $BASE/etc/ssh/sshd_config
-            fi
-            sv hup sshd
-        ;;
-    esac
-done
-
-if [ x$MV_NEW_INSTALL = xtrue ]
-then
-    hosttypechange="false"
-fi
-
-
-
-#  exit 1
-
-#network
-if [ x"$shownetwork" = xtrue ]
-then
-    OLDHOSTNAME=`hostname`
-    NEWHOSTNAME=$hostname
-    if [ ! $OLDHOSTNAME = $NEWHOSTNAME ]
-    then
-
-    ${MV_ROOT}/bin/restore_default_settings.sh  -cuhostname -o -h$OLDHOSTNAME
-    RESTART_FE="true"
-    hostname $NEWHOSTNAME
-    if [ $SystemType != "Frontend_only" ]
-    then
-        sv restart mythbackend
-    fi
-
-    fi
-
-    setup_network
-    CMDLINE=$(cat /proc/cmdline)
-    echo $CMDLINE |grep -q netboot
-    NETBOOT=$?
-    if [   x$NETBOOT = x1  ]
-        then
-            echo "loading network"
-            ${BASE}/etc/net/scripts/network.init reload
-            ${BASE}/etc/net/scripts/network.init restart
-        else
-            echo "netboot, will not start network"
-        fi
-fi
-
-
-if [ x$showhost = "xtrue" ]
-then
-    . $MV_ROOT/bin/ir_config.sh
-    setupir
-    case $SystemType in
-        Standalone)
-                setupntp 1
-                services
-
-                if [ x$hosttypechange = "xtrue" ]
-                then
-                    setup_db
-                fi
-                if [ -f   ${BASE}/etc/avahi/services/mysql.service     ]
-                then
-                            rm -f ${BASE}/etc/avahi/services/mysql.service
-                            sudo sv restart avahi
-                fi
-
-                install="mysql mythdb-initial  avahi portmap nfs-utils local-website $ser_install"
-                remove="none $ser_remove"
-
-                daemon_add="mysql  mythbackend  avahi portmap nfs-utils netfs lighttpd $ser_daemon_add"
-                daemon_remove="none $ser_daemon_remove"
-
-                ;;
-        Master_backend)
-                setupntp 1
-                services
-
-                if [  !  -f   ${BASE}/etc/avahi/services/mysql.service     ]
-                then
-                            mkdir  ${BASE}/etc/avahi/services
-                            cp $TEMPLATES/mysql.service  ${BASE}/etc/avahi/services/mysql.service
-                            sudo sv restart  avahi
-                fi
-
-                install="mysql  mythdb-initial avahi portmap nfs-utils local-website myth2ipod mythtv-status $ser_install  "
-                remove="$ser_remove"
-
-                daemon_add="mysql mythbackend  avahi   portmap nfs-utils netfs lighttpd $ser_daemon_add"
-                daemon_remove="$ser_daemon_remove"
-                ;;
-        Slave_backend)
-                setupntp 0
-                services
-                if [ x$hosttypechange = "xtrue" ]
-                then
-                setup_db
-                fi
-                if [    -f   ${BASE}/etc/avahi/services/mysql.service     ]
-                then
-                            rm -f ${BASE}/etc/avahi/services/mysql.service
-                            sudo sv restart  avahi
-                fi
-
-                #cp $TEMPLATES/mysql.service  ${BASE}/etc/avahi/services/mysql.service
-                install="mysql  avahi  local-website portmap nfs-utils $ser_install  "
-                remove=" $ser_remove"
-
-                daemon_add="mythbackend avahi portmap nfs-utils netfs lighttpd $ser_daemon_add"
-                daemon_remove="$ser_daemon_remove"
-                ;;
-        Frontend_only)
-            #Add values for services
-            setupntp 0
-            services
-            if [  -f   ${BASE}/etc/avahi/services/mysql.service     ]
-                then
-                            rm -f ${BASE}/etc/avahi/services/mysql.service
-                            sudo sv restart  avahi
-                fi
-
-            install="libmysqlclient mysql-clients portmap nfs-utils avahi local-website $ser_install"
-            remove="mysql mythweb$postfix $ser_remove"
-
-            daemon_add="avahi portmap nfs-utils netfs lighttpd $ser_daemon_add "
-            daemon_remove="mysql   mythbackend  $ser_daemon_remove"
-    ;;
-    esac
-    #setupSyslog
-
-fi
-
-#apply these to ALL types
-
-
-
-
-#systemtype
-
-if [ x$showhost = "xtrue" ]
-then
-    setupmysqlnetwork
-    setupmysql
-
-    #setupremote
-    #REMOTE FIND ME JM
-
-    #grab the new dbhost key
-    #/usr/bin/grabkey.py
-fi
-
-#audio
-
-if [ x$showaudio = "xtrue" ]
-then
-    #setupsoundtype
-    if [ ! x$Audiotype = xtinker  ]
-    then
-        ${MV_ROOT}/bin/soundconfig.sh -t real -i $Audiotype -d $SoundDevice
-    fi
-fi
-
-#should always run
-packages
-
-#misc
-
-if [ x$showmisc = "xtrue" ]
-then
-    setupzipcode
-    settimezone
-    setupcnfs
-fi
-
-#sleep
-if [ x$showsleep = "xtrue" ]
-then
-    setupsleep
-fi
-
-if [ x$showX = "xtrue" ]
-then
-    ${MV_ROOT}/bin/xconfig.sh
-fi
-
-#advanced
-if [ x$showadvanced = "xtrue" ]
-then
-    if [ ! x$showhost = "xtrue" ]
-    then
-        services
-        install="none $ser_install"
-        remove="none $ser_remove"
-        daemon_add=" none $ser_daemon_add"
-        daemon_remove="none $ser_daemon_remove"
-        packages
-
-
-        if [ x$SystemType = xMaster_backend ]
-        then
-            setuppacman link
-            else
-            setuppacman
-        fi
-    fi
-    setupncidclient
-    setupnciddaemon
-    setupbootsplash
-    setuphobbitclient
-    #setupreceiver
-    setupevrouter
-    #setupblaster
-    #setupLCD
-    setupDNSMASQ
-
-
-
-fi
-
-if [ x$showscreensaver  = xtrue ]
-then
-     setupscreensaver
-fi
-
-if [ x$showir = xtrue ]
-then
-    . $MV_ROOT/bin/ir_config.sh
-    setupir
-fi
-
-daemons
-#add check for lcd, and restart if needed.
-
-if [ x$RESTART_FE = xtrue ]
-then
-    reloadfe
-fi
-
-
-
-
 
-case $SystemType in
-    Standalone)  smoltsystem=6
-                    MVRELEASE="$MVRELEASE  (Standalone)"
-                    ;;
-Master_backend)
-            if [ x$RunFrontend = x1 ]
-            then
-                smoltsystem=2
-                MVRELEASE="$MVRELEASE  (MBE with Frontend)"
-            else
-                smoltsystem=1
-                MVRELEASE="$MVRELEASE  (MBE)"
-            fi
-            ;;
-Slave_backend)
-            if [ x$RunFrontend = x1 ]
-            then
-                smoltsystem=5
-                MVRELEASE="$MVRELEASE  (SLAVE  with Frontend)"
-            else
-                smoltsystem=5
-                MVRELEASE="$MVRELEASE  (SLAVE)"
-            fi
-            ;;
-    Frontend_only)
-        smoltsystem=3
-        MVRELEASE="$MVRELEASE  ( Frontend only)"
-            ;;
-esac
-echo $MVRELEASE > /etc/os_myth_release
-echo "systemtype=$smoltsystem" > /home/mythtv/.mythtv/smolt.info 2>/dev/null
-echo "remote=$Remotetype" >> /home/mythtv/.mythtv/smolt.info 2>/dev/null
+systemconfig.py -m $@
 
-- 
cgit v0.12


From bb8e9844185c984a76049dddc087bdf347ff3c9f Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Thu, 4 Jun 2009 08:43:26 -0500
Subject: linhes-config:   minor cleanup of logging

---
 abs/core-testing/LinHES-config/PKGBUILD          |  15 ++-
 abs/core-testing/LinHES-config/mv_advanced.py    |   0
 abs/core-testing/LinHES-config/mv_common.py      |   0
 abs/core-testing/LinHES-config/mv_hostype.py     | 147 +++++++++++++++++++++++
 abs/core-testing/LinHES-config/mv_install.py     |  38 +++---
 abs/core-testing/LinHES-config/mv_ir.py          |   0
 abs/core-testing/LinHES-config/mv_misc.py        |  32 ++---
 abs/core-testing/LinHES-config/mv_network.py     |  14 +--
 abs/core-testing/LinHES-config/mv_screensaver.py |   0
 abs/core-testing/LinHES-config/mv_smolt.py       |   2 +-
 abs/core-testing/LinHES-config/mv_software.py    |   0
 abs/core-testing/LinHES-config/mv_webuser.py     |   0
 12 files changed, 206 insertions(+), 42 deletions(-)
 mode change 100644 => 100755 abs/core-testing/LinHES-config/mv_advanced.py
 mode change 100644 => 100755 abs/core-testing/LinHES-config/mv_common.py
 create mode 100755 abs/core-testing/LinHES-config/mv_hostype.py
 mode change 100644 => 100755 abs/core-testing/LinHES-config/mv_ir.py
 mode change 100644 => 100755 abs/core-testing/LinHES-config/mv_misc.py
 mode change 100644 => 100755 abs/core-testing/LinHES-config/mv_network.py
 mode change 100644 => 100755 abs/core-testing/LinHES-config/mv_screensaver.py
 mode change 100644 => 100755 abs/core-testing/LinHES-config/mv_smolt.py
 mode change 100644 => 100755 abs/core-testing/LinHES-config/mv_software.py
 mode change 100644 => 100755 abs/core-testing/LinHES-config/mv_webuser.py

diff --git a/abs/core-testing/LinHES-config/PKGBUILD b/abs/core-testing/LinHES-config/PKGBUILD
index a658e7e..58dcfd8 100755
--- a/abs/core-testing/LinHES-config/PKGBUILD
+++ b/abs/core-testing/LinHES-config/PKGBUILD
@@ -1,12 +1,12 @@
 pkgname=LinHES-config
 pkgver=1.0
-pkgrel=420
+pkgrel=429
 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 rsync python-parted )
 arch=('i686')
 
-source=(mv_install.py mv_config.py mythinstall.bin myth_user_call file_time_offset.py install-ui.xml install_proxy.sh install_functions.sh systemconfig.sh install_db_chroot.sh restore_default_settings.sh xconfig.sh timezip.py soundconfig.sh LinHES-release issue MythVantage.sh create_master.sh build_diskless.sh networkconfig.sh timezone.bin autocard.py restore_km_db_chroot.sh README ir_config.sh)
+source=(mv_install.py mv_config.py mythinstall.bin myth_user_call file_time_offset.py install-ui.xml install_proxy.sh install_functions.sh systemconfig.sh install_db_chroot.sh restore_default_settings.sh xconfig.sh timezip.py soundconfig.sh LinHES-release issue MythVantage.sh create_master.sh build_diskless.sh networkconfig.sh timezone.bin autocard.py restore_km_db_chroot.sh README ir_config.sh mv_advanced.py  mv_common.py   mv_ir.py  mv_misc.py  mv_network.py  mv_screensaver.py  mv_smolt.py  mv_software.py  mv_webuser.py mv_hostype.py systemconfig.py)
 
 install=LinHES.install
 build() {
@@ -38,6 +38,17 @@ build() {
     install -m 0755 autocard.py $MVDIR/bin/autocard.py
     install -m 0755 mv_config.py $MVDIR/bin/mv_config.py
     install -m 0755 mv_install.py $MVDIR/bin/mv_install.py
+    install -m 0755 mv_advanced.py  $MVDIR/bin/
+    install -m 0755 mv_common.py $MVDIR/bin/ 
+    install -m 0755 mv_ir.py  $MVDIR/bin/ 
+    install -m 0755 mv_misc.py  $MVDIR/bin/ 
+    install -m 0755 mv_network.py  $MVDIR/bin/ 
+    install -m 0755 mv_screensaver.py  $MVDIR/bin/ 
+    install -m 0755 mv_smolt.py  $MVDIR/bin/ 
+    install -m 0755 mv_software.py  $MVDIR/bin/ 
+    install -m 0755 mv_webuser.py $MVDIR/bin/ 
+    install -m 0755 mv_hostype.py $MVDIR/bin/ 
+    install -m 0755 systemconfig.py $MVDIR/bin/ 
 
     #README file displayed on install
     install -m 0755 README $MVDIR/README
diff --git a/abs/core-testing/LinHES-config/mv_advanced.py b/abs/core-testing/LinHES-config/mv_advanced.py
old mode 100644
new mode 100755
diff --git a/abs/core-testing/LinHES-config/mv_common.py b/abs/core-testing/LinHES-config/mv_common.py
old mode 100644
new mode 100755
diff --git a/abs/core-testing/LinHES-config/mv_hostype.py b/abs/core-testing/LinHES-config/mv_hostype.py
new file mode 100755
index 0000000..0bbd16e
--- /dev/null
+++ b/abs/core-testing/LinHES-config/mv_hostype.py
@@ -0,0 +1,147 @@
+# -*- coding: utf-8 -*-
+import logging, mv_common
+import os
+
+config_file = "mv_config"
+data_config = __import__(config_file, globals(), locals(), [])
+
+def setup_ntp(usepool,ntpserver):
+    if usepool:
+        logging.info("Setting ntp server to %s",ntpserver)
+        print '''sed -i "s/pool.ntp.org/$dbhost/g" ${BASE}/etc/ntp.conf'''
+    else:
+        logging.info("Not changing ntp configuration")
+
+def setup_avahi(templates):
+    file="/etc/avahi/services/mysql.service"
+    if not os.path.exists(file):
+        logging.debug("    copying in mysql.service for avahi")
+        try:
+            os.makedirs("/etc/avahi/services")
+        except:
+            logging.debug("    Couldn't create /etc/avahi/services")
+        mv_common.cp_and_log(template+"/mysql.service",file)
+        cmd="sudo sv restart avahi"
+        mv_common.runcmd(cmd)
+
+def remove_avahi_service():
+    file="/etc/avahi/services/mysql.service"
+    if os.path.exists(file):
+        logging.debug("    Removing avahi mysql.service file")
+        cmd="rm -rf %s" %file
+        runcmd(cmd)
+        cmd="sudo sv restart avahi"
+        mv_common.runcmd(cmd)
+
+def setup_db():
+    logging.debug("    Setting up the database")
+
+def setup_mysqlnetwork():
+    logging.debug("    Setting up mysql network")
+
+def setup_mysql():
+    logging.debug("    Configuring mysql")
+
+def setup_func_key():
+    if data_config.SYSTEMTYPE == "MythVantage":
+        logging.debug("    Grabbing the key for Func")
+        cmd="/usr/MythVantage/bin/grabkey.py"
+        mv_common.runcmd(cmd)
+
+def setup_func_minion(dbhost):
+    logging.info("    Setting up the func minion:")
+    logging.debug("   certmaster is %s:",dbhost)
+    cmd='''sed -i "s/^certmaster.*$/certmaster = %s/" /etc/func/minion.conf ''' %dbhost
+    mv_common.runcmd(cmd)
+
+def setup_syslog(dbhost):
+    logging.debug("    Setting syslog to log to %s",dbhost)
+    cmd ='''sed -i "s/^destination d_remote.*$/destination d_remote \{tcp\(\"%s\" port\(514\)\) \;\} \;/" /etc/syslog-ng.conf''' %dbhost
+    return
+
+def hostypeprint(systemconfig):
+    logging.info("______Start of hostype config_____")
+    mv_common.services(systemconfig)
+    install_list=''
+    remove_list=''
+    daemon_list=''
+    daemon_remove_list=''
+
+    if systemconfig["SystemType"] == "Standalone":
+        logging.info("Stand alone system being configured")
+        setup_ntp(False,"null")
+        remove_avahi_service()
+        if systemconfig["hostypec"]:
+            setup_db()
+        install_list=("mysql", "mythdb-initial", "avahi", "portmap", "nfs-utils", "local-website", "myth2ipod", "mythtv-status")
+        daemon_list=("mysql", "mythbackend", "avahi", "portmap", "nfs-utils", "netfs", "lighttpd")
+
+    elif systemconfig["SystemType"] == "Master_backend":
+        logging.info("Master backend system being configured")
+        setup_ntp(False,"null")
+        setup_avahi(systemconfig["TEMPLATES"])
+        install_list=("mysql", "mythdb-initial", "avahi", "portmap", "nfs-utils", "local-website", "myth2ipod", "mythtv-status")
+        daemon_list=("mysql", "mythbackend", "avahi", "portmap", "nfs-utils", "netfs", "lighttpd")
+        if data_config.SYSTEMTYPE == "MythVantage":
+            install_list.append('func')
+            install_list.append('certmaster')
+            daemon_list.append('certmaster')
+
+    elif systemconfig["SystemType"] == "Slave_backend":
+        logging.info("Slave backend  system being configured")
+        setup_ntp(True,systemconfig["dbhost"])
+        remove_avahi_service()
+        if systemconfig["hostypec"]:
+            setup_db()
+        install_list=("portmap", "nfs-utils", "local-website", "avahi", 'libmysqlclient')
+        daemon_list=("mythbackend", "portmap", "nfs-utils", "netfs", "lighttpd", "avahi")
+        daemon_remove_list=('mysql')
+        if data_config.SYSTEMTYPE == "MythVantage":
+            install_list.remove("local-website")
+            daemon_list.remove("lighttpd")
+            install_list.append('func')
+            daemon_list.append('funcd')
+            remove_list.append("lighttpd")
+
+
+    elif systemconfig["SystemType"] == "Frontend_only":
+        logging.info("Frontend only system being configured")
+        setup_ntp(True,systemconfig["dbhost"])
+        remove_avahi_service()
+        install_list=("mysql-clients", "libmysqlclient",  "avahi", "portmap", "nfs-utils", "local-website")
+        remove_list=("mysql")
+        daemon_list=("mysql", "mythbackend", "avahi", "portmap", "nfs-utils", "netfs", "lighttpd")
+        daemon_remove_list=("mysql", "mythbackend")
+        if data_config.SYSTEMTYPE == "MythVantage":
+            install_list.remove("local-website")
+            daemon_list.remove("lighttpd")
+            install_list.append('func')
+            daemon_list.append('funcd')
+            remove_list.append("lighttpd")
+
+
+
+    for pkg in install_list:
+        mv_common.pacinstall(pkg)
+    for pkg in remove_list:
+        mv_common.pacinstall(pkg)
+    for daemon in daemon_list:
+        mv_common.add_service(daemon)
+    for daemon in daemon_remove_list:
+        mv_common.remove_service(daemon)
+    if systemconfig["RunFrontend"] == "1":
+        logging.debug("   Will run the frontend")
+        mv_common.add_service("frontend")
+        mv_common.add_service("hal")
+    else:
+        logging.debug("   Will NOT run the frontend")
+        mv_common.remove_service("frontend")
+        mv_common.remove_service("hal")
+
+    setup_mysqlnetwork()
+    setup_mysql()
+    if data_config.SYSTEMTYPE == "MythVantage":
+        setup_func_minion(dbhost)
+        setup_func_key()
+        setup_syslog(systemconfig["dbhost"])
+    logging.info("__End of hostype config\n")
diff --git a/abs/core-testing/LinHES-config/mv_install.py b/abs/core-testing/LinHES-config/mv_install.py
index 83563aa..1281932 100755
--- a/abs/core-testing/LinHES-config/mv_install.py
+++ b/abs/core-testing/LinHES-config/mv_install.py
@@ -463,21 +463,21 @@ def create_fstab(extralines):
     fstabfile = data_config.MOUNTPOINT+"/etc/fstab"
     fstab_list = []
     f = open(fstabfile,  'w')
-    line = "# <file system>        <dir>         <type>    <options>          <dump> <pass> \n"
+    line = '''# <file system>        <dir>         <type>    <options>          <dump> <pass> \n'''
     fstab_list.append(line)
-    line = "none                   /dev/pts      devpts    defaults            0      0 \n"
+    line = '''none                   /dev/pts      devpts    defaults            0      0 \n'''
     fstab_list.append(line)
-    line = "none                   /dev/shm      tmpfs     defaults            0      0\n"
+    line = '''none                   /dev/shm      tmpfs     defaults            0      0\n'''
     fstab_list.append(line)
-    line = "/dev/cdrom /media/cdrom   auto    ro, user, noauto, unhide   0      0\n"
+    line = '''/dev/cdrom /media/cdrom   auto    ro,user,noauto,unhide   0      0\n'''
     fstab_list.append(line)
-    line = "/dev/dvd /media/dvd   auto    ro, user, noauto, unhide   0      0\n"
+    line = '''/dev/dvd /media/dvd   auto    ro,user,noauto,unhide   0      0\n'''
     fstab_list.append(line)
-    line = "UUID=ROOTUID /  auto defaults, noatime 0 1\n"
+    line = '''UUID=ROOTUID /  auto defaults,noatime 0 1\n'''
     fstab_list.append(line)
-    line = "UUID=DATAUID %s  auto defaults, noatime 0 1\n" %(data_config.DATAMOUNT)
+    line = '''UUID=DATAUID %s  auto defaults,noatime 0 1\n''' %(data_config.DATAMOUNT)
     fstab_list.append(line)
-    line = "UUID=SWAPUID swap swap defaults  0 0 \n"
+    line = '''UUID=SWAPUID swap swap defaults  0 0 \n'''
     fstab_list.append(line)
     for vline in extralines:
         fstab_list.append(vline)
@@ -848,7 +848,8 @@ def full_install(hostoptions):
         cmd = "  chroot %s %s/bin/install_db_chroot.sh |tee /tmp/chrootdb.out" %(data_config.MOUNTPOINT, MVROOT)
         runcmd(cmd)
         logging.info("Running systemconfig in chroot")
-        cmd = "  chroot %s %s/bin/systemconfig.sh misc, hostype, network, advanced, user, this_is_install" %(data_config.MOUNTPOINT, MVROOT)
+        #cmd = "  chroot %s %s/bin/systemconfig.sh misc, hostype, network, advanced, user, this_is_install" %(data_config.MOUNTPOINT, MVROOT)
+        cmd = "  chroot %s %s/bin/systemconfig.sh all , this_is_install" %(data_config.MOUNTPOINT, MVROOT)
         runcmd(cmd)
         mysqldb("stop", "chroot")
         kill_dhcp_chroot()
@@ -866,13 +867,14 @@ def full_install(hostoptions):
         if ( 'x' == '1' ):
             logging.debug("touching /tmp/.dbsysfailed")
         else:
-            cmd = "  chroot %s %s/bin/systemconfig.sh misc, hostype, network, advanced, user, this_is_install" %(data_config.MOUNTPOINT, MVROOT)
+            #cmd = "  chroot %s %s/bin/systemconfig.sh misc, hostype, network, advanced, user, this_is_install" %(data_config.MOUNTPOINT, MVROOT)
+            cmd = "  chroot %s %s/bin/systemconfig.sh all , this_is_install" %(data_config.MOUNTPOINT, MVROOT)
             runcmd(cmd)
             cmd = "  chroot %s %s/bin/restore_default_settings.sh -c ACCESSCONTROL " %(data_config.MOUNTPOINT, MVROOT)
             runcmd(cmd)
         umount_bind_chroot()
-    cmd = "  chroot %s %s/bin/systemconfig.sh advanced, user" %(data_config.MOUNTPOINT, MVROOT)
-    runcmd(cmd)
+    #cmd = "  chroot %s %s/bin/systemconfig.sh advanced, user" %(data_config.MOUNTPOINT, MVROOT)
+    #runcmd(cmd)
     cmd = "  touch %s%s/.configure" %(data_config.MOUNTPOINT, data_config.MYTHHOME)
     runcmd(cmd)
     cmd = "  chmod 777 %s%s/.configure" %(data_config.MOUNTPOINT, data_config.MYTHHOME)
@@ -1069,7 +1071,8 @@ def upgrade(hostoptions):
     fix_permissions()
     mount_bind_chroot()
     logging.info("Running systemconfig in chroot")
-    cmd = "  chroot %s %s/bin/systemconfig.sh misc, hostype, network, advanced, user, this_is_install" %(data_config.MOUNTPOINT, MVROOT)
+    #cmd = "  chroot %s %s/bin/systemconfig.sh misc, hostype, network, advanced, user, this_is_install" %(data_config.MOUNTPOINT, MVROOT)
+    cmd = "  chroot %s %s/bin/systemconfig.sh all , this_is_install" %(data_config.MOUNTPOINT, MVROOT)
     runcmd(cmd)
     mysqldb("stop", "")
     if ( systemconfig["SystemType"] == "Master_backend" or  systemconfig["SystemType"] == "Standalone" ):
@@ -1095,11 +1098,12 @@ def upgrade(hostoptions):
         runcmd(cmd)
 
     logging.info("Running systemconfig in chroot 2nd time")
-    cmd = "  chroot %s %s/bin/systemconfig.sh misc, hostype, network, advanced, user, this_is_install" %(data_config.MOUNTPOINT, MVROOT)
-    runcmd(cmd)
-    logging.info("Running systemconfig in chroot")
-    cmd = "  chroot %s %s/bin/systemconfig.sh advanced" %(data_config.MOUNTPOINT, MVROOT)
+    #cmd = "  chroot %s %s/bin/systemconfig.sh misc, hostype, network, advanced, user, this_is_install" %(data_config.MOUNTPOINT, MVROOT)
+    cmd = "  chroot %s %s/bin/systemconfig.sh all , this_is_install" %(data_config.MOUNTPOINT, MVROOT)
     runcmd(cmd)
+    #logging.info("Running systemconfig in chroot")
+    #cmd = "  chroot %s %s/bin/systemconfig.sh advanced" %(data_config.MOUNTPOINT, MVROOT)
+    #runcmd(cmd)
     mysqldb("stop", 'chroot')
     apply_new_auth()
     kill_dhcp_chroot()
diff --git a/abs/core-testing/LinHES-config/mv_ir.py b/abs/core-testing/LinHES-config/mv_ir.py
old mode 100644
new mode 100755
diff --git a/abs/core-testing/LinHES-config/mv_misc.py b/abs/core-testing/LinHES-config/mv_misc.py
old mode 100644
new mode 100755
index eba7b57..27aeb98
--- a/abs/core-testing/LinHES-config/mv_misc.py
+++ b/abs/core-testing/LinHES-config/mv_misc.py
@@ -25,13 +25,13 @@ def setup_zip(MVROOT,zipcode):
     logging.debug("__End of zipcode\n")
 
 def setup_tz(timezone,TEMPLATES):
-    logging.debug("____Setting up the timezone____")
+    logging.info("____Setting up the timezone____")
 
     if not timezone:
         timezone="unknown"
-    logging.debug("    Setting timezone to %s",timezone)
+    logging.info("    Setting timezone to %s",timezone)
     try:
-        logging.debug("    Removeing /etc/localtime")
+        logging.debug("    Removing /etc/localtime")
         os.remove("/etc/localtime")
     except:
         logging.debug("    Couldn't remove /etc/localtime")
@@ -39,17 +39,20 @@ def setup_tz(timezone,TEMPLATES):
 
     srclink="/usr/share/zoneinfo/%s" %timezone
     logging.debug("    symlinking %s to /etc/localtime",srclink)
-    os.symlink(srclink,"/etc/localtime")
-    cmd = '''sed -e "s~^TIMEZONE=.*$~TIMEZONE=\"%s\"~" /etc/rc.conf > $TEMPLATES/rc.conf''' %timezone
+    try:
+        os.symlink(srclink,"/etc/localtime")
+    except:
+        logging.critical("    Couldn't make symlink for /etc/localtime")
+    cmd = '''sed -e "s/^TIMEZONE=.*$/TIMEZONE=\\"%s\\" /" /etc/rc.conf > $TEMPLATES/rc.conf''' %re.escape(timezone)
     mv_common.runcmd(cmd)
 
     if os.path.exists("/etc/php/php.ini"):
-        logging.debug("Changing timezone for php")
-        cmd = '''sed -i "s/^.*date.timezone.*$/date.timezone=%s/" ${BASE}/etc/php/php.ini''' %timezone
+        logging.info("    Changing timezone for php")
+        cmd = '''sed -i "s/^.*date.timezone.*$/date.timezone=%s/" ${BASE}/etc/php/php.ini''' %re.escape(timezone)
         mv_common.runcmd(cmd)
 
     mv_common.cp_and_log(TEMPLATES+"/rc.conf","/etc/rc.conf")
-    logging.debug("__End of timezone\n")
+    logging.info("__End of timezone\n")
 
 def setup_nfs(systemconfig):
     nfslist=[]
@@ -72,11 +75,10 @@ def setup_nfs(systemconfig):
             nfsmap_file = download_nfsmap(ip)
             nfslist = process_nfsmap_file(nfsmap_file)
         #else treat it as a single mount point
-        else:
-            item = (systemconfig["NFSserver"] , systemconfig["NFSmount"])
-            nfslist.append(item)
-        setup_nfs_fstab(nfslist)
-
+    else:
+        item = (systemconfig["NFSserver"] , systemconfig["NFSmount"])
+        nfslist.append(item)
+    setup_nfs_fstab(nfslist)
     logging.info("__End of nfs\n")
 
 def setup_sleep(systemconfig):
@@ -120,7 +122,7 @@ def process_nfsmap_file(mapfile):
             logging.debug("    %s",item)
             nfslist.append(item)
     except :
-        logging.debug("Couldn't read file %s, or some other error",mapfile)
+        logging.critical("Couldn't read file %s, or some other error",mapfile)
     return nfslist
 
 def scrubnfs(templates):
@@ -167,6 +169,6 @@ def setup_nfs_fstab(nfslist):
         f.write(line)
         f.close()
     except:
-        logging.debug("    Couldn't open /etc/fstab")
+        logging.critical("    *Couldn't open /etc/fstab for writing")
     logging.debug("   Done adding nfs paths to fstab")
 
diff --git a/abs/core-testing/LinHES-config/mv_network.py b/abs/core-testing/LinHES-config/mv_network.py
old mode 100644
new mode 100755
index 77ee2d8..ca29c7d
--- a/abs/core-testing/LinHES-config/mv_network.py
+++ b/abs/core-testing/LinHES-config/mv_network.py
@@ -21,7 +21,7 @@ def setup_MYTH_DHCP(systemconfig):
     try:
         defaultdhcp = systemconfig["HostUSEDHCP"+default_interface]
     except:
-        logging.debug("    Error occured finding default dhcp")
+        logging.critical("    *Error occured finding default dhcp")
         defaultdhcp = "0"
     logging.debug("    Using %s as dhcp value for %s", default_interface, defaultdhcp)
     return defaultdhcp
@@ -64,7 +64,7 @@ def setup_hostname(systemconfig):
     try:
         hostname = systemconfig["hostname"]
     except:
-        logging.info("    Hostname could not be set")
+        logging.critical("    *Hostname could not be set")
         logging.info("    Using default value of me")
         hostname = "me"
     logging.info("    Setting the hostname to %s", hostname)
@@ -182,12 +182,12 @@ def change_iface_state(netdev, state):
 def find_active(systemconfig):
     interfacelist=('eth0', 'eth1', 'wlan0', 'wlan1')
     logging.debug("    _Start of find_active")
-    try:
-        os.remove("/etc/resolv.conf")
-    except:
-        logging.debug("    couldn't remove /etc/resolv.conf")
 
     if systemconfig["mythdhcp"] == "1":
+        try:
+            os.remove("/etc/resolv.conf")
+        except:
+            logging.debug("    couldn't remove /etc/resolv.conf")
         cmd = ''' echo search lan > /etc/resolv.conf '''
         mv_common.runcmd(cmd)
         cmd = ''' echo nameserver 127.0.0.1 >> /etc/resolv.conf '''
@@ -214,7 +214,7 @@ def vnc_netboot_check():
         bootoptions = f.readlines()
         f.close()
     except:
-        logging.debug("    Couldn't open /proc/cmdline")
+        logging.critical("    *Couldn't open /proc/cmdline")
         logging.debug("    Assuming it's ok to fiddle with the network")
         return True
     bootoptions =  bootoptions[0]
diff --git a/abs/core-testing/LinHES-config/mv_screensaver.py b/abs/core-testing/LinHES-config/mv_screensaver.py
old mode 100644
new mode 100755
diff --git a/abs/core-testing/LinHES-config/mv_smolt.py b/abs/core-testing/LinHES-config/mv_smolt.py
old mode 100644
new mode 100755
index e4fbaee..5fd3722
--- a/abs/core-testing/LinHES-config/mv_smolt.py
+++ b/abs/core-testing/LinHES-config/mv_smolt.py
@@ -44,7 +44,7 @@ def setup_smolt_type(SystemType,Remotetype,RunFrontend,mythhome,stype):
         smoltsystem = 3
         MVRELEASE="%s ( Frontend only)" %releasename
 
-    logging.info("    smolt type is %s : %s", MVRELEASE,smoltsystem)
+    logging.debug("    smolt type is %s : %s", MVRELEASE,smoltsystem)
     smoltfile = mythhome+"/.mythtv/smolt.info"
     cmd = ''' echo  "%s" > /etc/os_myth_release ''' %MVRELEASE
     mv_common.runcmd(cmd)
diff --git a/abs/core-testing/LinHES-config/mv_software.py b/abs/core-testing/LinHES-config/mv_software.py
old mode 100644
new mode 100755
diff --git a/abs/core-testing/LinHES-config/mv_webuser.py b/abs/core-testing/LinHES-config/mv_webuser.py
old mode 100644
new mode 100755
-- 
cgit v0.12


From dd2c1f96b8c3e06d26cc8a1f9c3d82ff6a20a39a Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Thu, 4 Jun 2009 09:57:23 -0500
Subject: linhes-config:  Add better debuging,  load the correct module from
 templates

---
 abs/core-testing/LinHES-config/mv_ir.py | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/abs/core-testing/LinHES-config/mv_ir.py b/abs/core-testing/LinHES-config/mv_ir.py
index b3552c5..6c2b2aa 100755
--- a/abs/core-testing/LinHES-config/mv_ir.py
+++ b/abs/core-testing/LinHES-config/mv_ir.py
@@ -189,7 +189,7 @@ def setup_blaster_transmiter(HostBlasterType):
         scrub_modules("/etc/modules.mythvantage","blaster")
 
 def setup_lcd(LCDtype, TEMPLATES, Remotetype):
-    logging.debug("    Start of setup_lcd")
+    logging.debug("____Start of setup_lcd____")
     logging.debug("    LCDType: %s", LCDtype)
     logging.debug("    Remotetype: %s", Remotetype)
     if LCDtype == "tinker":
@@ -213,8 +213,17 @@ def setup_lcd(LCDtype, TEMPLATES, Remotetype):
             logging.debug("    Adding module for LCD")
             scrub_modules("/etc/modules.mythvantage", "LCD")
             cmd = "cat %s >> /etc/modules.mythvantage" %lcdmodule
+            mv_common.runcmd(cmd)
         if Remotetype != "tinker":
+            lcdconf = "%s/LCD/%s/LCDd.conf" %(TEMPLATES,LCDtype)
             lcdlirc = "%s/LCD/%s" %(TEMPLATES,LCDtype)
+            mv_common.pacinstall("lcdproc")
+            if os.path.exists(lcdconf):
+                logging.debug("    Copying in lcdconf template file: %s",lcdconf)
+                mv_common.cp_and_log(lcdconf, "/etc/LCDd.conf")
+            else:
+                logging.debug("    %s is not present, will not copy it")
+
             if os.path.exists(lcdlirc+"/lircrc"):
                 logging.debug("    LCD seems to support lirc")
                 #setup the lirc aspect of the lcd
@@ -238,6 +247,9 @@ def setup_lcd(LCDtype, TEMPLATES, Remotetype):
                 cmd =  "chmod 755 /etc/lircrc"
                 mv_common.runcmd(cmd)
 
+            mv_common.add_service("lcdd")
+    logging.debug("__End of setup_lcd")
+
 def setup_ir(systemconfig, data_config):
     rc = False
     logging.info("____Start of IR____")
-- 
cgit v0.12


From 07d0be031e4db6460d6c22cb3775cd2e977e163e Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Thu, 4 Jun 2009 10:09:41 -0500
Subject: linhes-config:  add several service calls for sv restart lcdd using
 the the service calls

---
 abs/core-testing/LinHES-config/mv_common.py | 32 ++++++++++++++++++++++++++++-
 abs/core-testing/LinHES-config/mv_ir.py     |  1 +
 2 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/abs/core-testing/LinHES-config/mv_common.py b/abs/core-testing/LinHES-config/mv_common.py
index 64ff2d6..0cbabf5 100755
--- a/abs/core-testing/LinHES-config/mv_common.py
+++ b/abs/core-testing/LinHES-config/mv_common.py
@@ -1,5 +1,5 @@
 # -*- coding: utf-8 -*-
-import logging, os
+import logging, os, time
 import commands
 config_file = "mv_config"
 data_config = __import__(config_file, globals(), locals(), [])
@@ -37,6 +37,36 @@ def remove_service(daemon):
     cmd = "remove_service.sh %s" %daemon
     runcmd(cmd)
 
+def start_service(daemon):
+    logging.info("    start service %s",daemon)
+    cmd = "sv start %s" %daemon
+    runcmd(cmd)
+
+def stop_service(daemon):
+    logging.info("    stop service %s",daemon)
+    cmd = "sv stop %s" %daemon
+    runcmd(cmd)
+
+def restart_service(daemon):
+    logging.info("    Restarting service %s",daemon)
+    if daemon == "lcdd":
+        stop_service(daemon)
+        logging.debug("    killing all lcdd")
+        cmd = "killall -9 LCDd"
+        runcmd(cmd)
+        time.sleep(2)
+        start_service(daemon)
+    else:
+        cmd = "sv restart %s" %daemon
+        runcmd(cmd)
+
+def hup_service(daemon):
+    logging.info("    hup service %s",daemon)
+    cmd = "sv hup %s" %daemon
+    runcmd(cmd)
+
+
+
 def pkg_blacklist_check(pkg):
     cmd = '''grep -q %s /etc/blacklist.package''' %pkg
     rc = runcmd(cmd)
diff --git a/abs/core-testing/LinHES-config/mv_ir.py b/abs/core-testing/LinHES-config/mv_ir.py
index 6c2b2aa..6ce549f 100755
--- a/abs/core-testing/LinHES-config/mv_ir.py
+++ b/abs/core-testing/LinHES-config/mv_ir.py
@@ -248,6 +248,7 @@ def setup_lcd(LCDtype, TEMPLATES, Remotetype):
                 mv_common.runcmd(cmd)
 
             mv_common.add_service("lcdd")
+            mv_common.restart_service("lcdd")
     logging.debug("__End of setup_lcd")
 
 def setup_ir(systemconfig, data_config):
-- 
cgit v0.12


From f768ebf6fd77b111e0135099f5c1a7fbdd6c78ca Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Thu, 4 Jun 2009 11:01:43 -0500
Subject: system-templates:  Remove unused files, remove user share from
 template file. The user share is now added by systemconfig.py

---
 abs/core-testing/system-templates/PKGBUILD                     |  2 +-
 .../system-templates/templates/samba/smb.conf.home             | 10 ----------
 .../system-templates/templates/samba/smb.conf.media            | 10 ----------
 .../system-templates/templates/samba/smb.conf.template         |  1 -
 4 files changed, 1 insertion(+), 22 deletions(-)
 delete mode 100755 abs/core-testing/system-templates/templates/samba/smb.conf.home
 delete mode 100755 abs/core-testing/system-templates/templates/samba/smb.conf.media

diff --git a/abs/core-testing/system-templates/PKGBUILD b/abs/core-testing/system-templates/PKGBUILD
index 4d72aad..5a195c5 100755
--- a/abs/core-testing/system-templates/PKGBUILD
+++ b/abs/core-testing/system-templates/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=system-templates
 pkgver=1.0
-pkgrel=18
+pkgrel=20
 conflicts=( )
 pkgdesc="Templates used for system configuration"
 depends=()
diff --git a/abs/core-testing/system-templates/templates/samba/smb.conf.home b/abs/core-testing/system-templates/templates/samba/smb.conf.home
deleted file mode 100755
index c0f3136..0000000
--- a/abs/core-testing/system-templates/templates/samba/smb.conf.home
+++ /dev/null
@@ -1,10 +0,0 @@
-[home]
-   path = /home/mythtv/
-   public = yes
-   only guest = yes
-   writeable  = yes
-   printable = no
-  force user = mythtv
-  force group = mythtv
-  create mask = 0755
-
diff --git a/abs/core-testing/system-templates/templates/samba/smb.conf.media b/abs/core-testing/system-templates/templates/samba/smb.conf.media
deleted file mode 100755
index 914a321..0000000
--- a/abs/core-testing/system-templates/templates/samba/smb.conf.media
+++ /dev/null
@@ -1,10 +0,0 @@
-[myth]
-   path = /myth
-   public = yes
-   only guest = yes
-   writeable  = yes
-   printable = no
-  force user = mythtv
-  force group = mythtv
-  create mask = 0755
-
diff --git a/abs/core-testing/system-templates/templates/samba/smb.conf.template b/abs/core-testing/system-templates/templates/samba/smb.conf.template
index aef29eb..da1e89e 100644
--- a/abs/core-testing/system-templates/templates/samba/smb.conf.template
+++ b/abs/core-testing/system-templates/templates/samba/smb.conf.template
@@ -121,5 +121,4 @@
 
 
 #============================ Share Definitions ==============================
-include =  /home/mythtv/templates/user.shares
 
-- 
cgit v0.12


From 53be0cba35f7ab5880be30b397f2e1671611e34d Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Thu, 4 Jun 2009 11:02:19 -0500
Subject: linhes-config:  Fix auto nfs shares for none nfs servers

---
 abs/core-testing/LinHES-config/mv_misc.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/abs/core-testing/LinHES-config/mv_misc.py b/abs/core-testing/LinHES-config/mv_misc.py
index 27aeb98..c93cd71 100755
--- a/abs/core-testing/LinHES-config/mv_misc.py
+++ b/abs/core-testing/LinHES-config/mv_misc.py
@@ -75,9 +75,14 @@ def setup_nfs(systemconfig):
             nfsmap_file = download_nfsmap(ip)
             nfslist = process_nfsmap_file(nfsmap_file)
         #else treat it as a single mount point
+        else:
+            item = (systemconfig["NFSserver"] , systemconfig["NFSmount"])
+            nfslist.append(item)
     else:
-        item = (systemconfig["NFSserver"] , systemconfig["NFSmount"])
-        nfslist.append(item)
+        #if standalone or slave try to use MBE
+        if systemconfig["SystemType"] == "Frontend_only" or systemconfig["SystemType"] == "Slave_Backend":
+            item = (systemconfig["dbhost"] , data_config.DATAMOUNT)
+            nfslist.append(item)
     setup_nfs_fstab(nfslist)
     logging.info("__End of nfs\n")
 
-- 
cgit v0.12


From 70c7883467b9348ce43b2822664bfa19af4d553d Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Thu, 4 Jun 2009 11:02:30 -0500
Subject: linhes-config: misc fixes

---
 abs/core-testing/LinHES-config/mv_advanced.py  |  2 +-
 abs/core-testing/LinHES-config/mv_common.py    |  4 ++++
 abs/core-testing/LinHES-config/systemconfig.py | 19 ++++++++++---------
 3 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/abs/core-testing/LinHES-config/mv_advanced.py b/abs/core-testing/LinHES-config/mv_advanced.py
index f5a0f29..01351df 100755
--- a/abs/core-testing/LinHES-config/mv_advanced.py
+++ b/abs/core-testing/LinHES-config/mv_advanced.py
@@ -105,7 +105,7 @@ def setup_evrouter(UseEvrouter,EvrouterConfig,template):
             return
         mv_common.pacinstall("evrouter")
         mv_common.pacinstall("Xvfb")
-        mv_common.cp_and_log(template+EvrouterConfig,"/etc/evrouter.cfg")
+        mv_common.cp_and_log(template+"/evrouter/"+EvrouterConfig,"/etc/evrouter.cfg")
         mv_common.add_service("evrouter")
         mv_common.add_service("Xvfb")
     else:
diff --git a/abs/core-testing/LinHES-config/mv_common.py b/abs/core-testing/LinHES-config/mv_common.py
index 0cbabf5..9b33454 100755
--- a/abs/core-testing/LinHES-config/mv_common.py
+++ b/abs/core-testing/LinHES-config/mv_common.py
@@ -120,6 +120,7 @@ def pacremove(pkg):
         else:
             logging.info("    Removing %s",pkg)
             cmd ='''pacman --noconfirm -R  %s ''' %pkg
+            runcmd(cmd)
     else:
         logging.info("    %s is blacklisted, will not remove",pkg)
 
@@ -152,6 +153,9 @@ def reloadfe(dbhost,RESTART_LCD):
 
 def restartfe(RESTART_LCD):
     logging.debug("____Start of restartfe____")
+    if data_config.SYSTEMTYPE=="LinHES":
+        logging.debug("    LinHES seems to be running will not restartfe")
+        return
     logging.info("    Restarting frontend")
     restartLCD(RESTART_LCD)
     cmd="killall -9 mythfrontend"
diff --git a/abs/core-testing/LinHES-config/systemconfig.py b/abs/core-testing/LinHES-config/systemconfig.py
index 7e5e3b1..77471c2 100755
--- a/abs/core-testing/LinHES-config/systemconfig.py
+++ b/abs/core-testing/LinHES-config/systemconfig.py
@@ -50,7 +50,7 @@ def main(argv):
     global systemconfig
     systemconfig["MVROOT"]=MVROOT
     restartlcd = False
-    cmdmodule={"misc":False , "sleep":False , "hostype":False , "hostypec":False , "advanced":False , "audio":False , "network":False , "advancedX":False , "webuser":False , "restartfe":False , "reloadfe":False , "ddns":False , "screensaver":False , "ir":False , "this_is_install":False , "user":False, "software":False, "smolt":False, "all":False}
+    cmdmodule={"misc":False , "sleep":False , "hostype":False , "hostypec":False , "advanced":False , "audio":False , "network":False , "advancedX":False , "webuser":False , "restartfe":False , "reloadfe":False , "ddns":False , "screensaver":False , "ir":False , "this_is_install":False , "user":False, "software":False, "plugins":False, "smolt":False, "all":False}
     try:
         opts,  args = getopt.getopt(argv,  'c:hm:',  ["help","modules" ] )
     except getopt.GetoptError, why:
@@ -93,7 +93,7 @@ def main(argv):
 
     if cmdmodule["hostype"]:
         import mv_hostype
-        cmdmodule["advancedX"] = False
+        cmdmodule["advancedX"] = True
         setup_x(systemconfig)
         cmdmodule["ir"] = True
         mv_hostype.hostypeprint(systemconfig)
@@ -131,6 +131,7 @@ def main(argv):
         mv_misc.setup_nfs(systemconfig)
 
     if cmdmodule["sleep"]:
+        import mv_misc
         mv_misc.setup_sleep(systemconfig)
 
     if cmdmodule["webuser"]:
@@ -148,7 +149,7 @@ def main(argv):
         import mv_advanced
         mv_advanced.setup_advanced(systemconfig, data_config)
 
-    if cmdmodule["software"]:
+    if cmdmodule["software"] or cmdmodule["plugins"]:
         import mv_software
         mv_software.setup_software(systemconfig, data_config)
 
@@ -204,12 +205,12 @@ if __name__ == "__main__":
     systemconfig["TEMPLATES"] = os.environ["TEMPLATES"]
     logging.debug("______START OF DEBUG______")
     main(sys.argv[1:])
-    #logging.debug("______cmd line options______")
-    #for i in cmdmodule.items():
-        #logging.debug (i)
-    #logging.debug("______systemconfig______")
-    #for i in systemconfig.items():
-        #logging.debug(i)
+    logging.debug("______cmd line options______")
+    for i in cmdmodule.items():
+        logging.debug (i)
+    logging.debug("______systemconfig______")
+    for i in systemconfig.items():
+        logging.debug(i)
     #pass
 
 
-- 
cgit v0.12


From 4c3293b79113967cfe86eab4ff6ec974f809e07e Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Thu, 4 Jun 2009 21:04:03 -0500
Subject: LinHES-config:  fix modules.mythvantage typo in ir setup. Set default
 value for templates if the variable isn't present to the shell.

---
 abs/core-testing/LinHES-config/PKGBUILD        |  2 +-
 abs/core-testing/LinHES-config/mv_ir.py        | 24 +++++++++++++++++-------
 abs/core-testing/LinHES-config/systemconfig.py |  8 +++++++-
 3 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/abs/core-testing/LinHES-config/PKGBUILD b/abs/core-testing/LinHES-config/PKGBUILD
index 58dcfd8..7bd6369 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=429
+pkgrel=430
 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 rsync python-parted )
diff --git a/abs/core-testing/LinHES-config/mv_ir.py b/abs/core-testing/LinHES-config/mv_ir.py
index 6ce549f..efc8a60 100755
--- a/abs/core-testing/LinHES-config/mv_ir.py
+++ b/abs/core-testing/LinHES-config/mv_ir.py
@@ -34,7 +34,7 @@ def scrub_modules(filename,module):
 
 def add_module(filename,module):
     logging.debug("    adding  %s to %s",module,filename)
-    cmd = ''' echo %s >> %s ''' %(module,filename)
+    cmd = ''' echo "%s" >> %s ''' %(module,filename)
     mv_common.runcmd(cmd)
 
 def unload_all_lirc():
@@ -98,7 +98,7 @@ def setup_ir_receiver(ReceiverType,TEMPLATES):
     logging.info("    Configuring receiver %s", ReceiverType)
     if ReceiverType == "Serial":
         scrub_modules("/etc/modules.mythvantage","lirc")
-        add_module("/etc/modules/.mythvantage","lirc_serial    #lirc")
+        add_module("/etc/modules.mythvantage","lirc_serial    #lirc")
         cmd = "load-modules-mythvantage.sh"
         mv_common.runcmd(cmd)
         mv_common.remove_service("igdaemon")
@@ -106,7 +106,7 @@ def setup_ir_receiver(ReceiverType,TEMPLATES):
 
     elif ReceiverType == "Usb-imon":
         scrub_modules("/etc/modules.mythvantage","lirc")
-        add_module("/etc/modules/.mythvantage","lirc_imon    #lirc")
+        add_module("/etc/modules.mythvantage","lirc_imon    #lirc")
         cmd = "load-modules-mythvantage.sh"
         mv_common.runcmd(cmd)
         mv_common.remove_service("igdaemon")
@@ -114,7 +114,18 @@ def setup_ir_receiver(ReceiverType,TEMPLATES):
 
     elif ReceiverType == "Hauppauge":
         scrub_modules("/etc/modules.mythvantage","lirc")
-        add_module("/etc/modules/.mythvantage","lirc_i2c    #lirc")
+        add_module("/etc/modules.mythvantage","lirc_i2c    #lirc")
+        mv_common.cp_and_log(TEMPLATES+"/modules/lirc_i2c.conf" ,
+                             "/etc/modprobe.d/lirc_i2c.conf")
+        cmd = "rmmod lirc_i2c"
+        mv_common.runcmd(cmd)
+        cmd = "load-modules-mythvantage.sh"
+        mv_common.runcmd(cmd)
+        mv_common.remove_service("igdaemon")
+        mv_common.remove_service("tatir")
+    elif ReceiverType == "pvr150":
+        scrub_modules("/etc/modules.mythvantage","lirc")
+        add_module("/etc/modules.mythvantage","lirc_i2c    #lirc")
         mv_common.cp_and_log(TEMPLATES+"/modules/lirc_i2c.conf" ,
                              "/etc/modprobe.d/lirc_i2c.conf")
         cmd = "rmmod lirc_i2c"
@@ -123,7 +134,6 @@ def setup_ir_receiver(ReceiverType,TEMPLATES):
         mv_common.runcmd(cmd)
         mv_common.remove_service("igdaemon")
         mv_common.remove_service("tatir")
-
     elif ReceiverType == "iguanaIR-usb":
         scrub_modules("/etc/modules.mythvantage","lirc")
         mv_common.add_service("igdaemon")
@@ -179,8 +189,8 @@ def setup_blaster_transmiter(HostBlasterType):
     elif HostBlasterType == "pvr150":
         scrub_modules("/etc/modules.mythvantage", "blaster")
         scrub_modules("/etc/modules.mythvantage", "lirc")
-        add_module("/etc/modules/.mythvantage", "lirc_pvr150    #blaster")
-        add_module("/etc/modules/.mythvantage", "lirc_pvr150    #lirc")
+        add_module("/etc/modules.mythvantage", "lirc_pvr150    #blaster")
+        add_module("/etc/modules.mythvantage", "lirc_pvr150    #lirc")
         cmd = "rmmod lirc_i2c"
         mv_common.runcmd(cmd)
         cmd = "load-modules-mythvantage.sh"
diff --git a/abs/core-testing/LinHES-config/systemconfig.py b/abs/core-testing/LinHES-config/systemconfig.py
index 77471c2..5ccaa10 100755
--- a/abs/core-testing/LinHES-config/systemconfig.py
+++ b/abs/core-testing/LinHES-config/systemconfig.py
@@ -202,7 +202,13 @@ if __name__ == "__main__":
             var, val = line.rsplit("=", 1)
             val = val.strip('"')
             systemconfig[var.strip()] = val.strip()
-    systemconfig["TEMPLATES"] = os.environ["TEMPLATES"]
+    try:
+        systemconfig["TEMPLATES"] = os.environ["TEMPLATES"]
+    except:
+        logging.critical("    *TEMPLATES is not defined")
+        logging.critical("    *using default value")
+        systemconfig["TEMPLATES"] = "/usr/MythVantage/templates"
+
     logging.debug("______START OF DEBUG______")
     main(sys.argv[1:])
     logging.debug("______cmd line options______")
-- 
cgit v0.12


From feda84feddf1292b00b2bb641072c0f414b159b1 Mon Sep 17 00:00:00 2001
From: Cecil Hugh Watson <knoppmyth@gmail.com>
Date: Fri, 5 Jun 2009 22:42:02 -0700
Subject: Changed kernel version to reflect latest.  Latest software version.

---
 abs/core-testing/plextor-convertX-driver/PKGBUILD         | 12 ++++++------
 abs/core-testing/plextor-convertX-driver/convertX.install |  6 +++---
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/abs/core-testing/plextor-convertX-driver/PKGBUILD b/abs/core-testing/plextor-convertX-driver/PKGBUILD
index fb503fb..a02f88f 100755
--- a/abs/core-testing/plextor-convertX-driver/PKGBUILD
+++ b/abs/core-testing/plextor-convertX-driver/PKGBUILD
@@ -2,22 +2,22 @@
 
 pkgname=plextor-convertX-driver
 pkgver=0.9.8
-pkgrel=3
-_kernver=2.6.27-ARCH
+pkgrel=4
+_kernver=2.6.28-LinHES
 pkgdesc="Drivers for Plextor tuners"
 arch=(i686 x86_64)
 url="http://nikosapi.org/software/WIS_Go7007"
 install="convertX.install"
-source=("http://nikosapi.org/software/WIS_Go7007/wis-go7007-linux-0.9.8-2.tar.bz2" 'wis-go7007-2.6.26-nopage.diff' 'wis-go7007-linux-0.9.8-2-2.6.27.patch')
+source=("http://go7007.imploder.org/wp-content/uploads/2009/02/wis-go7007-linux-098-4tar.bz2" 'wis-go7007-2.6.26-nopage.diff' 'wis-go7007-linux-0.9.8-2-2.6.27.patch')
 depends=('udev>=070' 'fxload')
 makedepends=('gcc')
 
 build() {
    
   # SET UP
-  cd $startdir/src/wis-go7007-linux-0.9.8-2 || return 1
-  patch -Np1 -i ../wis-go7007-2.6.26-nopage.diff || return 1
-  patch -Np1 -i ../wis-go7007-linux-0.9.8-2-2.6.27.patch || return 1
+  cd $startdir/src/wis-go7007-linux-0.9.8-4 || return 1
+#  patch -Np1 -i ../wis-go7007-2.6.26-nopage.diff || return 1
+#  patch -Np1 -i ../wis-go7007-linux-0.9.8-2-2.6.27.patch || return 1
   # build
   make clean ||  return 1
   make || return 1
diff --git a/abs/core-testing/plextor-convertX-driver/convertX.install b/abs/core-testing/plextor-convertX-driver/convertX.install
index 8dfd0b7..8081c6a 100755
--- a/abs/core-testing/plextor-convertX-driver/convertX.install
+++ b/abs/core-testing/plextor-convertX-driver/convertX.install
@@ -5,7 +5,7 @@ pre_install() {
 post_install() {
   # updating module dependencies
   echo ">>> Updating module dependencies. Please wait ..."
-  KERNEL_VERSION=2.6.17-STB
+  KERNEL_VERSION=2.6.28-LinHES
   depmod -v $KERNEL_VERSION > /dev/null 2>&1
   /bin/true
 }
@@ -13,7 +13,7 @@ post_install() {
 post_upgrade() {
   # updating module dependencies
   echo ">>> Updating module dependencies. Please wait ..."
-  KERNEL_VERSION=2.6.17-STB
+  KERNEL_VERSION=2.6.28-LinHES
   depmod -v $KERNEL_VERSION > /dev/null 2>&1
   /bin/true
 }
@@ -21,7 +21,7 @@ post_upgrade() {
 post_remove() {
   # updating module dependencies
   echo ">>> Updating module dependencies. Please wait ..."
-  KERNEL_VERSION=2.6.17-STB
+  KERNEL_VERSION=2.6.28-LinHES
   depmod -v $KERNEL_VERSION > /dev/null 2>&1
   /bin/true
 }
-- 
cgit v0.12


From 2d02247187371f7c47922c2aa00473a756dab5be Mon Sep 17 00:00:00 2001
From: Cecil Hugh Watson <knoppmyth@gmail.com>
Date: Fri, 5 Jun 2009 23:09:52 -0700
Subject: Removed from extra as it is in core/perl_modules.

---
 abs/extra-testing/perl-algorithm-diff/PKGBUILD | 23 -----------------------
 1 file changed, 23 deletions(-)
 delete mode 100644 abs/extra-testing/perl-algorithm-diff/PKGBUILD

diff --git a/abs/extra-testing/perl-algorithm-diff/PKGBUILD b/abs/extra-testing/perl-algorithm-diff/PKGBUILD
deleted file mode 100644
index 43d53c1..0000000
--- a/abs/extra-testing/perl-algorithm-diff/PKGBUILD
+++ /dev/null
@@ -1,23 +0,0 @@
-# This PKGBUILD was generated by cpan4pacman via CPANPLUS::Dist::Pacman
-# Contributor: François Charette <firmicus ατ gmx δοτ net>
-
-pkgname=perl-algorithm-diff
-pkgver=1.1902
-pkgrel=1
-pkgdesc="Compute intelligent differences between two files / lists"
-arch=('i686' 'x86_64')
-url="http://search.cpan.org/~TJMATHER/XML-RegExp"
-license=('GPL' 'PerlArtistic')
-depends=('perl>=5.10.0')
-options=('!emptydirs')
-source=(http://search.cpan.org/CPAN/authors/id/T/TY/TYEMQ/Algorithm-Diff-$pkgver.tar.gz) 
-md5sums=('ff3e17ae485f8adfb8857b183991fbce')
-
-build() {
-  cd  $startdir/src/Algorithm-Diff-$pkgver
-  PERL_MM_USE_DEFAULT=1 perl Makefile.PL INSTALLDIRS=vendor || return 1 
-  make || return 1
-  make install DESTDIR=$startdir/pkg || return 1
-  find $startdir/pkg -name '.packlist' -delete
-  find $startdir/pkg -name '*.pod' -delete
-}
-- 
cgit v0.12


From 3d3022399bd4f53ab44767a38ea59adb8f3051a2 Mon Sep 17 00:00:00 2001
From: Cecil Hugh Watson <knoppmyth@gmail.com>
Date: Fri, 5 Jun 2009 23:10:29 -0700
Subject: Bumped version, created group shepherd-dep to allow for easy install.

---
 abs/core-testing/perl_modules/perl-algorithm-diff/PKGBUILD | 3 ++-
 abs/core-testing/perl_modules/perl-digest-sha1/PKGBUILD    | 4 ++--
 abs/core-testing/perl_modules/perl-javascript/PKGBUILD     | 3 ++-
 abs/core-testing/perl_modules/perl-list-compare/PKGBUILD   | 3 ++-
 abs/core-testing/perl_modules/perl-pathtools/PKGBUILD      | 4 ++--
 5 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/abs/core-testing/perl_modules/perl-algorithm-diff/PKGBUILD b/abs/core-testing/perl_modules/perl-algorithm-diff/PKGBUILD
index 38be2cc..d185772 100644
--- a/abs/core-testing/perl_modules/perl-algorithm-diff/PKGBUILD
+++ b/abs/core-testing/perl_modules/perl-algorithm-diff/PKGBUILD
@@ -2,13 +2,14 @@
 # Maintainer: Charles Mauch <cmauch@gmail.com>
 pkgname=perl-algorithm-diff
 pkgver=1.1902
-pkgrel=3
+pkgrel=4
 pkgdesc="Perl/CPAN Module Algorithm::Diff : Diff also Longest Common Subsequence"
 arch=("i686" "x86_64")
 url="http://search.cpan.org/TYEMQ/Algorithm-Diff"
 license=("GPL" "Artistic")
 source=("http://www.cpan.org/authors/id/T/TY/TYEMQ/Algorithm-Diff-1.1902.tar.gz")
 md5sums=("ff3e17ae485f8adfb8857b183991fbce")
+groups=('shepherd-dep')
 build() {
   cd $startdir/src/Algorithm-Diff-1.1902
   PERL_MM_USE_DEFAULT=1 perl Makefile.PL INSTALLDIRS=vendor || return 1 
diff --git a/abs/core-testing/perl_modules/perl-digest-sha1/PKGBUILD b/abs/core-testing/perl_modules/perl-digest-sha1/PKGBUILD
index 7a3a414..7bf6976 100644
--- a/abs/core-testing/perl_modules/perl-digest-sha1/PKGBUILD
+++ b/abs/core-testing/perl_modules/perl-digest-sha1/PKGBUILD
@@ -5,7 +5,7 @@
 pkgname=perl-digest-sha1
 _realname=Digest-SHA1
 pkgver=2.11
-pkgrel=3
+pkgrel=4
 pkgdesc="Perl Module: Interface to the SHA-1 Algorithm."
 arch=(i686 x86_64)
 license=('PerlArtistic')
@@ -16,7 +16,7 @@ source=(http://www.cpan.org/authors/id/G/GA/GAAS/${_realname}-${pkgver}.tar.gz)
 replaces=('digest-sha1')
 provides=('digest-sha1')
 md5sums=('2449bfe21d6589c96eebf94dae24df6b')
-
+groups=('shepherd-dep')
 build() {
   cd ${startdir}/src/${_realname}-${pkgver}
   # install module in vendor directories.
diff --git a/abs/core-testing/perl_modules/perl-javascript/PKGBUILD b/abs/core-testing/perl_modules/perl-javascript/PKGBUILD
index 8ce00cb..564e2d9 100644
--- a/abs/core-testing/perl_modules/perl-javascript/PKGBUILD
+++ b/abs/core-testing/perl_modules/perl-javascript/PKGBUILD
@@ -1,7 +1,7 @@
 pkgname=perl-javascript
 _realname=JavaScript
 pkgver=1.12
-pkgrel=1
+pkgrel=2
 pkgdesc="get name of current working directory"
 arch=('i686' 'x86_64')
 url="http://search.cpan.org/~KWILLIAMS/Path-Class"
@@ -11,6 +11,7 @@ depends=('perl>=5.10.0' spidermonkey)
 options=('!emptydirs')
 source=(http://search.cpan.org/CPAN/authors/id/C/CL/CLAESJAC/JavaScript-$pkgver.tar.gz)
 #source=(http://search.cpan.org/CPAN/authors/id/T/TB/TBUSCH/JavaScript-SpiderMonkey-0.19.tar.gz)
+groups=('shepherd-dep')
 build() {
   cd  $startdir/src/$_realname-$pkgver
   JS_INC=/usr/include/js   PERL_MM_USE_DEFAULT=1 perl Makefile.PL INSTALLDIRS=vendor || return 1 
diff --git a/abs/core-testing/perl_modules/perl-list-compare/PKGBUILD b/abs/core-testing/perl_modules/perl-list-compare/PKGBUILD
index c1406c1..7480b98 100644
--- a/abs/core-testing/perl_modules/perl-list-compare/PKGBUILD
+++ b/abs/core-testing/perl_modules/perl-list-compare/PKGBUILD
@@ -4,12 +4,13 @@
 pkgname=perl-list-compare
 _realname=List-Compare
 pkgver=0.37
-pkgrel=1
+pkgrel=2
 pkgdesc="List::Compare - Compare elements of two or more lists"
 arch=(i686 x86_64)
 license=('PerlArtistic')
 url="http://search.cpan.org/dist/${_realname}/"
 depends=('perlxml' 'perl>=5.10.0')
+groups=('shepherd-dep')
 options=('!emptydirs')
 source=(ftp://ftp.cpan.org/pub/CPAN/authors/id/J/JK/JKEENAN/${_realname}-${pkgver}.tar.gz)
 md5sums=('7c730dd58cc31a5bbb8eb7006edd1704')
diff --git a/abs/core-testing/perl_modules/perl-pathtools/PKGBUILD b/abs/core-testing/perl_modules/perl-pathtools/PKGBUILD
index 11e69ab..db11a6f 100644
--- a/abs/core-testing/perl_modules/perl-pathtools/PKGBUILD
+++ b/abs/core-testing/perl_modules/perl-pathtools/PKGBUILD
@@ -1,7 +1,7 @@
 
 pkgname=perl-pathtools
 pkgver=3.29
-pkgrel=1
+pkgrel=2
 pkgdesc="get name of current working directory"
 arch=('i686' 'x86_64')
 url="http://search.cpan.org/~KWILLIAMS/Path-Class"
@@ -10,7 +10,7 @@ license=('GPL' 'PerlArtistic')
 depends=('perl>=5.10.0')
 options=('!emptydirs')
 source=(http://search.cpan.org/CPAN/authors/id/S/SM/SMUELLER/PathTools-$pkgver.tar.gz)
-
+groups=('shepherd-dep')
 build() {
   cd  $startdir/src/PathTools-$pkgver
   PERL_MM_USE_DEFAULT=1 perl Makefile.PL INSTALLDIRS=vendor || return 1 
-- 
cgit v0.12


From d1dc84be1c14be8fc0211c583c2eb7cdf44b8504 Mon Sep 17 00:00:00 2001
From: Cecil Hugh Watson <knoppmyth@gmail.com>
Date: Fri, 5 Jun 2009 23:52:43 -0700
Subject: Bumped to latest for vsftpd.

---
 abs/core-testing/libcap/PKGBUILD | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/abs/core-testing/libcap/PKGBUILD b/abs/core-testing/libcap/PKGBUILD
index 8d09b19..a80dccf 100644
--- a/abs/core-testing/libcap/PKGBUILD
+++ b/abs/core-testing/libcap/PKGBUILD
@@ -1,20 +1,22 @@
-#$Id: PKGBUILD 8870 2008-08-16 22:39:56Z eric $
-# Maintainer: Arjan Timmerman <arjan@archlinux.org>
+#$Id: PKGBUILD 29964 2009-03-15 02:32:04Z hugo $
+# Maintainer: Hugo Doria <hugo@archlinux.org>
+
 pkgname=libcap
-pkgver=1.10
-pkgrel=2
+pkgver=2.16
+pkgrel=3
 pkgdesc="POSIX 1003.1e capabilities"
-arch=(i686 x86_64)
+arch=('i686' 'x86_64')
 url="http://www.kernel.org/pub/linux/libs/security/linux-privs/"
-license="GPL"
+license=('GPL')
 depends=('glibc')
-source=(http://www.kernel.org/pub/linux/libs/security/linux-privs/kernel-2.4/${pkgname}-${pkgver}.tar.gz
-	libcap-1.10-debian.patch)
-md5sums=('2c09eea823f67cfdde96177a959bc39b' 'ba642c86c4072917fcff77ec31411194')
+source=(http://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/${pkgname}-${pkgver}.tar.gz)
+md5sums=('9e075fda242c4070ba76407064c13302')
 
 build() {
-  cd ${startdir}/src/${pkgname}-${pkgver}
-  patch -Np1 -i ${startdir}/src/libcap-1.10-debian.patch || return 1
-  make prefix=/usr DESTDIR=${startdir}/pkg install
-  rmdir ${startdir}/pkg/usr/share/man/man2
+  cd ${srcdir}/${pkgname}-${pkgver}
+  sed -i -e "s|LIBDIR=\$(FAKEROOT)\$(lib_prefix)/\$(lib)|LIBDIR=\$(FAKEROOT)/\$(lib)|g" Make.Rules || return 1
+  make prefix=/usr DESTDIR=${pkgdir} install
+
+  rm ${pkgdir}/lib/*.a || return 1
+  chmod 755 ${pkgdir}/lib/libcap.so.* || return 1
 }
-- 
cgit v0.12


From 220f914135c967aeb05e745c9e3c8555330de830 Mon Sep 17 00:00:00 2001
From: Cecil Hugh Watson <knoppmyth@gmail.com>
Date: Sat, 6 Jun 2009 00:03:31 -0700
Subject: Initial inclusion of vsftpd.

---
 abs/extra-testing/community/vsftpd/PKGBUILD       | 52 +++++++++++++++++++++++
 abs/extra-testing/community/vsftpd/run            | 13 ++++++
 abs/extra-testing/community/vsftpd/vsftpd.d       | 40 +++++++++++++++++
 abs/extra-testing/community/vsftpd/vsftpd.install | 22 ++++++++++
 abs/extra-testing/community/vsftpd/vsftpd.xinetd  | 10 +++++
 5 files changed, 137 insertions(+)
 create mode 100644 abs/extra-testing/community/vsftpd/PKGBUILD
 create mode 100644 abs/extra-testing/community/vsftpd/run
 create mode 100644 abs/extra-testing/community/vsftpd/vsftpd.d
 create mode 100644 abs/extra-testing/community/vsftpd/vsftpd.install
 create mode 100644 abs/extra-testing/community/vsftpd/vsftpd.xinetd

diff --git a/abs/extra-testing/community/vsftpd/PKGBUILD b/abs/extra-testing/community/vsftpd/PKGBUILD
new file mode 100644
index 0000000..3c4213e
--- /dev/null
+++ b/abs/extra-testing/community/vsftpd/PKGBUILD
@@ -0,0 +1,52 @@
+# $Id: PKGBUILD 29700 2009-03-11 22:18:56Z hugo $
+# Maintainer: Andreas Radke <andyrtr@archlinux.org>
+# Contributor: judd <jvinet@zeroflux.org>
+
+pkgname=vsftpd
+pkgver=2.1.0
+pkgrel=3
+pkgdesc="Very Secure FTP daemon"
+arch=('i686' 'x86_64')
+license=('GPL')
+backup=(etc/vsftpd.conf etc/xinetd.d/vsftpd)
+url="http://vsftpd.beasts.org/"
+#makedepends=('vim')
+depends=('glibc' 'pam' 'tcp_wrappers>=7.6-8' 'openssl>=0.9.8j-1' 'libcap>=2.16')
+install=vsftpd.install
+source=(ftp://vsftpd.beasts.org/users/cevans/vsftpd-$pkgver.tar.gz \
+        vsftpd.xinetd vsftpd.d run)
+md5sums=('7890b54e7ffa6106ffbdfda53f47fa41'
+         'b07fd4609c70063c1d6b20142910c1a6'
+         'e46ed8e4c4a6e6a3de59f60b98e4f569'
+	 '8abbed7cc75f9a9d2944e0e83c8dd90d')
+
+build() {
+  cd ${srcdir}/${pkgname}-${pkgver}
+  # build-time config
+  sed \
+    -e 's|^#undef VSF_BUILD_TCPWRAPPERS$|#define VSF_BUILD_TCPWRAPPERS|' \
+    -e 's|^#undef VSF_BUILD_SSL$|#define VSF_BUILD_SSL|' \
+    -i builddefs.h
+  make CFLAGS="${CFLAGS}" || return 1
+  install -D -m755 vsftpd ${pkgdir}/usr/sbin/vsftpd || return 1
+  install -D -m644 vsftpd.conf ${pkgdir}/etc/vsftpd.conf || return 1
+  install -D -m644 vsftpd.8 ${pkgdir}/usr/share/man/man8/vsftpd.8 || return 1
+  install -D -m644 vsftpd.conf.5 ${pkgdir}/usr/share/man/man5/vsftpd.conf.5 || return 1
+  install -D -m644 ../vsftpd.xinetd ${pkgdir}/etc/xinetd.d/vsftpd  || return 1
+  install -D -m755 ../vsftpd.d ${pkgdir}/etc/rc.d/vsftpd || return 1
+  mkdir -p $startdir/pkg/usr/share/empty
+#  ex ${pkgdir}/etc/vsftpd.conf <<_EOF
+#2
+#i
+##
+## Use this to use vsftpd in standalone mode, otherwise it runs through (x)inetd
+##listen=YES
+#.
+#w
+#q
+#_EOF
+#}
+# Below added for LinHES
+  mkdir -p $startdir/pkg/etc/sv/vsftpd/supervise
+  cp $startdir/src/run $startdir/pkg/etc/sv/vsftpd/
+}
diff --git a/abs/extra-testing/community/vsftpd/run b/abs/extra-testing/community/vsftpd/run
new file mode 100644
index 0000000..1fd5202
--- /dev/null
+++ b/abs/extra-testing/community/vsftpd/run
@@ -0,0 +1,13 @@
+#!/bin/sh
+exec 2>&1
+. /etc/profile
+. /etc/systemconfig
+export TERM=linux
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+stat_runit "Starting VSFTPD"
+export HOME=/root
+
+# Start vsftpd
+/usr/sbin/vsftpd /etc/vsftpd.conf
diff --git a/abs/extra-testing/community/vsftpd/vsftpd.d b/abs/extra-testing/community/vsftpd/vsftpd.d
new file mode 100644
index 0000000..b43a6d0
--- /dev/null
+++ b/abs/extra-testing/community/vsftpd/vsftpd.d
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID /usr/sbin/vsftpd`
+case "$1" in
+	start)
+		stat_busy "Starting vsftpd FTP Daemon"
+		if [ -z "$PID" ]; then 
+			/usr/sbin/vsftpd &
+			PID=`pidof -o %PPID /usr/sbin/vsftpd`
+			if [ -z $PID ]; then
+				stat_fail
+			else
+				add_daemon vsftpd
+				stat_done
+			fi
+		else
+			stat_fail
+		fi
+	;;
+	stop)
+		stat_busy "Stopping vsftpd FTP Daemon"
+		[ ! -z "$PID" ]  && kill $PID &> /dev/null
+		if [ $? -gt 0 ]; then
+			stat_fail
+		else
+			rm_daemon vsftpd
+			stat_done
+		fi
+	;;
+	restart)
+		$0 stop
+		sleep 1
+		$0 start
+	;;
+	*)
+		echo "usage: $0 {start|stop|restart}"  
+esac
diff --git a/abs/extra-testing/community/vsftpd/vsftpd.install b/abs/extra-testing/community/vsftpd/vsftpd.install
new file mode 100644
index 0000000..3bbb2cc
--- /dev/null
+++ b/abs/extra-testing/community/vsftpd/vsftpd.install
@@ -0,0 +1,22 @@
+# arg 1:  the new package version
+post_install() {
+  if [ -f lib/modules/`uname -r`/kernel/security/capability.ko ]; then
+    echo ">>> It appears that your current kernel has linux security"
+    echo ">>> capabilities built as a module.  vsftpd requires this"
+    echo ">>> functionality to operate."
+    echo ">>>"
+    echo ">>> To activate the module, please load it now (modprobe capability)."
+    echo ">>> Also, you should add it to your MODULES array in rc.conf, so"
+    echo ">>> it will be activated automatically at boot-up."
+  fi
+# Below added for LinHES
+  add_service.sh vsftpd
+}
+
+post_upgrade() {
+  post_install $1
+}
+
+post_remove() {
+	remove_service.sh vsftpd
+}
diff --git a/abs/extra-testing/community/vsftpd/vsftpd.xinetd b/abs/extra-testing/community/vsftpd/vsftpd.xinetd
new file mode 100644
index 0000000..eff2eb3
--- /dev/null
+++ b/abs/extra-testing/community/vsftpd/vsftpd.xinetd
@@ -0,0 +1,10 @@
+service ftp
+{
+        socket_type             = stream
+        wait                    = no
+        user                    = root
+        server                  = /usr/sbin/vsftpd
+        log_on_success  += HOST DURATION
+        log_on_failure  += HOST
+        disable                 = yes
+}
-- 
cgit v0.12


From 321a517e296a8e44bf26a4461f7850c1ec197f9c Mon Sep 17 00:00:00 2001
From: Cecil Hugh Watson <knoppmyth@gmail.com>
Date: Sat, 6 Jun 2009 12:24:31 -0700
Subject: Bumped version to add default cfg, hourly cron job and .install file.

---
 abs/extra-testing/fuppes-svn/PKGBUILD | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/abs/extra-testing/fuppes-svn/PKGBUILD b/abs/extra-testing/fuppes-svn/PKGBUILD
index fd794b6..cca32af 100644
--- a/abs/extra-testing/fuppes-svn/PKGBUILD
+++ b/abs/extra-testing/fuppes-svn/PKGBUILD
@@ -3,15 +3,18 @@
 
 pkgname=fuppes-svn
 pkgver=636
-pkgrel=2
+pkgrel=3
 pkgdesc="A free, multiplatform Universal Plug and Play A/V MediaServer"
 arch=('i686' 'x86_64')
 url="http://fuppes.ulrich-voelkel.de/"
 license=('GPL2')
 depends=('pcre' 'libxml2' 'sqlite3' 'gettext' 'taglib' 'imagemagick' 'ffmpeg' 'libmp4v2' 'lame' 'libvorbis' 'libmpcdec' 'flac' 'faad2' 'libmad')
 makdepends=('pkgconfig' 'autoconf' 'subversion')
-source=(fuppes-r634-archlinux.patch fuppes.diff)
-md5sums=('5d9f6331cc91b64aab69449ce327b214' 'c495fa1bd9a870ae36820632434319ee')
+install=fuppes.install
+source=(fuppes-r634-archlinux.patch fuppes.diff fuppes.cfg run fuppes)
+md5sums=('5d9f6331cc91b64aab69449ce327b214' 'c495fa1bd9a870ae36820632434319ee' \
+	 'b0cef07d8e60d01c8146a69870672elf' 'd8615e017b9929498076c312f134b2ed' \
+	 '3c355b860f1b0d273f5aa8b2bea1bde5')
 
 _svnmod="fuppes"
 _svntrunk="https://fuppes.svn.sourceforge.net/svnroot/fuppes/trunk"
@@ -36,5 +39,11 @@ build()
 	
 	make || return 1
 	make DESTDIR=$startdir/pkg install || return 1
+	mkdir -p $startdir/pkg/etv/sv/fuppes/supervise
+	install -D -m755 $startdir/src/run $startdir/pkg/etc/sv/fuppes/
+	mkdir -p $startdir/pkg/etc/fuppes
+	cp $startdir/src/fuppes.cfg $startdir/pkg/etc/fuppes
+	mkdir -p $startdir/pkg/etc/cron.hourly
+	install -D -m755 $startdir/src/fuppes $startdir/pkg/etc/cron.hourly
 }
 
-- 
cgit v0.12


From b373c7795b4ef0e00ffcaea044ef7a3217bcb658 Mon Sep 17 00:00:00 2001
From: Cecil Hugh Watson <knoppmyth@gmail.com>
Date: Sat, 6 Jun 2009 12:24:52 -0700
Subject: Cron job for hourly database rebuilding.

---
 abs/extra-testing/fuppes-svn/fuppes | 2 ++
 1 file changed, 2 insertions(+)
 create mode 100644 abs/extra-testing/fuppes-svn/fuppes

diff --git a/abs/extra-testing/fuppes-svn/fuppes b/abs/extra-testing/fuppes-svn/fuppes
new file mode 100644
index 0000000..60960b5
--- /dev/null
+++ b/abs/extra-testing/fuppes-svn/fuppes
@@ -0,0 +1,2 @@
+#!/bin/bash
+/usr/bin/wget -O /dev/null -q http://localhost:81/presentation/options.html?db=update &> /dev/null
-- 
cgit v0.12


From 3a21f86ce044101bec01db95777c0476f7868d92 Mon Sep 17 00:00:00 2001
From: Cecil Hugh Watson <knoppmyth@gmail.com>
Date: Sat, 6 Jun 2009 12:25:01 -0700
Subject: Default fuppes.cfg file.

---
 abs/extra-testing/fuppes-svn/fuppes.cfg | 216 ++++++++++++++++++++++++++++++++
 1 file changed, 216 insertions(+)
 create mode 100644 abs/extra-testing/fuppes-svn/fuppes.cfg

diff --git a/abs/extra-testing/fuppes-svn/fuppes.cfg b/abs/extra-testing/fuppes-svn/fuppes.cfg
new file mode 100644
index 0000000..beb81cf
--- /dev/null
+++ b/abs/extra-testing/fuppes-svn/fuppes.cfg
@@ -0,0 +1,216 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<fuppes_config version="0.7.2.3">
+  <shared_objects>
+    <!--<dir>/mnt/music</dir>-->
+    <!--<itunes>/Users/.../iTunes.xml</itunes>-->
+    <dir>/myth/tv</dir>
+    <dir>/myth/video</dir>
+    <dir>/myth/music</dir>
+    <dir>/myth/gallery</dir>
+    <dir>/myth/pretty</dir>
+  </shared_objects>
+  <network>
+    <!--empty = automatic detection-->
+    <interface>192.168.1.253</interface>
+    <!--empty or 0 = random port-->
+    <http_port>81</http_port>
+    <!--list of ip addresses allowed to access fuppes. if empty all ips are allowed-->
+    <allowed_ips>
+      <!--<ip>192.168.0.1</ip>-->
+    </allowed_ips>
+  </network>
+  <content_directory>
+    <!--a list of possible charsets can be found under:
+      http://www.gnu.org/software/libiconv/-->
+    <local_charset>UTF-8</local_charset>
+    <!--libs used for metadata extraction when building the database. [true|false]-->
+    <use_imagemagick>true</use_imagemagick>
+    <use_taglib>true</use_taglib>
+    <use_libavformat>true</use_libavformat>
+  </content_directory>
+  <global_settings>
+    <temp_dir/>
+    <!--uuid is written to and read from <config-dir>/uuid.txt if set to true-->
+    <use_fixed_uuid>false</use_fixed_uuid>
+  </global_settings>
+  <device_settings>
+    <!--"default" settings are inhertied by specific devices and can be overwritten-->
+    <!--do NOT remove the "default" device settings-->
+    <!--all new file types have to be added to the default settings-->
+    <!--adding new file types just to a specific device will have no affect-->
+    <device name="default">
+      <!--specify the maximum length for file names (0 or empty = unlimited)-->
+      <max_file_name_length>0</max_file_name_length>
+      <!--[file|container]-->
+      <playlist_style>file</playlist_style>
+      <show_childcount_in_title>false</show_childcount_in_title>
+      <enable_dlna>false</enable_dlna>
+      <transcoding_release_delay>4</transcoding_release_delay>
+      <file_settings>
+        <!--audio files-->
+        <file ext="mp3">
+          <type>AUDIO_ITEM</type>
+          <mime_type>audio/mpeg</mime_type>
+          <dlna>MP3</dlna>
+        </file>
+        <file ext="ogg">
+          <type>AUDIO_ITEM</type>
+          <mime_type>application/octet-stream</mime_type>
+          <transcode enabled="true">
+            <ext>mp3</ext>
+            <mime_type>audio/mpeg</mime_type>
+            <dlna>MP3</dlna>
+            <http_encoding>chunked</http_encoding>
+            <decoder>vorbis</decoder>
+            <encoder>lame</encoder>
+            <bitrate>192</bitrate>
+            <samplerate>44100</samplerate>
+          </transcode>
+        </file>
+        <file ext="mpc">
+          <type>AUDIO_ITEM</type>
+          <mime_type>application/octet-stream</mime_type>
+          <transcode enabled="true">
+            <ext>mp3</ext>
+            <mime_type>audio/mpeg</mime_type>
+            <dlna>MP3</dlna>
+            <http_encoding>chunked</http_encoding>
+            <decoder>musepack</decoder>
+            <encoder>lame</encoder>
+            <bitrate>192</bitrate>
+            <samplerate>44100</samplerate>
+          </transcode>
+        </file>
+        <file ext="wav">
+          <type>AUDIO_ITEM</type>
+          <mime_type>audio/x-wav</mime_type>
+        </file>
+        <file ext="flac">
+          <type>AUDIO_ITEM</type>
+          <mime_type>audio/x-flac</mime_type>
+          <transcode enabled="true">
+            <ext>mp3</ext>
+            <mime_type>audio/mpeg</mime_type>
+            <dlna>MP3</dlna>
+            <http_encoding>chunked</http_encoding>
+            <decoder>flac</decoder>
+            <encoder>lame</encoder>
+            <bitrate>192</bitrate>
+            <samplerate>44100</samplerate>
+          </transcode>
+        </file>
+        <file ext="wma">
+          <type>AUDIO_ITEM</type>
+          <mime_type>audio/x-ms-wma</mime_type>
+          <dlna>WMAFULL</dlna>
+        </file>
+        <!--image files-->
+        <file ext="jpg">
+          <ext>jpeg</ext>
+          <type>IMAGE_ITEM</type>
+          <mime_type>image/jpeg</mime_type>
+          <convert enabled="false">
+            <!--<dcraw enabled="true">-q 0</dcraw>-->
+            <ext>png</ext>
+            <mime_type>image/png</mime_type>
+            <height>0</height>
+            <width>0</width>
+            <!--set "greater" to "true" if you only want to resize images greater than "height" or "width"-->
+            <greater>false</greater>
+            <!--set "less" to "true" if you only want to resize images less than "height" or "width"-->
+            <less>false</less>
+            <!--set "less" and "greater" to "false" if you always want to resize-->
+          </convert>
+        </file>
+        <file ext="bmp">
+          <type>IMAGE_ITEM</type>
+          <mime_type>image/bmp</mime_type>
+        </file>
+        <file ext="png">
+          <type>IMAGE_ITEM</type>
+          <mime_type>image/png</mime_type>
+        </file>
+        <file ext="gif">
+          <type>IMAGE_ITEM</type>
+          <mime_type>image/gif</mime_type>
+        </file>
+        <!--video files-->
+        <file ext="mpg">
+          <ext>mpeg</ext>
+          <type>VIDEO_ITEM</type>
+          <mime_type>video/mpeg</mime_type>
+        </file>
+        <file ext="mp4">
+          <type>VIDEO_ITEM</type>
+          <mime_type>video/mp4</mime_type>
+        </file>
+        <file ext="avi">
+          <type>VIDEO_ITEM</type>
+          <mime_type>video/x-msvideo</mime_type>
+        </file>
+        <file ext="wmv">
+          <type>VIDEO_ITEM</type>
+          <mime_type>video/x-ms-wmv</mime_type>
+        </file>
+        <file ext="vob">
+          <type>VIDEO_ITEM</type>
+          <mime_type>video/x-ms-vob</mime_type>
+        </file>
+        <file ext="vdr">
+          <type>VIDEO_ITEM</type>
+          <mime_type>video/x-extension-vdr</mime_type>
+          <transcode enabled="true">
+            <ext>vob</ext>
+            <mime_type>video/x-ms-vob</mime_type>
+          </transcode>
+        </file>
+        <file ext="flv">
+          <type>VIDEO_ITEM</type>
+          <mime_type>application/x-flash-video</mime_type>
+        </file>
+        <file ext="asf">
+          <type>VIDEO_ITEM</type>
+          <mime_type>video/x-ms-asf</mime_type>
+        </file>
+        <!--playlists-->
+        <file ext="pls">
+          <type>PLAYLIST</type>
+          <mime_type>audio/x-scpls</mime_type>
+        </file>
+        <file ext="m3u">
+          <type>PLAYLIST</type>
+          <mime_type>audio/x-mpegurl</mime_type>
+        </file>
+      </file_settings>
+    </device>
+    <!--For other device settings take a look at http://fuppes.ulrich-voelkel.de/wiki/index.php/Category:Device-->
+    <!--If you have more than one device it is a good idea to set the ip address as some devices may have conflicting "user agents".-->
+    <!--It is safe to remove unneeded devices-->
+    <device name="PS3" enabled="false">
+      <user_agent>UPnP/1.0 DLNADOC/1.00</user_agent>
+      <user_agent>PLAYSTATION3</user_agent>
+      <!--<ip></ip>-->
+      <enable_dlna>true</enable_dlna>
+      <transcoding_release_delay>50</transcoding_release_delay>
+      <file_settings>
+        <file ext="ogg">
+          <type>AUDIO_ITEM_MUSIC_TRACK</type>
+          <transcode enabled="true">
+            <http_encoding>stream</http_encoding>
+          </transcode>
+        </file>
+      </file_settings>
+    </device>
+    <device name="Xbox 360" virtual="Xbox 360" enabled="false">
+      <user_agent>Xbox/2.0.\d+.\d+ UPnP/1.0 Xbox/2.0.\d+.\d+</user_agent>
+      <user_agent>Xenon</user_agent>
+      <xbox360>true</xbox360>
+      <show_empty_resolution>true</show_empty_resolution>
+      <description_values>
+        <friendly_name>%s %v : 1 : Windows Media Connect</friendly_name>
+        <model_name>Windows Media Connect compatible (%s)</model_name>
+        <model_number>2.0</model_number>
+      </description_values>
+    </device>
+  </device_settings>
+</fuppes_config>
-- 
cgit v0.12


From 10adcc3196f77c041d400ca5851d1b3e4f86be46 Mon Sep 17 00:00:00 2001
From: Cecil Hugh Watson <knoppmyth@gmail.com>
Date: Sat, 6 Jun 2009 12:25:13 -0700
Subject: Install file for fuppes.

---
 abs/extra-testing/fuppes-svn/fuppes.install | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
 create mode 100644 abs/extra-testing/fuppes-svn/fuppes.install

diff --git a/abs/extra-testing/fuppes-svn/fuppes.install b/abs/extra-testing/fuppes-svn/fuppes.install
new file mode 100644
index 0000000..029c3f0
--- /dev/null
+++ b/abs/extra-testing/fuppes-svn/fuppes.install
@@ -0,0 +1,18 @@
+# arg 1:  the new package version
+post_install() {
+  sv stop mythbackend
+  mv /etc/sv/mythbackend/run /tmp
+  sed 's/logfile/noupnp\ --logfile/' </tmp/run >/etc/sv/mythbackend
+  sv start mythbackend
+  add_service.sh fuppes
+  sv start fuppes
+}
+
+post_remove() {
+	sv stop fuppes
+	remove_service.sh fuppes
+	mv /etc/sv/mythbackend/run /tmp/run
+	sv stop mythbackend
+	sed 's/--noupnp\ --logfile/--logfile/' </tmp/run >/etc/sv/mythbackend/run
+	sv start mythbackend
+}
-- 
cgit v0.12


From 8520f23354765b7aadd78eeca2f4d8d2d6f6ddd4 Mon Sep 17 00:00:00 2001
From: Cecil Hugh Watson <knoppmyth@gmail.com>
Date: Sat, 6 Jun 2009 12:25:28 -0700
Subject: Runit file to control fuppes.

---
 abs/extra-testing/fuppes-svn/run | 2 ++
 1 file changed, 2 insertions(+)
 create mode 100755 abs/extra-testing/fuppes-svn/run

diff --git a/abs/extra-testing/fuppes-svn/run b/abs/extra-testing/fuppes-svn/run
new file mode 100755
index 0000000..670a3dd
--- /dev/null
+++ b/abs/extra-testing/fuppes-svn/run
@@ -0,0 +1,2 @@
+#!/bin/bash
+exec /usr/bin/fuppes --config-dir /etc/fuppes --database-file /data/srv/fuppes/fuppes.db --temp-dir /myth/tmp
-- 
cgit v0.12


From c1582d92ad97d1e54aec1faa4e6ac4752d60aa01 Mon Sep 17 00:00:00 2001
From: Cecil Hugh Watson <knoppmyth@gmail.com>
Date: Sat, 6 Jun 2009 12:34:22 -0700
Subject: Bumped version to fixes packager errors. :)

---
 abs/extra-testing/fuppes-svn/PKGBUILD | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/abs/extra-testing/fuppes-svn/PKGBUILD b/abs/extra-testing/fuppes-svn/PKGBUILD
index cca32af..849015d 100644
--- a/abs/extra-testing/fuppes-svn/PKGBUILD
+++ b/abs/extra-testing/fuppes-svn/PKGBUILD
@@ -3,7 +3,7 @@
 
 pkgname=fuppes-svn
 pkgver=636
-pkgrel=3
+pkgrel=4
 pkgdesc="A free, multiplatform Universal Plug and Play A/V MediaServer"
 arch=('i686' 'x86_64')
 url="http://fuppes.ulrich-voelkel.de/"
@@ -11,10 +11,10 @@ license=('GPL2')
 depends=('pcre' 'libxml2' 'sqlite3' 'gettext' 'taglib' 'imagemagick' 'ffmpeg' 'libmp4v2' 'lame' 'libvorbis' 'libmpcdec' 'flac' 'faad2' 'libmad')
 makdepends=('pkgconfig' 'autoconf' 'subversion')
 install=fuppes.install
-source=(fuppes-r634-archlinux.patch fuppes.diff fuppes.cfg run fuppes)
+source=(fuppes-r634-archlinux.patch fuppes.diff fuppes.cfg run fuppes.ch)
 md5sums=('5d9f6331cc91b64aab69449ce327b214' 'c495fa1bd9a870ae36820632434319ee' \
-	 'b0cef07d8e60d01c8146a69870672elf' 'd8615e017b9929498076c312f134b2ed' \
-	 '3c355b860f1b0d273f5aa8b2bea1bde5')
+	 'b0cef07d8e60d01c8146a69870672e1f' 'd8615e017b9929498076c312f134b2ed' \
+	 '3c355b860f1b0d273f5aa8b2bea1bde6')
 
 _svnmod="fuppes"
 _svntrunk="https://fuppes.svn.sourceforge.net/svnroot/fuppes/trunk"
-- 
cgit v0.12


From 1904a84c254fb7e15602d051c5a224800f3de11a Mon Sep 17 00:00:00 2001
From: Cecil Hugh Watson <knoppmyth@gmail.com>
Date: Sat, 6 Jun 2009 12:34:49 -0700
Subject: Removed as it has the same name as _svnmod.

---
 abs/extra-testing/fuppes-svn/fuppes | 2 --
 1 file changed, 2 deletions(-)
 delete mode 100644 abs/extra-testing/fuppes-svn/fuppes

diff --git a/abs/extra-testing/fuppes-svn/fuppes b/abs/extra-testing/fuppes-svn/fuppes
deleted file mode 100644
index 60960b5..0000000
--- a/abs/extra-testing/fuppes-svn/fuppes
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/bash
-/usr/bin/wget -O /dev/null -q http://localhost:81/presentation/options.html?db=update &> /dev/null
-- 
cgit v0.12


From fb60333ca7e5c6a4d4686edb67da82c8f0d7dadb Mon Sep 17 00:00:00 2001
From: Cecil Hugh Watson <knoppmyth@gmail.com>
Date: Sat, 6 Jun 2009 12:35:05 -0700
Subject: Cron job for fuppes.

---
 abs/extra-testing/fuppes-svn/fuppes.ch | 2 ++
 1 file changed, 2 insertions(+)
 create mode 100644 abs/extra-testing/fuppes-svn/fuppes.ch

diff --git a/abs/extra-testing/fuppes-svn/fuppes.ch b/abs/extra-testing/fuppes-svn/fuppes.ch
new file mode 100644
index 0000000..60960b5
--- /dev/null
+++ b/abs/extra-testing/fuppes-svn/fuppes.ch
@@ -0,0 +1,2 @@
+#!/bin/bash
+/usr/bin/wget -O /dev/null -q http://localhost:81/presentation/options.html?db=update &> /dev/null
-- 
cgit v0.12


From 58b4cb933cbdbbe4f0aa6d13faee02fbae65267b Mon Sep 17 00:00:00 2001
From: Cecil Hugh Watson <knoppmyth@gmail.com>
Date: Sat, 6 Jun 2009 12:37:08 -0700
Subject: Bumped version to fix packager errors.

---
 abs/extra-testing/fuppes-svn/PKGBUILD | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/abs/extra-testing/fuppes-svn/PKGBUILD b/abs/extra-testing/fuppes-svn/PKGBUILD
index 849015d..338c113 100644
--- a/abs/extra-testing/fuppes-svn/PKGBUILD
+++ b/abs/extra-testing/fuppes-svn/PKGBUILD
@@ -3,7 +3,7 @@
 
 pkgname=fuppes-svn
 pkgver=636
-pkgrel=4
+pkgrel=5
 pkgdesc="A free, multiplatform Universal Plug and Play A/V MediaServer"
 arch=('i686' 'x86_64')
 url="http://fuppes.ulrich-voelkel.de/"
@@ -44,6 +44,6 @@ build()
 	mkdir -p $startdir/pkg/etc/fuppes
 	cp $startdir/src/fuppes.cfg $startdir/pkg/etc/fuppes
 	mkdir -p $startdir/pkg/etc/cron.hourly
-	install -D -m755 $startdir/src/fuppes $startdir/pkg/etc/cron.hourly
+	install -D -m755 $startdir/src/fuppes.ch $startdir/pkg/etc/cron.hourly
 }
 
-- 
cgit v0.12


From b393e23b9d1b3f840811712dc0c6fabc985f4e24 Mon Sep 17 00:00:00 2001
From: Cecil Hugh Watson <knoppmyth@gmail.com>
Date: Sat, 6 Jun 2009 12:44:59 -0700
Subject: Fixed typo.

---
 abs/extra-testing/fuppes-svn/PKGBUILD | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/abs/extra-testing/fuppes-svn/PKGBUILD b/abs/extra-testing/fuppes-svn/PKGBUILD
index 338c113..3c14ddd 100644
--- a/abs/extra-testing/fuppes-svn/PKGBUILD
+++ b/abs/extra-testing/fuppes-svn/PKGBUILD
@@ -39,7 +39,7 @@ build()
 	
 	make || return 1
 	make DESTDIR=$startdir/pkg install || return 1
-	mkdir -p $startdir/pkg/etv/sv/fuppes/supervise
+	mkdir -p $startdir/pkg/etc/sv/fuppes/supervise
 	install -D -m755 $startdir/src/run $startdir/pkg/etc/sv/fuppes/
 	mkdir -p $startdir/pkg/etc/fuppes
 	cp $startdir/src/fuppes.cfg $startdir/pkg/etc/fuppes
-- 
cgit v0.12


From 60cd3b7cdb907a8e5e4cfb48c5498458cb7f2c64 Mon Sep 17 00:00:00 2001
From: Cecil Hugh Watson <knoppmyth@gmail.com>
Date: Sat, 6 Jun 2009 12:54:07 -0700
Subject: Fixed packager error.

---
 abs/extra-testing/fuppes-svn/fuppes.install | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/abs/extra-testing/fuppes-svn/fuppes.install b/abs/extra-testing/fuppes-svn/fuppes.install
index 029c3f0..a35aebe 100644
--- a/abs/extra-testing/fuppes-svn/fuppes.install
+++ b/abs/extra-testing/fuppes-svn/fuppes.install
@@ -2,7 +2,7 @@
 post_install() {
   sv stop mythbackend
   mv /etc/sv/mythbackend/run /tmp
-  sed 's/logfile/noupnp\ --logfile/' </tmp/run >/etc/sv/mythbackend
+  sed 's/logfile/noupnp\ --logfile/' </tmp/run >/etc/sv/mythbackend/run
   sv start mythbackend
   add_service.sh fuppes
   sv start fuppes
-- 
cgit v0.12


From 564edb5f65fcda73275b7bd3ea04dc4650669552 Mon Sep 17 00:00:00 2001
From: Cecil Hugh Watson <knoppmyth@gmail.com>
Date: Sat, 6 Jun 2009 13:05:38 -0700
Subject: Bumped version for inclusion of fuppes.php and modications to
 index.html.

---
 abs/core-testing/local-website/PKGBUILD | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/abs/core-testing/local-website/PKGBUILD b/abs/core-testing/local-website/PKGBUILD
index e02a757..6ce813c 100644
--- a/abs/core-testing/local-website/PKGBUILD
+++ b/abs/core-testing/local-website/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=local-website
 pkgver=2
-pkgrel=6
+pkgrel=7
 pkgdesc="Contents of http://localhost"
 arch=(i686 x86_64)
 license=('GPL')
-- 
cgit v0.12


From d3cec1f30285b9fa6a774443a59c9f4d65a9263f Mon Sep 17 00:00:00 2001
From: Cecil Hugh Watson <knoppmyth@gmail.com>
Date: Sat, 6 Jun 2009 13:05:57 -0700
Subject: Modified index.html to reflect more LinHES work.

---
 abs/core-testing/local-website/htdocs/index.html | 73 ++++++++++--------------
 1 file changed, 31 insertions(+), 42 deletions(-)

diff --git a/abs/core-testing/local-website/htdocs/index.html b/abs/core-testing/local-website/htdocs/index.html
index 661f673..14d5c22 100644
--- a/abs/core-testing/local-website/htdocs/index.html
+++ b/abs/core-testing/local-website/htdocs/index.html
@@ -1,22 +1,39 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
 <head>
+
+  
   <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
+
+  
   <meta content="Cecil Watson" name="author">
+
+  
+ 
+  
   <title>LinHES R6</title>
   <link href="KnoppMyth.css" rel="stylesheet" type="text/css">
 </head>
+
+
 <body>
 <p align="center"><a href="http://www.mysettopbox.tv">
       <img src="header.png" alt="Tux with a Remote" align="middle" border="0"></a>
   </p>
+
+	
+  
 <table align="center" border="0" cellpadding="5">
 
     <tbody>
+
       <tr>
+
 	<td style="vertical-align: top;">
+	  
       <p class="headerimage" align="center"><b>The Linux Home Entertainment System Release 6</b></p>
 
+	  
       <p><a href="mythweb/mythweb.php"><b>MythWeb</b></a>: <br>
 
 		&nbsp; &nbsp; The MythWeb allows you to use a web page to control
@@ -24,6 +41,7 @@
 		but it is dependent upon MythTV being installed and operational."
 	  </p>
 
+	  
       <p><a href="remote/index.html"><b>MythTV Web Virtual Remote</b></a>: <br>
 
 		&nbsp; &nbsp; A web based virtual remote control for MythTV.
@@ -32,32 +50,38 @@
 		<b>Utilities/Setup -&gt; Setup -&gt; General -&gt; Fourth Page</b>.
 	  </p>
 
+	  
       <p><a href="mythtv-doc/mythtv-HOWTO.html"><b>MythTV Documentation</b></a>: <br>
 
 		&nbsp; &nbsp; The MythTV Installation / User's Guide.
 	  </p>
 
+	  
       <p><a href="mythtv-doc/keys.txt"><b>MythTV Keybindings</b></a>: <br>
 
 		&nbsp; &nbsp; The keybindings for the normal MythTV interface.
 	  </p>
 
+	  
       <p><a href="linhes.html"><b>LinHES</b></a>: <br>
 
 		&nbsp; &nbsp; Describes how "The Project Leader" setup multiple systems
 		to form a <b>Lin</b>ux <b>H</b>ome <b>E</b>ntertainment <b>S</b>ystem.
 	  </p>
 
+	  
       <p><a href="folding@home/"><b>My Folding Status</b></a>: <br>
 
 		&nbsp; &nbsp; Status of the folding@home work for the local user.
 	  </p>
 
+	  
       <p><a href="http://fah-web.stanford.edu/cgi-bin/main.py?qtype=teampage&amp;teamnum=50975"><b>Folding@home</b></a>: <br>
 
 		&nbsp; &nbsp; KnoppMyth Team status for the folding@home effort.
 	  </p>
 
+	  
       <p><a href="ipodfeed/"><b>iPod Feeds</b></a> <br>
 
 		&nbsp; &nbsp; Transcodes ready for the ipod (if any).</p>
@@ -67,62 +91,27 @@
 &nbsp;&nbsp;&nbsp; FUPPES - Free UPnP Entertainment Service. &nbsp;A
 UPnP to be used inplace of the UPnP server that comes with MythTV.
 &nbsp;If the UPnP that comes with MythTV doesn't work for you, you can
-try FUPPES. &nbsp;Edit <i>/etc/sv/mythtvbackend/run</i>, and add "<i>--noupnp</i>"
-to the command line for <i>/usr/bin/mythbackend</i>. &nbsp;Then restart the
-backend and start FUPPES.</p>
-      <p style="font-weight: bold;">sv restart mythtvbackend fuppes</p>
-      <p>If you want FUPPES to start on boot add a link to the
-      <i>/etc/sv/fuppes</i> directory under <i>/var/service</i>.</p>
-      <p><b>ln -s /etc/sv/fuppes /var/service</b></p>
-      <p></p>
-
-      <p><a href="motion/index.html"><b>Motion</b></a>: <br>
-
-		&nbsp; &nbsp; Motion is a software motion detector. The configuration file for
-		motion is <i>/etc/motion/motion.conf</i>. All you should have to do is edit
-		"videodevice" to point to your webcam or capture device. You'll also
-		need to change the IP in <i>/var/www/motion/index.html</i> to the IP of your
-		backend.
-		<br><br>
-
-		&nbsp; &nbsp; As root: <b>sv start motion</b> will start motion.
-		To have it start automatically add a link to the
-                <i>/etc/sv/motion</i> directory under <i>/var/service</i>.</p>
-                <p><b>ln -s /etc/sv/motion /var/service</b></p>
-		<p>Images and video are stored in <i>/myth/motion</i>.
-		Symlinks to <i>/myth/gallery</i> and <i>/myth/video</i> exist.
-                <br><br>
-
-		For further detail on configuring Motion, please read the
-		<a href="http://www.lavrsen.dk/twiki/bin/view/Motion/MotionGuide">Motion Guide</a>.
-
-	  </p>
-
+try FUPPES.
+	  
       <p><a href="rrd/index.html"><b>RRDTool</b></a>: <br>
 
 		&nbsp; &nbsp; Hardware status graphs.
 	  </p>
 
-      <p><a href="vlc_control.php"><b>VLC HTTP Interface</b></a>: <br>
-
-		&nbsp; &nbsp; Web interface for VideoLan Client.
-	  </p>
-
-	  <b>Tip:</b>
-		&nbsp;If you seem to be stuck in a
-		loop when trying to select a video to stream from MythWeb
-		(MythStreamTV), go back to the main
-		<a href="mythweb/">MythWeb</a> page and select &nbsp;"StreamTV" again.
-
+	  
       <p><a href="javascript:void(0)"onclick="window.open('mythweb/data/mp3player.html','linkname','height=100, width=260,scrollbars=no')"><b>KnoppMyth Radio</b></a>: <br>
 
                 &nbsp; &nbsp; Your music must be encoded as MP3 in MythMusic for this to work.</p>
+	  
         </td>
+
       </tr>
+
     <tr>
       <td style="vertical-align: top;"></td>
     </tr>
   </tbody>
+  
 </table>
 
 </body>
-- 
cgit v0.12


From 2b93b25ab290526d4def70668d136aa1ec0987f1 Mon Sep 17 00:00:00 2001
From: Cecil Hugh Watson <knoppmyth@gmail.com>
Date: Sat, 6 Jun 2009 13:06:12 -0700
Subject: PHP to redirect to fuppes.

---
 abs/core-testing/local-website/htdocs/fuppes.php | 4 ++++
 1 file changed, 4 insertions(+)
 create mode 100644 abs/core-testing/local-website/htdocs/fuppes.php

diff --git a/abs/core-testing/local-website/htdocs/fuppes.php b/abs/core-testing/local-website/htdocs/fuppes.php
new file mode 100644
index 0000000..f082f31
--- /dev/null
+++ b/abs/core-testing/local-website/htdocs/fuppes.php
@@ -0,0 +1,4 @@
+<?php
+$HTTP_HOST = getenv('HTTP_HOST');
+header("Location: http://$HTTP_HOST:81/");
+?>
-- 
cgit v0.12


From c13eeafc9aa43d7b2c4a457987409e9da03af481 Mon Sep 17 00:00:00 2001
From: Cecil Hugh Watson <knoppmyth@gmail.com>
Date: Sat, 6 Jun 2009 13:12:54 -0700
Subject: Bumped version as run needs to be able to be ran.

---
 abs/extra-testing/community/vsftpd/PKGBUILD | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/abs/extra-testing/community/vsftpd/PKGBUILD b/abs/extra-testing/community/vsftpd/PKGBUILD
index 3c4213e..32a4007 100644
--- a/abs/extra-testing/community/vsftpd/PKGBUILD
+++ b/abs/extra-testing/community/vsftpd/PKGBUILD
@@ -4,7 +4,7 @@
 
 pkgname=vsftpd
 pkgver=2.1.0
-pkgrel=3
+pkgrel=4
 pkgdesc="Very Secure FTP daemon"
 arch=('i686' 'x86_64')
 license=('GPL')
@@ -48,5 +48,5 @@ build() {
 #}
 # Below added for LinHES
   mkdir -p $startdir/pkg/etc/sv/vsftpd/supervise
-  cp $startdir/src/run $startdir/pkg/etc/sv/vsftpd/
+  install -D -m755 $startdir/src/run $startdir/pkg/etc/sv/vsftpd/
 }
-- 
cgit v0.12

