Chameleon

Chameleon Commit Details

Date:2015-01-30 00:01:17 (4 years 4 months ago)
Author:ErmaC
Commit:2569
Parents: 2568
Message:Update Chameleon pkg Installer (Allow install on ESP). (Credits to Micky1979)
Changes:
D/trunk/package/Scripts.templates/Pre/clean_bootplist.pl
D/trunk/package/Scripts/Sub
D/trunk/package/Scripts.templates/InstallerLog
A/trunk/package/Scripts/Main/BootNO
A/trunk/package/Scripts.templates/CleanOptions/clean_bootplist.pl
A/trunk/package/Scripts.templates/CleanOptions
A/trunk/package/Scripts/Main/BootYES
M/trunk/package/po/mk.po
M/trunk/package/po/hr.po
M/trunk/package/po/nl.po
M/trunk/package/po/pl.po
M/trunk/package/po/hu.po
M/trunk/package/Scripts/Main/Standardpostinstall
M/trunk/package/buildpkg.sh
M/trunk/package/Scripts.templates/InstallModule/postinstall
M/trunk/package/po/ca.po
M/trunk/package/slimpkg.sh
M/trunk/package/po/sr.po
M/trunk/package/Distribution
M/trunk/package/Scripts.templates/AddOption/postinstall
M/trunk/package/Scripts.templates/Post/postinstall
M/trunk/package/Changes.txt
M/trunk/package/Scripts.templates/Pre/preinstall
M/trunk/package/Scripts.templates/InstallTheme/postinstall
M/trunk/package/Scripts/Main/ESPpostinstall

File differences

