From e64ae16a10e7c506efbfd473d8738eddd7c46c7b Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Fri, 28 Nov 2008 11:23:00 -0600
Subject: -fix timezip to support region/subregion. -Restore sudo all for the
 mythtv user

---
 abs/mv-core/MythVantage-config/PKGBUILD    |  2 +-
 abs/mv-core/MythVantage-config/timezip.py  | 43 ++++++++++++++++++++++++++++++
 abs/mv-core/MythVantage-system/PKGBUILD    |  2 +-
 abs/mv-core/MythVantage-system/STB.install |  3 ++-
 4 files changed, 47 insertions(+), 3 deletions(-)

diff --git a/abs/mv-core/MythVantage-config/PKGBUILD b/abs/mv-core/MythVantage-config/PKGBUILD
index 0a1178b..377083b 100755
--- a/abs/mv-core/MythVantage-config/PKGBUILD
+++ b/abs/mv-core/MythVantage-config/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=MythVantage-config
 pkgver=3.2
-pkgrel=141
+pkgrel=142
 pkgdesc="The Gui-installer"
 depends=(bc mysql-python expect curl dnsutils sg3_utils parted)
 arch=('i686')
diff --git a/abs/mv-core/MythVantage-config/timezip.py b/abs/mv-core/MythVantage-config/timezip.py
index 7a35475..18f338f 100755
--- a/abs/mv-core/MythVantage-config/timezip.py
+++ b/abs/mv-core/MythVantage-config/timezip.py
@@ -20,6 +20,8 @@ def printvars():
     print "BEhostname:" + BEhostname
     print "zipcode:" + zipcode
     print "timezone:" + tz
+    print "timezone region:" + tz_region
+    print "timezone subregion:" + tz_subregion
     print "nfsip:" + nfsip
     print "nfstoggle:" + nfstoggle
     print "nfsmount:"  + nfsmount
@@ -30,6 +32,8 @@ def selectvars():
     global BEhostname
     global zipcode
     global tz
+    global tz_region
+    global tz_subregion
     global nfsip
     global nfstoggle
     global nfsmount
@@ -77,7 +81,22 @@ def selectvars():
         tz=result[0]
     except TypeError:
         tz=""
+##########
+    cursor.execute("select data from settings where value='HostTimeZoneRegion' and hostname=(%s)",(BEhostname))
+    result = cursor.fetchone()
+    try:
+        tz_region=result[0]
+    except TypeError:
+        tz=""
+    tempsubregion="HostTimeZoneRegion_" + tz_region
 
+    cursor.execute("select data from settings where value=%s and hostname=(%s)",(tempsubregion,BEhostname))
+    result = cursor.fetchone()
+    try:
+        tz_subregion=result[0]
+    except TypeError:
+        tz_subregion=""
+###############
     if  ( thishostname != BEhostname ):
         cursor.execute("select data from settings where value='GlobalServiceHobbitserver'")
         result = cursor.fetchone()
@@ -114,6 +133,27 @@ def insertvars():
             cursor.execute("update settings set data=(%s) where hostname=(%s) and value='HostTimeZone'",(tz,thishostname))
             print "updating timezone"
 
+    cursor.execute("select *  from settings where value='HostTimeZoneRegion' and hostname=(%s)",(thishostname))
+    result = cursor.fetchone()
+    if ( tz != ""):
+         if (result == None):
+            cursor.execute("INSERT INTO  settings (value,data,hostname) VALUES ('HostTimeZoneRegion',(%s),(%s))",(tz_region,thishostname))
+            print "inserting timezone region"
+         else:
+            cursor.execute("update settings set data=(%s) where hostname=(%s) and value='HostTimeZoneRegion'",(tz_region,thishostname))
+            print "updating timezone region"
+
+    tempsubregion="HostTimeZoneRegion_" + tz_region
+    cursor.execute("select *  from settings where value=%s and hostname=(%s)",(tempsubregion,thishostname))
+    result = cursor.fetchone()
+    if ( tz != ""):
+         if (result == None):
+            cursor.execute("INSERT INTO  settings (value,data,hostname) VALUES ((%s),(%s),(%s))",(tempsubregion,tz_subregion,thishostname))
+            print "inserting timezone subregion"
+         else:
+            cursor.execute("update settings set data=(%s) where hostname=(%s) and value=(%s)",(tempsubregion,tz_subregion,thishostname))
+            print "updating timezone subregion"
+
 
 #start of NFSIP
     cursor.execute("select data from settings where value='HostCentralNFSIP' and hostname=(%s)",(thishostname))
@@ -157,6 +197,9 @@ def main(argv):
     global BEhostname
     global zipcode
     global tz
+    global tz_region
+    global tz_subregion
+
     global nfsip
     global hobbitclient
     try:
diff --git a/abs/mv-core/MythVantage-system/PKGBUILD b/abs/mv-core/MythVantage-system/PKGBUILD
index 7f01ac0..6a10b71 100644
--- a/abs/mv-core/MythVantage-system/PKGBUILD
+++ b/abs/mv-core/MythVantage-system/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=MythVantage-system
 pkgver=1.0
-pkgrel=1
+pkgrel=2
 arch=('i686')
 MVDIR=$startdir/pkg/usr/MythVantage
 BINDIR=$startdir/pkg/usr/bin
diff --git a/abs/mv-core/MythVantage-system/STB.install b/abs/mv-core/MythVantage-system/STB.install
index d10e0c1..135663e 100644
--- a/abs/mv-core/MythVantage-system/STB.install
+++ b/abs/mv-core/MythVantage-system/STB.install
@@ -38,8 +38,9 @@ LINE13="nobody    ALL = NOPASSWD: /usr/MythVantage/bin/build_diskless.sh"
 LINE14="nobody    ALL = NOPASSWD: /sbin/sv stop dnsmasq"
 LINE15="nobody    ALL = NOPASSWD: /sbin/sv start dnsmasq"
 LINE16="nobody    ALL = NOPASSWD: /sbin/sv hup  dnsmasq"
+LINE17="mythtv    ALL =(ALL) NOPASSWD: ALL"
 
-for i in "$LINE" "$LINE1" "$LINE2" "$LINE3" "$LINE4" "$LINE5" "$LINE7" "$LINE8" "$LINE9"  "$LINE10" "$LINE11" "$LINE12" "$LINE13" "$LINE14" "$LINE15" "$LINE16"
+for i in "$LINE" "$LINE1" "$LINE2" "$LINE3" "$LINE4" "$LINE5" "$LINE7" "$LINE8" "$LINE9"  "$LINE10" "$LINE11" "$LINE12" "$LINE13" "$LINE14" "$LINE15" "$LINE16" "$LINE17"
 do
         cp /etc/sudoers /etc/sudoers.bak
         grep -q "$i" /etc/sudoers
-- 
cgit v0.12

