mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-12-05 13:33:33 +01:00
138 lines
3.8 KiB
Plaintext
138 lines
3.8 KiB
Plaintext
|
<?xml version="1.0"?>
|
||
|
|
||
|
<installer-gui-script minSpecVersion='1'>
|
||
|
|
||
|
<options hostArchitectures='i386' allow-external-scripts='true'/>
|
||
|
<domains enable_anywhere="true"/>
|
||
|
|
||
|
<welcome file='Welcome.html'/>
|
||
|
<!-- license file="License.rtf" sla="EA0401" -->
|
||
|
<readme file='Description.html'/>
|
||
|
<conclusion file="Conclusion.html"/>
|
||
|
<background file='background.tiff' alignment='topleft' scaling='proportional'/>
|
||
|
<background-darkAqua file="background.tiff" alignment='topleft' scaling="proportional"/>
|
||
|
|
||
|
<title>Clover %CLOVERVERSION% r%CLOVERREVISION% EFI bootloader</title>
|
||
|
|
||
|
<script>
|
||
|
|
||
|
function installCheckScript()
|
||
|
{
|
||
|
var obj = system.ioregistry.matchingClass("AppleSMC");
|
||
|
if (obj) {
|
||
|
system.log('installCheckScript: Found AppleSMC');
|
||
|
my.result.message = system.localizedStringWithFormat('Intel_Mac_message');
|
||
|
my.result.type = 'Fatal';
|
||
|
return false;
|
||
|
}
|
||
|
system.log('installCheckScript: Passed.');
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
function volCheckScript()
|
||
|
{
|
||
|
system.log('volCheckScript: Passed.');
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
function upgrade_allowed(){
|
||
|
var upgradable = true;
|
||
|
var upgradeAction = my.choice.packageUpgradeAction;
|
||
|
|
||
|
if((upgradeAction == "downgrade") || (upgradeAction == "mixed")){
|
||
|
my.choice.tooltip = system.localizedString('Newer_Package_Installed_message');
|
||
|
upgradable = false;
|
||
|
}
|
||
|
|
||
|
return upgradable;
|
||
|
}
|
||
|
|
||
|
function systemHasGPT(){
|
||
|
var obj = system.ioregistry.matchingName("EFI System Partition");
|
||
|
if (obj)
|
||
|
return true;
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
function checkFileExists(file){
|
||
|
if (my.target) {
|
||
|
return system.files.fileExistsAtPath(my.target.mountpoint + file)
|
||
|
}
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
function cloverPackageFirstRun(){
|
||
|
var installer_plist = '/Library/Preferences/com.projectosx.clover.installer.plist';
|
||
|
if (checkFileExists(my.target.mountpoint + installer_plist)) {
|
||
|
return false;
|
||
|
}
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
function choicePreviouslySelected(option) {
|
||
|
var installer_plist = '/Library/Preferences/com.projectosx.clover.installer.plist';
|
||
|
if (checkFileExists(installer_plist)) {
|
||
|
dict = system.files.plistAtPath(my.target.mountpoint + installer_plist);
|
||
|
return dict[option] == undefined ? false : dict[option];
|
||
|
}
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
function checkBootFromUEFI() {
|
||
|
var classObjects = system.ioregistry.matchingName('efi','IODeviceTree');
|
||
|
if (classObjects) {
|
||
|
for(var i = 0; i < classObjects.length; i++) {
|
||
|
var obj = classObjects[i];
|
||
|
if ( obj.hasOwnProperty("firmware-vendor") != true)
|
||
|
continue;
|
||
|
if (obj["firmware-vendor"].toString() == 'C,L,O,V,E,R') {
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
function checkFileSystemIsWritable()
|
||
|
{
|
||
|
var writable = true;
|
||
|
var cmd = '[[ yes == $(diskutil info / | grep -i \'read-only volume:\' | awk \'{print $NF}\' | tr \'[:upper:]\' \'[:lower:]\') ]]'
|
||
|
r = system.run('/bin/bash', '-c', cmd);
|
||
|
system.log('checkFileSystemIsWritable diskutil result = ' + r);
|
||
|
|
||
|
writable = (r != 0);
|
||
|
|
||
|
if (writable) {
|
||
|
system.log('checkFileSystemIsWritable: file system is writable: Passed');
|
||
|
} else {
|
||
|
system.log('checkFileSystemIsWritable: root file system is read only, try to make it RW...');
|
||
|
var cmd2 = '/usr/bin/osascript -e\''
|
||
|
cmd2 += 'do shell script "mount -uw /'
|
||
|
cmd2 += '" with prompt '
|
||
|
cmd2 += '"' + system.localizedString('MakingRootRW') + '"'
|
||
|
cmd2 += ' with administrator privileges\''
|
||
|
|
||
|
try
|
||
|
{
|
||
|
r2 = system.run('/bin/bash', '-c', cmd2);
|
||
|
writable = (r2 == 0);
|
||
|
if (writable) {
|
||
|
system.log('mount -uw / succeded.');
|
||
|
}
|
||
|
} catch (e) {
|
||
|
system.log('mount -uw / returned with error: ' + e);
|
||
|
writable = false;
|
||
|
}
|
||
|
|
||
|
if (writable == false) {
|
||
|
my.result.message = system.localizedString('GoToFailRootRW');
|
||
|
my.result.type = 'Fatal';
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return writable;
|
||
|
}
|
||
|
|
||
|
</script>
|
||
|
<installation-check script="checkFileSystemIsWritable()"/>
|