Update of /cvsroot/fink/dists/10.4/unstable/main/finkinfo/utils
In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv21067

Added Files:
        sleepwatcher.info sleepwatcher.patch 
Log Message:
New from tracker
http://sourceforge.net/tracker/index.php?func=detail&aid=1888518&group_id=17203&atid=414256


--- NEW FILE: sleepwatcher.info ---
Package: sleepwatcher
Version: 2.0.5
Revision: 1
Description: Daemon that monitors sleep and wakeup
License: GPL
Maintainer: Pepe Barbe <[EMAIL PROTECTED]>
Source: http://www.bernhard-baehr.de/%n_%v_src.tgz
Source-MD5: 886fd37f9ae2941e99eb507b312ba236
PatchFile: %n.patch
PatchFile-MD5: 6ac63435a25176b4f16c8d096c813d2d
DaemonicFile: %n.xml
Homepage: http://www.bernhard-baehr.de/

BuildDepends: fink (>= 0.24.12) 
Depends: <<
        daemonic (>= 20010902-1)
<<

PatchScript: <<
#!/bin/sh -ev
if [ i386 = "`uname -m`" ]
then
  ARCH=X86
else
  ARCH=PPC
fi
sed -e "s,@ARCH@,$ARCH," -e "s,@PREFIX@,%i,"  < %{PatchFile} | patch -p1
<<

CompileScript: make sleepwatcher

InstallScript:<<
make install
mkdir -p %i/etc
install -o root -g wheel -m 755 rc.sleep %i/etc/
install -o root -g wheel -m 755 rc.wakeup %i/etc/
<<

DaemonicFile: <<
<service>
  <description>%n %v</description>
  <message>%n %v</message>

  <daemon name="%n">
    <executable background="yes">%p/sbin/%n</executable>
    <parameters>-d -V -s %p/etc/rc.sleep -w %p/etc/rc.wakeup -p 
%p/var/run/sleepwatcher.pid</parameters>
    <pidfile>%p/var/run/%n.pid</pidfile>
  </daemon>
</service>

<<

PreRmScript: <<
if [ $1 != "upgrade" ]; then
  daemonic remove %N
fi
<<

PostInstScript: <<
daemonic install %N
<<

DescUsage: <<
You can run 'sudo daemonic enable %N' as root to create a StartupItem for it.
If run as daemon all users can create two executable scripts ~/.wakeup and
~/.sleep, that will be executed when the computers wakes up or sleeps,
accordingly.
<<

DescDetail: <<
SleepWatcher is a command line tool (daemon) for Mac OS X that monitors sleep,
wakeup and idleness of a Mac. It can be used to execute a Unix command when
the Mac or the display of the Mac goes to sleep mode or wakes up or after a
given time without user interaction. It also can send the Mac to sleep mode or
retrieve the time since last user activity.
<<
--- NEW FILE: sleepwatcher.patch ---
diff -urN sleepwatcher_2.0.5_src/Makefile sleepwatcher_2.0.5_src.new/Makefile
--- sleepwatcher_2.0.5_src/Makefile     2007-11-02 08:40:21.000000000 -0500
+++ sleepwatcher_2.0.5_src.new/Makefile 2008-02-06 20:23:03.000000000 -0600
@@ -10,14 +10,11 @@
 CFLAGS_X86= -O3 -prebind -mmacosx-version-min=10.3 -mtune=pentium -arch i386
 LIBS= -framework IOKit -framework CoreFoundation
 
-BINDIR=/usr/local/sbin
-MANDIR=/usr/local/man
[EMAIL PROTECTED]@/sbin
[EMAIL PROTECTED]@/share/man
 
 sleepwatcher: sleepwatcher.c
-       $(CC) $(CFLAGS_PPC) -o sleepwatcher.ppc sleepwatcher.c $(LIBS)
-       $(CC) $(CFLAGS_X86) -o sleepwatcher.x86 sleepwatcher.c $(LIBS)
-       lipo -create sleepwatcher.ppc sleepwatcher.x86 -output sleepwatcher
-       rm -f sleepwatcher.ppc sleepwatcher.x86
+       $(CC) $([EMAIL PROTECTED]@) -o sleepwatcher sleepwatcher.c $(LIBS)
 
 install: sleepwatcher sleepwatcher.8
        mkdir -p $(BINDIR)
