From 75e9f21c438349435454c641737877df18a35098 Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Mon, 1 Oct 2012 10:55:35 -0500
Subject: LinHES-system:  cleaned up install file and moved sudo rules to their
 own file.

---
 abs/core/LinHES-system/PKGBUILD          | 27 +++++++++---
 abs/core/LinHES-system/system-sudo.rules |  1 +
 abs/core/LinHES-system/system.install    | 76 +++++---------------------------
 3 files changed, 33 insertions(+), 71 deletions(-)
 create mode 100644 abs/core/LinHES-system/system-sudo.rules

diff --git a/abs/core/LinHES-system/PKGBUILD b/abs/core/LinHES-system/PKGBUILD
index 7c63ce0..8abecab 100755
--- a/abs/core/LinHES-system/PKGBUILD
+++ b/abs/core/LinHES-system/PKGBUILD
@@ -1,10 +1,10 @@
 pkgname=LinHES-system
 pkgver=2
-pkgrel=109
+pkgrel=113
 arch=('i686' 'x86_64')
 MVDIR=$startdir/pkg/usr/LH
 BINDIR=$startdir/pkg/usr/bin
-#install=LinHES-system.install
+install=system.install
 pkgdesc="scripts and things related to having an  automated system"
 depends=(linhes-sounds xdotool tilda keylaunch python_aosd 'linhes-scripts>=7-24' 'udisks' 'LinHES-config>=2.3-59' 'sudo' 'python2-dbus' 'unclutter' 'wmctrl' 'archlinux-xdg-menu')
 backup=(etc/modprobe.d/alsa-base)
@@ -30,8 +30,12 @@ binfiles="LinHES-start optimize_mythdb.py
  misc_upcoming_recordings.pl
  misc_which_recorder.pl"
 
-source=(LinHES-session LinHES-profile.sh $binfiles alsa-base myth_mtc.lr
- diskspace cacheclean.cron readme_is_xml add_storage.readme)
+source=(LinHES-session
+    LinHES-profile.sh $binfiles
+    alsa-base myth_mtc.lr
+    diskspace cacheclean.cron
+    readme_is_xml add_storage.readme
+    system-sudo.rules )
 
 build() {
         cd $startdir/src
@@ -42,7 +46,7 @@ build() {
         do
         	item=$i
         	install -m755 -D $item $MVDIR/bin/$item
-        	echo $item
+        	echo "installing $item to $MVDIR"
         done
 
         cd $startdir/bin
@@ -50,7 +54,7 @@ build() {
         do
         	item=$i
         	install -m755 -D $item $MVDIR/bin/$item
-        	echo $item
+        	echo "bin stuff: $item"
         done
 
         install -m644 -D $startdir/src/alsa-base $startdir/pkg/etc/modprobe.d/alsa-base.conf
@@ -62,6 +66,14 @@ build() {
         install -m755 -D $startdir/src/diskspace $startdir/pkg/etc/cron.tenminutes/diskspace
         mkdir $startdir/pkg/etc/logrotate.d
         cp $startdir/myth_mtc.lr $startdir/pkg/etc/logrotate.d
+
+        #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 $startdir/src/system-sudo.rules $startdir/pkg/etc/sudoers.d/system_sudo
+
+
 }
 md5sums=('5bd4938cf41b63787aa4cdfd76423e09'
          '5881bdb43d578ec3a79d1f77ea58a3db'
@@ -102,4 +114,5 @@ md5sums=('5bd4938cf41b63787aa4cdfd76423e09'
          '84492954db16740f949d795b74383189'
          '02c810c2f47b7c4495fdacaf54189473'
          '1e2ca4dd872a50df6b70528e06df558a'
-         'da432d68962e109e09beb2b71c8c8571')
+         'da432d68962e109e09beb2b71c8c8571'
+         '366ccb097d1c221389709485c3b2d159')
diff --git a/abs/core/LinHES-system/system-sudo.rules b/abs/core/LinHES-system/system-sudo.rules
new file mode 100644
index 0000000..86e1b72
--- /dev/null
+++ b/abs/core/LinHES-system/system-sudo.rules
@@ -0,0 +1 @@
+mythtv    ALL=(ALL)       NOPASSWD: ALL
diff --git a/abs/core/LinHES-system/system.install b/abs/core/LinHES-system/system.install
index 7ae0616..662e271 100644
--- a/abs/core/LinHES-system/system.install
+++ b/abs/core/LinHES-system/system.install
@@ -3,79 +3,27 @@
 
 # arg 1:  the new package version
 pre_install() {
-/bin/true
+    /bin/true
 }
 
 # arg 1:  the new package version
 post_install() {
-MVDIR=/usr/LH/bin
-#	ln -s  $MVDIR/backup_job /etc/cron.daily/backup_cron
-#	ln -s  $MVDIR/update_system  /etc/cron.daily/xupdate_system_cron
-#	ln -s  $MVDIR/repo_sync.sh  /etc/cron.daily/zrepo_sync.sh
-	if [ ! -e /etc/cron.daily/myth_mtc ]
-	then
-		ln -s  $MVDIR/myth_mtc.sh  /etc/cron.daily/myth_mtc
-	fi
-	if [  -e /etc/cron.daily/myth_mtc.sh ]
-	then
-		rm -f  /etc/cron.daily/myth_mtc.sh
-	fi
-#LINE="mythtv    ALL = NOPASSWD: /sbin/sv stop mythbackend"
-LINE="mythtv 	ALL=(ALL)       NOPASSWD: ALL"
-LINE1="%wheel 	ALL=(ALL)       NOPASSWD: ALL"
-
-
-for i in "$LINE" "$LINE1" "$LINE2" "$LINE3" "$LINE4" "$LINE5" "$LINE7" "$LINE8" "$LINE9"  "$LINE10" "$LINE11" "$LINE12" "$LINE13" "$LINE14" "$LINE15" "$LINE16"
-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
-
-REALTIME="session         required        pam_limits.so"
-grep -q "pam_limits.so" /etc/pam.d/su
-        if [ $? != 0 ]
-        then
-		echo "$REALTIME" >>  /etc/pam.d/su
-
-	fi
-
-
-# Add db entry for misc status in MythWeb
-/usr/LH/bin/misc_status_config.py
-
-
+    MVDIR=/usr/LH/bin
+    #add myth_mtc to cron list
+    if [ ! -e /etc/cron.daily/myth_mtc ]
+    then
+        ln -s  $MVDIR/myth_mtc.sh  /etc/cron.daily/myth_mtc
+    fi
+
+    # Add db entry for misc status in MythWeb
+    # not needed in R8 because it's in the DB, may be removed
+    #/usr/LH/bin/misc_status_config.py
 }
 
 # arg 1:  the new package version
 # arg 2:  the old package version
 pre_upgrade() {
-	if [ -e  /etc/cron.daily/backup_cron ]
-	then
-		rm -f  /etc/cron.daily/backup_cron
-	fi
-	if [ -e /etc/cron.daily/xupdate_system_cron ]
-	then
-		rm -f /etc/cron.daily/xupdate_system_cron
-	fi
-
-	if [ -e /etc/cron.daily/myth_mtc.py ]
-	then
-		rm -f /etc/cron.daily/myth_mtc.py
-	fi
-
-
+    /bin/true
 }
 
 # arg 1:  the new package version
-- 
cgit v0.12

