1 | #!/bin/bash␊ |
2 | ␊ |
3 | echo "==============================================="␊ |
4 | echo "Entered Postflight Script"␊ |
5 | echo "*************************"␊ |
6 | ␊ |
7 | # Find location of this script in the package installer␊ |
8 | # so we know where all the other scripts are located.␊ |
9 | ␊ |
10 | MYLOCATION="${PWD}/${BASH_ARGV[0]}"␊ |
11 | export MYLOCATION="${MYLOCATION%/*}"␊ |
12 | scriptDir=$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 transfer temporary Extra folder to destination, ␊ |
23 | # or merge temporary Extra folder in to an already existing Extra␊ |
24 | # folder on the destination target.␊ |
25 | ␊ |
26 | if [ -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 | ␊ |
38 | ␉if [ -f ${3}/.Chameleon/nullESP ] && ! [ -f ${3}/.Chameleon/nullstandard ]; then␊ |
39 | ␊ |
40 | ␉␉echo "Executing command: ditto ${3}/.Chameleon/Extra /Volumes/EFI/Extra"␊ |
41 | ␉␉ditto ${3}/.Chameleon/Extra /Volumes/EFI/Extra␊ |
42 | ␊ |
43 | ␉␉echo "Executing command: umount -f Volumes/EFI"␊ |
44 | ␉␉"$scriptDir"UnMountEFIvolumes.sh␊ |
45 | ␉␉returnValue=$?␊ |
46 | ␉␉if [ ${returnValue} = 0 ]; then␊ |
47 | ␉␉␉rm -R -f /Volumes/EFI␊ |
48 | ␉␉fi␊ |
49 | ␉else␊ |
50 | ␉␉echo "Executing command: ditto ${3}/.Chameleon/Extra ${3}/Extra"␊ |
51 | ␉␉ditto ${3}/.Chameleon/Extra ${3}/Extra␊ |
52 | ␉fi␊ |
53 | ␊ |
54 | fi␊ |
55 | ␊ |
56 | ␊ |
57 | echo "==============================================="␊ |
58 | echo "Clean Up"␊ |
59 | echo "********"␊ |
60 | ␊ |
61 | # remove the temporary /.Chameleon directory␊ |
62 | echo "Executing command: rm -r ${3}/.Chameleon/"␊ |
63 | rm -r ${3}/.Chameleon/␊ |
64 | ␊ |
65 | # remove the temporary boot sector files if they exist␊ |
66 | if [ -d /tmp/newbs ]; then␊ |
67 | ␉echo "Executing command: rm /tmp/newbs"␊ |
68 | ␉rm /tmp/newbs␊ |
69 | fi␊ |
70 | if [ -d /tmp/origbs ]; then␊ |
71 | ␉echo "Executing command: rm /tmp/origbs"␊ |
72 | ␉rm /tmp/origbs␊ |
73 | fi␊ |
74 | ␊ |
75 | ␊ |
76 | exit 0␊ |
77 | |