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"
47echo "Executing command: rm -f -R /Volumes/EFI/Extra"
48rm -f -R "/Volumes/EFI/Extra"
49fi
50
51echo "Executing command: ditto ${3}/.Chameleon/Extra /Volumes/EFI/Extra"
52ditto "${3}"/.Chameleon/Extra /Volumes/EFI/Extra
53
54echo "Executing command: umount -f Volumes/EFI"
55"$scriptDir"UnMountEFIvolumes.sh
56returnValue=$?
57if [ ${returnValue} = 0 ]; then
58echo "Executing command: rm -f -R /Volumes/EFI/"
59rm -R -f /Volumes/EFI
60fi
61else
62# Does an /Extra folder already exist at the target location?
63# If yes, then make a backup of it
64
65if [ -d "${3}"/Extra ]; then
66echo "DEBUG: Backing up existing ${3}/Extra"
67mkdir -p "${3}"/ExtraBackup
68cp -f -R "${3}"/Extra "${3}"/ExtraBackup
69echo "Executing command: rm -f -R ${3}/Extra"
70rm -f -R "${3}"/Extra
71fi
72
73echo "Executing command: ditto ${3}/.Chameleon/Extra ${3}/Extra"
74ditto "${3}"/.Chameleon/Extra "${3}"/Extra
75fi
76
77fi
78
79
80echo "==============================================="
81echo "Clean Up"
82echo "********"
83
84# check the /.Chameleon temporary directory exists
85# if yes, remove the temporary /.Chameleon directory
86
87if [ -d "${3}"/.Chameleon ]; then
88echo "Executing command: rm -r ${3}/.Chameleon/"
89rm -r "${3}"/.Chameleon
90fi
91
92# remove the temporary boot sector files if they exist
93if [ -d /tmp/newbs ]; then
94echo "Executing command: rm /tmp/newbs"
95rm /tmp/newbs
96fi
97if [ -d /tmp/origbs ]; then
98echo "Executing command: rm /tmp/origbs"
99rm /tmp/origbs
100fi
101
102
103exit 0
104

Archive Download this file

Revision: 252