From af02ac9e699ac0b9d5802d99fdb069859fef6c0a Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Thu, 9 Aug 2012 16:58:18 -0500
Subject: linhes-config: changed sudo rules for post install, added sudo to
 list of depends

---
 abs/core/LinHES-config/LinHES.install    | 85 --------------------------------
 abs/core/LinHES-config/PKGBUILD          | 23 +++++----
 abs/core/LinHES-config/config-sudo.rules |  3 ++
 abs/core/LinHES-config/config.install    | 63 +++++++++++++++++++++++
 4 files changed, 80 insertions(+), 94 deletions(-)
 delete mode 100644 abs/core/LinHES-config/LinHES.install
 create mode 100644 abs/core/LinHES-config/config-sudo.rules
 create mode 100644 abs/core/LinHES-config/config.install

diff --git a/abs/core/LinHES-config/LinHES.install b/abs/core/LinHES-config/LinHES.install
deleted file mode 100644
index fb967aa..0000000
--- a/abs/core/LinHES-config/LinHES.install
+++ /dev/null
@@ -1,85 +0,0 @@
-# This is a default template for a post-install scriptlet.  You can
-# remove any functions you don't need (and this header).
-
-# arg 1:  the new package version
-pre_install() {
-  rm -f /etc/issue
-  rm -f /etc/arch-release
-
-}
-
-# arg 1:  the new package version
-post_install() {
-    if [ ! -f /etc/blacklist.package ]
-    then
-        echo "List of packages to ignore" > /etc/blacklist.package
-        echo "one package per line" >> /etc/blacklist.package
-    fi
-
-LINE="mythtv    ALL = NOPASSWD:/usr/MythVantage/bin/mythvantage"
-LINE1="mythtv   ALL = NOPASSWD:/usr/MythVantage/bin/MythVantage"
-    for i in "$LINE"  "$LINE1"
-    do
-        cp /etc/sudoers /etc/sudoers.bak
-        grep -q "$i" /etc/sudoers
-        if [ $? != 0 ]
-        then
-            echo  "$i" >> /etc/sudoers
-            visudo -cf /etc/sudoers
-            if [ ! $? = 0 ]
-            then
-                cp /etc/sudoers.bak /etc/sudoers
-                echo $i
-                echo "Error adding files"
-                exit 1
-            fi
-        fi
-    done
-
-
-}
-
-# arg 1:  the new package version
-# arg 2:  the old package version
-pre_upgrade() {
-  /bin/true
-}
-
-# arg 1:  the new package version
-# arg 2:  the old package version
-post_upgrade() {
-    . /etc/profile
-    ps -ef|grep mysqld|grep -v grep
-    status=$?
-    echo "status $status"
-    if [ $status  = 0 ]
-    then
-        restore_default_settings.sh -c load
-    fi
-        if [ ! -f /etc/blacklist.package ]
-        then
-            echo "List of packages to ignore" > /etc/blacklist.package
-            echo  "one package per line" >> /etc/blacklist.package
-        fi
-    cat /etc/LinHES-release > /etc/os_myth_release
-
-    if [ ! -f /usr/share/mythtv/config.xml ]
-    then
-       echo "config.xml not found, generating a new one"
-       /usr/MythVantage/bin/systemconfig.py -m hostype
-    fi
-}
-
-# arg 1:  the old package version
-pre_remove() {
-  /bin/true
-}
-
-# arg 1:  the old package version
-post_remove() {
-  /bin/true
-}
-
-op=$1
-shift
-$op $*
diff --git a/abs/core/LinHES-config/PKGBUILD b/abs/core/LinHES-config/PKGBUILD
index 52303f9..077064c 100644
--- a/abs/core/LinHES-config/PKGBUILD
+++ b/abs/core/LinHES-config/PKGBUILD
@@ -6,7 +6,7 @@ pkgdesc="Install and configure your system"
 depends=('bc' 'libstatgrab'  'mysql-python' 'expect' 'curl' 'dnsutils' 'parted'
 	 'sg3_utils' 'nmbscan' 'system-templates' 'rsync' 'python-parted'
 	 'python-pexpect' 'python-netifaces' 
-	 'python-iplib' 'mythinstall>=2-10')
+	 'python-iplib' 'mythinstall>=2-10' 'sudo')
 #LinHES-timezone
 arch=('i686' 'x86_64')
 
