Index: /trunk/PesterSleepFixer/PesterSleepFixer.packproj
===================================================================
--- /trunk/PesterSleepFixer/PesterSleepFixer.packproj	(revision 334)
+++ /trunk/PesterSleepFixer/PesterSleepFixer.packproj	(revision 334)
@@ -0,0 +1,600 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>Hierarchy</key>
+	<dict>
+		<key>Attributes</key>
+		<dict>
+			<key>Documents</key>
+			<dict>
+				<key>Background Image</key>
+				<dict>
+					<key>IFPkgFlagBackgroundAlignment</key>
+					<integer>4</integer>
+					<key>IFPkgFlagBackgroundScaling</key>
+					<integer>1</integer>
+					<key>Mode</key>
+					<integer>0</integer>
+					<key>Path</key>
+					<string></string>
+					<key>Path Type</key>
+					<integer>1</integer>
+				</dict>
+				<key>License</key>
+				<dict>
+					<key>International</key>
+					<dict>
+						<key>Mode</key>
+						<integer>0</integer>
+						<key>Path</key>
+						<string></string>
+						<key>Path Type</key>
+						<integer>1</integer>
+					</dict>
+				</dict>
+				<key>ReadMe</key>
+				<dict>
+					<key>International</key>
+					<dict>
+						<key>Mode</key>
+						<integer>0</integer>
+						<key>Path</key>
+						<string></string>
+						<key>Path Type</key>
+						<integer>1</integer>
+					</dict>
+				</dict>
+				<key>Welcome</key>
+				<dict>
+					<key>International</key>
+					<dict>
+						<key>Mode</key>
+						<integer>0</integer>
+						<key>Path</key>
+						<string></string>
+						<key>Path Type</key>
+						<integer>1</integer>
+					</dict>
+				</dict>
+			</dict>
+			<key>Files</key>
+			<dict>
+				<key>Compress</key>
+				<true/>
+				<key>Hierarchy</key>
+				<dict>
+					<key>Children</key>
+					<array>
+						<dict>
+							<key>Children</key>
+							<array>
+								<dict>
+									<key>Children</key>
+									<array/>
+									<key>GID</key>
+									<integer>80</integer>
+									<key>Path</key>
+									<string>Utilities</string>
+									<key>Path Type</key>
+									<integer>1</integer>
+									<key>Privileges</key>
+									<integer>509</integer>
+									<key>Type</key>
+									<integer>1</integer>
+									<key>UID</key>
+									<integer>0</integer>
+								</dict>
+							</array>
+							<key>GID</key>
+							<integer>80</integer>
+							<key>Path</key>
+							<string>Applications</string>
+							<key>Path Type</key>
+							<integer>1</integer>
+							<key>Privileges</key>
+							<integer>509</integer>
+							<key>Type</key>
+							<integer>1</integer>
+							<key>UID</key>
+							<integer>0</integer>
+						</dict>
+						<dict>
+							<key>Children</key>
+							<array>
+								<dict>
+									<key>Children</key>
+									<array/>
+									<key>GID</key>
+									<integer>80</integer>
+									<key>Path</key>
+									<string>Application Support</string>
+									<key>Path Type</key>
+									<integer>1</integer>
+									<key>Privileges</key>
+									<integer>509</integer>
+									<key>Type</key>
+									<integer>1</integer>
+									<key>UID</key>
+									<integer>0</integer>
+								</dict>
+								<dict>
+									<key>Children</key>
+									<array/>
+									<key>GID</key>
+									<integer>80</integer>
+									<key>Path</key>
+									<string>Documentation</string>
+									<key>Path Type</key>
+									<integer>1</integer>
+									<key>Privileges</key>
+									<integer>509</integer>
+									<key>Type</key>
+									<integer>1</integer>
+									<key>UID</key>
+									<integer>0</integer>
+								</dict>
+								<dict>
+									<key>Children</key>
+									<array/>
+									<key>GID</key>
+									<integer>80</integer>
+									<key>Path</key>
+									<string>Filesystems</string>
+									<key>Path Type</key>
+									<integer>1</integer>
+									<key>Privileges</key>
+									<integer>509</integer>
+									<key>Type</key>
+									<integer>1</integer>
+									<key>UID</key>
+									<integer>0</integer>
+								</dict>
+								<dict>
+									<key>Children</key>
+									<array/>
+									<key>GID</key>
+									<integer>80</integer>
+									<key>Path</key>
+									<string>Frameworks</string>
+									<key>Path Type</key>
+									<integer>1</integer>
+									<key>Privileges</key>
+									<integer>509</integer>
+									<key>Type</key>
+									<integer>1</integer>
+									<key>UID</key>
+									<integer>0</integer>
+								</dict>
+								<dict>
+									<key>Children</key>
+									<array/>
+									<key>GID</key>
+									<integer>80</integer>
+									<key>Path</key>
+									<string>Internet Plug-Ins</string>
+									<key>Path Type</key>
+									<integer>1</integer>
+									<key>Privileges</key>
+									<integer>509</integer>
+									<key>Type</key>
+									<integer>1</integer>
+									<key>UID</key>
+									<integer>0</integer>
+								</dict>
+								<dict>
+									<key>Children</key>
+									<array/>
+									<key>GID</key>
+									<integer>80</integer>
+									<key>Path</key>
+									<string>PreferencePanes</string>
+									<key>Path Type</key>
+									<integer>1</integer>
+									<key>Privileges</key>
+									<integer>509</integer>
+									<key>Type</key>
+									<integer>1</integer>
+									<key>UID</key>
+									<integer>0</integer>
+								</dict>
+								<dict>
+									<key>Children</key>
+									<array/>
+									<key>GID</key>
+									<integer>80</integer>
+									<key>Path</key>
+									<string>Preferences</string>
+									<key>Path Type</key>
+									<integer>1</integer>
+									<key>Privileges</key>
+									<integer>509</integer>
+									<key>Type</key>
+									<integer>1</integer>
+									<key>UID</key>
+									<integer>0</integer>
+								</dict>
+								<dict>
+									<key>Children</key>
+									<array/>
+									<key>GID</key>
+									<integer>80</integer>
+									<key>Path</key>
+									<string>Printers</string>
+									<key>Path Type</key>
+									<integer>1</integer>
+									<key>Privileges</key>
+									<integer>509</integer>
+									<key>Type</key>
+									<integer>1</integer>
+									<key>UID</key>
+									<integer>0</integer>
+								</dict>
+								<dict>
+									<key>Children</key>
+									<array/>
+									<key>GID</key>
+									<integer>80</integer>
+									<key>Path</key>
+									<string>QuickTime</string>
+									<key>Path Type</key>
+									<integer>1</integer>
+									<key>Privileges</key>
+									<integer>509</integer>
+									<key>Type</key>
+									<integer>1</integer>
+									<key>UID</key>
+									<integer>0</integer>
+								</dict>
+								<dict>
+									<key>Children</key>
+									<array/>
+									<key>GID</key>
+									<integer>80</integer>
+									<key>Path</key>
+									<string>Scripts</string>
+									<key>Path Type</key>
+									<integer>1</integer>
+									<key>Privileges</key>
+									<integer>509</integer>
+									<key>Type</key>
+									<integer>1</integer>
+									<key>UID</key>
+									<integer>0</integer>
+								</dict>
+								<dict>
+									<key>Children</key>
+									<array/>
+									<key>GID</key>
+									<integer>0</integer>
+									<key>Path</key>
+									<string>StartupItems</string>
+									<key>Path Type</key>
+									<integer>2</integer>
+									<key>Privileges</key>
+									<integer>493</integer>
+									<key>Type</key>
+									<integer>3</integer>
+									<key>UID</key>
+									<integer>0</integer>
+								</dict>
+							</array>
+							<key>GID</key>
+							<integer>80</integer>
+							<key>Path</key>
+							<string>Library</string>
+							<key>Path Type</key>
+							<integer>1</integer>
+							<key>Privileges</key>
+							<integer>1021</integer>
+							<key>Type</key>
+							<integer>1</integer>
+							<key>UID</key>
+							<integer>0</integer>
+						</dict>
+						<dict>
+							<key>Children</key>
+							<array>
+								<dict>
+									<key>Children</key>
+									<array>
+										<dict>
+											<key>Children</key>
+											<array/>
+											<key>GID</key>
+											<integer>0</integer>
+											<key>Path</key>
+											<string>Extensions</string>
+											<key>Path Type</key>
+											<integer>1</integer>
+											<key>Privileges</key>
+											<integer>493</integer>
+											<key>Type</key>
+											<integer>1</integer>
+											<key>UID</key>
+											<integer>0</integer>
+										</dict>
+									</array>
+									<key>GID</key>
+									<integer>0</integer>
+									<key>Path</key>
+									<string>Library</string>
+									<key>Path Type</key>
+									<integer>1</integer>
+									<key>Privileges</key>
+									<integer>493</integer>
+									<key>Type</key>
+									<integer>1</integer>
+									<key>UID</key>
+									<integer>0</integer>
+								</dict>
+							</array>
+							<key>GID</key>
+							<integer>0</integer>
+							<key>Path</key>
+							<string>System</string>
+							<key>Path Type</key>
+							<integer>1</integer>
+							<key>Privileges</key>
+							<integer>493</integer>
+							<key>Type</key>
+							<integer>1</integer>
+							<key>UID</key>
+							<integer>0</integer>
+						</dict>
+					</array>
+					<key>GID</key>
+					<integer>80</integer>
+					<key>Path</key>
+					<string>/</string>
+					<key>Path Type</key>
+					<integer>1</integer>
+					<key>Privileges</key>
+					<integer>1021</integer>
+					<key>Type</key>
+					<integer>1</integer>
+					<key>UID</key>
+					<integer>0</integer>
+				</dict>
+				<key>IFPkgFlagDefaultLocation</key>
+				<string>/Library</string>
+				<key>Imported Package</key>
+				<false/>
+				<key>Package Path</key>
+				<string></string>
+				<key>Split Forks</key>
+				<true/>
+			</dict>
+			<key>Plugins</key>
+			<dict>
+				<key>PluginsList</key>
+				<array>
+					<dict>
+						<key>Path</key>
+						<string>Introduction</string>
+						<key>Type</key>
+						<integer>0</integer>
+					</dict>
+					<dict>
+						<key>Path</key>
+						<string>ReadMe</string>
+						<key>Type</key>
+						<integer>0</integer>
+					</dict>
+					<dict>
+						<key>Path</key>
+						<string>License</string>
+						<key>Type</key>
+						<integer>0</integer>
+					</dict>
+					<dict>
+						<key>Path</key>
+						<string>Target</string>
+						<key>Type</key>
+						<integer>0</integer>
+					</dict>
+					<dict>
+						<key>Path</key>
+						<string>PackageSelection</string>
+						<key>Type</key>
+						<integer>0</integer>
+					</dict>
+					<dict>
+						<key>Path</key>
+						<string>Install</string>
+						<key>Type</key>
+						<integer>0</integer>
+					</dict>
+					<dict>
+						<key>Path</key>
+						<string>FinishUp</string>
+						<key>Type</key>
+						<integer>0</integer>
+					</dict>
+				</array>
+			</dict>
+			<key>Scripts</key>
+			<dict>
+				<key>Additional Resources</key>
+				<dict>
+					<key>International</key>
+					<array/>
+				</dict>
+				<key>Installation Scripts</key>
+				<dict>
+					<key>IFInstallationScriptsPostflight</key>
+					<dict>
+						<key>Path</key>
+						<string></string>
+						<key>Status</key>
+						<false/>
+					</dict>
+					<key>IFInstallationScriptsPostinstall</key>
+					<dict>
+						<key>Path</key>
+						<string>postinstall</string>
+						<key>Path Type</key>
+						<integer>2</integer>
+						<key>Status</key>
+						<true/>
+					</dict>
+					<key>IFInstallationScriptsPostupgrade</key>
+					<dict>
+						<key>Path</key>
+						<string>postupgrade</string>
+						<key>Path Type</key>
+						<integer>2</integer>
+						<key>Status</key>
+						<true/>
+					</dict>
+					<key>IFInstallationScriptsPreflight</key>
+					<dict>
+						<key>Path</key>
+						<string></string>
+						<key>Path Type</key>
+						<integer>1</integer>
+						<key>Status</key>
+						<false/>
+					</dict>
+					<key>IFInstallationScriptsPreinstall</key>
+					<dict>
+						<key>Path</key>
+						<string>preinstall</string>
+						<key>Path Type</key>
+						<integer>2</integer>
+						<key>Status</key>
+						<true/>
+					</dict>
+					<key>IFInstallationScriptsPreupgrade</key>
+					<dict>
+						<key>Path</key>
+						<string>preupgrade</string>
+						<key>Path Type</key>
+						<integer>2</integer>
+						<key>Status</key>
+						<true/>
+					</dict>
+				</dict>
+				<key>Requirements</key>
+				<array>
+					<dict>
+						<key>AlertDialog</key>
+						<dict>
+							<key>International</key>
+							<dict>
+								<key>MessageKey</key>
+								<string>PesterSleepFixer requires Mac OS X 10.4 or later.</string>
+								<key>TitleKey</key>
+								<string>Mac OS X 10.4 required</string>
+							</dict>
+						</dict>
+						<key>LabelKey</key>
+						<string>Requires Tiger</string>
+						<key>Level</key>
+						<integer>0</integer>
+						<key>SpecArgument</key>
+						<string>sysv</string>
+						<key>SpecTag</key>
+						<integer>2</integer>
+						<key>SpecType</key>
+						<string>gestalt</string>
+						<key>Status</key>
+						<true/>
+						<key>TestObject</key>
+						<string>1040</string>
+						<key>TestOperator</key>
+						<string>&gt;=</string>
+					</dict>
+				</array>
+			</dict>
+			<key>Settings</key>
+			<dict>
+				<key>Description</key>
+				<dict>
+					<key>International</key>
+					<dict>
+						<key>IFPkgDescriptionDeleteWarning</key>
+						<string></string>
+						<key>IFPkgDescriptionDescription</key>
+						<string></string>
+						<key>IFPkgDescriptionTitle</key>
+						<string>PesterSleepFixer</string>
+						<key>IFPkgDescriptionVersion</key>
+						<string>1.0</string>
+					</dict>
+				</dict>
+				<key>Display Information</key>
+				<dict>
+					<key>CFBundleGetInfoString</key>
+					<string>PesterSleepFixer 1.0 © 2007 Nicholas Riley</string>
+					<key>CFBundleIconFile</key>
+					<string></string>
+					<key>CFBundleIconFile Path Type</key>
+					<integer>1</integer>
+					<key>CFBundleIdentifier</key>
+					<string>net.sabi.pkg.PesterSleepFixer</string>
+					<key>CFBundleName</key>
+					<string>PesterSleepFixer</string>
+					<key>CFBundleShortVersionString</key>
+					<string>1.0</string>
+				</dict>
+				<key>Options</key>
+				<dict>
+					<key>IFPkgFlagAllowBackRev</key>
+					<false/>
+					<key>IFPkgFlagAuthorizationAction</key>
+					<integer>1</integer>
+					<key>IFPkgFlagFollowLinks</key>
+					<true/>
+					<key>IFPkgFlagIsRequired</key>
+					<true/>
+					<key>IFPkgFlagOverwritePermissions</key>
+					<false/>
+					<key>IFPkgFlagRelocatable</key>
+					<false/>
+					<key>IFPkgFlagRestartAction</key>
+					<integer>0</integer>
+					<key>IFPkgFlagRootVolumeOnly</key>
+					<true/>
+					<key>IFPkgFlagUpdateInstalledLanguages</key>
+					<false/>
+				</dict>
+				<key>Version</key>
+				<dict>
+					<key>IFMajorVersion</key>
+					<integer>1</integer>
+					<key>IFMinorVersion</key>
+					<integer>0</integer>
+				</dict>
+			</dict>
+		</dict>
+		<key>IFPkgFlagPackageSelection</key>
+		<integer>0</integer>
+		<key>Name</key>
+		<string>PesterSleepFixer</string>
+		<key>Status</key>
+		<integer>1</integer>
+		<key>Type</key>
+		<integer>1</integer>
+	</dict>
+	<key>Name</key>
+	<string>Project</string>
+	<key>Settings</key>
+	<dict>
+		<key>10.1 Compatibility</key>
+		<true/>
+		<key>Build Path</key>
+		<string>build</string>
+		<key>Build Path Type</key>
+		<integer>2</integer>
+		<key>Comment</key>
+		<string></string>
+		<key>Remove .DS_Store</key>
+		<true/>
+		<key>Remove .pbdevelopment</key>
+		<true/>
+		<key>Remove CVS</key>
+		<false/>
+	</dict>
+</dict>
+</plist>
Index: /trunk/PesterSleepFixer/StartupItems/PesterSleepFixer/PesterSleepFixer
===================================================================
--- /trunk/PesterSleepFixer/StartupItems/PesterSleepFixer/PesterSleepFixer	(revision 334)
+++ /trunk/PesterSleepFixer/StartupItems/PesterSleepFixer/PesterSleepFixer	(revision 334)
@@ -0,0 +1,39 @@
+#!/bin/sh
+#
+#	Pester Sleep Fixer start script
+
+# The Run/Restart/Start/StopService routines appeared in /Library/StartupItems/PesterSleepFixer/rc.common with
+# Mac OS X 10.2. For earlier systems, we define our own RunService routine.
+RunService ()
+{
+	ConsoleMessage "Starting Pester Sleep Fixer"
+	/Library/StartupItems/PesterSleepFixer/pester-sleepfixer -d -V -s /Library/StartupItems/PesterSleepFixer/rc.sleep -w /Library/StartupItems/PesterSleepFixer/rc.wakeup
+	/Library/StartupItems/PesterSleepFixer/rc.wakeup
+	return 0
+}
+
+. /etc/rc.common
+
+StartService ()
+{
+	ConsoleMessage "Starting Pester Sleep Fixer"
+	/Library/StartupItems/PesterSleepFixer/pester-sleepfixer -d -V -s /Library/StartupItems/PesterSleepFixer/rc.sleep -w /Library/StartupItems/PesterSleepFixer/rc.wakeup
+	/Library/StartupItems/PesterSleepFixer/rc.wakeup
+	return 0
+}
+
+StopService ()
+{
+	ConsoleMessage "Stopping Pester Sleep Fixer"
+	killall pester-sleepfixer
+	/Library/StartupItems/PesterSleepFixer/rc.sleep
+	return 0
+}
+
+RestartService ()
+{
+	StopService
+	StartService
+}
+
+RunService "$1"
Index: /trunk/PesterSleepFixer/StartupItems/PesterSleepFixer/StartupParameters.plist
===================================================================
--- /trunk/PesterSleepFixer/StartupItems/PesterSleepFixer/StartupParameters.plist	(revision 334)
+++ /trunk/PesterSleepFixer/StartupItems/PesterSleepFixer/StartupParameters.plist	(revision 334)
@@ -0,0 +1,10 @@
+{
+	Description     = "Pester Sleep Fixer";
+	Provides        = ("PesterSleepFixer");
+	OrderPreference = "Last";
+	Messages =
+	{
+		start = "Starting Pester Sleep Fixer";
+		stop  = "Stopping Pester Sleep Fixer";
+	};
+}
Index: /trunk/PesterSleepFixer/StartupItems/PesterSleepFixer/rc.sleep
===================================================================
--- /trunk/PesterSleepFixer/StartupItems/PesterSleepFixer/rc.sleep	(revision 334)
+++ /trunk/PesterSleepFixer/StartupItems/PesterSleepFixer/rc.sleep	(revision 334)
@@ -0,0 +1,15 @@
+#!/bin/zsh -ef
+#
+#	rc.sleep
+#
+#	script to be executed on sleep by the PesterSleepFixer daemon
+
+/bin/rm -rf /tmp/PesterSleepFixer
+/usr/bin/install -dm 600 /tmp/PesterSleepFixer
+cd /tmp/PesterSleepFixer
+
+for user in $(echo 'show State:/Users/ConsoleUser' | scutil | awk '/kCGSSessionUserNameKey/ { print $3; }'); do
+	su - $user -c "/Library/StartupItems/PesterSleepFixer/appswitch -qi net.sabi.Pester" && \
+		/usr/bin/touch $user && \
+		/usr/bin/logger -t $0 "will restart Pester on wake for $user"
+done
Index: /trunk/PesterSleepFixer/StartupItems/PesterSleepFixer/rc.wakeup
===================================================================
--- /trunk/PesterSleepFixer/StartupItems/PesterSleepFixer/rc.wakeup	(revision 334)
+++ /trunk/PesterSleepFixer/StartupItems/PesterSleepFixer/rc.wakeup	(revision 334)
@@ -0,0 +1,16 @@
+#!/bin/zsh -ef
+#
+#	rc.wakeup
+#
+#	script to be executed on wakeup by the PesterSleepFixer daemon
+
+[[ -d /tmp/PesterSleepFixer ]] || exit 0
+
+cd /tmp/PesterSleepFixer
+
+for user in *(N); do
+	/usr/bin/su - $user -c "/Library/StartupItems/PesterSleepFixer/launch -bi net.sabi.Pester"
+	/usr/bin/logger -t $0 "restarted Pester on wake for $user"
+done
+
+/bin/rm -rf /tmp/PesterSleepFixer
Index: /trunk/PesterSleepFixer/postinstall
===================================================================
--- /trunk/PesterSleepFixer/postinstall	(revision 334)
+++ /trunk/PesterSleepFixer/postinstall	(revision 334)
@@ -0,0 +1,5 @@
+#!/bin/sh -
+
+/Library/StartupItems/PesterSleepFixer/PesterSleepFixer start
+
+exit 0
Index: /trunk/PesterSleepFixer/postupgrade
===================================================================
--- /trunk/PesterSleepFixer/postupgrade	(revision 334)
+++ /trunk/PesterSleepFixer/postupgrade	(revision 334)
@@ -0,0 +1,5 @@
+#!/bin/sh -
+
+/Library/StartupItems/PesterSleepFixer/PesterSleepFixer start
+
+exit 0
Index: /trunk/PesterSleepFixer/preinstall
===================================================================
--- /trunk/PesterSleepFixer/preinstall	(revision 334)
+++ /trunk/PesterSleepFixer/preinstall	(revision 334)
@@ -0,0 +1,7 @@
+#!/bin/sh -
+
+if [ -x /Library/StartupItems/PesterSleepFixer/PesterSleepFixer ]; then
+	/Library/StartupItems/PesterSleepFixer/PesterSleepFixer stop
+fi
+
+exit 0
Index: /trunk/PesterSleepFixer/preupgrade
===================================================================
--- /trunk/PesterSleepFixer/preupgrade	(revision 334)
+++ /trunk/PesterSleepFixer/preupgrade	(revision 334)
@@ -0,0 +1,7 @@
+#!/bin/sh -
+
+if [ -x /Library/StartupItems/PesterSleepFixer/PesterSleepFixer ]; then
+	/Library/StartupItems/PesterSleepFixer/PesterSleepFixer stop
+fi
+
+exit 0
