Index: branches/ErmaC/Trunk/i386/libsaio/ati.c =================================================================== --- branches/ErmaC/Trunk/i386/libsaio/ati.c (revision 1650) +++ branches/ErmaC/Trunk/i386/libsaio/ati.c (revision 1651) @@ -556,21 +556,21 @@ { 0x6718, 0x31301682, CHIP_FAMILY_CAYMAN, "AMD Radeon HD 6970", kNull }, { 0x6720, 0x04BA1028, CHIP_FAMILY_CAYMAN, "AMD Radeon HD 6970m", kElodea }, // ErmaC no tested - + { 0x6738, 0x00D01002, CHIP_FAMILY_BARTS, "AMD Radeon HD 6870", kDuckweed }, { 0x6738, 0x21FA1002, CHIP_FAMILY_BARTS, "AMD Radeon HD 6870", kDuckweed }, { 0x6738, 0x67381002, CHIP_FAMILY_BARTS, "AMD Radeon HD 6870", kDuckweed }, { 0x6738, 0x21FA1458, CHIP_FAMILY_BARTS, "AMD Radeon HD 6870", kDuckweed }, - + { 0x6738, 0x31031682, CHIP_FAMILY_BARTS, "AMD Radeon HD 6870", kDuckweed }, { 0x6738, 0x31041682, CHIP_FAMILY_BARTS, "AMD Radeon HD 6870", kDuckweed }, - + { 0x6738, 0xE178174B, CHIP_FAMILY_BARTS, "AMD Radeon HD 6870", kDuckweed }, - + { 0x6738, 0x20101787, CHIP_FAMILY_BARTS, "AMD Radeon HD 6870", kDuckweed }, { 0x6738, 0x23051787, CHIP_FAMILY_BARTS, "AMD Radeon HD 6870", kDuckweed }, - + { 0x6739, 0x67391002, CHIP_FAMILY_BARTS, "AMD Radeon HD 6850", kDuckweed }, { 0x6739, 0x21F81458, CHIP_FAMILY_BARTS, "AMD Radeon HD 6850", kDuckweed }, @@ -578,35 +578,35 @@ { 0x6739, 0x24411462, CHIP_FAMILY_BARTS, "AMD Radeon HD 6850", kDuckweed }, { 0x6739, 0xE177174B, CHIP_FAMILY_BARTS, "AMD Radeon HD 6850", kDuckweed }, - + { 0x6740, 0x1657103C, CHIP_FAMILY_TURKS, "AMD Radeon HD 6770M", kNull }, { 0x6741, 0x04891025, CHIP_FAMILY_TURKS, "AMD Radeon HD 6650M", kNull }, // ErmaC no tested { 0x6741, 0x050E1025, CHIP_FAMILY_TURKS, "AMD Radeon HD 6650M", kNull }, { 0x6741, 0x05131025, CHIP_FAMILY_TURKS, "AMD Radeon HD 6650M", kNull }, { 0x6741, 0x1646103C, CHIP_FAMILY_TURKS, "AMD Radeon HD 6750M", kNull }, - { 0x6741, 0x9080104D, CHIP_FAMILY_TURKS, "AMD Radeon HD 6630M", kNull }, + { 0x6741, 0x9080104D, CHIP_FAMILY_TURKS, "AMD Radeon HD 6630M", kNull }, - { 0x6758, 0x67581002, CHIP_FAMILY_TURKS, "AMD Radeon HD 6670", kBulrushes }, - - { 0x6758, 0x22051458, CHIP_FAMILY_TURKS, "AMD Radeon HD 6670", kBulrushes }, + { 0x6758, 0x67581002, CHIP_FAMILY_TURKS, "AMD Radeon HD 6670", kBulrushes }, - { 0x6758, 0x31811682, CHIP_FAMILY_TURKS, "AMD Radeon HD 6670", kBulrushes }, - { 0x6758, 0x31831682, CHIP_FAMILY_TURKS, "AMD Radeon HD 6670", kBulrushes }, + { 0x6758, 0x22051458, CHIP_FAMILY_TURKS, "AMD Radeon HD 6670", kBulrushes }, - { 0x6758, 0xE1941746, CHIP_FAMILY_TURKS, "AMD Radeon HD 6670", kBulrushes }, - + { 0x6758, 0x31811682, CHIP_FAMILY_TURKS, "AMD Radeon HD 6670", kBulrushes }, + { 0x6758, 0x31831682, CHIP_FAMILY_TURKS, "AMD Radeon HD 6670", kBulrushes }, + + { 0x6758, 0xE1941746, CHIP_FAMILY_TURKS, "AMD Radeon HD 6670", kBulrushes }, + { 0x6759, 0xE193174B, CHIP_FAMILY_TURKS, "AMD Radeon HD 6570", kNull }, - { 0x6760, 0x04CC1028, CHIP_FAMILY_RV730, "AMD Radeon HD 6490M", kNull }, + { 0x6760, 0x04CC1028, CHIP_FAMILY_RV730, "AMD Radeon HD 6490M", kNull }, { 0x6760, 0x1CB21043, CHIP_FAMILY_RV730, "AMD Radeon HD 6470M", kNull }, { 0x6760, 0x167D103C, CHIP_FAMILY_CAICOS, "AMD Radeon HD 6470M", kNull }, // ErmaC no tested { 0x6760, 0x1656103C, CHIP_FAMILY_CAICOS, "AMD Radeon HD 6490M", kNull }, // ErmaC no tested - { 0x6779, 0x64501092, CHIP_FAMILY_CAICOS, "AMD Radeon HD 6450", kBulrushes }, - - { 0x6779, 0xE164174B, CHIP_FAMILY_CAICOS, "AMD Radeon HD 6450", kBulrushes }, - + { 0x6779, 0x64501092, CHIP_FAMILY_CAICOS, "AMD Radeon HD 6450", kBulrushes }, + + { 0x6779, 0xE164174B, CHIP_FAMILY_CAICOS, "AMD Radeon HD 6450", kBulrushes }, + /* standard/default models */ { 0x9400, 0x00000000, CHIP_FAMILY_R600, "ATI Radeon HD 2900 XT", kNull }, { 0x9405, 0x00000000, CHIP_FAMILY_R600, "ATI Radeon HD 2900 GT", kNull }, Index: branches/ErmaC/Trunk/i386/libsaio/fake_efi.c =================================================================== --- branches/ErmaC/Trunk/i386/libsaio/fake_efi.c (revision 1650) +++ branches/ErmaC/Trunk/i386/libsaio/fake_efi.c (revision 1651) @@ -434,11 +434,6 @@ static const char const SYSTEM_TYPE_PROP[] = "system-type"; static const char const MODEL_PROP[] = "Model"; static const char const BOARDID_PROP[] = "board-id"; -// Facetime fix from olegpronin @ insanelymac -// Breaks booting from RAID -static const char const BOOT_UUID_PROP[] = "boot-uuid"; -static char uuidStr[64]; -//Facetime fix end /* * Get an smbios option string option to convert to EFI_CHAR16 string @@ -607,21 +602,6 @@ // Fill /efi/device-properties node. setupDeviceProperties(node); - - // Facetime fix from olegpronin @ insanelymac - // Thanks to Lnx2Mac for the idea of using the key SkipFTFix=Yes as a temporary work around for this breaking RAID booting - bool skipFTFix=false; - getBoolForKey(kSkipFTFix, &skipFTFix, &bootInfo->chameleonConfig); - if (!skipFTFix) { - //Facetime temp fix start - Node *ChoosenNode; - if (gBootVolume->fs_getuuid && gBootVolume->fs_getuuid (gBootVolume, uuidStr) == 0) - { - ChoosenNode = DT__FindNode("/chosen", false); - DT__AddProperty(ChoosenNode, BOOT_UUID_PROP, 64, uuidStr); - } - //Facetime fix end - } } /* @@ -640,6 +620,21 @@ } /* + * Populate the chosen node + */ +void setupChosenNode() +{ + Node *chosenNode; + chosenNode = DT__FindNode("/chosen", false); + if (chosenNode == 0) + stop("Couldn't get chosen node"); + + int bootUUIDLength = strlen(gBootUUIDString); + if (bootUUIDLength) + DT__AddProperty(chosenNode, "boot-uuid", bootUUIDLength + 1, gBootUUIDString); +} + +/* * Load the smbios.plist override config file if any */ static void setupSmbiosConfigFile(const char *filename) @@ -703,6 +698,9 @@ gST64->Hdr.CRC32 = 0; gST64->Hdr.CRC32 = crc32(0L, gST64, gST64->Hdr.HeaderSize); } + + // Setup the chosen node + setupChosenNode(); } void saveOriginalSMBIOS(void) Index: branches/ErmaC/Trunk/i386/boot2/boot.c =================================================================== --- branches/ErmaC/Trunk/i386/boot2/boot.c (revision 1650) +++ branches/ErmaC/Trunk/i386/boot2/boot.c (revision 1651) @@ -72,7 +72,7 @@ static char gCacheNameAdler[64 + 256]; char *gPlatformName = gCacheNameAdler; -char gRootDevice[512]; +char gRootDevice[ROOT_DEVICE_SIZE]; char gMKextName[512]; char gMacOSVersion[8]; int bvCount = 0, gDeviceCount = 0; Index: branches/ErmaC/Trunk/i386/boot2/boot.h =================================================================== --- branches/ErmaC/Trunk/i386/boot2/boot.h (revision 1650) +++ branches/ErmaC/Trunk/i386/boot2/boot.h (revision 1651) @@ -101,7 +101,6 @@ #define kSMBIOSdefaults "SMBIOSdefaults" /* smbios_patcher.c */ #define kSystemID "SystemId" /* fake_efi.c */ #define kSystemType "SystemType" /* fake_efi.c */ -#define kSkipFTFix "SkipFTFix" /* fake_efi.c */ //For Work around to bypass olegpronin's Facetime fix #define kUseMemDetect "UseMemDetect" /* platform.c */ @@ -148,6 +147,7 @@ * A global set by boot() to record the device that the booter * was loaded from. */ +#define ROOT_DEVICE_SIZE 512 extern int gBIOSDev; extern long gBootMode; extern bool sysConfigValid; @@ -225,9 +225,11 @@ /* * options.c */ -extern int getBootOptions(bool firstRun); -extern int processBootOptions(); -extern int selectAlternateBootDevice(int bootdevice); +extern char gBootUUIDString[]; + +extern int getBootOptions(bool firstRun); +extern int processBootOptions(); +extern int selectAlternateBootDevice(int bootdevice); extern bool promptForRescanOption(void); void showHelp(); Index: branches/ErmaC/Trunk/i386/boot2/options.c =================================================================== --- branches/ErmaC/Trunk/i386/boot2/options.c (revision 1650) +++ branches/ErmaC/Trunk/i386/boot2/options.c (revision 1651) @@ -1063,6 +1063,7 @@ //========================================================================== +char gBootUUIDString[32+4+1] = ""; // UUID of the boot volume e.g. 5EB1869F-C4FA-3502-BDEB-3B8ED5D87292 extern unsigned char chainbootdev; extern unsigned char chainbootflag; @@ -1071,6 +1072,9 @@ int argLen = argName ? strlen(argName) : 0; int len = argLen + cnt + 1; // +1 to account for space + if (argName) + len++; // +1 to account for '=' + if (len > *cntRemainingP) { error("Warning: boot arguments too long, truncating\n"); return false; @@ -1081,8 +1085,8 @@ *argP += argLen; *argP[0] = '='; (*argP)++; - len++; // +1 to account for '=' } + strncpy( *argP, val, cnt ); *argP += cnt; *argP[0] = ' '; @@ -1102,7 +1106,8 @@ const char *configTable, char **argP, // Output value int *cntRemainingP, // Output count - char *foundVal // found value + char *foundVal, // found value + int foundValSize // max found value size ) { const char *val; @@ -1119,9 +1124,8 @@ copyArgument(argName, val, cnt, argP, cntRemainingP); found = true; } - if (found && foundVal) { - strlcpy(foundVal, val, cnt+1); - } + if (found && foundVal) + strlcpy(foundVal, val, foundValSize); return found; } @@ -1131,17 +1135,15 @@ int processBootOptions() { - const char * cp = gBootArgs; - const char * val = 0; - const char * kernel; - int cnt; - int userCnt; - int cntRemaining; - char * argP; - char uuidStr[64]; - bool uuidSet = false; - char * configKernelFlags; - char * valueBuffer; + const char *cp = gBootArgs; + const char *val = 0; + const char *kernel; + int cnt; + int userCnt; + int cntRemaining; + char *argP; + char *configKernelFlags; + char *valueBuffer; valueBuffer = malloc(VALUE_SIZE); @@ -1221,35 +1223,34 @@ configKernelFlags = malloc(cnt + 1); strlcpy(configKernelFlags, val, cnt + 1); - if (processBootArgument(kBootUUIDKey, cp, configKernelFlags, bootInfo->config, &argP, &cntRemaining, 0)) { - // boot-uuid was set either on the command-line - // or in the config file. - uuidSet = true; - } else { - + // boot-uuid can be set either on the command-line or in the config file + if (!processBootArgument(kBootUUIDKey, cp, configKernelFlags, bootInfo->config, + &argP, &cntRemaining, gBootUUIDString, sizeof(gBootUUIDString))) { // // Try an alternate method for getting the root UUID on boot helper partitions. // if (gBootVolume->flags & kBVFlagBooter) - { - if((loadHelperConfig(&bootInfo->helperConfig) == 0) - && getValueForKey(kHelperRootUUIDKey, &val, &cnt, &bootInfo->helperConfig) ) + { + // Load the configuration store in the boot helper partition + if (loadHelperConfig(&bootInfo->helperConfig) == 0) { - getValueForKey(kHelperRootUUIDKey, &val, &cnt, &bootInfo->helperConfig); - copyArgument(kBootUUIDKey, val, cnt, &argP, &cntRemaining); - uuidSet = true; - } + val = getStringForKey(kHelperRootUUIDKey, &bootInfo->helperConfig); + if (val != NULL) + strlcpy(gBootUUIDString, val, sizeof(gBootUUIDString)); + } } - if (!uuidSet && gBootVolume->fs_getuuid && gBootVolume->fs_getuuid (gBootVolume, uuidStr) == 0) { - verbose("Setting boot-uuid to: %s\n", uuidStr); - copyArgument(kBootUUIDKey, uuidStr, strlen(uuidStr), &argP, &cntRemaining); - uuidSet = true; - } + // Try to get the volume uuid string + if (!strlen(gBootUUIDString) && gBootVolume->fs_getuuid) + gBootVolume->fs_getuuid(gBootVolume, gBootUUIDString); - } + // If we have the volume uuid add it to the commandline arguments + if (strlen(gBootUUIDString)) + copyArgument(kBootUUIDKey, gBootUUIDString, strlen(gBootUUIDString), &argP, &cntRemaining); + } - if (!processBootArgument(kRootDeviceKey, cp, configKernelFlags, bootInfo->config, &argP, &cntRemaining, gRootDevice)) { + if (!processBootArgument(kRootDeviceKey, cp, configKernelFlags, bootInfo->config, + &argP, &cntRemaining, gRootDevice, ROOT_DEVICE_SIZE)) { cnt = 0; if ( getValueForKey( kBootDeviceKey, &val, &cnt, &bootInfo->chameleonConfig)) { valueBuffer[0] = '*'; @@ -1257,7 +1258,7 @@ strlcpy(valueBuffer + 1, val, cnt); val = valueBuffer; } else { - if (uuidSet) { + if (strlen(gBootUUIDString)) { val = "*uuid"; cnt = 5; } else { @@ -1276,7 +1277,8 @@ /* * Removed. We don't need this anymore. * - if (!processBootArgument(kPlatformKey, cp, configKernelFlags, bootInfo->config, &argP, &cntRemaining, gPlatformName)) { + if (!processBootArgument(kPlatformKey, cp, configKernelFlags, bootInfo->config, + &argP, &cntRemaining, gPlatformName, sizeof(gCacheNameAdler))) { getPlatformName(gPlatformName); copyArgument(kPlatformKey, gPlatformName, strlen(gPlatformName), &argP, &cntRemaining); } Index: branches/ErmaC/Trunk/package/Distribution =================================================================== --- branches/ErmaC/Trunk/package/Distribution (revision 1650) +++ branches/ErmaC/Trunk/package/Distribution (revision 1651) @@ -27,7 +27,7 @@ my.result.type = 'Fatal'; return false; } - system.log('installCheckScript: Passed.'); + system.log('installCheckScript: Failed.'); return false; } @@ -37,18 +37,6 @@ 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) Index: branches/ErmaC/Trunk/package/slimpkg.sh =================================================================== --- branches/ErmaC/Trunk/package/slimpkg.sh (revision 1650) +++ branches/ErmaC/Trunk/package/slimpkg.sh (revision 1651) @@ -3,11 +3,8 @@ # $1 Path to store built package packagesidentity="org.chameleon" - packagename="Chameleon" - pkgroot="${0%/*}" - chamTemp="usr/local/chamTemp" COL_BLACK="\x1b[30;01m" @@ -20,9 +17,8 @@ COL_BLUE="\x1b[34;01m" COL_RESET="\x1b[39;49;00m" -#version=$( grep I386BOOT_CHAMELEONVERSION vers.h | awk '{ print $3 }' | tr -d '\"' ) version=$( cat version ) -stage=${version##*-}" (.: ErmaC :. branch)" +stage=${version##*-} revision=$( grep I386BOOT_CHAMELEONREVISION vers.h | awk '{ print $3 }' | tr -d '\"' ) builddate=$( grep I386BOOT_BUILDDATE vers.h | awk '{ print $3,$4 }' | tr -d '\"' ) timestamp=$( date -j -f "%Y-%m-%d %H:%M:%S" "${builddate}" "+%s" ) @@ -57,10 +53,23 @@ outline[$((outlinecount++))]="${indent[$xmlindent]}" +# build pre install package + echo "================= Preinstall =================" + ((xmlindent++)) + packagesidentity="org.chameleon" + mkdir -p ${1}/Pre/Root + mkdir -p ${1}/Pre/Scripts + 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 + # build core package echo "================= Core =================" - ((xmlindent++)) - packagesidentity="org.chameleon.core" + packagesidentity="org.chameleon" mkdir -p ${1}/Core/Root/usr/local/bin mkdir -p ${1}/Core/Root/usr/standalone/i386 ditto --noextattr --noqtn ${1%/*}/i386/boot ${1}/Core/Root/usr/standalone/i386 @@ -77,44 +86,46 @@ local coresize=$( du -hkc "${1}/Core/Root" | tail -n1 | awk {'print $1'} ) echo " [BUILD] i386 " buildpackage "${1}/Core" "/" "0" "start_visible=\"false\" start_selected=\"true\"" >/dev/null 2>&1 +# End build core package # build Chameleon package echo "================= Chameleon =================" - outline[$((outlinecount++))]="${indent[$xmlindent]}\t" - choices[$((choicescount++))]="\n\n" - + outline[$((outlinecount++))]="${indent[$xmlindent]}" + choices[$((choicescount++))]="\t\n\t\n" + ((xmlindent++)) + # build standard package mkdir -p ${1}/Standard/Root mkdir -p ${1}/Standard/Scripts/Resources - cp -f ${pkgroot}/Scripts/Main/Standard/* ${1}/Standard/Scripts + 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 echo " [BUILD] Standard " - buildpackage "${1}/Standard" "/" "${coresize}" "start_enabled=\"true\" start_selected=\"upgrade_allowed()\" selected=\"exclusive(choices['EFI']) && exclusive(choices['noboot'])\"" >/dev/null 2>&1 + buildpackage "${1}/Standard" "/" "${coresize}" "start_enabled=\"true\" selected=\"exclusive(choices['EFI']) && exclusive(choices['noboot'])\"" >/dev/null 2>&1 # End build standard package # build efi package mkdir -p ${1}/EFI/Root mkdir -p ${1}/EFI/Scripts/Resources - cp -f ${pkgroot}/Scripts/Main/EFI/* ${1}/EFI/Scripts + 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 echo " [BUILD] EFI " - buildpackage "${1}/EFI" "/" "${coresize}" "start_visible=\"systemHasGPT()\" start_selected=\"false\" selected=\"exclusive(choices['Standard']) && exclusive(choices['noboot'])\"" >/dev/null 2>&1 + buildpackage "${1}/EFI" "/" "${coresize}" "start_visible=\"systemHasGPT()\" selected=\"exclusive(choices['Standard']) && exclusive(choices['noboot'])\"" >/dev/null 2>&1 # End build efi package # build reset choice package mkdir -p ${1}/noboot/Root echo " [BUILD] Reset choice " - buildpackage "${1}/noboot" "/$chamTemp" "" "start_visible=\"true\" start_selected=\"false\" selected=\"exclusive(choices['Standard']) && exclusive(choices['EFI'])\"" >/dev/null 2>&1 + buildpackage "${1}/noboot" "/$chamTemp" "" "selected=\"exclusive(choices['Standard']) && exclusive(choices['EFI'])\"" >/dev/null 2>&1 # End build reset choice package - - ((xmlindent--)) - outline[$((outlinecount++))]="${indent[$xmlindent]}\t" + + ((xmlindent--)) + outline[$((outlinecount++))]="${indent[$xmlindent]}" # End build Chameleon package # build Modules package @@ -129,8 +140,8 @@ ############################### if [ "$(ls -A "${1%/*}/i386/modules")" ]; then { - outline[$((outlinecount++))]="${indent[$xmlindent]}\t" - choices[$((choicescount++))]="\n\n" + outline[$((outlinecount++))]="${indent[$xmlindent]}" + choices[$((choicescount++))]="\t\n\t\n" ((xmlindent++)) packagesidentity="org.chameleon.modules" # - @@ -172,7 +183,7 @@ fi ((xmlindent--)) - outline[$((outlinecount++))]="${indent[$xmlindent]}\t" + outline[$((outlinecount++))]="${indent[$xmlindent]}" } else { @@ -183,19 +194,24 @@ # build post install package echo "================= Post =================" + packagesidentity="org.chameleon" mkdir -p ${1}/Post/Root mkdir -p ${1}/Post/Scripts - cp -f ${pkgroot}/Scripts/Main/Post/* ${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 " buildpackage "${1}/Post" "/" "" "start_visible=\"false\" start_selected=\"true\"" >/dev/null 2>&1 - outline[$((outlinecount++))]="${indent[$xmlindent]}" +# End build post install package +#((xmlindent--)) +outline[$((outlinecount++))]="${indent[$xmlindent]}" + # build meta package - makedistribution "${1}" "${2}" "${3}" "${4}" "${5}" + makedistribution "${1}" "${2}" "${3}" "${4}" #"${5}" # clean up @@ -269,13 +285,12 @@ popd >/dev/null - outline[$((outlinecount++))]="${indent[$xmlindent]}\t" + outline[$((outlinecount++))]="${indent[$xmlindent]}" if [ "${4}" ]; then - local choiceoptions="${indent[$xmlindent]}${4}\n" + local choiceoptions="\t\t${4}" fi - choices[$((choicescount++))]="\n\t#${packagename// /}.pkg\n\n" - + choices[$((choicescount++))]="\t\n\t\t#${packagename// /}.pkg\n\t\n" rm -R -f "${1}" fi } @@ -323,7 +338,7 @@ find "${1}/${packagename}" -name '.DS_Store' -delete pushd "${1}/${packagename}" >/dev/null - xar -c -f "${1%/*}/$packagename.pkg" --compression none . + xar -c -f "${1%/*}/${packagename// /}-${version}-r${revision}.pkg" --compression none . popd >/dev/null # Here is the place for assign a Icon to the pkg @@ -332,8 +347,8 @@ # ---- ditto -xk "${pkgroot}/Icons/pkg.zip" "${pkgroot}/Icons/" DeRez -only icns "${pkgroot}/Icons/Icons/pkg.icns" > tempicns.rsrc - Rez -append tempicns.rsrc -o "${1%/*}/$packagename.pkg" - SetFile -a C "${1%/*}/$packagename.pkg" + Rez -append tempicns.rsrc -o "${1%/*}/$packagename-${version}-r$revision.pkg" + SetFile -a C "${1%/*}/$packagename-${version}-r$revision.pkg" rm -f tempicns.rsrc rm -rf "${pkgroot}/Icons/Icons" # End @@ -355,5 +370,5 @@ } -main "${1}" "${2}" "${3}" "${4}" "${5}" +main "${1}" "${2}" "${3}" "${4}" #"${5}" Index: branches/ErmaC/Trunk/package/OptionalSettings/Resolution.txt =================================================================== --- branches/ErmaC/Trunk/package/OptionalSettings/Resolution.txt (revision 1650) +++ branches/ErmaC/Trunk/package/OptionalSettings/Resolution.txt (revision 1651) @@ -21,7 +21,7 @@ # B) User can select only one of the options from the list. # Set Exclusive=False for A, or Exclusive=True for B. # -Exclusive=False +Exclusive=True # --------------------------------------------- # Note: There must be a carriage return at end of last line # --------------------------------------------- Index: branches/ErmaC/Trunk/package/OptionalSettings/General.txt =================================================================== --- branches/ErmaC/Trunk/package/OptionalSettings/General.txt (revision 1650) +++ branches/ErmaC/Trunk/package/OptionalSettings/General.txt (revision 1651) @@ -34,5 +34,4 @@ UHCIreset:UHCIreset=Yes UseMemDetect:UseMemDetect=No UseKernelCache:UseKernelCache=Yes -Wake:Wake=Yes -SkipFTFix:SkipFTFix=Yes +Wake:Wake=Yes \ No newline at end of file Index: branches/ErmaC/Trunk/package/OptionalSettings/Control.txt =================================================================== --- branches/ErmaC/Trunk/package/OptionalSettings/Control.txt (revision 1650) +++ branches/ErmaC/Trunk/package/OptionalSettings/Control.txt (revision 1651) @@ -30,5 +30,5 @@ LegacyLogo:Legacy Logo=Yes InstantMenu:Instant Menu=Yes QuietBoot:QuietBoot=Yes -ShowInfo:ShowInfo=No +ShowInfo:ShowInfo=Yes Wait:Wait=Yes Index: branches/ErmaC/Trunk/package/Scripts/Main/ESPpostinstall =================================================================== --- branches/ErmaC/Trunk/package/Scripts/Main/ESPpostinstall (revision 0) +++ branches/ErmaC/Trunk/package/Scripts/Main/ESPpostinstall (revision 1651) @@ -0,0 +1,187 @@ +#!/bin/bash + +echo "===============================================" +echo "Main EFI System Partition Post-Install Script" +echo "*********************************************" +echo "-----------------------------------------------" +echo "" + +# 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 + +stage0Loader="boot0" +stage0LoaderDualBoot="boot0md" +stage1LoaderHFS="boot1h" +stage1LoaderFAT="boot1f32" +stage2Loader="boot" + +targetVolumeChosenByUser=$3 +targetDeviceChosenByUser=$( df "${targetVolumeChosenByUser}" | sed -n '2p' | awk '{print $1}' ) + +targetVolume="/Volumes/EFI" +targetDevice=${targetDeviceChosenByUser%s*}s1 +targetDeviceRaw=${targetDevice/disk/rdisk} +targetDisk=${targetDevice%s*} +targetDiskRaw=${targetDisk/disk/rdisk} +targetSlice=${targetDevice#*disk*s} + +targetResources="${targetVolumeChosenByUser}/usr/local/bin/" + +echo "===============================================" +echo "DEBUG: display script variables" +echo "***************************" + +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 "" + + +# 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}" + +# Check to see if the selected disk uses a GPT + +bootuuid=$( diskutil info "$targetDeviceChosenByUser" | grep Volume\ UUID | awk {'print $3'} ) +partitiontable=$( diskutil list ${targetDeviceChosenByUser%s*} | sed -n '3p' | awk '{print $2}' ) + +if [ ${partitiontable} = "GUID_partition_scheme" ]; then + echo "Confirm this is a GPT partitioned disk." + + # Double check we can see the selected partition and it's of the right type. + # If the following script finds anything, it returns 1 to indicate failure. + + + "$scriptDir"CheckProceed.sh "${targetVolume}" "${targetDeviceChosenByUser}" "${targetVolumeChosenByUser}" "${scriptDir}" + returnValue=$? + if [ ${returnValue} = 0 ]; then + # OK to proceed + + + # 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}" "${targetVolumeChosenByUser}" "${scriptDir}" + returnValue=$? + if [ ${returnValue} = 0 ]; then + # OK to proceed + + + # 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=$? + + + # 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}" "${targetVolumeChosenByUser}" "${scriptDir}" + diskupdate=$? + + + # check the format of the selected partition. + # result should be either hfs or msdos + # Should really check to make sure! + + 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}" "${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"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 Property changes on: branches/ErmaC/Trunk/package/Scripts/Main/ESPpostinstall ___________________________________________________________________ Added: svn:executable + * Index: branches/ErmaC/Trunk/package/Scripts/Main/postinstall =================================================================== --- branches/ErmaC/Trunk/package/Scripts/Main/postinstall (revision 0) +++ branches/ErmaC/Trunk/package/Scripts/Main/postinstall (revision 1651) @@ -0,0 +1,235 @@ +#!/bin/bash + +echo "===============================================" +echo "Post Post-Install Script" +echo "*********************************" +echo "-----------------------------------------------" +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 + +# Check target exists +if [ ! -e "$3" ] +then + echo "$3 volume does not exist!" + exit 1 +fi + +# clean up what would otherwise turn into "//" paths +if [ "$3" == "/" ] +then + dest_vol="" +else + dest_vol="$3" +fi + +# Find script location so to find the Install Log script. +MYLOCATION="${PWD}/${BASH_ARGV[0]}" +export MYLOCATION="${MYLOCATION%/*}" +scriptDir=$MYLOCATION + +# Has install log already been generated? +if [ ! -f "${dest_vol}"/.ChameleonLogFlag ]; then + # Write some information to the Install Log + versionNumber=`cat "${scriptDir}"/Resources/version` + revisionNumber=`cat "${scriptDir}"/Resources/revision` + "$scriptDir"InstallLog.sh "${dest_vol}" "Installer version: ${versionNumber} ${revisionNumber}" + "$scriptDir"InstallLog.sh "${dest_vol}" "Running Post postinstall script" + "$scriptDir"InstallLog.sh "${dest_vol}" "Target volume = ${dest_vol}" +else + "$scriptDir"InstallLog.sh "${dest_vol}" "Running Post postinstall script" +fi + +# set temporary directory +chamTemp="$dest_vol/usr/local/chamTemp" + +# Check for stopped installation due to Chameleon +# already existing on the same disk. +if [ ! -f "$dest_vol"/.ChameleonExists ]; then + + # --------------------------------------------- + # Add any installed modules to the Install Log + # --------------------------------------------- + if [ -e "${chamTemp}"/Extra/modules ]; then + ls "${chamTemp}"/Extra/modules | while read FILE + do + "$scriptDir"InstallLog.sh "${dest_vol}" "Installed module:$FILE" + done + fi + + # --------------------------------------------- + # Add any installed themes to the Install Log + # --------------------------------------------- + if [ -e "${chamTemp}"/Extra/Themes ]; then + ls "${chamTemp}"/Extra/Themes | while read FILE + do + "$scriptDir"InstallLog.sh "${dest_vol}" "Installed Theme:$FILE" + done + fi + + # --------------------------------------------- + # Build org.chameleon.Boot.plist + # --------------------------------------------- + # All options selected are now dummy files with + # the filename of the option and value residing + # in /usr/local/chamTemp/options/ + # for example. Boot Banner=Yes + + # Are there any options to build? + if [ "$(ls -A ${chamTemp}/options )" ]; then + + # Check for temporary directory/Extra folder. + if [ ! -d "$chamTemp"/Extra ]; then + mkdir "$chamTemp"/Extra + fi + + # Create template for org.chameleon.Boot.plist" + tempOCBP="$chamTemp"/Extra/org.chameleon.Boot.plist + cp "$4"/Library/Preferences/SystemConfiguration/com.apple.Boot.plist "$tempOCBP" + + # Read list of all boot options the user added. + arrayCount=0 + kernelFlagCount=0 + while read FILE + do + options[arrayCount]="${FILE##*/}" + + # Check keyRead for 'KF' at beginning to + # indicate that should be a kernel flag + if [ ${options[arrayCount]:0:2} = "KF" ];then + # plistbuddy only add's if the key doesn't already exist. + # So let's store any kernelflags and add them all at the + # same time once when we reach the end of the options list. + kernelflag[kernelFlagCount]="${options[arrayCount]##*flag=}" + "$scriptDir"InstallLog.sh "${dest_vol}" "Added kernel flag: ${kernelflag[kernelFlagCount]}" + (( kernelFlagCount++ )) + else + keyRead="${options[$arrayCount]%=*}" + value="${options[$arrayCount]#*=}" + # escape any spaces + keyToUse=$( echo $keyRead | sed 's/ /\\ /g' ) + if [ "${keyToUse}" != "DONT" ] && [ "${value}" != "ADD" ]; then + sudo /usr/libexec/plistbuddy -c "Add :${keyToUse} string ${value}" "$tempOCBP" + returnValue=$? + if [ ${returnValue} -ne 1 ]; then + "$scriptDir"InstallLog.sh "${dest_vol}" "Added boot option: ${keyRead}=${value}" + else + "$scriptDir"InstallLog.sh "${dest_vol}" "Can't add ${keyRead}=${value} as an option already exists for: ${keyRead}" + fi + fi + fi + (( arrayCount++ )) + done < <(ls "${chamTemp}"/options ) + + # If exclusive options were used and the 'None' option was chosen, + # then a dummy file named DONT=ADD would be in /$chamTemp/Extra/options. + # If that was the only option then the above code would have made a + # temporary Extra folder with a default org.chameleon.Boot.plist + # In this case we don't need it and should discard it otherwise the folder + # will be copied to the users / directory when it's not wanted. + if [ ${arrayCount} == 1 ] && [ "${keyToUse}" == "DONT" ] && [ "${value}" == "ADD" ]; then + if [ -e "${chamTemp}"/Extra ] && [ ! -e "${chamTemp}"/Extra/Themes ] && [ ! -e "${chamTemp}"/Extra/Modules ]; then + rm -r -f "$chamTemp"/Extra + fi + fi + + if [ $kernelFlagCount -gt 0 ]; then + # Add kernel flags + for (( i=0 ; i < $kernelFlagCount ; i++ )) + do + # Add any kernel flags together in to one string. + kernelFlagString="${kernelFlagString} ${kernelflag[i]}" + done + sudo /usr/libexec/plistbuddy -c "Add :Kernel\ Flags string $kernelFlagString" "$tempOCBP" + if [ ${returnValue}=1 ]; then # key already exists. + sudo /usr/libexec/plistbuddy -c "Delete :Kernel\ Flags" "$tempOCBP" + sudo /usr/libexec/plistbuddy -c "Add :Kernel\ Flags string $kernelFlagString" "$tempOCBP" + fi + fi + fi + + # --------------------------------------------- + # Copy temp Extra folder to target destination + # --------------------------------------------- + # If we've made a temporary Extra folder to use then + # check for an existing /Extra folder. If found, back it up + # before copying the temporary Extra folder to destination. + # Extra folder now resides in /usr/local/chamTemp/ + # Copy /usr/local/chamTemp/Extra to correct location. + + if [ -d "$chamTemp"/Extra ]; then + if [ ! -f "$dest_vol"/.ChameleonEFI ]; then + # The Standard install option chosen + + # Does an /Extra folder already exist? + if [ -e "$dest_vol"/Extra ]; then + "$scriptDir"InstallLog.sh "${dest_vol}" "Found existing $dest_vol/Extra folder. Renaming it $dest_vol/Extra-OLD-$( date "+%H-%M-%S" )" + mv "$dest_vol/Extra" "$dest_vol/Extra_OLD-"$( date "+%H-%M-%S" ) + fi + "$scriptDir"InstallLog.sh "${dest_vol}" "Writing folder: $dest_vol/Extra" + cp -R "$chamTemp"/Extra "$dest_vol" + else + # The EFI system partition install option was chosen + # Does a /Volumes/Extra folder already exist? + if [ -e "/Volumes/EFI/Extra" ]; then + "$scriptDir"InstallLog.sh "${dest_vol}" "Found existing /Volumes/EFI/Extra folder. Renaming it Extra-OLD-$( date "+%H-%M-%S" )" + mv "/Volumes/EFI/Extra" "/Volumes/EFI/Extra_OLD-"$( date "+%H-%M-%S" ) + fi + "$scriptDir"InstallLog.sh "${dest_vol}" "Writing folder: /Volumes/EFI/Extra" + cp -R "$chamTemp"/Extra "/Volumes/EFI" + fi + fi + + # Unmount ALL mounted volumes named EFI + "$scriptDir"UnMountEFIvolumes.sh "${dest_vol}" "${scriptDir}" +else + cleanUp="${cleanUp},0" + rm "$dest_vol"/.ChameleonExists +fi + +# --------------------------------------------- +# Cleanup +# --------------------------------------------- + +# remove any temporary boot sector files if they exist +if [ -d /tmp/newbs ]; then + cleanUp="${cleanUp},1a" + rm /tmp/newbs +fi +if [ -d /tmp/origbs ]; then + cleanUp="${cleanUp},1b" + rm /tmp/origbs +fi +if [ -d /tmp/newBootSector ]; then + cleanUp="${cleanUp},1c" + rm /tmp/newbs +fi +if [ -d /tmp/originalBootSector ]; then + cleanUp="${cleanUp},1d" + rm /tmp/origbs +fi + +# delete the temporary Chameleon folder +if [ -e "$chamTemp" ]; then + cleanUp="${cleanUp},2" + rm -rf "$chamTemp" +fi + +# Remove /.ChameleonEFI file +if [ -f "$dest_vol"/.ChameleonEFI ]; then + cleanUp="${cleanUp},3" + rm "$dest_vol"/.ChameleonEFI +fi + +"$scriptDir"InstallLog.sh "${dest_vol}" "Cleanup: ${cleanUp}" +"$scriptDir"InstallLog.sh "${dest_vol}" "LineBreak" +"$scriptDir"InstallLog.sh "${dest_vol}" "Post script complete" + +echo "===============================================" +echo "END - Post Post-Install Script" +echo "*********************************" +echo "-----------------------------------------------" +echo "" \ No newline at end of file Property changes on: branches/ErmaC/Trunk/package/Scripts/Main/postinstall ___________________________________________________________________ Added: svn:executable + * Index: branches/ErmaC/Trunk/package/Scripts/Main/Standardpostinstall =================================================================== --- branches/ErmaC/Trunk/package/Scripts/Main/Standardpostinstall (revision 0) +++ branches/ErmaC/Trunk/package/Scripts/Main/Standardpostinstall (revision 1651) @@ -0,0 +1,202 @@ +#!/bin/bash + +echo "===============================================" +echo "Main Standard Post-Install Script" +echo "*********************************" +echo "-----------------------------------------------" +echo "" + +# 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 + +stage0Loader="boot0" +stage0LoaderDualBoot="boot0md" +stage1LoaderHFS="boot1h" +stage1LoaderFAT="boot1f32" +stage2Loader="boot" + +targetVolume=$3 +targetDevice=$( df "${targetVolume}" | sed -n '2p' | awk '{print $1}' ) +targetDeviceRaw=${targetDevice/disk/rdisk} +targetDisk=${targetDevice%s*} +targetDiskRaw=${targetDisk/disk/rdisk} +targetSlice=${targetDevice#*disk*s} + +targetResources="${targetVolume}/usr/local/bin/" + +echo "===============================================" +echo "DEBUG: display script variables" +echo "*******************************" + +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 "" + + +# Write some information to the Install Log +"$scriptDir"InstallLog.sh "${targetVolume}" "Running Standard postinstall script" +"$scriptDir"InstallLog.sh "${targetVolume}" "Target volume = ${targetVolume} on ${targetDevice}" + +# Double check we can see the selected partition and it's of the right type. +# If the following script finds anything, it returns 1 to indicate failure. + +"$scriptDir"CheckProceed.sh "${targetVolume}" "${targetDevice}" "${targetVolume}" "${scriptDir}" +returnValue=$? +if [ ${returnValue} = 0 ]; then + # OK to proceed + + + # 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}" + returnValue=$? + if [ ${returnValue} = 0 ]; then + # OK to proceed + + + # 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=$? + + + # 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=$? + + + # check the format of the selected partition. + # result should be either hfs or msdos + # Should really check to make sure! + + targetFormat=$( fstyp "$targetDevice" ) + + + # 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 + + # 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 + + # Append a line break to the installer log + "$scriptDir"InstallLog.sh "${targetVolume}" "LineBreak" + + if [ ${diskupdate} = "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 + + # Write the stage 1 loader to the partition boot sector + "$scriptDir"WriteChameleonStage1.sh "${targetFormat}" "${stage1LoaderHFS}" "${stage1LoaderFAT}" "${3}" "${targetDeviceRaw}" "${targetVolume}" "${scriptDir}" + + # Write the stage 2 loader to the root of the selected partition + "$scriptDir"WriteChameleonStage2.sh "${stage2Loader}" "${3}" "${targetDevice}" "${targetVolume}" "${scriptDir}" + + + # Next we look to check for existing Chameleon installations. + # But as it will check /Volumes/EFI for the stage 2 loader, + # we need to make sure it's mounted. + + # Tell the user what's going on. + "$scriptDir"InstallLog.sh "${targetVolume}" "LineBreak" + "$scriptDir"InstallLog.sh "${targetVolume}" "About to check your disk for previous installations" + "$scriptDir"InstallLog.sh "${targetVolume}" "which involves checking the EFI system partition if" + "$scriptDir"InstallLog.sh "${targetVolume}" "appropriate for this disk." + + # Unmount ALL mounted volumes named EFI. + # Returns 0=success, 1=fail + + "$scriptDir"UnMountEFIvolumes.sh "${targetVolume}" "${scriptDir}" + returnValue=$? + if [ ${returnValue} = 0 ]; then + # OK to proceed + + if [ ${partitionScheme} = 1 ] || [ ${partitionScheme} = 2 ]; then + # Mount the EFI system partition + "$scriptDir"MountESP.sh "${targetDisk}" "${targetVolume}" "${scriptDir}" + fi + + # Check for another existing Chameleon installation on the same disk + "$scriptDir"CheckPreviousChameleon.sh "${targetDisk}" "${targetDeviceRaw}" "${targetDevice}" "${targetVolume}" "${scriptDir}" + fi + + # 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 +fi + +"$scriptDir"InstallLog.sh "${targetVolume}" "LineBreak" +"$scriptDir"InstallLog.sh "${targetVolume}" "Standard script complete" + +echo "===============================================" +echo "END - Standard Post-Install Script" +echo "*********************************" +echo "-----------------------------------------------" +echo "" + +exit 0 Property changes on: branches/ErmaC/Trunk/package/Scripts/Main/Standardpostinstall ___________________________________________________________________ Added: svn:executable + * Index: branches/ErmaC/Trunk/package/Scripts/Main/preinstall =================================================================== --- branches/ErmaC/Trunk/package/Scripts/Main/preinstall (revision 1650) +++ branches/ErmaC/Trunk/package/Scripts/Main/preinstall (revision 1651) @@ -6,8 +6,42 @@ echo "-----------------------------------------------" echo "" -# Place holder for maybe setting up install log here? +# Creates text file named 'Chameleon_Installer_Log.txt' +# at the root of the target volume. This is to help show the +# user why the installation process failed (even though the +# package installer ends reading 'Installation Successful'. + + +# 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 + +targetVolume=$3 + +logName="Chameleon_Installer_Log.txt" +logFile="${targetVolume}"/$logName + +versionNumber=`cat "${scriptDir}"/Resources/version` +revisionNumber=`cat "${scriptDir}"/Resources/revision` + + + +# Setup Chameleon_Installer_Log.txt file +# by writing header and diskutil list + +echo "Chameleon installer log - $( date ) +Installer version: ${versionNumber} ${revisionNumber} +======================================================" >"${logFile}" + +diskutil list >>"${logFile}" +echo "======================================================" >>"${logFile}" + + + echo "===============================================" echo "END - Pre-Install Script" echo "*********************************" Index: branches/ErmaC/Trunk/package/Scripts/Sub/CheckFormat.sh =================================================================== --- branches/ErmaC/Trunk/package/Scripts/Sub/CheckFormat.sh (revision 1650) +++ branches/ErmaC/Trunk/package/Scripts/Sub/CheckFormat.sh (revision 1651) @@ -1,43 +0,0 @@ -#!/bin/bash - -echo "===============================================" -echo "CheckFormat: Is target HFS or MSDOS?" -echo "**********************************************" - -# if the selected partition is formatted as HFS then exit with 1 -# if the selected partition is formatted as MSDOS then exit with 2 -# if fstyp doesn't return a value then exit with 0 - -# Receives targetDevice: for example, /dev/disk0s2 -# Receives targetVolume: Volume to install to. -# Receives scriptDir: The location of the main script dir. - - -if [ "$#" -eq 3 ]; then - targetDevice="$1" - targetVolume="$2" - scriptDir="$3" - echo "DEBUG: passed argument for targetDevice = $targetDevice" - echo "DEBUG: passed argument for targetVolume = $targetVolume" - echo "DEBUG: passed argument for scriptDir = $scriptDir" -else - echo "Error - wrong number of values passed" - exit 9 -fi - -if [ "$( fstyp "$targetDevice" | grep hfs )" ]; then - #echo "DEBUG: ${targetDevice} is currently formatted as HFS" - #"$scriptDir"InstallLog.sh "${targetVolume}" "${targetDevice} is currently formatted as HFS" - exit 1 - -fi -if [ "$( fstyp "$targetDevice" | grep msdos )" ]; then - #echo "DEBUG: ${targetDevice} is currently formatted as msdos" - #"$scriptDir"InstallLog.sh "${targetVolume}" "${targetDevice} is currently formatted as msdos" - exit 2 -fi - -#echo "DEBUG: WARNING: ${targetDevice} is currently not formatted as either HFS or msdos" -"$scriptDir"InstallLog.sh "${targetVolume}" "WARNING: ${targetDevice} is currently not formatted as either HFS or msdos" - -exit 0 Index: branches/ErmaC/Trunk/package/Scripts/Sub/CheckPreviousChameleon.sh =================================================================== --- branches/ErmaC/Trunk/package/Scripts/Sub/CheckPreviousChameleon.sh (revision 1650) +++ branches/ErmaC/Trunk/package/Scripts/Sub/CheckPreviousChameleon.sh (revision 1651) @@ -4,9 +4,13 @@ echo "Check Previous Chameleon: Will there be problems?" echo "***********************************************" -# Checks the selected volume is present and the disk is partitioned -# Now also check for another existing Chameleon installation on the same disk. +# Checks for another existing Chameleon installation on the same disk +# and tries to make sure the user doesn't end up with an un-bootable +# system due to having installed Chameleon previously elsewhere. +# Called from the Standard/postinstall and EFI/postinstall scripts +# /Volumes/EFI should already be mounted before this is called. + # Receives targetDisk: for example, /dev/disk3. # Receives targetDeviceRaw: for example, /dev/rdisk3s1. # Receives targetDevice: Stores device number, for example /dev/disk2s1. @@ -30,11 +34,11 @@ fi -# Check for existing Chameleon installations on a different -# partition of the same target disk. -#echo "DEBUG: Checking for existing Chameleon installations on ${targetDisk#/dev/}..." +# =============================================== +# Prepare some vars +# =============================================== +sliceNumber=$( echo ${targetDeviceRaw#*disk*s} ) -sliceNumber=$( echo ${targetDeviceRaw#*disk*s} ) # strip slice from end targetDiskRawNoSlice=$( echo ${targetDeviceRaw%$sliceNumber} ) @@ -42,102 +46,147 @@ # How many actual partitions are there? numSlices=$(( $( diskutil list | grep $( echo ${targetDisk#/dev/} ) | sed -n '$=' ) -2 )) -# Only check the disk for Chameleon installations if there is more than one partition. + +# =============================================== +# Checking the disk for existing Chameleon installations +# if there is more than one partition on the disk. +# =============================================== if [ $numSlices -gt 1 ]; then - + "$scriptDir"InstallLog.sh "${installerVolume}" "LineBreak" + "$scriptDir"InstallLog.sh "${installerVolume}" "Checking for previous chameleon installations on ${targetDisk#/dev/}" + + # Check the disk's MBR for existing stage 0 boot code (code from CheckDiskMicrocode.sh script) + stage0type=$( dd 2>/dev/null if="$targetDisk" count=3 bs=1 skip=105 | xxd | awk '{print $2$3}' ) + if [ "${stage0type}" == "0a803c" ] || [ "${stage0type}" == "ee7505" ] || [ "${stage0type}" == "742b80" ]; then + stage0type=2 + elif [ "${stage0type}" == "0b807c" ]; then + stage0type=1 + fi + #Scan all partitions for Chameleon code for (( i=1; i <= $numSlices; i++ )); do - stageExistence=0 - stage0FirstBootable=0 - previousExistence="NONE" + if [ $stage0type == 1 ] || [ $stage0type == 2 ]; then + stagesFound=1 + else + stagesFound=0 + fi + stage1Existence="NONE" + stage2Existence=0 targetDiskRaw=$targetDiskRawNoSlice$i - - # Check for existing stage 0 boot file (same code as CheckDiskMicrocode.sh script) - stage0type=$( dd 2>/dev/null if="$targetDisk" count=3 bs=1 skip=105 | xxd | awk '{print $2$3}' ) - if [ "${stage0type}" == "0b807c" ] || [ "${stage0type}" == "0a803c" ] || [ "${stage0type}" == "ee7505" ] || [ "${stage0type}" == "742b80" ]; then - #echo "DEBUG: boot0 found on $targetDisk" - (( stageExistence++ )) - - # While here, check just for either existing boot0hfs, boot0md or boot0md (dmazar's boot0workV2) - if [ "${stage0type}" == "0a803c" ] || [ "${stage0type}" == "ee7505" ] || [ "${stage0type}" == "742b80" ]; then - stage0FirstBootable=1 - fi - fi - + # Check for existence of a bootable partition boot sector containing either boot1h or boot1f32 boot1Search=$( dd 2>/dev/null if="$targetDiskRaw" count=1 | perl -ne '@a=split"";for(@a){printf"%02x",ord}' ) if [ "${boot1Search:0:16}" == "fa31c08ed0bcf0ff" ] && [ "${boot1Search:1020:2}" == "55" ]; then - #echo "DEBUG: boot1h found on "$targetDiskRaw - (( stageExistence++ )) - previousExistence="boot1" + (( stagesFound++ )) + stage1Existence="boot1h" elif [ "${boot1Search:0:4}" == "e962" ] && [ "${boot1Search:180:12}" == "424f4f542020" ] && [ "${boot1Search:1020:2}" == "55" ]; then - #echo "DEBUG: boot1f32 found on "$targetDiskRaw - (( stageExistence++ )) - previousExistence="boot1f32" + (( stagesFound++ )) + stage1Existence="boot1f32" fi - # Check for existing stage 2 boot file also - # NOTE: This will fail to find /boot on /Volumes/EFI as it won't be mounted! + # Check for existing stage 2 boot file. + # Include checking the EFI system partition if it exists and is mounted. if [ -e "$( df | grep ${targetDisk}s${i} | awk '{ print $6 }' )"/boot ]; then - #echo "DEBUG: boot found on $targetDiskRaw" - (( stageExistence++ )) + (( stagesFound++ )) + stage2Existence=1 fi - - #if [ $stageExistence == 3 ] && [ $i -ne $sliceNumber ]; then - #echo "DEBUG: STOP: There is already an existing Chameleon installation on $targetDiskRaw" - #"$scriptDir"InstallLog.sh "${installerVolume}" "STOP: There is already an existing Chameleon installation on $targetDiskRaw." - #"$scriptDir"InstallLog.sh "${installerVolume}" "NOTE: This is allowed and does work as long as you aren't dual booting Windows" - #"$scriptDir"InstallLog.sh "${installerVolume}" "NOTE: from the same disk and are happy to control which partition is used by" - #"$scriptDir"InstallLog.sh "${installerVolume}" "NOTE: flagging the required partition active. General use doesn't require two" - #"$scriptDir"InstallLog.sh "${installerVolume}" "NOTE: Chameleon installs on the same disk, though might be done by advanced users." - #"$scriptDir"InstallLog.sh "${installerVolume}" "NOTE: If you still want to do this then proceed by installing Chameleon manually." - #exit 1 - #fi - - if [ $stageExistence -ge 2 ] && [ "$previousExistence" != "NONE" ] && [ $i -ne $sliceNumber ]; then + + if [ $stagesFound -ge 2 ] && [ "$stage1Existence" != "NONE" ] && [ $i -ne $sliceNumber ]; then # There is previous Chameleon stage 1 code on a partition boot sector, # and either a complete or incomplete installation (ie. boot0 or boot are missing). - if [ $stageExistence == 3 ]; then - "$scriptDir"InstallLog.sh "${installerVolume}" "WARN: There is already an existing Chameleon installation on $targetDiskRaw." - else - "$scriptDir"InstallLog.sh "${installerVolume}" "NOTE: $previousExistence already exists at ${targetDisk}s${i}" + + if [ $stagesFound == 3 ] && [ $i -lt $sliceNumber ]; then + # Exisitng installation found which will still be default. + message="************************** TAKE NOTE ***************************** +**** There is an existing Chameleon installation on $targetDiskRaw +**** and that installation will still be the default loader as it's +**** on an earlier partition. If you want this new installation on +**** $installerVolume to be default then you will need to remove the +**** boot file from $targetDiskRaw and re-run this installer. +**************************************************************" + "$scriptDir"InstallLog.sh "${installerVolume}" "${message}" fi + if [ $stagesFound == 3 ] && [ $i -gt $sliceNumber ]; then + # Exisitng installation found which will no longer be default. + message="NOTE: There is an existing Chameleon installation on $targetDiskRaw +NOTE: but this installation on $targetDevice will be the default loader +NOTE: because you're installing to an earlier partition on the disk." + "$scriptDir"InstallLog.sh "${installerVolume}" "${message}" + fi - # This could prove problematic and result in either a b1f:error or boot0:error - # if the following conditions are true: + + # User could see a b1f:error or boot0:error if the following conditions are true: # A) Boot0hfs, Boot0md or Boot0md (dmazar's Boot0workV2) is being used. # B) The previous stage 1 code is on a lower partiton than the one being installed to now. + # C) boot is missing from that partition. + + if [ $stagesFound == 2 ] && [ $stage2Existence == 0 ]; then + # Exisitng boot0 and boot1 only found - missing boot + "$scriptDir"InstallLog.sh "${installerVolume}" "INFO: Found $stage1Existence installed to ${targetDisk}s${i}" + + # stage0type=2 is used to know if 'A' is true. + if [ $stage0type == 2 ]; then + # i = current slice we're checking, slicenumber = slice trying to install to. + if [ $i -lt $sliceNumber ]; then + "$scriptDir"InstallLog.sh "${installerVolume}" "WARN: Conditions point to the possibility of a boot failure" + + # Fix by making previous paritionboot sector un-bootable + # Change Byte 01FExh to 00 (510 decimal) + message="--- +FIX: Make ${targetDisk}s${i} boot sector un-bootable by changing byte 1FEh to 00. +NOTE: Any Extra folder you had there will still be there. If you want to use +NOTE: ${targetDisk}s${i} again as your boot partition then re-run this installer +NOTE: selecting it as the target, ONLY choosing the 'Chameleon Bootloader' option +NOTE: and NONE of the other options. +---" + "$scriptDir"InstallLog.sh "${installerVolume}" "${message}" - # stage0FirstBootable=1 is used to know if 'A' is true. - if [ $stage0FirstBootable == 1 ]; then - # i = current slice we're checking, slicenumber = slice trying to install to. - if [ $i -lt $sliceNumber ]; then - "$scriptDir"InstallLog.sh "${installerVolume}" "WARN: Conditions point to you receiving a boot failure" - # Fix by making previous paritionboot sector un-bootable - # Change Byte 01FExh to 00 (510 decimal) - "$scriptDir"InstallLog.sh "${installerVolume}" "---" - "$scriptDir"InstallLog.sh "${installerVolume}" "FIX: Make ${targetDisk}s${i} boot sector un-bootable by changing byte 1FEh to 00." - "$scriptDir"InstallLog.sh "${installerVolume}" "NOTE: Any Extra folder you had there will still be there. If you want to use" - "$scriptDir"InstallLog.sh "${installerVolume}" "NOTE: ${targetDisk}s${i} again as your boot partition then re-run this installer" - "$scriptDir"InstallLog.sh "${installerVolume}" "NOTE: selecting it as the target, ONLY choosing the 'Chameleon Bootloader' option" - "$scriptDir"InstallLog.sh "${installerVolume}" "NOTE: and NONE of the other options." - "$scriptDir"InstallLog.sh "${installerVolume}" "---" - dd if=${targetDisk}s${i} count=1 bs=512 of=/tmp/originalBootSector - cp /tmp/originalBootSector /tmp/newBootSector - dd if="$scriptDir/patch" of=/tmp/newBootSector bs=1 count=1 seek=510 conv=notrunc - dd if=/tmp/newBootSector of=${targetDisk}s${i} count=1 bs=512 - else - "$scriptDir"InstallLog.sh "${installerVolume}" "NOTE: but won't interfere as you're installing to an earlier partition." + # /Volumes/EFI needs unmounting before changing partition boot sector + if [ $i == 1 ]; then + umount /Volumes/EFI + else + diskutil unmount "${targetDisk}"s${i} + fi + + if [ "$( fstyp "${targetDisk}"s${i} | grep hfs )" ]; then + #echo "DEBUG: HFS - changing byte 1FEh to 00" + dd if=${targetDisk}s${i} count=2 bs=512 of=originalBootSector + cp originalBootSector newBootSector + dd if="patch" of=newBootSector bs=1 count=1 seek=510 conv=notrunc + dd if=newBootSector of=${targetDisk}s${i} count=2 bs=510 + fi + if [ "$( fstyp "${targetDisk}"s${i} | grep msdos )" ]; then + #echo "DEBUG: MSDOS - changing byte 1FEh to 00" + dd if=${targetDisk}s${i} count=1 bs=512 of=/tmp/originalBootSector + cp /tmp/originalBootSector /tmp/newBootSector + dd if="$scriptDir/patch" of=/tmp/newBootSector bs=1 count=1 seek=510 conv=notrunc + dd if=/tmp/newBootSector of=${targetDisk}s${i} count=1 bs=512 + fi + + # /Volumes/EFI needs re-mounting so EFI/postinstall script can use it. + # Don't check for a GPT as wouldn't have got here if it wasn't + if [ $i == 1 ]; then + "$scriptDir"MountESP.sh "${targetDisk}" "${installerVolume}" "${scriptDir}" + else + diskutil mount "${targetDisk}"s${i} + fi + + else + "$scriptDir"InstallLog.sh "${installerVolume}" "INFO: but won't interfere as you're installing to an earlier partition." + fi + elif [ $stage0type == 1 ]; then + # boot0 was found which looks for boot1 on the first active partition. + "$scriptDir"InstallLog.sh "${installerVolume}" "NOTE: so select to boot that partition (if used) with active flag." + #else + #echo "DEBUG: Boot0 not found" fi - else - "$scriptDir"InstallLog.sh "${installerVolume}" "NOTE: so select to boot that partition (if used) with active flag." fi fi + done - #else #echo "DEBUG: Just one slice" fi -exit 0 \ No newline at end of file +exit 0 Index: branches/ErmaC/Trunk/package/Scripts/Sub/InstallLog.sh =================================================================== --- branches/ErmaC/Trunk/package/Scripts/Sub/InstallLog.sh (revision 1650) +++ branches/ErmaC/Trunk/package/Scripts/Sub/InstallLog.sh (revision 1651) @@ -4,10 +4,8 @@ echo "InstallLog: Create/Append installation log" echo "**********************************************" -# Creates text file named 'Chameleon_Installer_Log.txt' -# at the root of the target volume. This is to help show the -# user why the installation process failed (even though the -# package installer ends reading 'Installation Successful'. +# Writes to the Chameleon_Installer_Log.txt file created +# by the preinstall script at the start of installation. # Receives two parameters # $1 = selected volume for location of the install log @@ -23,30 +21,14 @@ exit 9 fi + + logName="Chameleon_Installer_Log.txt" logFile="${logLocation}"/$logName -# On first run, create a file named .ChameleonLogFlag at -# the root of the target volume. Then check for this file -# on subsequent runs to know the initialisation sequence -# has been done. -if [ ! -f "${logLocation}"/.ChameleonLogFlag ]; then - # This is the first run, so setup - # Chameleon_Installer_Log.txt file - # by writing header. +if [ -f "${logFile}" ]; then - # Also include the first message that this script - # would be called with which will be version/revision - # of Chameleon package. - - echo "Chameleon installer log - $( date ) -${verboseText} -======================================================" >"${logFile}" - - # Create /.ChameleonLogFlag file. - echo "Log" >"${logLocation}"/.ChameleonLogFlag -else # Append messages to the log as passed by other scripts. if [ "${verboseText}" = "Diskutil" ]; then diskutil list >>"${logFile}" @@ -68,4 +50,4 @@ fi fi -exit 0 \ No newline at end of file +exit 0 Index: branches/ErmaC/Trunk/package/Scripts/Sub/MountESP.sh =================================================================== --- branches/ErmaC/Trunk/package/Scripts/Sub/MountESP.sh (revision 0) +++ branches/ErmaC/Trunk/package/Scripts/Sub/MountESP.sh (revision 1651) @@ -0,0 +1,42 @@ +#!/bin/bash + +echo "===============================================" +echo "MountESP: Mount the EFI system partition" +echo "***********************************************" + +# Creates a mountpoint and mounts /Volumes/EFI of the +# supplied disk which would have been pre-checked as using a GPT + +# Receives targetDisk: for example /dev/disk2. +# Receives installerVolume: Volume to write the installer log to. +# Receives scriptDir: The location of the main script dir. + +if [ "$#" -eq 3 ]; then + targetDisk="$1" + installerVolume="$2" + scriptDir="$3" + echo "DEBUG: passed argument for targetDisk = $targetDisk" + echo "DEBUG: passed argument for installerVolume = $installerVolume" + echo "DEBUG: passed argument for scriptDir = $scriptDir" +else + echo "Error - wrong number of values passed" + exit 9 +fi + + +# Does the mountpoint exist? +if [ ! -e "/Volumes/EFI" ]; then + mkdir -p "/Volumes/EFI" +fi + +# Mount '/Volumes/EFI' using the correct format type +if [ "$( fstyp "${targetDisk}"s1 | grep hfs )" ]; then + "$scriptDir"InstallLog.sh "${installerVolume}" "Mounting ${targetDisk}s1 as /Volumes/EFI" + mount_hfs "${targetDisk}"s1 "/Volumes/EFI" +fi +if [ "$( fstyp "${targetDisk}"s1 | grep msdos )" ]; then + "$scriptDir"InstallLog.sh "${installerVolume}" "Mounting ${targetDisk}s1 as /Volumes/EFI" + mount_msdos -u 0 -g 0 "${targetDisk}"s1 "/Volumes/EFI" +fi + +exit 0 \ No newline at end of file Property changes on: branches/ErmaC/Trunk/package/Scripts/Sub/MountESP.sh ___________________________________________________________________ Added: svn:executable + * Index: branches/ErmaC/Trunk/package/Scripts/Sub/WriteChameleonStage1.sh =================================================================== --- branches/ErmaC/Trunk/package/Scripts/Sub/WriteChameleonStage1.sh (revision 1650) +++ branches/ErmaC/Trunk/package/Scripts/Sub/WriteChameleonStage1.sh (revision 1651) @@ -6,7 +6,7 @@ # Writes Chameleon stage 1 loader. -# Receives espformat: 1 for HFS, 2 for MSDOS, 0 for unknown +# Receives targetFormat: either hfs or msdos # Receives stage1LoaderHFS: Name of file - boot1h # Receives stage1LoaderFAT: Name of file - boot1f32 # Receives selectedDestination: for example, /Volumes/USB @@ -15,14 +15,14 @@ # Receives scriptDir: The location of the main script dir. if [ "$#" -eq 7 ]; then - espformat="$1" + targetFormat="$1" stage1LoaderHFS="$2" stage1LoaderFAT="$3" selectedDestination="$4" targetDeviceRaw="$5" targetVolume="$6" scriptDir="$7" - echo "DEBUG: passed argument for espformat = $espformat" + echo "DEBUG: passed argument for targetFormat = $targetFormat" echo "DEBUG: passed argument for stage1LoaderHFS = $stage1LoaderHFS" echo "DEBUG: passed argument for stage1LoaderFAT = $stage1LoaderFAT" echo "DEBUG: passed argument for selectedDestination = $selectedDestination" @@ -34,8 +34,7 @@ exit 9 fi -if [ ${espformat} = "1" ]; then - # the selected partition is HFS formatted +if [ ${targetFormat} = "hfs" ]; then #echo "DEBUG: Executing command: dd if=${selectedDestination}/usr/standalone/i386/${stage1LoaderHFS} of=${targetDeviceRaw}" dd if="${selectedDestination}"/usr/standalone/i386/${stage1LoaderHFS} of=${targetDeviceRaw} @@ -43,8 +42,7 @@ "$scriptDir"InstallLog.sh "${targetVolume}" "Written ${stage1LoaderHFS} to ${targetDeviceRaw}." fi -if [ ${espformat} = "2" ]; then - # the selected partition FAT formatted +if [ ${targetFormat} = "msdos" ]; then #echo "DEBUG: Executing command: dd if=${targetDeviceRaw} count=1 bs=512 of=/tmp/origbs" dd if=${targetDeviceRaw} count=1 bs=512 of=/tmp/origbs Index: branches/ErmaC/Trunk/package/Scripts/Sub/WriteChameleonStage2.sh =================================================================== --- branches/ErmaC/Trunk/package/Scripts/Sub/WriteChameleonStage2.sh (revision 1650) +++ branches/ErmaC/Trunk/package/Scripts/Sub/WriteChameleonStage2.sh (revision 1651) @@ -4,9 +4,6 @@ echo "Write Chameleon Stage 2 Loader:" echo "*******************************" -# Writes Chameleon stage 2 loader. - -# Receives espformat: 1 for HFS, 2 for MSDOS, 0 for unknown # Receives stage2Loader: Name of file - boot # Receives selectedDestination: for example, /Volumes/ChameleonBootUSB (or /Volumes/EFI if ESP install). # Receives targetDevice: for example, /dev/disk3s1 @@ -14,14 +11,12 @@ # Receives scriptDir: The location of the main script dir. -if [ "$#" -eq 6 ]; then - espformat="$1" - stage2Loader="$2" - selectedDestination="$3" - targetDevice="$4" - targetVolume="$5" - scriptDir="$6" - echo "DEBUG: passed argument for espformat = $espformat" +if [ "$#" -eq 5 ]; then + stage2Loader="$1" + selectedDestination="$2" + targetDevice="$3" + targetVolume="$4" + scriptDir="$5" echo "DEBUG: passed argument for stage2Loader = $stage2Loader" echo "DEBUG: passed argument for selectedDestination = $selectedDestination" echo "DEBUG: passed argument for targetDevice = $targetDevice" @@ -34,31 +29,6 @@ # check to see if install to EFI system partition was selected if [ "${selectedDestination}" = "/Volumes/EFI" ]; then - #echo "DEBUG: EFI install chosen" - - if [ ! -e "${selectedDestination}" ]; then - #echo "DEBUG: Executing Command: mkdir -p ${selectedDestination}" - mkdir -p "${selectedDestination}" - #else - #echo "DEBUG: folder /Volumes/EFI already exists" - fi - - #if the EFI system partition was selected then - # mount '/Volumes/EFI' with the correct format type - - if [ ${espformat} = 1 ]; then - - #echo "Executing command: mount_hfs ${targetDevice} ${targetVolume}" - "$scriptDir"InstallLog.sh "${targetVolume}" "Mounting ${targetDevice} as ${selectedDestination}" - mount_hfs "${targetDevice}" "${selectedDestination}" - fi - if [ ${espformat} = 2 ]; then - [ -d "${selectedDestination}" ] || mkdir -p "${selectedDestination}" - #echo "Executing command: mount_msdos -u 0 -g 0 ${targetDevice} ${selectedDestination}" - "$scriptDir"InstallLog.sh "${targetVolume}" "Mounting ${targetDevice} as ${selectedDestination}" - mount_msdos -u 0 -g 0 "${targetDevice}" "${selectedDestination}" - fi - #echo "DEBUG: Executing command: cp "${targetVolume}"/usr/standalone/i386/${stage2Loader} ${selectedDestination}" cp "${targetVolume}"/usr/standalone/i386/"${stage2Loader}" "${selectedDestination}" "$scriptDir"InstallLog.sh "${targetVolume}" "Written boot to ${selectedDestination}." Index: branches/ErmaC/Trunk/package/Scripts/Sub/SetActivePartition.sh =================================================================== --- branches/ErmaC/Trunk/package/Scripts/Sub/SetActivePartition.sh (revision 1650) +++ branches/ErmaC/Trunk/package/Scripts/Sub/SetActivePartition.sh (revision 1651) @@ -6,22 +6,19 @@ # Sets partition active if Windows is not installed. -# Receives efiformat: code is 1 for HFS, 2 for MSDOS, 0 for unknown # Receives diskSigCheck: code is 1 for a Windows install, 0 for no Windows install # Receives targetDiskRaw: for example, /dev/rdisk1 # Receives targetSlice: for example, 1 # Receives targetVolume: Volume to install to. # Receives scriptDir: The location of the main script dir. -if [ "$#" -eq 6 ]; then - efiformat="$1" - diskSigCheck="$2" - targetDiskRaw="$3" - targetSlice="$4" - targetVolume="$5" - scriptDir="$6" +if [ "$#" -eq 5 ]; then + diskSigCheck="$1" + targetDiskRaw="$2" + targetSlice="$3" + targetVolume="$4" + scriptDir="$5" - echo "DEBUG: passed argument for efiformat = $efiformat" echo "DEBUG: passed argument for diskSigCheck = $diskSigCheck" echo "DEBUG: passed argument for targetDiskRaw = $targetDiskRaw" echo "DEBUG: passed argument for targetSlice = $targetSlice" Index: branches/ErmaC/Trunk/package/Scripts/Sub/UnMountEFIvolumes.sh =================================================================== --- branches/ErmaC/Trunk/package/Scripts/Sub/UnMountEFIvolumes.sh (revision 1650) +++ branches/ErmaC/Trunk/package/Scripts/Sub/UnMountEFIvolumes.sh (revision 1651) @@ -6,7 +6,7 @@ # loop through and un-mount ALL mounted 'EFI' system partitions - Thanks kizwan -# Receives targetVolumeChosenByUser: Stores original target if EFI install selected. +# Receives targetVolumeChosenByUser: To write install log to. # Receives scriptDir: The location of the main script dir. if [ "$#" -eq 2 ]; then @@ -23,14 +23,12 @@ # be unmounted in which case the loop would run forever. attempts=1 while [ "$( df | grep EFI )" ] && [ $attempts -lt 5 ]; do - #echo "DEBUG: Unmounting $( df | grep EFI | awk '{print $1}' )" - "$scriptDir"InstallLog.sh "${targetVolumeChosenByUser}" "Find and unmount any volume named 'EFI':" - "$scriptDir"InstallLog.sh "${targetVolumeChosenByUser}" "$( df | grep EFI | awk '{print $1}' )" + "$scriptDir"InstallLog.sh "${targetVolumeChosenByUser}" "Volume named 'EFI' is mounted..." + "$scriptDir"InstallLog.sh "${targetVolumeChosenByUser}" "Unmounting $( df | grep EFI | awk '{print $1}' )" umount -f $( df | grep EFI | awk '{print $1}' ) (( attempts++ )) done if [ $attempts = 5 ]; then - #echo "DEBUG: failed to unmount 'EFI' System Partition." "$scriptDir"InstallLog.sh "${targetVolumeChosenByUser}" "Failed to unmount 'EFI' System Partition." exit 1 fi Index: branches/ErmaC/Trunk/package/Resources/zh_TW.lproj/Localizable.strings =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/package/Resources/he.lproj/Localizable.strings =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/package/Resources/id.lproj/Localizable.strings =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/package/Resources/el.lproj/Localizable.strings =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/package/Resources/zh_CN.lproj/Localizable.strings =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/package/Resources/ar.lproj/Localizable.strings =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/package/Resources/en.lproj/Description.html =================================================================== --- branches/ErmaC/Trunk/package/Resources/en.lproj/Description.html (revision 1650) +++ branches/ErmaC/Trunk/package/Resources/en.lproj/Description.html (revision 1651) @@ -1,29 +1,45 @@ - + + + -

