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 com.apple.Boot.plist to destination.␊ |
23 | ␊ |
24 | if [ -d ${3}/.Chameleon/Extra ]; then␊ |
25 | ␊ |
26 | ␉# check to see if install to EFI system partition was selected␊ |
27 | ␉# if chosen, the package installer will add a file named 'nullESP'␊ |
28 | ␉# in to the temporary directory /.Chameleon␊ |
29 | ␊ |
30 | ␉if [ -f ${3}/.Chameleon/nullESP ]; then␊ |
31 | ␉␉echo "Executing command: mv -f ${3}/.Chameleon/Extra /Volumes/EFI"␊ |
32 | ␉␉mv -f ${3}/.Chameleon/Extra /Volumes/EFI␊ |
33 | ␊ |
34 | ␉␉echo "Executing command: umount -f Volumes/EFI"␊ |
35 | ␉␉"$scriptDir"UnMountEFIvolumes.sh␊ |
36 | ␉␉returnValue=$?␊ |
37 | ␉␉if [ ${returnValue} = 0 ]; then␊ |
38 | ␉␉␉rm -R -f /Volumes/EFI␊ |
39 | ␉␉fi␊ |
40 | ␉else␊ |
41 | ␉␉echo "Executing command: mv -f ${3}/.Chameleon/Extra ${3}/"␊ |
42 | ␉␉mv -f ${3}/.Chameleon/Extra ${3}/␊ |
43 | ␉fi␊ |
44 | ␊ |
45 | fi␊ |
46 | ␊ |
47 | echo "==============================================="␊ |
48 | echo "Clean Up"␊ |
49 | echo "*************************"␊ |
50 | ␊ |
51 | # remove the temporary /.Chameleon directory␊ |
52 | echo "Executing command: rm -r ${3}/.Chameleon/"␊ |
53 | rm -r ${3}/.Chameleon/␊ |
54 | ␊ |
55 | # remove the temporary boot sector files if they exist␊ |
56 | if [ -d /tmp/newbs ]; then␊ |
57 | ␉echo "Executing command: rm /tmp/newbs"␊ |
58 | ␉rm /tmp/newbs␊ |
59 | fi␊ |
60 | if [ -d /tmp/origbs ]; then␊ |
61 | ␉echo "Executing command: rm /tmp/origbs"␊ |
62 | ␉rm /tmp/origbs␊ |
63 | fi␊ |
64 | ␊ |
65 | ␊ |
66 | exit 0␊ |
67 | |