Package - Power Manager Daemon

The daemon provides the scheduling capabilities of Power Manager. This package also includes a selection of support files needed by the daemon to perform the schedule's actions.

Requirements

A restart is required after installing this package.

The restart is needed to ensure the security rights take hold. Our testing found security changes do not propogate as expected until a restart.

Files Installed

Facilities with particular shut down needs can modify the safershutdown script; this script completes a scheduled shut down.

Files Created During Installation

The post installation script installs additional essential files. These files are responsible for launching Power Manager's daemon on start up.

On Mac OS X 10.4 or later, the following file is installed.

Line  
1
/Library/LaunchDaemons/uk.co.dssw.powermanager.plist

On Mac OS X 10.3.9, the following directory is installed.

Line  
1
/Library/StartupItems/PowerManager/

Scripts

The daemon package performs scripts in preparation for and after installation.

Preparation

The preparation script stops any existing instance of Power Manager. Care is taken to handle both SystemStarter and launchd managed instances of Power Manager's daemon.

Line  
1
#!/bin/sh
2
3
# Must be run as root
4
5
# Power Manager 3.5+; launchd managed
6
if [ -e "/Library/LaunchDaemons/uk.co.dssw.powermanager.plist" ]; then 
7
    echo "Stopping powermanagerd through launchctl..."
8
    /bin/launchctl unload /Library/LaunchDaemons/uk.co.dssw.powermanager.plist
9
fi
10
11
# Power Manager 3.0 - 3.2.1
12
if [ -e "/usr/local/powermanager/bin/powermanagerd" ]; then 
13
    echo "Stopping already running powermanagerd..."
14
    /usr/local/powermanager/bin/powermanagerd -k stop
15
    sleep 2
16
fi
17
18
exit 0

Post Installation

The post installation script performs four tasks.

The global login item ensures Power Manager can notify each user and has a means of cleanly logging out users.

Security rights are requested and modifications are propogated through to /etc/authorization.

Line  
1
#!/bin/sh
2
# Part of DssW Power Manager
3
# Copyright (c) 2007 Dragon Systems Software Limited
4
# Support: support@dssw.co.uk
5
#
6
# This script completes the installation process by copying Mac OS X version
7
# dependent files and setting up permissions.
8
9
# Install a global login item for pmassistant
10
sudo "$3/usr/local/powermanager/bin/pmassistant.app/Contents/MacOS/pmassistant" -i
11
echo "Inserted global login item for 'pmassistant.app'"
12
13
# Set up security rights for administrators
14
sudo "$3/usr/local/powermanager/bin/powermanagerd" -i
15
echo "Set up rights for 'powermanagerd'"
16
17
# launchd or StartupItems
18
if [ -e "$3/Library/LaunchDaemons/" ]; then
19
20
    # launchd, Mac OS X 10.4+
21
    sudo cp -R "$3/usr/local/powermanager/etc/launchd/uk.co.dssw.powermanager.plist" "$3/Library/LaunchDaemons/."
22
    sudo /bin/launchctl load "$3/Library/LaunchDaemons/uk.co.dssw.powermanager.plist"
23
        
24
    echo "Installed launchd profile for 'powermanagerd'"
25
    
26
    # remove existing Power Manager StartupItems
27
    if [ -e "$3/Library/StartupItems/PowerManager/" ]; then
28
        sudo /bin/rm -r "$3/Library/StartupItems/PowerManager"
29
    fi
30
else
31
32
    # StartupItems, Mac OS X 10.3.9
33
    sudo cp -R "$3/usr/local/powermanager/etc/PowerManager" "$3/Library/StartupItems/."
34
    sudo "$3/Library/StartupItems/PowerManager/PowerManager" start
35
36
    echo "Installed StartUpItem for 'powermanagerd'"
37
38
fi
39
40
# Move any PM3.5 - 3.6.2 preferences to the new location
41
HOSTNAME=`hostname -s`
42
if [ -e "/var/root/Library/Preferences/uk.co.dssw.powermanager.daemon.$HOSTNAME.plist" ]; then
43
    echo "Updating v3.5 - 3.6.2 preference location."
44
    mv "/var/root/Library/Preferences/uk.co.dssw.powermanager.daemon.$HOSTNAME.plist" '/Library/Preferences/uk.co.dssw.powermanager.daemon.plist'
45
fi