Chameleon is combination of various boot loader components.
It is based on David Elliott's fake EFI implementation added to Apple's boot-132 project.
Chameleon is extended with the following key features:

-
-

New features in Chameleon 2.0

-
-

- Fully customizable GUI to bring some color to the Darwin Bootloader.

-

- Booting retail DVDs by directly loading a ramdisk image without help of additional programs.

-

- Hibernation. Enjoy resuming your Mac OS X with a preview image.

-

- SMBIOS override to modify the factory SMBIOS values.

-

- DSDT override to use a modified fixed DSDT which can solve several issues.

-
-

- Device Property Injection via device-properties string.

-

- hybrid boot0 / boot1h for MBR and GPT partitioned disks.

-

- automatic FSB detection code even for recent AMD CPUs.

-

- Apple Software RAID support.

-
-

For detailed information, visit : http://chameleon.osx86.hu

+

Chameleon is a boot loader built using a combination of components which evolved from the development of David Elliott's fake EFI implementation added to Apple's boot-132 project.

+


+

Chameleon v2 is extended with many features. For example:

+


+

- Fully customizable GUI to bring some color to the Darwin Bootloader.

+

- Load a ramdisk to directly boot retail DVDs without additional programs.

+

- Hibernation. Enjoy resuming your Mac OS X with a preview image.

