Import Upstream version 1.8.5
[hcoop/debian/openafs.git] / src / packaging / MacOS / OpenAFS.pre_upgrade
1 #!/bin/sh
2 DAEMON=/private/var/db/openafs/etc/launchafs.sh
3 DAEMON_LAUNCHD_SCRIPT=/Library/LaunchDaemons/org.openafs.filesystems.afs.plist
4 DAEMON_UP=$(ps -ef | grep "$DAEMON_NAME" | grep -v grep | wc -l)
5 PREFERENCE_PANE=/Library/PreferencePanes/OpenAFS.prefPane
6
7 cd /var/db/openafs/etc
8 # only do these checks if we're upgrading from a pre-1.2.7
9 if [ -f CellServDB -a ! -f CellServDB.master ]; then
10 CK=`md5 CellServDB | awk '{ print $4 }'`
11 if grep -q $CK $1/Contents/Resources/CellServDB.list; then
12 # it matched one of our previously released files
13 echo Unmodified CellServDB -- not preserving
14 :
15 else
16 if [ ! -f CellServDB.master.last ]; then
17 echo Modified CellServDB -- saving as /var/db/openafs/etc/CellServDB.save
18 echo Please re-merge it manually -- this will not be required for future upgrades
19 fi
20 cp CellServDB CellServDB.save
21 fi
22 fi
23 if [ -f config/afsd.options -a -f config/afsd.options.sample ]; then
24 if cmp -s config/afsd.options config/afs.options.sample; then
25 echo Removing no-longer needed afsd.options file
26 rm -f config/afsd.options
27 fi
28 fi
29
30 if [ -f /Library/StartupItems/OpenAFS/OpenAFS ]; then
31 /Library/StartupItems/OpenAFS/OpenAFS stop
32 rm /Library/StartupItems/OpenAFS/OpenAFS
33 else
34 if [ -f /Library/LaunchDaemons/org.openafs.filesystems.afs.plist ]; then
35 if ps ax | grep -v grep | grep $DAEMON > /dev/null
36 then
37 launchctl stop org.openafs.filesystems.afs
38 else
39 echo "$DAEMON is not running"
40 fi
41
42 launchctl unload -w $DAEMON_LAUNCHD_SCRIPT
43 fi
44 fi
45
46 if [ -d /Library/PreferencePanes/OpenAFS.prefPane ]; then
47 rm -R /Library/PreferencePanes/OpenAFS.prefPane
48 fi