Chameleon Applications

Chameleon Applications Svn Source Tree

Root/branches/blackosx/trunk/PackageBuilder/Main_Package_Elements/Scripts/postflight.sh

  • Property svn:executable set to *
1#!/bin/bash
2
3echo "==============================================="
4echo "Entered Postflight Script"
5echo "*************************"
6
7# Find location of this script in the package installer
8# so we know where all the other scripts are located.
9
10MYLOCATION="${PWD}/${BASH_ARGV[0]}"
11export MYLOCATION="${MYLOCATION%/*}"
12scriptDir=$MYLOCATION
13
14
15# Run script to create com.apple.Boot.plist
16# and pass it the installer destination.
17
18"$scriptDir"BuildBootOptions.sh "${3}"
19
20
21# Has the temporary directory /.Chameleon/Extra been created?
22# If yes then check first for an existing /Extra folder on the
23# destination and if exists then back it up and delete existing.
24# Then transfer temporary Extra folder to destination.
25
26if [ -d "${3}"/.Chameleon/Extra ]; then
27
28# Check to see if install to EFI system partition was selected
29# if chosen, the package installer would have added a file named
30# 'nullESP' in to the temporary directory /.Chameleon
31
32# We also need to check to see if the user selected both the
33# standard install and EFI system partition options.
34# If they did then the EFI system partition script would
35# have been cancelled, meaning the Extra folder needs to
36# be copied the selected destination.
37
38if [ -f ${3}/.Chameleon/nullESP ] && ! [ -f ${3}/.Chameleon/nullstandard ]; then
39
40# Does an /Extra folder already exist at the target location?
41# If yes, then make a backup of it
42
43if [ -d "/Volumes/EFI/Extra" ]; then
44echo "DEBUG: Executing command: Backing up existing /Volumes/EFI/Extra"
45mkdir -p "/Volumes/EFI/ExtraBackup"
46cp -f -R "/Volumes/EFI/Extra" "/Volumes/EFI/ExtraBackup"
47rm -f -R "/Volumes/EFI/Extra"
48fi
49
50echo "Executing command: ditto ${3}/.Chameleon/Extra /Volumes/EFI/Extra"
51ditto ${3}/.Chameleon/Extra /Volumes/EFI/Extra
52
53echo "Executing command: umount -f Volumes/EFI"
54"$scriptDir"UnMountEFIvolumes.sh
55returnValue=$?
56if [ ${returnValue} = 0 ]; then
57rm -R -f /Volumes/EFI
58fi
59else
60# Does an /Extra folder already exist at the target location?
61# If yes, then make a backup of it
62
63if [ -d "${3}/Extra" ]; then
64echo "DEBUG: Executing command: Backing up existing ${3}/Extra"
65mkdir -p "${3}/ExtraBackup"
66cp -f -R "${3}/Extra" "${3}/ExtraBackup"
67rm -f -R "${3}/Extra"
68fi
69
70echo "Executing command: ditto ${3}/.Chameleon/Extra ${3}/Extra"
71ditto ${3}/.Chameleon/Extra ${3}/Extra
72fi
73
74fi
75
76
77echo "==============================================="
78echo "Clean Up"
79echo "********"
80
81# remove the temporary /.Chameleon directory
82echo "Executing command: rm -r ${3}/.Chameleon/"
83rm -r "${3}"/.Chameleon/
84
85# remove the temporary boot sector files if they exist
86if [ -d /tmp/newbs ]; then
87echo "Executing command: rm /tmp/newbs"
88rm /tmp/newbs
89fi
90if [ -d /tmp/origbs ]; then
91echo "Executing command: rm /tmp/origbs"
92rm /tmp/origbs
93fi
94
95
96exit 0
97

Archive Download this file

Revision: 249