+

- SMBIOS override to modify the factory SMBIOS values.

+

- DSDT override to use a modified fixed DSDT which can solve several issues.

+

- Device Property Injection via device-properties string.

+

- hybrid boot0 / boot1h for MBR and GPT partitioned disks.

+

- Automatic FSB detection code even for recent AMD CPUs.

+

- Apple Software RAID support.

+

- Module support

+

- Memory detection adapted from memtest86: http://www.memtest.org

+


+


+

The code is released under version 2 of the Gnu Public License.

+

http://forge.voodooprojects.org/p/chameleon

+


+

FAQ's: http://forum.voodooprojects.org/index.php/topic,754.0.html

Index: branches/ErmaC/Trunk/package/Resources/en.lproj/Localizable.strings =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/package/Resources/pt-PT.lproj/Localizable.strings =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/package/Resources/es.lproj/Localizable.strings =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/package/Resources/fr.lproj/Localizable.strings =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/package/Resources/mk.lproj/Localizable.strings =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/package/Resources/hr.lproj/Localizable.strings =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/package/Resources/nl.lproj/Localizable.strings =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/package/Resources/pl.lproj/Localizable.strings =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/package/Resources/it.lproj/Localizable.strings =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/package/Resources/pt-BR.lproj/Localizable.strings =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/package/Resources/sr.lproj/Localizable.strings =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/package/Resources/Japanese.lproj/Localizable.strings =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/package/Resources/ru.lproj/Localizable.strings =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/package/Resources/de.lproj/Localizable.strings =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/package/Resources/bg.lproj/Localizable.strings =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/package/buildpkg.sh =================================================================== --- branches/ErmaC/Trunk/package/buildpkg.sh (revision 1650) +++ branches/ErmaC/Trunk/package/buildpkg.sh (revision 1651) @@ -3,11 +3,8 @@ # $1 Path to store built package packagesidentity="org.chameleon" - packagename="Chameleon" - pkgroot="${0%/*}" - chamTemp="usr/local/chamTemp" COL_BLACK="\x1b[30;01m" @@ -20,7 +17,6 @@ COL_BLUE="\x1b[34;01m" COL_RESET="\x1b[39;49;00m" -#version=$( grep I386BOOT_CHAMELEONVERSION vers.h | awk '{ print $3 }' | tr -d '\"' ) version=$( cat version ) stage=${version##*-} revision=$( grep I386BOOT_CHAMELEONREVISION vers.h | awk '{ print $3 }' | tr -d '\"' ) @@ -58,14 +54,15 @@ outline[$((outlinecount++))]="${indent[$xmlindent]}" # build pre install package -# This is run before any other package - so this could -# be a good place to initialise the install log??? echo "================= Preinstall =================" ((xmlindent++)) packagesidentity="org.chameleon" mkdir -p ${1}/Pre/Root mkdir -p ${1}/Pre/Scripts + 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 @@ -100,31 +97,27 @@ # build standard package mkdir -p ${1}/Standard/Root mkdir -p ${1}/Standard/Scripts/Resources - cp -f ${pkgroot}/Scripts/Main/Standard/* ${1}/Standard/Scripts + 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 echo " [BUILD] Standard " - buildpackage "${1}/Standard" "/" "${coresize}" "start_enabled=\"true\" start_selected=\"upgrade_allowed()\" selected=\"exclusive(choices['EFI']) && exclusive(choices['noboot'])\"" >/dev/null 2>&1 + buildpackage "${1}/Standard" "/" "${coresize}" "start_enabled=\"true\" selected=\"exclusive(choices['EFI']) && exclusive(choices['noboot'])\"" >/dev/null 2>&1 # End build standard package # build efi package mkdir -p ${1}/EFI/Root mkdir -p ${1}/EFI/Scripts/Resources - cp -f ${pkgroot}/Scripts/Main/EFI/* ${1}/EFI/Scripts + 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 echo " [BUILD] EFI " - buildpackage "${1}/EFI" "/" "${coresize}" "start_visible=\"systemHasGPT()\" start_selected=\"false\" selected=\"exclusive(choices['Standard']) && exclusive(choices['noboot'])\"" >/dev/null 2>&1 + buildpackage "${1}/EFI" "/" "${coresize}" "start_visible=\"systemHasGPT()\" selected=\"exclusive(choices['Standard']) && exclusive(choices['noboot'])\"" >/dev/null 2>&1 # End build efi package # build reset choice package mkdir -p ${1}/noboot/Root echo " [BUILD] Reset choice " - buildpackage "${1}/noboot" "/$chamTemp" "" "start_visible=\"true\" start_selected=\"false\" selected=\"exclusive(choices['Standard']) && exclusive(choices['EFI'])\"" >/dev/null 2>&1 + buildpackage "${1}/noboot" "/$chamTemp" "" "selected=\"exclusive(choices['Standard']) && exclusive(choices['EFI'])\"" >/dev/null 2>&1 # End build reset choice package ((xmlindent--)) @@ -186,7 +179,7 @@ fi ((xmlindent--)) - outline[$((outlinecount++))]="${indent[$xmlindent]}\t
" + outline[$((outlinecount++))]="${indent[$xmlindent]}
" } else { @@ -195,7 +188,6 @@ fi # End build Modules packages - # build Extras package # build options packages @@ -220,7 +212,7 @@ choices[$((choicescount++))]="\t\n\t\n" ((xmlindent++)) packagesidentity="org.chameleon.options.$builtOptionsList" - + # ------------------------------------------------------ # Read boot option file in to an array. # ------------------------------------------------------ @@ -269,7 +261,7 @@ done # to indicate exclusive option, call buildoptionalsettings with the 2nd parameter set to 1 . - buildoptionalsettings "$1" "0" "keylayout" + buildoptionalsettings "$1" "1" "keylayout" ((xmlindent--)) outline[$((outlinecount++))]="${indent[$xmlindent]}" @@ -302,16 +294,16 @@ ((xmlindent--)) outline[$((outlinecount++))]="${indent[$xmlindent]}" - # End build theme packages -# End build Extras package + # End build theme packages# End build Extras package # build post install package echo "================= Post =================" packagesidentity="org.chameleon" mkdir -p ${1}/Post/Root mkdir -p ${1}/Post/Scripts - cp -f ${pkgroot}/Scripts/Main/Post/* ${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 " @@ -327,7 +319,7 @@ # clean up - rm -R -f "${1}" + #rm -R -f "${1}" } @@ -411,7 +403,15 @@ fi done x="${x}${stringEnd}" - buildpackage "${1}/${optionName}" "/$chamTemp/options" "" "start_selected=\"false\" ${x}" >/dev/null 2>&1 + + # First exclusive option is the 'no choice' option, so let's make that selected by default. + if [ $c = 0 ]; then + initialChoice="true" + else + initialChoice="false" + fi + + buildpackage "${1}/${optionName}" "/$chamTemp/options" "" "start_selected=\"${initialChoice}\" ${x}" >/dev/null 2>&1 else buildpackage "${1}/${optionName}" "/$chamTemp/options" "" "start_selected=\"false\"" >/dev/null 2>&1 fi @@ -447,7 +447,7 @@ header+="auth=\"root\">\n" header+="\t\n" - rm -R -f "${1}/Temp" + #rm -R -f "${1}/Temp" [ -d "${1}/Temp" ] || mkdir -m 777 "${1}/Temp" [ -d "${1}/Root" ] && mkbom "${1}/Root" "${1}/Temp/Bom" @@ -481,10 +481,8 @@ if [ "${4}" ]; then local choiceoptions="\t\t${4}" fi - #choices[$((choicescount++))]="\n\t#${packagename// /}.pkg\n\n" - choices[$((choicescount++))]="\t\n\t\t#${packagename// /}.pkg\n\t\n" - rm -R -f "${1}" + #rm -R -f "${1}" fi } @@ -565,5 +563,5 @@ } -main "${1}" "${2}" "${3}" "${4}" "${5}" +main "${1}" "${2}" "${3}" "${4}" #"${5}" Index: branches/ErmaC/Modules/i386/libsaio/fake_efi.c =================================================================== --- branches/ErmaC/Modules/i386/libsaio/fake_efi.c (revision 1650) +++ branches/ErmaC/Modules/i386/libsaio/fake_efi.c (revision 1651) @@ -434,11 +434,6 @@ static const char const SYSTEM_TYPE_PROP[] = "system-type"; static const char const MODEL_PROP[] = "Model"; static const char const BOARDID_PROP[] = "board-id"; -// Facetime fix from olegpronin @ insanelymac -// Breaks booting from RAID -static const char const BOOT_UUID_PROP[] = "boot-uuid"; -static char uuidStr[64]; -//Facetime fix end /* * Get an smbios option string option to convert to EFI_CHAR16 string @@ -607,21 +602,6 @@ // Fill /efi/device-properties node. setupDeviceProperties(node); - - // Facetime fix from olegpronin @ insanelymac - // Thanks to Lnx2Mac for the idea of using the key SkipFTFix=Yes as a temporary work around for this breaking RAID booting - bool skipFTFix=false; - getBoolForKey(kSkipFTFix, &skipFTFix, &bootInfo->chameleonConfig); - if (!skipFTFix) { - //Facetime temp fix start - Node *ChoosenNode; - if (gBootVolume->fs_getuuid && gBootVolume->fs_getuuid (gBootVolume, uuidStr) == 0) - { - ChoosenNode = DT__FindNode("/chosen", false); - DT__AddProperty(ChoosenNode, BOOT_UUID_PROP, 64, uuidStr); - } - //Facetime fix end - } } /* @@ -640,6 +620,21 @@ } /* + * Populate the chosen node + */ +void setupChosenNode() +{ + Node *chosenNode; + chosenNode = DT__FindNode("/chosen", false); + if (chosenNode == 0) + stop("Couldn't get chosen node"); + + int bootUUIDLength = strlen(gBootUUIDString); + if (bootUUIDLength) + DT__AddProperty(chosenNode, "boot-uuid", bootUUIDLength + 1, gBootUUIDString); +} + +/* * Load the smbios.plist override config file if any */ static void setupSmbiosConfigFile(const char *filename) @@ -703,6 +698,9 @@ gST64->Hdr.CRC32 = 0; gST64->Hdr.CRC32 = crc32(0L, gST64, gST64->Hdr.HeaderSize); } + + // Setup the chosen node + setupChosenNode(); } void saveOriginalSMBIOS(void) Index: branches/ErmaC/Modules/i386/boot2/boot.c =================================================================== --- branches/ErmaC/Modules/i386/boot2/boot.c (revision 1650) +++ branches/ErmaC/Modules/i386/boot2/boot.c (revision 1651) @@ -72,7 +72,7 @@ static char gCacheNameAdler[64 + 256]; char *gPlatformName = gCacheNameAdler; -char gRootDevice[512]; +char gRootDevice[ROOT_DEVICE_SIZE]; char gMKextName[512]; char gMacOSVersion[8]; int bvCount = 0, gDeviceCount = 0; Index: branches/ErmaC/Modules/i386/boot2/boot.h =================================================================== --- branches/ErmaC/Modules/i386/boot2/boot.h (revision 1650) +++ branches/ErmaC/Modules/i386/boot2/boot.h (revision 1651) @@ -101,7 +101,6 @@ #define kSMBIOSdefaults "SMBIOSdefaults" /* smbios_patcher.c */ #define kSystemID "SystemId" /* fake_efi.c */ #define kSystemType "SystemType" /* fake_efi.c */ -#define kSkipFTFix "SkipFTFix" /* fake_efi.c */ //For Work around to bypass olegpronin's Facetime fix #define kUseMemDetect "UseMemDetect" /* platform.c */ @@ -138,6 +137,7 @@ * A global set by boot() to record the device that the booter * was loaded from. */ +#define ROOT_DEVICE_SIZE 512 extern int gBIOSDev; extern long gBootMode; extern bool sysConfigValid; @@ -215,9 +215,11 @@ /* * options.c */ -extern int getBootOptions(bool firstRun); -extern int processBootOptions(); -extern int selectAlternateBootDevice(int bootdevice); +extern char gBootUUIDString[]; + +extern int getBootOptions(bool firstRun); +extern int processBootOptions(); +extern int selectAlternateBootDevice(int bootdevice); extern bool promptForRescanOption(void); void showHelp(); Index: branches/ErmaC/Modules/i386/boot2/options.c =================================================================== --- branches/ErmaC/Modules/i386/boot2/options.c (revision 1650) +++ branches/ErmaC/Modules/i386/boot2/options.c (revision 1651) @@ -1063,6 +1063,7 @@ //========================================================================== +char gBootUUIDString[32+4+1] = ""; // UUID of the boot volume e.g. 5EB1869F-C4FA-3502-BDEB-3B8ED5D87292 extern unsigned char chainbootdev; extern unsigned char chainbootflag; @@ -1071,6 +1072,9 @@ int argLen = argName ? strlen(argName) : 0; int len = argLen + cnt + 1; // +1 to account for space + if (argName) + len++; // +1 to account for '=' + if (len > *cntRemainingP) { error("Warning: boot arguments too long, truncating\n"); return false; @@ -1081,8 +1085,8 @@ *argP += argLen; *argP[0] = '='; (*argP)++; - len++; // +1 to account for '=' } + strncpy( *argP, val, cnt ); *argP += cnt; *argP[0] = ' '; @@ -1102,7 +1106,8 @@ const char *configTable, char **argP, // Output value int *cntRemainingP, // Output count - char *foundVal // found value + char *foundVal, // found value + int foundValSize // max found value size ) { const char *val; @@ -1119,9 +1124,8 @@ copyArgument(argName, val, cnt, argP, cntRemainingP); found = true; } - if (found && foundVal) { - strlcpy(foundVal, val, cnt+1); - } + if (found && foundVal) + strlcpy(foundVal, val, foundValSize); return found; } @@ -1131,17 +1135,15 @@ int processBootOptions() { - const char * cp = gBootArgs; - const char * val = 0; - const char * kernel; - int cnt; - int userCnt; - int cntRemaining; - char * argP; - char uuidStr[64]; - bool uuidSet = false; - char * configKernelFlags; - char * valueBuffer; + const char *cp = gBootArgs; + const char *val = 0; + const char *kernel; + int cnt; + int userCnt; + int cntRemaining; + char *argP; + char *configKernelFlags; + char *valueBuffer; valueBuffer = malloc(VALUE_SIZE); @@ -1221,35 +1223,34 @@ configKernelFlags = malloc(cnt + 1); strlcpy(configKernelFlags, val, cnt + 1); - if (processBootArgument(kBootUUIDKey, cp, configKernelFlags, bootInfo->config, &argP, &cntRemaining, 0)) { - // boot-uuid was set either on the command-line - // or in the config file. - uuidSet = true; - } else { - + // boot-uuid can be set either on the command-line or in the config file + if (!processBootArgument(kBootUUIDKey, cp, configKernelFlags, bootInfo->config, + &argP, &cntRemaining, gBootUUIDString, sizeof(gBootUUIDString))) { // // Try an alternate method for getting the root UUID on boot helper partitions. // if (gBootVolume->flags & kBVFlagBooter) - { - if((loadHelperConfig(&bootInfo->helperConfig) == 0) - && getValueForKey(kHelperRootUUIDKey, &val, &cnt, &bootInfo->helperConfig) ) + { + // Load the configuration store in the boot helper partition + if (loadHelperConfig(&bootInfo->helperConfig) == 0) { - getValueForKey(kHelperRootUUIDKey, &val, &cnt, &bootInfo->helperConfig); - copyArgument(kBootUUIDKey, val, cnt, &argP, &cntRemaining); - uuidSet = true; - } + val = getStringForKey(kHelperRootUUIDKey, &bootInfo->helperConfig); + if (val != NULL) + strlcpy(gBootUUIDString, val, sizeof(gBootUUIDString)); + } } - if (!uuidSet && gBootVolume->fs_getuuid && gBootVolume->fs_getuuid (gBootVolume, uuidStr) == 0) { - verbose("Setting boot-uuid to: %s\n", uuidStr); - copyArgument(kBootUUIDKey, uuidStr, strlen(uuidStr), &argP, &cntRemaining); - uuidSet = true; - } + // Try to get the volume uuid string + if (!strlen(gBootUUIDString) && gBootVolume->fs_getuuid) + gBootVolume->fs_getuuid(gBootVolume, gBootUUIDString); - } + // If we have the volume uuid add it to the commandline arguments + if (strlen(gBootUUIDString)) + copyArgument(kBootUUIDKey, gBootUUIDString, strlen(gBootUUIDString), &argP, &cntRemaining); + } - if (!processBootArgument(kRootDeviceKey, cp, configKernelFlags, bootInfo->config, &argP, &cntRemaining, gRootDevice)) { + if (!processBootArgument(kRootDeviceKey, cp, configKernelFlags, bootInfo->config, + &argP, &cntRemaining, gRootDevice, ROOT_DEVICE_SIZE)) { cnt = 0; if ( getValueForKey( kBootDeviceKey, &val, &cnt, &bootInfo->chameleonConfig)) { valueBuffer[0] = '*'; @@ -1257,7 +1258,7 @@ strlcpy(valueBuffer + 1, val, cnt); val = valueBuffer; } else { - if (uuidSet) { + if (strlen(gBootUUIDString)) { val = "*uuid"; cnt = 5; } else { @@ -1276,7 +1277,8 @@ /* * Removed. We don't need this anymore. * - if (!processBootArgument(kPlatformKey, cp, configKernelFlags, bootInfo->config, &argP, &cntRemaining, gPlatformName)) { + if (!processBootArgument(kPlatformKey, cp, configKernelFlags, bootInfo->config, + &argP, &cntRemaining, gPlatformName, sizeof(gCacheNameAdler))) { getPlatformName(gPlatformName); copyArgument(kPlatformKey, gPlatformName, strlen(gPlatformName), &argP, &cntRemaining); } Index: branches/ErmaC/Modules/package/Distribution =================================================================== --- branches/ErmaC/Modules/package/Distribution (revision 1650) +++ branches/ErmaC/Modules/package/Distribution (revision 1651) @@ -27,7 +27,7 @@ my.result.type = 'Fatal'; return false; } - system.log('installCheckScript: Passed.'); + system.log('installCheckScript: Failed.'); return false; } @@ -37,18 +37,6 @@ 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) Index: branches/ErmaC/Modules/package/slimpkg.sh =================================================================== --- branches/ErmaC/Modules/package/slimpkg.sh (revision 1650) +++ branches/ErmaC/Modules/package/slimpkg.sh (revision 1651) @@ -3,11 +3,8 @@ # $1 Path to store built package packagesidentity="org.chameleon" - packagename="Chameleon" - pkgroot="${0%/*}" - chamTemp="usr/local/chamTemp" COL_BLACK="\x1b[30;01m" @@ -20,9 +17,8 @@ COL_BLUE="\x1b[34;01m" COL_RESET="\x1b[39;49;00m" -#version=$( grep I386BOOT_CHAMELEONVERSION vers.h | awk '{ print $3 }' | tr -d '\"' ) version=$( cat version ) -stage=${version##*-}" (.: ErmaC :. branch)" +stage=${version##*-} revision=$( grep I386BOOT_CHAMELEONREVISION vers.h | awk '{ print $3 }' | tr -d '\"' ) builddate=$( grep I386BOOT_BUILDDATE vers.h | awk '{ print $3,$4 }' | tr -d '\"' ) timestamp=$( date -j -f "%Y-%m-%d %H:%M:%S" "${builddate}" "+%s" ) @@ -57,10 +53,23 @@ outline[$((outlinecount++))]="${indent[$xmlindent]}" +# build pre install package + echo "================= Preinstall =================" + ((xmlindent++)) + packagesidentity="org.chameleon" + mkdir -p ${1}/Pre/Root + mkdir -p ${1}/Pre/Scripts + 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 + # build core package echo "================= Core =================" - ((xmlindent++)) - packagesidentity="org.chameleon.core" + packagesidentity="org.chameleon" mkdir -p ${1}/Core/Root/usr/local/bin mkdir -p ${1}/Core/Root/usr/standalone/i386 ditto --noextattr --noqtn ${1%/*}/i386/boot ${1}/Core/Root/usr/standalone/i386 @@ -77,44 +86,46 @@ local coresize=$( du -hkc "${1}/Core/Root" | tail -n1 | awk {'print $1'} ) echo " [BUILD] i386 " buildpackage "${1}/Core" "/" "0" "start_visible=\"false\" start_selected=\"true\"" >/dev/null 2>&1 +# End build core package # build Chameleon package echo "================= Chameleon =================" - outline[$((outlinecount++))]="${indent[$xmlindent]}\t" - choices[$((choicescount++))]="\n\n" - + outline[$((outlinecount++))]="${indent[$xmlindent]}" + choices[$((choicescount++))]="\t\n\t\n" + ((xmlindent++)) + # build standard package mkdir -p ${1}/Standard/Root mkdir -p ${1}/Standard/Scripts/Resources - cp -f ${pkgroot}/Scripts/Main/Standard/* ${1}/Standard/Scripts + 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 echo " [BUILD] Standard " - buildpackage "${1}/Standard" "/" "${coresize}" "start_enabled=\"true\" start_selected=\"upgrade_allowed()\" selected=\"exclusive(choices['EFI']) && exclusive(choices['noboot'])\"" >/dev/null 2>&1 + buildpackage "${1}/Standard" "/" "${coresize}" "start_enabled=\"true\" selected=\"exclusive(choices['EFI']) && exclusive(choices['noboot'])\"" >/dev/null 2>&1 # End build standard package # build efi package mkdir -p ${1}/EFI/Root mkdir -p ${1}/EFI/Scripts/Resources - cp -f ${pkgroot}/Scripts/Main/EFI/* ${1}/EFI/Scripts + 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 echo " [BUILD] EFI " - buildpackage "${1}/EFI" "/" "${coresize}" "start_visible=\"systemHasGPT()\" start_selected=\"false\" selected=\"exclusive(choices['Standard']) && exclusive(choices['noboot'])\"" >/dev/null 2>&1 + buildpackage "${1}/EFI" "/" "${coresize}" "start_visible=\"systemHasGPT()\" selected=\"exclusive(choices['Standard']) && exclusive(choices['noboot'])\"" >/dev/null 2>&1 # End build efi package # build reset choice package mkdir -p ${1}/noboot/Root echo " [BUILD] Reset choice " - buildpackage "${1}/noboot" "/$chamTemp" "" "start_visible=\"true\" start_selected=\"false\" selected=\"exclusive(choices['Standard']) && exclusive(choices['EFI'])\"" >/dev/null 2>&1 + buildpackage "${1}/noboot" "/$chamTemp" "" "selected=\"exclusive(choices['Standard']) && exclusive(choices['EFI'])\"" >/dev/null 2>&1 # End build reset choice package - - ((xmlindent--)) - outline[$((outlinecount++))]="${indent[$xmlindent]}\t" + + ((xmlindent--)) + outline[$((outlinecount++))]="${indent[$xmlindent]}" # End build Chameleon package # build Modules package @@ -133,8 +144,8 @@ ############################### if [ "$(ls -A "${1%/*}/i386/modules")" ]; then { - outline[$((outlinecount++))]="${indent[$xmlindent]}\t" - choices[$((choicescount++))]="\n\n" + outline[$((outlinecount++))]="${indent[$xmlindent]}" + choices[$((choicescount++))]="\t\n\t\n" ((xmlindent++)) packagesidentity="org.chameleon.modules" # - @@ -212,7 +223,7 @@ fi ((xmlindent--)) - outline[$((outlinecount++))]="${indent[$xmlindent]}\t" + outline[$((outlinecount++))]="${indent[$xmlindent]}" } else { @@ -223,19 +234,24 @@ # build post install package echo "================= Post =================" + packagesidentity="org.chameleon" mkdir -p ${1}/Post/Root mkdir -p ${1}/Post/Scripts - cp -f ${pkgroot}/Scripts/Main/Post/* ${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 " buildpackage "${1}/Post" "/" "" "start_visible=\"false\" start_selected=\"true\"" >/dev/null 2>&1 - outline[$((outlinecount++))]="${indent[$xmlindent]}" +# End build post install package +#((xmlindent--)) +outline[$((outlinecount++))]="${indent[$xmlindent]}" + # build meta package - makedistribution "${1}" "${2}" "${3}" "${4}" "${5}" + makedistribution "${1}" "${2}" "${3}" "${4}" #"${5}" # clean up @@ -309,13 +325,12 @@ popd >/dev/null - outline[$((outlinecount++))]="${indent[$xmlindent]}\t" + outline[$((outlinecount++))]="${indent[$xmlindent]}" if [ "${4}" ]; then - local choiceoptions="${indent[$xmlindent]}${4}\n" + local choiceoptions="\t\t${4}" fi - choices[$((choicescount++))]="\n\t#${packagename// /}.pkg\n\n" - + choices[$((choicescount++))]="\t\n\t\t#${packagename// /}.pkg\n\t\n" rm -R -f "${1}" fi } @@ -363,7 +378,7 @@ find "${1}/${packagename}" -name '.DS_Store' -delete pushd "${1}/${packagename}" >/dev/null - xar -c -f "${1%/*}/$packagename.pkg" --compression none . + xar -c -f "${1%/*}/${packagename// /}-${version}-r${revision}.pkg" --compression none . popd >/dev/null # Here is the place for assign a Icon to the pkg @@ -372,8 +387,8 @@ # ---- ditto -xk "${pkgroot}/Icons/pkg.zip" "${pkgroot}/Icons/" DeRez -only icns "${pkgroot}/Icons/Icons/pkg.icns" > tempicns.rsrc - Rez -append tempicns.rsrc -o "${1%/*}/$packagename.pkg" - SetFile -a C "${1%/*}/$packagename.pkg" + Rez -append tempicns.rsrc -o "${1%/*}/$packagename-${version}-r$revision.pkg" + SetFile -a C "${1%/*}/$packagename-${version}-r$revision.pkg" rm -f tempicns.rsrc rm -rf "${pkgroot}/Icons/Icons" # End @@ -395,5 +410,5 @@ } -main "${1}" "${2}" "${3}" "${4}" "${5}" +main "${1}" "${2}" "${3}" "${4}" #"${5}" Index: branches/ErmaC/Modules/package/builddmg.sh =================================================================== --- branches/ErmaC/Modules/package/builddmg.sh (revision 1650) +++ branches/ErmaC/Modules/package/builddmg.sh (revision 1651) @@ -39,6 +39,7 @@ revision=$( grep I386BOOT_CHAMELEONREVISION vers.h | awk '{ print $3 }' | tr -d '\"' ) builddate=$( grep I386BOOT_BUILDDATE vers.h | awk '{ print $3,$4 }' | tr -d '\"' ) timestamp=$( date -j -f "%Y-%m-%d %H:%M:%S" "${builddate}" "+%s" ) +CHAMELEON_PACKAGE_NAME=${VOLUME_NAME}-${version}-r${revision} # ========================= # Start of building process @@ -51,11 +52,11 @@ echo "" # ================================= -# 1) Clean previus builded contents +# 1) Clean previous builded contents # ================================= if [ -x ${SRC_FOLDER} ]; then - echo " Deleting previus existing source folder/content " + echo " Deleting previous existing source folder/content " rm -R ${SRC_FOLDER} rm -f ${DMG_TEMP_NAME} fi @@ -75,13 +76,32 @@ ditto -xk "${pkgroot}/Icons/doc.zip" "${SRC_FOLDER}/" ditto -xk "${pkgroot}/Icons/pan.zip" "${SRC_FOLDER}/" ditto -xk "${pkgroot}/Icons/tm.zip" "${SRC_FOLDER}/" - - mv ${SYM_ROOT}/${VOLUME_NAME}.pkg ${SRC_FOLDER}/${VOLUME_NAME}.pkg - cp -r ${pkgroot}/doc/* ${SRC_FOLDER}/Documentation/ + + #mv ${SYM_ROOT}/${VOLUME_NAME}.pkg ${SRC_FOLDER}/${VOLUME_NAME}.pkg + cp -r ${SYM_ROOT}/${CHAMELEON_PACKAGE_NAME}.pkg ${SRC_FOLDER}/${CHAMELEON_PACKAGE_NAME}.pkg + #cp -r ${pkgroot}/doc/* ${SRC_FOLDER}/Documentation/ + cp -r ${SYM_ROOT%/*}/doc/BootHelp.txt ${SRC_FOLDER}/Documentation/ + cp -r ${SYM_ROOT%/*}/doc/Users_Guide0.5.pdf ${SRC_FOLDER}/Documentation/ cp -r ${pkgroot}/Configuration/PrefPanel/* ${SRC_FOLDER}/PrefPanel/ cp -r ${SYM_ROOT}/i386/* ${SRC_FOLDER}/i386/ cp -r ${SYM_ROOT%/*}/artwork/themes/* ${SRC_FOLDER}/Themes/ - rm -rf ${SRC_FOLDER}`find . -type d -name .svn` + #rm -rf ${SRC_FOLDER}`find . -type d -name .svn` + + # The above line caused problems with svn reporting changes to all + # directories in the Chameleon source folder that exist before compiling + # svn status would show the following: + # ~ Chameleon.xcodeproj + # ~ artwork + # ~ i386 + # ~ package + # ~ doc + # I've changed the code to this for now to get round the problem. + # Hopefully someone else can find out why it was happenening. + svnFilesToRemove=($( find "${SRC_FOLDER}" -type d -name '.svn')) + for (( i = 0 ; i < ${#svnFilesToRemove[@]} ; i++ )) + do + rm -rf ${svnFilesToRemove[$i]} + done # ======================================= # 4) Find the size of the folder contents @@ -138,7 +158,7 @@ # 9) Make sure it's not world writeable # ===================================== - mv ${SRC_FOLDER}/${VOLUME_NAME}.pkg ${MOUNT_DIR}/${VOLUME_NAME}.pkg + mv ${SRC_FOLDER}/${CHAMELEON_PACKAGE_NAME}.pkg ${MOUNT_DIR}/${VOLUME_NAME}.pkg cp -R ${SRC_FOLDER}/Documentation ${MOUNT_DIR}/ cp -R ${SRC_FOLDER}/PrefPanel ${MOUNT_DIR}/ cp -R ${SRC_FOLDER}/i386 ${MOUNT_DIR}/ @@ -155,10 +175,10 @@ # ============================================= echo " [openUp] Setting auto open flag" -if [ -x ${OPENUP_TOOL} ]; then - echo " Applying openUp..." - ${OPENUP_TOOL} "${MOUNT_DIR}" >/dev/null 2>&1 -fi + if [ -x ${OPENUP_TOOL} ]; then + echo " Applying openUp..." + ${OPENUP_TOOL} "${MOUNT_DIR}" >/dev/null 2>&1 + fi echo " " # =========== @@ -211,4 +231,5 @@ echo " ====================" echo "" #----- + exit 0 Index: branches/ErmaC/Modules/package/OptionalSettings/Resolution.txt =================================================================== --- branches/ErmaC/Modules/package/OptionalSettings/Resolution.txt (revision 1650) +++ branches/ErmaC/Modules/package/OptionalSettings/Resolution.txt (revision 1651) @@ -21,7 +21,7 @@ # B) User can select only one of the options from the list. # Set Exclusive=False for A, or Exclusive=True for B. # -Exclusive=False +Exclusive=True # --------------------------------------------- # Note: There must be a carriage return at end of last line # --------------------------------------------- Index: branches/ErmaC/Modules/package/OptionalSettings/General.txt =================================================================== --- branches/ErmaC/Modules/package/OptionalSettings/General.txt (revision 1650) +++ branches/ErmaC/Modules/package/OptionalSettings/General.txt (revision 1651) @@ -35,4 +35,3 @@ UseMemDetect:UseMemDetect=No UseKernelCache:UseKernelCache=Yes Wake:Wake=Yes -SkipFTFix:SkipFTFix=Yes Index: branches/ErmaC/Modules/package/OptionalSettings/Control.txt =================================================================== --- branches/ErmaC/Modules/package/OptionalSettings/Control.txt (revision 1650) +++ branches/ErmaC/Modules/package/OptionalSettings/Control.txt (revision 1651) @@ -30,5 +30,5 @@ LegacyLogo:Legacy Logo=Yes InstantMenu:Instant Menu=Yes QuietBoot:QuietBoot=Yes -ShowInfo:ShowInfo=No +ShowInfo:ShowInfo=Yes Wait:Wait=Yes Index: branches/ErmaC/Modules/package/Scripts/Main/ESPpostinstall =================================================================== --- branches/ErmaC/Modules/package/Scripts/Main/ESPpostinstall (revision 0) +++ branches/ErmaC/Modules/package/Scripts/Main/ESPpostinstall (revision 1651) @@ -0,0 +1,187 @@ +#!/bin/bash + +echo "===============================================" +echo "Main EFI System Partition Post-Install Script" +echo "*********************************************" +echo "-----------------------------------------------" +echo "" + +# 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 + +stage0Loader="boot0" +stage0LoaderDualBoot="boot0md" +stage1LoaderHFS="boot1h" +stage1LoaderFAT="boot1f32" +stage2Loader="boot" + +targetVolumeChosenByUser=$3 +targetDeviceChosenByUser=$( df "${targetVolumeChosenByUser}" | sed -n '2p' | awk '{print $1}' ) + +targetVolume="/Volumes/EFI" +targetDevice=${targetDeviceChosenByUser%s*}s1 +targetDeviceRaw=${targetDevice/disk/rdisk} +targetDisk=${targetDevice%s*} +targetDiskRaw=${targetDisk/disk/rdisk} +targetSlice=${targetDevice#*disk*s} + +targetResources="${targetVolumeChosenByUser}/usr/local/bin/" + +echo "===============================================" +echo "DEBUG: display script variables" +echo "***************************" + +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 "" + + +# 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}" + +# Check to see if the selected disk uses a GPT + +bootuuid=$( diskutil info "$targetDeviceChosenByUser" | grep Volume\ UUID | awk {'print $3'} ) +partitiontable=$( diskutil list ${targetDeviceChosenByUser%s*} | sed -n '3p' | awk '{print $2}' ) + +if [ ${partitiontable} = "GUID_partition_scheme" ]; then + echo "Confirm this is a GPT partitioned disk." + + # Double check we can see the selected partition and it's of the right type. + # If the following script finds anything, it returns 1 to indicate failure. + + + "$scriptDir"CheckProceed.sh "${targetVolume}" "${targetDeviceChosenByUser}" "${targetVolumeChosenByUser}" "${scriptDir}" + returnValue=$? + if [ ${returnValue} = 0 ]; then + # OK to proceed + + + # 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}" "${targetVolumeChosenByUser}" "${scriptDir}" + returnValue=$? + if [ ${returnValue} = 0 ]; then + # OK to proceed + + + # 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=$? + + + # 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}" "${targetVolumeChosenByUser}" "${scriptDir}" + diskupdate=$? + + + # check the format of the selected partition. + # result should be either hfs or msdos + # Should really check to make sure! + + 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}" "${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"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 Property changes on: branches/ErmaC/Modules/package/Scripts/Main/ESPpostinstall ___________________________________________________________________ Added: svn:executable + * Index: branches/ErmaC/Modules/package/Scripts/Main/postinstall =================================================================== --- branches/ErmaC/Modules/package/Scripts/Main/postinstall (revision 0) +++ branches/ErmaC/Modules/package/Scripts/Main/postinstall (revision 1651) @@ -0,0 +1,235 @@ +#!/bin/bash + +echo "===============================================" +echo "Post Post-Install Script" +echo "*********************************" +echo "-----------------------------------------------" +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 + +# Check target exists +if [ ! -e "$3" ] +then + echo "$3 volume does not exist!" + exit 1 +fi + +# clean up what would otherwise turn into "//" paths +if [ "$3" == "/" ] +then + dest_vol="" +else + dest_vol="$3" +fi + +# Find script location so to find the Install Log script. +MYLOCATION="${PWD}/${BASH_ARGV[0]}" +export MYLOCATION="${MYLOCATION%/*}" +scriptDir=$MYLOCATION + +# Has install log already been generated? +if [ ! -f "${dest_vol}"/.ChameleonLogFlag ]; then + # Write some information to the Install Log + versionNumber=`cat "${scriptDir}"/Resources/version` + revisionNumber=`cat "${scriptDir}"/Resources/revision` + "$scriptDir"InstallLog.sh "${dest_vol}" "Installer version: ${versionNumber} ${revisionNumber}" + "$scriptDir"InstallLog.sh "${dest_vol}" "Running Post postinstall script" + "$scriptDir"InstallLog.sh "${dest_vol}" "Target volume = ${dest_vol}" +else + "$scriptDir"InstallLog.sh "${dest_vol}" "Running Post postinstall script" +fi + +# set temporary directory +chamTemp="$dest_vol/usr/local/chamTemp" + +# Check for stopped installation due to Chameleon +# already existing on the same disk. +if [ ! -f "$dest_vol"/.ChameleonExists ]; then + + # --------------------------------------------- + # Add any installed modules to the Install Log + # --------------------------------------------- + if [ -e "${chamTemp}"/Extra/modules ]; then + ls "${chamTemp}"/Extra/modules | while read FILE + do + "$scriptDir"InstallLog.sh "${dest_vol}" "Installed module:$FILE" + done + fi + + # --------------------------------------------- + # Add any installed themes to the Install Log + # --------------------------------------------- + if [ -e "${chamTemp}"/Extra/Themes ]; then + ls "${chamTemp}"/Extra/Themes | while read FILE + do + "$scriptDir"InstallLog.sh "${dest_vol}" "Installed Theme:$FILE" + done + fi + + # --------------------------------------------- + # Build org.chameleon.Boot.plist + # --------------------------------------------- + # All options selected are now dummy files with + # the filename of the option and value residing + # in /usr/local/chamTemp/options/ + # for example. Boot Banner=Yes + + # Are there any options to build? + if [ "$(ls -A ${chamTemp}/options )" ]; then + + # Check for temporary directory/Extra folder. + if [ ! -d "$chamTemp"/Extra ]; then + mkdir "$chamTemp"/Extra + fi + + # Create template for org.chameleon.Boot.plist" + tempOCBP="$chamTemp"/Extra/org.chameleon.Boot.plist + cp "$4"/Library/Preferences/SystemConfiguration/com.apple.Boot.plist "$tempOCBP" + + # Read list of all boot options the user added. + arrayCount=0 + kernelFlagCount=0 + while read FILE + do + options[arrayCount]="${FILE##*/}" + + # Check keyRead for 'KF' at beginning to + # indicate that should be a kernel flag + if [ ${options[arrayCount]:0:2} = "KF" ];then + # plistbuddy only add's if the key doesn't already exist. + # So let's store any kernelflags and add them all at the + # same time once when we reach the end of the options list. + kernelflag[kernelFlagCount]="${options[arrayCount]##*flag=}" + "$scriptDir"InstallLog.sh "${dest_vol}" "Added kernel flag: ${kernelflag[kernelFlagCount]}" + (( kernelFlagCount++ )) + else + keyRead="${options[$arrayCount]%=*}" + value="${options[$arrayCount]#*=}" + # escape any spaces + keyToUse=$( echo $keyRead | sed 's/ /\\ /g' ) + if [ "${keyToUse}" != "DONT" ] && [ "${value}" != "ADD" ]; then + sudo /usr/libexec/plistbuddy -c "Add :${keyToUse} string ${value}" "$tempOCBP" + returnValue=$? + if [ ${returnValue} -ne 1 ]; then + "$scriptDir"InstallLog.sh "${dest_vol}" "Added boot option: ${keyRead}=${value}" + else + "$scriptDir"InstallLog.sh "${dest_vol}" "Can't add ${keyRead}=${value} as an option already exists for: ${keyRead}" + fi + fi + fi + (( arrayCount++ )) + done < <(ls "${chamTemp}"/options ) + + # If exclusive options were used and the 'None' option was chosen, + # then a dummy file named DONT=ADD would be in /$chamTemp/Extra/options. + # If that was the only option then the above code would have made a + # temporary Extra folder with a default org.chameleon.Boot.plist + # In this case we don't need it and should discard it otherwise the folder + # will be copied to the users / directory when it's not wanted. + if [ ${arrayCount} == 1 ] && [ "${keyToUse}" == "DONT" ] && [ "${value}" == "ADD" ]; then + if [ -e "${chamTemp}"/Extra ] && [ ! -e "${chamTemp}"/Extra/Themes ] && [ ! -e "${chamTemp}"/Extra/Modules ]; then + rm -r -f "$chamTemp"/Extra + fi + fi + + if [ $kernelFlagCount -gt 0 ]; then + # Add kernel flags + for (( i=0 ; i < $kernelFlagCount ; i++ )) + do + # Add any kernel flags together in to one string. + kernelFlagString="${kernelFlagString} ${kernelflag[i]}" + done + sudo /usr/libexec/plistbuddy -c "Add :Kernel\ Flags string $kernelFlagString" "$tempOCBP" + if [ ${returnValue}=1 ]; then # key already exists. + sudo /usr/libexec/plistbuddy -c "Delete :Kernel\ Flags" "$tempOCBP" + sudo /usr/libexec/plistbuddy -c "Add :Kernel\ Flags string $kernelFlagString" "$tempOCBP" + fi + fi + fi + + # --------------------------------------------- + # Copy temp Extra folder to target destination + # --------------------------------------------- + # If we've made a temporary Extra folder to use then + # check for an existing /Extra folder. If found, back it up + # before copying the temporary Extra folder to destination. + # Extra folder now resides in /usr/local/chamTemp/ + # Copy /usr/local/chamTemp/Extra to correct location. + + if [ -d "$chamTemp"/Extra ]; then + if [ ! -f "$dest_vol"/.ChameleonEFI ]; then + # The Standard install option chosen + + # Does an /Extra folder already exist? + if [ -e "$dest_vol"/Extra ]; then + "$scriptDir"InstallLog.sh "${dest_vol}" "Found existing $dest_vol/Extra folder. Renaming it $dest_vol/Extra-OLD-$( date "+%H-%M-%S" )" + mv "$dest_vol/Extra" "$dest_vol/Extra_OLD-"$( date "+%H-%M-%S" ) + fi + "$scriptDir"InstallLog.sh "${dest_vol}" "Writing folder: $dest_vol/Extra" + cp -R "$chamTemp"/Extra "$dest_vol" + else + # The EFI system partition install option was chosen + # Does a /Volumes/Extra folder already exist? + if [ -e "/Volumes/EFI/Extra" ]; then + "$scriptDir"InstallLog.sh "${dest_vol}" "Found existing /Volumes/EFI/Extra folder. Renaming it Extra-OLD-$( date "+%H-%M-%S" )" + mv "/Volumes/EFI/Extra" "/Volumes/EFI/Extra_OLD-"$( date "+%H-%M-%S" ) + fi + "$scriptDir"InstallLog.sh "${dest_vol}" "Writing folder: /Volumes/EFI/Extra" + cp -R "$chamTemp"/Extra "/Volumes/EFI" + fi + fi + + # Unmount ALL mounted volumes named EFI + "$scriptDir"UnMountEFIvolumes.sh "${dest_vol}" "${scriptDir}" +else + cleanUp="${cleanUp},0" + rm "$dest_vol"/.ChameleonExists +fi + +# --------------------------------------------- +# Cleanup +# --------------------------------------------- + +# remove any temporary boot sector files if they exist +if [ -d /tmp/newbs ]; then + cleanUp="${cleanUp},1a" + rm /tmp/newbs +fi +if [ -d /tmp/origbs ]; then + cleanUp="${cleanUp},1b" + rm /tmp/origbs +fi +if [ -d /tmp/newBootSector ]; then + cleanUp="${cleanUp},1c" + rm /tmp/newbs +fi +if [ -d /tmp/originalBootSector ]; then + cleanUp="${cleanUp},1d" + rm /tmp/origbs +fi + +# delete the temporary Chameleon folder +if [ -e "$chamTemp" ]; then + cleanUp="${cleanUp},2" + rm -rf "$chamTemp" +fi + +# Remove /.ChameleonEFI file +if [ -f "$dest_vol"/.ChameleonEFI ]; then + cleanUp="${cleanUp},3" + rm "$dest_vol"/.ChameleonEFI +fi + +"$scriptDir"InstallLog.sh "${dest_vol}" "Cleanup: ${cleanUp}" +"$scriptDir"InstallLog.sh "${dest_vol}" "LineBreak" +"$scriptDir"InstallLog.sh "${dest_vol}" "Post script complete" + +echo "===============================================" +echo "END - Post Post-Install Script" +echo "*********************************" +echo "-----------------------------------------------" +echo "" \ No newline at end of file Property changes on: branches/ErmaC/Modules/package/Scripts/Main/postinstall ___________________________________________________________________ Added: svn:executable + * Index: branches/ErmaC/Modules/package/Scripts/Main/Standardpostinstall =================================================================== --- branches/ErmaC/Modules/package/Scripts/Main/Standardpostinstall (revision 0) +++ branches/ErmaC/Modules/package/Scripts/Main/Standardpostinstall (revision 1651) @@ -0,0 +1,202 @@ +#!/bin/bash + +echo "===============================================" +echo "Main Standard Post-Install Script" +echo "*********************************" +echo "-----------------------------------------------" +echo "" + +# 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 + +stage0Loader="boot0" +stage0LoaderDualBoot="boot0md" +stage1LoaderHFS="boot1h" +stage1LoaderFAT="boot1f32" +stage2Loader="boot" + +targetVolume=$3 +targetDevice=$( df "${targetVolume}" | sed -n '2p' | awk '{print $1}' ) +targetDeviceRaw=${targetDevice/disk/rdisk} +targetDisk=${targetDevice%s*} +targetDiskRaw=${targetDisk/disk/rdisk} +targetSlice=${targetDevice#*disk*s} + +targetResources="${targetVolume}/usr/local/bin/" + +echo "===============================================" +echo "DEBUG: display script variables" +echo "*******************************" + +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 "" + + +# Write some information to the Install Log +"$scriptDir"InstallLog.sh "${targetVolume}" "Running Standard postinstall script" +"$scriptDir"InstallLog.sh "${targetVolume}" "Target volume = ${targetVolume} on ${targetDevice}" + +# Double check we can see the selected partition and it's of the right type. +# If the following script finds anything, it returns 1 to indicate failure. + +"$scriptDir"CheckProceed.sh "${targetVolume}" "${targetDevice}" "${targetVolume}" "${scriptDir}" +returnValue=$? +if [ ${returnValue} = 0 ]; then + # OK to proceed + + + # 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}" + returnValue=$? + if [ ${returnValue} = 0 ]; then + # OK to proceed + + + # 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=$? + + + # 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=$? + + + # check the format of the selected partition. + # result should be either hfs or msdos + # Should really check to make sure! + + targetFormat=$( fstyp "$targetDevice" ) + + + # 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 + + # 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 + + # Append a line break to the installer log + "$scriptDir"InstallLog.sh "${targetVolume}" "LineBreak" + + if [ ${diskupdate} = "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 + + # Write the stage 1 loader to the partition boot sector + "$scriptDir"WriteChameleonStage1.sh "${targetFormat}" "${stage1LoaderHFS}" "${stage1LoaderFAT}" "${3}" "${targetDeviceRaw}" "${targetVolume}" "${scriptDir}" + + # Write the stage 2 loader to the root of the selected partition + "$scriptDir"WriteChameleonStage2.sh "${stage2Loader}" "${3}" "${targetDevice}" "${targetVolume}" "${scriptDir}" + + + # Next we look to check for existing Chameleon installations. + # But as it will check /Volumes/EFI for the stage 2 loader, + # we need to make sure it's mounted. + + # Tell the user what's going on. + "$scriptDir"InstallLog.sh "${targetVolume}" "LineBreak" + "$scriptDir"InstallLog.sh "${targetVolume}" "About to check your disk for previous installations" + "$scriptDir"InstallLog.sh "${targetVolume}" "which involves checking the EFI system partition if" + "$scriptDir"InstallLog.sh "${targetVolume}" "appropriate for this disk." + + # Unmount ALL mounted volumes named EFI. + # Returns 0=success, 1=fail + + "$scriptDir"UnMountEFIvolumes.sh "${targetVolume}" "${scriptDir}" + returnValue=$? + if [ ${returnValue} = 0 ]; then + # OK to proceed + + if [ ${partitionScheme} = 1 ] || [ ${partitionScheme} = 2 ]; then + # Mount the EFI system partition + "$scriptDir"MountESP.sh "${targetDisk}" "${targetVolume}" "${scriptDir}" + fi + + # Check for another existing Chameleon installation on the same disk + "$scriptDir"CheckPreviousChameleon.sh "${targetDisk}" "${targetDeviceRaw}" "${targetDevice}" "${targetVolume}" "${scriptDir}" + fi + + # 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 +fi + +"$scriptDir"InstallLog.sh "${targetVolume}" "LineBreak" +"$scriptDir"InstallLog.sh "${targetVolume}" "Standard script complete" + +echo "===============================================" +echo "END - Standard Post-Install Script" +echo "*********************************" +echo "-----------------------------------------------" +echo "" + +exit 0 Property changes on: branches/ErmaC/Modules/package/Scripts/Main/Standardpostinstall ___________________________________________________________________ Added: svn:executable + * Index: branches/ErmaC/Modules/package/Scripts/Main/preinstall =================================================================== --- branches/ErmaC/Modules/package/Scripts/Main/preinstall (revision 1650) +++ branches/ErmaC/Modules/package/Scripts/Main/preinstall (revision 1651) @@ -6,8 +6,42 @@ echo "-----------------------------------------------" echo "" -# Place holder for maybe setting up install log here? +# Creates text file named 'Chameleon_Installer_Log.txt' +# at the root of the target volume. This is to help show the +# user why the installation process failed (even though the +# package installer ends reading 'Installation Successful'. + + +# 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 + +targetVolume=$3 + +logName="Chameleon_Installer_Log.txt" +logFile="${targetVolume}"/$logName + +versionNumber=`cat "${scriptDir}"/Resources/version` +revisionNumber=`cat "${scriptDir}"/Resources/revision` + + + +# Setup Chameleon_Installer_Log.txt file +# by writing header and diskutil list + +echo "Chameleon installer log - $( date ) +Installer version: ${versionNumber} ${revisionNumber} +======================================================" >"${logFile}" + +diskutil list >>"${logFile}" +echo "======================================================" >>"${logFile}" + + + echo "===============================================" echo "END - Pre-Install Script" echo "*********************************" Index: branches/ErmaC/Modules/package/Scripts/Sub/CheckFormat.sh =================================================================== --- branches/ErmaC/Modules/package/Scripts/Sub/CheckFormat.sh (revision 1650) +++ branches/ErmaC/Modules/package/Scripts/Sub/CheckFormat.sh (revision 1651) @@ -1,43 +0,0 @@ -#!/bin/bash - -echo "===============================================" -echo "CheckFormat: Is target HFS or MSDOS?" -echo "**********************************************" - -# if the selected partition is formatted as HFS then exit with 1 -# if the selected partition is formatted as MSDOS then exit with 2 -# if fstyp doesn't return a value then exit with 0 - -# Receives targetDevice: for example, /dev/disk0s2 -# Receives targetVolume: Volume to install to. -# Receives scriptDir: The location of the main script dir. - - -if [ "$#" -eq 3 ]; then - targetDevice="$1" - targetVolume="$2" - scriptDir="$3" - echo "DEBUG: passed argument for targetDevice = $targetDevice" - echo "DEBUG: passed argument for targetVolume = $targetVolume" - echo "DEBUG: passed argument for scriptDir = $scriptDir" -else - echo "Error - wrong number of values passed" - exit 9 -fi - -if [ "$( fstyp "$targetDevice" | grep hfs )" ]; then - #echo "DEBUG: ${targetDevice} is currently formatted as HFS" - #"$scriptDir"InstallLog.sh "${targetVolume}" "${targetDevice} is currently formatted as HFS" - exit 1 - -fi -if [ "$( fstyp "$targetDevice" | grep msdos )" ]; then - #echo "DEBUG: ${targetDevice} is currently formatted as msdos" - #"$scriptDir"InstallLog.sh "${targetVolume}" "${targetDevice} is currently formatted as msdos" - exit 2 -fi - -#echo "DEBUG: WARNING: ${targetDevice} is currently not formatted as either HFS or msdos" -"$scriptDir"InstallLog.sh "${targetVolume}" "WARNING: ${targetDevice} is currently not formatted as either HFS or msdos" - -exit 0 Index: branches/ErmaC/Modules/package/Scripts/Sub/CheckPreviousChameleon.sh =================================================================== --- branches/ErmaC/Modules/package/Scripts/Sub/CheckPreviousChameleon.sh (revision 1650) +++ branches/ErmaC/Modules/package/Scripts/Sub/CheckPreviousChameleon.sh (revision 1651) @@ -4,9 +4,13 @@ echo "Check Previous Chameleon: Will there be problems?" echo "***********************************************" -# Checks the selected volume is present and the disk is partitioned -# Now also check for another existing Chameleon installation on the same disk. +# Checks for another existing Chameleon installation on the same disk +# and tries to make sure the user doesn't end up with an un-bootable +# system due to having installed Chameleon previously elsewhere. +# Called from the Standard/postinstall and EFI/postinstall scripts +# /Volumes/EFI should already be mounted before this is called. + # Receives targetDisk: for example, /dev/disk3. # Receives targetDeviceRaw: for example, /dev/rdisk3s1. # Receives targetDevice: Stores device number, for example /dev/disk2s1. @@ -30,11 +34,11 @@ fi -# Check for existing Chameleon installations on a different -# partition of the same target disk. -#echo "DEBUG: Checking for existing Chameleon installations on ${targetDisk#/dev/}..." +# =============================================== +# Prepare some vars +# =============================================== +sliceNumber=$( echo ${targetDeviceRaw#*disk*s} ) -sliceNumber=$( echo ${targetDeviceRaw#*disk*s} ) # strip slice from end targetDiskRawNoSlice=$( echo ${targetDeviceRaw%$sliceNumber} ) @@ -42,102 +46,147 @@ # How many actual partitions are there? numSlices=$(( $( diskutil list | grep $( echo ${targetDisk#/dev/} ) | sed -n '$=' ) -2 )) -# Only check the disk for Chameleon installations if there is more than one partition. + +# =============================================== +# Checking the disk for existing Chameleon installations +# if there is more than one partition on the disk. +# =============================================== if [ $numSlices -gt 1 ]; then - + "$scriptDir"InstallLog.sh "${installerVolume}" "LineBreak" + "$scriptDir"InstallLog.sh "${installerVolume}" "Checking for previous chameleon installations on ${targetDisk#/dev/}" + + # Check the disk's MBR for existing stage 0 boot code (code from CheckDiskMicrocode.sh script) + stage0type=$( dd 2>/dev/null if="$targetDisk" count=3 bs=1 skip=105 | xxd | awk '{print $2$3}' ) + if [ "${stage0type}" == "0a803c" ] || [ "${stage0type}" == "ee7505" ] || [ "${stage0type}" == "742b80" ]; then + stage0type=2 + elif [ "${stage0type}" == "0b807c" ]; then + stage0type=1 + fi + #Scan all partitions for Chameleon code for (( i=1; i <= $numSlices; i++ )); do - stageExistence=0 - stage0FirstBootable=0 - previousExistence="NONE" + if [ $stage0type == 1 ] || [ $stage0type == 2 ]; then + stagesFound=1 + else + stagesFound=0 + fi + stage1Existence="NONE" + stage2Existence=0 targetDiskRaw=$targetDiskRawNoSlice$i - - # Check for existing stage 0 boot file (same code as CheckDiskMicrocode.sh script) - stage0type=$( dd 2>/dev/null if="$targetDisk" count=3 bs=1 skip=105 | xxd | awk '{print $2$3}' ) - if [ "${stage0type}" == "0b807c" ] || [ "${stage0type}" == "0a803c" ] || [ "${stage0type}" == "ee7505" ] || [ "${stage0type}" == "742b80" ]; then - #echo "DEBUG: boot0 found on $targetDisk" - (( stageExistence++ )) - - # While here, check just for either existing boot0hfs, boot0md or boot0md (dmazar's boot0workV2) - if [ "${stage0type}" == "0a803c" ] || [ "${stage0type}" == "ee7505" ] || [ "${stage0type}" == "742b80" ]; then - stage0FirstBootable=1 - fi - fi - + # Check for existence of a bootable partition boot sector containing either boot1h or boot1f32 boot1Search=$( dd 2>/dev/null if="$targetDiskRaw" count=1 | perl -ne '@a=split"";for(@a){printf"%02x",ord}' ) if [ "${boot1Search:0:16}" == "fa31c08ed0bcf0ff" ] && [ "${boot1Search:1020:2}" == "55" ]; then - #echo "DEBUG: boot1h found on "$targetDiskRaw - (( stageExistence++ )) - previousExistence="boot1" + (( stagesFound++ )) + stage1Existence="boot1h" elif [ "${boot1Search:0:4}" == "e962" ] && [ "${boot1Search:180:12}" == "424f4f542020" ] && [ "${boot1Search:1020:2}" == "55" ]; then - #echo "DEBUG: boot1f32 found on "$targetDiskRaw - (( stageExistence++ )) - previousExistence="boot1f32" + (( stagesFound++ )) + stage1Existence="boot1f32" fi - # Check for existing stage 2 boot file also - # NOTE: This will fail to find /boot on /Volumes/EFI as it won't be mounted! + # Check for existing stage 2 boot file. + # Include checking the EFI system partition if it exists and is mounted. if [ -e "$( df | grep ${targetDisk}s${i} | awk '{ print $6 }' )"/boot ]; then - #echo "DEBUG: boot found on $targetDiskRaw" - (( stageExistence++ )) + (( stagesFound++ )) + stage2Existence=1 fi - - #if [ $stageExistence == 3 ] && [ $i -ne $sliceNumber ]; then - #echo "DEBUG: STOP: There is already an existing Chameleon installation on $targetDiskRaw" - #"$scriptDir"InstallLog.sh "${installerVolume}" "STOP: There is already an existing Chameleon installation on $targetDiskRaw." - #"$scriptDir"InstallLog.sh "${installerVolume}" "NOTE: This is allowed and does work as long as you aren't dual booting Windows" - #"$scriptDir"InstallLog.sh "${installerVolume}" "NOTE: from the same disk and are happy to control which partition is used by" - #"$scriptDir"InstallLog.sh "${installerVolume}" "NOTE: flagging the required partition active. General use doesn't require two" - #"$scriptDir"InstallLog.sh "${installerVolume}" "NOTE: Chameleon installs on the same disk, though might be done by advanced users." - #"$scriptDir"InstallLog.sh "${installerVolume}" "NOTE: If you still want to do this then proceed by installing Chameleon manually." - #exit 1 - #fi - - if [ $stageExistence -ge 2 ] && [ "$previousExistence" != "NONE" ] && [ $i -ne $sliceNumber ]; then + + if [ $stagesFound -ge 2 ] && [ "$stage1Existence" != "NONE" ] && [ $i -ne $sliceNumber ]; then # There is previous Chameleon stage 1 code on a partition boot sector, # and either a complete or incomplete installation (ie. boot0 or boot are missing). - if [ $stageExistence == 3 ]; then - "$scriptDir"InstallLog.sh "${installerVolume}" "WARN: There is already an existing Chameleon installation on $targetDiskRaw." - else - "$scriptDir"InstallLog.sh "${installerVolume}" "NOTE: $previousExistence already exists at ${targetDisk}s${i}" + + if [ $stagesFound == 3 ] && [ $i -lt $sliceNumber ]; then + # Exisitng installation found which will still be default. + message="************************** TAKE NOTE ***************************** +**** There is an existing Chameleon installation on $targetDiskRaw +**** and that installation will still be the default loader as it's +**** on an earlier partition. If you want this new installation on +**** $installerVolume to be default then you will need to remove the +**** boot file from $targetDiskRaw and re-run this installer. +**************************************************************" + "$scriptDir"InstallLog.sh "${installerVolume}" "${message}" fi + if [ $stagesFound == 3 ] && [ $i -gt $sliceNumber ]; then + # Exisitng installation found which will no longer be default. + message="NOTE: There is an existing Chameleon installation on $targetDiskRaw +NOTE: but this installation on $targetDevice will be the default loader +NOTE: because you're installing to an earlier partition on the disk." + "$scriptDir"InstallLog.sh "${installerVolume}" "${message}" + fi - # This could prove problematic and result in either a b1f:error or boot0:error - # if the following conditions are true: + + # User could see a b1f:error or boot0:error if the following conditions are true: # A) Boot0hfs, Boot0md or Boot0md (dmazar's Boot0workV2) is being used. # B) The previous stage 1 code is on a lower partiton than the one being installed to now. + # C) boot is missing from that partition. + + if [ $stagesFound == 2 ] && [ $stage2Existence == 0 ]; then + # Exisitng boot0 and boot1 only found - missing boot + "$scriptDir"InstallLog.sh "${installerVolume}" "INFO: Found $stage1Existence installed to ${targetDisk}s${i}" + + # stage0type=2 is used to know if 'A' is true. + if [ $stage0type == 2 ]; then + # i = current slice we're checking, slicenumber = slice trying to install to. + if [ $i -lt $sliceNumber ]; then + "$scriptDir"InstallLog.sh "${installerVolume}" "WARN: Conditions point to the possibility of a boot failure" + + # Fix by making previous paritionboot sector un-bootable + # Change Byte 01FExh to 00 (510 decimal) + message="--- +FIX: Make ${targetDisk}s${i} boot sector un-bootable by changing byte 1FEh to 00. +NOTE: Any Extra folder you had there will still be there. If you want to use +NOTE: ${targetDisk}s${i} again as your boot partition then re-run this installer +NOTE: selecting it as the target, ONLY choosing the 'Chameleon Bootloader' option +NOTE: and NONE of the other options. +---" + "$scriptDir"InstallLog.sh "${installerVolume}" "${message}" - # stage0FirstBootable=1 is used to know if 'A' is true. - if [ $stage0FirstBootable == 1 ]; then - # i = current slice we're checking, slicenumber = slice trying to install to. - if [ $i -lt $sliceNumber ]; then - "$scriptDir"InstallLog.sh "${installerVolume}" "WARN: Conditions point to you receiving a boot failure" - # Fix by making previous paritionboot sector un-bootable - # Change Byte 01FExh to 00 (510 decimal) - "$scriptDir"InstallLog.sh "${installerVolume}" "---" - "$scriptDir"InstallLog.sh "${installerVolume}" "FIX: Make ${targetDisk}s${i} boot sector un-bootable by changing byte 1FEh to 00." - "$scriptDir"InstallLog.sh "${installerVolume}" "NOTE: Any Extra folder you had there will still be there. If you want to use" - "$scriptDir"InstallLog.sh "${installerVolume}" "NOTE: ${targetDisk}s${i} again as your boot partition then re-run this installer" - "$scriptDir"InstallLog.sh "${installerVolume}" "NOTE: selecting it as the target, ONLY choosing the 'Chameleon Bootloader' option" - "$scriptDir"InstallLog.sh "${installerVolume}" "NOTE: and NONE of the other options." - "$scriptDir"InstallLog.sh "${installerVolume}" "---" - dd if=${targetDisk}s${i} count=1 bs=512 of=/tmp/originalBootSector - cp /tmp/originalBootSector /tmp/newBootSector - dd if="$scriptDir/patch" of=/tmp/newBootSector bs=1 count=1 seek=510 conv=notrunc - dd if=/tmp/newBootSector of=${targetDisk}s${i} count=1 bs=512 - else - "$scriptDir"InstallLog.sh "${installerVolume}" "NOTE: but won't interfere as you're installing to an earlier partition." + # /Volumes/EFI needs unmounting before changing partition boot sector + if [ $i == 1 ]; then + umount /Volumes/EFI + else + diskutil unmount "${targetDisk}"s${i} + fi + + if [ "$( fstyp "${targetDisk}"s${i} | grep hfs )" ]; then + #echo "DEBUG: HFS - changing byte 1FEh to 00" + dd if=${targetDisk}s${i} count=2 bs=512 of=originalBootSector + cp originalBootSector newBootSector + dd if="patch" of=newBootSector bs=1 count=1 seek=510 conv=notrunc + dd if=newBootSector of=${targetDisk}s${i} count=2 bs=510 + fi + if [ "$( fstyp "${targetDisk}"s${i} | grep msdos )" ]; then + #echo "DEBUG: MSDOS - changing byte 1FEh to 00" + dd if=${targetDisk}s${i} count=1 bs=512 of=/tmp/originalBootSector + cp /tmp/originalBootSector /tmp/newBootSector + dd if="$scriptDir/patch" of=/tmp/newBootSector bs=1 count=1 seek=510 conv=notrunc + dd if=/tmp/newBootSector of=${targetDisk}s${i} count=1 bs=512 + fi + + # /Volumes/EFI needs re-mounting so EFI/postinstall script can use it. + # Don't check for a GPT as wouldn't have got here if it wasn't + if [ $i == 1 ]; then + "$scriptDir"MountESP.sh "${targetDisk}" "${installerVolume}" "${scriptDir}" + else + diskutil mount "${targetDisk}"s${i} + fi + + else + "$scriptDir"InstallLog.sh "${installerVolume}" "INFO: but won't interfere as you're installing to an earlier partition." + fi + elif [ $stage0type == 1 ]; then + # boot0 was found which looks for boot1 on the first active partition. + "$scriptDir"InstallLog.sh "${installerVolume}" "NOTE: so select to boot that partition (if used) with active flag." + #else + #echo "DEBUG: Boot0 not found" fi - else - "$scriptDir"InstallLog.sh "${installerVolume}" "NOTE: so select to boot that partition (if used) with active flag." fi fi + done - #else #echo "DEBUG: Just one slice" fi -exit 0 \ No newline at end of file +exit 0 Index: branches/ErmaC/Modules/package/Scripts/Sub/InstallLog.sh =================================================================== --- branches/ErmaC/Modules/package/Scripts/Sub/InstallLog.sh (revision 1650) +++ branches/ErmaC/Modules/package/Scripts/Sub/InstallLog.sh (revision 1651) @@ -4,10 +4,8 @@ echo "InstallLog: Create/Append installation log" echo "**********************************************" -# Creates text file named 'Chameleon_Installer_Log.txt' -# at the root of the target volume. This is to help show the -# user why the installation process failed (even though the -# package installer ends reading 'Installation Successful'. +# Writes to the Chameleon_Installer_Log.txt file created +# by the preinstall script at the start of installation. # Receives two parameters # $1 = selected volume for location of the install log @@ -23,30 +21,14 @@ exit 9 fi + + logName="Chameleon_Installer_Log.txt" logFile="${logLocation}"/$logName -# On first run, create a file named .ChameleonLogFlag at -# the root of the target volume. Then check for this file -# on subsequent runs to know the initialisation sequence -# has been done. -if [ ! -f "${logLocation}"/.ChameleonLogFlag ]; then - # This is the first run, so setup - # Chameleon_Installer_Log.txt file - # by writing header. +if [ -f "${logFile}" ]; then - # Also include the first message that this script - # would be called with which will be version/revision - # of Chameleon package. - - echo "Chameleon installer log - $( date ) -${verboseText} -======================================================" >"${logFile}" - - # Create /.ChameleonLogFlag file. - echo "Log" >"${logLocation}"/.ChameleonLogFlag -else # Append messages to the log as passed by other scripts. if [ "${verboseText}" = "Diskutil" ]; then diskutil list >>"${logFile}" @@ -68,4 +50,4 @@ fi fi -exit 0 \ No newline at end of file +exit 0 Index: branches/ErmaC/Modules/package/Scripts/Sub/MountESP.sh =================================================================== --- branches/ErmaC/Modules/package/Scripts/Sub/MountESP.sh (revision 0) +++ branches/ErmaC/Modules/package/Scripts/Sub/MountESP.sh (revision 1651) @@ -0,0 +1,42 @@ +#!/bin/bash + +echo "===============================================" +echo "MountESP: Mount the EFI system partition" +echo "***********************************************" + +# Creates a mountpoint and mounts /Volumes/EFI of the +# supplied disk which would have been pre-checked as using a GPT + +# Receives targetDisk: for example /dev/disk2. +# Receives installerVolume: Volume to write the installer log to. +# Receives scriptDir: The location of the main script dir. + +if [ "$#" -eq 3 ]; then + targetDisk="$1" + installerVolume="$2" + scriptDir="$3" + echo "DEBUG: passed argument for targetDisk = $targetDisk" + echo "DEBUG: passed argument for installerVolume = $installerVolume" + echo "DEBUG: passed argument for scriptDir = $scriptDir" +else + echo "Error - wrong number of values passed" + exit 9 +fi + + +# Does the mountpoint exist? +if [ ! -e "/Volumes/EFI" ]; then + mkdir -p "/Volumes/EFI" +fi + +# Mount '/Volumes/EFI' using the correct format type +if [ "$( fstyp "${targetDisk}"s1 | grep hfs )" ]; then + "$scriptDir"InstallLog.sh "${installerVolume}" "Mounting ${targetDisk}s1 as /Volumes/EFI" + mount_hfs "${targetDisk}"s1 "/Volumes/EFI" +fi +if [ "$( fstyp "${targetDisk}"s1 | grep msdos )" ]; then + "$scriptDir"InstallLog.sh "${installerVolume}" "Mounting ${targetDisk}s1 as /Volumes/EFI" + mount_msdos -u 0 -g 0 "${targetDisk}"s1 "/Volumes/EFI" +fi + +exit 0 \ No newline at end of file Property changes on: branches/ErmaC/Modules/package/Scripts/Sub/MountESP.sh ___________________________________________________________________ Added: svn:executable + * Index: branches/ErmaC/Modules/package/Scripts/Sub/WriteChameleonStage1.sh =================================================================== --- branches/ErmaC/Modules/package/Scripts/Sub/WriteChameleonStage1.sh (revision 1650) +++ branches/ErmaC/Modules/package/Scripts/Sub/WriteChameleonStage1.sh (revision 1651) @@ -6,7 +6,7 @@ # Writes Chameleon stage 1 loader. -# Receives espformat: 1 for HFS, 2 for MSDOS, 0 for unknown +# Receives targetFormat: either hfs or msdos # Receives stage1LoaderHFS: Name of file - boot1h # Receives stage1LoaderFAT: Name of file - boot1f32 # Receives selectedDestination: for example, /Volumes/USB @@ -15,14 +15,14 @@ # Receives scriptDir: The location of the main script dir. if [ "$#" -eq 7 ]; then - espformat="$1" + targetFormat="$1" stage1LoaderHFS="$2" stage1LoaderFAT="$3" selectedDestination="$4" targetDeviceRaw="$5" targetVolume="$6" scriptDir="$7" - echo "DEBUG: passed argument for espformat = $espformat" + echo "DEBUG: passed argument for targetFormat = $targetFormat" echo "DEBUG: passed argument for stage1LoaderHFS = $stage1LoaderHFS" echo "DEBUG: passed argument for stage1LoaderFAT = $stage1LoaderFAT" echo "DEBUG: passed argument for selectedDestination = $selectedDestination" @@ -34,8 +34,7 @@ exit 9 fi -if [ ${espformat} = "1" ]; then - # the selected partition is HFS formatted +if [ ${targetFormat} = "hfs" ]; then #echo "DEBUG: Executing command: dd if=${selectedDestination}/usr/standalone/i386/${stage1LoaderHFS} of=${targetDeviceRaw}" dd if="${selectedDestination}"/usr/standalone/i386/${stage1LoaderHFS} of=${targetDeviceRaw} @@ -43,8 +42,7 @@ "$scriptDir"InstallLog.sh "${targetVolume}" "Written ${stage1LoaderHFS} to ${targetDeviceRaw}." fi -if [ ${espformat} = "2" ]; then - # the selected partition FAT formatted +if [ ${targetFormat} = "msdos" ]; then #echo "DEBUG: Executing command: dd if=${targetDeviceRaw} count=1 bs=512 of=/tmp/origbs" dd if=${targetDeviceRaw} count=1 bs=512 of=/tmp/origbs Index: branches/ErmaC/Modules/package/Scripts/Sub/WriteChameleonStage2.sh =================================================================== --- branches/ErmaC/Modules/package/Scripts/Sub/WriteChameleonStage2.sh (revision 1650) +++ branches/ErmaC/Modules/package/Scripts/Sub/WriteChameleonStage2.sh (revision 1651) @@ -4,9 +4,6 @@ echo "Write Chameleon Stage 2 Loader:" echo "*******************************" -# Writes Chameleon stage 2 loader. - -# Receives espformat: 1 for HFS, 2 for MSDOS, 0 for unknown # Receives stage2Loader: Name of file - boot # Receives selectedDestination: for example, /Volumes/ChameleonBootUSB (or /Volumes/EFI if ESP install). # Receives targetDevice: for example, /dev/disk3s1 @@ -14,14 +11,12 @@ # Receives scriptDir: The location of the main script dir. -if [ "$#" -eq 6 ]; then - espformat="$1" - stage2Loader="$2" - selectedDestination="$3" - targetDevice="$4" - targetVolume="$5" - scriptDir="$6" - echo "DEBUG: passed argument for espformat = $espformat" +if [ "$#" -eq 5 ]; then + stage2Loader="$1" + selectedDestination="$2" + targetDevice="$3" + targetVolume="$4" + scriptDir="$5" echo "DEBUG: passed argument for stage2Loader = $stage2Loader" echo "DEBUG: passed argument for selectedDestination = $selectedDestination" echo "DEBUG: passed argument for targetDevice = $targetDevice" @@ -34,31 +29,6 @@ # check to see if install to EFI system partition was selected if [ "${selectedDestination}" = "/Volumes/EFI" ]; then - #echo "DEBUG: EFI install chosen" - - if [ ! -e "${selectedDestination}" ]; then - #echo "DEBUG: Executing Command: mkdir -p ${selectedDestination}" - mkdir -p "${selectedDestination}" - #else - #echo "DEBUG: folder /Volumes/EFI already exists" - fi - - #if the EFI system partition was selected then - # mount '/Volumes/EFI' with the correct format type - - if [ ${espformat} = 1 ]; then - - #echo "Executing command: mount_hfs ${targetDevice} ${targetVolume}" - "$scriptDir"InstallLog.sh "${targetVolume}" "Mounting ${targetDevice} as ${selectedDestination}" - mount_hfs "${targetDevice}" "${selectedDestination}" - fi - if [ ${espformat} = 2 ]; then - [ -d "${selectedDestination}" ] || mkdir -p "${selectedDestination}" - #echo "Executing command: mount_msdos -u 0 -g 0 ${targetDevice} ${selectedDestination}" - "$scriptDir"InstallLog.sh "${targetVolume}" "Mounting ${targetDevice} as ${selectedDestination}" - mount_msdos -u 0 -g 0 "${targetDevice}" "${selectedDestination}" - fi - #echo "DEBUG: Executing command: cp "${targetVolume}"/usr/standalone/i386/${stage2Loader} ${selectedDestination}" cp "${targetVolume}"/usr/standalone/i386/"${stage2Loader}" "${selectedDestination}" "$scriptDir"InstallLog.sh "${targetVolume}" "Written boot to ${selectedDestination}." Index: branches/ErmaC/Modules/package/Scripts/Sub/SetActivePartition.sh =================================================================== --- branches/ErmaC/Modules/package/Scripts/Sub/SetActivePartition.sh (revision 1650) +++ branches/ErmaC/Modules/package/Scripts/Sub/SetActivePartition.sh (revision 1651) @@ -6,22 +6,19 @@ # Sets partition active if Windows is not installed. -# Receives efiformat: code is 1 for HFS, 2 for MSDOS, 0 for unknown # Receives diskSigCheck: code is 1 for a Windows install, 0 for no Windows install # Receives targetDiskRaw: for example, /dev/rdisk1 # Receives targetSlice: for example, 1 # Receives targetVolume: Volume to install to. # Receives scriptDir: The location of the main script dir. -if [ "$#" -eq 6 ]; then - efiformat="$1" - diskSigCheck="$2" - targetDiskRaw="$3" - targetSlice="$4" - targetVolume="$5" - scriptDir="$6" +if [ "$#" -eq 5 ]; then + diskSigCheck="$1" + targetDiskRaw="$2" + targetSlice="$3" + targetVolume="$4" + scriptDir="$5" - echo "DEBUG: passed argument for efiformat = $efiformat" echo "DEBUG: passed argument for diskSigCheck = $diskSigCheck" echo "DEBUG: passed argument for targetDiskRaw = $targetDiskRaw" echo "DEBUG: passed argument for targetSlice = $targetSlice" Index: branches/ErmaC/Modules/package/Scripts/Sub/UnMountEFIvolumes.sh =================================================================== --- branches/ErmaC/Modules/package/Scripts/Sub/UnMountEFIvolumes.sh (revision 1650) +++ branches/ErmaC/Modules/package/Scripts/Sub/UnMountEFIvolumes.sh (revision 1651) @@ -6,7 +6,7 @@ # loop through and un-mount ALL mounted 'EFI' system partitions - Thanks kizwan -# Receives targetVolumeChosenByUser: Stores original target if EFI install selected. +# Receives targetVolumeChosenByUser: To write install log to. # Receives scriptDir: The location of the main script dir. if [ "$#" -eq 2 ]; then @@ -23,14 +23,12 @@ # be unmounted in which case the loop would run forever. attempts=1 while [ "$( df | grep EFI )" ] && [ $attempts -lt 5 ]; do - #echo "DEBUG: Unmounting $( df | grep EFI | awk '{print $1}' )" - "$scriptDir"InstallLog.sh "${targetVolumeChosenByUser}" "Find and unmount any volume named 'EFI':" - "$scriptDir"InstallLog.sh "${targetVolumeChosenByUser}" "$( df | grep EFI | awk '{print $1}' )" + "$scriptDir"InstallLog.sh "${targetVolumeChosenByUser}" "Volume named 'EFI' is mounted..." + "$scriptDir"InstallLog.sh "${targetVolumeChosenByUser}" "Unmounting $( df | grep EFI | awk '{print $1}' )" umount -f $( df | grep EFI | awk '{print $1}' ) (( attempts++ )) done if [ $attempts = 5 ]; then - #echo "DEBUG: failed to unmount 'EFI' System Partition." "$scriptDir"InstallLog.sh "${targetVolumeChosenByUser}" "Failed to unmount 'EFI' System Partition." exit 1 fi Index: branches/ErmaC/Modules/package/Resources/zh_TW.lproj/Localizable.strings =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/package/Resources/he.lproj/Localizable.strings =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/package/Resources/id.lproj/Localizable.strings =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/package/Resources/el.lproj/Localizable.strings =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/package/Resources/zh_CN.lproj/Localizable.strings =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/package/Resources/ar.lproj/Localizable.strings =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/package/Resources/en.lproj/Description.html =================================================================== --- branches/ErmaC/Modules/package/Resources/en.lproj/Description.html (revision 1650) +++ branches/ErmaC/Modules/package/Resources/en.lproj/Description.html (revision 1651) @@ -1,29 +1,45 @@ - + + + -