@@ -44,12 +44,13 @@ source=(mv_install.py
 	mv_webuser.py
 	mv_hostype.py
 	mv_supplemental.py
-    systemconfig.py
+        systemconfig.py
 	myth_user_call.py
-	mythvantage.cfg)
+	mythvantage.cfg
+	config-sudo.rules )
 
 backup=(etc/mythvantage.cfg)
-install=LinHES.install
+install=config.install
 
 build() {
     mkdir -p $startdir/pkg/etc
@@ -62,8 +63,7 @@ build() {
     mkdir -p $MVDIR/etc
 
     #copy in all the installer specific stuff
-#    install -m0700 myth_user_call  $MVDIR/bin/myth_user_call
-    install -m0700 myth_user_call.py $MVDIR/bin/myth_user_call
+    install -m 0700 myth_user_call.py $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
@@ -100,11 +100,15 @@ build() {
 
     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
     install -m 0755 LinHES-release $startdir/pkg/etc/LinHES-release
-    #install -m 0755 issue $startdir/pkg/etc/issue
 
+    #sudo rules
+    mkdir -p $startdir/pkg/etc/sudoers.d/
+    chmod 750 $startdir/pkg/etc/sudoers.d/ 
+    chown -R root:root $startdir/pkg/etc/sudoers.d 
+    
+    install -o root -g root -m 0750 config-sudo.rules $startdir/pkg/etc/sudoers.d/config-sudo.rules
 }
 md5sums=('4ef6a2f04f5cb1777ac3772eeccdc78f'
          '16b98fcb3753ef6cfc35075c326d30e4'
@@ -142,4 +146,5 @@ md5sums=('4ef6a2f04f5cb1777ac3772eeccdc78f'
          '755c05b833aca6c5be130972af052e8b'
          'd8f80e5686d02555f044363f1ac17d97'
          '2596460462cf6c889cf8f95485537b20'
-         'a63ff9ef5250965aeabc74bfa8e43981')
+         'a63ff9ef5250965aeabc74bfa8e43981'
+         '4804aa93aaad3dfcfff08cd9ffd68836')
diff --git a/abs/core/LinHES-config/config-sudo.rules b/abs/core/LinHES-config/config-sudo.rules
new file mode 100644
index 0000000..67d5aba
--- /dev/null
+++ b/abs/core/LinHES-config/config-sudo.rules
@@ -0,0 +1,3 @@
+mythtv   ALL = NOPASSWD:/usr/MythVantage/bin/mythvantage
+mythtv   ALL = NOPASSWD:/usr/MythVantage/bin/MythVantage
+
diff --git a/abs/core/LinHES-config/config.install b/abs/core/LinHES-config/config.install
new file mode 100644
index 0000000..fb905fb
--- /dev/null
+++ b/abs/core/LinHES-config/config.install
@@ -0,0 +1,63 @@
+# This is a default template for a post-install scriptlet.  You can
+# remove any functions you don't need (and this header).
+
+# arg 1:  the new package version
+pre_install() {
+  rm -f /etc/issue
+  rm -f /etc/arch-release
+
+}
+
+# arg 1:  the new package version
+post_install() {
+    if [ ! -f /etc/blacklist.package ]
+    then
+        echo "List of packages to ignore" > /etc/blacklist.package
+        echo "one package per line" >> /etc/blacklist.package
+    fi
+}
+
+# arg 1:  the new package version
+# arg 2:  the old package version
+pre_upgrade() {
+  /bin/true
+}
+
+# arg 1:  the new package version
+# arg 2:  the old package version
+post_upgrade() {
+    . /etc/profile
+    ps -ef|grep mysqld|grep -v grep
+    status=$?
+    echo "status $status"
+    if [ $status  = 0 ]
+    then
+        restore_default_settings.sh -c load
+    fi
+        if [ ! -f /etc/blacklist.package ]
+        then
+            echo "List of packages to ignore" > /etc/blacklist.package
+            echo  "one package per line" >> /etc/blacklist.package
+        fi
+    cat /etc/LinHES-release > /etc/os_myth_release
+
+    if [ ! -f /usr/share/mythtv/config.xml ]
+    then
+       echo "config.xml not found, generating a new one"
+       /usr/MythVantage/bin/systemconfig.py -m hostype
+    fi
+}
+
+# arg 1:  the old package version
+pre_remove() {
+  /bin/true
+}
+
+# arg 1:  the old package version
+post_remove() {
+  /bin/true
+}
+
+op=$1
+shift
+$op $*
-- 
cgit v0.12