trunk/package/Distribution
1717
1818
1919
20
20
2121
2222
2323
var bootPlist = null;
if (my.target) {
var boot_plist_filenames = new Array( 'org.chameleon.Boot.plist', 'com.apple.Boot.plist' );
var boot_plist_filenames = new Array( 'org.chameleon.Boot.plist', 'com.apple.Boot.plist', 'com.apple.boot.plist');
for ( var i = 0; i < boot_plist_filenames.length; i++ ) {
bootPlist = system.files.plistAtPath( my.target.mountpoint + '/Extra/' + boot_plist_filenames[i] );
if (bootPlist)
trunk/package/slimpkg.sh
6262
6363
6464
65
6665
6766
6867
......
123122
124123
125124
126
127125
128126
129127
......
135133
136134
137135
138
139136
140137
141138
......
223220
224221
225222
226
227
228223
229224
230225
ditto --noextattr --noqtn ${1%/*/*}/revision ${1}/Pre/Scripts/Resources/revision
ditto --noextattr --noqtn ${1%/*/*}/version ${1}/Pre/Scripts/Resources/version
cp -f ${pkgroot}/Scripts/Main/preinstall ${1}/Pre/Scripts
cp -f ${pkgroot}/Scripts/Sub/InstallLog.sh ${1}/Pre/Scripts
echo "[BUILD] Pre "
buildpackage "${1}/Pre" "/" "" "start_visible=\"false\" start_selected=\"true\"" >/dev/null 2>&1
# End build pre install package
mkdir -p ${1}/Standard/Root
mkdir -p ${1}/Standard/Scripts/Resources
cp -f ${pkgroot}/Scripts/Main/Standardpostinstall ${1}/Standard/Scripts/postinstall
cp -f ${pkgroot}/Scripts/Sub/* ${1}/Standard/Scripts
ditto --arch i386 `which SetFile` ${1}/Standard/Scripts/Resources/SetFile
ditto --noextattr --noqtn ${1%/*/*}/revision ${1}/Standard/Scripts/Resources/revision
ditto --noextattr --noqtn ${1%/*/*}/version ${1}/Standard/Scripts/Resources/version
mkdir -p ${1}/EFI/Root
mkdir -p ${1}/EFI/Scripts/Resources
cp -f ${pkgroot}/Scripts/Main/ESPpostinstall ${1}/EFI/Scripts/postinstall
cp -f ${pkgroot}/Scripts/Sub/* ${1}/EFI/Scripts
ditto --arch i386 `which SetFile` ${1}/EFI/Scripts/Resources/SetFile
ditto --noextattr --noqtn ${1%/*/*}/revision ${1}/EFI/Scripts/Resources/revision
ditto --noextattr --noqtn ${1%/*/*}/version ${1}/EFI/Scripts/Resources/version
mkdir -p ${1}/Post/Root
mkdir -p ${1}/Post/Scripts
cp -f ${pkgroot}/Scripts/Main/postinstall ${1}/Post/Scripts
cp -f ${pkgroot}/Scripts/Sub/InstallLog.sh ${1}/Post/Scripts
cp -f ${pkgroot}/Scripts/Sub/UnMountEFIvolumes.sh ${1}/Post/Scripts
ditto --noextattr --noqtn ${1%/*/*}/revision ${1}/Post/Scripts/Resources/revision
ditto --noextattr --noqtn ${1%/*/*}/version ${1}/Post/Scripts/Resources/version
echo "[BUILD] Post "
trunk/package/Scripts.templates/AddOption/postinstall
22
33
44
5
5
6
7
8
69
710
811
912
1013
11
1214
1315
14
15
16
17
1618
1719
1820
19
21
22
2023
21
24
2225
26
27
28
2329
2430
2531
26
32
2733
2834
2935
......
5460
5561
5662
63
5764
set -u
targetVolume="$3"
configFile='/private/tmp/InstallConfig.plist'
v_mntptDev=$( /usr/libexec/plistbuddy -c "Print :ramdisk" ${configFile} | sed -e 's/[[:blank:]]*//g' )
v_mntpt=$( LC_ALL=C diskutil info ${v_mntptDev} | grep -i 'mount point' | awk '{$1=$2=""; print $0}' \
| sed -e 's/^[ \t]*//' )
key="@optionKey@"
value="@optionValue@"
type="@optionType@"
logName="@LOG_FILENAME@"
logFile="${targetVolume}/$logName"
# Check if target volume exists
if [[ ! -d "$targetVolume" ]]; then
echo "$targetVolume volume does not exist!" >&2
if [[ ! -d "$v_mntpt" ]]; then
echo "$v_mntpt volume does not exist!" >&2
exit 1
fi
exec >>"${logFile}" 2>&1
mainLine="=============================================================================="
subLine="------------------------------------------------------------------------------"
echo "Added boot option: ${key}=${value}"
exec > >(tee -a "${v_mntpt}/${logName}") 2>&1
echo "$mainLine"
echo "Writing boot option: ${key}=${value}"
key="${key// /\\ }" # Escape spaces
value="${value// /\\ }" # Escape spaces
bootPListFile="${targetVolume}/Extra/org.chameleon.Boot.plist"
bootPListFile="${v_mntpt}/Extra/org.chameleon.Boot.plist"
case "$type" in
bool|text)
;;
esac
echo "$subLine"
exit 0
trunk/package/Scripts.templates/Post/postinstall
55
66
77
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
831
9
10
32
33
1134
1235
13
14
15
16
17
18
19
36
37
38
2039
40
41
42
43
2144
2245
23
2446
25
47
2648
27
28
29
30
31
32
33
49
3450
35
51
52
3653
37
54
55
56
57
58
59
60
61
62
63
64
65
3866
39
40
41
67
68
69
70
4271
43
44
45
72
4673
47
48
74
75
76
77
4978
50
51
79
80
81
82
83
84
85
86
5287
53
54
5588
56
57
89
90
91
92
93
94
95
96
97
# $3 = Installation volume (mountpoint) to receive the payload
# $4 = Root directory for the system
mainLine="=============================================================================="
subLine="------------------------------------------------------------------------------"
if [ "$3" == "/" ]
then
targetVolume="/Volumes/"$( ls -1F /Volumes | sed -n 's:@$::p' )
# really need to do that?? Unix "component" path assume are between "/"
# ie current volume can be also /// or ///Volumes///MyVolume w/o problem!
else
targetVolume="$3"
fi
configFile='/private/tmp/InstallConfig.plist'
v_mntptDev=$( /usr/libexec/PlistBuddy -c "Print :ramdisk" ${configFile} )
v_mntpt=$( LC_ALL=C diskutil info ${v_mntptDev} | grep -i 'mount point' | awk '{$1=$2=""; print $0}' \
| sed -e 's/^[ \t]*//' )
targetDevice=$( /usr/libexec/PlistBuddy -c "Print :targetdev" ${configFile} )
choicedVolume=$( LC_ALL=C diskutil info ${targetDevice} | grep -i 'mount point' | awk '{$1=$2=""; print $0}' \
| sed -e 's/^[ \t]*//' )
backupRootDir="${targetVolume}/Chameleon.Backups"
backupDir=$( /usr/libexec/PlistBuddy -c "Print :backupDir" ${configFile} )
# Check target exists
if [ ! -d "$3" ]; then
echo "$3 volume does not exist !" >&2
if [ ! -d "${targetVolume}" ]; then
echo "Target volume does not exist !" >&2
exit 1
fi
# If target volume is root of current system then replace
# / with volume name.
if [ "$3" == "/" ]; then
dest_vol="/Volumes/"$( ls -1F /Volumes | sed -n 's:@$::p' )
else
dest_vol="$3"
if [ ! -d "${v_mntpt}" ]; then
echo "Ram disk volume does not exist !" >&2
exit 1
fi
if [ ! -d "${choicedVolume}" ]; then
echo "${choicedVolume} volume does not exist !" >&2
exit 1
fi
logName="@LOG_FILENAME@"
logFile="${dest_vol}/$logName"
exec >>"${logFile}" 2>&1
exec > >(tee -a "${v_mntpt}/${logName}") 2>&1
# Find script location so to find the Install Log script.
MYLOCATION="${PWD}/${BASH_ARGV[0]}"
export MYLOCATION="${MYLOCATION%/*}"
scriptDir=$MYLOCATION
# Write some information to the Install Log
echo "======================================================"
echo "$mainLine"
echo "Running Post postinstall script"
echo "Target volume = ${dest_vol}"
echo "Target volume = ${choicedVolume}"
echo "$subLine"
# ---------------------------------------------
# Replace/Copying the Extra folder
echo "Moving Extra folder to ${choicedVolume}"
cp -R "${v_mntpt}/Extra" "${choicedVolume}"/
echo "NOTE: any Themes or modules you have must be there since this now is the boot partition,"
echo " ACPI tables, SMBios.plist and the org.chameleon.Boot.plist (with custom settings"
echo " for the target OSX must be in each partition that contanin it.)"
echo "$subLine"
echo "Post postinstall script complete"
echo "$mainLine"
# Update Rights
# ---------------------------------------------
chmod 777 ${dest_vol}/Extra 2>/dev/null
chmod 666 ${dest_vol}/Extra/*.plist 2>/dev/null
chmod 777 "${choicedVolume}"/Extra 2>/dev/null
chmod 666 "${choicedVolume}"/Extra/*.plist 2>/dev/null
chmod 666 "${choicedVolume}/Extra/${logName}" 2>/dev/null
# if an Extra/Extensions exist... we can repair the permission???
# ---------------------------------------------
# Cleanup
# ---------------------------------------------
# Check Backup folder (is always on the target Volume)
# Unmount ALL mounted volumes named EFI
"$scriptDir"UnMountEFIvolumes.sh "${dest_vol}" "${scriptDir}"
if [ -d "${backupRootDir}/${backupDir}" ]; then
# Remove empty directories
find "${backupRootDir}" -type d -depth -empty -exec rmdir {} \;
fi
# remove any temporary boot sector files if they exist
rm -f /tmp/newbs /tmp/origbs /tmp/originalBootSector /tmp/newBootSector
# copying the installer log inside the Extra folder
if [[ $( /usr/libexec/PlistBuddy -c "Print bootloader" ${configFile} ) == "true" ]];then
# if we have installed the bootloader, this is a new log
cat "${v_mntpt}/${logName}" > "${choicedVolume}/Extra/${logName}"
else
# ..otherwise adding the new log to the existing one (if exist)
cat "${v_mntpt}/${logName}" >> "${choicedVolume}/Extra/${logName}"
fi
# Remove /.ChameleonEFI file
rm -f "${dest_vol}/.ChameleonEFI"
echo "======================================================"
echo "Post postinstall script complete"
# Umount the Ram Disk & cleaning
rm -f /private/tmp/InstallConfig.plist
rm -f "${targetVolume}/EXTRAROOTDIR"
exec 1<&- # Restore stdout and close file descriptor #1 before umount the Ram Disk
umount -f $v_mntptDev > /dev/null
hdiutil detach $v_mntptDev
trunk/package/Scripts.templates/Pre/clean_bootplist.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/usr/bin/perl
use strict;
use YAML::Syck;
our $target_volume;
our $boot_plist_filepath;
our $yaml_file="@YAML_FILE@";
if ($#ARGV < 0) {
print stderr "A target volume is needed\n";
} else {
$target_volume=$ARGV[0];
}
$boot_plist_filepath = "${target_volume}/Extra/org.chameleon.Boot.plist";
if ( -f "$boot_plist_filepath" ) {
main("$yaml_file");
}
sub _do_cmd {
my ($cmd, $key, $value) = @_;
my $out;
$key =~ s/([\s])/\\$1/g; # Escape characters in key
$value =~ s/([\s"])/\\$1/g; # Escape characters in value (space & ")
my $plistbuddy_command="$cmd :$key $value";
open ( OUTPUT, "-|", '/usr/libexec/plistbuddy', "-c", "$plistbuddy_command", "$boot_plist_filepath" );
my $exit_code = $?;
chomp($out = <OUTPUT>);
close OUTPUT;
return $out;
}
sub get_boot_plist_option {
my ($option) = @_;
return _do_cmd( "Print", "$option");
}
sub delete_boot_plist_option {
my ($option) = @_;
return _do_cmd( "Delete", "$option");
}
sub delete_boot_plist_text_option {
my ($option, $values) = @_;
my $current_value = get_boot_plist_option "$option";
if ( $current_value ne "") {
foreach my $recognized_value (@{$values}) {
if ($recognized_value eq $current_value) {
return _do_cmd( "Delete", "$option");
}
}
}
return "";
}
sub delete_boot_plist_list_option {
my ($option, $values) = @_;
my $current_value = get_boot_plist_option "$option";
if ( $current_value ne "") {
my %count;
my @new_list;
foreach my $value (@{$values}) {
$count{$value} = 1;
}
foreach my $value (split(/\s+/,$current_value)) {
if ( not exists $count{$value} ) {
push @new_list, $value;
}
}
return _do_cmd( "Set", $option, join(' ',@new_list) );
}
return "";
}
sub main() {
# Remove all options that installer can managed
my ($yaml_file) = @_;
my $hash_ref = LoadFile($yaml_file) or die "Can't open yaml file\n";
foreach my $option ( keys %{$hash_ref} ) {
my $type = $hash_ref->{$option}->{type};
if ( $type =~ /^bool$/i ) {
delete_boot_plist_option($option);
} elsif ( $type =~ /^text$/i ) {
delete_boot_plist_text_option( $option,
$hash_ref->{$option}->{values} );
} elsif ( $type =~ /^list$/i ) {
delete_boot_plist_list_option( $option,
$hash_ref->{$option}->{values} );
}
}
}
trunk/package/Scripts.templates/Pre/preinstall
11
22
3
4
5
6
7
8
93
104
115
126
137
148
15
16
9
10
11
1712
18
19
20
21
22
23
24
25
26
27
2813
2914
3015
......
3217
3318
3419
20
21
3522
36
23
3724
38
39
40
41
42
25
26
27
28
29
4330
44
45
31
32
33
34
35
36
37
38
4639
47
40
41
42
43
44
45
46
4847
49
50
48
49
50
51
5152
52
53
54
53
5554
56
57
58
59
60
61
62
63
64
65
66
55
56
57
58
59
60
6761
68
69
70
71
72
7362
74
63
64
7565
76
66
67
68
7769
78
70
71
72
7973
80
81
82
83
84
74
75
76
8577
86
87
88
89
90
91
78
79
9280
93
81
82
83
84
85
86
87
88
9489
95
96
97
9890
9991
#!/bin/bash
echo "==============================================="
echo "Pre-Install Script"
echo "*********************************"
echo "-----------------------------------------------"
echo ""
# Creates text file named '@LOG_FILENAME@'
# at the root of the target volume. This is to give the user
# a record of the installation process and also to show why
# possibly the installation process failed (even though the
# package installer ends reading 'Installation Successful').
# This script also prepares, then backs up any previous
# stage2 boot file, /Extra folder and install log if they exist.
# This script also prepares the Ram Disk and the InstallConfig.plist
mainLine="=============================================================================="
subLine="------------------------------------------------------------------------------"
# Find location of this script in the package installer
# so we know where all the other scripts are located.
MYLOCATION="${PWD}/${BASH_ARGV[0]}"
export MYLOCATION="${MYLOCATION%/*}"
scriptDir=$MYLOCATION
# If target volume root of current system then replace
# / with volume name.
if [ "$3" == "/" ]
then
targetVolume="/Volumes/"$( ls -1F /Volumes | sed -n 's:@$::p' )
targetVolume="$3"
fi
v_mntpt="/Volumes/BOOTRAMDISK"
size='409600' # is the size of a standard EFI partition
logName="@LOG_FILENAME@"
logFile="${targetVolume}/$logName"
configFile="/private/tmp/InstallConfig.plist"
# ---------------------------------------------
# Preparing Backing up of Chameleon files
# ---------------------------------------------
backupRootDir="${targetVolume}/Chameleon.Backups"
backupDir="${backupRootDir}/"$( date -j "+%F-%Hh%M" )
# Functions to create/umount the RAM DISK
UMOUNT_VDISK() {
umount -f "${1}"
hdiutil detach "${1}"
}
# Create the backup directory
mkdir -p "$backupDir"
RAM_DISK() {
if [ $( df | awk '{$1=$2=$3=$4=$5=$6=$7=$8=""; print $0}' | sed -e 's/^[ \t]*//' | \
grep -x "${v_mntpt}" ) ]; then
devToUmount=$( LC_ALL=C diskutil info "${v_mntpt}" | grep -i 'Device Node:' | awk '{print $3}' )
UMOUNT_VDISK $devToUmount
fi
echo "CREATING RAM DISK"
# mkdir -p $v_mntpt
[[ -f "$logFile" ]] && mv "$logFile" "${backupDir}/${logName}" # Backup old log file
dev=$(hdiutil attach -nomount ram://${size})
if [ $? -eq 0 ] ; then
diskutil erasevolume FAT32 "BOOTRAMDISK" ${dev}
else
echo "Failed to create the Ram Disk, installation aborted!"
exit 1
fi
# Setup Chameleon Log file
# by writing header and diskutil list
rm -f $configFile
# adding the Ram disk device to InstallConfig.plist to be shared with other packages
/usr/libexec/PlistBuddy -c "Add :ramdisk string ${dev}" $configFile
}
echo "Chameleon installer log - $( date )
Installer version: %CHAMELEONVERSION% %CHAMELEONREVISION%
======================================================" >"${logFile}"
RAM_DISK
diskutil list >>"${logFile}"
echo "======================================================" >>"${logFile}"
# ---------------------------------------------
# Backup Chameleon files
# ---------------------------------------------
echo "Backup Chameleon files" >>"${logFile}"
# Backup stage2
if [[ -f "${targetVolume}/boot" ]];then
echo "Backup stage2 file ${targetVolume}/boot to ${backupDir}/boot" >>"${logFile}"
cp -p "${targetVolume}/boot" "${backupDir}/boot"
# ensure that ram disk has "/Volumes/BOOTRAMDISK" mount point
v_mntpt=$( LC_ALL=C diskutil info ${dev} | grep -i 'mount point' | awk '{$1=$2=""; print $0}' \
| sed -e 's/^[ \t]*//' )
if [ ! -d "${v_mntpt}" ]; then
echo "Ram Disk not found!"
exit
fi
# Backup /Extra directory
if [[ -d "${targetVolume}/Extra" ]];then
echo "Backing up ${targetVolume}/Extra folder to ${backupDir}/Extra" >>"${logFile}"
cp -pR "${targetVolume}/Extra" "${backupDir}/Extra"
fi
chflags -R nohidden "$backupDir" # Remove the invisible flag of files in the backups
touch "${v_mntpt}/${logName}"
exec > >(tee -a "${v_mntpt}/${logName}") 2>&1
find "${backupRootDir}" -type d -depth -empty -exec rmdir {} \; # Remove empty directories
echo "$mainLine"
echo "Pre-Install Script"
echo "$subLine"
echo "======================================================" >>"${logFile}"
# creating a symlink (from Clover)
echo "Creating ${targetVolume}/EXTRAROOTDIR symlink targeting ${v_mntpt}"
ln -sf "${v_mntpt}" "${targetVolume}/EXTRAROOTDIR"
# Check existing plist name for old naming convention and change to new convention.
if [[ -f "${targetVolume}/Extra/com.apple.Boot.plist" ]]; then
echo "Renaming existing com.apple.Boot.plist to org.chameleon.Boot.plist" >>"${logFile}"
mv "${targetVolume}/Extra/com.apple.Boot.plist" "${targetVolume}/Extra/org.chameleon.Boot.plist"
fi
# Preparing Backing up of Chameleon files
backupRootDir="${targetVolume}/Chameleon.Backups"
backupDir=$( date -j "+%F-%Hh%M" )
# ---------------------------------------------
# Clearing options that Chameleon can managed
# ---------------------------------------------
echo "Clearing options..." >>"${logFile}"
"${PWD}/clean_bootplist.pl" "${targetVolume}" 2>&1 | grep -v 'Does Not Exist' >>"${logFile}"
echo "======================================================" >>"${logFile}"
# Create the backup directory
mkdir -p "${backupRootDir}/${backupDir}"
echo "==============================================="
# Remove the invisible flag of files in the backups
chflags -R nohidden "${backupRootDir}"
# adding the backupdir name to InstallConfig.plist to be shared with other packages
/usr/libexec/PlistBuddy -c "Add :backupDir string ${backupDir}" $configFile >/dev/null
diskutil list >> "${v_mntpt}/${logName}"
echo "$subLine"
echo "END - Pre-Install Script"
echo "*********************************"
echo "-----------------------------------------------"
echo ""
exit 0
trunk/package/Scripts.templates/InstallTheme/postinstall
22
33
44
5
5
6
7
8
69
710
811
912
10
1113
1214
13
14
15
16
1517
1618
1719
18
20
21
1922
20
23
2124
25
26
27
28
29
30
31
32
33
34
35
2236
set -u
targetVolume="$3"
configFile='/private/tmp/InstallConfig.plist'
v_mntptDev=$( /usr/libexec/PlistBuddy -c "Print :ramdisk" ${configFile} | sed -e 's/[[:blank:]]*//g' )
v_mntpt=$( LC_ALL=C diskutil info ${v_mntptDev} | grep -i 'mount point' | awk '{$1=$2=""; print $0}' \
| sed -e 's/^[ \t]*//' )
themeName="@themeName@"
themeDir="@themeDir@"
logName="@LOG_FILENAME@"
logFile="${targetVolume}/$logName"
# Check if target volume exists
if [[ ! -d "$targetVolume" ]]; then
echo "$targetVolume volume does not exist!" >&2
if [[ ! -d "${v_mntpt}" ]]; then
echo "$v_mntpt volume does not exist!" >&2
exit 1
fi
exec >>"${logFile}" 2>&1
mainLine="=============================================================================="
subLine="------------------------------------------------------------------------------"
[[ -d "${targetVolume}/Extra/Themes/$themeDir" ]] && echo "Theme $themeName installed"
exec > >(tee -a "${v_mntpt}/${logName}") 2>&1
echo "$mainLine"
echo "Installing Theme $themeName"
echo "$subLine"
if [[ -d "${v_mntpt}/Extra/Themes/$themeDir" ]]; then
echo "Theme $themeName installed"
else
echo "*** ERROR:$themeName not installed"
fi
echo "$subLine"
exit 0
trunk/package/Scripts.templates/InstallModule/postinstall
22
33
44
5
5
6
7
8
69
710
811
912
10
1113
1214
13
14
15
15
16
17
1618
1719
18
20
21
1922
20
23
2124
25
26
27
28
29
30
31
32
33
34
35
36
2237
set -u
targetVolume="$3"
configFile='/private/tmp/InstallConfig.plist'
v_mntptDev=$( /usr/libexec/PlistBuddy -c "Print :ramdisk" ${configFile} | sed -e 's/[[:blank:]]*//g' )
v_mntpt=$( LC_ALL=C diskutil info ${v_mntptDev} | grep -i 'mount point' | awk '{$1=$2=""; print $0}' \
| sed -e 's/^[ \t]*//' )
moduleName="@moduleName@"
moduleFile="@moduleFile@"
logName="@LOG_FILENAME@"
logFile="${targetVolume}/$logName"
# Check if target volume exists
if [[ ! -d "$targetVolume" ]]; then
echo "$targetVolume volume does not exist!" >&2
exit 1
if [[ ! -d "${v_mntpt}" ]]; then
echo "Ram Disk not found volume does not exist!" >&2
# exit 1
fi
exec >>"${logFile}" 2>&1
mainLine="=============================================================================="
subLine="------------------------------------------------------------------------------"
[[ -f "${targetVolume}/Extra/modules/$moduleFile" ]] && echo "Module $moduleName installed"
exec > >(tee -a "${v_mntpt}/${logName}") 2>&1
echo "$mainLine"
echo "Installing $moduleFile"
echo "$subLine"
if [[ -f "${v_mntpt}/Extra/modules/$moduleFile" ]]; then
echo "$moduleName installed to Ram disk"
else
echo "*** ERROR:$moduleName not installed"
fi
echo "$subLine"
exit 0
trunk/package/Scripts.templates/CleanOptions/clean_bootplist.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/usr/bin/perl
use strict;
use YAML::Syck;
our $target_volume;
our $boot_plist_filepath;
our $yaml_file="@YAML_FILE@";
if ($#ARGV < 0) {
print stderr "A target volume is needed\n";
} else {
$target_volume=$ARGV[0];
}
$boot_plist_filepath = "${target_volume}/Extra/org.chameleon.Boot.plist";
if ( -f "$boot_plist_filepath" ) {
main("$yaml_file");
}
sub _do_cmd {
my ($cmd, $key, $value) = @_;
my $out;
$key =~ s/([\s])/\\$1/g; # Escape characters in key
$value =~ s/([\s"])/\\$1/g; # Escape characters in value (space & ")
my $plistbuddy_command="$cmd :$key $value";
open ( OUTPUT, "-|", '/usr/libexec/PlistBuddy', "-c", "$plistbuddy_command", "$boot_plist_filepath" );
my $exit_code = $?;
chomp($out = <OUTPUT>);
close OUTPUT;
return $out;
}
sub get_boot_plist_option {
my ($option) = @_;
return _do_cmd( "Print", "$option");
}
sub delete_boot_plist_option {
my ($option) = @_;
return _do_cmd( "Delete", "$option");
}
sub delete_boot_plist_text_option {
my ($option, $values) = @_;
my $current_value = get_boot_plist_option "$option";
if ( $current_value ne "") {
foreach my $recognized_value (@{$values}) {
if ($recognized_value eq $current_value) {
return _do_cmd( "Delete", "$option");
}
}
}
return "";
}
sub delete_boot_plist_list_option {
my ($option, $values) = @_;
my $current_value = get_boot_plist_option "$option";
if ( $current_value ne "") {
my %count;
my @new_list;
foreach my $value (@{$values}) {
$count{$value} = 1;
}
foreach my $value (split(/\s+/,$current_value)) {
if ( not exists $count{$value} ) {
push @new_list, $value;
}
}
return _do_cmd( "Set", $option, join(' ',@new_list) );
}
return "";
}
sub main() {
# Remove all options that installer can managed
my ($yaml_file) = @_;
my $hash_ref = LoadFile($yaml_file) or die "Can't open yaml file\n";
foreach my $option ( keys %{$hash_ref} ) {
my $type = $hash_ref->{$option}->{type};
if ( $type =~ /^bool$/i ) {
delete_boot_plist_option($option);
} elsif ( $type =~ /^text$/i ) {
delete_boot_plist_text_option( $option,
$hash_ref->{$option}->{values} );
} elsif ( $type =~ /^list$/i ) {
delete_boot_plist_list_option( $option,
$hash_ref->{$option}->{values} );
}
}
}
trunk/package/Changes.txt
1
2
13
24
35
- Micky1979 - Update Chameleon pkg Installer (Allow install on ESP).
- Micky1979 - Add sectorsize is a tiny command line made to detect the Physical and logical sector size of your hard disk.
- JrCs - boot1-install can show ntfs volume.
trunk/package/Scripts/Main/BootNO
1
2
3
4
5
6
7
8
#!/bin/bash
configFile="/private/tmp/InstallConfig.plist"
# adding option to declare that we are NOT installing the binary of the bootloader
# to the InstallConfig.plist
/usr/libexec/PlistBuddy -c "Add :bootloader bool false" ${configFile}
trunk/package/Scripts/Main/BootYES
1
2
3
4
5
6
7
8
#!/bin/bash
configFile="/private/tmp/InstallConfig.plist"
# adding option to declare that we are NOT installing the binary of the bootloader
# to the InstallConfig.plist
/usr/libexec/PlistBuddy -c "Add :bootloader bool true" ${configFile}
trunk/package/Scripts/Main/ESPpostinstall
11
22
3
4
5
6
7
3
4
5
6
7
8
9
10
811
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
3334
3435
3536
3637
38
3739
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
3858
39
40
41
42
43
44
45
46
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
4798
48
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
49115
50
51
52
53
54
55
116
117
118
119
120
121
122
123
124
56125
57
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
58145
59
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
60161
61
62
63
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
64186
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
81213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
82229
83
84
85
86
230
231
232
233
87234
88
235
236
237
238
239
240
241
242
243
89244
90
91
245
246
247
248
249
250
251
252
253
92254
93
94
255
256
257
258
259
260
261
95262
96
97
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
98317
318
319
320
321
322
323
324
325
326
327
328
329
330
99331
100
101
102
103
332
104333
105
106
107
108
334
335
336
337
338
109339
110
111
340
112341
113
114
115
116
342
343
344
345
346
347
348
117349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
118374
119
120
121375
122
123
376
377
378
124379
380
381
125382
126
127
128
129
383
384
130385
131
132
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
133410
411
412
134413
135
136
137
414
415
416
138417
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203418
#!/bin/bash
echo "==============================================="
echo "Main EFI System Partition Post-Install Script"
echo "*********************************************"
echo "-----------------------------------------------"
echo ""
# --------------------------------------------------------------------------------------------------------
# Install.sh v1.3, script to install Chameleon
# Created by Miky1979 on December 8th, 2014
# --------------------------------------------------------------------------------------------------------
targetVolume="${3}"
InstallToESP="1"
InstallBootloader="0"
configFile="/private/tmp/InstallConfig.plist"
# Find location of this script in the package installer
# so we know where all the other scripts are located.
MYLOCATION="${PWD}/${BASH_ARGV[0]}"
export MYLOCATION="${MYLOCATION%/*}"
scriptDir=$MYLOCATION
#echo "==============================================="
#echo "Apple Installer Package Variables"
#echo "*********************************"
#echo "DEBUG: $ 1 = Full path to the installation package the installer app is processing: " $1
#echo "DEBUG: $ 2 = Full path to the installation destination: " $2
#echo "DEBUG: $ 3 = Installation volume (mountpoint) to receive the payload: " $3
#echo "DEBUG: $ 4 = Root directory for the system: " $4
#echo "DEBUG: Script Name: " $SCRIPT_NAME
#echo "DEBUG: Package Path: " $PACKAGE_PATH
#echo "DEBUG: Installer Temp: " $INSTALLER_TEMP
#echo "DEBUG: Full path to the temp directory containing the operation executable: " $RECEIPT_PATH
#echo "-----------------------------------------------"
#echo ""
# Initialise Script Globals
if [[ $( /usr/libexec/PlistBuddy -c "Print bootloader" ${configFile} ) == "true" ]];then
# installing stage 0, 1 and 2 only if user want this:
# ie only if have no selected noboot choice
InstallBootloader="1"
fi
# --------------------------------------------------------------------------------------------------------
if [ ! -d "${targetVolume}" ]; then echo "target Volume not found, aborting!"; exit 1; fi
# --------------------------------------------------------------------------------------------------------
i386Dir="${targetVolume}/usr/standalone/i386"
usrLocalBin="${targetVolume}/usr/local/bin"
# --------------------------------------------------------------------------------------------------------
choicedVolume="${targetVolume}"
ESP_MOUNTED="0"
# --------------------------------------------------------------------------------------------------------
v_mntptDev=$( /usr/libexec/PlistBuddy -c "Print :ramdisk" ${configFile} | sed -e 's/[[:blank:]]*//g' )
v_mntpt=$( LC_ALL=C diskutil info ${v_mntptDev} | grep -i 'mount point' | awk '{$1=$2=""; print $0}' \
| sed -e 's/^[ \t]*//')
backupRootDir="${targetVolume}/Chameleon.Backups"
backupDir=$( /usr/libexec/PlistBuddy -c "Print :backupDir" ${configFile} )
logName="Chameleon_Installer_Log.txt"
logFile="${v_mntpt}/${logName}"
# --------------------------------------------------------------------------------------------------------
stage0Loader="boot0"
stage0LoaderDualBoot="boot0md"
stage1LoaderHFS="boot1h"
stage1LoaderFAT="boot1f32"
stage1LoaderExFAT="boot1x"
stage2Loader="boot"
versionToInstall=$(cat "${i386Dir}/Boot" | grep -a 'Darwin/x86 boot v' )
# --------------------------------------------------------------------------------------------------------
localdd="/bin/dd"
SS="${usrLocalBin}/sectorsize"
# --------------------------------------------------------------------------------------------------------
# Scanning all Variables. We are switching to the target Volume or its ESP.
# This function is usefull to rescan the new target "at need"
SCAN() {
targetDevice=$( LC_ALL=C diskutil info "${choicedVolume}" | grep -i 'Device Node:' | awk '{print $NF}' )
targetDeviceRaw=${targetDevice/disk/rdisk}
targetDisk=${targetDevice%s*}
targetDiskRaw=${targetDisk/disk/rdisk}
targetSlice=${targetDevice#*disk*s}
IOContent=$( LC_ALL=C diskutil info "${targetDisk}" | grep -i 'Content (IOContent)' | awk '{print $NF}' )
FS=$( LC_ALL=C diskutil info ${targetDevice} | grep -i 'Type (Bundle)' | \
awk '{print $NF}' | awk '{print tolower($0)}' )
disksignature=$( dd 2>/dev/null if="${targetDisk}" count=1 | dd 2>/dev/null count=4 bs=1 skip=440 | \
perl -ne '@a=split"";for(@a){printf"%02x",ord}' )
# If target volume root of current system then replace
# / with volume name.
if [ "$3" == "/" ]
then
targetVolumeChosenByUser="/Volumes/"$( ls -1F /Volumes | sed -n 's:@$::p' )
else
targetVolumeChosenByUser="$3"
fi
if [ $InstallBootloader = "1" ];then
blocksize=$( "${SS}" "${targetDeviceRaw}" | awk '{ print $2 }' )
fi
}
# --------------------------------------------------------------------------------------------------------
# lines
mainLine="=============================================================================="
subLine="------------------------------------------------------------------------------"
# --------------------------------------------------------------------------------------------------------
# Debug for Chameleon.
# Create a folder inside the Desktop called "DebugChameleon", and the log will be full
DEBUG() {
echo "$mainLine"
echo "DEBUG: display script variables (ESPpostinstall)"
echo "$mainLine"
echo "DEBUG: stage0Loader: Disk loader is ${stage0Loader} (or boot0hfs)"
echo "DEBUG: stage0LoaderDualBoot: Disk loader is ${stage0LoaderDualBoot} (or boot0hfs)"
echo "DEBUG: stage1LoaderHFS: Partition loader is ${stage1LoaderHFS}"
echo "DEBUG: stage1LoaderFat: Partition loader is ${stage1LoaderFAT}"
echo "DEBUG: stage1LoaderExFAT: Partition loader is ${stage1LoaderExFAT}"
echo "DEBUG: stage2Loader: Filesystem loader is ${stage2Loader}"
echo "DEBUG: targetVolume: Volume is ${targetVolume}"
echo "DEBUG: targetDevice: Volume device is ${targetDevice}"
echo "DEBUG: targetDeviceRaw: Volume raw device is ${targetDeviceRaw}"
echo "DEBUG: targetDisk: Disk device is ${targetDisk}"
echo "DEBUG: targetDiskRaw: Disk raw device is ${targetDiskRaw}"
echo "DEBUG: targetSlice: Volume slice is ${targetSlice}"
echo "DEBUG: versionToInstall: version to install is ${versionToInstall}"
echo "DEBUG: IOContent: partition scheme is ${IOContent}"
echo "DEBUG: FS: file System is ${FS}"
if [ $InstallBootloader = "1" ];then
echo "DEBUG: blocksize: block size detected = ${blocksize}-bytes"
fi
}
# --------------------------------------------------------------------------------------------------------
# Checking for unsupported FAT16 filesystem
CHECK_FAT16() {
pers=$( LC_ALL=C diskutil info "${targetDeviceRaw}" | grep -i 'File System Personality' \
| awk '{print $NF}' | awk '{print tolower($0)}' )
targetDeviceChosenByUser=$( df "${targetVolumeChosenByUser}" | sed -n '2p' | awk '{print $1}' )
case $pers in
fat16)
echo "** ERROR: Can't Install to a device using FAT16!"
exit 1
;;
*)
echo "First Check Passed!"
;;
esac
}
# --------------------------------------------------------------------------------------------------------
# Mount or umount the ESP..or leave as is if already mounted..
UMOUNT_ESP_DISK() {
# umount the ESP by its dev
umount -f $espDisk
}
targetVolume="/Volumes/EFI"
targetDevice=${targetDeviceChosenByUser%s*}s1
targetDeviceRaw=${targetDevice/disk/rdisk}
targetDisk=${targetDevice%s*}
targetDiskRaw=${targetDisk/disk/rdisk}
targetSlice=${targetDevice#*disk*s}
CHECK_ESP_MOUNTPOINT() {
# umount the ESP by its Mount Point
# and checking it if is busy by another ESP
if [ $( df | awk '{$1=$2=$3=$4=$5=$6=$7=$8=""; print $0}' | sed -e 's/^[ \t]*//' | \
grep -x '/Volumes/ESP' ) ]; then
umount -f /Volumes/ESP
ESP_MOUNTED="0"
fi
}
targetResources="${targetVolumeChosenByUser}/usr/local/bin/"
MOUNT_ESP() {
ESP_MOUNTED="1" # ..assuming that the ESP can be already mounted..
if [ $( df | grep "${espDisk}" | awk '{print $1}' | grep -x "${espDisk}" ) ];then
# ESP is already mounted, so now we aquire the Mount Point
espmtp=$( LC_ALL=C diskutil info ${espDisk} | grep -i 'mount point' | awk '{$1=$2=""; print $0}' | \
sed -e 's/^[ \t]*//' )
if [ -d "${espmtp}" ];then
echo "ESP Mount Point is:${espmtp}, using that as target Volume!"
choicedVolume="${espmtp}"
SCAN
else
echo "The mount point was not found, try to umount it to get the standard one.."
UMOUNT_ESP_DISK
CHECK_ESP_MOUNTPOINT
fi
else
# ESP is not mounted..
ESP_MOUNTED="0"
fi
efiPartitionExist=0 # target volume does not have EFI system partition.
if [ $ESP_MOUNTED = "0" ];then
mkdir -p /Volumes/ESP
case $( fstyp $espDisk ) in
hfs)
mount -t hfs $espDisk /Volumes/ESP
;;
msdos)
mount -t msdos $espDisk /Volumes/ESP
;;
*)
echo "ESP fileSystem unsupported, Installing to ${targetVolume}!"
choicedVolume="${targetVolume}"
;;
esac
sleep 0.3
echo "==============================================="
echo "DEBUG: display script variables"
echo "***************************"
if [ $( df | awk '{$1=$2=$3=$4=$5=$6=$7=$8=""; print $0}' | sed -e 's/^[ \t]*//' | \
grep -x '/Volumes/ESP' ) ]; then
ESP_MOUNTED="1"
choicedVolume="/Volumes/ESP"
SCAN
else
echo "ESP can't be mounted, Installing to ${targetVolume}!"
choicedVolume="${targetVolume}"
fi
fi
}
# --------------------------------------------------------------------------------------------------------
PARTITION_ACTIVE_IF() {
echo -e "${mainLine}\nSET PARTITION ACTIVE:"
# if Windows was detected, don't activate the partition..
# if the stage 0 loader is boo0hfs, don't activate the partition
if [ WINDOWS_EXIST = "0" ] || [ "${stage0Loader}" != "boot0hfs" ];then
partitionactive=$( fdisk -d ${targetDiskRaw} | grep -n "*" | awk -F: '{print $1}')
if [ "${partitionactive}" ] && [ "${partitionactive}" = "${targetSlice}" ]; then
echo "${targetDiskRaw#/dev/r}, slice "${targetSlice}" is already set active. No need to change it."
else
echo "Setting ${choicedVolume} partition active."
# BadAxe requires EFI partition to be flagged active.
# but it doesn't' hurt to do it for any non-windows partition.
echo "DEBUG: stage0Loader: Disk loader is ${stage0Loader}"
echo "DEBUG: stage0LoaderDualBoot: Disk loader is ${stage0LoaderDualBoot}"
echo "DEBUG: stage1LoaderHFS: Partition loader is ${stage1LoaderHFS}"
echo "DEBUG: stage1LoaderFat: Partition loader is ${stage1LoaderFAT}"
echo "DEBUG: stage2Loader: Filesystem loader is ${stage2Loader}"
echo "DEBUG: targetVolumeChosenByUser: Volume is ${targetVolumeChosenByUser}"
echo "DEBUG: targetDeviceChosenByUser: Volume device is ${targetDeviceChosenByUser}"
echo "DEBUG: targetVolume: Volume is ${targetVolume}"
echo "DEBUG: targetDevice: Volume device is ${targetDevice}"
echo "DEBUG: targetDeviceRaw: Volume raw device is ${targetDeviceRaw}"
echo "DEBUG: targetDisk: Disk device is ${targetDisk}"
echo "DEBUG: targetDiskRaw: Disk raw device is ${targetDiskRaw}"
echo "DEBUG: targetSlice: Volume slice is ${targetSlice}"
echo "DEBUG: targetResources: Boot Resources is ${targetResources}"
echo "-----------------------------------------------"
echo ""
# leave left aligned the follow code:
fdisk -e ${targetDiskRaw} <<-MAKEACTIVE
print
flag ${targetSlice}
write
y
quit
MAKEACTIVE
fi
else
echo "Partition will not activate when Windows is detected or stage 0 is boot0hfs"
fi
echo ""
echo "$mainLine"
}
# --------------------------------------------------------------------------------------------------------
# Writing stage 0
CHECK_WINDOWS() {
WINDOWS_EXIST="0"
if [ "${disksignature}" = "00000000" ]; then
echo "Windows installation not found on ${targetDisk}."
else
echo "Windows installation found on ${targetDisk}."
WINDOWS_EXIST="1"
fi
}
WRITE_STAGE0() {
if [ $InstallBootloader = "1" ];then
echo -e "${mainLine}\nWRITING STAGE 0:"
CHECK_WINDOWS
case "$1" in
hfs)
if [ WINDOWS_EXIST = "1" ];then stage0Loader="boo0hfs"; else stage0Loader="boot0"; fi
;;
msdos)
if [ WINDOWS_EXIST = "1" ];then stage0Loader="boo0md"; else stage0Loader="boot0";fi
;;
exfat)
stage0Loader="boot0"
;;
esac
# Write some information to the Install Log
"$scriptDir"InstallLog.sh "${targetVolumeChosenByUser}" "Running EFI postinstall script"
"$scriptDir"InstallLog.sh "${targetVolumeChosenByUser}" "Target selected by user = ${targetVolumeChosenByUser} on ${targetDeviceChosenByUser}"
"$scriptDir"InstallLog.sh "${targetVolumeChosenByUser}" "Target volume = ${targetVolume} on ${targetDevice}"
"${usrLocalBin}/fdisk440" -u -f "${i386Dir}/${stage0Loader}" -y ${targetDisk}
echo "${stage0Loader} writed to ${targetDisk}"
fi
}
# Check to see if the selected disk uses a GPT
# --------------------------------------------------------------------------------------------------------
# Writing stage 1 on different filesystems
WRITE_STAGE1_HFS() {
if [ $InstallBootloader = "1" ];then
echo -e "${mainLine}\nWRITING STAGE 1 HFS:"
$localdd if="${i386Dir}/${stage1LoaderHFS}" of=${targetDeviceRaw}
echo "${stage1LoaderHFS} (hfs) writed to ${targetDeviceRaw}."
fi
}
bootuuid=$( diskutil info "$targetDeviceChosenByUser" | grep Volume\ UUID | awk {'print $3'} )
partitiontable=$( diskutil list ${targetDeviceChosenByUser%s*} | sed -n '3p' | awk '{print $2}' )
WRITE_STAGE1_EXFAT() {
if [ $InstallBootloader = "1" ];then
echo -e "${mainLine}\nWRITING STAGE 1 ExFAT:"
cp -R "${usrLocalBin}/boot1-install" "${v_mntpt}"/
cp -R "${i386Dir}/${stage1LoaderExFAT}" "${v_mntpt}"/
"${v_mntpt}/boot1-install" -y -u -f "${v_mntpt}/${stage1LoaderExFAT}" ${targetDeviceRaw}
echo "${stage1LoaderExFAT} (ExFAT) writed to ${targetDeviceRaw}."
fi
}
if [ ${partitiontable} = "GUID_partition_scheme" ]; then
echo "Confirm this is a GPT partitioned disk."
WRITE_STAGE1_FAT32() {
if [ $InstallBootloader = "1" ];then
echo -e "${mainLine}\nWRITING STAGE 1 FAT32:"
$localdd if=${targetDeviceRaw} count=1 bs=512 of="${v_mntpt}/origbs"
cp "${i386Dir}/${stage1LoaderFAT}" "${v_mntpt}/newbs"
$localdd if="${v_mntpt}/origbs" of="${v_mntpt}/newbs" skip=3 seek=3 bs=1 count=87 conv=notrunc
$localdd if="${v_mntpt}/newbs" of="${targetDeviceRaw}" count=1 bs=512
# Double check we can see the selected partition and it's of the right type.
# The following script returns either 0 or 1 to proceed, or 2 to indicate failure.
echo "${stage1LoaderFAT} (Fat32) writed to ${targetDeviceRaw}."
fi
}
# --------------------------------------------------------------------------------------------------------
# Writing stage 2
WRITE_STAGE2() {
if [ $InstallBootloader = "1" ];then
echo -e "${mainLine}\nWRITING STAGE 2:"
cp -R "${i386Dir}/${stage2Loader}" "${choicedVolume}/"
chflags hidden "${choicedVolume}/${stage2Loader}"
echo "Stage 2 (boot) writed to ${choicedVolume}."
fi
}
# --------------------------------------------------------------------------------------------------------
# Waiting for targhet Volume was re-mounted before proceeding..
# Note: the target Volume is umonted by boot1-install that also take the step to remount it (only waiting..)
WAIT_REMOUNT() {
if [ $InstallBootloader = "1" ];then
if [ ! -d "${choicedVolume}" ]; then
echo -e "${mainLine}\nWAITING TO RE-MOUNT ${choicedVolume}:"
until [ -d "${choicedVolume}" ]; do
sleep 0.3
done
echo "${choicedVolume} is mounted!"
fi
fi
}
# --------------------------------------------------------------------------------------------------------
# Extra folder...
EXTRA() {
echo -e "${mainLine}\nEXTRA FOLDER:"
if [ ! -d "${choicedVolume}/Extra" ]; then
echo "Extra not found on ${choicedVolume}, creating.."
mkdir -p "${v_mntpt}/Extra"
/usr/libexec/PlistBuddy -c "Add :'Kernel Flags' string -v" "${v_mntpt}/Extra/org.chameleon.Boot.plist"
else
echo "Extra folder already exist on ${choicedVolume}, copying to the Ram Disk.."
cp -R "${choicedVolume}/Extra" "${v_mntpt}"/
./clean_bootplist.pl "${v_mntpt}" >/dev/null
fi
}
# --------------------------------------------------------------------------------------------------------
# Preparing Backing up of Chameleon files
BACKUP() {
echo -e "${mainLine}\nBACKUP CHAMELEON FILES:"
# Backup Stage 2
if [ $InstallBootloader = "1" ];then
if [ -f "${choicedVolume}/boot" ]; then
echo "Backup stage2 file ${choicedVolume}/boot to ${backupRootDir}/${backupDir}/boot"
cp "${choicedVolume}/boot" "${backupRootDir}/${backupDir}/boot"
else
echo "No stage 2 (boot) was found, nothing to be saved."
fi
fi
# Backup /Extra directory
if [[ -d "${choicedVolume}/Extra" ]];then
echo "Backing up ${choicedVolume}/Extra folder to ${backupRootDir}/${backupDir}/Extra"
cp -pR "${choicedVolume}/Extra" "${backupRootDir}/${backupDir}"/
else
echo "No Extra folder was found, nothing to be saved."
fi
}
# --------------------------------------------------------------------------------------------------------
if [ ! -d "${v_mntpt}" ]; then
echo "Ram Disk not found!"
exit
fi
"$scriptDir"CheckProceed.sh "${targetVolume}" "${targetDeviceChosenByUser}" "${targetVolumeChosenByUser}" "${scriptDir}"
returnValue=$?
if [ ${returnValue} -ne 2 ]; then
# OK to proceed
exec > >(tee -a "${logFile}") 2>&1
# Remember if the target volume has an EFI system partition.
if [ ${returnValue} -ne 1 ]; then
efiPartitionExist=1
fi
echo "$mainLine"
echo "Main ESP Post-Install Script"
echo "Chameleon installer log - $( date )"
if [ $InstallBootloader = "1" ];then echo "$versionToInstall"; else echo "no boot session"; fi
echo ""
# Does a GRUB or Linux loader already exist in the disk's MBR?
# The script returns 1 if yes, 0 if no.
SCAN
"$scriptDir"CheckGRUBLinuxLoader.sh "${targetDisk}" "${targetVolumeChosenByUser}" "${scriptDir}"
returnValue=$?
if [ ${returnValue} = 0 ]; then
# OK to proceed
# (adjusted from Clover)
if [ ! "${targetDevice#*disk*s}" ]; then
echo
echo "*** ERROR: Volume does not use slices!"
echo
exit 1
fi
if [ "${InstallToESP}" == "1" ]; then
echo "$mainLine"
echo "SEARCHING ESP PARTITION:"
case "$IOContent" in
GUID_partition_scheme)
echo "GPT partition Scheme detected.."
espDisk="${targetDisk}s1"
if [ $( LC_ALL=C diskutil info ${espDisk} | grep -i 'Partition Type:' | \
awk '{print $NF}' ) = "EFI" ]; then
echo "EFI partition found is ${espDisk}, try to mount it.."
MOUNT_ESP
else
echo "EFI was not fount, continue installing to ${targetVolume}"
choicedVolume="${targetVolume}"
fi
;;
*)
echo "Can't install on the ESP, because does not exist.."
echo "..continue installing to ${targetVolume}"
;;
esac
else
SCAN
fi
# check for a 4-byte Windows disk signature in the disk's MBR.
# the following script returns 1 if a Windows disk signature exists, and 0 if not.
"$scriptDir"CheckWindowsDiskSignature.sh "${targetDisk}" "${targetVolumeChosenByUser}" "${scriptDir}"
diskSigCheck=$?
if [ -d "${HOME}/Desktop/DebugChameleon" ]; then
DEBUG
fi
# adding the chosen Volume dev id to the InstallConfig.plist
/usr/libexec/PlistBuddy -c "Add :targetdev string ${targetDevice}" $configFile
# check for existing bootloaders in the disk's MBR
# and find out if we can write the Chameleon boot files.
# the following script returns 0 if we can proceed
# with writing the boot files, and 1 for not.
BACKUP
EXTRA
"$scriptDir"CheckDiskMicrocode.sh "${targetDisk}" "${diskSigCheck}" "${targetVolumeChosenByUser}" "${scriptDir}"
diskupdate=$?
echo "${mainLine}"
CHECK_FAT16
case "$FS" in
hfs)
echo "${targetDevice} is HFS formatted"
WRITE_STAGE0 hfs
WRITE_STAGE1_HFS
;;
msdos)
echo "${targetDevice} is FAT32 formatted"
WRITE_STAGE0 msdos
WRITE_STAGE1_FAT32
;;
exfat)
echo "${targetDevice} is ExFAT formatted"
WRITE_STAGE0 exfat
WRITE_STAGE1_EXFAT
WAIT_REMOUNT
;;
*)
echo "FileSystem unsupported, aborting!"
exit 0
;;
esac
WRITE_STAGE2
PARTITION_ACTIVE_IF
# check the format of the selected partition.
# result should be either hfs or msdos
# Should really check to make sure!
echo "$mainLine"
echo "END - ESP Post-Install Script"
# --------------------------------------------------------------------------------------------------------
targetFormat=$( fstyp "$targetDevice" )
# Append a LineBreak to the installer log
"$scriptDir"InstallLog.sh "${targetVolumeChosenByUser}" "LineBreak"
if [ ${diskupdate} = "0" ]; then
# Write the stage 0 loader to the MBR
"$scriptDir"WriteChameleonStage0.sh "${diskSigCheck}" "${stage0Loader}" "${stage0LoaderDualBoot}" "${targetDisk}" "${targetResources}" "${targetVolumeChosenByUser}" "${scriptDir}"
else
"$scriptDir"InstallLog.sh "${targetVolumeChosenByUser}" "Stage 0 loader not written to ${targetDisk}."
fi
# Write the stage 1 loader to the partition boot sector
"$scriptDir"WriteChameleonStage1.sh "${targetFormat}" "${stage1LoaderHFS}" "${stage1LoaderFAT}" "${targetVolumeChosenByUser}" "${targetDeviceRaw}" "${targetVolumeChosenByUser}" "${scriptDir}"
# Unmount ALL mounted volumes named EFI.
# Returns 0=success, 1=fail
"$scriptDir"UnMountEFIvolumes.sh "${targetVolumeChosenByUser}" "${scriptDir}"
returnValue=$?
if [ ${returnValue} = 0 ]; then
# OK to proceed
# Mount the EFI system partition
"$scriptDir"MountESP.sh "${targetDisk}" "${targetVolumeChosenByUser}" "${efiPartitionExist}" "${scriptDir}"
# Write the stage 2 loader to the root of the selected partition
"$scriptDir"WriteChameleonStage2.sh "${stage2Loader}" "${targetVolume}" "${targetDevice}" "${targetVolumeChosenByUser}" "${scriptDir}"
# Check for another existing Chameleon installation on the same disk
"$scriptDir"InstallLog.sh "${targetVolume}" "LineBreak"
"$scriptDir"InstallLog.sh "${targetVolume}" "Preparing to check target disk for previous installations."
"$scriptDir"CheckPreviousChameleon.sh "${targetDisk}" "${targetDeviceRaw}" "${targetDevice}" "${targetVolumeChosenByUser}" "${scriptDir}"
fi
# Append a LineBreak to the installer log
"$scriptDir"InstallLog.sh "${targetVolumeChosenByUser}" "LineBreak"
# Set the active partition ONLY if Windows is not installed
"$scriptDir"SetActivePartition.sh "${diskSigCheck}" "${targetDiskRaw}" "${targetSlice}" "${targetVolumeChosenByUser}" "${scriptDir}"
fi
fi
else
#echo "ERROR Volume is not on a GPT partitioned disc."
"$scriptDir"InstallLog.sh "${targetVolumeChosenByUser}" "ERROR Volume is not on a GPT partitioned disc."
fi
# Create temporary file on target volume to notify Postinstall
# script, boot option code, that EFI (ESP) option was chosen
echo "EFI" >"${targetVolumeChosenByUser}"/.ChameleonEFI
"$scriptDir"InstallLog.sh "${targetVolumeChosenByUser}" "LineBreak"
"$scriptDir"InstallLog.sh "${targetVolumeChosenByUser}" "EFI script complete"
echo "==============================================="
echo "END - Main EFI System Partition Post-Install Script"
echo "*********************************************"
echo "-----------------------------------------------"
echo ""
exit 0
trunk/package/Scripts/Main/Standardpostinstall
11
22
3
4
5
6
7
3
4
5
6
7
8
9
10
811
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
3434
3535
3636
3737
38
3839
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
3958
40
41
42
43
44
45
46
47
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
4898
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
49115
50
51
52
53
54
116
117
118
119
120
121
122
123
124
55125
56
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
57145
58
59
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
60161
61
62
63
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
64186
65
66
67
68
69
70
71
72
73
74
75
76
77
78
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
79213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
80229
81
82
83
230
231
232
233
234
235
236
237
238
239
240
241
242
84243
85
86
244
245
246
247
248
249
250
251
252
87253
88
89
90
91
92
93
94
95
96
254
255
256
257
258
259
260
97261
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
114316
317
318
319
320
321
322
323
324
325
326
327
328
329
115330
116
117
118
119
331
120332
333
334
335
336
337
121338
122
123
124
125
339
126340
341
342
343
344
345
346
347
127348
128
129
130
131
132
133
134
135
136
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
137373
138
139
140
141
142
143
144374
145
146
147
148
149
375
376
377
150378
151
152
379
380
153381
154
155
156
157
158
159
382
383
160384
161
162
163
164
165
166
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
167409
168
169
410
411
170412
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
413
200414
201
202
203
415
204416
205417
#!/bin/bash
echo "==============================================="
echo "Main Standard Post-Install Script"
echo "*********************************"
echo "-----------------------------------------------"
echo ""
# --------------------------------------------------------------------------------------------------------
# Install.sh v1.3, script to install Chameleon
# Created by Miky1979 on December 8th, 2014
# --------------------------------------------------------------------------------------------------------
targetVolume="${3}"
InstallToESP="0"
InstallBootloader="0"
configFile="/private/tmp/InstallConfig.plist"
# Find location of this script in the package installer
# so we know where all the other scripts are located.
MYLOCATION="${PWD}/${BASH_ARGV[0]}"
export MYLOCATION="${MYLOCATION%/*}"
scriptDir=$MYLOCATION
#echo "==============================================="
#echo "Apple Installer Package Variables"
#echo "*********************************"
#echo "DEBUG: $ 1 = Full path to the installation package the installer app is processing: " $1
#echo "DEBUG: $ 2 = Full path to the installation destination: " $2
#echo "DEBUG: $ 3 = Installation volume (mountpoint) to receive the payload: " $3
#echo "DEBUG: $ 4 = Root directory for the system: " $4
#echo "DEBUG: Script Name: " $SCRIPT_NAME
#echo "DEBUG: Package Path: " $PACKAGE_PATH
#echo "DEBUG: Installer Temp: " $INSTALLER_TEMP
#echo "DEBUG: Full path to the temp directory containing the operation executable: " $RECEIPT_PATH
#echo "-----------------------------------------------"
#echo ""
# Initialise Script Globals
if [[ $( /usr/libexec/PlistBuddy -c "Print bootloader" ${configFile} ) == "true" ]];then
# installing stage 0, 1 and 2 only if user want this:
# ie only if have no selected noboot choice
InstallBootloader="1"
fi
# --------------------------------------------------------------------------------------------------------
if [ ! -d "${targetVolume}" ]; then echo "target Volume not found, aborting!"; exit 1; fi
# --------------------------------------------------------------------------------------------------------
i386Dir="${targetVolume}/usr/standalone/i386"
usrLocalBin="${targetVolume}/usr/local/bin"
# --------------------------------------------------------------------------------------------------------
choicedVolume="${targetVolume}"
ESP_MOUNTED="0"
# --------------------------------------------------------------------------------------------------------
v_mntptDev=$( /usr/libexec/PlistBuddy -c "Print :ramdisk" ${configFile} | sed -e 's/[[:blank:]]*//g' )
v_mntpt=$( LC_ALL=C diskutil info ${v_mntptDev} | grep -i 'mount point' | awk '{$1=$2=""; print $0}' \
| sed -e 's/^[ \t]*//')
backupRootDir="${targetVolume}/Chameleon.Backups"
backupDir=$( /usr/libexec/PlistBuddy -c "Print :backupDir" ${configFile} )
logName="Chameleon_Installer_Log.txt"
logFile="${v_mntpt}/${logName}"
# --------------------------------------------------------------------------------------------------------
stage0Loader="boot0"
stage0LoaderDualBoot="boot0md"
stage1LoaderHFS="boot1h"
stage1LoaderFAT="boot1f32"
stage1LoaderExFAT="boot1x"
stage2Loader="boot"
versionToInstall=$(cat "${i386Dir}/Boot" | grep -a 'Darwin/x86 boot v' )
# --------------------------------------------------------------------------------------------------------
localdd="/bin/dd"
SS="${usrLocalBin}/sectorsize"
# --------------------------------------------------------------------------------------------------------
# Scanning all Variables. We are switching to the target Volume or its ESP.
# This function is usefull to rescan the new target "at need"
SCAN() {
targetDevice=$( LC_ALL=C diskutil info "${choicedVolume}" | grep -i 'Device Node:' | awk '{print $NF}' )
targetDeviceRaw=${targetDevice/disk/rdisk}
targetDisk=${targetDevice%s*}
targetDiskRaw=${targetDisk/disk/rdisk}
targetSlice=${targetDevice#*disk*s}
IOContent=$( LC_ALL=C diskutil info "${targetDisk}" | grep -i 'Content (IOContent)' | awk '{print $NF}' )
FS=$( LC_ALL=C diskutil info ${targetDevice} | grep -i 'Type (Bundle)' | \
awk '{print $NF}' | awk '{print tolower($0)}' )
disksignature=$( dd 2>/dev/null if="${targetDisk}" count=1 | dd 2>/dev/null count=4 bs=1 skip=440 | \
perl -ne '@a=split"";for(@a){printf"%02x",ord}' )
# If target volume root of current system then replace
# / with volume name.
if [ "$3" == "/" ]
then
targetVolume="/Volumes/"$( ls -1F /Volumes | sed -n 's:@$::p' )
else
targetVolume="$3"
fi
if [ $InstallBootloader = "1" ];then
blocksize=$( "${SS}" "${targetDeviceRaw}" | awk '{ print $2 }' )
fi
}
# --------------------------------------------------------------------------------------------------------
# lines
mainLine="=============================================================================="
subLine="------------------------------------------------------------------------------"
# --------------------------------------------------------------------------------------------------------
# Debug for Chameleon.
# Create a folder inside the Desktop called "DebugChameleon", and the log will be full
DEBUG() {
echo "$mainLine"
echo "DEBUG: display script variables (Standardpostinstall)"
echo "$mainLine"
echo "DEBUG: stage0Loader: Disk loader is ${stage0Loader} (or boot0hfs)"
echo "DEBUG: stage0LoaderDualBoot: Disk loader is ${stage0LoaderDualBoot} (or boot0hfs)"
echo "DEBUG: stage1LoaderHFS: Partition loader is ${stage1LoaderHFS}"
echo "DEBUG: stage1LoaderFat: Partition loader is ${stage1LoaderFAT}"
echo "DEBUG: stage1LoaderExFAT: Partition loader is ${stage1LoaderExFAT}"
echo "DEBUG: stage2Loader: Filesystem loader is ${stage2Loader}"
echo "DEBUG: targetVolume: Volume is ${targetVolume}"
echo "DEBUG: targetDevice: Volume device is ${targetDevice}"
echo "DEBUG: targetDeviceRaw: Volume raw device is ${targetDeviceRaw}"
echo "DEBUG: targetDisk: Disk device is ${targetDisk}"
echo "DEBUG: targetDiskRaw: Disk raw device is ${targetDiskRaw}"
echo "DEBUG: targetSlice: Volume slice is ${targetSlice}"
echo "DEBUG: versionToInstall: version to install is ${versionToInstall}"
echo "DEBUG: IOContent: partition scheme is ${IOContent}"
echo "DEBUG: FS: file System is ${FS}"
if [ $InstallBootloader = "1" ];then
echo "DEBUG: blocksize: block size detected = ${blocksize}-bytes"
fi
}
# --------------------------------------------------------------------------------------------------------
# Checking for unsupported FAT16 filesystem
CHECK_FAT16() {
pers=$( LC_ALL=C diskutil info "${targetDeviceRaw}" | grep -i 'File System Personality' \
| awk '{print $NF}' | awk '{print tolower($0)}' )
case $pers in
fat16)
echo "** ERROR: Can't Install to a device using FAT16!"
exit 1
;;
*)
echo "First Check Passed!"
;;
esac
}
# --------------------------------------------------------------------------------------------------------
# Mount or umount the ESP..or leave as is if already mounted..
UMOUNT_ESP_DISK() {
# umount the ESP by its dev
umount -f $espDisk
}
targetDevice=$( df "${targetVolume}" | sed -n '2p' | awk '{print $1}' )
targetDeviceRaw=${targetDevice/disk/rdisk}
targetDisk=${targetDevice%s*}
targetDiskRaw=${targetDisk/disk/rdisk}
targetSlice=${targetDevice#*disk*s}
CHECK_ESP_MOUNTPOINT() {
# umount the ESP by its Mount Point
# and checking it if is busy by another ESP
if [ $( df | awk '{$1=$2=$3=$4=$5=$6=$7=$8=""; print $0}' | sed -e 's/^[ \t]*//' | \
grep -x '/Volumes/ESP' ) ]; then
umount -f /Volumes/ESP
ESP_MOUNTED="0"
fi
}
targetResources="${targetVolume}/usr/local/bin/"
MOUNT_ESP() {
ESP_MOUNTED="1" # ..assuming that the ESP can be already mounted..
if [ $( df | grep "${espDisk}" | awk '{print $1}' | grep -x "${espDisk}" ) ];then
# ESP is already mounted, so now we aquire the Mount Point
espmtp=$( LC_ALL=C diskutil info ${espDisk} | grep -i 'mount point' | awk '{$1=$2=""; print $0}' | \
sed -e 's/^[ \t]*//' )
if [ -d "${espmtp}" ];then
echo "ESP Mount Point is:${espmtp}, using that as target Volume!"
choicedVolume="${espmtp}"
SCAN
else
echo "The mount point was not found, try to umount it to get the standard one.."
UMOUNT_ESP_DISK
CHECK_ESP_MOUNTPOINT
fi
else
# ESP is not mounted..
ESP_MOUNTED="0"
fi
updateStage1=1 # by default update partition boot sector
efiPartitionExist=0 # target volume does not have EFI system partition.
if [ $ESP_MOUNTED = "0" ];then
mkdir -p /Volumes/ESP
case $( fstyp $espDisk ) in
hfs)
mount -t hfs $espDisk /Volumes/ESP
;;
msdos)
mount -t msdos $espDisk /Volumes/ESP
;;
*)
echo "ESP fileSystem unsupported, Installing to ${targetVolume}!"
choicedVolume="${targetVolume}"
;;
esac
sleep 0.3
echo "==============================================="
echo "DEBUG: display script variables"
echo "*******************************"
if [ $( df | awk '{$1=$2=$3=$4=$5=$6=$7=$8=""; print $0}' | sed -e 's/^[ \t]*//' | \
grep -x '/Volumes/ESP' ) ]; then
ESP_MOUNTED="1"
choicedVolume="/Volumes/ESP"
SCAN
else
echo "ESP can't be mounted, Installing to ${targetVolume}!"
choicedVolume="${targetVolume}"
fi
fi
}
# --------------------------------------------------------------------------------------------------------
PARTITION_ACTIVE_IF() {
echo -e "${mainLine}\nSET PARTITION ACTIVE:"
# if Windows was detected, don't activate the partition..
# if the stage 0 loader is boo0hfs, don't activate the partition
if [ WINDOWS_EXIST = "0" ] || [ "${stage0Loader}" != "boot0hfs" ];then
partitionactive=$( fdisk -d ${targetDiskRaw} | grep -n "*" | awk -F: '{print $1}')
if [ "${partitionactive}" ] && [ "${partitionactive}" = "${targetSlice}" ]; then
echo "${targetDiskRaw#/dev/r}, slice "${targetSlice}" is already set active. No need to change it."
else
echo "Setting ${choicedVolume} partition active."
# BadAxe requires EFI partition to be flagged active.
# but it doesn't' hurt to do it for any non-windows partition.
echo "DEBUG: stage0Loader: Disk loader is ${stage0Loader}"
echo "DEBUG: stage0LoaderDualBoot: Disk loader is ${stage0LoaderDualBoot}"
echo "DEBUG: stage1LoaderHFS: Partition loader is ${stage1LoaderHFS}"
echo "DEBUG: stage1LoaderFat: Partition loader is ${stage1LoaderFAT}"
echo "DEBUG: stage2Loader: Filesystem loader is ${stage2Loader}"
echo "DEBUG: targetVolume: Volume is ${targetVolume}"
echo "DEBUG: targetDevice: Volume device is ${targetDevice}"
echo "DEBUG: targetDeviceRaw: Volume raw device is ${targetDeviceRaw}"
echo "DEBUG: targetDisk: Disk device is ${targetDisk}"
echo "DEBUG: targetDiskRaw: Disk raw device is ${targetDiskRaw}"
echo "DEBUG: targetSlice: Volume slice is ${targetSlice}"
echo "DEBUG: targetResources: Boot Resources is ${targetResources}"
echo "-----------------------------------------------"
echo ""
# leave left aligned the follow code:
fdisk -e ${targetDiskRaw} <<-MAKEACTIVE
print
flag ${targetSlice}
write
y
quit
MAKEACTIVE
fi
else
echo "Partition will not activate when Windows is detected or stage 0 is boot0hfs"
fi
echo ""
echo "$mainLine"
}
# --------------------------------------------------------------------------------------------------------
# Writing stage 0
CHECK_WINDOWS() {
WINDOWS_EXIST="0"
if [ "${disksignature}" = "00000000" ]; then
echo "Windows installation not found on ${targetDisk}."
else
echo "Windows installation found on ${targetDisk}."
WINDOWS_EXIST="1"
fi
}
WRITE_STAGE0() {
if [ $InstallBootloader = "1" ];then
echo -e "${mainLine}\nWRITING STAGE 0:"
CHECK_WINDOWS
case "$1" in
hfs)
if [ WINDOWS_EXIST = "1" ];then stage0Loader="boo0hfs"; else stage0Loader="boot0"; fi
;;
msdos)
if [ WINDOWS_EXIST = "1" ];then stage0Loader="boo0md"; else stage0Loader="boot0";fi
;;
exfat)
stage0Loader="boot0"
;;
esac
# Write some information to the Install Log
"$scriptDir"InstallLog.sh "${targetVolume}" "Running Standard postinstall script"
"$scriptDir"InstallLog.sh "${targetVolume}" "Target volume = ${targetVolume} on ${targetDevice}"
"${usrLocalBin}/fdisk440" -u -f "${i386Dir}/${stage0Loader}" -y ${targetDisk}
echo "${stage0Loader} writed to ${targetDisk}"
fi
}
# --------------------------------------------------------------------------------------------------------
# Writing stage 1 on different filesystems
WRITE_STAGE1_HFS() {
if [ $InstallBootloader = "1" ];then
echo -e "${mainLine}\nWRITING STAGE 1 HFS:"
$localdd if="${i386Dir}/${stage1LoaderHFS}" of=${targetDeviceRaw}
echo "${stage1LoaderHFS} (hfs) writed to ${targetDeviceRaw}."
fi
}
# Double check we can see the selected partition and it's of the right type.
# The following script returns either 0 or 1 to proceed, or 2 to indicate failure.
WRITE_STAGE1_EXFAT() {
if [ $InstallBootloader = "1" ];then
echo -e "${mainLine}\nWRITING STAGE 1 ExFAT:"
cp -R "${usrLocalBin}/boot1-install" "${v_mntpt}"/
cp -R "${i386Dir}/${stage1LoaderExFAT}" "${v_mntpt}"/
"${v_mntpt}/boot1-install" -y -u -f "${v_mntpt}/${stage1LoaderExFAT}" ${targetDeviceRaw}
echo "${stage1LoaderExFAT} (ExFAT) writed to ${targetDeviceRaw}."
fi
}
"$scriptDir"CheckProceed.sh "${targetVolume}" "${targetDevice}" "${targetVolume}" "${scriptDir}"
returnValue=$?
if [ ${returnValue} -ne 2 ]; then
# OK to proceed
# Remember if the target volume has an EFI system partition.
if [ ${returnValue} -ne 1 ]; then
efiPartitionExist=1
fi
WRITE_STAGE1_FAT32() {
if [ $InstallBootloader = "1" ];then
echo -e "${mainLine}\nWRITING STAGE 1 FAT32:"
$localdd if=${targetDeviceRaw} count=1 bs=512 of="${v_mntpt}/origbs"
cp "${i386Dir}/${stage1LoaderFAT}" "${v_mntpt}/newbs"
$localdd if="${v_mntpt}/origbs" of="${v_mntpt}/newbs" skip=3 seek=3 bs=1 count=87 conv=notrunc
$localdd if="${v_mntpt}/newbs" of="${targetDeviceRaw}" count=1 bs=512
# Does a GRUB or Linux loader already exist in the disk's MBR?
# The script returns 1 if yes, 0 if no.
"$scriptDir"CheckGRUBLinuxLoader.sh "${targetDisk}" "${targetVolume}" "${scriptDir}"
diskupdate=$?
if [ ${diskupdate} -ne 0 ]; then
"$scriptDir"InstallLog.sh "${targetVolume}" "Found an existing GRUB/LILO bootloader in the MBR."
"$scriptDir"InstallLog.sh "${targetVolume}" "MBR and partition boot sector will not be modified."
updateStage1=0
else
# check for existing bootloaders in the disk's MBR
# and find out if we can write the Chameleon boot files.
# the following script returns 0 if we can proceed
# with writing the boot files, and 1 for not.
"$scriptDir"CheckDiskMicrocode.sh "${targetDisk}" "${diskSigCheck}" "${targetVolume}" "${scriptDir}"
diskupdate=$?
fi
echo "${stage1LoaderFAT} (Fat32) writed to ${targetDeviceRaw}."
fi
}
# --------------------------------------------------------------------------------------------------------
# Writing stage 2
WRITE_STAGE2() {
if [ $InstallBootloader = "1" ];then
echo -e "${mainLine}\nWRITING STAGE 2:"
cp -R "${i386Dir}/${stage2Loader}" "${choicedVolume}/"
chflags hidden "${choicedVolume}/${stage2Loader}"
echo "Stage 2 (boot) writed to ${choicedVolume}."
fi
}
# --------------------------------------------------------------------------------------------------------
# Waiting for targhet Volume was re-mounted before proceeding..
# Note: the target Volume is umonted by boot1-install that also take the step to remount it (only waiting..)
WAIT_REMOUNT() {
if [ $InstallBootloader = "1" ];then
if [ ! -d "${choicedVolume}" ]; then
echo -e "${mainLine}\nWAITING TO RE-MOUNT ${choicedVolume}:"
until [ -d "${choicedVolume}" ]; do
sleep 0.3
done
echo "${choicedVolume} is mounted!"
fi
fi
}
# --------------------------------------------------------------------------------------------------------
# Extra folder...
EXTRA() {
echo -e "${mainLine}\nEXTRA FOLDER:"
if [ ! -d "${choicedVolume}/Extra" ]; then
echo "Extra not found on ${choicedVolume}, creating.."
mkdir -p "${v_mntpt}/Extra"
/usr/libexec/PlistBuddy -c "Add :'Kernel Flags' string -v" "${v_mntpt}/Extra/org.chameleon.Boot.plist"
else
echo "Extra folder already exist on ${choicedVolume}, copying to the Ram Disk.."
cp -R "${choicedVolume}/Extra" "${v_mntpt}"/
./clean_bootplist.pl "${v_mntpt}" >/dev/null
fi
}
# --------------------------------------------------------------------------------------------------------
# Preparing Backing up of Chameleon files
BACKUP() {
echo -e "${mainLine}\nBACKUP CHAMELEON FILES:"
# Backup Stage 2
if [ $InstallBootloader = "1" ];then
if [ -f "${choicedVolume}/boot" ]; then
echo "Backup stage2 file ${choicedVolume}/boot to ${backupRootDir}/${backupDir}/boot"
cp "${choicedVolume}/boot" "${backupRootDir}/${backupDir}/boot"
else
echo "No stage 2 (boot) was found, nothing to be saved."
fi
fi
# Backup /Extra directory
if [[ -d "${choicedVolume}/Extra" ]];then
echo "Backing up ${choicedVolume}/Extra folder to ${backupRootDir}/${backupDir}/Extra"
cp -pR "${choicedVolume}/Extra" "${backupRootDir}/${backupDir}"/
else
echo "No Extra folder was found, nothing to be saved."
fi
}
# --------------------------------------------------------------------------------------------------------
if [ ! -d "${v_mntpt}" ]; then
echo "Ram Disk not found!"
exit
fi
# check for a 4-byte Windows disk signature in the disk's MBR.
# the following script returns 1 if a Windows disk signature exists, and 0 if not.
"$scriptDir"CheckWindowsDiskSignature.sh "${targetDisk}" "${targetVolume}" "${scriptDir}"
diskSigCheck=$?
exec > >(tee -a "${logFile}") 2>&1
echo "$mainLine"
echo "Main Standard Post-Install Script"
echo "Chameleon installer log - $( date )"
if [ $InstallBootloader = "1" ];then echo "$versionToInstall"; else echo "no boot session"; fi
echo ""
# check the format of the selected partition.
# result should be either hfs or msdos
# Should really check to make sure!
targetFormat=$( fstyp "$targetDevice" )
SCAN
# (adjusted from Clover)
if [ ! "${targetDevice#*disk*s}" ]; then
echo
echo "*** ERROR: Volume does not use slices!"
echo
exit 1
fi
# check the partition scheme used for the selected disk.
# the following script returns 1 if GPT
# the following script returns 2 if GPT/MBR
# the following script returns 3 if MBR
# the following script returns 0 if nothing
"$scriptDir"CheckPartitionScheme.sh "${targetDisk}" "${targetVolume}" "${scriptDir}"
partitionScheme=$?
if [ ${partitionScheme} = 3 ]; then
# If MBR partition scheme then check for FAT16 or FAT32
if [ "${InstallToESP}" == "1" ]; then
echo "$mainLine"
echo "SEARCHING ESP PARTITION:"
case "$IOContent" in
GUID_partition_scheme)
echo "GPT partition Scheme detected.."
espDisk="${targetDisk}s1"
if [ $( LC_ALL=C diskutil info ${espDisk} | grep -i 'Partition Type:' | \
awk '{print $NF}' ) = "EFI" ]; then
echo "EFI partition found is ${espDisk}, try to mount it.."
MOUNT_ESP
else
echo "EFI was not fount, continue installing to ${targetVolume}"
choicedVolume="${targetVolume}"
fi
;;
*)
echo "Can't install on the ESP, because does not exist.."
echo "..continue installing to ${targetVolume}"
;;
esac
else
SCAN
fi
# the following script returns 1 if FAT16
# the following script returns 2 if FAT32
# the following script returns 0 if nothing
"$scriptDir"CheckFatType.sh "${targetDeviceRaw}" "${targetVolume}" "${scriptDir}"
fatType=$?
fi
if [ "${fatType}" = 1 ] && [ "${partitionScheme}" = 3 ]; then
# Write error to Chameleon_Error_Log file
"$scriptDir"InstallLog.sh "${targetVolume}" "FAIL: Cannot install to a device using FAT16"
else
# Continue if the selected device is not a FAT16 format device
if [ -d "${HOME}/Desktop/DebugChameleon" ]; then
DEBUG
fi
# Append a line break to the installer log
"$scriptDir"InstallLog.sh "${targetVolume}" "LineBreak"
# adding the chosen Volume dev id to the InstallConfig.plist
/usr/libexec/PlistBuddy -c "Add :targetdev string ${targetDevice}" $configFile
if [ ${diskupdate} -eq 0 ]; then
# Write the stage 0 loader to the MBR
"$scriptDir"WriteChameleonStage0.sh "${diskSigCheck}" "${stage0Loader}" "${stage0LoaderDualBoot}" "${targetDisk}" "${targetResources}" "${targetVolume}" "${scriptDir}"
else
"$scriptDir"InstallLog.sh "${targetVolume}" "Stage 0 loader not written to ${targetDisk}."
fi
BACKUP
EXTRA
if [ ${updateStage1} -eq 1 ]; then
# Write the stage 1 loader to the partition boot sector
"$scriptDir"WriteChameleonStage1.sh "${targetFormat}" "${stage1LoaderHFS}" "${stage1LoaderFAT}" "${3}" "${targetDeviceRaw}" "${targetVolume}" "${scriptDir}"
else
"$scriptDir"InstallLog.sh "${targetVolume}" "Partition boot sector not written to ${targetDevice}."
fi
echo "${mainLine}"
CHECK_FAT16
case "$FS" in
hfs)
echo "${targetDevice} is HFS formatted"
WRITE_STAGE0 hfs
WRITE_STAGE1_HFS
;;
msdos)
echo "${targetDevice} is FAT32 formatted"
WRITE_STAGE0 msdos
WRITE_STAGE1_FAT32
;;
exfat)
echo "${targetDevice} is ExFAT formatted"
WRITE_STAGE0 exfat
WRITE_STAGE1_EXFAT
WAIT_REMOUNT
;;
*)
echo "FileSystem unsupported, aborting!"
exit 0
;;
esac
# Write the stage 2 loader to the root of the selected partition
"$scriptDir"WriteChameleonStage2.sh "${stage2Loader}" "${3}" "${targetDevice}" "${targetVolume}" "${scriptDir}"
WRITE_STAGE2
PARTITION_ACTIVE_IF
# Next we look to check for existing Chameleon installations.
"$scriptDir"InstallLog.sh "${targetVolume}" "LineBreak"
"$scriptDir"InstallLog.sh "${targetVolume}" "Preparing to check target disk for previous installations."
if [ ${efiPartitionExist} -ne 0 ]; then # volume has an EFI system partition
"$scriptDir"InstallLog.sh "${targetVolume}" "Going to check the EFI system partition also."
# Unmount ALL mounted volumes named EFI. Returns 0=success, 1=fail
"$scriptDir"UnMountEFIvolumes.sh "${targetVolume}" "${scriptDir}"
returnValue=$?
if [ ${returnValue} = 0 ]; then
# Mount the EFI system partition
"$scriptDir"MountESP.sh "${targetDisk}" "${targetVolume}" "${efiPartitionExist}" "${scriptDir}"
fi
fi
# Check for another existing Chameleon installation on the same disk
"$scriptDir"CheckPreviousChameleon.sh "${targetDisk}" "${targetDeviceRaw}" "${targetDevice}" "${targetVolume}" "${scriptDir}"
# Append a line break to the installer log
"$scriptDir"InstallLog.sh "${targetVolume}" "LineBreak"
# Set the active partition ONLY if Windows is not installed
"$scriptDir"SetActivePartition.sh "${diskSigCheck}" "${targetDiskRaw}" "${targetSlice}" "${targetVolume}" "${scriptDir}"
fi
fi
"$scriptDir"InstallLog.sh "${targetVolume}" "LineBreak"
"$scriptDir"InstallLog.sh "${targetVolume}" "Standard script complete"
"$scriptDir"InstallLog.sh "${targetVolume}" "LineBreak"
echo "==============================================="
echo "$mainLine"
echo "END - Standard Post-Install Script"
echo "*********************************"
echo "-----------------------------------------------"
echo ""
# --------------------------------------------------------------------------------------------------------
exit 0
trunk/package/buildpkg.sh
274274
275275
276276
277
278
279
280
277281
278282
279283
......
467471
468472
469473
470
471
472
473
474
475
476
477
478
479
480
474
475
476
477
478
479
480
481
482
483
484
485
481486
482487
483488
484489
485490
486
491
487492
488493
489
490
491
492
493
494
494
495
495496
496
497
498
499
500
497
498
501499
502500
503501
504
505
502
503
504
506505
507
508
509
510
511
512
513
514
515
516
517
518
506
507
508
519509
520
521
522
523
524
525
510
526511
527512
513
514
528515
529516
530517
531
532
518
519
520
533521
534522
535523
......
573561
574562
575563
576
564
577565
578566
579567
......
592580
593581
594582
595
583
596584
597585
598586
......
611599
612600
613601
614
602
615603
616604
617605
......
630618
631619
632620
633
621
634622
635623
636624
......
649637
650638
651639
652
640
653641
654642
655643
......
668656
669657
670658
671
659
672660
673661
674662
......
680668
681669
682670
683
671
684672
685673
686674
687675
688676
689
677
690678
691679
692
680
693681
694
682
695683
696684
697685
......
722710
723711
724712
725
713
726714
727715
728716
......
741729
742730
743731
744
732
745733
746734
747735
......
760748
761749
762750
763
751
764752
765753
766754
......
779767
780768
781769
782
770
783771
784772
785773
......
798786
799787
800788
801
789
802790
803791
804792
......
822810
823811
824812
825
813
826814
827815
828816
......
978966
979967
980968
981
969
982970
983971
984972
985973
986
987
974
975
988976
989
977
978
979
980
981
982
983
984
985
990986
991987
988
989
990
991
992
993
994
995
996
992997
993998
994999
9951000
996
1001
9971002
1003
1004
1005
1006
9981007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
9991022
10001023
10011024
......
10041027
10051028
10061029
1007
10081030
10091031
10101032
......
11071129
11081130
11091131
1132
11101133
11111134
11121135
......
11721195
11731196
11741197
1198
11751199
11761200
11771201
case "$option" in
--group=*)
shift; groupChoice=${option#*=} ;;
--selected=*)
shift; choiceOptions="$choiceOptions selected=\"${option#*=}\"" ;;
--enabled=*)
shift; choiceOptions="$choiceOptions enabled=\"${option#*=}\"" ;;
--start-selected=*)
shift; choiceOptions="$choiceOptions start_selected=\"${option#*=}\"" ;;
--start-enabled=*)
choiceId="Core"
mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Root/usr/local/bin
mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Root/usr/standalone/i386
ditto --noextattr --noqtn ${SYMROOT}/i386/boot ${PKG_BUILD_DIR}/${choiceId}/Root/usr/standalone/i386
ditto --noextattr --noqtn ${SYMROOT}/i386/boot0 ${PKG_BUILD_DIR}/${choiceId}/Root/usr/standalone/i386
ditto --noextattr --noqtn ${SYMROOT}/i386/boot0md ${PKG_BUILD_DIR}/${choiceId}/Root/usr/standalone/i386
ditto --noextattr --noqtn ${SYMROOT}/i386/boot1f32 ${PKG_BUILD_DIR}/${choiceId}/Root/usr/standalone/i386
ditto --noextattr --noqtn ${SYMROOT}/i386/boot1h ${PKG_BUILD_DIR}/${choiceId}/Root/usr/standalone/i386
ditto --noextattr --noqtn ${SYMROOT}/i386/boot1x ${PKG_BUILD_DIR}/${choiceId}/Root/usr/standalone/i386
ditto --noextattr --noqtn ${SYMROOT}/i386/boot1he ${PKG_BUILD_DIR}/${choiceId}/Root/usr/standalone/i386
ditto --noextattr --noqtn ${SYMROOT}/i386/boot1hp ${PKG_BUILD_DIR}/${choiceId}/Root/usr/standalone/i386
ditto --noextattr --noqtn ${SYMROOT}/i386/cdboot ${PKG_BUILD_DIR}/${choiceId}/Root/usr/standalone/i386
ditto --noextattr --noqtn ${SYMROOT}/i386/chain0 ${PKG_BUILD_DIR}/${choiceId}/Root/usr/standalone/i386
ditto --noextattr --noqtn ${SYMROOT}/i386/fdisk440 ${PKG_BUILD_DIR}/${choiceId}/Root/usr/local/bin
ditto --noextattr --noqtn ${SYMROOT}/i386/boot ${PKG_BUILD_DIR}/${choiceId}/Root/usr/standalone/i386
ditto --noextattr --noqtn ${SYMROOT}/i386/boot0 ${PKG_BUILD_DIR}/${choiceId}/Root/usr/standalone/i386
ditto --noextattr --noqtn ${SYMROOT}/i386/boot0md ${PKG_BUILD_DIR}/${choiceId}/Root/usr/standalone/i386
ditto --noextattr --noqtn ${SYMROOT}/i386/boot1f32 ${PKG_BUILD_DIR}/${choiceId}/Root/usr/standalone/i386
ditto --noextattr --noqtn ${SYMROOT}/i386/boot1h ${PKG_BUILD_DIR}/${choiceId}/Root/usr/standalone/i386
ditto --noextattr --noqtn ${SYMROOT}/i386/boot1x ${PKG_BUILD_DIR}/${choiceId}/Root/usr/standalone/i386
ditto --noextattr --noqtn ${SYMROOT}/i386/boot1he ${PKG_BUILD_DIR}/${choiceId}/Root/usr/standalone/i386
ditto --noextattr --noqtn ${SYMROOT}/i386/boot1hp ${PKG_BUILD_DIR}/${choiceId}/Root/usr/standalone/i386
ditto --noextattr --noqtn ${SYMROOT}/i386/cdboot ${PKG_BUILD_DIR}/${choiceId}/Root/usr/standalone/i386
ditto --noextattr --noqtn ${SYMROOT}/i386/chain0 ${PKG_BUILD_DIR}/${choiceId}/Root/usr/standalone/i386
ditto --noextattr --noqtn ${SYMROOT}/i386/fdisk440 ${PKG_BUILD_DIR}/${choiceId}/Root/usr/local/bin
ditto --noextattr --noqtn ${SYMROOT}/i386/sectorsize ${PKG_BUILD_DIR}/${choiceId}/Root/usr/local/bin
ditto --noextattr --noqtn ${SYMROOT}/i386/boot1-install ${PKG_BUILD_DIR}/${choiceId}/Root/usr/local/bin
ditto --noextattr --noqtn ${SYMROOT}/i386/bdmesg ${PKG_BUILD_DIR}/${choiceId}/Root/usr/local/bin
packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}")
buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/"
addChoice --start-visible="false" --start-selected="true" --pkg-refs="$packageRefId" "${choiceId}"
addChoice --start-visible="false" --selected="choices['boot'].selected" --pkg-refs="$packageRefId" "${choiceId}"
# End build core package
# build Chameleon package
echo "================= Chameleon ================="
addGroupChoices --exclusive_one_choice "Chameleon"
# build standard package
choiceId="Standard"
# build boot choice package
choiceId="boot"
mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Root
mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Scripts/Resources
addTemplateScripts --pkg-rootdir="${PKG_BUILD_DIR}/${choiceId}" InstallerLog
cp -f ${PKGROOT}/Scripts/Main/${choiceId}postinstall ${PKG_BUILD_DIR}/${choiceId}/Scripts/postinstall
cp -f ${PKGROOT}/Scripts/Sub/* ${PKG_BUILD_DIR}/${choiceId}/Scripts
ditto --arch i386 `which SetFile` ${PKG_BUILD_DIR}/${choiceId}/Scripts/Resources/SetFile
mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Scripts
cp -f ${PKGROOT}/Scripts/Main/BootYES ${PKG_BUILD_DIR}/${choiceId}/Scripts/postinstall
packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}")
buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/"
addChoice --group="Chameleon" --start-selected="true" --pkg-refs="$packageRefId" "${choiceId}"
# End build standard package
addChoice --start-visible="false" --selected="!choices['noboot'].selected" \
--pkg-refs="$packageRefId" "${choiceId}"
# End build boot choice package
# build efi package
if [[ 1 -eq 0 ]];then
# Only standard installation is currently supported
# We need to update the script to be able to install
# Chameleon on EFI partition
choiceId="EFI"
mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Root
mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Scripts/Resources
addTemplateScripts --pkg-rootdir="${PKG_BUILD_DIR}/${choiceId}" InstallerLog
cp -f ${PKGROOT}/Scripts/Main/ESPpostinstall ${PKG_BUILD_DIR}/${choiceId}/Scripts/postinstall
cp -f ${PKGROOT}/Scripts/Sub/* ${PKG_BUILD_DIR}/${choiceId}/Scripts
ditto --arch i386 `which SetFile` ${PKG_BUILD_DIR}/${choiceId}/Scripts/Resources/SetFile
# build Chameleon package
echo "================= Chameleon ================="
addGroupChoices "Chameleon"
packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}")
buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/"
addChoice --group="Chameleon" --start-visible="systemHasGPT()" --start-selected="false" --pkg-refs="$packageRefId" "${choiceId}"
# End build efi package
fi
# build no bootloader choice package
# build noboot choice package
choiceId="noboot"
mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Root
mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Scripts
cp -f ${PKGROOT}/Scripts/Main/BootNO ${PKG_BUILD_DIR}/${choiceId}/Scripts/postinstall
packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}")
buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/"
addChoice --group="Chameleon" --start-selected="false" --pkg-refs="$packageRefId" "${choiceId}"
# End build no bootloader choice package
addChoice --group="Chameleon" --selected="!choices['boot'].selected" \
--pkg-refs="$packageRefId" "${choiceId}"
# End build noboot choice package
# End build Chameleon package
InstallModule
packageRefId=$(getPackageRefId "${modules_packages_identity}" "${choiceId}")
buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/Extra/modules"
buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/EXTRAROOTDIR/Extra/modules"
addChoice --group="Module" --start-selected="false" --pkg-refs="$packageRefId" "${choiceId}"
# End build ACPICodec package module
}
InstallModule
packageRefId=$(getPackageRefId "${modules_packages_identity}" "${choiceId}")
buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/Extra/modules"
buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/EXTRAROOTDIR/Extra/modules"
addChoice --group="Module" --start-selected="false" --pkg-refs="$packageRefId" "${choiceId}"
# End build NvidiaGraphicsEnabler package module
}
InstallModule
packageRefId=$(getPackageRefId "${modules_packages_identity}" "${choiceId}")
buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/Extra/modules"
buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/EXTRAROOTDIR/Extra/modules"
addChoice --group="Module" --start-selected="false" --pkg-refs="$packageRefId" "${choiceId}"
# End build AMDGraphicsEnabler package module
}
InstallModule
packageRefId=$(getPackageRefId "${modules_packages_identity}" "${choiceId}")
buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/Extra/modules"
buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/EXTRAROOTDIR/Extra/modules"
addChoice --group="Module" --start-selected="false" --pkg-refs="$packageRefId" "${choiceId}"
# End build IntelGraphicsEnabler package module
}
InstallModule
packageRefId=$(getPackageRefId "${modules_packages_identity}" "${choiceId}")
buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/Extra/modules"
buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/EXTRAROOTDIR/Extra/modules"
addChoice --group="Module" --start-selected="false" --pkg-refs="$packageRefId" "${choiceId}"
# End build KernelPatcher package module
}
InstallModule
packageRefId=$(getPackageRefId "${modules_packages_identity}" "${choiceId}")
buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/Extra/modules"
buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/EXTRAROOTDIR/Extra/modules"
addChoice --group="Module" --start-selected="false" --pkg-refs="$packageRefId" "${choiceId}"
# End build KextPatcher package module
}
# Start build Keylayout package module
choiceId="Keylayout"
moduleFile="${choiceId}.dylib"
mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Root/Extra/{modules,Keymaps}
mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Root/EXTRAROOTDIR/Extra/{modules,Keymaps}
mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Root/usr/local/bin
layout_src_dir="${SRCROOT}/i386/modules/Keylayout/layouts/layouts-src"
if [ -d "$layout_src_dir" ];then
# Create a tar.gz from layout sources
(cd "$layout_src_dir"; \
tar czf "${PKG_BUILD_DIR}/${choiceId}/Root/Extra/Keymaps/layouts-src.tar.gz" README *.slt)
tar czf "${PKG_BUILD_DIR}/${choiceId}/Root/EXTRAROOTDIR/Extra/Keymaps/layouts-src.tar.gz" README *.slt)
fi
# Adding module
ditto --noextattr --noqtn ${SYMROOT}/i386/modules/$moduleFile ${PKG_BUILD_DIR}/${choiceId}/Root/Extra/modules
ditto --noextattr --noqtn ${SYMROOT}/i386/modules/$moduleFile ${PKG_BUILD_DIR}/${choiceId}/Root/EXTRAROOTDIR/Extra/modules
# Adding Keymaps
ditto --noextattr --noqtn ${SRCROOT}/Keymaps ${PKG_BUILD_DIR}/${choiceId}/Root/Extra/Keymaps
ditto --noextattr --noqtn ${SRCROOT}/Keymaps ${PKG_BUILD_DIR}/${choiceId}/Root/EXTRAROOTDIR/Extra/Keymaps
# Adding tools
ditto --noextattr --noqtn ${SYMROOT}/i386/cham-mklayout ${PKG_BUILD_DIR}/${choiceId}/Root/usr/local/bin
# Adding scripts
InstallModule
packageRefId=$(getPackageRefId "${modules_packages_identity}" "${choiceId}")
buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/Extra/modules"
buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/EXTRAROOTDIR/Extra/modules"
addChoice --group="Module" --start-selected="false" --pkg-refs="$packageRefId" "${choiceId}"
# End build klibc package module
}
InstallModule
packageRefId=$(getPackageRefId "${modules_packages_identity}" "${choiceId}")
buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/Extra/modules"
buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/EXTRAROOTDIR/Extra/modules"
addChoice --group="Module" --start-selected="false" --pkg-refs="$packageRefId" "${choiceId}"
# End build Resolution package module
}
InstallModule
packageRefId=$(getPackageRefId "${modules_packages_identity}" "${choiceId}")
buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/Extra/modules"
buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/EXTRAROOTDIR/Extra/modules"
addChoice --group="Module" --start-selected="false" --pkg-refs="$packageRefId" "${choiceId}"
# End build HDAEnabler package module
}
InstallModule
packageRefId=$(getPackageRefId "${modules_packages_identity}" "${choiceId}")
buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/Extra/modules"
buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/EXTRAROOTDIR/Extra/modules"
addChoice --group="Module" --start-selected="false" --pkg-refs="$packageRefId" "${choiceId}"
# End build FileNVRAM package module
}
InstallModule
packageRefId=$(getPackageRefId "${modules_packages_identity}" "${choiceId}")
buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/Extra/modules"
buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/EXTRAROOTDIR/Extra/modules"
addChoice --group="Module" --start-selected="false" --pkg-refs="$packageRefId" "${choiceId}"
# End build Sata package module
}
InstallModule
packageRefId=$(getPackageRefId "${modules_packages_identity}" "${choiceId}")
buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/Extra/modules"
buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/EXTRAROOTDIR/Extra/modules"
# Add the klibc package because the uClibc module is dependent of klibc module
addChoice --group="Module" --start-selected="false" --pkg-refs="$packageRefId $klibcPackageRefId" "${choiceId}"
# End build uClibc package module
InstallTheme
packageRefId=$(getPackageRefId "${packagesidentity}" "${themeName}")
buildpackage "$packageRefId" "${themeName}" "${PKG_BUILD_DIR}/${themeName}" "/Extra/Themes"
buildpackage "$packageRefId" "${themeName}" "${PKG_BUILD_DIR}/${themeName}" "/EXTRAROOTDIR/Extra/Themes"
addChoice --group="Themes" --start-selected="false" --pkg-refs="$packageRefId" "${themeName}"
done
# End build theme packages# End build Extras package
# build pre install package
echo "================= Pre ================="
# build standard package
echo "================ standard ================"
packagesidentity="${chameleon_package_identity}"
choiceId="Pre"
choiceId="Standard"
mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Root
mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Scripts/Resources
local yamlFile="Resources/chameleon_options.yaml"
addTemplateScripts --pkg-rootdir="${PKG_BUILD_DIR}/${choiceId}" \
--subst="YAML_FILE=${yamlFile}" CleanOptions
generate_options_yaml_file "${PKG_BUILD_DIR}/${choiceId}/Scripts/$yamlFile"
cp -f ${PKGROOT}/Scripts/Main/${choiceId}postinstall ${PKG_BUILD_DIR}/${choiceId}/Scripts/postinstall
ditto --arch i386 `which SetFile` ${PKG_BUILD_DIR}/${choiceId}/Scripts/Resources/SetFile
packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}")
buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/"
addChoice --group="Chameleon" --start-selected="true" --selected="!choices['EFI'].selected" \
--pkg-refs="$packageRefId" "${choiceId}"
# End build standard package
# build efi package
echo "================== EFI =================="
packagesidentity="${chameleon_package_identity}"
choiceId="EFI"
mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Root
mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Scripts/Resources
local yamlFile="Resources/chameleon_options.yaml"
addTemplateScripts --pkg-rootdir="${PKG_BUILD_DIR}/${choiceId}" \
--subst="YAML_FILE=${yamlFile}" ${choiceId}
--subst="YAML_FILE=${yamlFile}" CleanOptions
generate_options_yaml_file "${PKG_BUILD_DIR}/${choiceId}/Scripts/$yamlFile"
cp -f ${PKGROOT}/Scripts/Main/ESPpostinstall ${PKG_BUILD_DIR}/${choiceId}/Scripts/postinstall
ditto --arch i386 `which SetFile` ${PKG_BUILD_DIR}/${choiceId}/Scripts/Resources/SetFile
packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}")
buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/"
addChoice --group="Chameleon" --enabled="systemHasGPT()" --start-selected="false" \
--selected="!choices['Standard'].selected" \
--pkg-refs="$packageRefId" "${choiceId}"
# End build efi package
# build pre install package
echo "================= Pre ================="
packagesidentity="${chameleon_package_identity}"
choiceId="Pre"
packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}")
mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Root
addTemplateScripts --pkg-rootdir="${PKG_BUILD_DIR}/${choiceId}" ${choiceId}
buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/"
# End build pre install package
# build post install package
choiceId="Post"
mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Root
addTemplateScripts --pkg-rootdir="${PKG_BUILD_DIR}/${choiceId}" ${choiceId}
cp -f ${PKGROOT}/Scripts/Sub/UnMountEFIvolumes.sh ${PKG_BUILD_DIR}/${choiceId}/Scripts
packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}")
buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/"
}
generateChoices() {
for (( idx=1; idx < ${#choice_key[*]} ; idx++)); do
local choiceId=${choice_key[$idx]}
local choiceOptions=${choice_options[$idx]}
local start_indent_level=2
echo -e "\n\t<choices-outline>" >> "${PKG_BUILD_DIR}/${packagename}/Distribution"
for main_choice in ${choice_group_items[0]};do
generateOutlineChoices $main_choice $start_indent_level >> "${PKG_BUILD_DIR}/${packagename}/Distribution"
done
trunk/package/po/mk.po
609609
610610
611611
612
612
613613
614614
615615
......
621621
622622
623623
624
624
625625
626626
627627
......
631631
632632
633633
634
635
634
636635
637
636
638637
639638
640639
......
644643
645644
646645
647
648
646
649647
650
648
651649
652650
653651
#: Resources/templates/Localizable.strings:126
#, no-wrap
msgid "PrivateData=No"
msgstr ""
msgstr "PrivateData=No"
#. type: "PrivateData_description"
#: Resources/templates/Localizable.strings:127
#: Resources/templates/Localizable.strings:131
#, no-wrap
msgid "USBBusFix=Yes"
msgstr ""
msgstr "USBBusFix=Yes"
#. type: "USBBusFix_description"
#: Resources/templates/Localizable.strings:132
#. type: "USBLegacyOff_title"
#: Resources/templates/Localizable.strings:134
#, fuzzy, no-wrap
#| msgid "LegacyLogo=Yes"
#, no-wrap
msgid "USBLegacyOff=Yes"
msgstr "LegacyLogo=Yes"
msgstr "USBLegacyOff=Yes"
#. type: "USBLegacyOff_description"
#: Resources/templates/Localizable.strings:135
#. type: "XHCILegacyOff_title"
#: Resources/templates/Localizable.strings:137
#, fuzzy, no-wrap
#| msgid "LegacyLogo=Yes"
#, no-wrap
msgid "XHCILegacyOff=Yes"
msgstr "LegacyLogo=Yes"
msgstr "XHCILegacyOff=Yes"
#. type: "XHCILegacyOff_description"
#: Resources/templates/Localizable.strings:138
trunk/package/po/nl.po
628628
629629
630630
631
631
632632
633633
634634
......
640640
641641
642642
643
643
644644
645645
646646
......
650650
651651
652652
653
654
653
655654
656
655
657656
658657
659658
......
663662
664663
665664
666
667
665
668666
669
667
670668
671669
672670
#: Resources/templates/Localizable.strings:126
#, no-wrap
msgid "PrivateData=No"
msgstr ""
msgstr "PrivateData=No"
#. type: "PrivateData_description"
#: Resources/templates/Localizable.strings:127
#: Resources/templates/Localizable.strings:131
#, no-wrap
msgid "USBBusFix=Yes"
msgstr ""
msgstr "USBBusFix=Yes"
#. type: "USBBusFix_description"
#: Resources/templates/Localizable.strings:132
#. type: "USBLegacyOff_title"
#: Resources/templates/Localizable.strings:134
#, fuzzy, no-wrap
#| msgid "LegacyLogo=Yes"
#, no-wrap
msgid "USBLegacyOff=Yes"
msgstr "LegacyLogo=Yes"
msgstr "USBLegacyOff=Yes"
#. type: "USBLegacyOff_description"
#: Resources/templates/Localizable.strings:135
#. type: "XHCILegacyOff_title"
#: Resources/templates/Localizable.strings:137
#, fuzzy, no-wrap
#| msgid "LegacyLogo=Yes"
#, no-wrap
msgid "XHCILegacyOff=Yes"
msgstr "LegacyLogo=Yes"
msgstr "XHCILegacyOff=Yes"
#. type: "XHCILegacyOff_description"
#: Resources/templates/Localizable.strings:138
trunk/package/po/hr.po
610610
611611
612612
613
613
614614
615615
616616
......
622622
623623
624624
625
625
626626
627627
628628
......
632632
633633
634634
635
636
635
637636
638
637
639638
640639
641640
......
645644
646645
647646
648
649
647
650648
651
649
652650
653651
654652
#: Resources/templates/Localizable.strings:126
#, no-wrap
msgid "PrivateData=No"
msgstr ""
msgstr "PrivateData=No"
#. type: "PrivateData_description"
#: Resources/templates/Localizable.strings:127
#: Resources/templates/Localizable.strings:131
#, no-wrap
msgid "USBBusFix=Yes"
msgstr ""
msgstr "USBBusFix=Yes"
#. type: "USBBusFix_description"
#: Resources/templates/Localizable.strings:132
#. type: "USBLegacyOff_title"
#: Resources/templates/Localizable.strings:134
#, fuzzy, no-wrap
#| msgid "LegacyLogo=Yes"
#, no-wrap
msgid "USBLegacyOff=Yes"
msgstr "LegacyLogo=Yes"
msgstr "USBLegacyOff=Yes"
#. type: "USBLegacyOff_description"
#: Resources/templates/Localizable.strings:135
#. type: "XHCILegacyOff_title"
#: Resources/templates/Localizable.strings:137
#, fuzzy, no-wrap
#| msgid "LegacyLogo=Yes"
#, no-wrap
msgid "XHCILegacyOff=Yes"
msgstr "LegacyLogo=Yes"
msgstr "XHCILegacyOff=Yes"
#. type: "XHCILegacyOff_description"
#: Resources/templates/Localizable.strings:138
trunk/package/po/pl.po
614614
615615
616616
617
617
618618
619619
620620
......
626626
627627
628628
629
629
630630
631631
632632
......
636636
637637
638638
639
640
639
641640
642
641
643642
644643
645644
......
649648
650649
651650
652
653
651
654652
655
653
656654
657655
658656
#: Resources/templates/Localizable.strings:126
#, no-wrap
msgid "PrivateData=No"
msgstr ""
msgstr "PrivateData=No"
#. type: "PrivateData_description"
#: Resources/templates/Localizable.strings:127
#: Resources/templates/Localizable.strings:131
#, no-wrap
msgid "USBBusFix=Yes"
msgstr ""
msgstr "USBBusFix=Yes"
#. type: "USBBusFix_description"
#: Resources/templates/Localizable.strings:132
#. type: "USBLegacyOff_title"
#: Resources/templates/Localizable.strings:134
#, fuzzy, no-wrap
#| msgid "LegacyLogo=Yes"
#, no-wrap
msgid "USBLegacyOff=Yes"
msgstr "LegacyLogo=Yes"
msgstr "USBLegacyOff=Yes"
#. type: "USBLegacyOff_description"
#: Resources/templates/Localizable.strings:135
#. type: "XHCILegacyOff_title"
#: Resources/templates/Localizable.strings:137
#, fuzzy, no-wrap
#| msgid "LegacyLogo=Yes"
#, no-wrap
msgid "XHCILegacyOff=Yes"
msgstr "LegacyLogo=Yes"
msgstr "XHCILegacyOff=Yes"
#. type: "XHCILegacyOff_description"
#: Resources/templates/Localizable.strings:138
trunk/package/po/hu.po
603603
604604
605605
606
606
607607
608608
609609
......
615615
616616
617617
618
618
619619
620620
621621
......
625625
626626
627627
628
629
628
630629
631
630
632631
633632
634633
......
638637
639638
640639
641
642
640
643641
644
642
645643
646644
647645
#: Resources/templates/Localizable.strings:126
#, no-wrap
msgid "PrivateData=No"
msgstr ""
msgstr "PrivateData=No"
#. type: "PrivateData_description"
#: Resources/templates/Localizable.strings:127
#: Resources/templates/Localizable.strings:131
#, no-wrap
msgid "USBBusFix=Yes"
msgstr ""
msgstr "USBBusFix=Yes"
#. type: "USBBusFix_description"
#: Resources/templates/Localizable.strings:132
#. type: "USBLegacyOff_title"
#: Resources/templates/Localizable.strings:134
#, fuzzy, no-wrap
#| msgid "LegacyLogo=Yes"
#, no-wrap
msgid "USBLegacyOff=Yes"
msgstr "LegacyLogo=Yes"
msgstr "USBLegacyOff=Yes"
#. type: "USBLegacyOff_description"
#: Resources/templates/Localizable.strings:135
#. type: "XHCILegacyOff_title"
#: Resources/templates/Localizable.strings:137
#, fuzzy, no-wrap
#| msgid "LegacyLogo=Yes"
#, no-wrap
msgid "XHCILegacyOff=Yes"
msgstr "LegacyLogo=Yes"
msgstr "XHCILegacyOff=Yes"
#. type: "XHCILegacyOff_description"
#: Resources/templates/Localizable.strings:138
trunk/package/po/ca.po
612612
613613
614614
615
615
616616
617617
618618
......
624624
625625
626626
627
627
628628
629629
630630
......
634634
635635
636636
637
638
637
639638
640
639
641640
642641
643642
......
647646
648647
649648
650
651
649
652650
653
651
654652
655653
656654
#: Resources/templates/Localizable.strings:126
#, no-wrap
msgid "PrivateData=No"
msgstr ""
msgstr "PrivateData=No"
#. type: "PrivateData_description"
#: Resources/templates/Localizable.strings:127
#: Resources/templates/Localizable.strings:131
#, no-wrap
msgid "USBBusFix=Yes"
msgstr ""
msgstr "USBBusFix=Yes"
#. type: "USBBusFix_description"
#: Resources/templates/Localizable.strings:132
#. type: "USBLegacyOff_title"
#: Resources/templates/Localizable.strings:134
#, fuzzy, no-wrap
#| msgid "LegacyLogo=Yes"
#, no-wrap
msgid "USBLegacyOff=Yes"
msgstr "LegacyLogo=Yes"
msgstr "USBLegacyOff=Yes"
#. type: "USBLegacyOff_description"
#: Resources/templates/Localizable.strings:135
#. type: "XHCILegacyOff_title"
#: Resources/templates/Localizable.strings:137
#, fuzzy, no-wrap
#| msgid "LegacyLogo=Yes"
#, no-wrap
msgid "XHCILegacyOff=Yes"
msgstr "LegacyLogo=Yes"
msgstr "XHCILegacyOff=Yes"
#. type: "XHCILegacyOff_description"
#: Resources/templates/Localizable.strings:138
trunk/package/po/sr.po
608608
609609
610610
611
611
612612
613613
614614
......
620620
621621
622622
623
623
624624
625625
626626
......
630630
631631
632632
633
634
633
635634
636
635
637636
638637
639638
......
643642
644643
645644
646
647
645
648646
649
647
650648
651649
652650
#: Resources/templates/Localizable.strings:126
#, no-wrap
msgid "PrivateData=No"
msgstr ""
msgstr "PrivateData=No"
#. type: "PrivateData_description"
#: Resources/templates/Localizable.strings:127
#: Resources/templates/Localizable.strings:131
#, no-wrap
msgid "USBBusFix=Yes"
msgstr ""
msgstr "USBBusFix=Yes"
#. type: "USBBusFix_description"
#: Resources/templates/Localizable.strings:132
#. type: "USBLegacyOff_title"
#: Resources/templates/Localizable.strings:134
#, fuzzy, no-wrap
#| msgid "LegacyLogo=Yes"
#, no-wrap
msgid "USBLegacyOff=Yes"
msgstr "LegacyLogo=Yes"
msgstr "USBLegacyOff=Yes"
#. type: "USBLegacyOff_description"
#: Resources/templates/Localizable.strings:135
#. type: "XHCILegacyOff_title"
#: Resources/templates/Localizable.strings:137
#, fuzzy, no-wrap
#| msgid "LegacyLogo=Yes"
#, no-wrap
msgid "XHCILegacyOff=Yes"
msgstr "LegacyLogo=Yes"
msgstr "XHCILegacyOff=Yes"
#. type: "XHCILegacyOff_description"
#: Resources/templates/Localizable.strings:138

Archive Download the corresponding diff file

Revision: 2569