Chameleon is combination of various boot loader components.
It is based on David Elliott's fake EFI implementation added to Apple's boot-132 project.
Chameleon is extended with the following key features:

-
-

New features in Chameleon 2.0

-
-

- Fully customizable GUI to bring some color to the Darwin Bootloader.

-

- Booting retail DVDs by directly loading a ramdisk image without help of additional programs.

-

- Hibernation. Enjoy resuming your Mac OS X with a preview image.

-

- SMBIOS override to modify the factory SMBIOS values.

-

- DSDT override to use a modified fixed DSDT which can solve several issues.

-
-

- Device Property Injection via device-properties string.

-

- hybrid boot0 / boot1h for MBR and GPT partitioned disks.

-

- automatic FSB detection code even for recent AMD CPUs.

-

- Apple Software RAID support.

-
-

For detailed information, visit : http://chameleon.osx86.hu

+

Chameleon is a boot loader built using a combination of components which evolved from the development of David Elliott's fake EFI implementation added to Apple's boot-132 project.

+


+

Chameleon v2 is extended with many features. For example:

+


+

- Fully customizable GUI to bring some color to the Darwin Bootloader.

+

- Load a ramdisk to directly boot retail DVDs without additional programs.

+

- Hibernation. Enjoy resuming your Mac OS X with a preview image.

