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

