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 | ␉if [ -f ${3}/.Chameleon/nullESP ]; then␊ |
33 | ␉␉echo "Executing command: ditto ${3}/.Chameleon/Extra /Volumes/EFI/Extra"␊ |
34 | ␉␉ditto ${3}/.Chameleon/Extra /Volumes/EFI/Extra␊ |
35 | ␊ |
36 | ␉␉echo "Executing command: umount -f Volumes/EFI"␊ |
37 | ␉␉"$scriptDir"UnMountEFIvolumes.sh␊ |
38 | ␉␉returnValue=$?␊ |
39 | ␉␉if [ ${returnValue} = 0 ]; then␊ |
40 | ␉␉␉rm -R -f /Volumes/EFI␊ |
41 | ␉␉fi␊ |
42 | ␉else␊ |
43 | ␉␉echo "Executing command: ditto ${3}/.Chameleon/Extra ${3}/Extra"␊ |
44 | ␉␉ditto ${3}/.Chameleon/Extra ${3}/Extra␊ |
45 | ␉fi␊ |
46 | ␊ |
47 | fi␊ |
48 | ␊ |
49 | echo "==============================================="␊ |
50 | echo "Clean Up"␊ |
51 | echo "*************************"␊ |
52 | ␊ |
53 | # remove the temporary /.Chameleon directory␊ |
54 | echo "Executing command: rm -r ${3}/.Chameleon/"␊ |
55 | rm -r ${3}/.Chameleon/␊ |
56 | ␊ |
57 | # remove the temporary boot sector files if they exist␊ |
58 | if [ -d /tmp/newbs ]; then␊ |
59 | ␉echo "Executing command: rm /tmp/newbs"␊ |
60 | ␉rm /tmp/newbs␊ |
61 | fi␊ |
62 | if [ -d /tmp/origbs ]; then␊ |
63 | ␉echo "Executing command: rm /tmp/origbs"␊ |
64 | ␉rm /tmp/origbs␊ |
65 | fi␊ |
66 | ␊ |
67 | ␊ |
68 | exit 0␊ |
69 | |