+

- SMBIOS override to modify the factory SMBIOS values.

+

- DSDT override to use a modified fixed DSDT which can solve several issues.

+

- Device Property Injection via device-properties string.

+

- hybrid boot0 / boot1h for MBR and GPT partitioned disks.

+

- Automatic FSB detection code even for recent AMD CPUs.

+

- Apple Software RAID support.

+

- Module support

+

- Memory detection adapted from memtest86: http://www.memtest.org

+


+


+

The code is released under version 2 of the Gnu Public License.

+

http://forge.voodooprojects.org/p/chameleon

+


+

FAQ's: http://forum.voodooprojects.org/index.php/topic,754.0.html

Index: branches/ErmaC/Modules/package/Resources/en.lproj/Localizable.strings =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/package/Resources/pt-PT.lproj/Localizable.strings =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/package/Resources/es.lproj/Localizable.strings =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/package/Resources/fr.lproj/Localizable.strings =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/package/Resources/mk.lproj/Localizable.strings =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/package/Resources/hr.lproj/Localizable.strings =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/package/Resources/nl.lproj/Localizable.strings =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/package/Resources/pl.lproj/Localizable.strings =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/package/Resources/it.lproj/Localizable.strings =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/package/Resources/pt-BR.lproj/Localizable.strings =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/package/Resources/sr.lproj/Localizable.strings =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/package/Resources/Japanese.lproj/Localizable.strings =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/package/Resources/ru.lproj/Localizable.strings =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/package/Resources/de.lproj/Localizable.strings =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/package/Resources/bg.lproj/Localizable.strings =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/package/buildpkg.sh =================================================================== --- branches/ErmaC/Modules/package/buildpkg.sh (revision 1650) +++ branches/ErmaC/Modules/package/buildpkg.sh (revision 1651) @@ -3,11 +3,8 @@ # $1 Path to store built package packagesidentity="org.chameleon" - packagename="Chameleon" - pkgroot="${0%/*}" - chamTemp="usr/local/chamTemp" COL_BLACK="\x1b[30;01m" @@ -20,7 +17,6 @@ COL_BLUE="\x1b[34;01m" COL_RESET="\x1b[39;49;00m" -#version=$( grep I386BOOT_CHAMELEONVERSION vers.h | awk '{ print $3 }' | tr -d '\"' ) version=$( cat version ) stage=${version##*-} revision=$( grep I386BOOT_CHAMELEONREVISION vers.h | awk '{ print $3 }' | tr -d '\"' ) @@ -58,14 +54,15 @@ outline[$((outlinecount++))]="${indent[$xmlindent]}" # build pre install package -# This is run before any other package - so this could -# be a good place to initialise the install log??? echo "================= Preinstall =================" ((xmlindent++)) packagesidentity="org.chameleon" mkdir -p ${1}/Pre/Root mkdir -p ${1}/Pre/Scripts + 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 @@ -100,31 +97,27 @@ # build standard package mkdir -p ${1}/Standard/Root mkdir -p ${1}/Standard/Scripts/Resources - cp -f ${pkgroot}/Scripts/Main/Standard/* ${1}/Standard/Scripts + 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 echo " [BUILD] Standard " - buildpackage "${1}/Standard" "/" "${coresize}" "start_enabled=\"true\" start_selected=\"upgrade_allowed()\" selected=\"exclusive(choices['EFI']) && exclusive(choices['noboot'])\"" >/dev/null 2>&1 + buildpackage "${1}/Standard" "/" "${coresize}" "start_enabled=\"true\" selected=\"exclusive(choices['EFI']) && exclusive(choices['noboot'])\"" >/dev/null 2>&1 # End build standard package # build efi package mkdir -p ${1}/EFI/Root mkdir -p ${1}/EFI/Scripts/Resources - cp -f ${pkgroot}/Scripts/Main/EFI/* ${1}/EFI/Scripts + 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 echo " [BUILD] EFI " - buildpackage "${1}/EFI" "/" "${coresize}" "start_visible=\"systemHasGPT()\" start_selected=\"false\" selected=\"exclusive(choices['Standard']) && exclusive(choices['noboot'])\"" >/dev/null 2>&1 + buildpackage "${1}/EFI" "/" "${coresize}" "start_visible=\"systemHasGPT()\" selected=\"exclusive(choices['Standard']) && exclusive(choices['noboot'])\"" >/dev/null 2>&1 # End build efi package # build reset choice package mkdir -p ${1}/noboot/Root echo " [BUILD] Reset choice " - buildpackage "${1}/noboot" "/$chamTemp" "" "start_visible=\"true\" start_selected=\"false\" selected=\"exclusive(choices['Standard']) && exclusive(choices['EFI'])\"" >/dev/null 2>&1 + buildpackage "${1}/noboot" "/$chamTemp" "" "selected=\"exclusive(choices['Standard']) && exclusive(choices['EFI'])\"" >/dev/null 2>&1 # End build reset choice package ((xmlindent--)) @@ -226,7 +219,7 @@ fi ((xmlindent--)) - outline[$((outlinecount++))]="${indent[$xmlindent]}\t
" + outline[$((outlinecount++))]="${indent[$xmlindent]}
" } else { @@ -235,7 +228,6 @@ fi # End build Modules packages - # build Extras package # build options packages @@ -260,7 +252,7 @@ choices[$((choicescount++))]="\t\n\t\n" ((xmlindent++)) packagesidentity="org.chameleon.options.$builtOptionsList" - + # ------------------------------------------------------ # Read boot option file in to an array. # ------------------------------------------------------ @@ -309,7 +301,7 @@ done # to indicate exclusive option, call buildoptionalsettings with the 2nd parameter set to 1 . - buildoptionalsettings "$1" "0" "keylayout" + buildoptionalsettings "$1" "1" "keylayout" ((xmlindent--)) outline[$((outlinecount++))]="${indent[$xmlindent]}" @@ -342,16 +334,16 @@ ((xmlindent--)) outline[$((outlinecount++))]="${indent[$xmlindent]}" - # End build theme packages -# End build Extras package + # End build theme packages# End build Extras package # build post install package echo "================= Post =================" packagesidentity="org.chameleon" mkdir -p ${1}/Post/Root mkdir -p ${1}/Post/Scripts - cp -f ${pkgroot}/Scripts/Main/Post/* ${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 " @@ -367,7 +359,7 @@ # clean up - rm -R -f "${1}" + #rm -R -f "${1}" } @@ -451,7 +443,15 @@ fi done x="${x}${stringEnd}" - buildpackage "${1}/${optionName}" "/$chamTemp/options" "" "start_selected=\"false\" ${x}" >/dev/null 2>&1 + + # First exclusive option is the 'no choice' option, so let's make that selected by default. + if [ $c = 0 ]; then + initialChoice="true" + else + initialChoice="false" + fi + + buildpackage "${1}/${optionName}" "/$chamTemp/options" "" "start_selected=\"${initialChoice}\" ${x}" >/dev/null 2>&1 else buildpackage "${1}/${optionName}" "/$chamTemp/options" "" "start_selected=\"false\"" >/dev/null 2>&1 fi @@ -487,7 +487,7 @@ header+="auth=\"root\">\n" header+="\t\n" - rm -R -f "${1}/Temp" + #rm -R -f "${1}/Temp" [ -d "${1}/Temp" ] || mkdir -m 777 "${1}/Temp" [ -d "${1}/Root" ] && mkbom "${1}/Root" "${1}/Temp/Bom" @@ -521,10 +521,8 @@ if [ "${4}" ]; then local choiceoptions="\t\t${4}" fi - #choices[$((choicescount++))]="\n\t#${packagename// /}.pkg\n\n" - choices[$((choicescount++))]="\t\n\t\t#${packagename// /}.pkg\n\t\n" - rm -R -f "${1}" + #rm -R -f "${1}" fi } @@ -605,5 +603,5 @@ } -main "${1}" "${2}" "${3}" "${4}" "${5}" +main "${1}" "${2}" "${3}" "${4}" #"${5}"