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# TO DO - Set permissions of temporary /Extra folder
29
30
31
32# If user selected to the standard installation
33# then the package installer would have added a file named
34# 'nullstandard' in to the temporary directory /.Chameleon
35
36# If user selected to install to EFI system partition
37# then the package installer would have added a file named
38# 'nullESP' in to the temporary directory /.Chameleon
39
40# We also need to check to see if the user selected both the
41# standard install and EFI system partition options.
42# If they did then the EFI system partition script would
43# have been cancelled, meaning the Extra folder needs to
44# be copied the selected destination.
45
46if [ -f "${3}"/.Chameleon/nullESP ] && ! [ -f "${3}"/.Chameleon/nullstandard ]; then
47
48# Does an /Extra folder already exist on the target EFI system partition?
49# If yes, then make a backup of it
50
51if [ -d "/Volumes/EFI/Extra" ]; then
52echo "DEBUG: Executing command: Backing up existing /Volumes/EFI/Extra"
53mkdir -p "/Volumes/EFI/ExtraBackup"
54cp -f -R "/Volumes/EFI/Extra" "/Volumes/EFI/ExtraBackup"
55echo "Executing command: rm -f -R /Volumes/EFI/Extra"
56rm -f -R "/Volumes/EFI/Extra"
57fi
58
59# copy temporary /Extra folder to the selected destination.
60echo "Executing command: cp ${3}/.Chameleon/Extra /Volumes/EFI/Extra"
61cp -R "${3}"/.Chameleon/Extra /Volumes/EFI/Extra
62
63echo "Executing command: umount -f Volumes/EFI"
64"$scriptDir"UnMountEFIvolumes.sh
65returnValue=$?
66if [ ${returnValue} = 0 ]; then
67echo "Executing command: rm -f -R /Volumes/EFI/"
68rm -R -f /Volumes/EFI
69fi
70else
71# Does an /Extra folder already exist at the target location?
72# If yes, then make a backup of it
73
74if [ -d "${3}"/Extra ]; then
75echo "DEBUG: Backing up existing ${3}/Extra"
76mkdir -p "${3}"/ExtraBackup
77cp -f -R "${3}"/Extra "${3}"/ExtraBackup
78echo "Executing command: rm -f -R ${3}/Extra"
79rm -f -R "${3}"/Extra
80fi
81
82echo "Executing command: cp ${3}/.Chameleon/Extra ${3}/Extra"
83cp -R "${3}"/.Chameleon/Extra "${3}"/Extra
84fi
85
86fi
87
88
89echo "==============================================="
90echo "Remove any temporary files"
91echo "**************************"
92
93# check the /.Chameleon temporary directory exists
94# if yes, remove the temporary /.Chameleon directory
95
96if [ -d "${3}"/.Chameleon ]; then
97echo "Executing command: rm -f -R ${3}/.Chameleon/"
98rm -f -R "${3}"/.Chameleon
99fi
100
101# remove the temporary boot sector files if they exist
102if [ -d /tmp/newbs ]; then
103echo "Executing command: rm /tmp/newbs"
104rm /tmp/newbs
105fi
106if [ -d /tmp/origbs ]; then
107echo "Executing command: rm /tmp/origbs"
108rm /tmp/origbs
109fi
110
111
112exit 0
113

Archive Download this file

Revision: 256