diff -urN sleepwatcher_2.0.5_src/rc.sleep sleepwatcher_2.0.5_src.new/rc.sleep
--- sleepwatcher_2.0.5_src/rc.sleep     1969-12-31 18:00:00.000000000 -0600
+++ sleepwatcher_2.0.5_src.new/rc.sleep 2007-11-02 07:44:50.000000000 -0500
@@ -0,0 +1,54 @@
+#!/bin/sh
+#
+#      rc.sleep
+#
+#      script to be executed on sleep by the sleepwatcher daemon
+#
+#      17.11.2002 bb   created
+#      22.11.2002 bb   added .sleep script handling
+#      22.12.2002 bb   quoted $home (might contain space)
+#      22.06.2003 adb  use nidump to detect home directories
+#      22.05.2005 bb   use nigrep (old method missed last account in
+#                      the nidump output), check for interactive users
+#                      (users with a /etc/shells shell), log .sleep
+#                      execution to the syslog
+#      15.08.2005 bb   added >/dev/null to grep command because of
+#                      file descriptor problems with Mac OS X 10.3.9
+#      31.12.2005 bb   execute the sleep script only for users currently
+#                      logged in
+#      07.01.2006 bb   replaced "who -q" with "users" (Mac OS X 10.3 who
+#                      does not support the -q option)
+#       20.04.2006 bb   ${name:0:8} instead of $name: users returns short
+#                       user names (8 chars), but the NI database can have
+#                       longer names
+#      26.06.2006 bb   modified "eval $var=$val" to use awk to get only
+#                      the first word of $val for compatibility with user
+#                      accounts from Active Directory
+#      20.08.2007 bb   rewritten using scutil (thanks to a hint of
+#                      Nicholas Riley)
+#      04.10.2007 bb   in su: $name -> $user
+#
+
+for user in `echo 'show State:/Users/ConsoleUser' | scutil | awk 
'/kCGSSessionUserNameKey/ { print $3 }'`; do
+       home=`eval echo ~$user`
+       if [ -x "$home/.sleep" ]; then
+               logger -t $0 "executing .sleep of user $user"
+               su - $user -c "$home/.sleep"
+       fi
+done
+
+#unset name shell home
+#
+#nigrep '^(name|home|shell)$' / /users | while read id node var val; do
+#      eval $var=`echo $val | awk '{ print $1 }'`
+#      [ "$name" -a "$shell" -a "$home" ] || continue
+#      if grep -q $shell /etc/shells >/dev/null; then
+#              if users | grep -q "\<${name:0:8}\>" >/dev/null; then
+#                      if [ -x "$home/.sleep" ]; then
+#                              logger -t $0 "executing .sleep of user $name"
+#                              su - $name -c "$home/.sleep"
+#                      fi
+#              fi
+#      fi              
+#      unset name shell home
+#done
diff -urN sleepwatcher_2.0.5_src/rc.wakeup sleepwatcher_2.0.5_src.new/rc.wakeup
--- sleepwatcher_2.0.5_src/rc.wakeup    1969-12-31 18:00:00.000000000 -0600
+++ sleepwatcher_2.0.5_src.new/rc.wakeup        2007-10-04 11:52:39.000000000 
-0500
@@ -0,0 +1,54 @@
+#!/bin/sh
+#
+#      rc.wakeup
+#
+#      script to be executed on wakeup by the sleepwatcher daemon
+#
+#      17.11.2002 bb   created
+#      22.11.2002 bb   added .wakeup script handling
+#      22.12.2002 bb   quoted $home (might contain space)
+#      22.06.2003 adb  use nidump to detect home directories
+#      22.05.2005 bb   use nigrep (old method missed last account in
+#                      the nidump output), check for interactive users
+#                      (users with a /etc/shells shell), log .wakeup
+#                      execution to the syslog
+#      15.08.2005 bb   added >/dev/null to grep command because of
+#                      file descriptor problems with Mac OS X 10.3.9
+#      31.12.2005 bb   execute the wakeup script only for users currently
+#                      logged in
+#      07.01.2006 bb   replaced "who -q" with "users" (Mac OS X 10.3 who
+#                      does not support the -q option)
+#       20.04.2006 bb   ${name:0:8} instead of $name: users returns short
+#                       user names (8 chars), but the NI database can have
+#                       longer names
+#      26.06.2006 bb   modified "eval $var=$val" to use awk to get only
+#                      the first word of $val for compatibility with user
+#                      accounts from Active Directory
+#      20.08.2006 bb   rewritten using scutil (thanks to a hint of
+#                      Nicholas Riley)
+#      04.10.2007 bb   in su: $name -> $user
+#
+
+for user in `echo 'show State:/Users/ConsoleUser' | scutil | awk 
'/kCGSSessionUserNameKey/ { print $3 }'`; do
+       home=`eval echo ~$user`
+       if [ -x "$home/.wakeup" ]; then
+               logger -t $0 "executing .wakeup of user $user"
+               su - $user -c "$home/.wakeup"
+       fi
+done
+
+#unset name shell home
+#
+#nigrep '^(name|home|shell)$' / /users | while read id node var val; do
+#      eval $var=`echo $val | awk '{ print $1 }'`
+#      [ "$name" -a "$shell" -a "$home" ] || continue
+#      if grep -q $shell /etc/shells >/dev/null; then
+#              if users | grep -q "\<${name:0:8}\>" >/dev/null; then
+#                      if [ -x "$home/.wakeup" ]; then
+#                              logger -t $0 "executing .wakeup of user $name"
+#                              su - $name -c "$home/.wakeup"
+#                      fi
+#              fi
+#      fi              
+#      unset name shell home
+#done


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Fink-commits mailing list
Fink-commits@lists.sourceforge.net
http://news.gmane.org/gmane.os.apple.fink.cvs

Reply via email to