Index: branches/ErmaC/Trunk/artwork/themes/default/device_hfsplus_tiger.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/ErmaC/Trunk/artwork/themes/default/device_hfsplus_tiger.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/device_befs.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/text_scroll_prev.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/device_hfsraid.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/logo.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/device_hfsplus_sl.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/ErmaC/Trunk/artwork/themes/default/device_hfsplus_sl.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/device_hfsplus_lion_o.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/ErmaC/Trunk/artwork/themes/default/device_hfsplus_lion_o.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/device_ext3.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/device_hfsplus_leo.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/ErmaC/Trunk/artwork/themes/default/device_hfsplus_leo.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/boot.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/menu_single_user.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/device_fat_o.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/device_freebsd_o.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/device_hfsraid_tiger_o.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/ErmaC/Trunk/artwork/themes/default/device_hfsraid_tiger_o.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/device_ntfs_o.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/device_scroll_prev.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/device_openbsd.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/device_hfsraid_sl_o.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/ErmaC/Trunk/artwork/themes/default/device_hfsraid_sl_o.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/device_hfsraid_leo_o.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/ErmaC/Trunk/artwork/themes/default/device_hfsraid_leo_o.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/menu_ignore_caches.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/menu_verbose_disabled.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/device_hfsplus_o.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/device_hfsplus_lion.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/ErmaC/Trunk/artwork/themes/default/device_hfsplus_lion.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/menu_boot.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/font_console.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/device_ntfs.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/device_hfsraid_tiger.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/ErmaC/Trunk/artwork/themes/default/device_hfsraid_tiger.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/device_freebsd.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/device_fat.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/menu_single_user_disabled.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/device_hfsraid_sl.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/ErmaC/Trunk/artwork/themes/default/device_hfsraid_sl.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/device_hfsraid_lion_o.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/ErmaC/Trunk/artwork/themes/default/device_hfsraid_lion_o.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/device_hfsraid_leo.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/ErmaC/Trunk/artwork/themes/default/device_hfsraid_leo.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/font_small.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/text_scroll_next.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/device_cdrom_o.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/device_hfsplus.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/device_selection.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/menu_ignore_caches_disabled.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/menu_video_info.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/menu_memory_info.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/device_generic_o.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/menu_selection.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/theme.plist =================================================================== --- branches/ErmaC/Trunk/artwork/themes/default/theme.plist (revision 1750) +++ branches/ErmaC/Trunk/artwork/themes/default/theme.plist (revision 1751) @@ -5,11 +5,9 @@ Author Blackosx Version - 1.0 - + 1.1 Enabled no - screen_width 1024 screen_height @@ -20,12 +18,10 @@ 10 screen_bgcolor #767f73 - background_pos_x 50% background_pos_y 0 - logo_pos_x logo_pos_y @@ -34,7 +30,6 @@ #000000 logo_transparency 255 - devices_pos_x devices_pos_y @@ -49,7 +44,6 @@ 45 devices_layout horizontal - bootprompt_pos_x bootprompt_pos_y @@ -66,7 +60,6 @@ #3e3e3e bootprompt_transparency 1 - infobox_pos_x infobox_pos_y @@ -83,7 +76,6 @@ #3e3e3e infobox_transparency 35 - menu_pos_x menu_pos_y @@ -96,7 +88,6 @@ #3e3e3e menu_transparency 1 - progressbar_pos_x progressbar_pos_y @@ -105,12 +96,10 @@ 100 progressbar_height 40 - countdown_pos_x countdown_pos_y -20% - boot_width 1024 boot_height Index: branches/ErmaC/Trunk/artwork/themes/default/device_hfsplus_tiger_o.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/ErmaC/Trunk/artwork/themes/default/device_hfsplus_tiger_o.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/device_scroll_next.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/device_befs_o.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/menu_help.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/device_hfsraid_o.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/device_hfsplus_sl_o.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/ErmaC/Trunk/artwork/themes/default/device_hfsplus_sl_o.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/background.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/thumb.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/device_hfsraid_lion.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/ErmaC/Trunk/artwork/themes/default/device_hfsraid_lion.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/device_hfsplus_leo_o.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/ErmaC/Trunk/artwork/themes/default/device_hfsplus_leo_o.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/device_ext3_o.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/device_cdrom.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/device_openbsd_o.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/progress_bar_background.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/progress_bar.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/menu_verbose.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/artwork/themes/default/device_generic.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Trunk/i386/libsaio/ext2fs.c =================================================================== --- branches/ErmaC/Trunk/i386/libsaio/ext2fs.c (revision 1750) +++ branches/ErmaC/Trunk/i386/libsaio/ext2fs.c (revision 1751) @@ -18,6 +18,35 @@ return (OSReadLittleInt16(buf+0x438,0)==0xEF53); } +long EX2GetUUID(CICell ih, char *uuidStr) +{ + uint8_t *b, *buf=malloc (EX2ProbeSize); + if (!buf) + return -1; + Seek(ih, 0); + Read(ih, (long)buf, EX2ProbeSize); + if (!EX2Probe (buf)) + { + free (buf); + return -1; + } + if (OSReadLittleInt32 (buf+0x44c,0)<1) + { + free (buf); + return -1; + } + b=buf+0x468; + sprintf(uuidStr, + "%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X", + b[0], b[1], b[2], b[3], + b[4], b[5], + b[6], b[7], + b[8], b[9], + b[10], b[11], b[12], b[13], b[14], b[15]); + free (buf); + return 0; +} + void EX2GetDescription(CICell ih, char *str, long strMaxLen) { char * buf=malloc (EX2ProbeSize); Index: branches/ErmaC/Trunk/i386/libsaio/ext2fs.h =================================================================== --- branches/ErmaC/Trunk/i386/libsaio/ext2fs.h (revision 1750) +++ branches/ErmaC/Trunk/i386/libsaio/ext2fs.h (revision 1751) @@ -9,3 +9,4 @@ extern bool EX2Probe (const void *buf); extern void EX2GetDescription(CICell ih, char *str, long strMaxLen); +extern long EX2GetUUID(CICell ih, char *uuidStr); Index: branches/ErmaC/Trunk/i386/libsaio/acpi_patcher.c =================================================================== --- branches/ErmaC/Trunk/i386/libsaio/acpi_patcher.c (revision 1750) +++ branches/ErmaC/Trunk/i386/libsaio/acpi_patcher.c (revision 1751) @@ -819,7 +819,7 @@ sprintf(filename, i>0?"SSDT-%d.aml":"SSDT.aml", i); - if(new_ssdt[ssdt_count] = loadACPITable(filename)) + if ( (new_ssdt[ssdt_count] = loadACPITable(filename)) ) { ssdt_count++; } Index: branches/ErmaC/Trunk/i386/libsaio/gma.c =================================================================== --- branches/ErmaC/Trunk/i386/libsaio/gma.c (revision 1750) +++ branches/ErmaC/Trunk/i386/libsaio/gma.c (revision 1751) @@ -183,21 +183,21 @@ devprop_add_value(device, "model", (uint8_t*)model, (strlen(model) + 1)); devprop_add_value(device, "device_type", (uint8_t*)"display", 8); - if ((model == (char *)"Mobile GMA950") - || (model == (char *)"Mobile GMA3150")) + if ((strcmp("Mobile GMA950", model) == 0) || + (strcmp("Mobile GMA3150",model) == 0)) { devprop_add_value(device, "AAPL,HasPanel", reg_TRUE, 4); devprop_add_value(device, "built-in", &BuiltIn, 1); devprop_add_value(device, "class-code", ClassFix, 4); } - else if ((model == (char *)"Desktop GMA950") - || (model == (char *)"Desktop GMA3150")) + else if ((strcmp("Desktop GMA950", model) == 0) || + (strcmp("Desktop GMA3150",model) == 0)) { BuiltIn = 0x01; devprop_add_value(device, "built-in", &BuiltIn, 1); devprop_add_value(device, "class-code", ClassFix, 4); } - else if (model == (char *)"GMAX3100") + else if (strcmp("GMAX3100",model) == 0) { devprop_add_value(device, "AAPL,HasPanel", GMAX3100_vals[0], 4); devprop_add_value(device, "AAPL,SelfRefreshSupported", GMAX3100_vals[1], 4); Index: branches/ErmaC/Trunk/i386/libsaio/usb.c =================================================================== --- branches/ErmaC/Trunk/i386/libsaio/usb.c (revision 1750) +++ branches/ErmaC/Trunk/i386/libsaio/usb.c (revision 1751) @@ -244,7 +244,7 @@ //We try soft reset first - some systems hang on reboot with hard reset // Definitely needed during reboot on 10.4.6 - isOwnershipConflict = ((legacy[3] & 1 != 0) && (legacy[2] & 1 != 0)); + isOwnershipConflict = (((legacy[3] & 1) != 0) && ((legacy[2] & 1) != 0)); if (!alwaysHardBIOSReset && isOwnershipConflict) { DBG("EHCI - Ownership conflict - attempting soft reset ...\n"); DBG("EHCI - toggle OS Ownership to 0\n"); Index: branches/ErmaC/Trunk/i386/libsaio/nvidia.c =================================================================== --- branches/ErmaC/Trunk/i386/libsaio/nvidia.c (revision 1750) +++ branches/ErmaC/Trunk/i386/libsaio/nvidia.c (revision 1751) @@ -748,9 +748,9 @@ { 0x10DE0DC5, "GeForce GTS 450" }, { 0x10DE0DC6, "GeForce GTS 450" }, { 0x10DE0DCA, "GF10x" }, - // 0DD0 - 0DDF { 0x10DE0DCD, "GeForce GT 555M" }, // ErmaC { 0x10DE0DCE, "GeForce GT 555M" }, // ErmaC + // 0DD0 - 0DDF { 0x10DE0DD1, "GeForce GTX 460M" }, { 0x10DE0DD2, "GeForce GT 445M" }, { 0x10DE0DD3, "GeForce GT 435M" }, @@ -838,8 +838,8 @@ { 0x10DE1057, "NVS 4200M" }, // ErmaC // 1060 - 106F // 1070 - 107F + { 0x10DE107F, "NVIDIA GF119-ES" }, // ErmaC // 1080 - 108F - { 0x10DE107F, "NVIDIA GF119-ES" }, // ErmaC { 0x10DE1080, "GeForce GTX 580" }, { 0x10DE1081, "GeForce GTX 570" }, { 0x10DE1082, "GeForce GTX 560 Ti" }, @@ -1055,7 +1055,7 @@ channel1 |= ( 0x1 << entries[i].index); entries[i].type = TYPE_GROUPED; - if ((entries[i-1].type == 0x0)) + if ( entries[i-1].type == 0x0 ) { channel1 |= ( 0x1 << entries[i-1].index); entries[i-1].type = TYPE_GROUPED; @@ -1074,7 +1074,7 @@ channel2 |= ( 0x1 << entries[i].index); entries[i].type = TYPE_GROUPED; - if ((entries[i - 1].type == 0x0)) + if ( entries[i - 1].type == 0x0 ) { channel2 |= ( 0x1 << entries[i-1].index); entries[i-1].type = TYPE_GROUPED; @@ -1252,12 +1252,14 @@ vram_size *= REG32(NVC0_MEM_CTRLR_COUNT); } - // Workaround for GT 420/430 & 9600M GT + // Workaround for 9600M GT, GT 420/430/440 & GT 525M switch (nvda_dev->device_id) { + case 0x0649: vram_size = 512*1024*1024; break; // 9600M GT + case 0x0DE0: vram_size = 1024*1024*1024; break; // GT 440 case 0x0DE1: vram_size = 1024*1024*1024; break; // GT 430 case 0x0DE2: vram_size = 1024*1024*1024; break; // GT 420 - case 0x0649: vram_size = 512*1024*1024; break; // 9600M GT + case 0x0DEC: vram_size = 1024*1024*1024; break; // GT 525M default: break; } Index: branches/ErmaC/Trunk/i386/libsaio/ati.c =================================================================== --- branches/ErmaC/Trunk/i386/libsaio/ati.c (revision 1750) +++ branches/ErmaC/Trunk/i386/libsaio/ati.c (revision 1751) @@ -502,9 +502,9 @@ { 0x689C, 0x30201682, CHIP_FAMILY_HEMLOCK, "ATI Radeon HD 5970", kUakari }, - { 0x68A0, 0x043A1028, CHIP_FAMILY_BROADWAY, "ATI Mobility Radeon HD 5870", kNull }, // ErmaC + { 0x68A0, 0x043A1028, CHIP_FAMILY_BROADWAY, "ATI Mobility Radeon HD 5870", kNomascus }, // ErmaC - { 0x68A1, 0x144D103C, CHIP_FAMILY_CYPRESS, "ATI Mobility Radeon HD 5850", kNomascus }, + { 0x68A1, 0x144D103C, CHIP_FAMILY_CYPRESS, "ATI Mobility Radeon HD 5850", kNomascus }, { 0x68A1, 0x1522103C, CHIP_FAMILY_CYPRESS, "ATI Mobility Radeon HD 5850", kHoolock }, { 0x68A8, 0x050E1025, CHIP_FAMILY_CYPRESS, "AMD Radeon HD 6850M", kUakari }, @@ -513,7 +513,8 @@ { 0x68B8, 0x00CF106B, CHIP_FAMILY_JUNIPER, "ATI Radeon HD 5770", kHoolock }, - { 0x68B8, 0x21f61458, CHIP_FAMILY_JUNIPER, "GigaByte HD5770 R577SL-1GD", kVervet }, // ErmaC + { 0x68B8, 0x21D71458, CHIP_FAMILY_JUNIPER, "ATI Radeon HD 5770", kVervet }, + { 0x68B8, 0x21F61458, CHIP_FAMILY_JUNIPER, "GigaByte HD5770 R577SL-1GD", kVervet }, // ErmaC { 0x68B8, 0x29901682, CHIP_FAMILY_JUNIPER, "ATI Radeon HD 5770", kVervet }, { 0x68B8, 0x29911682, CHIP_FAMILY_JUNIPER, "ATI Radeon HD 5770", kVervet }, @@ -522,8 +523,6 @@ { 0x68B8, 0xE144174B, CHIP_FAMILY_JUNIPER, "ATI Radeon HD 5770", kHoolock }, // ErmaC { 0x68B8, 0xE147174B, CHIP_FAMILY_JUNIPER, "ATI Radeon HD 5770", kVervet }, - { 0x68B8, 0x21D71458, CHIP_FAMILY_JUNIPER, "ATI Radeon HD 5770", kVervet }, - { 0x68B8, 0x200A1787, CHIP_FAMILY_JUNIPER, "ATI Radeon HD 5770", kVervet }, // ErmaC { 0x68B8, 0x200B1787, CHIP_FAMILY_JUNIPER, "ATI Radeon HD 5770", kVervet }, { 0x68B8, 0x22881787, CHIP_FAMILY_JUNIPER, "ATI Radeon HD 5770", kVervet }, @@ -586,9 +585,9 @@ { 0x68E1, 0x1426103C, CHIP_FAMILY_CEDAR, "ATI Radeon HD 5430M", kEulemur }, - { 0x68F9, 0x010E1002, CHIP_FAMILY_CEDAR, "ATI Radeon HD 5450", kNull }, // ErmaC + { 0x68F9, 0x010E1002, CHIP_FAMILY_CEDAR, "ATI Radeon HD 5450", kEulemur }, // ErmaC - { 0x68F9, 0x03741043, CHIP_FAMILY_CEDAR, "ASUS EAH5450", kNull }, // ErmaC + { 0x68F9, 0x03741043, CHIP_FAMILY_CEDAR, "ASUS EAH5450", kEulemur }, // ErmaC { 0x68F9, 0x5470174B, CHIP_FAMILY_CEDAR, "ATI Radeon HD 5470", kNull }, { 0x68F9, 0x5490174B, CHIP_FAMILY_CEDAR, "ATI Radeon HD 5490", kNull }, @@ -613,15 +612,16 @@ { 0x6718, 0x67181002, CHIP_FAMILY_CAYMAN, "AMD Radeon HD 6970", kNull }, { 0x6718, 0x31301682, CHIP_FAMILY_CAYMAN, "AMD Radeon HD 6970", kNull }, - { 0x6719, 0x0B001002, CHIP_FAMILY_CAYMAN, "AMD Radeon HD 6950", kNull }, // ErmaC + { 0x6719, 0x0B001002, CHIP_FAMILY_CAYMAN, "AMD Radeon HD 6950", kGibba }, // ErmaC { 0x6719, 0x186B174B, CHIP_FAMILY_CAYMAN, "AMD Radeon HD 6950", kNull }, // ErmaC - { 0x6719, 0x20101787, CHIP_FAMILY_CAYMAN, "AMD Radeon HD 6970", kNull }, // ErmaC + { 0x6719, 0x20101787, CHIP_FAMILY_CAYMAN, "AMD Radeon HD 6950", kGibba }, // ErmaC { 0x671D, 0x10020B2A, CHIP_FAMILY_ANTILLES, "AMD Radeon HD 6990", kNull }, // ErmaC { 0x671D, 0x10021B2A, CHIP_FAMILY_ANTILLES, "AMD Radeon HD 6990", kNull }, // ErmaC { 0x671D, 0x16823160, CHIP_FAMILY_ANTILLES, "AMD Radeon HD 6990", kNull }, // ErmaC - { 0x6720, 0x04BA1028, CHIP_FAMILY_BARTS, "AMD Radeon HD 6970m", kElodea }, // ErmaC + { 0x6720, 0x04901028, CHIP_FAMILY_BARTS, "AMD Radeon HD 6970M", kNull }, // ErmaC + { 0x6720, 0x04BA1028, CHIP_FAMILY_BARTS, "AMD Radeon HD 6970M", kElodea }, // ErmaC { 0x6738, 0x00D01002, CHIP_FAMILY_BARTS, "AMD Radeon HD 6870", kDuckweed }, { 0x6738, 0x174B174B, CHIP_FAMILY_BARTS, "Sapphire Radeon HD6870", kBulrushes }, // ErmaC @@ -640,6 +640,7 @@ { 0x6738, 0x20101787, CHIP_FAMILY_BARTS, "AMD Radeon HD 6870", kDuckweed }, { 0x6738, 0x23051787, CHIP_FAMILY_BARTS, "AMD Radeon HD 6870", kDuckweed }, + { 0x6739, 0xAA881002, CHIP_FAMILY_BARTS, "AMD Radeon HD 6850", kDuckweed }, { 0x6739, 0x03B41043, CHIP_FAMILY_BARTS, "AMD Radeon HD 6850", kDuckweed }, // ErmaC { 0x6739, 0x21F81458, CHIP_FAMILY_BARTS, "AMD Radeon HD 6850", kBulrushes }, // ErmaC { 0x6739, 0x24411462, CHIP_FAMILY_BARTS, "AMD Radeon HD 6850", kDuckweed }, @@ -673,7 +674,8 @@ { 0x6760, 0x04CC1028, CHIP_FAMILY_CAICOS, "AMD Radeon HD 6490M", kNull }, - { 0x6760, 0x167D103C, CHIP_FAMILY_CAICOS, "AMD Radeon HD 6490M", kNull }, // ErmaC + { 0x6760, 0x165A103C, CHIP_FAMILY_CAICOS, "AMD Radeon HD 6470M", kNull }, + { 0x6760, 0x167D103C, CHIP_FAMILY_CAICOS, "AMD Radeon HD 6470M", kNull }, // ErmaC { 0x6760, 0x1CB21043, CHIP_FAMILY_CAICOS, "AMD Radeon HD 6470M", kNull }, @@ -750,12 +752,13 @@ { 0x689C, 0x00000000, CHIP_FAMILY_HEMLOCK, "ATI Radeon HD 5900 Series", kUakari }, { 0x689E, 0x00000000, CHIP_FAMILY_CYPRESS, "ATI Radeon HD 5800 Series", kUakari }, - { 0x68A0, 0x00000000, CHIP_FAMILY_BROADWAY, "ATI Mobility Radeon HD 5800 Series", kNull }, // ErmaC + { 0x68A0, 0x00000000, CHIP_FAMILY_BROADWAY, "ATI Mobility Radeon HD 5800 Series", kNomascus }, // ErmaC { 0x68A1, 0x00000000, CHIP_FAMILY_BROADWAY, "ATI Mobility Radeon HD 5800 Series", kNull }, // ErmaC { 0x68B0, 0x00000000, CHIP_FAMILY_BROADWAY, "ATI Mobility Radeon HD 5800 Series", kNull }, // ErmaC { 0x68B8, 0x00000000, CHIP_FAMILY_JUNIPER, "ATI Radeon HD 5700 Series", kVervet }, { 0x68B9, 0x00000000, CHIP_FAMILY_JUNIPER, "ATI Radeon HD 5600 Series", kVervet }, + { 0x68BA, 0x00000000, CHIP_FAMILY_JUNIPER, "ATI Radeon HD 6770 Series", kVervet }, { 0x68BE, 0x00000000, CHIP_FAMILY_JUNIPER, "ATI Radeon HD 5700 Series", kVervet }, { 0x68D8, 0x00000000, CHIP_FAMILY_REDWOOD, "ATI Radeon HD 5600 Series", kBaboon }, @@ -766,7 +769,7 @@ /* Northen Islands */ { 0x6718, 0x00000000, CHIP_FAMILY_CAYMAN, "AMD Radeon HD 6970 Series", kNull }, - { 0x6719, 0x00000000, CHIP_FAMILY_CAYMAN, "AMD Radeon HD 6950 Series", kNull }, + { 0x6719, 0x00000000, CHIP_FAMILY_CAYMAN, "AMD Radeon HD 6950 Series", kGibba }, { 0x671D, 0x00000000, CHIP_FAMILY_ANTILLES, "AMD Radeon HD 6900 Series", kNull }, // ErmaC { 0x671F, 0x00000000, CHIP_FAMILY_CAYMAN, "AMD Radeon HD 6900 Series", kNull }, // ErmaC Index: branches/ErmaC/Trunk/i386/libsaio/disk.c =================================================================== --- branches/ErmaC/Trunk/i386/libsaio/disk.c (revision 1750) +++ branches/ErmaC/Trunk/i386/libsaio/disk.c (revision 1751) @@ -131,6 +131,7 @@ unsigned int byteCount, void * buffer ) = NULL; int (*p_get_ramdisk_info)(int biosdev, struct driveInfo *dip) = NULL; +static bool getOSVersion(BVRef bvr, char *str); extern void spinActivityIndicator(int sectors); @@ -896,7 +897,8 @@ biosdev, partno, part->relsect, part, - 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + EX2GetUUID, EX2GetDescription, (BVFree)free, 0, kBIOSDevTypeHardDrive, 0); @@ -1143,7 +1145,7 @@ result = FDISK_NTFS; else if (BeFSProbe(probeBuffer)) result = FDISK_BEFS; - else if (fatbits=MSDOSProbe(probeBuffer)) + else if ( (fatbits = MSDOSProbe(probeBuffer)) ) { switch (fatbits) { @@ -1184,7 +1186,7 @@ struct DiskBVMap * map = NULL; void *buffer = malloc(BPS); int error; - if ( error = readBytes( biosdev, /*secno*/0, 0, BPS, buffer ) != 0) { + if ( (error = readBytes( biosdev, /*secno*/0, 0, BPS, buffer )) != 0) { verbose("Failed to read boot sector from BIOS device %02xh. Error=%d\n", biosdev, error); goto scanErr; } @@ -1427,6 +1429,48 @@ } } +static bool getOSVersion(BVRef bvr, char *str) +{ + bool valid = false; + config_file_t systemVersion; + char dirSpec[512]; + + sprintf(dirSpec, "hd(%d,%d)/System/Library/CoreServices/SystemVersion.plist", BIOS_DEV_UNIT(bvr), bvr->part_no); + + if (!loadConfigFile(dirSpec, &systemVersion)) + { + valid = true; + } + else + { + sprintf(dirSpec, "hd(%d,%d)/System/Library/CoreServices/ServerVersion.plist", BIOS_DEV_UNIT(bvr), bvr->part_no); + + if (!loadConfigFile(dirSpec, &systemVersion)) + { + bvr->OSisServer = true; + valid = true; + } + } + + if (valid) + { + const char *val; + int len; + + if (getValueForKey(kProductVersion, &val, &len, &systemVersion)) + { + // getValueForKey uses const char for val + // so copy it and trim + *str = '\0'; + strncat(str, val, MIN(len, 4)); + } + else + valid = false; + } + + return valid; +} + //========================================================================== static void scanFSLevelBVRSettings(BVRef chain) @@ -1479,18 +1523,10 @@ // if (bvr->flags & kBVFlagNativeBoot) { - sprintf(dirSpec, "hd(%d,%d)/System/Library/CoreServices/", BIOS_DEV_UNIT(bvr), bvr->part_no); - strcpy(fileSpec, "SystemVersion.plist"); - ret = GetFileInfo(dirSpec, fileSpec, &flags, &time); - - if (ret == -1) - { - strcpy(fileSpec, "ServerVersion.plist"); - ret = GetFileInfo(dirSpec, fileSpec, &flags, &time); - } - - if (!ret) - bvr->flags |= kBVFlagSystemVolume; + if (getOSVersion(bvr,bvr->OSVersion) == true) + { + bvr->flags |= kBVFlagSystemVolume; + } } } Index: branches/ErmaC/Trunk/i386/libsaio/smbios_decode.c =================================================================== --- branches/ErmaC/Trunk/i386/libsaio/smbios_decode.c (revision 1750) +++ branches/ErmaC/Trunk/i386/libsaio/smbios_decode.c (revision 1751) @@ -23,6 +23,40 @@ extern char *getSMBStringForField(SMBStructHeader *structHeader, uint8_t field); +static const char * +SMBMemoryDeviceTypes[] = +{ + "RAM", /* 00h Undefined */ + "RAM", /* 01h Other */ + "RAM", /* 02h Unknown */ + "DRAM", /* 03h DRAM */ + "EDRAM", /* 04h EDRAM */ + "VRAM", /* 05h VRAM */ + "SRAM", /* 06h SRAM */ + "RAM", /* 07h RAM */ + "ROM", /* 08h ROM */ + "FLASH", /* 09h FLASH */ + "EEPROM", /* 0Ah EEPROM */ + "FEPROM", /* 0Bh FEPROM */ + "EPROM", /* 0Ch EPROM */ + "CDRAM", /* 0Dh CDRAM */ + "3DRAM", /* 0Eh 3DRAM */ + "SDRAM", /* 0Fh SDRAM */ + "SGRAM", /* 10h SGRAM */ + "RDRAM", /* 11h RDRAM */ + "DDR SDRAM", /* 12h DDR */ + "DDR2 SDRAM", /* 13h DDR2 */ + "DDR2 FB-DIMM", /* 14h DDR2 FB-DIMM */ + "RAM", /* 15h unused */ + "RAM", /* 16h unused */ + "RAM", /* 17h unused */ + "DDR3", /* 18h DDR3, chosen in [5776134] */ +}; + +static const int +kSMBMemoryDeviceTypeCount = sizeof(SMBMemoryDeviceTypes) / + sizeof(SMBMemoryDeviceTypes[0]); + //------------------------------------------------------------------------------------------------------------------------- // BIOSInformation //------------------------------------------------------------------------------------------------------------------------- Index: branches/ErmaC/Trunk/i386/libsaio/smbios.h =================================================================== --- branches/ErmaC/Trunk/i386/libsaio/smbios.h (revision 1750) +++ branches/ErmaC/Trunk/i386/libsaio/smbios.h (revision 1751) @@ -386,40 +386,6 @@ SMBWord Data[]; } __attribute__((packed)) SMBMemorySPD; -static const char * -SMBMemoryDeviceTypes[] = -{ - "RAM", /* 00h Undefined */ - "RAM", /* 01h Other */ - "RAM", /* 02h Unknown */ - "DRAM", /* 03h DRAM */ - "EDRAM", /* 04h EDRAM */ - "VRAM", /* 05h VRAM */ - "SRAM", /* 06h SRAM */ - "RAM", /* 07h RAM */ - "ROM", /* 08h ROM */ - "FLASH", /* 09h FLASH */ - "EEPROM", /* 0Ah EEPROM */ - "FEPROM", /* 0Bh FEPROM */ - "EPROM", /* 0Ch EPROM */ - "CDRAM", /* 0Dh CDRAM */ - "3DRAM", /* 0Eh 3DRAM */ - "SDRAM", /* 0Fh SDRAM */ - "SGRAM", /* 10h SGRAM */ - "RDRAM", /* 11h RDRAM */ - "DDR SDRAM", /* 12h DDR */ - "DDR2 SDRAM", /* 13h DDR2 */ - "DDR2 FB-DIMM", /* 14h DDR2 FB-DIMM */ - "RAM", /* 15h unused */ - "RAM", /* 16h unused */ - "RAM", /* 17h unused */ - "DDR3", /* 18h DDR3, chosen in [5776134] */ -}; - -static const int -kSMBMemoryDeviceTypeCount = sizeof(SMBMemoryDeviceTypes) / - sizeof(SMBMemoryDeviceTypes[0]); - // // OEM Processor Type (Apple Specific - Type 131) // Index: branches/ErmaC/Trunk/i386/libsaio/convert.c =================================================================== --- branches/ErmaC/Trunk/i386/libsaio/convert.c (revision 1750) +++ branches/ErmaC/Trunk/i386/libsaio/convert.c (revision 1751) @@ -94,9 +94,9 @@ hexNibble = hexStr[hexStrIdx]; // ignore all chars except valid hex numbers - if (hexNibble >= '0' && hexNibble <= '9' - || hexNibble >= 'A' && hexNibble <= 'F' - || hexNibble >= 'a' && hexNibble <= 'f') + if ( (hexNibble >= '0' && hexNibble <= '9') || + (hexNibble >= 'A' && hexNibble <= 'F') || + (hexNibble >= 'a' && hexNibble <= 'f') ) { hexByte[hexNibbleIdx++] = hexNibble; Index: branches/ErmaC/Trunk/i386/libsaio/pci.h =================================================================== --- branches/ErmaC/Trunk/i386/libsaio/pci.h (revision 1750) +++ branches/ErmaC/Trunk/i386/libsaio/pci.h (revision 1751) @@ -43,7 +43,7 @@ struct pci_dt_t *next; } pci_dt_t; -#define PCIADDR(bus, dev, func) (1 << 31) | (bus << 16) | (dev << 11) | (func << 8) +#define PCIADDR(bus, dev, func) ((1 << 31) | (bus << 16) | (dev << 11) | (func << 8)) #define PCI_ADDR_REG 0xcf8 #define PCI_DATA_REG 0xcfc Index: branches/ErmaC/Trunk/i386/libsaio/saio_types.h =================================================================== --- branches/ErmaC/Trunk/i386/libsaio/saio_types.h (revision 1750) +++ branches/ErmaC/Trunk/i386/libsaio/saio_types.h (revision 1751) @@ -191,6 +191,8 @@ char altlabel[BVSTRLEN]; /* partition volume label */ bool filtered; /* newFilteredBVChain() will set to TRUE */ bool visible; /* will shown in the device list */ + char OSVersion[8]; + bool OSisServer; /* 1 = OS X server , 0 = OS X client */ }; enum { @@ -218,9 +220,9 @@ kPartitionTypeFAT16 = 0x06, kPartitionTypeFAT32 = 0x0c, kPartitionTypeEXT3 = 0x83, - kPartitionTypeBEFS = 0xEB, - kPartitionTypeFreeBSD = 0xa5, - kPartitionTypeOpenBSD = 0xa6 + kPartitionTypeBEFS = 0xEB, + kPartitionTypeFreeBSD = 0xa5, + kPartitionTypeOpenBSD = 0xa6 }; //#define BIOS_DEV_TYPE(d) ((d) & kBIOSDevTypeMask) Index: branches/ErmaC/Trunk/i386/libsaio/fake_efi.c =================================================================== --- branches/ErmaC/Trunk/i386/libsaio/fake_efi.c (revision 1750) +++ branches/ErmaC/Trunk/i386/libsaio/fake_efi.c (revision 1751) @@ -655,7 +655,7 @@ { // Check selected volume's Extra. sprintf(dirSpecSMBIOS, "/Extra/%s", filename); - if (err = loadConfigFile(dirSpecSMBIOS, &bootInfo->smbiosConfig)) + if ( (err = loadConfigFile(dirSpecSMBIOS, &bootInfo->smbiosConfig)) ) { // Check booter volume/rdbt Extra. sprintf(dirSpecSMBIOS, "bt(0,0)/Extra/%s", filename); Index: branches/ErmaC/Trunk/i386/include/klibc/compiler.h =================================================================== --- branches/ErmaC/Trunk/i386/include/klibc/compiler.h (revision 0) +++ branches/ErmaC/Trunk/i386/include/klibc/compiler.h (revision 1751) @@ -0,0 +1,158 @@ +/* + * klibc/compiler.h + * + * Various compiler features + */ + +#ifndef _KLIBC_COMPILER_H +#define _KLIBC_COMPILER_H + +/* Specific calling conventions */ +/* __cdecl is used when we want varadic and non-varadic functions to have + the same binary calling convention. */ +#ifdef __i386__ +# ifdef __GNUC__ +# define __cdecl __attribute__((cdecl,regparm(0))) +# else + /* Most other C compilers have __cdecl as a keyword */ +# endif +#else +# define __cdecl /* Meaningless on non-i386 */ +#endif + +/* + * How to declare a function which should be inlined or instantiated locally + */ +#ifdef __GNUC__ +# ifdef __GNUC_STDC_INLINE__ +# define __static_inline static __inline__ __attribute__((__gnu_inline__)) +# else +# define __static_inline static __inline__ +# endif +#else +# define __static_inline inline /* Just hope this works... */ +#endif + +/* + * How to declare a function which should be inlined or have a call to + * an external module + */ +#ifdef __GNUC__ +# ifdef __GNUC_STDC_INLINE__ +# define __extern_inline extern __inline__ __attribute__((__gnu_inline__)) +# else +# define __extern_inline extern __inline__ +# endif +#else +# define __extern_inline inline /* Just hope this works... */ +#endif + +/* How to declare a function that *must* be inlined */ +/* Use "extern inline" even in the gcc3+ case to avoid warnings in ctype.h */ +#ifdef __GNUC__ +# if __GNUC__ >= 3 +# define __must_inline __extern_inline __attribute__((__always_inline__)) +# else +# define __must_inline extern __inline__ +# endif +#else +# define __must_inline inline /* Just hope this works... */ +#endif + +/* How to declare a function that does not return */ +#ifdef __GNUC__ +# define __noreturn void __attribute__((noreturn)) +#else +# define __noreturn void +#endif + +/* "const" function: + + Many functions do not examine any values except their arguments, + and have no effects except the return value. Basically this is + just slightly more strict class than the `pure' attribute above, + since function is not allowed to read global memory. + + Note that a function that has pointer arguments and examines the + data pointed to must _not_ be declared `const'. Likewise, a + function that calls a non-`const' function usually must not be + `const'. It does not make sense for a `const' function to return + `void'. +*/ +#ifdef __GNUC__ +# define __constfunc __attribute__((const)) +#else +# define __constfunc +#endif +#undef __attribute_const__ +#define __attribute_const__ __constfunc + +/* "pure" function: + + Many functions have no effects except the return value and their + return value depends only on the parameters and/or global + variables. Such a function can be subject to common subexpression + elimination and loop optimization just as an arithmetic operator + would be. These functions should be declared with the attribute + `pure'. +*/ +#ifdef __GNUC__ +# define __purefunc __attribute__((pure)) +#else +# define __purefunc +#endif +#undef __attribute_pure__ +#define __attribute_pure__ __purefunc + +/* Format attribute */ +#ifdef __GNUC__ +# define __formatfunc(t,f,a) __attribute__((format(t,f,a))) +#else +# define __formatfunc(t,f,a) +#endif + +/* malloc() function (returns unaliased pointer) */ +#if defined(__GNUC__) && (__GNUC__ >= 3) +# define __mallocfunc __attribute__((malloc)) +#else +# define __mallocfunc +#endif + +/* likely/unlikely */ +#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)) +# define __likely(x) __builtin_expect(!!(x), 1) +# define __unlikely(x) __builtin_expect(!!(x), 0) +#else +# define __likely(x) (!!(x)) +# define __unlikely(x) (!!(x)) +#endif + +/* Possibly unused function */ +#ifdef __GNUC__ +# define __unusedfunc __attribute__((unused)) +#else +# define __unusedfunc +#endif + +/* It's all user space... */ +#define __user + +/* The bitwise attribute: disallow arithmetric operations */ +#ifdef __CHECKER__ /* sparse only */ +# define __bitwise __attribute__((bitwise)) +#else +# define __bitwise +#endif + +/* Shut up unused warnings */ +#ifdef __GNUC__ +# define __attribute_used__ __attribute__((used)) +#else +# define __attribute_used__ +#endif + +/* Compiler pragma to make an alias symbol */ +#define __ALIAS(__t, __f, __p, __a) \ + __t __f __p __attribute__((weak, alias(#__a))); + +#endif Index: branches/ErmaC/Trunk/i386/klibc/strlcpy.c =================================================================== --- branches/ErmaC/Trunk/i386/klibc/strlcpy.c (revision 0) +++ branches/ErmaC/Trunk/i386/klibc/strlcpy.c (revision 1751) @@ -0,0 +1,27 @@ +/* + * strlcpy.c + */ + +#include +#include + +size_t strlcpy(char *dst, const char *src, size_t size) +{ + size_t bytes = 0; + char *q = dst; + const char *p = src; + char ch; + + while ((ch = *p++)) { + if (bytes + 1 < size) + *q++ = ch; + + bytes++; + } + + /* If size == 0 there is no space for a final null... */ + if (size) + *q = '\0'; + + return bytes; +} Index: branches/ErmaC/Trunk/i386/klibc/LICENSE =================================================================== --- branches/ErmaC/Trunk/i386/klibc/LICENSE (revision 0) +++ branches/ErmaC/Trunk/i386/klibc/LICENSE (revision 1751) @@ -0,0 +1,73 @@ +This license applies to all files in directory and its subdirectories, +unless otherwise noted in individual files. + + +Some files are derived from files derived from the include/ directory +of the Linux kernel, and are licensed under the terms of the GNU +General Public License, version 2, as released by the Free Software +Foundation, Inc.; incorporated herein by reference. + + ----- + +Some files are derived from files copyrighted by the Regents of The +University of California, and are available under the following +license: + +Note: The advertising clause in the license appearing on BSD Unix +files was officially rescinded by the Director of the Office of +Technology Licensing of the University of California on July 22 +1999. He states that clause 3 is "hereby deleted in its entirety." + + * Copyright (c) + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + + ----- + +For all remaining files, the following license applies: + + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * Any copyright notice(s) and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Index: branches/ErmaC/Trunk/i386/klibc/Makefile =================================================================== --- branches/ErmaC/Trunk/i386/klibc/Makefile (revision 0) +++ branches/ErmaC/Trunk/i386/klibc/Makefile (revision 1751) @@ -0,0 +1,51 @@ +SRCROOT = $(abspath $(CURDIR)/../..) +OBJROOT = $(SRCROOT)/obj/i386/klibc +SYMROOT = $(SRCROOT)/sym/i386 +DSTROOT = $(SRCROOT)/dst/i386 +DOCROOT = $(SRCROOT)/doc +IMGROOT = $(SRCROOT)/sym/cache +IMGSKELROOT = $(SRCROOT)/imgskel +CDBOOT = ${IMGROOT}/usr/standalone/i386/cdboot + +DIR = klibc +include ${SRCROOT}/Make.rules + +# LIBSAIODIR = ../libsaio + +CFLAGS := $(CFLAGS) $(RC_CFLAGS) $(MORECPP) -arch i386 \ + -fno-builtin -static $(OMIT_FRAME_POINTER_CFLAG) \ + -mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \ + -march=pentium4 -msse2 -mfpmath=sse -msoft-float \ + -nostdinc -include $(SRCROOT)/autoconf.h + +CPPFLAGS := $(CPPFLAGS) -nostdinc++ + +INC = -I. -I$(SYMROOT) -I${SRCROOT}/i386/include + +OBJS = strlcpy.o + +OBJS := $(addprefix $(OBJROOT)/, $(OBJS)) + +LIBS = libklibc.a +LIBS := $(addprefix $(SYMROOT)/, $(LIBS)) + +DIRS_NEEDED = $(OBJROOT) $(SYMROOT) + +all embedtheme: $(DIRS_NEEDED) $(LIBS) + + +$(LIBS): $(OBJS) + @echo "\t[RM] $@" + @rm -f $@ + @echo "\t[AR] $(@F)" + @ar q $@ $^ &> /dev/null + @echo "\t[RANLIB] $(@F)" + @ranlib $@ + +# dependencies +-include $(OBJROOT)/Makedep + +clean-local: + @for o in $(OBJS); do if [ -f "$${o}" ];then echo "\t[RM] $${o}"; fi; done + @for l in $(LIBS); do if [ -f "$${l}" ];then echo "\t[RM] $${l}"; fi; done + @rm -f $(LIBS) $(OBJS) Index: branches/ErmaC/Trunk/i386/boot2/Makefile =================================================================== --- branches/ErmaC/Trunk/i386/boot2/Makefile (revision 1750) +++ branches/ErmaC/Trunk/i386/boot2/Makefile (revision 1751) @@ -35,8 +35,8 @@ THEMEDIR = ../../artwork/themes/$(THEME) INC = -I. -I$(SRCROOT) -I$(SYMDIR) -I$(LIBSADIR) -I$(LIBSAIODIR) -I${SRCROOT}/i386/include -LIBS= -L$(SYMDIR) -lsaio -lsa -LIBDEP= libsaio.a libsa.a +LIBS= -L$(SYMDIR) -lsaio -lsa -lklibc +LIBDEP= libsaio.a libsa.a libklibc.a OTHER_FILES = Index: branches/ErmaC/Trunk/i386/boot2/boot.c =================================================================== --- branches/ErmaC/Trunk/i386/boot2/boot.c (revision 1750) +++ branches/ErmaC/Trunk/i386/boot2/boot.c (revision 1751) @@ -81,7 +81,7 @@ BVRef bvr, menuBVR, bvChain; static bool checkOSVersion(const char * version); -static bool getOSVersion(); +static void getOSVersion(); static unsigned long Adler32(unsigned char *buffer, long length); //static void selectBiosDevice(void); @@ -759,36 +759,9 @@ && (gMacOSVersion[2] == version[2]) && (gMacOSVersion[3] == version[3])); } -bool getOSVersion() +static void getOSVersion() { - bool valid = false; - const char *val; - int len; - config_file_t systemVersion; - - if (!loadConfigFile("System/Library/CoreServices/SystemVersion.plist", &systemVersion)) - { - valid = true; - } - else if (!loadConfigFile("System/Library/CoreServices/ServerVersion.plist", &systemVersion)) - { - valid = true; - } - - if (valid) - { - if (getValueForKey(kProductVersion, &val, &len, &systemVersion)) - { - // getValueForKey uses const char for val - // so copy it and trim - *gMacOSVersion = '\0'; - strncat(gMacOSVersion, val, MIN(len, 4)); - } - else - valid = false; - } - - return valid; + strlcpy(gMacOSVersion, gBootVolume->OSVersion, sizeof(gMacOSVersion)); } #define BASE 65521L /* largest prime smaller than 65536 */ Index: branches/ErmaC/Trunk/i386/boot2/gui.c =================================================================== --- branches/ErmaC/Trunk/i386/boot2/gui.c (revision 1750) +++ branches/ErmaC/Trunk/i386/boot2/gui.c (revision 1751) @@ -15,7 +15,7 @@ #define IMG_REQUIRED -1 #define THEME_NAME_DEFAULT "Default" -static const char *theme_name = THEME_NAME_DEFAULT; +static const char *theme_name = THEME_NAME_DEFAULT; #ifdef CONFIG_EMBED_THEME #include "art.h" @@ -43,8 +43,24 @@ iDeviceGeneric_o, iDeviceHFS, iDeviceHFS_o, + iDeviceHFS_Lion, + iDeviceHFS_Lion_o, + iDeviceHFS_SL, + iDeviceHFS_SL_o, + iDeviceHFS_Leo, + iDeviceHFS_Leo_o, + iDeviceHFS_Tiger, + iDeviceHFS_Tiger_o, iDeviceHFSRAID, iDeviceHFSRAID_o, + iDeviceHFSRAID_Lion, + iDeviceHFSRAID_Lion_o, + iDeviceHFSRAID_SL, + iDeviceHFSRAID_SL_o, + iDeviceHFSRAID_Leo, + iDeviceHFSRAID_Leo_o, + iDeviceHFSRAID_Tiger, + iDeviceHFSRAID_Tiger_o, iDeviceEXT3, iDeviceEXT3_o, iDeviceFreeBSD, /* FreeBSD/OpenBSD detection,nawcom's code by valv, Icon credits to blackosx */ @@ -98,8 +114,25 @@ {.name = "device_generic_o", .image = NULL}, {.name = "device_hfsplus", .image = NULL}, {.name = "device_hfsplus_o", .image = NULL}, + {.name = "device_hfsplus_lion", .image = NULL}, + {.name = "device_hfsplus_lion_o", .image = NULL}, + {.name = "device_hfsplus_sl", .image = NULL}, + {.name = "device_hfsplus_sl_o", .image = NULL}, + {.name = "device_hfsplus_leo", .image = NULL}, + {.name = "device_hfsplus_leo_o", .image = NULL}, + {.name = "device_hfsplus_tiger", .image = NULL}, + {.name = "device_hfsplus_tiger_o", .image = NULL}, + {.name = "device_hfsraid", .image = NULL}, {.name = "device_hfsraid_o", .image = NULL}, + {.name = "device_hfsplus_raid_lion", .image = NULL}, + {.name = "device_hfsplus_raid_lion_o", .image = NULL}, + {.name = "device_hfsplus_raid_sl", .image = NULL}, + {.name = "device_hfsplus_raid_sl_o", .image = NULL}, + {.name = "device_hfsplus_raid_leo", .image = NULL}, + {.name = "device_hfsplus_raid_leo_o", .image = NULL}, + {.name = "device_hfsplus_raid_tiger", .image = NULL}, + {.name = "device_hfsplus_raid_tiger_o", .image = NULL}, {.name = "device_ext3", .image = NULL}, {.name = "device_ext3_o", .image = NULL}, {.name = "device_freebsd", .image = NULL}, /* FreeBSD/OpenBSD detection,nawcom's code by valv, Icon credits to blackosx */ @@ -156,7 +189,7 @@ extern char gBootArgs[BOOT_STRING_LEN]; char prompt_text[] = "boot: "; - + menuitem_t infoMenuItems[] = { { .text = "Boot" }, @@ -169,6 +202,7 @@ }; int initFont(font_t *font, image_t *image); +int destroyFont(font_t *font); void colorFont(font_t *font, uint32_t color); void makeRoundedCorners(pixmap_t *p); @@ -272,7 +306,7 @@ unsigned int embed_size; embed_data = embeddedImages[e].pngdata; embed_size = *embeddedImages[e].length; - + if (loadEmbeddedPngImage(embed_data, embed_size, &width, &height, &imagedata) == 0) { images[i].image->width = width; @@ -285,13 +319,24 @@ return 0; } #endif - else if (alt_image != IMG_REQUIRED && images[alt_image].image->pixels != NULL) + else if (alt_image != IMG_REQUIRED) { - // Using the passed alternate image for non-mandatory images. - // We don't clone the already existing pixmap, but using its properties instead! - images[i].image->width = images[alt_image].image->width; - images[i].image->height = images[alt_image].image->height; - images[i].image->pixels = images[alt_image].image->pixels; + if (images[alt_image].image->pixels != NULL) { + + // Using the passed alternate image for non-mandatory images. + // We don't clone the already existing pixmap, but using its properties instead! + images[i].image->width = images[alt_image].image->width; + images[i].image->height = images[alt_image].image->height; + images[i].image->pixels = images[alt_image].image->pixels; + + } else { + + // Unable to load or to find the image, this image not vital anyway, reseting and returning success !! + + free(images[i].image); + images[i].image = NULL; + } + return 0; } else @@ -300,8 +345,12 @@ printf("ERROR: GUI: could not open '%s/%s.png'!\n", theme_name, image); sleep(2); #endif - return 1; - } + free(images[i].image); + images[i].image = NULL; + return 1; + + } + } return 1; } @@ -315,8 +364,25 @@ LOADPNG(device_generic_o, iDeviceGeneric); LOADPNG(device_hfsplus, iDeviceGeneric); LOADPNG(device_hfsplus_o, iDeviceHFS); + LOADPNG(device_hfsplus_lion, iDeviceHFS_Lion); + LOADPNG(device_hfsplus_lion_o, iDeviceHFS_Lion_o); + LOADPNG(device_hfsplus_sl, iDeviceHFS_SL); + LOADPNG(device_hfsplus_sl_o, iDeviceHFS_SL_o); + LOADPNG(device_hfsplus_leo, iDeviceHFS_Leo); + LOADPNG(device_hfsplus_leo_o, iDeviceHFS_Leo_o); + LOADPNG(device_hfsplus_tiger, iDeviceHFS_Tiger); + LOADPNG(device_hfsplus_tiger_o, iDeviceHFS_Tiger_o); + LOADPNG(device_hfsraid, iDeviceGeneric); LOADPNG(device_hfsraid_o, iDeviceHFSRAID); + LOADPNG(device_hfsplus_raid_lion, iDeviceHFSRAID_Lion); + LOADPNG(device_hfsplus_raid_lion_o, iDeviceHFSRAID_Lion_o); + LOADPNG(device_hfsplus_raid_sl, iDeviceHFSRAID_SL); + LOADPNG(device_hfsplus_raid_sl_o, iDeviceHFSRAID_SL_o); + LOADPNG(device_hfsplus_raid_leo, iDeviceHFSRAID_Leo); + LOADPNG(device_hfsplus_raid_leo_o, iDeviceHFSRAID_Leo_o); + LOADPNG(device_hfsplus_raid_tiger, iDeviceHFSRAID_Tiger); + LOADPNG(device_hfsplus_raid_tiger_o, iDeviceHFSRAID_Tiger_o); LOADPNG(device_ext3, iDeviceGeneric); LOADPNG(device_ext3_o, iDeviceEXT3); LOADPNG(device_freebsd, iDeviceGeneric); /* FreeBSD/OpenBSD detection,nawcom's code by valv, Icon credits to blackosx */ @@ -366,7 +432,25 @@ return 0; } - + +static int unloadGraphics(void) +{ + int i; + + destroyFont(&font_console); + destroyFont(&font_small); + for (i = 0; i < sizeof(images) / sizeof(images[0]); i++) + { + if (images[i].image) + { + if (images[i].image->pixels) free(images[i].image->pixels); + free (images[i].image); + images[i].image = 0; + } + } + return 0; +} + pixmap_t *getCroppedPixmapAtPosition( pixmap_t *from, position_t pos, uint16_t width, uint16_t height ) { @@ -409,10 +493,23 @@ gui.backbuffer->width = gui.screen.width; gui.backbuffer->height = gui.screen.height; - + return 0; } +int freeBackBuffer( window_t *window ) +{ + if (gui.backbuffer && gui.backbuffer->pixels) + { + free(gui.backbuffer->pixels); + free(gui.backbuffer); + gui.backbuffer = 0; + return 0; + } + + return 1; +} + int createWindowBuffer( window_t *window ) { window->pixmap = malloc(sizeof(pixmap_t)); @@ -429,7 +526,7 @@ window->pixmap->width = window->width; window->pixmap->height = window->height; - + return 0; } @@ -441,7 +538,7 @@ free(window->pixmap); return 0; } - + return 1; } @@ -508,7 +605,7 @@ if(getDimensionForKey("devices_pos_y", &pixel, theme, gui.screen.height , gui.devicelist.height ) ) gui.devicelist.pos.y = pixel; break; - + case HorizontalLayout: default: gui.devicelist.width = ((images[iSelection].image->width + gui.devicelist.iconspacing) * MIN(gui.maxdevices, gDeviceCount) + (images[iDeviceScrollPrev].image->width + images[iDeviceScrollNext].image->width) + gui.devicelist.iconspacing); @@ -692,7 +789,7 @@ if(getColorForKey("font_console_color", &color, theme)) gui.screen.font_console_color = (color & 0x00FFFFFF); } - + int initGUI(void) { int val; @@ -761,9 +858,24 @@ } } } + + // not available memory, freeing resources + freeWindowBuffer(&gui.menu); + freeWindowBuffer(&gui.infobox); + freeWindowBuffer(&gui.bootprompt); + freeWindowBuffer(&gui.devicelist); + freeWindowBuffer(&gui.screen); + freeBackBuffer(&gui.screen); + unloadGraphics(); + return 1; } +bool is_image_loaded(int i) +{ + return (images[i].image != NULL) ? true : false; +} + void drawDeviceIcon(BVRef device, pixmap_t *buffer, position_t p, bool isSelected) { int devicetype; @@ -775,37 +887,82 @@ switch (device->part_type) { case kPartitionTypeHFS: + { // Use HFS or HFSRAID icon depending on bvr flags. - devicetype = (device->flags & kBVFlagBooter) ? iDeviceHFSRAID : iDeviceHFS; + if (device->flags & kBVFlagBooter) { + + switch (device->OSVersion[3]) { + case '7': + devicetype = is_image_loaded(iDeviceHFSRAID_Lion) ? iDeviceHFSRAID_Lion : is_image_loaded(iDeviceHFSRAID) ? iDeviceHFSRAID : iDeviceGeneric; + break; + case '6': + devicetype = is_image_loaded(iDeviceHFSRAID_SL) ? iDeviceHFSRAID_SL : is_image_loaded(iDeviceHFSRAID) ? iDeviceHFSRAID : iDeviceGeneric; + break; + case '5': + devicetype = is_image_loaded(iDeviceHFSRAID_Leo) ? iDeviceHFSRAID_Leo : is_image_loaded(iDeviceHFSRAID) ? iDeviceHFSRAID : iDeviceGeneric; + break; + case '4': + devicetype = is_image_loaded(iDeviceHFSRAID_Tiger) ? iDeviceHFSRAID_Tiger : is_image_loaded(iDeviceHFSRAID) ? iDeviceHFSRAID : iDeviceGeneric; + break; + default: + devicetype = is_image_loaded(iDeviceHFSRAID) ? iDeviceHFSRAID : iDeviceGeneric; + break; + } + + } + else + { + + switch (device->OSVersion[3]) { + case '7': + devicetype = is_image_loaded(iDeviceHFS_Lion) ? iDeviceHFS_Lion : is_image_loaded(iDeviceHFS) ? iDeviceHFS : iDeviceGeneric; + break; + case '6': + devicetype = is_image_loaded(iDeviceHFS_SL) ? iDeviceHFS_SL : is_image_loaded(iDeviceHFS) ? iDeviceHFS : iDeviceGeneric; + break; + case '5': + devicetype = is_image_loaded(iDeviceHFS_Leo) ? iDeviceHFS_Leo : is_image_loaded(iDeviceHFS) ? iDeviceHFS : iDeviceGeneric; + break; + case '4': + devicetype = is_image_loaded(iDeviceHFS_Tiger) ? iDeviceHFS_Tiger : is_image_loaded(iDeviceHFS) ? iDeviceHFS : iDeviceGeneric; + break; + default: + devicetype = is_image_loaded(iDeviceHFS) ? iDeviceHFS : iDeviceGeneric; + break; + } + + } + break; - + + } case kPartitionTypeHPFS: - devicetype = iDeviceNTFS; // Use HPFS / NTFS icon + devicetype = is_image_loaded(iDeviceNTFS) ? iDeviceNTFS : iDeviceGeneric; // Use HPFS / NTFS icon break; - case kPartitionTypeBEFS: /* Haiku detection and Icon credits to scorpius */ - devicetype = iDeviceBEFS; // Use BEFS / Haiku icon + case kPartitionTypeFAT16: + devicetype = is_image_loaded(iDeviceFAT16) ? iDeviceFAT16 : iDeviceGeneric; // Use FAT16 icon break; - case kPartitionTypeFreeBSD: /* FreeBSD/OpenBSD detection,nawcom's code by valv, Icon credits to blackosx */ - devicetype = iDeviceFreeBSD; // Use FreeBSD icon + case kPartitionTypeFAT32: + devicetype = is_image_loaded(iDeviceFAT32) ? iDeviceFAT32 : iDeviceGeneric; // Use FAT32 icon break; - - case kPartitionTypeOpenBSD: /* FreeBSD/OpenBSD detection,nawcom's code by valv, Icon credits to blackosx */ - devicetype = iDeviceOpenBSD; // Use OpenBSD icon + + case kPartitionTypeEXT3: + devicetype = is_image_loaded(iDeviceEXT3) ? iDeviceEXT3 : iDeviceGeneric; // Use EXT2/3 icon break; - - case kPartitionTypeFAT16: - devicetype = iDeviceFAT16; // Use FAT16 icon + + case kPartitionTypeFreeBSD: /* FreeBSD/OpenBSD detection,nawcom's code by valv, Icon credits to blackosx */ + devicetype = is_image_loaded(iDeviceFreeBSD) ? iDeviceFreeBSD : iDeviceGeneric; // Use FreeBSD icon break; - case kPartitionTypeFAT32: - devicetype = iDeviceFAT32; // Use FAT32 icon + case kPartitionTypeOpenBSD: /* FreeBSD/OpenBSD detection,nawcom's code by valv, Icon credits to blackosx */ + devicetype = is_image_loaded(iDeviceOpenBSD) ? iDeviceOpenBSD : iDeviceGeneric; // Use OpenBSD icon break; - case kPartitionTypeEXT3: - devicetype = iDeviceEXT3; // Use EXT2/3 icon + case kPartitionTypeBEFS: /* Haiku detection and Icon credits to scorpius */ + devicetype = is_image_loaded(iDeviceBEFS) ? iDeviceBEFS : iDeviceGeneric;// Use BEFS / Haiku icon break; default: @@ -818,7 +975,7 @@ if (isSelected) { blend(images[iSelection].image, buffer, centeredAt(images[iSelection].image, p)); - devicetype++; + devicetype++; // selec override image } // draw icon @@ -839,7 +996,7 @@ position_t p, p_prev, p_next; //uint8_t maxDevices = MIN( gui.maxdevices, menucount ); - + fillPixmapWithColor( gui.devicelist.pixmap, gui.devicelist.bgcolor); makeRoundedCorners( gui.devicelist.pixmap); @@ -889,7 +1046,7 @@ if(infoMenuSelection >= INFOMENU_NATIVEBOOT_START && infoMenuSelection <= INFOMENU_NATIVEBOOT_END) infoMenuSelection = 0; } - + if (gui.menu.draw) drawInfoMenuItems(); @@ -942,7 +1099,7 @@ updateVRAM(); } - + void clearGraphicBootPrompt() { // clear text buffer @@ -1016,7 +1173,7 @@ // break; case 15: *(uint16_t *)(((uint8_t *)vram)+i*VIDEO (rowBytes) + j*2) = ((b&0xf8)>>3) | ((g&0xf8)<<2) | ((r&0xf8)<<7); - break; + break; } } } @@ -1031,14 +1188,14 @@ if (gui.bootprompt.draw) blend( gui.bootprompt.pixmap, gui.backbuffer, gui.bootprompt.pos ); - + if (gui.menu.draw) blend( gui.menu.pixmap, gui.backbuffer, gui.menu.pos ); if (gui.infobox.draw) blend( gui.infobox.pixmap, gui.backbuffer, gui.infobox.pos ); } - + vramwrite ( gui.backbuffer->pixels, gui.backbuffer->width, gui.backbuffer->height ); if (gui.redraw) @@ -1095,15 +1252,15 @@ bounds.y = ( window->height - window->vborder ); cursor = origin; - + font_t *font = &font_console; - + for( i=0; i< strlen(formattedtext); i++ ) { character = formattedtext[i]; character -= 32; - + // newline ? if( formattedtext[i] == '\n' ) { @@ -1115,7 +1272,7 @@ continue; } - + // tab ? if( formattedtext[i] == '\t' ) cursor.x += ( font->chars[0]->width * 5 ); @@ -1258,7 +1415,7 @@ bounds.x = ( window->width - ( window->hborder * 2 ) ); bounds.y = ( window->height - ( window->vborder * 2 ) ); cursor = origin; - + for( i=0; i< strlen(formattedtext); i++ ) { character = formattedtext[i]; @@ -1293,7 +1450,7 @@ cursor.x = origin.x; cursor.y += font->height; } - + // check y pos and reset to origin.y if ( cursor.y > ( bounds.y + font->chars[0]->height) ) { @@ -1405,7 +1562,7 @@ for( x = 0; x < data->image->width && count < CHARACTERS_COUNT; x++) { start = end; - + // if the pixel is red we've reached the end of the char if( pixel( data->image, x, 0 ).value == 0xFFFF0000) { @@ -1431,7 +1588,7 @@ // check if font is monospaced if( ( count > 0 ) && ( font->width != font->chars[count]->width ) ) monospaced = true; - + font->width = font->chars[count]->width; count++; @@ -1451,6 +1608,21 @@ return 0; } +int destroyFont(font_t *font) +{ + int i; + for (i = 0; i < CHARACTERS_COUNT; i++) + { + if (font->chars[i]) + { + if (font->chars[i]->pixels) free (font->chars[i]->pixels); + free (font->chars[i]); + font->chars[i] = 0; + } + } + return 0; +} + void colorFont(font_t *font, uint32_t color) { if( !color ) @@ -1588,11 +1760,11 @@ break; } } - + fillPixmapWithColor( gui.infobox.pixmap, gui.infobox.bgcolor); makeRoundedCorners( gui.infobox.pixmap); - + // print the title if present if( title ) drawStr(title, &font_console, gui.infobox.pixmap, pos_title); @@ -1642,7 +1814,7 @@ updateVRAM(); break; } - + if(key == ' ') // spacebar = next page { if( lines > ( currentline + visiblelines ) ) @@ -1714,7 +1886,7 @@ for(x=todraw, x2 = 0; x < width - 1; x++, x2++) { if(x2 == (buffBG->width -2 )) x2 = 0; - pixel(&progressbar, x,y).value = pixel(buffBG, x2,y).value; + pixel(&progressbar, x,y).value = pixel(buffBG, x2,y).value; } if(progress < 100) pixel(&progressbar, width - 1, y).value = pixel(buffBG, buffBG->width - 1, y).value; @@ -1722,7 +1894,7 @@ pixel(&progressbar, 0, y).value = pixel(buffBG, buffBG->width - 1, y).value; x2=0; } - + blend(&progressbar, blendInto, p); animateProgressBar(); free(progressbar.pixels); @@ -1829,7 +2001,7 @@ else if( infoMenuSelection == MENU_SHOW_HELP ) showHelp(); - + else { int buff = infoMenuSelection; Index: branches/ErmaC/Trunk/i386/boot2/gui.h =================================================================== --- branches/ErmaC/Trunk/i386/boot2/gui.h (revision 1750) +++ branches/ErmaC/Trunk/i386/boot2/gui.h (revision 1751) @@ -19,23 +19,23 @@ #define CHARACTERS_COUNT 223 -#define BOOT_NORMAL 0 +#define BOOT_NORMAL 0 #define BOOT_VERBOSE 1 #define BOOT_IGNORECACHE 2 #define BOOT_SINGLEUSER 3 -#define DO_NOT_BOOT 4 +#define DO_NOT_BOOT 4 #define CLOSE_INFO_MENU 5 -#define INFOMENU_NATIVEBOOT_START 1 -#define INFOMENU_NATIVEBOOT_END 3 +#define INFOMENU_NATIVEBOOT_START 1 +#define INFOMENU_NATIVEBOOT_END 3 -#define MENU_SHOW_MEMORY_INFO 4 -#define MENU_SHOW_VIDEO_INFO 5 -#define MENU_SHOW_HELP 6 +#define MENU_SHOW_MEMORY_INFO 4 +#define MENU_SHOW_VIDEO_INFO 5 +#define MENU_SHOW_HELP 6 enum { HorizontalLayout = 0, - VerticalLayout = 1 + VerticalLayout = 1, }; /* @@ -124,6 +124,7 @@ void drawBackground(); void setupDeviceList(config_file_t *theme); +bool is_image_loaded(int i); void drawDeviceIcon(BVRef device, pixmap_t *buffer, position_t p, bool isSelected); void drawDeviceList(int start, int end, int selection); void drawProgressBar(pixmap_t *blendInto, uint16_t width, position_t p, uint8_t progress); Index: branches/ErmaC/Trunk/i386/boot2/options.c =================================================================== --- branches/ErmaC/Trunk/i386/boot2/options.c (revision 1750) +++ branches/ErmaC/Trunk/i386/boot2/options.c (revision 1751) @@ -135,7 +135,7 @@ lasttime=time18(); } - if (ch = readKeyboardStatus()) + if ( (ch = readKeyboardStatus()) ) break; // Count can be interrupted by holding down shift, Index: branches/ErmaC/Trunk/i386/libsa/string.c =================================================================== --- branches/ErmaC/Trunk/i386/libsa/string.c (revision 1750) +++ branches/ErmaC/Trunk/i386/libsa/string.c (revision 1751) @@ -172,7 +172,7 @@ strcpy(char * s1, const char * s2) { register char *ret = s1; - while (*s1++ = *s2++) + while ((*s1++ = *s2++)) continue; return ret; } @@ -186,15 +186,6 @@ return ret; } -size_t -strlcpy(char * s1, const char * s2, size_t n) -{ - while (n && (*s1++ = *s2++)) - n--; - if (!n) *--s1=0; - return strlen(s2); -} - char * strstr(const char *in, const char *str) { Index: branches/ErmaC/Trunk/i386/libsa/prf.c =================================================================== --- branches/ErmaC/Trunk/i386/libsa/prf.c (revision 1750) +++ branches/ErmaC/Trunk/i386/libsa/prf.c (revision 1751) @@ -151,7 +151,7 @@ break; case 's': s = (char *)*adx; - while (c = *s++) { + while ((c = *s++)) { (*putfn_p)(c, putfn_arg); width++; } Index: branches/ErmaC/Trunk/i386/libsa/strtol.c =================================================================== --- branches/ErmaC/Trunk/i386/libsa/strtol.c (revision 1750) +++ branches/ErmaC/Trunk/i386/libsa/strtol.c (revision 1751) @@ -148,7 +148,7 @@ break; if (c >= base) break; - if (any < 0 || acc > cutoff || acc == cutoff && c > cutlim) + if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim)) any = -1; else { any = 1; @@ -220,7 +220,7 @@ break; if (c >= base) break; - if (any < 0 || acc > cutoff || acc == cutoff && c > cutlim) + if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim)) any = -1; else { any = 1; @@ -291,7 +291,7 @@ break; if (c >= base) break; - if (any < 0 || acc > cutoff || acc == cutoff && c > cutlim) + if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim)) any = -1; else { any = 1; Index: branches/ErmaC/Trunk/i386/Makefile =================================================================== --- branches/ErmaC/Trunk/i386/Makefile (revision 1750) +++ branches/ErmaC/Trunk/i386/Makefile (revision 1751) @@ -16,7 +16,7 @@ # The order of building is important. SUBDIRS_PRE = util -SUBDIRS = $(SUBDIRS_PRE) libsa libsaio boot0 boot1 boot2 cdboot modules +SUBDIRS = $(SUBDIRS_PRE) klibc libsa libsaio boot0 boot1 boot2 cdboot modules modules-builtin: @cd modules; ${MAKE} BUILT_IN=yes Index: branches/ErmaC/Trunk/package/Distribution =================================================================== --- branches/ErmaC/Trunk/package/Distribution (revision 1750) +++ branches/ErmaC/Trunk/package/Distribution (revision 1751) @@ -2,51 +2,45 @@ - + + - + + + + + - - - - - + Chameleon_title - Chameleon_title + + function chameleon_boot_plist_exists() { + return system.files.fileExistsAtPath(my.target.mountpoint + '/Extra/org.chameleon.Boot.plist'); + } + + Index: branches/ErmaC/Trunk/package/Changes.txt =================================================================== --- branches/ErmaC/Trunk/package/Changes.txt (revision 0) +++ branches/ErmaC/Trunk/package/Changes.txt (revision 1751) @@ -0,0 +1,47 @@ +- Keylayout / Keymaps fixed and made a mandatory install. + +- Add option to upgrade an existing install - or more exactly, merge newly selected options with an existing /Extra folder. Also, rename an existing /Extra/com.apple.Boot.plist to /Extra/org.chameleon.Boot.plist. + +- Change the layout/wording displayed in the installer (English only) and give it a facelift. Adjust background image to scale to fit in the window. + +- Set exclusive 'None' option to default choice. + +- Add code to detect and make necessary changes to avoid possibility of a b1f:error or boot1:error should the user decide to install a secondary boot partition. + +- Fix bug installing to /Volumes/EFI + +- Add crazybirdy's Chinese translation to zh-CN and zh-TW resources. + +- Add dmaazar's boot0workV2 changes to ../i386/boot0/boot0md.s. + +- Added check for an existing Chameleon installation on a different partition of same target disk to help stop new +users from confusing themselves. If found, the install process will exit and write the reason to the install log. + +- Re-organised Scripts folder in to Main and Sub scripts. The main scripts for the standard and EFI system partition +installation options have been changed to used the code that I'd previously re-structured. The Sub scripts are the +original chameleon installer scripts with maybe some tweaks/additions, split in to separate scripts. These scripts +include the previous additions I'd made including checking for FAT16 partitions, installing boot0md or boot0 depending +on whether or not a Windows installation is found and writing boot1h or boot1f32 depending on installing to HFS or +FAT32 format partitions. + +- All references of Boot0hfs removed and now replaced with Boot0md. + +- Installer log added to now dump a log of useful info about the install process to the root of the selected target. + +- Boot options re-thought and are now automatically created at compile time from simple lists, rather than manage a +separate file of code of each option. + +- Added missing useKernelCache boot option. + +- Easily enable a list to be exclusive or not. + +- The main Post script now creates the org.chameleon.Boot.plist based on the modules / options / key layouts / themes +selected by the user. + +- Only create and /Extra folder if there's something to go in it. + +- Backup an existing /Extra folder to /Extra-OLD(date & time). + +- slimpkg.sh changed to match the revised code in buildpkg.sh where applicable. + +- English Localizable.strings revised to match latest additions and some texts updated. \ No newline at end of file Index: branches/ErmaC/Trunk/package/Scripts/Main/ESPpostinstall =================================================================== --- branches/ErmaC/Trunk/package/Scripts/Main/ESPpostinstall (revision 1750) +++ branches/ErmaC/Trunk/package/Scripts/Main/ESPpostinstall (revision 1751) @@ -56,6 +56,8 @@ targetResources="${targetVolumeChosenByUser}/usr/local/bin/" +efiPartitionExist=0 # target volume does not have EFI system partition. + echo "===============================================" echo "DEBUG: display script variables" echo "***************************" @@ -92,14 +94,18 @@ 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. + # The following script returns either 0 or 1 to proceed, or 2 to indicate failure. "$scriptDir"CheckProceed.sh "${targetVolume}" "${targetDeviceChosenByUser}" "${targetVolumeChosenByUser}" "${scriptDir}" returnValue=$? - if [ ${returnValue} = 0 ]; then + if [ ${returnValue} -ne 2 ]; then # OK to proceed + # Remember if the target volume has an EFI system partition. + if [ ${returnValue} -ne 1 ]; then + efiPartitionExist=1 + fi # Does a GRUB or Linux loader already exist in the disk's MBR? # The script returns 1 if yes, 0 if no. @@ -157,12 +163,14 @@ # OK to proceed # Mount the EFI system partition - "$scriptDir"MountESP.sh "${targetDisk}" "${targetVolumeChosenByUser}" "${scriptDir}" + "$scriptDir"MountESP.sh "${targetDisk}" "${targetVolumeChosenByUser}" "${efiPartitionExist}" "${scriptDir}" # Write the stage 2 loader to the root of the selected partition "$scriptDir"WriteChameleonStage2.sh "${stage2Loader}" "${targetVolume}" "${targetDevice}" "${targetVolumeChosenByUser}" "${scriptDir}" # Check for another existing Chameleon installation on the same disk + "$scriptDir"InstallLog.sh "${targetVolume}" "LineBreak" + "$scriptDir"InstallLog.sh "${targetVolume}" "Preparing to check target disk for previous installations." "$scriptDir"CheckPreviousChameleon.sh "${targetDisk}" "${targetDeviceRaw}" "${targetDevice}" "${targetVolumeChosenByUser}" "${scriptDir}" fi Index: branches/ErmaC/Trunk/package/Scripts/Main/postinstall =================================================================== --- branches/ErmaC/Trunk/package/Scripts/Main/postinstall (revision 1750) +++ branches/ErmaC/Trunk/package/Scripts/Main/postinstall (revision 1751) @@ -20,10 +20,10 @@ # / with volume name. if [ "$3" == "/" ] then - dest_vol="/Volumes/"$( ls -1F /Volumes | sed -n 's:@$::p' ) + dest_vol="/Volumes/"$( ls -1F /Volumes | sed -n 's:@$::p' ) else dest_vol="$3" -fi +fi # Find script location so to find the Install Log script. MYLOCATION="${PWD}/${BASH_ARGV[0]}" @@ -37,261 +37,245 @@ # set temporary directory chamTemp="$dest_vol/usr/local/chamTemp" -# Check for stopped installation due to Chameleon -# already existing on the same disk. -# TO DO - This check can be removed as it's no longer used!! -if [ ! -f "$dest_vol"/.ChameleonExists ]; then +# --------------------------------------------- +# 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 - # --------------------------------------------- - # 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}" "Added module: $FILE" - done +# 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 - - # --------------------------------------------- - # 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}" "Added 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 + tempOCBP="$chamTemp"/Extra/org.chameleon.Boot.plist - # Are there any options to build? - if [ "$(ls -A ${chamTemp}/options )" ]; then + # Create template for org.chameleon.Boot.plist" + tempOCBP="$chamTemp"/Extra/org.chameleon.Boot.plist + cp "$4"/Library/Preferences/SystemConfiguration/com.apple.Boot.plist "$tempOCBP" - # Check for temporary directory/Extra folder. - if [ ! -d "$chamTemp"/Extra ]; then - mkdir "$chamTemp"/Extra + # 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 ) - tempOCBP="$chamTemp"/Extra/org.chameleon.Boot.plist - - # 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 + if [ $kernelFlagCount -gt 0 ]; then + # Add any kernel flags together in to one string. + for (( i=0 ; i < $kernelFlagCount ; i++ )) 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 any kernel flags together in to one string. - for (( i=0 ; i < $kernelFlagCount ; i++ )) - do - kernelFlagString="${kernelFlagString} ${kernelflag[i]}" - done - # We add the final string in the next section. - fi + kernelFlagString="${kernelFlagString} ${kernelflag[i]}" + done + # We add the final string in the next section. fi - +fi + +# --------------------------------------------- +# 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}" "Added module: $FILE" + if [ "$FILE" == "Keylayout.dylib" ]; then + "$scriptDir"InstallLog.sh "${dest_vol}" "Also adding required Keymaps." + fi + 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}" "Added Theme: $FILE" + done +fi + +# Does a temporary /Extra folder exist? +if [ -d "$chamTemp"/Extra ]; then + # --------------------------------------------- # Merge /Extra folders? # --------------------------------------------- # Does the user want to upgrade an existing /Extra folder? - # If so, then merge their existing one in to the temp one - if [ -e "$chamTemp/install_type_upgrade" ]; then - "$scriptDir"InstallLog.sh "${dest_vol}" "User selected to do an upgrade install." - - # first move the new org.chameleon.Boot.plist out of tmp - # Extra folder so we can merge that separately. - mv "$tempOCBP" "$chamTemp/holding.plist" - - # Check for an existing /Extra folder - # and merge existing /Extra with temp one. - if [ -e "$dest_vol"/.ChameleonEFI ]; then - if [ -e "/Volumes/EFI/Extra" ]; then - "$scriptDir"InstallLog.sh "${dest_vol}" "Merging existing /Volumes/EFI/Extra folder." - ditto --noextattr --noqtn /Volumes/EFI/Extra "$chamTemp"/Extra - fi - else - if [ -e "$dest_vol/Extra" ]; then - "$scriptDir"InstallLog.sh "${dest_vol}" "Merging existing ${dest_vol}/Extra folder." - ditto --noextattr --noqtn "${dest_vol}"/Extra "$chamTemp"/Extra - fi - fi - - # Check existing plist name for old naming convention - # and change to new convention. - if [ -e "$chamTemp"/Extra/com.apple.Boot.plist ]; then - "$scriptDir"InstallLog.sh "${dest_vol}" "Renaming existing com.apple.Boot.plist to org.chameleon.Boot.plist." - mv "$chamTemp"/Extra/com.apple.Boot.plist "$tempOCBP" - fi - - # Before merging org.chameleon.Boot.plist, copy any - # existing kernel flags, then delete the entry. - currentFlags=$( sudo /usr/libexec/plistbuddy -c "Print :Kernel\ Flags" "$tempOCBP" ) - sudo /usr/libexec/plistbuddy -c "Delete :Kernel\ Flags" "$tempOCBP" - - # Merge new org.chameleon.Boot.plist (holding.plist) - # with their currently existing one. - "$scriptDir"InstallLog.sh "${dest_vol}" "Merging new options into org.chameleon.Boot.plist. + # If so, then merge their existing one in to the temp one. + if [ -e "$chamTemp/install_type_upgrade" ]; then + "$scriptDir"InstallLog.sh "${dest_vol}" "User selected to do an upgrade install." + + # first move the new org.chameleon.Boot.plist out of tmp + # Extra folder so we can merge that separately. + mv "$tempOCBP" "$chamTemp/holding.plist" + + # Check for an existing /Extra folder + # and merge existing /Extra with temp one. + if [ -e "$dest_vol"/.ChameleonEFI ]; then + if [ -e "/Volumes/EFI/Extra" ]; then + "$scriptDir"InstallLog.sh "${dest_vol}" "Merging existing /Volumes/EFI/Extra folder." + ditto --noextattr --noqtn /Volumes/EFI/Extra "$chamTemp"/Extra + fi + else + if [ -e "$dest_vol/Extra" ]; then + "$scriptDir"InstallLog.sh "${dest_vol}" "Merging existing ${dest_vol}/Extra folder." + ditto --noextattr --noqtn "${dest_vol}"/Extra "$chamTemp"/Extra + fi + fi + + # Check existing plist name for old naming convention + # and change to new convention. + if [ -e "$chamTemp"/Extra/com.apple.Boot.plist ]; then + "$scriptDir"InstallLog.sh "${dest_vol}" "Renaming existing com.apple.Boot.plist to org.chameleon.Boot.plist." + mv "$chamTemp"/Extra/com.apple.Boot.plist "$tempOCBP" + fi + + # Before merging org.chameleon.Boot.plist, copy any + # existing kernel flags, then delete the entry. + currentFlags=$( sudo /usr/libexec/plistbuddy -c "Print :Kernel\ Flags" "$tempOCBP" ) + sudo /usr/libexec/plistbuddy -c "Delete :Kernel\ Flags" "$tempOCBP" + + # Merge new org.chameleon.Boot.plist (holding.plist) + # with their currently existing one. + "$scriptDir"InstallLog.sh "${dest_vol}" "------ +Merging new options into org.chameleon.Boot.plist. NOTE: Please check the new merged org.chameleon.Boot.plist as NOTE: any existing keys will NOT have been updated. NOTE: For example: If you already had Wait=No as a boot option -NOTE: and chose Wait=Yes from the list, this will NOT be changed." - sudo /usr/libexec/plistbuddy -c "Merge $chamTemp/holding.plist" "$tempOCBP" - - # Combine new kernel flags with old ones. - kernelFlagString="${kernelFlagString} $currentFlags" - # Write complete kernel flag entry back. - 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 - - elif [ -e "$chamTemp/install_type_new" ]; then - "$scriptDir"InstallLog.sh "${dest_vol}" "User selected to make a new install." - # Add kernel flags (if any) - if [ $kernelFlagCount -gt 0 ]; then - 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 - +NOTE: and chose Wait=Yes from the list, this will NOT be changed. +------" + sudo /usr/libexec/plistbuddy -c "Merge $chamTemp/holding.plist" "$tempOCBP" + + if [[ -n "$currentFlags" ]];then + # Combine new kernel flags with old ones. + kernelFlagString="${kernelFlagString} $currentFlags" + fi + + elif [ -e "$chamTemp/install_type_new" ]; then + "$scriptDir"InstallLog.sh "${dest_vol}" "User selected to make a new install." + fi + + # Write kernel flags option + kernelFlagString=$(echo ${kernelFlagString}) # Remove leading and trailing spaces + if [[ -n "$kernelFlagString" ]];then + sudo /usr/libexec/plistbuddy -c "Add :Kernel\ Flags string $kernelFlagString" "$tempOCBP" + returnValue=$? + if [ ${returnValue} -ne 0 ]; 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 + # --------------------------------------------- # 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 + # 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 + 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}" "Moving $dest_vol/Extra folder to $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 new Extra folder to: $dest_vol/" - echo "Copying $chamTemp/Extra TO $dest_vol" - 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}" "Moving /Volumes/EFI/Extra folder to /Volumes/EFI/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 new Extra folder to: /Volumes/EFI/" - cp -R "$chamTemp"/Extra "/Volumes/EFI" + # Does an /Extra folder already exist? + if [ -e "$dest_vol"/Extra ]; then + "$scriptDir"InstallLog.sh "${dest_vol}" "Moving $dest_vol/Extra folder to $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 new Extra folder to: $dest_vol/" + echo "Copying $chamTemp/Extra TO $dest_vol" + cp -R "$chamTemp"/Extra "$dest_vol" else - if [ ! -f "$dest_vol"/.ChameleonEFI ]; then - if [ -e "$dest_vol"/Extra ]; then - "$scriptDir"InstallLog.sh "${dest_vol}" "No elements selected for adding to an Extra folder, + # 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}" "Moving /Volumes/EFI/Extra folder to /Volumes/EFI/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 new Extra folder to: /Volumes/EFI/" + cp -R "$chamTemp"/Extra "/Volumes/EFI" + fi +else + if [ ! -f "$dest_vol"/.ChameleonEFI ]; then + if [ -e "$dest_vol"/Extra ]; then + "$scriptDir"InstallLog.sh "${dest_vol}" "No elements selected for adding to an Extra folder, so leaving existing $dest_vol/Extra folder untouched." - fi - else - if [ -e "/Volumes/EFI/Extra" ]; then - "$scriptDir"InstallLog.sh "${dest_vol}" "No elements selected for adding to an Extra folder, + fi + else + if [ -e "/Volumes/EFI/Extra" ]; then + "$scriptDir"InstallLog.sh "${dest_vol}" "No elements selected for adding to an Extra folder, so leaving existing /Volumes/EFI/Extra folder untouched." - fi fi fi - - # Unmount ALL mounted volumes named EFI - "$scriptDir"UnMountEFIvolumes.sh "${dest_vol}" "${scriptDir}" -else - cleanUp="${cleanUp},0" - rm "$dest_vol"/.ChameleonExists fi # --------------------------------------------- # Cleanup # --------------------------------------------- +# Unmount ALL mounted volumes named EFI +"$scriptDir"UnMountEFIvolumes.sh "${dest_vol}" "${scriptDir}" + # remove any temporary boot sector files if they exist if [ -d /tmp/newbs ]; then - cleanUp="${cleanUp},1a" - rm /tmp/newbs + cleanUp="${cleanUp},1a" + rm /tmp/newbs fi if [ -d /tmp/origbs ]; then - cleanUp="${cleanUp},1b" - rm /tmp/origbs + cleanUp="${cleanUp},1b" + rm /tmp/origbs fi if [ -d /tmp/newBootSector ]; then - cleanUp="${cleanUp},1c" - rm /tmp/newbs + cleanUp="${cleanUp},1c" + rm /tmp/newbs fi if [ -d /tmp/originalBootSector ]; then - cleanUp="${cleanUp},1d" - rm /tmp/origbs + cleanUp="${cleanUp},1d" + rm /tmp/origbs fi # delete the temporary Chameleon folder if [ -e "$chamTemp" ]; then - cleanUp="${cleanUp},2" - rm -rf "$chamTemp" + cleanUp="${cleanUp},2" + rm -rf "$chamTemp" fi # Remove /.ChameleonEFI file if [ -f "$dest_vol"/.ChameleonEFI ]; then - cleanUp="${cleanUp},3" - rm "$dest_vol"/.ChameleonEFI + cleanUp="${cleanUp},3" + rm "$dest_vol"/.ChameleonEFI fi "$scriptDir"InstallLog.sh "${dest_vol}" "Cleanup: ${cleanUp}" Index: branches/ErmaC/Trunk/package/Scripts/Main/Standardpostinstall =================================================================== --- branches/ErmaC/Trunk/package/Scripts/Main/Standardpostinstall (revision 1750) +++ branches/ErmaC/Trunk/package/Scripts/Main/Standardpostinstall (revision 1751) @@ -56,6 +56,7 @@ targetResources="${targetVolume}/usr/local/bin/" updateStage1=1 # by default update partition boot sector +efiPartitionExist=0 # target volume does not have EFI system partition. echo "===============================================" echo "DEBUG: display script variables" @@ -82,12 +83,17 @@ "$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. +# The following script returns either 0 or 1 to proceed, or 2 to indicate failure. "$scriptDir"CheckProceed.sh "${targetVolume}" "${targetDevice}" "${targetVolume}" "${scriptDir}" returnValue=$? -if [ ${returnValue} = 0 ]; then +if [ ${returnValue} -ne 2 ]; then # OK to proceed + + # Remember if the target volume has an EFI system partition. + if [ ${returnValue} -ne 1 ]; then + efiPartitionExist=1 + fi # Does a GRUB or Linux loader already exist in the disk's MBR? # The script returns 1 if yes, 0 if no. @@ -162,32 +168,21 @@ # 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 + "$scriptDir"InstallLog.sh "${targetVolume}" "Preparing to check target disk for previous installations." + if [ ${efiPartitionExist} -ne 0 ]; then # volume has an EFI system partition + "$scriptDir"InstallLog.sh "${targetVolume}" "Going to check the EFI system partition also." + # Unmount ALL mounted volumes named EFI. Returns 0=success, 1=fail + "$scriptDir"UnMountEFIvolumes.sh "${targetVolume}" "${scriptDir}" + returnValue=$? + if [ ${returnValue} = 0 ]; then # Mount the EFI system partition - "$scriptDir"MountESP.sh "${targetDisk}" "${targetVolume}" "${scriptDir}" + "$scriptDir"MountESP.sh "${targetDisk}" "${targetVolume}" "${efiPartitionExist}" "${scriptDir}" fi - - # Check for another existing Chameleon installation on the same disk - "$scriptDir"CheckPreviousChameleon.sh "${targetDisk}" "${targetDeviceRaw}" "${targetDevice}" "${targetVolume}" "${scriptDir}" fi + # Check for another existing Chameleon installation on the same disk + "$scriptDir"CheckPreviousChameleon.sh "${targetDisk}" "${targetDeviceRaw}" "${targetDevice}" "${targetVolume}" "${scriptDir}" # Append a line break to the installer log "$scriptDir"InstallLog.sh "${targetVolume}" "LineBreak" Index: branches/ErmaC/Trunk/package/Scripts/Sub/CheckPreviousChameleon.sh =================================================================== --- branches/ErmaC/Trunk/package/Scripts/Sub/CheckPreviousChameleon.sh (revision 1750) +++ branches/ErmaC/Trunk/package/Scripts/Sub/CheckPreviousChameleon.sh (revision 1751) @@ -52,8 +52,7 @@ # 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/}" + "$scriptDir"InstallLog.sh "${installerVolume}" "Checking ${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}' ) @@ -64,6 +63,7 @@ fi #Scan all partitions for Chameleon code + cleanRun=1 for (( i=1; i <= $numSlices; i++ )); do if [ $stage0type == 1 ] || [ $stage0type == 2 ]; then @@ -108,7 +108,7 @@ "$scriptDir"InstallLog.sh "${installerVolume}" "${message}" fi if [ $stagesFound == 3 ] && [ $i -gt $sliceNumber ]; then - # Exisitng installation found which will no longer be default. + # Existing 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." @@ -131,8 +131,7 @@ 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) + # Fix by making previous parition bootsector un-bootable 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 @@ -149,20 +148,12 @@ 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 + # Change Byte 01FExh to 00 (510 decimal) + # Same code can be used for HFS or FAT32 + 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 # /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 @@ -182,11 +173,15 @@ #echo "DEBUG: Boot0 not found" fi fi + else + (( cleanRun++ )) fi - done -#else - #echo "DEBUG: Just one slice" + if [[ $cleanRun == $i ]]; then + "$scriptDir"InstallLog.sh "${installerVolume}" "Nothing found that could cause any problems." + fi +else + "$scriptDir"InstallLog.sh "${installerVolume}" "Nothing to check as there's only one partition." fi exit 0 Index: branches/ErmaC/Trunk/package/Scripts/Sub/MountESP.sh =================================================================== --- branches/ErmaC/Trunk/package/Scripts/Sub/MountESP.sh (revision 1750) +++ branches/ErmaC/Trunk/package/Scripts/Sub/MountESP.sh (revision 1751) @@ -9,34 +9,43 @@ # Receives targetDisk: for example /dev/disk2. # Receives installerVolume: Volume to write the installer log to. +# Receives efiPartitionExist: either 0 or 1 # Receives scriptDir: The location of the main script dir. -if [ "$#" -eq 3 ]; then +if [ "$#" -eq 4 ]; then targetDisk="$1" installerVolume="$2" - scriptDir="$3" + efiPartitionExist="$3" + scriptDir="$4" echo "DEBUG: passed argument for targetDisk = $targetDisk" echo "DEBUG: passed argument for installerVolume = $installerVolume" + echo "DEBUG: passed argument for efiPartitionExist = $efiPartitionExist" echo "DEBUG: passed argument for scriptDir = $scriptDir" else echo "Error - wrong number of values passed" exit 9 fi +# Check the first partition is actually type 'EFI' +# as we could be checking a USB flash drive <4GB +if [ ${efiPartitionExist} = 1 ]; then -# Does the mountpoint exist? -if [ ! -e "/Volumes/EFI" ]; then - mkdir -p "/Volumes/EFI" -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" + # 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 +else + "$scriptDir"InstallLog.sh "${installerVolume}" "Target volume doesn't have an EFI system partition." 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 +exit 0 Index: branches/ErmaC/Trunk/package/Scripts/Sub/CheckProceed.sh =================================================================== --- branches/ErmaC/Trunk/package/Scripts/Sub/CheckProceed.sh (revision 1750) +++ branches/ErmaC/Trunk/package/Scripts/Sub/CheckProceed.sh (revision 1751) @@ -6,6 +6,9 @@ # Checks the selected volume is present and the disk is partitioned # Now also check for another existing Chameleon installation on the same disk. +# Exit with 0 to indicate okay to proceed, no problems. +# Exit with 1 to indicate okay to proceed, but target disk doesn't have EFI system partition. +# Exit with 2 to indicate not to proceed. # Receives targetVolume: Volume to install to (will be '/Volumes/EFI' if EFI install) # Receives targetDevice: Stores device number, for example /dev/disk2s1. @@ -26,40 +29,37 @@ exit 9 fi - # Does target volume exist? if [ -z "$targetVolume" ]; then echo "*** Cannot find the volume. Exiting." "$scriptDir"InstallLog.sh "${installerVolume}" "FAIL: Cannot file the volume: $targetVolume." - exit 1 -#else - #echo "DEBUG: Confirming target volume exists" + exit 2 fi - # Does target volume use slices? if [ "$targetDevice" = "$targetDevice#*disk*s" ]; then echo "*** ERROR Volume does not use slices. Exiting." "$scriptDir"InstallLog.sh "${installerVolume}" "FAIL: $targetVolume doesn't use slices." - exit 1 -#else - #echo "DEBUG: Confirming target device uses slices" + exit 2 fi +# Check to find if an EFI system partition exists on the disk. +# This is used in two cases: +# A) When checking for existing Chameleon installations. +# B) When the user chooses the EFI system partition install option, +# and installing to a 'small' HFS device like a 1GB USB flash +# drive which won't have an EFI System Partition. -# Add check for installing to a 'small' HFS device like a -# 1GB USB flash drive which won't have an EFI System Partition. -if [ "$targetVolume" = "/Volumes/EFI" ]; then - # Take target device and check slice 1 matches partition named "EFI" - stripped=$( echo ${targetDevice#/dev/} ) - if [ ! $(echo ${stripped#*disk*s}) = 1 ]; then - stripped=$( echo ${stripped%s*})"s1" - fi - if [ ! $( diskutil list | grep ${stripped} | awk {'print $2'} ) = "EFI" ]; then - #echo "DEBUG: *** The selected volume doesn't have an EFI System Partition. Exiting." +# Take target device and check if slice 1 is not named "EFI" +stripped=$( echo ${targetDevice#/dev/} ) +if [ ! $(echo ${stripped#*disk*s}) = 1 ]; then + stripped=$( echo ${stripped%s*})"s1" +fi +if [ ! $( diskutil list | grep ${stripped} | awk {'print $2'} ) = "EFI" ]; then + if [ "$targetVolume" = "/Volumes/EFI" ]; then "$scriptDir"InstallLog.sh "${installerVolume}" "FAIL: Selected disk does not have an EFI System Partition." - exit 1 fi + exit 1 fi exit 0 Index: branches/ErmaC/Trunk/package/Resources/ja.lproj/Description.html =================================================================== --- branches/ErmaC/Trunk/package/Resources/ja.lproj/Description.html (revision 1750) +++ branches/ErmaC/Trunk/package/Resources/ja.lproj/Description.html (revision 1751) @@ -34,7 +34,6 @@

- Automatic P-State & C-State generation for native power management.

- Message logging.


-


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

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


Index: branches/ErmaC/Trunk/package/Resources/he.lproj/Description.html =================================================================== --- branches/ErmaC/Trunk/package/Resources/he.lproj/Description.html (revision 1750) +++ branches/ErmaC/Trunk/package/Resources/he.lproj/Description.html (revision 1751) @@ -34,7 +34,6 @@

- Automatic P-State & C-State generation for native power management.

- Message logging.


-


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

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


Index: branches/ErmaC/Trunk/package/Resources/bs.lproj/Description.html =================================================================== --- branches/ErmaC/Trunk/package/Resources/bs.lproj/Description.html (revision 1750) +++ branches/ErmaC/Trunk/package/Resources/bs.lproj/Description.html (revision 1751) @@ -34,7 +34,6 @@

- Automatsko generisanje P-State i C-State za izvorno upravljanje energijom.

- Prijava porukama.


-


Kod je objavljen pod verzijom 2 GNU javna licenca.

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


Index: branches/ErmaC/Trunk/package/Resources/fr.lproj/Description.html =================================================================== --- branches/ErmaC/Trunk/package/Resources/fr.lproj/Description.html (revision 1750) +++ branches/ErmaC/Trunk/package/Resources/fr.lproj/Description.html (revision 1751) @@ -34,7 +34,6 @@

- Génération automatique des P-State & C-State pour une gestion de l'alimentation native.

- Journalisation des messages console.


-


Le code est publié sous la version 2 de la licence GPL (Gnu Public License).

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


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/nl.lproj/Description.html =================================================================== --- branches/ErmaC/Trunk/package/Resources/nl.lproj/Description.html (revision 1750) +++ branches/ErmaC/Trunk/package/Resources/nl.lproj/Description.html (revision 1751) @@ -34,7 +34,6 @@

- Automatisch P-State's & C-State's aangemaakt voor automatisch stroombeheer.

- Bericht logboek.


-


De code is vrijgegeven onder versie 2 van de Gnu Public License.

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


Index: branches/ErmaC/Trunk/package/Resources/hr.lproj/Description.html =================================================================== --- branches/ErmaC/Trunk/package/Resources/hr.lproj/Description.html (revision 1750) +++ branches/ErmaC/Trunk/package/Resources/hr.lproj/Description.html (revision 1751) @@ -34,7 +34,6 @@

- Automatsko generiranje P-State i C-State za izvorno upravljanje energijom.

- Prijava porukama.


-


Kod je objavljen pod verzijom 2 GNU javna licenca.

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


Index: branches/ErmaC/Trunk/package/Resources/pl.lproj/Description.html =================================================================== --- branches/ErmaC/Trunk/package/Resources/pl.lproj/Description.html (revision 1750) +++ branches/ErmaC/Trunk/package/Resources/pl.lproj/Description.html (revision 1751) @@ -34,7 +34,6 @@

- Automatyczne generowanie stanów P-State & C-State w celu uzyskania natywnego zarządzania energią.

- Logownie komunikatów.


-


Kod jest publikowany z licencją Gnu Public License w wersji 2.

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


Index: branches/ErmaC/Trunk/package/Resources/pt-BR.lproj/Description.html =================================================================== --- branches/ErmaC/Trunk/package/Resources/pt-BR.lproj/Description.html (revision 1750) +++ branches/ErmaC/Trunk/package/Resources/pt-BR.lproj/Description.html (revision 1751) @@ -34,7 +34,6 @@

- P-State automático & Geração C-State para gestão de energia nativa.

- Protocolo Mensagens.


-


Este código é distribuido sobre os termos da versão 2 da Gnu Public License.

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


Index: branches/ErmaC/Trunk/package/Resources/ru.lproj/Description.html =================================================================== --- branches/ErmaC/Trunk/package/Resources/ru.lproj/Description.html (revision 1750) +++ branches/ErmaC/Trunk/package/Resources/ru.lproj/Description.html (revision 1751) @@ -34,7 +34,6 @@

- Automatic P-State & C-State generation for native power management.

- Message logging.


-


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

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


Index: branches/ErmaC/Trunk/package/Resources/id.lproj/Description.html =================================================================== --- branches/ErmaC/Trunk/package/Resources/id.lproj/Description.html (revision 1750) +++ branches/ErmaC/Trunk/package/Resources/id.lproj/Description.html (revision 1751) @@ -34,7 +34,6 @@

- Automatic P-State & C-State generation for native power management.

- Message logging.


-


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

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


Index: branches/ErmaC/Trunk/package/Resources/el.lproj/Description.html =================================================================== --- branches/ErmaC/Trunk/package/Resources/el.lproj/Description.html (revision 1750) +++ branches/ErmaC/Trunk/package/Resources/el.lproj/Description.html (revision 1751) @@ -34,7 +34,6 @@

- Automatic P-State & C-State generation for native power management.

- Message logging.


-


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

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


Index: branches/ErmaC/Trunk/package/Resources/en.lproj/Description.html =================================================================== --- branches/ErmaC/Trunk/package/Resources/en.lproj/Description.html (revision 1750) +++ branches/ErmaC/Trunk/package/Resources/en.lproj/Description.html (revision 1751) @@ -34,7 +34,6 @@

- Automatic P-State & C-State generation for native power management.

- Message logging.


-


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

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


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/en.lproj/Welcome.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/Trunk/package/Resources/en.lproj/Welcome.rtfd/TXT.rtf (revision 1750) +++ branches/ErmaC/Trunk/package/Resources/en.lproj/Welcome.rtfd/TXT.rtf (revision 1751) @@ -1,4 +1,4 @@ -{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf230 +{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf360 {\fonttbl\f0\fnil\fcharset0 LucidaGrande;} {\colortbl;\red255\green255\blue255;\red255\green0\blue9;\red0\green0\blue255;} \margl1440\margr1440\vieww11660\viewh12980\viewkind0 @@ -12,11 +12,7 @@ \fs26 \cf0 v%CHAMELEONVERSION% r%CHAMELEONREVISION%\ -\fs50 \ -\pard\ri0 - -\fs22 \cf0 \ -\ +\fs50 \cf0 \ \pard\ri0\qc \fs28 \cf2 Do not install to an Apple Macintosh computer\ Index: branches/ErmaC/Trunk/package/Resources/ar.lproj/Description.html =================================================================== --- branches/ErmaC/Trunk/package/Resources/ar.lproj/Description.html (revision 1750) +++ branches/ErmaC/Trunk/package/Resources/ar.lproj/Description.html (revision 1751) @@ -34,7 +34,6 @@

- Automatic P-State & C-State generation لادارة الطاقة كما يجب ان يكون .

- Message logging.


-


هذا البرنامج صدر تحت رخضة الاصدار الثانى الهام ل Gnu .

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


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/ar.lproj/Welcome.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/Trunk/package/Resources/ar.lproj/Welcome.rtfd/TXT.rtf (revision 1750) +++ branches/ErmaC/Trunk/package/Resources/ar.lproj/Welcome.rtfd/TXT.rtf (revision 1751) @@ -11,13 +11,8 @@ \pard\ri0\qc \fs26 \cf0 v%CHAMELEONVERSION% r%CHAMELEONREVISION%\ -\pard\ri0\qc \fs50 \cf0 \ -\pard\ri0 - -\fs22 \cf0 \ -\ \pard\ri0\qc \f1\fs28 \cf2 \'e1\'c7 Index: branches/ErmaC/Trunk/package/Resources/pt-PT.lproj/Description.html =================================================================== --- branches/ErmaC/Trunk/package/Resources/pt-PT.lproj/Description.html (revision 1750) +++ branches/ErmaC/Trunk/package/Resources/pt-PT.lproj/Description.html (revision 1751) @@ -34,7 +34,6 @@

- P-State automático & Geração C-State para gestão de energia nativa.

- Protocolo Mensagens.


-


Este código é distribuido sobre os termos da versão 2 da Gnu Public License.

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


Index: branches/ErmaC/Trunk/package/Resources/es.lproj/Description.html =================================================================== --- branches/ErmaC/Trunk/package/Resources/es.lproj/Description.html (revision 1750) +++ branches/ErmaC/Trunk/package/Resources/es.lproj/Description.html (revision 1751) @@ -34,7 +34,6 @@

- Generación automática de P-States & C-States para gestión de energía nativa.

- Registro de Mensajes.


-


El código está liberado bajo la versión 2 de la Licencia Pública GNU.

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


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/mk.lproj/Description.html =================================================================== --- branches/ErmaC/Trunk/package/Resources/mk.lproj/Description.html (revision 1750) +++ branches/ErmaC/Trunk/package/Resources/mk.lproj/Description.html (revision 1751) @@ -34,7 +34,6 @@

- Автоматско генерирање на P-State & C-State за природна контрола на процесорот.

- Логирање на пораки.


-


Овој код е објавен под верзијата 2 од Gnu Public License.

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


Index: branches/ErmaC/Trunk/package/Resources/ko.lproj/Description.html =================================================================== --- branches/ErmaC/Trunk/package/Resources/ko.lproj/Description.html (revision 1750) +++ branches/ErmaC/Trunk/package/Resources/ko.lproj/Description.html (revision 1751) @@ -39,7 +39,6 @@

- 자동 P-State & C-State 생성기능으로 자연적인 전원 관리.

- 메세지 로깅.


-


이 코드는 GNU 일반 공중 사용 허가서(GPL) 버전 2 아래 공개 되었습니다.

(영문) http://forge.voodooprojects.org/p/chameleon


Index: branches/ErmaC/Trunk/package/Resources/it.lproj/Description.html =================================================================== --- branches/ErmaC/Trunk/package/Resources/it.lproj/Description.html (revision 1750) +++ branches/ErmaC/Trunk/package/Resources/it.lproj/Description.html (revision 1751) @@ -34,7 +34,6 @@

- Generazione automatica dei P-State e C-State.

- Log dei messaggi.


-


Il codice è rilasciato sotto la versione 2 della licenza GPL (Gnu Public License).

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


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/it.lproj/Welcome.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/Trunk/package/Resources/it.lproj/Welcome.rtfd/TXT.rtf (revision 1750) +++ branches/ErmaC/Trunk/package/Resources/it.lproj/Welcome.rtfd/TXT.rtf (revision 1751) @@ -1,4 +1,4 @@ -{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf230 +{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf360 {\fonttbl\f0\fnil\fcharset0 LucidaGrande;} {\colortbl;\red255\green255\blue255;\red255\green0\blue9;\red0\green0\blue255;} \margl1440\margr1440\vieww11660\viewh12980\viewkind0 @@ -12,11 +12,7 @@ \fs26 \cf0 v%CHAMELEONVERSION% r%CHAMELEONREVISION%\ -\fs50 \ -\pard\ri0 - -\fs22 \cf0 \ -\ +\fs50 \cf0 \ \pard\ri0\qc \fs28 \cf2 Non installare su computer Apple Macintosh\ Index: branches/ErmaC/Trunk/package/Resources/sr.lproj/Description.html =================================================================== --- branches/ErmaC/Trunk/package/Resources/sr.lproj/Description.html (revision 1750) +++ branches/ErmaC/Trunk/package/Resources/sr.lproj/Description.html (revision 1751) @@ -34,7 +34,6 @@

- Automatsko generisanje P-State i C-State za izvorno upravljanje energijom.

- Prijava porukama.


-


Kod je objavljen pod verzijom 2 GNU javna licenca.

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


Index: branches/ErmaC/Trunk/package/Resources/bg.lproj/Description.html =================================================================== --- branches/ErmaC/Trunk/package/Resources/bg.lproj/Description.html (revision 1750) +++ branches/ErmaC/Trunk/package/Resources/bg.lproj/Description.html (revision 1751) @@ -34,7 +34,6 @@

- Automatic P-State & C-State generation for native power management.

- Message logging.


-


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

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


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/Resources/de.lproj/Description.html =================================================================== --- branches/ErmaC/Trunk/package/Resources/de.lproj/Description.html (revision 1750) +++ branches/ErmaC/Trunk/package/Resources/de.lproj/Description.html (revision 1751) @@ -34,7 +34,6 @@

- Automatische P-State & C-State generation für native power management.

- Message logging.


-


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

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


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/buildpkg.sh =================================================================== --- branches/ErmaC/Trunk/package/buildpkg.sh (revision 1750) +++ branches/ErmaC/Trunk/package/buildpkg.sh (revision 1751) @@ -39,566 +39,623 @@ indent[2]="\t\t\t" indent[3]="\t\t\t\t" +declare -a pkgrefs + +# Package identifiers +modules_packages_identity="org.chameleon.modules" + +getPackageRefId () { + echo ${1//_/.}.${2//_/.} | tr [:upper:] [:lower:] +} + +addChoice () { + # $1 Choice Id + # $2 Choice Options + # $3..$n Package reference id (optional) + local choiceId="${1}" + local choiceOptions="${2}" + local choiceNode="\t" + done + fi + choiceNode="${choiceNode}\n\t\n" + + outline[$((outlinecount++))]="${indent[$xmlindent]}" + choices[$((choicescount++))]="$choiceNode" +} + +exclusive_one_choice () { + # $1 Current choice (ie: test1) + # $2..$n Others choice(s) (ie: "test2" "test3"). Current can or can't be in the others choices + local myChoice="${1}" + local result; + local separator=' || '; + for choice in ${@:2};do + if [[ "$choice" != "$myChoice" ]];then + result="${result}choices['$choice'].selected${separator}"; + fi + done + echo "!(${result%$separator})" +} + +exclusive_zero_or_one_choice () { + # $1 Current choice (ie: test1) + # $2..$n Others choice(s) (ie: "test2" "test3"). Current can or can't be in the others choices + local myChoice="${1}" + local result; + echo "(my.choice.selected && $(exclusive_one_choice ${@}))" +} + main () { # clean up the destination path -rm -R -f "${1}" -echo "" -echo -e $COL_CYAN" ----------------------------------"$COL_RESET -echo -e $COL_CYAN" Building $packagename Install Package"$COL_RESET -echo -e $COL_CYAN" ----------------------------------"$COL_RESET -echo "" + rm -R -f "${1}" + echo "" + echo -e $COL_CYAN" ----------------------------------"$COL_RESET + echo -e $COL_CYAN" Building $packagename Install Package"$COL_RESET + echo -e $COL_CYAN" ----------------------------------"$COL_RESET + echo "" -outline[$((outlinecount++))]="${indent[$xmlindent]}" + 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 + echo "================= Preinstall =================" + ((xmlindent++)) + packagesidentity="org.chameleon" + choiceId="Pre" + mkdir -p ${1}/${choiceId}/Root + mkdir -p ${1}/${choiceId}/Scripts + ditto --noextattr --noqtn ${1%/*/*}/revision ${1}/${choiceId}/Scripts/Resources/revision + ditto --noextattr --noqtn ${1%/*/*}/version ${1}/${choiceId}/Scripts/Resources/version + cp -f ${pkgroot}/Scripts/Main/preinstall ${1}/${choiceId}/Scripts + cp -f ${pkgroot}/Scripts/Sub/InstallLog.sh ${1}/${choiceId}/Scripts + echo -e "\t[BUILD] ${choiceId} " + packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}") + buildpackage "$packageRefId" "${choiceId}" "${1}/${choiceId}" "/" >/dev/null 2>&1 + addChoice "${choiceId}" "start_visible=\"false\" start_selected=\"true\"" "$packageRefId" # End build pre install package # build core package - echo "================= 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 - ditto --noextattr --noqtn ${1%/*}/i386/boot0 ${1}/Core/Root/usr/standalone/i386 - ditto --noextattr --noqtn ${1%/*}/i386/boot0md ${1}/Core/Root/usr/standalone/i386 - ditto --noextattr --noqtn ${1%/*}/i386/boot1f32 ${1}/Core/Root/usr/standalone/i386 - ditto --noextattr --noqtn ${1%/*}/i386/boot1h ${1}/Core/Root/usr/standalone/i386 - ditto --noextattr --noqtn ${1%/*}/i386/boot1he ${1}/Core/Root/usr/standalone/i386 - ditto --noextattr --noqtn ${1%/*}/i386/boot1hp ${1}/Core/Root/usr/standalone/i386 - ditto --noextattr --noqtn ${1%/*}/i386/cdboot ${1}/Core/Root/usr/standalone/i386 - ditto --noextattr --noqtn ${1%/*}/i386/chain0 ${1}/Core/Root/usr/standalone/i386 - ditto --noextattr --noqtn ${1%/*}/i386/fdisk440 ${1}/Core/Root/usr/local/bin - ditto --noextattr --noqtn ${1%/*}/i386/bdmesg ${1}/Core/Root/usr/local/bin - 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 + echo "================= Core =================" + packagesidentity="org.chameleon" + choiceId="Core" + mkdir -p ${1}/${choiceId}/Root/usr/local/bin + mkdir -p ${1}/${choiceId}/Root/usr/standalone/i386 + ditto --noextattr --noqtn ${1%/*}/i386/boot ${1}/${choiceId}/Root/usr/standalone/i386 + ditto --noextattr --noqtn ${1%/*}/i386/boot0 ${1}/${choiceId}/Root/usr/standalone/i386 + ditto --noextattr --noqtn ${1%/*}/i386/boot0md ${1}/${choiceId}/Root/usr/standalone/i386 + ditto --noextattr --noqtn ${1%/*}/i386/boot1f32 ${1}/${choiceId}/Root/usr/standalone/i386 + ditto --noextattr --noqtn ${1%/*}/i386/boot1h ${1}/${choiceId}/Root/usr/standalone/i386 + ditto --noextattr --noqtn ${1%/*}/i386/boot1he ${1}/${choiceId}/Root/usr/standalone/i386 + ditto --noextattr --noqtn ${1%/*}/i386/boot1hp ${1}/${choiceId}/Root/usr/standalone/i386 + ditto --noextattr --noqtn ${1%/*}/i386/cdboot ${1}/${choiceId}/Root/usr/standalone/i386 + ditto --noextattr --noqtn ${1%/*}/i386/chain0 ${1}/${choiceId}/Root/usr/standalone/i386 + ditto --noextattr --noqtn ${1%/*}/i386/fdisk440 ${1}/${choiceId}/Root/usr/local/bin + ditto --noextattr --noqtn ${1%/*}/i386/bdmesg ${1}/${choiceId}/Root/usr/local/bin + echo -e "\t[BUILD] ${choiceId} " + packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}") + buildpackage "$packageRefId" "${choiceId}" "${1}/${choiceId}" "/" >/dev/null 2>&1 + addChoice "${choiceId}" "start_visible=\"false\" start_selected=\"true\"" "$packageRefId" # End build core package - + # build install type - echo "================= Chameleon =================" - outline[$((outlinecount++))]="${indent[$xmlindent]}" - choices[$((choicescount++))]="\t\n\t\n" - ((xmlindent++)) - packagesidentity="org.chameleon.type" - - # build new install package - mkdir -p ${1}/New/Root - echo "" > "${1}/New/Root/install_type_new" - echo " [BUILD] New " - buildpackage "${1}/New" "/$chamTemp" "" "start_enabled=\"true\" selected=\"exclusive(choices['Upgrade'])\"" >/dev/null 2>&1 - # End build new install package + echo "================= Chameleon =================" + outline[$((outlinecount++))]="${indent[$xmlindent]}" + choices[$((choicescount++))]="\t\n\t\n" + ((xmlindent++)) + packagesidentity="org.chameleon.type" + allChoices="New Upgrade" - # build upgrade package - mkdir -p ${1}/Upgrade/Root - echo "" > "${1}/Upgrade/Root/install_type_upgrade" - echo " [BUILD] Upgrade " - buildpackage "${1}/Upgrade" "/$chamTemp" "" "start_selected=\"false\" selected=\"exclusive(choices['New'])\"" >/dev/null 2>&1 - # End build upgrade package + # build new install package + choiceId="New" + mkdir -p ${1}/${choiceId}/Root + echo "" > "${1}/${choiceId}/Root/install_type_new" + echo -e "\t[BUILD] ${choiceId} " + packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}") + buildpackage "$packageRefId" "${choiceId}" "${1}/${choiceId}" "/$chamTemp" >/dev/null 2>&1 + exclusiveChoice=$(exclusive_one_choice "$choiceId" "$allChoices") + addChoice "${choiceId}" "start_selected=\"!choices['Upgrade'].selected\" selected=\"${exclusiveChoice}\"" "$packageRefId" + # End build new install package + # build upgrade package + choiceId="Upgrade" + mkdir -p ${1}/${choiceId}/Root + echo "" > "${1}/${choiceId}/Root/install_type_upgrade" + echo -e "\t[BUILD] ${choiceId} " + packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}") + buildpackage "$packageRefId" "${choiceId}" "${1}/${choiceId}" "/$chamTemp" >/dev/null 2>&1 + exclusiveChoice=$(exclusive_one_choice "$choiceId" "$allChoices") + addChoice "${choiceId}" "start_selected=\"chameleon_boot_plist_exists()\" selected=\"${exclusiveChoice}\"" "$packageRefId" + # End build upgrade package + ((xmlindent--)) outline[$((outlinecount++))]="${indent[$xmlindent]}" -# End build install type +# End build install type # build Chameleon package - echo "================= Chameleon =================" - 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/Standardpostinstall ${1}/Standard/Scripts/postinstall - cp -f ${pkgroot}/Scripts/Sub/* ${1}/Standard/Scripts - ditto --arch i386 `which SetFile` ${1}/Standard/Scripts/Resources/SetFile - echo " [BUILD] Standard " - buildpackage "${1}/Standard" "/" "${coresize}" "start_enabled=\"true\" selected=\"exclusive(choices['EFI']) && exclusive(choices['noboot'])\"" >/dev/null 2>&1 - # End build standard package + echo "================= Chameleon =================" + outline[$((outlinecount++))]="${indent[$xmlindent]}" + choices[$((choicescount++))]="\t\n\t\n" + ((xmlindent++)) - # build efi package - mkdir -p ${1}/EFI/Root - mkdir -p ${1}/EFI/Scripts/Resources - cp -f ${pkgroot}/Scripts/Main/ESPpostinstall ${1}/EFI/Scripts/postinstall - cp -f ${pkgroot}/Scripts/Sub/* ${1}/EFI/Scripts - ditto --arch i386 `which SetFile` ${1}/EFI/Scripts/Resources/SetFile - echo " [BUILD] EFI " - buildpackage "${1}/EFI" "/" "${coresize}" "start_visible=\"systemHasGPT()\" selected=\"exclusive(choices['Standard']) && exclusive(choices['noboot'])\"" >/dev/null 2>&1 - # End build efi package + allChoices="Standard EFI noboot" - # build reset choice package - mkdir -p ${1}/noboot/Root - echo " [BUILD] Reset choice " - buildpackage "${1}/noboot" "/$chamTemp" "" "selected=\"exclusive(choices['Standard']) && exclusive(choices['EFI'])\"" >/dev/null 2>&1 - # End build reset choice package + # build standard package + choiceId="Standard" + mkdir -p ${1}/${choiceId}/Root + mkdir -p ${1}/${choiceId}/Scripts/Resources + cp -f ${pkgroot}/Scripts/Main/${choiceId}postinstall ${1}/${choiceId}/Scripts/postinstall + cp -f ${pkgroot}/Scripts/Sub/* ${1}/${choiceId}/Scripts + ditto --arch i386 `which SetFile` ${1}/${choiceId}/Scripts/Resources/SetFile + echo -e "\t[BUILD] ${choiceId} " + packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}") + buildpackage "$packageRefId" "${choiceId}" "${1}/${choiceId}" "/" >/dev/null 2>&1 + exclusiveChoice=$(exclusive_one_choice "$choiceId" "$allChoices") + addChoice "${choiceId}" "start_selected=\"true\" selected=\"${exclusiveChoice}\"" "$packageRefId" + # End build standard package + # build efi package + choiceId="EFI" + mkdir -p ${1}/${choiceId}/Root + mkdir -p ${1}/${choiceId}/Scripts/Resources + cp -f ${pkgroot}/Scripts/Main/ESPpostinstall ${1}/${choiceId}/Scripts/postinstall + cp -f ${pkgroot}/Scripts/Sub/* ${1}/${choiceId}/Scripts + ditto --arch i386 `which SetFile` ${1}/${choiceId}/Scripts/Resources/SetFile + echo -e "\t[BUILD] ${choiceId} " + packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}") + buildpackage "$packageRefId" "${choiceId}" "${1}/${choiceId}" "/" >/dev/null 2>&1 + exclusiveChoice=$(exclusive_one_choice "$choiceId" "$allChoices") + addChoice "${choiceId}" "start_visible=\"systemHasGPT()\" start_selected=\"false\" selected=\"${exclusiveChoice}\"" "$packageRefId" + # End build efi package + + # build no bootloader choice package + choiceId="noboot" + mkdir -p ${1}/${choiceId}/Root + echo -e "\t[BUILD] ${choiceId} " + packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}") + buildpackage "$packageRefId" "${choiceId}" "${1}/${choiceId}" "/" >/dev/null 2>&1 + exclusiveChoice=$(exclusive_one_choice "$choiceId" "$allChoices") + addChoice "${choiceId}" "start_selected=\"false\" selected=\"${exclusiveChoice}\"" "$packageRefId" + # End build no bootloader choice package + ((xmlindent--)) outline[$((outlinecount++))]="${indent[$xmlindent]}" # End build Chameleon package # build Modules package - echo "================= Modules =================" - ############################### - # Supported Modules # - ############################### - # klibc.dylib # - # Resolution.dylib # - # uClibcxx.dylib # - # Keylayout.dylib # - ############################### - if [ "$(ls -A "${1%/*}/i386/modules")" ]; then - { - outline[$((outlinecount++))]="${indent[$xmlindent]}" - choices[$((choicescount++))]="\t\n\t\n" - ((xmlindent++)) - packagesidentity="org.chameleon.modules" + echo "================= Modules =================" + ############################### + # Supported Modules # + ############################### + # klibc.dylib # + # Resolution.dylib # + # uClibcxx.dylib # + # Keylayout.dylib # + ############################### + if [ "$(ls -A "${1%/*}/i386/modules")" ]; then + { + outline[$((outlinecount++))]="${indent[$xmlindent]}" + choices[$((choicescount++))]="\t\n\t\n" + ((xmlindent++)) + # - - if [ -e ${1%/*}/i386/modules/klibc.dylib ]; then - { - mkdir -p ${1}/klibc/Root - ditto --noextattr --noqtn ${1%/*}/i386/modules/klibc.dylib ${1}/klibc/Root - echo " [BUILD] klibc " - buildpackage "${1}/klibc" "/$chamTemp/Extra/modules" "" "start_selected=\"false\"" >/dev/null 2>&1 - } - fi + if [ -e ${1%/*}/i386/modules/klibc.dylib ]; then + { + # Start build klibc package module + choiceId="klibc" + mkdir -p ${1}/${choiceId}/Root + ditto --noextattr --noqtn ${1%/*}/i386/modules/${choiceId}.dylib ${1}/${choiceId}/Root + echo -e "\t[BUILD] ${choiceId} " + packageRefId=$(getPackageRefId "${modules_packages_identity}" "${choiceId}") + buildpackage "$packageRefId" "${choiceId}" "${1}/${choiceId}" "/$chamTemp/Extra/modules" >/dev/null 2>&1 + addChoice "${choiceId}" "start_selected=\"false\"" "$packageRefId" + # End build klibc package module + } + fi + # - - if [ -e ${1%/*}/i386/modules/uClibcxx.dylib ]; then - { - mkdir -p ${1}/uClibc/Root - ditto --noextattr --noqtn ${1%/*}/i386/modules/uClibcxx.dylib ${1}/uClibc/Root - ditto --noextattr --noqtn ${1%/*}/i386/modules/klibc.dylib ${1}/uClibc/Root - echo " [BUILD] uClibc++ " - buildpackage "${1}/uClibc" "/$chamTemp/Extra/modules" "" "start_selected=\"false\"" >/dev/null 2>&1 - } - fi + if [ -e ${1%/*}/i386/modules/uClibcxx.dylib ]; then + { + # Start build uClibc package module + choiceId="uClibc" + mkdir -p ${1}/${choiceId}/Root + ditto --noextattr --noqtn ${1%/*}/i386/modules/uClibcxx.dylib ${1}/${choiceId}/Root + echo -e "\t[BUILD] ${choiceId} " + packageRefId=$(getPackageRefId "${modules_packages_identity}" "${choiceId}") + buildpackage "$packageRefId" "${choiceId}" "${1}/${choiceId}" "/$chamTemp/Extra/modules" >/dev/null 2>&1 + # Add the klibc package because the uClibc module is dependent of klibc module + addChoice "${choiceId}" "start_selected=\"false\"" \ + "$packageRefId" $(getPackageRefId "${modules_packages_identity}" "klibc") + # End build uClibc package module + } + fi + # - - if [ -e ${1%/*}/i386/modules/Resolution.dylib ]; then - { - mkdir -p ${1}/AutoReso/Root - ditto --noextattr --noqtn ${1%/*}/i386/modules/Resolution.dylib ${1}/AutoReso/Root - echo " [BUILD] Resolution " - buildpackage "${1}/AutoReso" "/$chamTemp/Extra/modules" "" "start_selected=\"false\"" >/dev/null 2>&1 - } - fi + if [ -e ${1%/*}/i386/modules/Resolution.dylib ]; then + { + # Start build Resolution package module + choiceId="AutoReso" + mkdir -p ${1}/${choiceId}/Root + ditto --noextattr --noqtn ${1%/*}/i386/modules/Resolution.dylib ${1}/${choiceId}/Root + echo -e "\t[BUILD] ${choiceId} " + packageRefId=$(getPackageRefId "${modules_packages_identity}" "${choiceId}") + buildpackage "$packageRefId" "${choiceId}" "${1}/${choiceId}" "/$chamTemp/Extra/modules" >/dev/null 2>&1 + addChoice "${choiceId}" "start_selected=\"false\"" "$packageRefId" + # End build Resolution package module + } + fi + # - - # Warning Keylayout module need additional files - if [ -e ${1%/*}/i386/modules/Keylayout.dylib ]; then - { - mkdir -p ${1}/Keylayout/Root/Extra/{modules,Keymaps} - mkdir -p ${1}/Keylayout/Root/usr/local/bin - layout_src_dir="${1%/sym/*}/i386/modules/Keylayout/layouts/layouts-src" - if [ -d "$layout_src_dir" ];then - # Create a tar.gz from layout sources - (cd "$layout_src_dir"; \ - tar czf "${1}/Keylayout/Root/Extra/Keymaps/layouts-src.tar.gz" README *.slt) - fi - # Adding module - ditto --noextattr --noqtn ${1%/*}/i386/modules/Keylayout.dylib ${1}/Keylayout/Root/Extra/modules - # Adding Keymaps - ditto --noextattr --noqtn ${1%/sym/*}/Keymaps ${1}/Keylayout/Root/Extra/Keymaps - # Adding tools - ditto --noextattr --noqtn ${1%/*}/i386/cham-mklayout ${1}/Keylayout/Root/usr/local/bin - buildpackage "${1}/Keylayout" "/" "" "start_selected=\"true\"" >/dev/null 2>&1 - } - fi + # Warning Keylayout module need additional files + if [ -e ${1%/*}/i386/modules/Keylayout.dylib ]; then + { + # Start build Keylayout package module + choiceId="Keylayout" + mkdir -p ${1}/${choiceId}/Root/Extra/{modules,Keymaps} + mkdir -p ${1}/${choiceId}/Root/usr/local/bin + layout_src_dir="${1%/sym/*}/i386/modules/Keylayout/layouts/layouts-src" + if [ -d "$layout_src_dir" ];then + # Create a tar.gz from layout sources + (cd "$layout_src_dir"; \ + tar czf "${1}/Keylayout/Root/Extra/Keymaps/layouts-src.tar.gz" README *.slt) + fi + # Adding module + ditto --noextattr --noqtn ${1%/*}/i386/modules/${choiceId}.dylib ${1}/${choiceId}/Root/Extra/modules + # Adding Keymaps + ditto --noextattr --noqtn ${1%/sym/*}/Keymaps ${1}/${choiceId}/Root/Extra/Keymaps + # Adding tools + ditto --noextattr --noqtn ${1%/*}/i386/cham-mklayout ${1}/${choiceId}/Root/usr/local/bin + echo -e "\t[BUILD] ${choiceId} " + packageRefId=$(getPackageRefId "${modules_packages_identity}" "${choiceId}") + buildpackage "$packageRefId" "${choiceId}" "${1}/${choiceId}" "/$chamTemp" >/dev/null 2>&1 - ((xmlindent--)) - outline[$((outlinecount++))]="${indent[$xmlindent]}" - } - else - { - echo " -= no modules to include =-" - } - fi + # Don't add a choice for Keylayout module + # addChoice "${choiceId}" "start_selected=\"false\"" "$packageRefId" + # End build Keylayout package module + } + fi + + ((xmlindent--)) + outline[$((outlinecount++))]="${indent[$xmlindent]}" + } + else + { + echo " -= no modules to include =-" + } + fi # End build Modules packages -# build Extras package - # build options packages +# build Options packages - outline[$((outlinecount++))]="${indent[$xmlindent]}" - choices[$((choicescount++))]="\t\n\t\n" + outline[$((outlinecount++))]="${indent[$xmlindent]}" + choices[$((choicescount++))]="\t\n\t\n" + ((xmlindent++)) + + + # ------------------------------------------------------ + # parse OptionalSettings folder to find files of boot options. + # ------------------------------------------------------ + OptionalSettingsFolder="${pkgroot}/OptionalSettings" + OptionalSettingsFiles=($( find "${OptionalSettingsFolder}" -depth 1 ! -name '.svn' ! -name '.DS_Store' )) + + for (( i = 0 ; i < ${#OptionalSettingsFiles[@]} ; i++ )) + do + + # Take filename and Strip .txt from end and path from front + builtOptionsList=$( echo ${OptionalSettingsFiles[$i]%.txt} ) + builtOptionsList=$( echo ${builtOptionsList##*/} ) + echo "================= $builtOptionsList =================" + outline[$((outlinecount++))]="${indent[$xmlindent]}" + choices[$((choicescount++))]="\t\n\t\n" ((xmlindent++)) + packagesidentity="org.chameleon.options.$builtOptionsList" # ------------------------------------------------------ - # parse OptionalSettings folder to find files of boot options. + # Read boot option file into an array. # ------------------------------------------------------ - OptionalSettingsFolder="${pkgroot}/OptionalSettings" - OptionalSettingsFiles=($( find "${OptionalSettingsFolder}" -depth 1 ! -name '.svn' ! -name '.DS_Store' )) - - for (( i = 0 ; i < ${#OptionalSettingsFiles[@]} ; i++ )) - do - - # Take filename and Strip .txt from end and path from front - builtOptionsList=$( echo ${OptionalSettingsFiles[$i]%.txt} ) - builtOptionsList=$( echo ${builtOptionsList##*/} ) - echo "================= $builtOptionsList =================" - outline[$((outlinecount++))]="${indent[$xmlindent]}" - choices[$((choicescount++))]="\t\n\t\n" - ((xmlindent++)) - packagesidentity="org.chameleon.options.$builtOptionsList" - - # ------------------------------------------------------ - # Read boot option file in to an array. - # ------------------------------------------------------ - availableOptions=() # array to hold the list of boot options, per 'section'. - exclusiveFlag=0 # used to indicate list has exclusive options. - exclusiveName="" # will be appended to exclusive 'none' option name. - count=0 # used as index for stepping through array. - while read textLine - do - # ignore lines in the file beginning with a # and Exclusive=False - if [[ ${textLine} != \#* ]] && [[ ${textLine} != "Exclusive=False" ]];then - # check for 'Exclusive=True' option in file - if [[ ${textLine} == "Exclusive=True" ]];then - exclusiveFlag=1 - exclusiveName=$builtOptionsList - else - availableOptions[count]=$textLine - ((count++)) - fi + availableOptions=() # array to hold the list of boot options, per 'section'. + exclusiveFlag=0 # used to indicate list has exclusive options + count=0 # used as index for stepping through array. + while read textLine; do + # ignore lines in the file beginning with a # and Exclusive=False + if [[ ${textLine} != \#* ]] && [[ ${textLine} != "Exclusive=False" ]];then + # check for 'Exclusive=True' option in file + if [[ ${textLine} == "Exclusive=True" ]];then + exclusiveFlag=1 + else + availableOptions[${#availableOptions[@]}]=$textLine fi - done < ${OptionalSettingsFiles[$i]} - buildoptionalsettings "$1" "${exclusiveFlag}" "${exclusiveName}" - - ((xmlindent--)) - outline[$((outlinecount++))]="${indent[$xmlindent]}" - done + fi + done < ${OptionalSettingsFiles[$i]} - # build KeyLayout options packages - echo "================= Keymaps Options =================" - outline[$((outlinecount++))]="${indent[$xmlindent]}" - choices[$((choicescount++))]="\t\n\t\n" - ((xmlindent++)) - packagesidentity="org.chameleon.options.keylayout" - - # ------------------------------------------------------ - # Available Keylayout boot options are discovered by - # reading contents of /Keymaps folder after compilation - # ------------------------------------------------------ - availableOptions=() - availableOptions=($( find "${1%/sym/*}/Keymaps" -type f -depth 1 -name '*.lyt' | sed 's|.*/||;s|\.lyt||' )) - # Adjust array contents to match expected format - # for boot options which is: name:key=value - for (( i = 0 ; i < ${#availableOptions[@]} ; i++ )) - do - availableOptions[i]=${availableOptions[i]}":KeyLayout="${availableOptions[i]} - done - - # to indicate exclusive option, call buildoptionalsettings with the 2nd parameter set to 1 . - buildoptionalsettings "$1" "1" "keylayout" - - ((xmlindent--)) - outline[$((outlinecount++))]="${indent[$xmlindent]}" + # ------------------------------------------------------ + # Loop through options in array and process each in turn + # ------------------------------------------------------ + allChoices="${availableOptions[@]//:*/}" + for (( c = 0 ; c < ${#availableOptions[@]} ; c++ )); do + textLine=${availableOptions[c]} + # split line - taking all before ':' as option name + # and all after ':' as key/value + optionName=${textLine%:*} + keyValue=${textLine##*:} - # End build KeyLayout options packages + # create folders required for each boot option + mkdir -p "${1}/$optionName/Root/" - ((xmlindent--)) - outline[$((outlinecount++))]="${indent[$xmlindent]}" + # create dummy file with name of key/value + echo "" > "${1}/$optionName/Root/${keyValue}" - # End build options packages - - # build theme packages - echo "================= Themes =================" - outline[$((outlinecount++))]="${indent[$xmlindent]}" - choices[$((choicescount++))]="\t\n\t\n" - ((xmlindent++)) - - # Using themes section from Azi's/package branch. - packagesidentity="org.chameleon.themes" - artwork="${1%/sym/package}/artwork/themes" - themes=($( find "${artwork}" -type d -depth 1 -not -name '.svn' )) - for (( i = 0 ; i < ${#themes[@]} ; i++ )) - do - theme=$( echo ${themes[$i]##*/} | awk 'BEGIN{OFS=FS=""}{$1=toupper($1);print}' ) - mkdir -p "${1}/${theme}/Root/" - rsync -r --exclude=.svn "${themes[$i]}/" "${1}/${theme}/Root/${theme}" - echo " [BUILD] ${theme}" - buildpackage "${1}/${theme}" "/$chamTemp/Extra/Themes" "" "start_selected=\"false\"" >/dev/null 2>&1 + echo -e "\t[BUILD] ${optionName} " + packageRefId=$(getPackageRefId "${packagesidentity}" "${optionName}") + buildpackage "$packageRefId" "${optionName}" "${1}/${optionName}" "/$chamTemp/options" >/dev/null 2>&1 + exclusiveSelect="" + if [[ ${exclusiveFlag} -eq 1 ]];then + exclusiveSelect="selected=\"$(exclusive_zero_or_one_choice "$optionName" "$allChoices")\"" + fi + addChoice "${optionName}" "start_selected=\"false\" ${exclusiveSelect}" "$packageRefId" done ((xmlindent--)) outline[$((outlinecount++))]="${indent[$xmlindent]}" - # End build theme packages# End build Extras package + done -# build post install package - echo "================= Post =================" - packagesidentity="org.chameleon" - mkdir -p ${1}/Post/Root - mkdir -p ${1}/Post/Scripts - cp -f ${pkgroot}/Scripts/Main/postinstall ${1}/Post/Scripts - cp -f ${pkgroot}/Scripts/Sub/InstallLog.sh ${1}/Post/Scripts - cp -f ${pkgroot}/Scripts/Sub/UnMountEFIvolumes.sh ${1}/Post/Scripts - ditto --noextattr --noqtn ${1%/*/*}/revision ${1}/Post/Scripts/Resources/revision - ditto --noextattr --noqtn ${1%/*/*}/version ${1}/Post/Scripts/Resources/version - echo " [BUILD] Post " - buildpackage "${1}/Post" "/" "" "start_visible=\"false\" start_selected=\"true\"" >/dev/null 2>&1 -# End build post install package + # build KeyLayout options packages + echo "================= Keymaps Options =================" + outline[$((outlinecount++))]="${indent[$xmlindent]}" + choices[$((choicescount++))]="\t\n\t\n" + ((xmlindent++)) + packagesidentity="org.chameleon.options.keylayout" + keylayoutPackageRefId=$(getPackageRefId "${modules_packages_identity}" "Keylayout") -((xmlindent--)) -outline[$((outlinecount++))]="${indent[$xmlindent]}" + # ------------------------------------------------------ + # Available Keylayout boot options are discovered by + # reading contents of /Keymaps folder after compilation + # ------------------------------------------------------ + availableOptions=($( find "${1%/sym/*}/Keymaps" -type f -depth 1 -name '*.lyt' | sed 's|.*/||;s|\.lyt||' )) + allChoices="${availableOptions[@]}" + # Adjust array contents to match expected format + # for boot options which is: name:key=value + for (( i = 0 ; i < ${#availableOptions[@]} ; i++ )); do + # availableOptions[i]=${availableOptions[i]}":KeyLayout="${availableOptions[i]} + # Start build of a keymap package module + choiceId="${availableOptions[i]}" + mkdir -p ${1}/${choiceId}/Root -# build meta package + # create dummy file with name of key/value + echo "" > "${1}/${choiceId}/Root/KeyLayout=${availableOptions[i]}" - makedistribution "${1}" "${2}" "${3}" "${4}" #"${5}" + echo -e "\t[BUILD] ${choiceId} " + packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}") + buildpackage "$packageRefId" "${choiceId}" "${1}/${choiceId}" "/$chamTemp/options" >/dev/null 2>&1 + exclusiveChoice=$(exclusive_zero_or_one_choice "$choiceId" "$allChoices") + # Add the Keylayout package because the Keylayout module is needed + addChoice "${choiceId}" "start_selected=\"false\" selected=\"${exclusiveChoice}\"" \ + "$packageRefId" "$keylayoutPackageRefId" + # End build uClibc package module + done -# clean up + ((xmlindent--)) + outline[$((outlinecount++))]="${indent[$xmlindent]}" - rm -R -f "${1}" + # End build KeyLayout options packages -} + ((xmlindent--)) + outline[$((outlinecount++))]="${indent[$xmlindent]}" +# End build options packages -fixperms () -{ - # $1 path - find "${1}" -type f -exec chmod 644 {} \; - find "${1}" -type d -exec chmod 755 {} \; - chown -R 0:0 "${1}" -} +# build theme packages + echo "================= Themes =================" + outline[$((outlinecount++))]="${indent[$xmlindent]}" + choices[$((choicescount++))]="\t\n\t\n" + ((xmlindent++)) -buildoptionalsettings() -{ - # $1 Path to package to build containing Root and or Scripts - # $2 = exclusiveFlag - # S3 = exclusiveName - - # ------------------------------------------------------ - # if exclusiveFlag=1 then re-build array - # adding extra boot option at beginning to give - #user a chance to choose none of them. - # ------------------------------------------------------ - if [ ${2} = "1" ]; then - tempArray=("${availableOptions[@]}") - availableOptions=() - availableOptions[0]="ChooseNone-"$3":DONT=ADD" - position=0 - totalItems="${#tempArray[@]}" - for (( position = 0 ; position < $totalItems ; position++ )) - do - availableOptions[$position+1]=${tempArray[${position}]} - done - fi - - # ------------------------------------------------------ - # Loop through options in array and process each in turn - # ------------------------------------------------------ - for (( c = 0 ; c < ${#availableOptions[@]} ; c++ )) - do - textLine=${availableOptions[c]} - # split line - taking all before ':' as option name - # and all after ':' as key/value - optionName=${textLine%:*} - keyValue=${textLine##*:} + # Using themes section from Azi's/package branch. + packagesidentity="org.chameleon.themes" + artwork="${1%/sym/package}/artwork/themes" + themes=($( find "${artwork}" -type d -depth 1 -not -name '.svn' )) + for (( i = 0 ; i < ${#themes[@]} ; i++ )); do + theme=$( echo ${themes[$i]##*/} | awk 'BEGIN{OFS=FS=""}{$1=toupper($1);print}' ) + mkdir -p "${1}/${theme}/Root/" + rsync -r --exclude=.svn "${themes[$i]}/" "${1}/${theme}/Root/${theme}" + echo -e "\t[BUILD] ${theme}" + packageRefId=$(getPackageRefId "${packagesidentity}" "${theme}") + buildpackage "$packageRefId" "${theme}" "${1}/${theme}" "/$chamTemp/Extra/Themes" >/dev/null 2>&1 + addChoice "${theme}" "start_selected=\"false\"" "$packageRefId" + done - # create folders required for each boot option - mkdir -p "${1}/$optionName/Root/" + ((xmlindent--)) + outline[$((outlinecount++))]="${indent[$xmlindent]}" +# End build theme packages# End build Extras package - # create dummy file with name of key/value - echo "" > "${1}/$optionName/Root/${keyValue}" +# build post install package + echo "================= Post =================" + packagesidentity="org.chameleon" + choiceId="Post" + mkdir -p ${1}/${choiceId}/Root + mkdir -p ${1}/${choiceId}/Scripts + cp -f ${pkgroot}/Scripts/Main/postinstall ${1}/${choiceId}/Scripts + cp -f ${pkgroot}/Scripts/Sub/InstallLog.sh ${1}/${choiceId}/Scripts + cp -f ${pkgroot}/Scripts/Sub/UnMountEFIvolumes.sh ${1}/${choiceId}/Scripts + ditto --noextattr --noqtn ${1%/*/*}/revision ${1}/${choiceId}/Scripts/Resources/revision + ditto --noextattr --noqtn ${1%/*/*}/version ${1}/${choiceId}/Scripts/Resources/version + echo -e "\t[BUILD] ${choiceId} " + packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}") + buildpackage "$packageRefId" "${choiceId}" "${1}/${choiceId}" "/" >/dev/null 2>&1 + addChoice "${choiceId}" "start_visible=\"false\" start_selected=\"true\"" "$packageRefId" +# End build post install package - echo " [BUILD] ${optionName} " + ((xmlindent--)) + outline[$((outlinecount++))]="${indent[$xmlindent]}" - # ------------------------------------------------------ - # Before calling buildpackage, add exclusive options - # to buildpackage call if requested. - # ------------------------------------------------------ - if [ $2 = "1" ]; then +# build meta package - # Prepare individual string parts - stringStart="selected=\"" - stringBefore="exclusive(choices['" - stringAfter="']) && " - stringEnd="'])\"" - x=${stringStart}${stringBefore} + makedistribution "${1}" "${2}" "${3}" "${4}" #"${5}" - # build string for sending to buildpackage - totalItems="${#availableOptions[@]}" - lastItem=$((totalItems-1)) +# clean up + # rm -R -f "${1}" - for (( r = 0 ; r < ${totalItems} ; r++ )) - do - textLineTemp=${availableOptions[r]} - optionNameTemp=${textLineTemp%:*} - if [ "${optionNameTemp}" != "${optionName}" ]; then - x="${x}${optionNameTemp}" - # Only add these to end of string up to the one before the last item - if [ $r -lt $lastItem ]; then - x="${x}${stringAfter}${stringBefore}" - fi - fi - done - x="${x}${stringEnd}" - - # 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 - done } buildpackage () { -# $1 Path to package to build containing Root and or Scripts -# $2 Install Location -# $3 Size -# $4 Options + # $1 Package Reference Id (ie: org.chameleon.themes.default) + # $2 Package Name (ie: Default) + # $3 Path to package to build containing Root and/or Scripts + # $4 Target install location + # $5 Size (optional) + if [[ -d "${3}/Root" ]]; then + local packageRefId="$1" + local packageName="$2" + local packagePath="$3" + local targetPath="$4" + local packageSize="$5" -if [ -d "${1}/Root" ] && [ "${1}/Scripts" ]; then + find "${packagePath}" -name '.DS_Store' -delete + local filecount=$( find "${packagePath}/Root" | wc -l ) + if [ "${packageSize}" ]; then + local installedsize="${packageSize}" + else + local installedsize=$( du -hkc "${packagePath}/Root" | tail -n1 | awk {'print $1'} ) + fi + local header="\n\n\n" + header+="\t\n" + rm -R -f "${packagePath}/Temp" - header+="auth=\"root\">\n" - header+="\t\n" - rm -R -f "${1}/Temp" + [ -d "${packagePath}/Temp" ] || mkdir -m 777 "${packagePath}/Temp" + [ -d "${packagePath}/Root" ] && mkbom "${packagePath}/Root" "${packagePath}/Temp/Bom" - [ -d "${1}/Temp" ] || mkdir -m 777 "${1}/Temp" - [ -d "${1}/Root" ] && mkbom "${1}/Root" "${1}/Temp/Bom" + if [ -d "${packagePath}/Scripts" ]; then + header+="\t\n" + for script in $( find "${packagePath}/Scripts" -type f \( -name 'pre*' -or -name 'post*' \) ); do + header+="\t\t<${script##*/} file=\"./${script##*/}\"/>\n" + done + header+="\t\n" + # Create the Script archive file (cpio format) + (cd "${packagePath}/Scripts" && find . -print | cpio -o -z -R root:wheel --format cpio > "${packagePath}/Temp/Scripts") 2>&1 | \ + grep -vE '^[0-9]+\s+blocks?$' # to remove cpio stderr messages + fi - if [ -d "${1}/Scripts" ]; then - header+="\t\n" - for script in $( find "${1}/Scripts" -type f \( -name 'pre*' -or -name 'post*' \) ) - do - header+="\t\t<${script##*/} file=\"./${script##*/}\"/>\n" - done - header+="\t\n" - chown -R 0:0 "${1}/Scripts" - pushd "${1}/Scripts" >/dev/null - find . -print | cpio -o -z -H cpio > "../Temp/Scripts" - popd >/dev/null - fi + header+="" + echo -e "${header}" > "${packagePath}/Temp/PackageInfo" - header+="" - echo -e "${header}" > "${1}/Temp/PackageInfo" - pushd "${1}/Root" >/dev/null - find . -print | cpio -o -z -H cpio > "../Temp/Payload" - popd >/dev/null - pushd "${1}/Temp" >/dev/null + # Create the Payload file (cpio format) + (cd "${packagePath}/Root" && find . -print | cpio -o -z -R root:wheel --format cpio > "${packagePath}/Temp/Payload") 2>&1 | \ + grep -vE '^[0-9]+\s+blocks?$' # to remove cpio stderr messages - xar -c -f "${1%/*}/${packagename// /}.pkg" --compression none . + # Create the package + (cd "${packagePath}/Temp" && xar -c -f "${packagePath}/../${packageName}.pkg" --compression none .) - popd >/dev/null + # Add the package to the list of build packages + pkgrefs[${#pkgrefs[*]}]="\t#${packageName}.pkg" - outline[$((outlinecount++))]="${indent[$xmlindent]}" - - if [ "${4}" ]; then - local choiceoptions="\t\t${4}" + rm -rf "${packagePath}" fi - choices[$((choicescount++))]="\t\n\t\t#${packagename// /}.pkg\n\t\n" - rm -R -f "${1}" -fi } makedistribution () { - rm -f "${1%/*}/${packagename// /}"*.pkg + distributionDestDir="${1%/*}" + distributionFilename="${packagename// /}-${version}-r${revision}.pkg" + distributionFilePath="${distributionDestDir}/${distributionFilename}" - find "${1}" -type f -name '*.pkg' -depth 1 | while read component + rm -f "${distributionDestDir}/${packagename// /}"*.pkg + + mkdir -p "${1}/${packagename}" + + find "${1}" -type f -name '*.pkg' -depth 1 | while read component do - mkdir -p "${1}/${packagename}/${component##*/}" - pushd "${1}/${packagename}/${component##*/}" >/dev/null - xar -x -f "${1%}/${component##*/}" - popd >/dev/null + pkg="${component##*/}" # ie: EFI.pkg + pkgdir="${1}/${packagename}/${pkg}" + # expand individual packages + pkgutil --expand "${1%}/${pkg}" "$pkgdir" + rm -f "${1%}/${pkg}" + done + +# Create the Distribution file + ditto --noextattr --noqtn "${pkgroot}/Distribution" "${1}/${packagename}/Distribution" + + for (( i=0; i < ${#outline[*]} ; i++)); do + echo -e "${outline[$i]}" >> "${1}/${packagename}/Distribution" done - ditto --noextattr --noqtn "${pkgroot}/Distribution" "${1}/${packagename}/Distribution" - ditto --noextattr --noqtn "${pkgroot}/Resources" "${1}/${packagename}/Resources" + for (( i=0; i < ${#choices[*]} ; i++)); do + echo -e "${choices[$i]}" >> "${1}/${packagename}/Distribution" + done - find "${1}/${packagename}/Resources" -type d -name '.svn' -exec rm -R -f {} \; 2>/dev/null + for (( i=0; i < ${#pkgrefs[*]} ; i++)); do + echo -e "${pkgrefs[$i]}" >> "${1}/${packagename}/Distribution" + done - for (( i=0; i < ${#outline[*]} ; i++)); - do - echo -e "${outline[$i]}" >> "${1}/${packagename}/Distribution" - done + echo -e "\n
" >> "${1}/${packagename}/Distribution" - for (( i=0; i < ${#choices[*]} ; i++)); - do - echo -e "${choices[$i]}" >> "${1}/${packagename}/Distribution" - done +# Create the Resources directory + ditto --noextattr --noqtn "${pkgroot}/Resources" "${1}/${packagename}/Resources" - echo "" >> "${1}/${packagename}/Distribution" +# CleanUp the directory + find "${1}/${packagename}" -type d -name '.svn' -exec rm -rf {} \; 2>/dev/null + find "${1}/${packagename}" -name '.DS_Store' -delete - perl -i -p -e "s/%CHAMELEONVERSION%/${version%%-*}/g" `find "${1}/${packagename}/Resources" -type f` - perl -i -p -e "s/%CHAMELEONREVISION%/${revision}/g" `find "${1}/${packagename}/Resources" -type f` +# Add Chameleon Version and Revision + perl -i -p -e "s/%CHAMELEONVERSION%/${version%%-*}/g" $( find "${1}/${packagename}/Resources" -type f ) + perl -i -p -e "s/%CHAMELEONREVISION%/${revision}/g" $( find "${1}/${packagename}/Resources" -type f ) -# Adding Developer and credits - perl -i -p -e "s/%DEVELOP%/${develop}/g" `find "${1}/${packagename}/Resources" -type f` - perl -i -p -e "s/%CREDITS%/${credits}/g" `find "${1}/${packagename}/Resources" -type f` - perl -i -p -e "s/%PKGDEV%/${pkgdev}/g" `find "${1}/${packagename}/Resources" -type f` +# Add Chameleon Stage + stage=${stage/RC/Release Candidate } + stage=${stage/FINAL/2.0 Final} + perl -i -p -e "s/%CHAMELEONSTAGE%/${stage}/g" $( find "${1}/${packagename}/Resources" -type f ) - stage=${stage/RC/Release Candidate } - stage=${stage/FINAL/2.0 Final} - perl -i -p -e "s/%CHAMELEONSTAGE%/${stage}/g" `find "${1}/${packagename}/Resources" -type f` +# Adding Developer and credits + perl -i -p -e "s/%DEVELOP%/${develop}/g" $( find "${1}/${packagename}/Resources" -type f ) + perl -i -p -e "s/%CREDITS%/${credits}/g" $( find "${1}/${packagename}/Resources" -type f ) + perl -i -p -e "s/%PKGDEV%/${pkgdev}/g" $( find "${1}/${packagename}/Resources" -type f ) - find "${1}/${packagename}" -name '.DS_Store' -delete - pushd "${1}/${packagename}" >/dev/null - xar -c -f "${1%/*}/${packagename// /}-${version}-r${revision}.pkg" --compression none . - popd >/dev/null +# Create the final package + pkgutil --flatten "${1}/${packagename}" "${distributionFilePath}" # Here is the place for assign a Icon to the pkg # command use to generate the file: # ditto -c -k --sequesterRsrc --keepParent Icon.icns Icon.zip # ---- - 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-${version}-r$revision.pkg" - SetFile -a C "${1%/*}/$packagename-${version}-r$revision.pkg" - rm -f tempicns.rsrc - rm -rf "${pkgroot}/Icons/Icons" + ditto -xk "${pkgroot}/Icons/pkg.zip" "${1}/Icons/" + DeRez -only icns "${1}/Icons/Icons/pkg.icns" > "${1}/Icons/tempicns.rsrc" + Rez -append "${1}/Icons/tempicns.rsrc" -o "${distributionFilePath}" + SetFile -a C "${distributionFilePath}" + rm -rf "${1}/Icons" + # End - md5=$( md5 "${1%/*}/${packagename// /}-${version}-r${revision}.pkg" | awk {'print $4'} ) - echo "MD5 (${packagename// /}-${version}-r${revision}.pkg) = ${md5}" > "${1%/*}/${packagename// /}-${version}-r${revision}.pkg.md5" - echo "" + md5=$( md5 "${distributionFilePath}" | awk {'print $4'} ) + echo "MD5 (${distributionFilePath}) = ${md5}" > "${distributionFilePath}.md5" + echo "" - echo -e $COL_GREEN" --------------------------"$COL_RESET - echo -e $COL_GREEN" Building process complete!"$COL_RESET - echo -e $COL_GREEN" --------------------------"$COL_RESET - echo "" - echo -e $COL_GREEN" Build info." - echo -e $COL_GREEN" ===========" - echo -e $COL_BLUE" Package name: "$COL_RESET"$packagename-${version}-r$revision.pkg" - echo -e $COL_BLUE" MD5: "$COL_RESET"$md5" - echo -e $COL_BLUE" Version: "$COL_RESET"$version" - echo -e $COL_BLUE" Stage: "$COL_RESET"$stage" - echo -e $COL_BLUE" Date/Time: "$COL_RESET"$builddate" - echo "" + echo -e $COL_GREEN" --------------------------"$COL_RESET + echo -e $COL_GREEN" Building process complete!"$COL_RESET + echo -e $COL_GREEN" --------------------------"$COL_RESET + echo "" + echo -e $COL_GREEN" Build info." + echo -e $COL_GREEN" ===========" + echo -e $COL_BLUE" Package name: "$COL_RESET"${distributionFilename}" + echo -e $COL_BLUE" MD5: "$COL_RESET"$md5" + echo -e $COL_BLUE" Version: "$COL_RESET"$version" + echo -e $COL_BLUE" Stage: "$COL_RESET"$stage" + echo -e $COL_BLUE" Date/Time: "$COL_RESET"$builddate" + echo "" } main "${1}" "${2}" "${3}" "${4}" #"${5}" - Index: branches/ErmaC/Trunk/CREDITS =================================================================== --- branches/ErmaC/Trunk/CREDITS (revision 1750) +++ branches/ErmaC/Trunk/CREDITS (revision 1751) @@ -11,4 +11,4 @@ Package: --------- -kalyway, AzimutZ, blackosx, ErmaC, scrax +kalyway, AzimutZ, blackosx, ErmaC, scrax, JrCs Index: branches/ErmaC/Trunk/Make.rules =================================================================== --- branches/ErmaC/Trunk/Make.rules (revision 1750) +++ branches/ErmaC/Trunk/Make.rules (revision 1751) @@ -141,13 +141,24 @@ || eval $$failcom; \ done + clean-dep: @if [ -f "$(OBJROOT)/Makedep" ];then echo "\t[RM] $(OBJROOT)/Makedep"; fi @rm -f $(OBJROOT)/Makedep + +FIND_IGNORE := \( -name .git -o -name .svn \) -prune -o -name Cconfig -o + +# clean: remove most generated files clean: clean-recursive clean-dep distclean: distclean-recursive clean-local clean-dep + @find . $(FIND_IGNORE) \ + \( -name '*.orig' -o -name '*.rej' -o -name '*~' \ + -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \ + -o -name '.*.rej' -o -size 0 \ + -o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \ + -type f -print | xargs rm -f clean-local: Index: branches/ErmaC/Trunk/CHANGES =================================================================== --- branches/ErmaC/Trunk/CHANGES (revision 1750) +++ branches/ErmaC/Trunk/CHANGES (revision 1751) @@ -1,3 +1,10 @@ +- Added support for using UUIDs with ext2 filesystems (credits to bitz): http://forge.voodooprojects.org/p/chameleon/issues/208/ +- Added Guerrero's patch on gui.c: http://forge.voodooprojects.org/p/chameleon/issues/178/ +- cparm : Ported the OS detection to the trunk, updated the default theme to v 1.1 (credit to blackosx) +- Added scorpius's patch (to get an unstretched boot screen for nVidia cards on DVI) in boot0.s, + disabled by default: http://forum.voodooprojects.org/index.php/topic,2158.0.html +- Added exFAT volume label support (FAT64) support (credit to dmazar): + http://forum.voodooprojects.org/index.php/topic,2095.0.html - Added AtiPorts option to GraphicsEnabler, so users can override the default number of ports. It proved to be useful when used to limit the number of ports that a framebuffer registers, which seems to be a requirement on laptops that can only use 2 ports at the same time. Index: branches/ErmaC/Trunk/Makefile =================================================================== --- branches/ErmaC/Trunk/Makefile (revision 1750) +++ branches/ErmaC/Trunk/Makefile (revision 1751) @@ -100,10 +100,14 @@ @mv ${DISTFILE}.tar.gz ${DISTFILE}.tgz clean-local: + @if [ -d "$(SYMROOT)/package" ];then echo "\t[RMDIR] $(SYMROOT)/package"; fi @if [ -f "$(HEADER_VERSION)" ];then echo "\t[RM] $(HEADER_VERSION)"; fi @if [ -f "$(SRCROOT)/revision" ];then echo "\t[RM] $(SRCROOT)/revision"; fi - @rm -f $(HEADER_VERSION) $(SRCROOT)/revision + @rm -rf "$(SYMROOT)/package" $(HEADER_VERSION) $(SRCROOT)/revision +AUTOCONF_FILES = $(SRCROOT)/auto.conf $(SRCROOT)/autoconf.h \ + $(SRCROOT)/autoconf.inc $(SRCROOT)/.config $(SRCROOT)/.config.old + distclean-local: @if [ -d "$(OBJROOT)" ];then echo "\t[RMDIR] $(OBJROOT)"; fi @if [ -d "$(SYMROOT)" ];then echo "\t[RMDIR] $(SYMROOT)"; fi @@ -111,29 +115,38 @@ @if [ -d "$(SRCROOT)/i386/modules/module_includes" ];then \ echo "\t[RMDIR] $(SRCROOT)/i386/modules/module_includes"; \ fi - @if [ -f "$(SRCROOT)/auto.conf" ];then echo "\t[RM] $(SRCROOT)/auto.conf"; fi - @if [ -f "$(SRCROOT)/autoconf.h" ];then echo "\t[RM] $(SRCROOT)/autoconf.h"; fi - @if [ -f "$(SRCROOT)/autoconf.inc" ];then echo "\t[RM] $(SRCROOT)/autoconf.inc"; fi - + @for cfg in $(AUTOCONF_FILES); do if [ -f "$${cfg}" ];then echo "\t[RM] $${cfg}"; fi; done @rm -rf $(OBJROOT) $(SYMROOT) $(DSTROOT) \ $(SRCROOT)/i386/modules/module_includes \ - $(SRCROOT)/auto.conf \ - $(SRCROOT)/autoconf.h \ - $(SRCROOT)/autoconf.inc + $(AUTOCONF_FILES) pkg installer: all - ${SRCROOT}/package/buildpkg.sh ${SYMROOT}/package; - @echo "\t[ZIP] ${DISTFILE}.pkg" - @ditto -c -k --sequesterRsrc ${DISTFILE}.pkg ${DISTFILE}.pkg.zip - @rm -r ${DISTFILE}.pkg + ${SRCROOT}/package/buildpkg.sh ${SYMROOT}/package dmg: all ${SRCROOT}/package/slimpkg.sh ${SYMROOT}/package; ${SRCROOT}/package/builddmg.sh ${SYMROOT}/package; +help: + @echo 'Configuration target:' + @echo ' config - Show configuration menu' + @echo + @echo 'Build targets:' + @echo ' all - Build all targets [DEFAULT]' + @echo ' dist - Build distribution tarball' + @echo ' pkg - Build installer package' + @echo + @echo 'Cleaning targets:' + @echo ' clean - Remove most generated files' + @echo ' distclean - Remove all generated files + config' +#@echo +# @echo 'Build options:' +# @echo 'make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build' + .PHONY: config .PHONY: clean .PHONY: image .PHONY: pkg .PHONY: installer .PHONY: dmg +.PHONY: help Index: branches/ErmaC/Modules/artwork/themes/default/device_hfsplus_tiger.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/ErmaC/Modules/artwork/themes/default/device_hfsplus_tiger.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/device_befs.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/text_scroll_prev.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/device_hfsraid.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/logo.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/device_hfsplus_sl.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/ErmaC/Modules/artwork/themes/default/device_hfsplus_sl.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/device_hfsplus_lion_o.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/ErmaC/Modules/artwork/themes/default/device_hfsplus_lion_o.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/device_ext3.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/device_hfsplus_leo.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/ErmaC/Modules/artwork/themes/default/device_hfsplus_leo.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/boot.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/menu_single_user.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/device_fat_o.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/device_freebsd_o.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/device_hfsraid_tiger_o.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/ErmaC/Modules/artwork/themes/default/device_hfsraid_tiger_o.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/device_ntfs_o.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/device_scroll_prev.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/device_openbsd.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/device_hfsraid_sl_o.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/ErmaC/Modules/artwork/themes/default/device_hfsraid_sl_o.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/device_hfsraid_leo_o.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/ErmaC/Modules/artwork/themes/default/device_hfsraid_leo_o.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/menu_ignore_caches.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/menu_verbose_disabled.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/device_hfsplus_o.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/device_hfsplus_lion.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/ErmaC/Modules/artwork/themes/default/device_hfsplus_lion.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/menu_boot.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/font_console.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/device_ntfs.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/device_hfsraid_tiger.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/ErmaC/Modules/artwork/themes/default/device_hfsraid_tiger.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/device_freebsd.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/device_fat.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/menu_single_user_disabled.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/device_hfsraid_sl.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/ErmaC/Modules/artwork/themes/default/device_hfsraid_sl.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/device_hfsraid_lion_o.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/ErmaC/Modules/artwork/themes/default/device_hfsraid_lion_o.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/device_hfsraid_leo.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/ErmaC/Modules/artwork/themes/default/device_hfsraid_leo.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/font_small.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/text_scroll_next.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/device_cdrom_o.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/device_hfsplus.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/device_selection.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/menu_ignore_caches_disabled.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/menu_video_info.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/menu_memory_info.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/device_generic_o.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/menu_selection.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/theme.plist =================================================================== --- branches/ErmaC/Modules/artwork/themes/default/theme.plist (revision 1750) +++ branches/ErmaC/Modules/artwork/themes/default/theme.plist (revision 1751) @@ -5,11 +5,9 @@ Author Blackosx Version - 1.0 - + 1.1 Enabled no - screen_width 1024 screen_height @@ -20,12 +18,10 @@ 10 screen_bgcolor #767f73 - background_pos_x 50% background_pos_y 0 - logo_pos_x logo_pos_y @@ -34,7 +30,6 @@ #000000 logo_transparency 255 - devices_pos_x devices_pos_y @@ -49,7 +44,6 @@ 45 devices_layout horizontal - bootprompt_pos_x bootprompt_pos_y @@ -66,7 +60,6 @@ #3e3e3e bootprompt_transparency 1 - infobox_pos_x infobox_pos_y @@ -83,7 +76,6 @@ #3e3e3e infobox_transparency 35 - menu_pos_x menu_pos_y @@ -96,7 +88,6 @@ #3e3e3e menu_transparency 1 - progressbar_pos_x progressbar_pos_y @@ -105,12 +96,10 @@ 100 progressbar_height 40 - countdown_pos_x countdown_pos_y -20% - boot_width 1024 boot_height Index: branches/ErmaC/Modules/artwork/themes/default/device_hfsplus_tiger_o.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/ErmaC/Modules/artwork/themes/default/device_hfsplus_tiger_o.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/device_scroll_next.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/device_befs_o.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/menu_help.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/device_hfsraid_o.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/device_hfsplus_sl_o.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/ErmaC/Modules/artwork/themes/default/device_hfsplus_sl_o.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/background.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/thumb.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/device_hfsraid_lion.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/ErmaC/Modules/artwork/themes/default/device_hfsraid_lion.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/device_hfsplus_leo_o.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/ErmaC/Modules/artwork/themes/default/device_hfsplus_leo_o.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/device_ext3_o.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/device_cdrom.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/device_openbsd_o.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/progress_bar_background.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/progress_bar.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/menu_verbose.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/artwork/themes/default/device_generic.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/i386/libsaio/ext2fs.c =================================================================== --- branches/ErmaC/Modules/i386/libsaio/ext2fs.c (revision 1750) +++ branches/ErmaC/Modules/i386/libsaio/ext2fs.c (revision 1751) @@ -18,6 +18,35 @@ return (OSReadLittleInt16(buf+0x438,0)==0xEF53); } +long EX2GetUUID(CICell ih, char *uuidStr) +{ + uint8_t *b, *buf=malloc (EX2ProbeSize); + if (!buf) + return -1; + Seek(ih, 0); + Read(ih, (long)buf, EX2ProbeSize); + if (!EX2Probe (buf)) + { + free (buf); + return -1; + } + if (OSReadLittleInt32 (buf+0x44c,0)<1) + { + free (buf); + return -1; + } + b=buf+0x468; + sprintf(uuidStr, + "%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X", + b[0], b[1], b[2], b[3], + b[4], b[5], + b[6], b[7], + b[8], b[9], + b[10], b[11], b[12], b[13], b[14], b[15]); + free (buf); + return 0; +} + void EX2GetDescription(CICell ih, char *str, long strMaxLen) { char * buf=malloc (EX2ProbeSize); Index: branches/ErmaC/Modules/i386/libsaio/ext2fs.h =================================================================== --- branches/ErmaC/Modules/i386/libsaio/ext2fs.h (revision 1750) +++ branches/ErmaC/Modules/i386/libsaio/ext2fs.h (revision 1751) @@ -9,3 +9,4 @@ extern bool EX2Probe (const void *buf); extern void EX2GetDescription(CICell ih, char *str, long strMaxLen); +extern long EX2GetUUID(CICell ih, char *uuidStr); Index: branches/ErmaC/Modules/i386/libsaio/acpi_patcher.c =================================================================== --- branches/ErmaC/Modules/i386/libsaio/acpi_patcher.c (revision 1750) +++ branches/ErmaC/Modules/i386/libsaio/acpi_patcher.c (revision 1751) @@ -819,7 +819,7 @@ sprintf(filename, i>0?"SSDT-%d.aml":"SSDT.aml", i); - if(new_ssdt[ssdt_count] = loadACPITable(filename)) + if ( (new_ssdt[ssdt_count] = loadACPITable(filename)) ) { ssdt_count++; } Index: branches/ErmaC/Modules/i386/libsaio/usb.c =================================================================== --- branches/ErmaC/Modules/i386/libsaio/usb.c (revision 1750) +++ branches/ErmaC/Modules/i386/libsaio/usb.c (revision 1751) @@ -244,7 +244,7 @@ //We try soft reset first - some systems hang on reboot with hard reset // Definitely needed during reboot on 10.4.6 - isOwnershipConflict = ((legacy[3] & 1 != 0) && (legacy[2] & 1 != 0)); + isOwnershipConflict = (((legacy[3] & 1) != 0) && ((legacy[2] & 1) != 0)); if (!alwaysHardBIOSReset && isOwnershipConflict) { DBG("EHCI - Ownership conflict - attempting soft reset ...\n"); DBG("EHCI - toggle OS Ownership to 0\n"); Index: branches/ErmaC/Modules/i386/libsaio/disk.c =================================================================== --- branches/ErmaC/Modules/i386/libsaio/disk.c (revision 1750) +++ branches/ErmaC/Modules/i386/libsaio/disk.c (revision 1751) @@ -131,6 +131,7 @@ unsigned int byteCount, void * buffer ) = NULL; int (*p_get_ramdisk_info)(int biosdev, struct driveInfo *dip) = NULL; +static bool getOSVersion(BVRef bvr, char *str); extern void spinActivityIndicator(int sectors); @@ -896,7 +897,8 @@ biosdev, partno, part->relsect, part, - 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + EX2GetUUID, EX2GetDescription, (BVFree)free, 0, kBIOSDevTypeHardDrive, 0); @@ -1143,7 +1145,7 @@ result = FDISK_NTFS; else if (BeFSProbe(probeBuffer)) result = FDISK_BEFS; - else if (fatbits=MSDOSProbe(probeBuffer)) + else if ( (fatbits = MSDOSProbe(probeBuffer)) ) { switch (fatbits) { @@ -1184,7 +1186,7 @@ struct DiskBVMap * map = NULL; void *buffer = malloc(BPS); int error; - if ( error = readBytes( biosdev, /*secno*/0, 0, BPS, buffer ) != 0) { + if ( (error = readBytes( biosdev, /*secno*/0, 0, BPS, buffer )) != 0) { verbose("Failed to read boot sector from BIOS device %02xh. Error=%d\n", biosdev, error); goto scanErr; } @@ -1427,6 +1429,48 @@ } } +static bool getOSVersion(BVRef bvr, char *str) +{ + bool valid = false; + config_file_t systemVersion; + char dirSpec[512]; + + sprintf(dirSpec, "hd(%d,%d)/System/Library/CoreServices/SystemVersion.plist", BIOS_DEV_UNIT(bvr), bvr->part_no); + + if (!loadConfigFile(dirSpec, &systemVersion)) + { + valid = true; + } + else + { + sprintf(dirSpec, "hd(%d,%d)/System/Library/CoreServices/ServerVersion.plist", BIOS_DEV_UNIT(bvr), bvr->part_no); + + if (!loadConfigFile(dirSpec, &systemVersion)) + { + bvr->OSisServer = true; + valid = true; + } + } + + if (valid) + { + const char *val; + int len; + + if (getValueForKey(kProductVersion, &val, &len, &systemVersion)) + { + // getValueForKey uses const char for val + // so copy it and trim + *str = '\0'; + strncat(str, val, MIN(len, 4)); + } + else + valid = false; + } + + return valid; +} + //========================================================================== static void scanFSLevelBVRSettings(BVRef chain) @@ -1479,18 +1523,10 @@ // if (bvr->flags & kBVFlagNativeBoot) { - sprintf(dirSpec, "hd(%d,%d)/System/Library/CoreServices/", BIOS_DEV_UNIT(bvr), bvr->part_no); - strcpy(fileSpec, "SystemVersion.plist"); - ret = GetFileInfo(dirSpec, fileSpec, &flags, &time); - - if (ret == -1) - { - strcpy(fileSpec, "ServerVersion.plist"); - ret = GetFileInfo(dirSpec, fileSpec, &flags, &time); - } - - if (!ret) - bvr->flags |= kBVFlagSystemVolume; + if (getOSVersion(bvr,bvr->OSVersion) == true) + { + bvr->flags |= kBVFlagSystemVolume; + } } } Index: branches/ErmaC/Modules/i386/libsaio/smbios_decode.c =================================================================== --- branches/ErmaC/Modules/i386/libsaio/smbios_decode.c (revision 1750) +++ branches/ErmaC/Modules/i386/libsaio/smbios_decode.c (revision 1751) @@ -23,6 +23,40 @@ extern char *getSMBStringForField(SMBStructHeader *structHeader, uint8_t field); +static const char * +SMBMemoryDeviceTypes[] = +{ + "RAM", /* 00h Undefined */ + "RAM", /* 01h Other */ + "RAM", /* 02h Unknown */ + "DRAM", /* 03h DRAM */ + "EDRAM", /* 04h EDRAM */ + "VRAM", /* 05h VRAM */ + "SRAM", /* 06h SRAM */ + "RAM", /* 07h RAM */ + "ROM", /* 08h ROM */ + "FLASH", /* 09h FLASH */ + "EEPROM", /* 0Ah EEPROM */ + "FEPROM", /* 0Bh FEPROM */ + "EPROM", /* 0Ch EPROM */ + "CDRAM", /* 0Dh CDRAM */ + "3DRAM", /* 0Eh 3DRAM */ + "SDRAM", /* 0Fh SDRAM */ + "SGRAM", /* 10h SGRAM */ + "RDRAM", /* 11h RDRAM */ + "DDR SDRAM", /* 12h DDR */ + "DDR2 SDRAM", /* 13h DDR2 */ + "DDR2 FB-DIMM", /* 14h DDR2 FB-DIMM */ + "RAM", /* 15h unused */ + "RAM", /* 16h unused */ + "RAM", /* 17h unused */ + "DDR3", /* 18h DDR3, chosen in [5776134] */ +}; + +static const int +kSMBMemoryDeviceTypeCount = sizeof(SMBMemoryDeviceTypes) / + sizeof(SMBMemoryDeviceTypes[0]); + //------------------------------------------------------------------------------------------------------------------------- // BIOSInformation //------------------------------------------------------------------------------------------------------------------------- Index: branches/ErmaC/Modules/i386/libsaio/smbios.h =================================================================== --- branches/ErmaC/Modules/i386/libsaio/smbios.h (revision 1750) +++ branches/ErmaC/Modules/i386/libsaio/smbios.h (revision 1751) @@ -386,40 +386,6 @@ SMBWord Data[]; } __attribute__((packed)) SMBMemorySPD; -static const char * -SMBMemoryDeviceTypes[] = -{ - "RAM", /* 00h Undefined */ - "RAM", /* 01h Other */ - "RAM", /* 02h Unknown */ - "DRAM", /* 03h DRAM */ - "EDRAM", /* 04h EDRAM */ - "VRAM", /* 05h VRAM */ - "SRAM", /* 06h SRAM */ - "RAM", /* 07h RAM */ - "ROM", /* 08h ROM */ - "FLASH", /* 09h FLASH */ - "EEPROM", /* 0Ah EEPROM */ - "FEPROM", /* 0Bh FEPROM */ - "EPROM", /* 0Ch EPROM */ - "CDRAM", /* 0Dh CDRAM */ - "3DRAM", /* 0Eh 3DRAM */ - "SDRAM", /* 0Fh SDRAM */ - "SGRAM", /* 10h SGRAM */ - "RDRAM", /* 11h RDRAM */ - "DDR SDRAM", /* 12h DDR */ - "DDR2 SDRAM", /* 13h DDR2 */ - "DDR2 FB-DIMM", /* 14h DDR2 FB-DIMM */ - "RAM", /* 15h unused */ - "RAM", /* 16h unused */ - "RAM", /* 17h unused */ - "DDR3", /* 18h DDR3, chosen in [5776134] */ -}; - -static const int -kSMBMemoryDeviceTypeCount = sizeof(SMBMemoryDeviceTypes) / - sizeof(SMBMemoryDeviceTypes[0]); - // // OEM Processor Type (Apple Specific - Type 131) // Index: branches/ErmaC/Modules/i386/libsaio/convert.c =================================================================== --- branches/ErmaC/Modules/i386/libsaio/convert.c (revision 1750) +++ branches/ErmaC/Modules/i386/libsaio/convert.c (revision 1751) @@ -94,9 +94,9 @@ hexNibble = hexStr[hexStrIdx]; // ignore all chars except valid hex numbers - if (hexNibble >= '0' && hexNibble <= '9' - || hexNibble >= 'A' && hexNibble <= 'F' - || hexNibble >= 'a' && hexNibble <= 'f') + if ( (hexNibble >= '0' && hexNibble <= '9') || + (hexNibble >= 'A' && hexNibble <= 'F') || + (hexNibble >= 'a' && hexNibble <= 'f') ) { hexByte[hexNibbleIdx++] = hexNibble; Index: branches/ErmaC/Modules/i386/libsaio/pci.h =================================================================== --- branches/ErmaC/Modules/i386/libsaio/pci.h (revision 1750) +++ branches/ErmaC/Modules/i386/libsaio/pci.h (revision 1751) @@ -43,7 +43,7 @@ struct pci_dt_t *next; } pci_dt_t; -#define PCIADDR(bus, dev, func) (1 << 31) | (bus << 16) | (dev << 11) | (func << 8) +#define PCIADDR(bus, dev, func) ((1 << 31) | (bus << 16) | (dev << 11) | (func << 8)) #define PCI_ADDR_REG 0xcf8 #define PCI_DATA_REG 0xcfc Index: branches/ErmaC/Modules/i386/libsaio/saio_types.h =================================================================== --- branches/ErmaC/Modules/i386/libsaio/saio_types.h (revision 1750) +++ branches/ErmaC/Modules/i386/libsaio/saio_types.h (revision 1751) @@ -191,6 +191,8 @@ char altlabel[BVSTRLEN]; /* partition volume label */ bool filtered; /* newFilteredBVChain() will set to TRUE */ bool visible; /* will shown in the device list */ + char OSVersion[8]; + bool OSisServer; /* 1 = OS X server , 0 = OS X client */ }; enum { @@ -218,9 +220,9 @@ kPartitionTypeFAT16 = 0x06, kPartitionTypeFAT32 = 0x0c, kPartitionTypeEXT3 = 0x83, - kPartitionTypeBEFS = 0xEB, - kPartitionTypeFreeBSD = 0xa5, - kPartitionTypeOpenBSD = 0xa6 + kPartitionTypeBEFS = 0xEB, + kPartitionTypeFreeBSD = 0xa5, + kPartitionTypeOpenBSD = 0xa6 }; //#define BIOS_DEV_TYPE(d) ((d) & kBIOSDevTypeMask) Index: branches/ErmaC/Modules/i386/libsaio/fake_efi.c =================================================================== --- branches/ErmaC/Modules/i386/libsaio/fake_efi.c (revision 1750) +++ branches/ErmaC/Modules/i386/libsaio/fake_efi.c (revision 1751) @@ -655,7 +655,7 @@ { // Check selected volume's Extra. sprintf(dirSpecSMBIOS, "/Extra/%s", filename); - if (err = loadConfigFile(dirSpecSMBIOS, &bootInfo->smbiosConfig)) + if ( (err = loadConfigFile(dirSpecSMBIOS, &bootInfo->smbiosConfig)) ) { // Check booter volume/rdbt Extra. sprintf(dirSpecSMBIOS, "bt(0,0)/Extra/%s", filename); Index: branches/ErmaC/Modules/i386/include/klibc/compiler.h =================================================================== --- branches/ErmaC/Modules/i386/include/klibc/compiler.h (revision 0) +++ branches/ErmaC/Modules/i386/include/klibc/compiler.h (revision 1751) @@ -0,0 +1,158 @@ +/* + * klibc/compiler.h + * + * Various compiler features + */ + +#ifndef _KLIBC_COMPILER_H +#define _KLIBC_COMPILER_H + +/* Specific calling conventions */ +/* __cdecl is used when we want varadic and non-varadic functions to have + the same binary calling convention. */ +#ifdef __i386__ +# ifdef __GNUC__ +# define __cdecl __attribute__((cdecl,regparm(0))) +# else + /* Most other C compilers have __cdecl as a keyword */ +# endif +#else +# define __cdecl /* Meaningless on non-i386 */ +#endif + +/* + * How to declare a function which should be inlined or instantiated locally + */ +#ifdef __GNUC__ +# ifdef __GNUC_STDC_INLINE__ +# define __static_inline static __inline__ __attribute__((__gnu_inline__)) +# else +# define __static_inline static __inline__ +# endif +#else +# define __static_inline inline /* Just hope this works... */ +#endif + +/* + * How to declare a function which should be inlined or have a call to + * an external module + */ +#ifdef __GNUC__ +# ifdef __GNUC_STDC_INLINE__ +# define __extern_inline extern __inline__ __attribute__((__gnu_inline__)) +# else +# define __extern_inline extern __inline__ +# endif +#else +# define __extern_inline inline /* Just hope this works... */ +#endif + +/* How to declare a function that *must* be inlined */ +/* Use "extern inline" even in the gcc3+ case to avoid warnings in ctype.h */ +#ifdef __GNUC__ +# if __GNUC__ >= 3 +# define __must_inline __extern_inline __attribute__((__always_inline__)) +# else +# define __must_inline extern __inline__ +# endif +#else +# define __must_inline inline /* Just hope this works... */ +#endif + +/* How to declare a function that does not return */ +#ifdef __GNUC__ +# define __noreturn void __attribute__((noreturn)) +#else +# define __noreturn void +#endif + +/* "const" function: + + Many functions do not examine any values except their arguments, + and have no effects except the return value. Basically this is + just slightly more strict class than the `pure' attribute above, + since function is not allowed to read global memory. + + Note that a function that has pointer arguments and examines the + data pointed to must _not_ be declared `const'. Likewise, a + function that calls a non-`const' function usually must not be + `const'. It does not make sense for a `const' function to return + `void'. +*/ +#ifdef __GNUC__ +# define __constfunc __attribute__((const)) +#else +# define __constfunc +#endif +#undef __attribute_const__ +#define __attribute_const__ __constfunc + +/* "pure" function: + + Many functions have no effects except the return value and their + return value depends only on the parameters and/or global + variables. Such a function can be subject to common subexpression + elimination and loop optimization just as an arithmetic operator + would be. These functions should be declared with the attribute + `pure'. +*/ +#ifdef __GNUC__ +# define __purefunc __attribute__((pure)) +#else +# define __purefunc +#endif +#undef __attribute_pure__ +#define __attribute_pure__ __purefunc + +/* Format attribute */ +#ifdef __GNUC__ +# define __formatfunc(t,f,a) __attribute__((format(t,f,a))) +#else +# define __formatfunc(t,f,a) +#endif + +/* malloc() function (returns unaliased pointer) */ +#if defined(__GNUC__) && (__GNUC__ >= 3) +# define __mallocfunc __attribute__((malloc)) +#else +# define __mallocfunc +#endif + +/* likely/unlikely */ +#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)) +# define __likely(x) __builtin_expect(!!(x), 1) +# define __unlikely(x) __builtin_expect(!!(x), 0) +#else +# define __likely(x) (!!(x)) +# define __unlikely(x) (!!(x)) +#endif + +/* Possibly unused function */ +#ifdef __GNUC__ +# define __unusedfunc __attribute__((unused)) +#else +# define __unusedfunc +#endif + +/* It's all user space... */ +#define __user + +/* The bitwise attribute: disallow arithmetric operations */ +#ifdef __CHECKER__ /* sparse only */ +# define __bitwise __attribute__((bitwise)) +#else +# define __bitwise +#endif + +/* Shut up unused warnings */ +#ifdef __GNUC__ +# define __attribute_used__ __attribute__((used)) +#else +# define __attribute_used__ +#endif + +/* Compiler pragma to make an alias symbol */ +#define __ALIAS(__t, __f, __p, __a) \ + __t __f __p __attribute__((weak, alias(#__a))); + +#endif Index: branches/ErmaC/Modules/i386/klibc/strlcpy.c =================================================================== --- branches/ErmaC/Modules/i386/klibc/strlcpy.c (revision 0) +++ branches/ErmaC/Modules/i386/klibc/strlcpy.c (revision 1751) @@ -0,0 +1,27 @@ +/* + * strlcpy.c + */ + +#include +#include + +size_t strlcpy(char *dst, const char *src, size_t size) +{ + size_t bytes = 0; + char *q = dst; + const char *p = src; + char ch; + + while ((ch = *p++)) { + if (bytes + 1 < size) + *q++ = ch; + + bytes++; + } + + /* If size == 0 there is no space for a final null... */ + if (size) + *q = '\0'; + + return bytes; +} Index: branches/ErmaC/Modules/i386/klibc/LICENSE =================================================================== --- branches/ErmaC/Modules/i386/klibc/LICENSE (revision 0) +++ branches/ErmaC/Modules/i386/klibc/LICENSE (revision 1751) @@ -0,0 +1,73 @@ +This license applies to all files in directory and its subdirectories, +unless otherwise noted in individual files. + + +Some files are derived from files derived from the include/ directory +of the Linux kernel, and are licensed under the terms of the GNU +General Public License, version 2, as released by the Free Software +Foundation, Inc.; incorporated herein by reference. + + ----- + +Some files are derived from files copyrighted by the Regents of The +University of California, and are available under the following +license: + +Note: The advertising clause in the license appearing on BSD Unix +files was officially rescinded by the Director of the Office of +Technology Licensing of the University of California on July 22 +1999. He states that clause 3 is "hereby deleted in its entirety." + + * Copyright (c) + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + + ----- + +For all remaining files, the following license applies: + + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * Any copyright notice(s) and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Index: branches/ErmaC/Modules/i386/klibc/Makefile =================================================================== --- branches/ErmaC/Modules/i386/klibc/Makefile (revision 0) +++ branches/ErmaC/Modules/i386/klibc/Makefile (revision 1751) @@ -0,0 +1,51 @@ +SRCROOT = $(abspath $(CURDIR)/../..) +OBJROOT = $(SRCROOT)/obj/i386/klibc +SYMROOT = $(SRCROOT)/sym/i386 +DSTROOT = $(SRCROOT)/dst/i386 +DOCROOT = $(SRCROOT)/doc +IMGROOT = $(SRCROOT)/sym/cache +IMGSKELROOT = $(SRCROOT)/imgskel +CDBOOT = ${IMGROOT}/usr/standalone/i386/cdboot + +DIR = klibc +include ${SRCROOT}/Make.rules + +# LIBSAIODIR = ../libsaio + +CFLAGS := $(CFLAGS) $(RC_CFLAGS) $(MORECPP) -arch i386 \ + -fno-builtin -static $(OMIT_FRAME_POINTER_CFLAG) \ + -mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \ + -march=pentium4 -msse2 -mfpmath=sse -msoft-float \ + -nostdinc -include $(SRCROOT)/autoconf.h + +CPPFLAGS := $(CPPFLAGS) -nostdinc++ + +INC = -I. -I$(SYMROOT) -I${SRCROOT}/i386/include + +OBJS = strlcpy.o + +OBJS := $(addprefix $(OBJROOT)/, $(OBJS)) + +LIBS = libklibc.a +LIBS := $(addprefix $(SYMROOT)/, $(LIBS)) + +DIRS_NEEDED = $(OBJROOT) $(SYMROOT) + +all embedtheme: $(DIRS_NEEDED) $(LIBS) + + +$(LIBS): $(OBJS) + @echo "\t[RM] $@" + @rm -f $@ + @echo "\t[AR] $(@F)" + @ar q $@ $^ &> /dev/null + @echo "\t[RANLIB] $(@F)" + @ranlib $@ + +# dependencies +-include $(OBJROOT)/Makedep + +clean-local: + @for o in $(OBJS); do if [ -f "$${o}" ];then echo "\t[RM] $${o}"; fi; done + @for l in $(LIBS); do if [ -f "$${l}" ];then echo "\t[RM] $${l}"; fi; done + @rm -f $(LIBS) $(OBJS) Index: branches/ErmaC/Modules/i386/boot2/Makefile =================================================================== --- branches/ErmaC/Modules/i386/boot2/Makefile (revision 1750) +++ branches/ErmaC/Modules/i386/boot2/Makefile (revision 1751) @@ -35,8 +35,8 @@ THEMEDIR = ../../artwork/themes/$(THEME) INC = -I. -I$(SRCROOT) -I$(SYMDIR) -I$(LIBSADIR) -I$(LIBSAIODIR) -I${SRCROOT}/i386/include -LIBS= -L$(SYMDIR) -lsaio -lsa -LIBDEP= libsaio.a libsa.a +LIBS= -L$(SYMDIR) -lsaio -lsa -lklibc +LIBDEP= libsaio.a libsa.a libklibc.a OTHER_FILES = Index: branches/ErmaC/Modules/i386/boot2/boot.c =================================================================== --- branches/ErmaC/Modules/i386/boot2/boot.c (revision 1750) +++ branches/ErmaC/Modules/i386/boot2/boot.c (revision 1751) @@ -81,7 +81,7 @@ BVRef bvr, menuBVR, bvChain; static bool checkOSVersion(const char * version); -static bool getOSVersion(); +static void getOSVersion(); static unsigned long Adler32(unsigned char *buffer, long length); //static void selectBiosDevice(void); @@ -759,36 +759,9 @@ && (gMacOSVersion[2] == version[2]) && (gMacOSVersion[3] == version[3])); } -bool getOSVersion() +static void getOSVersion() { - bool valid = false; - const char *val; - int len; - config_file_t systemVersion; - - if (!loadConfigFile("System/Library/CoreServices/SystemVersion.plist", &systemVersion)) - { - valid = true; - } - else if (!loadConfigFile("System/Library/CoreServices/ServerVersion.plist", &systemVersion)) - { - valid = true; - } - - if (valid) - { - if (getValueForKey(kProductVersion, &val, &len, &systemVersion)) - { - // getValueForKey uses const char for val - // so copy it and trim - *gMacOSVersion = '\0'; - strncat(gMacOSVersion, val, MIN(len, 4)); - } - else - valid = false; - } - - return valid; + strlcpy(gMacOSVersion, gBootVolume->OSVersion, sizeof(gMacOSVersion)); } #define BASE 65521L /* largest prime smaller than 65536 */ Index: branches/ErmaC/Modules/i386/boot2/gui.c =================================================================== --- branches/ErmaC/Modules/i386/boot2/gui.c (revision 1750) +++ branches/ErmaC/Modules/i386/boot2/gui.c (revision 1751) @@ -15,7 +15,7 @@ #define IMG_REQUIRED -1 #define THEME_NAME_DEFAULT "Default" -static const char *theme_name = THEME_NAME_DEFAULT; +static const char *theme_name = THEME_NAME_DEFAULT; #ifdef CONFIG_EMBED_THEME #include "art.h" @@ -43,8 +43,24 @@ iDeviceGeneric_o, iDeviceHFS, iDeviceHFS_o, + iDeviceHFS_Lion, + iDeviceHFS_Lion_o, + iDeviceHFS_SL, + iDeviceHFS_SL_o, + iDeviceHFS_Leo, + iDeviceHFS_Leo_o, + iDeviceHFS_Tiger, + iDeviceHFS_Tiger_o, iDeviceHFSRAID, iDeviceHFSRAID_o, + iDeviceHFSRAID_Lion, + iDeviceHFSRAID_Lion_o, + iDeviceHFSRAID_SL, + iDeviceHFSRAID_SL_o, + iDeviceHFSRAID_Leo, + iDeviceHFSRAID_Leo_o, + iDeviceHFSRAID_Tiger, + iDeviceHFSRAID_Tiger_o, iDeviceEXT3, iDeviceEXT3_o, iDeviceFreeBSD, /* FreeBSD/OpenBSD detection,nawcom's code by valv, Icon credits to blackosx */ @@ -98,8 +114,25 @@ {.name = "device_generic_o", .image = NULL}, {.name = "device_hfsplus", .image = NULL}, {.name = "device_hfsplus_o", .image = NULL}, + {.name = "device_hfsplus_lion", .image = NULL}, + {.name = "device_hfsplus_lion_o", .image = NULL}, + {.name = "device_hfsplus_sl", .image = NULL}, + {.name = "device_hfsplus_sl_o", .image = NULL}, + {.name = "device_hfsplus_leo", .image = NULL}, + {.name = "device_hfsplus_leo_o", .image = NULL}, + {.name = "device_hfsplus_tiger", .image = NULL}, + {.name = "device_hfsplus_tiger_o", .image = NULL}, + {.name = "device_hfsraid", .image = NULL}, {.name = "device_hfsraid_o", .image = NULL}, + {.name = "device_hfsplus_raid_lion", .image = NULL}, + {.name = "device_hfsplus_raid_lion_o", .image = NULL}, + {.name = "device_hfsplus_raid_sl", .image = NULL}, + {.name = "device_hfsplus_raid_sl_o", .image = NULL}, + {.name = "device_hfsplus_raid_leo", .image = NULL}, + {.name = "device_hfsplus_raid_leo_o", .image = NULL}, + {.name = "device_hfsplus_raid_tiger", .image = NULL}, + {.name = "device_hfsplus_raid_tiger_o", .image = NULL}, {.name = "device_ext3", .image = NULL}, {.name = "device_ext3_o", .image = NULL}, {.name = "device_freebsd", .image = NULL}, /* FreeBSD/OpenBSD detection,nawcom's code by valv, Icon credits to blackosx */ @@ -156,7 +189,7 @@ extern char gBootArgs[BOOT_STRING_LEN]; char prompt_text[] = "boot: "; - + menuitem_t infoMenuItems[] = { { .text = "Boot" }, @@ -169,6 +202,7 @@ }; int initFont(font_t *font, image_t *image); +int destroyFont(font_t *font); void colorFont(font_t *font, uint32_t color); void makeRoundedCorners(pixmap_t *p); @@ -272,7 +306,7 @@ unsigned int embed_size; embed_data = embeddedImages[e].pngdata; embed_size = *embeddedImages[e].length; - + if (loadEmbeddedPngImage(embed_data, embed_size, &width, &height, &imagedata) == 0) { images[i].image->width = width; @@ -285,13 +319,24 @@ return 0; } #endif - else if (alt_image != IMG_REQUIRED && images[alt_image].image->pixels != NULL) + else if (alt_image != IMG_REQUIRED) { - // Using the passed alternate image for non-mandatory images. - // We don't clone the already existing pixmap, but using its properties instead! - images[i].image->width = images[alt_image].image->width; - images[i].image->height = images[alt_image].image->height; - images[i].image->pixels = images[alt_image].image->pixels; + if (images[alt_image].image->pixels != NULL) { + + // Using the passed alternate image for non-mandatory images. + // We don't clone the already existing pixmap, but using its properties instead! + images[i].image->width = images[alt_image].image->width; + images[i].image->height = images[alt_image].image->height; + images[i].image->pixels = images[alt_image].image->pixels; + + } else { + + // Unable to load or to find the image, this image not vital anyway, reseting and returning success !! + + free(images[i].image); + images[i].image = NULL; + } + return 0; } else @@ -300,8 +345,12 @@ printf("ERROR: GUI: could not open '%s/%s.png'!\n", theme_name, image); sleep(2); #endif - return 1; - } + free(images[i].image); + images[i].image = NULL; + return 1; + + } + } return 1; } @@ -315,8 +364,25 @@ LOADPNG(device_generic_o, iDeviceGeneric); LOADPNG(device_hfsplus, iDeviceGeneric); LOADPNG(device_hfsplus_o, iDeviceHFS); + LOADPNG(device_hfsplus_lion, iDeviceHFS_Lion); + LOADPNG(device_hfsplus_lion_o, iDeviceHFS_Lion_o); + LOADPNG(device_hfsplus_sl, iDeviceHFS_SL); + LOADPNG(device_hfsplus_sl_o, iDeviceHFS_SL_o); + LOADPNG(device_hfsplus_leo, iDeviceHFS_Leo); + LOADPNG(device_hfsplus_leo_o, iDeviceHFS_Leo_o); + LOADPNG(device_hfsplus_tiger, iDeviceHFS_Tiger); + LOADPNG(device_hfsplus_tiger_o, iDeviceHFS_Tiger_o); + LOADPNG(device_hfsraid, iDeviceGeneric); LOADPNG(device_hfsraid_o, iDeviceHFSRAID); + LOADPNG(device_hfsplus_raid_lion, iDeviceHFSRAID_Lion); + LOADPNG(device_hfsplus_raid_lion_o, iDeviceHFSRAID_Lion_o); + LOADPNG(device_hfsplus_raid_sl, iDeviceHFSRAID_SL); + LOADPNG(device_hfsplus_raid_sl_o, iDeviceHFSRAID_SL_o); + LOADPNG(device_hfsplus_raid_leo, iDeviceHFSRAID_Leo); + LOADPNG(device_hfsplus_raid_leo_o, iDeviceHFSRAID_Leo_o); + LOADPNG(device_hfsplus_raid_tiger, iDeviceHFSRAID_Tiger); + LOADPNG(device_hfsplus_raid_tiger_o, iDeviceHFSRAID_Tiger_o); LOADPNG(device_ext3, iDeviceGeneric); LOADPNG(device_ext3_o, iDeviceEXT3); LOADPNG(device_freebsd, iDeviceGeneric); /* FreeBSD/OpenBSD detection,nawcom's code by valv, Icon credits to blackosx */ @@ -366,7 +432,25 @@ return 0; } - + +static int unloadGraphics(void) +{ + int i; + + destroyFont(&font_console); + destroyFont(&font_small); + for (i = 0; i < sizeof(images) / sizeof(images[0]); i++) + { + if (images[i].image) + { + if (images[i].image->pixels) free(images[i].image->pixels); + free (images[i].image); + images[i].image = 0; + } + } + return 0; +} + pixmap_t *getCroppedPixmapAtPosition( pixmap_t *from, position_t pos, uint16_t width, uint16_t height ) { @@ -409,10 +493,23 @@ gui.backbuffer->width = gui.screen.width; gui.backbuffer->height = gui.screen.height; - + return 0; } +int freeBackBuffer( window_t *window ) +{ + if (gui.backbuffer && gui.backbuffer->pixels) + { + free(gui.backbuffer->pixels); + free(gui.backbuffer); + gui.backbuffer = 0; + return 0; + } + + return 1; +} + int createWindowBuffer( window_t *window ) { window->pixmap = malloc(sizeof(pixmap_t)); @@ -429,7 +526,7 @@ window->pixmap->width = window->width; window->pixmap->height = window->height; - + return 0; } @@ -441,7 +538,7 @@ free(window->pixmap); return 0; } - + return 1; } @@ -508,7 +605,7 @@ if(getDimensionForKey("devices_pos_y", &pixel, theme, gui.screen.height , gui.devicelist.height ) ) gui.devicelist.pos.y = pixel; break; - + case HorizontalLayout: default: gui.devicelist.width = ((images[iSelection].image->width + gui.devicelist.iconspacing) * MIN(gui.maxdevices, gDeviceCount) + (images[iDeviceScrollPrev].image->width + images[iDeviceScrollNext].image->width) + gui.devicelist.iconspacing); @@ -692,7 +789,7 @@ if(getColorForKey("font_console_color", &color, theme)) gui.screen.font_console_color = (color & 0x00FFFFFF); } - + int initGUI(void) { int val; @@ -761,9 +858,24 @@ } } } + + // not available memory, freeing resources + freeWindowBuffer(&gui.menu); + freeWindowBuffer(&gui.infobox); + freeWindowBuffer(&gui.bootprompt); + freeWindowBuffer(&gui.devicelist); + freeWindowBuffer(&gui.screen); + freeBackBuffer(&gui.screen); + unloadGraphics(); + return 1; } +bool is_image_loaded(int i) +{ + return (images[i].image != NULL) ? true : false; +} + void drawDeviceIcon(BVRef device, pixmap_t *buffer, position_t p, bool isSelected) { int devicetype; @@ -775,37 +887,82 @@ switch (device->part_type) { case kPartitionTypeHFS: + { // Use HFS or HFSRAID icon depending on bvr flags. - devicetype = (device->flags & kBVFlagBooter) ? iDeviceHFSRAID : iDeviceHFS; + if (device->flags & kBVFlagBooter) { + + switch (device->OSVersion[3]) { + case '7': + devicetype = is_image_loaded(iDeviceHFSRAID_Lion) ? iDeviceHFSRAID_Lion : is_image_loaded(iDeviceHFSRAID) ? iDeviceHFSRAID : iDeviceGeneric; + break; + case '6': + devicetype = is_image_loaded(iDeviceHFSRAID_SL) ? iDeviceHFSRAID_SL : is_image_loaded(iDeviceHFSRAID) ? iDeviceHFSRAID : iDeviceGeneric; + break; + case '5': + devicetype = is_image_loaded(iDeviceHFSRAID_Leo) ? iDeviceHFSRAID_Leo : is_image_loaded(iDeviceHFSRAID) ? iDeviceHFSRAID : iDeviceGeneric; + break; + case '4': + devicetype = is_image_loaded(iDeviceHFSRAID_Tiger) ? iDeviceHFSRAID_Tiger : is_image_loaded(iDeviceHFSRAID) ? iDeviceHFSRAID : iDeviceGeneric; + break; + default: + devicetype = is_image_loaded(iDeviceHFSRAID) ? iDeviceHFSRAID : iDeviceGeneric; + break; + } + + } + else + { + + switch (device->OSVersion[3]) { + case '7': + devicetype = is_image_loaded(iDeviceHFS_Lion) ? iDeviceHFS_Lion : is_image_loaded(iDeviceHFS) ? iDeviceHFS : iDeviceGeneric; + break; + case '6': + devicetype = is_image_loaded(iDeviceHFS_SL) ? iDeviceHFS_SL : is_image_loaded(iDeviceHFS) ? iDeviceHFS : iDeviceGeneric; + break; + case '5': + devicetype = is_image_loaded(iDeviceHFS_Leo) ? iDeviceHFS_Leo : is_image_loaded(iDeviceHFS) ? iDeviceHFS : iDeviceGeneric; + break; + case '4': + devicetype = is_image_loaded(iDeviceHFS_Tiger) ? iDeviceHFS_Tiger : is_image_loaded(iDeviceHFS) ? iDeviceHFS : iDeviceGeneric; + break; + default: + devicetype = is_image_loaded(iDeviceHFS) ? iDeviceHFS : iDeviceGeneric; + break; + } + + } + break; - + + } case kPartitionTypeHPFS: - devicetype = iDeviceNTFS; // Use HPFS / NTFS icon + devicetype = is_image_loaded(iDeviceNTFS) ? iDeviceNTFS : iDeviceGeneric; // Use HPFS / NTFS icon break; - case kPartitionTypeBEFS: /* Haiku detection and Icon credits to scorpius */ - devicetype = iDeviceBEFS; // Use BEFS / Haiku icon + case kPartitionTypeFAT16: + devicetype = is_image_loaded(iDeviceFAT16) ? iDeviceFAT16 : iDeviceGeneric; // Use FAT16 icon break; - case kPartitionTypeFreeBSD: /* FreeBSD/OpenBSD detection,nawcom's code by valv, Icon credits to blackosx */ - devicetype = iDeviceFreeBSD; // Use FreeBSD icon + case kPartitionTypeFAT32: + devicetype = is_image_loaded(iDeviceFAT32) ? iDeviceFAT32 : iDeviceGeneric; // Use FAT32 icon break; - - case kPartitionTypeOpenBSD: /* FreeBSD/OpenBSD detection,nawcom's code by valv, Icon credits to blackosx */ - devicetype = iDeviceOpenBSD; // Use OpenBSD icon + + case kPartitionTypeEXT3: + devicetype = is_image_loaded(iDeviceEXT3) ? iDeviceEXT3 : iDeviceGeneric; // Use EXT2/3 icon break; - - case kPartitionTypeFAT16: - devicetype = iDeviceFAT16; // Use FAT16 icon + + case kPartitionTypeFreeBSD: /* FreeBSD/OpenBSD detection,nawcom's code by valv, Icon credits to blackosx */ + devicetype = is_image_loaded(iDeviceFreeBSD) ? iDeviceFreeBSD : iDeviceGeneric; // Use FreeBSD icon break; - case kPartitionTypeFAT32: - devicetype = iDeviceFAT32; // Use FAT32 icon + case kPartitionTypeOpenBSD: /* FreeBSD/OpenBSD detection,nawcom's code by valv, Icon credits to blackosx */ + devicetype = is_image_loaded(iDeviceOpenBSD) ? iDeviceOpenBSD : iDeviceGeneric; // Use OpenBSD icon break; - case kPartitionTypeEXT3: - devicetype = iDeviceEXT3; // Use EXT2/3 icon + case kPartitionTypeBEFS: /* Haiku detection and Icon credits to scorpius */ + devicetype = is_image_loaded(iDeviceBEFS) ? iDeviceBEFS : iDeviceGeneric;// Use BEFS / Haiku icon break; default: @@ -818,7 +975,7 @@ if (isSelected) { blend(images[iSelection].image, buffer, centeredAt(images[iSelection].image, p)); - devicetype++; + devicetype++; // selec override image } // draw icon @@ -839,7 +996,7 @@ position_t p, p_prev, p_next; //uint8_t maxDevices = MIN( gui.maxdevices, menucount ); - + fillPixmapWithColor( gui.devicelist.pixmap, gui.devicelist.bgcolor); makeRoundedCorners( gui.devicelist.pixmap); @@ -889,7 +1046,7 @@ if(infoMenuSelection >= INFOMENU_NATIVEBOOT_START && infoMenuSelection <= INFOMENU_NATIVEBOOT_END) infoMenuSelection = 0; } - + if (gui.menu.draw) drawInfoMenuItems(); @@ -942,7 +1099,7 @@ updateVRAM(); } - + void clearGraphicBootPrompt() { // clear text buffer @@ -1016,7 +1173,7 @@ // break; case 15: *(uint16_t *)(((uint8_t *)vram)+i*VIDEO (rowBytes) + j*2) = ((b&0xf8)>>3) | ((g&0xf8)<<2) | ((r&0xf8)<<7); - break; + break; } } } @@ -1031,14 +1188,14 @@ if (gui.bootprompt.draw) blend( gui.bootprompt.pixmap, gui.backbuffer, gui.bootprompt.pos ); - + if (gui.menu.draw) blend( gui.menu.pixmap, gui.backbuffer, gui.menu.pos ); if (gui.infobox.draw) blend( gui.infobox.pixmap, gui.backbuffer, gui.infobox.pos ); } - + vramwrite ( gui.backbuffer->pixels, gui.backbuffer->width, gui.backbuffer->height ); if (gui.redraw) @@ -1095,15 +1252,15 @@ bounds.y = ( window->height - window->vborder ); cursor = origin; - + font_t *font = &font_console; - + for( i=0; i< strlen(formattedtext); i++ ) { character = formattedtext[i]; character -= 32; - + // newline ? if( formattedtext[i] == '\n' ) { @@ -1115,7 +1272,7 @@ continue; } - + // tab ? if( formattedtext[i] == '\t' ) cursor.x += ( font->chars[0]->width * 5 ); @@ -1258,7 +1415,7 @@ bounds.x = ( window->width - ( window->hborder * 2 ) ); bounds.y = ( window->height - ( window->vborder * 2 ) ); cursor = origin; - + for( i=0; i< strlen(formattedtext); i++ ) { character = formattedtext[i]; @@ -1293,7 +1450,7 @@ cursor.x = origin.x; cursor.y += font->height; } - + // check y pos and reset to origin.y if ( cursor.y > ( bounds.y + font->chars[0]->height) ) { @@ -1405,7 +1562,7 @@ for( x = 0; x < data->image->width && count < CHARACTERS_COUNT; x++) { start = end; - + // if the pixel is red we've reached the end of the char if( pixel( data->image, x, 0 ).value == 0xFFFF0000) { @@ -1431,7 +1588,7 @@ // check if font is monospaced if( ( count > 0 ) && ( font->width != font->chars[count]->width ) ) monospaced = true; - + font->width = font->chars[count]->width; count++; @@ -1451,6 +1608,21 @@ return 0; } +int destroyFont(font_t *font) +{ + int i; + for (i = 0; i < CHARACTERS_COUNT; i++) + { + if (font->chars[i]) + { + if (font->chars[i]->pixels) free (font->chars[i]->pixels); + free (font->chars[i]); + font->chars[i] = 0; + } + } + return 0; +} + void colorFont(font_t *font, uint32_t color) { if( !color ) @@ -1588,11 +1760,11 @@ break; } } - + fillPixmapWithColor( gui.infobox.pixmap, gui.infobox.bgcolor); makeRoundedCorners( gui.infobox.pixmap); - + // print the title if present if( title ) drawStr(title, &font_console, gui.infobox.pixmap, pos_title); @@ -1642,7 +1814,7 @@ updateVRAM(); break; } - + if(key == ' ') // spacebar = next page { if( lines > ( currentline + visiblelines ) ) @@ -1714,7 +1886,7 @@ for(x=todraw, x2 = 0; x < width - 1; x++, x2++) { if(x2 == (buffBG->width -2 )) x2 = 0; - pixel(&progressbar, x,y).value = pixel(buffBG, x2,y).value; + pixel(&progressbar, x,y).value = pixel(buffBG, x2,y).value; } if(progress < 100) pixel(&progressbar, width - 1, y).value = pixel(buffBG, buffBG->width - 1, y).value; @@ -1722,7 +1894,7 @@ pixel(&progressbar, 0, y).value = pixel(buffBG, buffBG->width - 1, y).value; x2=0; } - + blend(&progressbar, blendInto, p); animateProgressBar(); free(progressbar.pixels); @@ -1829,7 +2001,7 @@ else if( infoMenuSelection == MENU_SHOW_HELP ) showHelp(); - + else { int buff = infoMenuSelection; Index: branches/ErmaC/Modules/i386/boot2/gui.h =================================================================== --- branches/ErmaC/Modules/i386/boot2/gui.h (revision 1750) +++ branches/ErmaC/Modules/i386/boot2/gui.h (revision 1751) @@ -19,23 +19,23 @@ #define CHARACTERS_COUNT 223 -#define BOOT_NORMAL 0 +#define BOOT_NORMAL 0 #define BOOT_VERBOSE 1 #define BOOT_IGNORECACHE 2 #define BOOT_SINGLEUSER 3 -#define DO_NOT_BOOT 4 +#define DO_NOT_BOOT 4 #define CLOSE_INFO_MENU 5 -#define INFOMENU_NATIVEBOOT_START 1 -#define INFOMENU_NATIVEBOOT_END 3 +#define INFOMENU_NATIVEBOOT_START 1 +#define INFOMENU_NATIVEBOOT_END 3 -#define MENU_SHOW_MEMORY_INFO 4 -#define MENU_SHOW_VIDEO_INFO 5 -#define MENU_SHOW_HELP 6 +#define MENU_SHOW_MEMORY_INFO 4 +#define MENU_SHOW_VIDEO_INFO 5 +#define MENU_SHOW_HELP 6 enum { HorizontalLayout = 0, - VerticalLayout = 1 + VerticalLayout = 1, }; /* @@ -124,6 +124,7 @@ void drawBackground(); void setupDeviceList(config_file_t *theme); +bool is_image_loaded(int i); void drawDeviceIcon(BVRef device, pixmap_t *buffer, position_t p, bool isSelected); void drawDeviceList(int start, int end, int selection); void drawProgressBar(pixmap_t *blendInto, uint16_t width, position_t p, uint8_t progress); Index: branches/ErmaC/Modules/i386/boot2/options.c =================================================================== --- branches/ErmaC/Modules/i386/boot2/options.c (revision 1750) +++ branches/ErmaC/Modules/i386/boot2/options.c (revision 1751) @@ -135,7 +135,7 @@ lasttime=time18(); } - if (ch = readKeyboardStatus()) + if ( (ch = readKeyboardStatus()) ) break; // Count can be interrupted by holding down shift, Index: branches/ErmaC/Modules/i386/libsa/string.c =================================================================== --- branches/ErmaC/Modules/i386/libsa/string.c (revision 1750) +++ branches/ErmaC/Modules/i386/libsa/string.c (revision 1751) @@ -172,7 +172,7 @@ strcpy(char * s1, const char * s2) { register char *ret = s1; - while (*s1++ = *s2++) + while ((*s1++ = *s2++)) continue; return ret; } @@ -186,15 +186,6 @@ return ret; } -size_t -strlcpy(char * s1, const char * s2, size_t n) -{ - while (n && (*s1++ = *s2++)) - n--; - if (!n) *--s1=0; - return strlen(s2); -} - char * strstr(const char *in, const char *str) { Index: branches/ErmaC/Modules/i386/libsa/prf.c =================================================================== --- branches/ErmaC/Modules/i386/libsa/prf.c (revision 1750) +++ branches/ErmaC/Modules/i386/libsa/prf.c (revision 1751) @@ -151,7 +151,7 @@ break; case 's': s = (char *)*adx; - while (c = *s++) { + while ((c = *s++)) { (*putfn_p)(c, putfn_arg); width++; } Index: branches/ErmaC/Modules/i386/libsa/strtol.c =================================================================== --- branches/ErmaC/Modules/i386/libsa/strtol.c (revision 1750) +++ branches/ErmaC/Modules/i386/libsa/strtol.c (revision 1751) @@ -148,7 +148,7 @@ break; if (c >= base) break; - if (any < 0 || acc > cutoff || acc == cutoff && c > cutlim) + if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim)) any = -1; else { any = 1; @@ -220,7 +220,7 @@ break; if (c >= base) break; - if (any < 0 || acc > cutoff || acc == cutoff && c > cutlim) + if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim)) any = -1; else { any = 1; @@ -291,7 +291,7 @@ break; if (c >= base) break; - if (any < 0 || acc > cutoff || acc == cutoff && c > cutlim) + if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim)) any = -1; else { any = 1; Index: branches/ErmaC/Modules/i386/Makefile =================================================================== --- branches/ErmaC/Modules/i386/Makefile (revision 1750) +++ branches/ErmaC/Modules/i386/Makefile (revision 1751) @@ -16,7 +16,7 @@ # The order of building is important. SUBDIRS_PRE = util -SUBDIRS = $(SUBDIRS_PRE) libsa libsaio boot0 boot1 boot2 cdboot modules +SUBDIRS = $(SUBDIRS_PRE) klibc libsa libsaio boot0 boot1 boot2 cdboot modules modules-builtin: @cd modules; ${MAKE} BUILT_IN=yes Index: branches/ErmaC/Modules/package/Distribution =================================================================== --- branches/ErmaC/Modules/package/Distribution (revision 1750) +++ branches/ErmaC/Modules/package/Distribution (revision 1751) @@ -2,51 +2,45 @@ - + + - + + + + + - - - - - + Chameleon_title - Chameleon_title + + function chameleon_boot_plist_exists() { + return system.files.fileExistsAtPath(my.target.mountpoint + '/Extra/org.chameleon.Boot.plist'); + } + + Index: branches/ErmaC/Modules/package/Changes.txt =================================================================== --- branches/ErmaC/Modules/package/Changes.txt (revision 0) +++ branches/ErmaC/Modules/package/Changes.txt (revision 1751) @@ -0,0 +1,47 @@ +- Keylayout / Keymaps fixed and made a mandatory install. + +- Add option to upgrade an existing install - or more exactly, merge newly selected options with an existing /Extra folder. Also, rename an existing /Extra/com.apple.Boot.plist to /Extra/org.chameleon.Boot.plist. + +- Change the layout/wording displayed in the installer (English only) and give it a facelift. Adjust background image to scale to fit in the window. + +- Set exclusive 'None' option to default choice. + +- Add code to detect and make necessary changes to avoid possibility of a b1f:error or boot1:error should the user decide to install a secondary boot partition. + +- Fix bug installing to /Volumes/EFI + +- Add crazybirdy's Chinese translation to zh-CN and zh-TW resources. + +- Add dmaazar's boot0workV2 changes to ../i386/boot0/boot0md.s. + +- Added check for an existing Chameleon installation on a different partition of same target disk to help stop new +users from confusing themselves. If found, the install process will exit and write the reason to the install log. + +- Re-organised Scripts folder in to Main and Sub scripts. The main scripts for the standard and EFI system partition +installation options have been changed to used the code that I'd previously re-structured. The Sub scripts are the +original chameleon installer scripts with maybe some tweaks/additions, split in to separate scripts. These scripts +include the previous additions I'd made including checking for FAT16 partitions, installing boot0md or boot0 depending +on whether or not a Windows installation is found and writing boot1h or boot1f32 depending on installing to HFS or +FAT32 format partitions. + +- All references of Boot0hfs removed and now replaced with Boot0md. + +- Installer log added to now dump a log of useful info about the install process to the root of the selected target. + +- Boot options re-thought and are now automatically created at compile time from simple lists, rather than manage a +separate file of code of each option. + +- Added missing useKernelCache boot option. + +- Easily enable a list to be exclusive or not. + +- The main Post script now creates the org.chameleon.Boot.plist based on the modules / options / key layouts / themes +selected by the user. + +- Only create and /Extra folder if there's something to go in it. + +- Backup an existing /Extra folder to /Extra-OLD(date & time). + +- slimpkg.sh changed to match the revised code in buildpkg.sh where applicable. + +- English Localizable.strings revised to match latest additions and some texts updated. \ No newline at end of file Index: branches/ErmaC/Modules/package/Scripts/Main/ESPpostinstall =================================================================== --- branches/ErmaC/Modules/package/Scripts/Main/ESPpostinstall (revision 1750) +++ branches/ErmaC/Modules/package/Scripts/Main/ESPpostinstall (revision 1751) @@ -56,6 +56,8 @@ targetResources="${targetVolumeChosenByUser}/usr/local/bin/" +efiPartitionExist=0 # target volume does not have EFI system partition. + echo "===============================================" echo "DEBUG: display script variables" echo "***************************" @@ -92,14 +94,18 @@ 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. + # The following script returns either 0 or 1 to proceed, or 2 to indicate failure. "$scriptDir"CheckProceed.sh "${targetVolume}" "${targetDeviceChosenByUser}" "${targetVolumeChosenByUser}" "${scriptDir}" returnValue=$? - if [ ${returnValue} = 0 ]; then + if [ ${returnValue} -ne 2 ]; then # OK to proceed + # Remember if the target volume has an EFI system partition. + if [ ${returnValue} -ne 1 ]; then + efiPartitionExist=1 + fi # Does a GRUB or Linux loader already exist in the disk's MBR? # The script returns 1 if yes, 0 if no. @@ -157,12 +163,14 @@ # OK to proceed # Mount the EFI system partition - "$scriptDir"MountESP.sh "${targetDisk}" "${targetVolumeChosenByUser}" "${scriptDir}" + "$scriptDir"MountESP.sh "${targetDisk}" "${targetVolumeChosenByUser}" "${efiPartitionExist}" "${scriptDir}" # Write the stage 2 loader to the root of the selected partition "$scriptDir"WriteChameleonStage2.sh "${stage2Loader}" "${targetVolume}" "${targetDevice}" "${targetVolumeChosenByUser}" "${scriptDir}" # Check for another existing Chameleon installation on the same disk + "$scriptDir"InstallLog.sh "${targetVolume}" "LineBreak" + "$scriptDir"InstallLog.sh "${targetVolume}" "Preparing to check target disk for previous installations." "$scriptDir"CheckPreviousChameleon.sh "${targetDisk}" "${targetDeviceRaw}" "${targetDevice}" "${targetVolumeChosenByUser}" "${scriptDir}" fi Index: branches/ErmaC/Modules/package/Scripts/Main/postinstall =================================================================== --- branches/ErmaC/Modules/package/Scripts/Main/postinstall (revision 1750) +++ branches/ErmaC/Modules/package/Scripts/Main/postinstall (revision 1751) @@ -20,10 +20,10 @@ # / with volume name. if [ "$3" == "/" ] then - dest_vol="/Volumes/"$( ls -1F /Volumes | sed -n 's:@$::p' ) + dest_vol="/Volumes/"$( ls -1F /Volumes | sed -n 's:@$::p' ) else dest_vol="$3" -fi +fi # Find script location so to find the Install Log script. MYLOCATION="${PWD}/${BASH_ARGV[0]}" @@ -37,261 +37,245 @@ # set temporary directory chamTemp="$dest_vol/usr/local/chamTemp" -# Check for stopped installation due to Chameleon -# already existing on the same disk. -# TO DO - This check can be removed as it's no longer used!! -if [ ! -f "$dest_vol"/.ChameleonExists ]; then +# --------------------------------------------- +# 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 - # --------------------------------------------- - # 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}" "Added module: $FILE" - done +# 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 - - # --------------------------------------------- - # 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}" "Added 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 + tempOCBP="$chamTemp"/Extra/org.chameleon.Boot.plist - # Are there any options to build? - if [ "$(ls -A ${chamTemp}/options )" ]; then + # Create template for org.chameleon.Boot.plist" + tempOCBP="$chamTemp"/Extra/org.chameleon.Boot.plist + cp "$4"/Library/Preferences/SystemConfiguration/com.apple.Boot.plist "$tempOCBP" - # Check for temporary directory/Extra folder. - if [ ! -d "$chamTemp"/Extra ]; then - mkdir "$chamTemp"/Extra + # 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 ) - tempOCBP="$chamTemp"/Extra/org.chameleon.Boot.plist - - # 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 + if [ $kernelFlagCount -gt 0 ]; then + # Add any kernel flags together in to one string. + for (( i=0 ; i < $kernelFlagCount ; i++ )) 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 any kernel flags together in to one string. - for (( i=0 ; i < $kernelFlagCount ; i++ )) - do - kernelFlagString="${kernelFlagString} ${kernelflag[i]}" - done - # We add the final string in the next section. - fi + kernelFlagString="${kernelFlagString} ${kernelflag[i]}" + done + # We add the final string in the next section. fi - +fi + +# --------------------------------------------- +# 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}" "Added module: $FILE" + if [ "$FILE" == "Keylayout.dylib" ]; then + "$scriptDir"InstallLog.sh "${dest_vol}" "Also adding required Keymaps." + fi + 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}" "Added Theme: $FILE" + done +fi + +# Does a temporary /Extra folder exist? +if [ -d "$chamTemp"/Extra ]; then + # --------------------------------------------- # Merge /Extra folders? # --------------------------------------------- # Does the user want to upgrade an existing /Extra folder? - # If so, then merge their existing one in to the temp one - if [ -e "$chamTemp/install_type_upgrade" ]; then - "$scriptDir"InstallLog.sh "${dest_vol}" "User selected to do an upgrade install." - - # first move the new org.chameleon.Boot.plist out of tmp - # Extra folder so we can merge that separately. - mv "$tempOCBP" "$chamTemp/holding.plist" - - # Check for an existing /Extra folder - # and merge existing /Extra with temp one. - if [ -e "$dest_vol"/.ChameleonEFI ]; then - if [ -e "/Volumes/EFI/Extra" ]; then - "$scriptDir"InstallLog.sh "${dest_vol}" "Merging existing /Volumes/EFI/Extra folder." - ditto --noextattr --noqtn /Volumes/EFI/Extra "$chamTemp"/Extra - fi - else - if [ -e "$dest_vol/Extra" ]; then - "$scriptDir"InstallLog.sh "${dest_vol}" "Merging existing ${dest_vol}/Extra folder." - ditto --noextattr --noqtn "${dest_vol}"/Extra "$chamTemp"/Extra - fi - fi - - # Check existing plist name for old naming convention - # and change to new convention. - if [ -e "$chamTemp"/Extra/com.apple.Boot.plist ]; then - "$scriptDir"InstallLog.sh "${dest_vol}" "Renaming existing com.apple.Boot.plist to org.chameleon.Boot.plist." - mv "$chamTemp"/Extra/com.apple.Boot.plist "$tempOCBP" - fi - - # Before merging org.chameleon.Boot.plist, copy any - # existing kernel flags, then delete the entry. - currentFlags=$( sudo /usr/libexec/plistbuddy -c "Print :Kernel\ Flags" "$tempOCBP" ) - sudo /usr/libexec/plistbuddy -c "Delete :Kernel\ Flags" "$tempOCBP" - - # Merge new org.chameleon.Boot.plist (holding.plist) - # with their currently existing one. - "$scriptDir"InstallLog.sh "${dest_vol}" "Merging new options into org.chameleon.Boot.plist. + # If so, then merge their existing one in to the temp one. + if [ -e "$chamTemp/install_type_upgrade" ]; then + "$scriptDir"InstallLog.sh "${dest_vol}" "User selected to do an upgrade install." + + # first move the new org.chameleon.Boot.plist out of tmp + # Extra folder so we can merge that separately. + mv "$tempOCBP" "$chamTemp/holding.plist" + + # Check for an existing /Extra folder + # and merge existing /Extra with temp one. + if [ -e "$dest_vol"/.ChameleonEFI ]; then + if [ -e "/Volumes/EFI/Extra" ]; then + "$scriptDir"InstallLog.sh "${dest_vol}" "Merging existing /Volumes/EFI/Extra folder." + ditto --noextattr --noqtn /Volumes/EFI/Extra "$chamTemp"/Extra + fi + else + if [ -e "$dest_vol/Extra" ]; then + "$scriptDir"InstallLog.sh "${dest_vol}" "Merging existing ${dest_vol}/Extra folder." + ditto --noextattr --noqtn "${dest_vol}"/Extra "$chamTemp"/Extra + fi + fi + + # Check existing plist name for old naming convention + # and change to new convention. + if [ -e "$chamTemp"/Extra/com.apple.Boot.plist ]; then + "$scriptDir"InstallLog.sh "${dest_vol}" "Renaming existing com.apple.Boot.plist to org.chameleon.Boot.plist." + mv "$chamTemp"/Extra/com.apple.Boot.plist "$tempOCBP" + fi + + # Before merging org.chameleon.Boot.plist, copy any + # existing kernel flags, then delete the entry. + currentFlags=$( sudo /usr/libexec/plistbuddy -c "Print :Kernel\ Flags" "$tempOCBP" ) + sudo /usr/libexec/plistbuddy -c "Delete :Kernel\ Flags" "$tempOCBP" + + # Merge new org.chameleon.Boot.plist (holding.plist) + # with their currently existing one. + "$scriptDir"InstallLog.sh "${dest_vol}" "------ +Merging new options into org.chameleon.Boot.plist. NOTE: Please check the new merged org.chameleon.Boot.plist as NOTE: any existing keys will NOT have been updated. NOTE: For example: If you already had Wait=No as a boot option -NOTE: and chose Wait=Yes from the list, this will NOT be changed." - sudo /usr/libexec/plistbuddy -c "Merge $chamTemp/holding.plist" "$tempOCBP" - - # Combine new kernel flags with old ones. - kernelFlagString="${kernelFlagString} $currentFlags" - # Write complete kernel flag entry back. - 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 - - elif [ -e "$chamTemp/install_type_new" ]; then - "$scriptDir"InstallLog.sh "${dest_vol}" "User selected to make a new install." - # Add kernel flags (if any) - if [ $kernelFlagCount -gt 0 ]; then - 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 - +NOTE: and chose Wait=Yes from the list, this will NOT be changed. +------" + sudo /usr/libexec/plistbuddy -c "Merge $chamTemp/holding.plist" "$tempOCBP" + + if [[ -n "$currentFlags" ]];then + # Combine new kernel flags with old ones. + kernelFlagString="${kernelFlagString} $currentFlags" + fi + + elif [ -e "$chamTemp/install_type_new" ]; then + "$scriptDir"InstallLog.sh "${dest_vol}" "User selected to make a new install." + fi + + # Write kernel flags option + kernelFlagString=$(echo ${kernelFlagString}) # Remove leading and trailing spaces + if [[ -n "$kernelFlagString" ]];then + sudo /usr/libexec/plistbuddy -c "Add :Kernel\ Flags string $kernelFlagString" "$tempOCBP" + returnValue=$? + if [ ${returnValue} -ne 0 ]; 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 + # --------------------------------------------- # 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 + # 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 + 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}" "Moving $dest_vol/Extra folder to $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 new Extra folder to: $dest_vol/" - echo "Copying $chamTemp/Extra TO $dest_vol" - 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}" "Moving /Volumes/EFI/Extra folder to /Volumes/EFI/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 new Extra folder to: /Volumes/EFI/" - cp -R "$chamTemp"/Extra "/Volumes/EFI" + # Does an /Extra folder already exist? + if [ -e "$dest_vol"/Extra ]; then + "$scriptDir"InstallLog.sh "${dest_vol}" "Moving $dest_vol/Extra folder to $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 new Extra folder to: $dest_vol/" + echo "Copying $chamTemp/Extra TO $dest_vol" + cp -R "$chamTemp"/Extra "$dest_vol" else - if [ ! -f "$dest_vol"/.ChameleonEFI ]; then - if [ -e "$dest_vol"/Extra ]; then - "$scriptDir"InstallLog.sh "${dest_vol}" "No elements selected for adding to an Extra folder, + # 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}" "Moving /Volumes/EFI/Extra folder to /Volumes/EFI/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 new Extra folder to: /Volumes/EFI/" + cp -R "$chamTemp"/Extra "/Volumes/EFI" + fi +else + if [ ! -f "$dest_vol"/.ChameleonEFI ]; then + if [ -e "$dest_vol"/Extra ]; then + "$scriptDir"InstallLog.sh "${dest_vol}" "No elements selected for adding to an Extra folder, so leaving existing $dest_vol/Extra folder untouched." - fi - else - if [ -e "/Volumes/EFI/Extra" ]; then - "$scriptDir"InstallLog.sh "${dest_vol}" "No elements selected for adding to an Extra folder, + fi + else + if [ -e "/Volumes/EFI/Extra" ]; then + "$scriptDir"InstallLog.sh "${dest_vol}" "No elements selected for adding to an Extra folder, so leaving existing /Volumes/EFI/Extra folder untouched." - fi fi fi - - # Unmount ALL mounted volumes named EFI - "$scriptDir"UnMountEFIvolumes.sh "${dest_vol}" "${scriptDir}" -else - cleanUp="${cleanUp},0" - rm "$dest_vol"/.ChameleonExists fi # --------------------------------------------- # Cleanup # --------------------------------------------- +# Unmount ALL mounted volumes named EFI +"$scriptDir"UnMountEFIvolumes.sh "${dest_vol}" "${scriptDir}" + # remove any temporary boot sector files if they exist if [ -d /tmp/newbs ]; then - cleanUp="${cleanUp},1a" - rm /tmp/newbs + cleanUp="${cleanUp},1a" + rm /tmp/newbs fi if [ -d /tmp/origbs ]; then - cleanUp="${cleanUp},1b" - rm /tmp/origbs + cleanUp="${cleanUp},1b" + rm /tmp/origbs fi if [ -d /tmp/newBootSector ]; then - cleanUp="${cleanUp},1c" - rm /tmp/newbs + cleanUp="${cleanUp},1c" + rm /tmp/newbs fi if [ -d /tmp/originalBootSector ]; then - cleanUp="${cleanUp},1d" - rm /tmp/origbs + cleanUp="${cleanUp},1d" + rm /tmp/origbs fi # delete the temporary Chameleon folder if [ -e "$chamTemp" ]; then - cleanUp="${cleanUp},2" - rm -rf "$chamTemp" + cleanUp="${cleanUp},2" + rm -rf "$chamTemp" fi # Remove /.ChameleonEFI file if [ -f "$dest_vol"/.ChameleonEFI ]; then - cleanUp="${cleanUp},3" - rm "$dest_vol"/.ChameleonEFI + cleanUp="${cleanUp},3" + rm "$dest_vol"/.ChameleonEFI fi "$scriptDir"InstallLog.sh "${dest_vol}" "Cleanup: ${cleanUp}" Index: branches/ErmaC/Modules/package/Scripts/Main/Standardpostinstall =================================================================== --- branches/ErmaC/Modules/package/Scripts/Main/Standardpostinstall (revision 1750) +++ branches/ErmaC/Modules/package/Scripts/Main/Standardpostinstall (revision 1751) @@ -56,6 +56,7 @@ targetResources="${targetVolume}/usr/local/bin/" updateStage1=1 # by default update partition boot sector +efiPartitionExist=0 # target volume does not have EFI system partition. echo "===============================================" echo "DEBUG: display script variables" @@ -82,12 +83,17 @@ "$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. +# The following script returns either 0 or 1 to proceed, or 2 to indicate failure. "$scriptDir"CheckProceed.sh "${targetVolume}" "${targetDevice}" "${targetVolume}" "${scriptDir}" returnValue=$? -if [ ${returnValue} = 0 ]; then +if [ ${returnValue} -ne 2 ]; then # OK to proceed + + # Remember if the target volume has an EFI system partition. + if [ ${returnValue} -ne 1 ]; then + efiPartitionExist=1 + fi # Does a GRUB or Linux loader already exist in the disk's MBR? # The script returns 1 if yes, 0 if no. @@ -162,32 +168,21 @@ # 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 + "$scriptDir"InstallLog.sh "${targetVolume}" "Preparing to check target disk for previous installations." + if [ ${efiPartitionExist} -ne 0 ]; then # volume has an EFI system partition + "$scriptDir"InstallLog.sh "${targetVolume}" "Going to check the EFI system partition also." + # Unmount ALL mounted volumes named EFI. Returns 0=success, 1=fail + "$scriptDir"UnMountEFIvolumes.sh "${targetVolume}" "${scriptDir}" + returnValue=$? + if [ ${returnValue} = 0 ]; then # Mount the EFI system partition - "$scriptDir"MountESP.sh "${targetDisk}" "${targetVolume}" "${scriptDir}" + "$scriptDir"MountESP.sh "${targetDisk}" "${targetVolume}" "${efiPartitionExist}" "${scriptDir}" fi - - # Check for another existing Chameleon installation on the same disk - "$scriptDir"CheckPreviousChameleon.sh "${targetDisk}" "${targetDeviceRaw}" "${targetDevice}" "${targetVolume}" "${scriptDir}" fi + # Check for another existing Chameleon installation on the same disk + "$scriptDir"CheckPreviousChameleon.sh "${targetDisk}" "${targetDeviceRaw}" "${targetDevice}" "${targetVolume}" "${scriptDir}" # Append a line break to the installer log "$scriptDir"InstallLog.sh "${targetVolume}" "LineBreak" Index: branches/ErmaC/Modules/package/Scripts/Sub/CheckPreviousChameleon.sh =================================================================== --- branches/ErmaC/Modules/package/Scripts/Sub/CheckPreviousChameleon.sh (revision 1750) +++ branches/ErmaC/Modules/package/Scripts/Sub/CheckPreviousChameleon.sh (revision 1751) @@ -52,8 +52,7 @@ # 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/}" + "$scriptDir"InstallLog.sh "${installerVolume}" "Checking ${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}' ) @@ -64,6 +63,7 @@ fi #Scan all partitions for Chameleon code + cleanRun=1 for (( i=1; i <= $numSlices; i++ )); do if [ $stage0type == 1 ] || [ $stage0type == 2 ]; then @@ -108,7 +108,7 @@ "$scriptDir"InstallLog.sh "${installerVolume}" "${message}" fi if [ $stagesFound == 3 ] && [ $i -gt $sliceNumber ]; then - # Exisitng installation found which will no longer be default. + # Existing 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." @@ -131,8 +131,7 @@ 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) + # Fix by making previous parition bootsector un-bootable 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 @@ -149,20 +148,12 @@ 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 + # Change Byte 01FExh to 00 (510 decimal) + # Same code can be used for HFS or FAT32 + 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 # /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 @@ -182,11 +173,15 @@ #echo "DEBUG: Boot0 not found" fi fi + else + (( cleanRun++ )) fi - done -#else - #echo "DEBUG: Just one slice" + if [[ $cleanRun == $i ]]; then + "$scriptDir"InstallLog.sh "${installerVolume}" "Nothing found that could cause any problems." + fi +else + "$scriptDir"InstallLog.sh "${installerVolume}" "Nothing to check as there's only one partition." fi exit 0 Index: branches/ErmaC/Modules/package/Scripts/Sub/MountESP.sh =================================================================== --- branches/ErmaC/Modules/package/Scripts/Sub/MountESP.sh (revision 1750) +++ branches/ErmaC/Modules/package/Scripts/Sub/MountESP.sh (revision 1751) @@ -9,34 +9,43 @@ # Receives targetDisk: for example /dev/disk2. # Receives installerVolume: Volume to write the installer log to. +# Receives efiPartitionExist: either 0 or 1 # Receives scriptDir: The location of the main script dir. -if [ "$#" -eq 3 ]; then +if [ "$#" -eq 4 ]; then targetDisk="$1" installerVolume="$2" - scriptDir="$3" + efiPartitionExist="$3" + scriptDir="$4" echo "DEBUG: passed argument for targetDisk = $targetDisk" echo "DEBUG: passed argument for installerVolume = $installerVolume" + echo "DEBUG: passed argument for efiPartitionExist = $efiPartitionExist" echo "DEBUG: passed argument for scriptDir = $scriptDir" else echo "Error - wrong number of values passed" exit 9 fi +# Check the first partition is actually type 'EFI' +# as we could be checking a USB flash drive <4GB +if [ ${efiPartitionExist} = 1 ]; then -# Does the mountpoint exist? -if [ ! -e "/Volumes/EFI" ]; then - mkdir -p "/Volumes/EFI" -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" + # 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 +else + "$scriptDir"InstallLog.sh "${installerVolume}" "Target volume doesn't have an EFI system partition." 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 +exit 0 Index: branches/ErmaC/Modules/package/Scripts/Sub/CheckProceed.sh =================================================================== --- branches/ErmaC/Modules/package/Scripts/Sub/CheckProceed.sh (revision 1750) +++ branches/ErmaC/Modules/package/Scripts/Sub/CheckProceed.sh (revision 1751) @@ -6,6 +6,9 @@ # Checks the selected volume is present and the disk is partitioned # Now also check for another existing Chameleon installation on the same disk. +# Exit with 0 to indicate okay to proceed, no problems. +# Exit with 1 to indicate okay to proceed, but target disk doesn't have EFI system partition. +# Exit with 2 to indicate not to proceed. # Receives targetVolume: Volume to install to (will be '/Volumes/EFI' if EFI install) # Receives targetDevice: Stores device number, for example /dev/disk2s1. @@ -26,40 +29,37 @@ exit 9 fi - # Does target volume exist? if [ -z "$targetVolume" ]; then echo "*** Cannot find the volume. Exiting." "$scriptDir"InstallLog.sh "${installerVolume}" "FAIL: Cannot file the volume: $targetVolume." - exit 1 -#else - #echo "DEBUG: Confirming target volume exists" + exit 2 fi - # Does target volume use slices? if [ "$targetDevice" = "$targetDevice#*disk*s" ]; then echo "*** ERROR Volume does not use slices. Exiting." "$scriptDir"InstallLog.sh "${installerVolume}" "FAIL: $targetVolume doesn't use slices." - exit 1 -#else - #echo "DEBUG: Confirming target device uses slices" + exit 2 fi +# Check to find if an EFI system partition exists on the disk. +# This is used in two cases: +# A) When checking for existing Chameleon installations. +# B) When the user chooses the EFI system partition install option, +# and installing to a 'small' HFS device like a 1GB USB flash +# drive which won't have an EFI System Partition. -# Add check for installing to a 'small' HFS device like a -# 1GB USB flash drive which won't have an EFI System Partition. -if [ "$targetVolume" = "/Volumes/EFI" ]; then - # Take target device and check slice 1 matches partition named "EFI" - stripped=$( echo ${targetDevice#/dev/} ) - if [ ! $(echo ${stripped#*disk*s}) = 1 ]; then - stripped=$( echo ${stripped%s*})"s1" - fi - if [ ! $( diskutil list | grep ${stripped} | awk {'print $2'} ) = "EFI" ]; then - #echo "DEBUG: *** The selected volume doesn't have an EFI System Partition. Exiting." +# Take target device and check if slice 1 is not named "EFI" +stripped=$( echo ${targetDevice#/dev/} ) +if [ ! $(echo ${stripped#*disk*s}) = 1 ]; then + stripped=$( echo ${stripped%s*})"s1" +fi +if [ ! $( diskutil list | grep ${stripped} | awk {'print $2'} ) = "EFI" ]; then + if [ "$targetVolume" = "/Volumes/EFI" ]; then "$scriptDir"InstallLog.sh "${installerVolume}" "FAIL: Selected disk does not have an EFI System Partition." - exit 1 fi + exit 1 fi exit 0 Index: branches/ErmaC/Modules/package/Resources/ja.lproj/Description.html =================================================================== --- branches/ErmaC/Modules/package/Resources/ja.lproj/Description.html (revision 1750) +++ branches/ErmaC/Modules/package/Resources/ja.lproj/Description.html (revision 1751) @@ -34,7 +34,6 @@

- Automatic P-State & C-State generation for native power management.

- Message logging.


-


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

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


Index: branches/ErmaC/Modules/package/Resources/he.lproj/Description.html =================================================================== --- branches/ErmaC/Modules/package/Resources/he.lproj/Description.html (revision 1750) +++ branches/ErmaC/Modules/package/Resources/he.lproj/Description.html (revision 1751) @@ -34,7 +34,6 @@

- Automatic P-State & C-State generation for native power management.

- Message logging.


-


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

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


Index: branches/ErmaC/Modules/package/Resources/bs.lproj/Description.html =================================================================== --- branches/ErmaC/Modules/package/Resources/bs.lproj/Description.html (revision 1750) +++ branches/ErmaC/Modules/package/Resources/bs.lproj/Description.html (revision 1751) @@ -34,7 +34,6 @@

- Automatsko generisanje P-State i C-State za izvorno upravljanje energijom.

- Prijava porukama.


-


Kod je objavljen pod verzijom 2 GNU javna licenca.

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


Index: branches/ErmaC/Modules/package/Resources/fr.lproj/Description.html =================================================================== --- branches/ErmaC/Modules/package/Resources/fr.lproj/Description.html (revision 1750) +++ branches/ErmaC/Modules/package/Resources/fr.lproj/Description.html (revision 1751) @@ -34,7 +34,6 @@

- Génération automatique des P-State & C-State pour une gestion de l'alimentation native.

- Journalisation des messages console.


-


Le code est publié sous la version 2 de la licence GPL (Gnu Public License).

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


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/nl.lproj/Description.html =================================================================== --- branches/ErmaC/Modules/package/Resources/nl.lproj/Description.html (revision 1750) +++ branches/ErmaC/Modules/package/Resources/nl.lproj/Description.html (revision 1751) @@ -34,7 +34,6 @@

- Automatisch P-State's & C-State's aangemaakt voor automatisch stroombeheer.

- Bericht logboek.


-


De code is vrijgegeven onder versie 2 van de Gnu Public License.

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


Index: branches/ErmaC/Modules/package/Resources/hr.lproj/Description.html =================================================================== --- branches/ErmaC/Modules/package/Resources/hr.lproj/Description.html (revision 1750) +++ branches/ErmaC/Modules/package/Resources/hr.lproj/Description.html (revision 1751) @@ -34,7 +34,6 @@

- Automatsko generiranje P-State i C-State za izvorno upravljanje energijom.

- Prijava porukama.


-


Kod je objavljen pod verzijom 2 GNU javna licenca.

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


Index: branches/ErmaC/Modules/package/Resources/pl.lproj/Description.html =================================================================== --- branches/ErmaC/Modules/package/Resources/pl.lproj/Description.html (revision 1750) +++ branches/ErmaC/Modules/package/Resources/pl.lproj/Description.html (revision 1751) @@ -34,7 +34,6 @@

- Automatyczne generowanie stanów P-State & C-State w celu uzyskania natywnego zarządzania energią.

- Logownie komunikatów.


-


Kod jest publikowany z licencją Gnu Public License w wersji 2.

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


Index: branches/ErmaC/Modules/package/Resources/pt-BR.lproj/Description.html =================================================================== --- branches/ErmaC/Modules/package/Resources/pt-BR.lproj/Description.html (revision 1750) +++ branches/ErmaC/Modules/package/Resources/pt-BR.lproj/Description.html (revision 1751) @@ -34,7 +34,6 @@

- P-State automático & Geração C-State para gestão de energia nativa.

- Protocolo Mensagens.


-


Este código é distribuido sobre os termos da versão 2 da Gnu Public License.

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


Index: branches/ErmaC/Modules/package/Resources/ru.lproj/Description.html =================================================================== --- branches/ErmaC/Modules/package/Resources/ru.lproj/Description.html (revision 1750) +++ branches/ErmaC/Modules/package/Resources/ru.lproj/Description.html (revision 1751) @@ -34,7 +34,6 @@

- Automatic P-State & C-State generation for native power management.

- Message logging.


-


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

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


Index: branches/ErmaC/Modules/package/Resources/id.lproj/Description.html =================================================================== --- branches/ErmaC/Modules/package/Resources/id.lproj/Description.html (revision 1750) +++ branches/ErmaC/Modules/package/Resources/id.lproj/Description.html (revision 1751) @@ -34,7 +34,6 @@

- Automatic P-State & C-State generation for native power management.

- Message logging.


-


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

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


Index: branches/ErmaC/Modules/package/Resources/el.lproj/Description.html =================================================================== --- branches/ErmaC/Modules/package/Resources/el.lproj/Description.html (revision 1750) +++ branches/ErmaC/Modules/package/Resources/el.lproj/Description.html (revision 1751) @@ -34,7 +34,6 @@

- Automatic P-State & C-State generation for native power management.

- Message logging.


-


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

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


Index: branches/ErmaC/Modules/package/Resources/en.lproj/Description.html =================================================================== --- branches/ErmaC/Modules/package/Resources/en.lproj/Description.html (revision 1750) +++ branches/ErmaC/Modules/package/Resources/en.lproj/Description.html (revision 1751) @@ -34,7 +34,6 @@

- Automatic P-State & C-State generation for native power management.

- Message logging.


-


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

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


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/en.lproj/Welcome.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/Modules/package/Resources/en.lproj/Welcome.rtfd/TXT.rtf (revision 1750) +++ branches/ErmaC/Modules/package/Resources/en.lproj/Welcome.rtfd/TXT.rtf (revision 1751) @@ -1,4 +1,4 @@ -{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf230 +{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf360 {\fonttbl\f0\fnil\fcharset0 LucidaGrande;} {\colortbl;\red255\green255\blue255;\red255\green0\blue9;\red0\green0\blue255;} \margl1440\margr1440\vieww11660\viewh12980\viewkind0 @@ -12,11 +12,7 @@ \fs26 \cf0 v%CHAMELEONVERSION% r%CHAMELEONREVISION%\ -\fs50 \ -\pard\ri0 - -\fs22 \cf0 \ -\ +\fs50 \cf0 \ \pard\ri0\qc \fs28 \cf2 Do not install to an Apple Macintosh computer\ Index: branches/ErmaC/Modules/package/Resources/ar.lproj/Description.html =================================================================== --- branches/ErmaC/Modules/package/Resources/ar.lproj/Description.html (revision 1750) +++ branches/ErmaC/Modules/package/Resources/ar.lproj/Description.html (revision 1751) @@ -34,7 +34,6 @@

- Automatic P-State & C-State generation لادارة الطاقة كما يجب ان يكون .

- Message logging.


-


هذا البرنامج صدر تحت رخضة الاصدار الثانى الهام ل Gnu .

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


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/ar.lproj/Welcome.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/Modules/package/Resources/ar.lproj/Welcome.rtfd/TXT.rtf (revision 1750) +++ branches/ErmaC/Modules/package/Resources/ar.lproj/Welcome.rtfd/TXT.rtf (revision 1751) @@ -11,13 +11,8 @@ \pard\ri0\qc \fs26 \cf0 v%CHAMELEONVERSION% r%CHAMELEONREVISION%\ -\pard\ri0\qc \fs50 \cf0 \ -\pard\ri0 - -\fs22 \cf0 \ -\ \pard\ri0\qc \f1\fs28 \cf2 \'e1\'c7 Index: branches/ErmaC/Modules/package/Resources/pt-PT.lproj/Description.html =================================================================== --- branches/ErmaC/Modules/package/Resources/pt-PT.lproj/Description.html (revision 1750) +++ branches/ErmaC/Modules/package/Resources/pt-PT.lproj/Description.html (revision 1751) @@ -34,7 +34,6 @@

- P-State automático & Geração C-State para gestão de energia nativa.

- Protocolo Mensagens.


-


Este código é distribuido sobre os termos da versão 2 da Gnu Public License.

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


Index: branches/ErmaC/Modules/package/Resources/es.lproj/Description.html =================================================================== --- branches/ErmaC/Modules/package/Resources/es.lproj/Description.html (revision 1750) +++ branches/ErmaC/Modules/package/Resources/es.lproj/Description.html (revision 1751) @@ -34,7 +34,6 @@

- Generación automática de P-States & C-States para gestión de energía nativa.

- Registro de Mensajes.


-


El código está liberado bajo la versión 2 de la Licencia Pública GNU.

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


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/mk.lproj/Description.html =================================================================== --- branches/ErmaC/Modules/package/Resources/mk.lproj/Description.html (revision 1750) +++ branches/ErmaC/Modules/package/Resources/mk.lproj/Description.html (revision 1751) @@ -34,7 +34,6 @@

- Автоматско генерирање на P-State & C-State за природна контрола на процесорот.

- Логирање на пораки.


-


Овој код е објавен под верзијата 2 од Gnu Public License.

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


Index: branches/ErmaC/Modules/package/Resources/ko.lproj/Description.html =================================================================== --- branches/ErmaC/Modules/package/Resources/ko.lproj/Description.html (revision 1750) +++ branches/ErmaC/Modules/package/Resources/ko.lproj/Description.html (revision 1751) @@ -39,7 +39,6 @@

- 자동 P-State & C-State 생성기능으로 자연적인 전원 관리.

- 메세지 로깅.


-


이 코드는 GNU 일반 공중 사용 허가서(GPL) 버전 2 아래 공개 되었습니다.

(영문) http://forge.voodooprojects.org/p/chameleon


Index: branches/ErmaC/Modules/package/Resources/it.lproj/Description.html =================================================================== --- branches/ErmaC/Modules/package/Resources/it.lproj/Description.html (revision 1750) +++ branches/ErmaC/Modules/package/Resources/it.lproj/Description.html (revision 1751) @@ -34,7 +34,6 @@

- Generazione automatica dei P-State e C-State.

- Log dei messaggi.


-


Il codice è rilasciato sotto la versione 2 della licenza GPL (Gnu Public License).

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


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/it.lproj/Welcome.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/Modules/package/Resources/it.lproj/Welcome.rtfd/TXT.rtf (revision 1750) +++ branches/ErmaC/Modules/package/Resources/it.lproj/Welcome.rtfd/TXT.rtf (revision 1751) @@ -1,4 +1,4 @@ -{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf230 +{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf360 {\fonttbl\f0\fnil\fcharset0 LucidaGrande;} {\colortbl;\red255\green255\blue255;\red255\green0\blue9;\red0\green0\blue255;} \margl1440\margr1440\vieww11660\viewh12980\viewkind0 @@ -12,11 +12,7 @@ \fs26 \cf0 v%CHAMELEONVERSION% r%CHAMELEONREVISION%\ -\fs50 \ -\pard\ri0 - -\fs22 \cf0 \ -\ +\fs50 \cf0 \ \pard\ri0\qc \fs28 \cf2 Non installare su computer Apple Macintosh\ Index: branches/ErmaC/Modules/package/Resources/sr.lproj/Description.html =================================================================== --- branches/ErmaC/Modules/package/Resources/sr.lproj/Description.html (revision 1750) +++ branches/ErmaC/Modules/package/Resources/sr.lproj/Description.html (revision 1751) @@ -34,7 +34,6 @@

- Automatsko generisanje P-State i C-State za izvorno upravljanje energijom.

- Prijava porukama.


-


Kod je objavljen pod verzijom 2 GNU javna licenca.

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


Index: branches/ErmaC/Modules/package/Resources/bg.lproj/Description.html =================================================================== --- branches/ErmaC/Modules/package/Resources/bg.lproj/Description.html (revision 1750) +++ branches/ErmaC/Modules/package/Resources/bg.lproj/Description.html (revision 1751) @@ -34,7 +34,6 @@

- Automatic P-State & C-State generation for native power management.

- Message logging.


-


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

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


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/Resources/de.lproj/Description.html =================================================================== --- branches/ErmaC/Modules/package/Resources/de.lproj/Description.html (revision 1750) +++ branches/ErmaC/Modules/package/Resources/de.lproj/Description.html (revision 1751) @@ -34,7 +34,6 @@

- Automatische P-State & C-State generation für native power management.

- Message logging.


-


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

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


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/buildpkg.sh =================================================================== --- branches/ErmaC/Modules/package/buildpkg.sh (revision 1750) +++ branches/ErmaC/Modules/package/buildpkg.sh (revision 1751) @@ -39,607 +39,691 @@ indent[2]="\t\t\t" indent[3]="\t\t\t\t" +declare -a pkgrefs + +# Package identifiers +modules_packages_identity="org.chameleon.modules" + +getPackageRefId () { + echo ${1//_/.}.${2//_/.} | tr [:upper:] [:lower:] +} + +addChoice () { + # $1 Choice Id + # $2 Choice Options + # $3..$n Package reference id (optional) + local choiceId="${1}" + local choiceOptions="${2}" + local choiceNode="\t" + done + fi + choiceNode="${choiceNode}\n\t\n" + + outline[$((outlinecount++))]="${indent[$xmlindent]}" + choices[$((choicescount++))]="$choiceNode" +} + +exclusive_one_choice () { + # $1 Current choice (ie: test1) + # $2..$n Others choice(s) (ie: "test2" "test3"). Current can or can't be in the others choices + local myChoice="${1}" + local result; + local separator=' || '; + for choice in ${@:2};do + if [[ "$choice" != "$myChoice" ]];then + result="${result}choices['$choice'].selected${separator}"; + fi + done + echo "!(${result%$separator})" +} + +exclusive_zero_or_one_choice () { + # $1 Current choice (ie: test1) + # $2..$n Others choice(s) (ie: "test2" "test3"). Current can or can't be in the others choices + local myChoice="${1}" + local result; + echo "(my.choice.selected && $(exclusive_one_choice ${@}))" +} + main () { # clean up the destination path -rm -R -f "${1}" -echo "" -echo -e $COL_CYAN" ----------------------------------"$COL_RESET -echo -e $COL_CYAN" Building $packagename Install Package"$COL_RESET -echo -e $COL_CYAN" ----------------------------------"$COL_RESET -echo "" + rm -R -f "${1}" + echo "" + echo -e $COL_CYAN" ----------------------------------"$COL_RESET + echo -e $COL_CYAN" Building $packagename Install Package"$COL_RESET + echo -e $COL_CYAN" ----------------------------------"$COL_RESET + echo "" -outline[$((outlinecount++))]="${indent[$xmlindent]}" + 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 + echo "================= Preinstall =================" + ((xmlindent++)) + packagesidentity="org.chameleon" + choiceId="Pre" + mkdir -p ${1}/${choiceId}/Root + mkdir -p ${1}/${choiceId}/Scripts + ditto --noextattr --noqtn ${1%/*/*}/revision ${1}/${choiceId}/Scripts/Resources/revision + ditto --noextattr --noqtn ${1%/*/*}/version ${1}/${choiceId}/Scripts/Resources/version + cp -f ${pkgroot}/Scripts/Main/preinstall ${1}/${choiceId}/Scripts + cp -f ${pkgroot}/Scripts/Sub/InstallLog.sh ${1}/${choiceId}/Scripts + echo -e "\t[BUILD] ${choiceId} " + packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}") + buildpackage "$packageRefId" "${choiceId}" "${1}/${choiceId}" "/" >/dev/null 2>&1 + addChoice "${choiceId}" "start_visible=\"false\" start_selected=\"true\"" "$packageRefId" # End build pre install package # build core package - echo "================= 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 - ditto --noextattr --noqtn ${1%/*}/i386/boot0 ${1}/Core/Root/usr/standalone/i386 - ditto --noextattr --noqtn ${1%/*}/i386/boot0md ${1}/Core/Root/usr/standalone/i386 - ditto --noextattr --noqtn ${1%/*}/i386/boot1f32 ${1}/Core/Root/usr/standalone/i386 - ditto --noextattr --noqtn ${1%/*}/i386/boot1h ${1}/Core/Root/usr/standalone/i386 - ditto --noextattr --noqtn ${1%/*}/i386/boot1he ${1}/Core/Root/usr/standalone/i386 - ditto --noextattr --noqtn ${1%/*}/i386/boot1hp ${1}/Core/Root/usr/standalone/i386 - ditto --noextattr --noqtn ${1%/*}/i386/cdboot ${1}/Core/Root/usr/standalone/i386 - ditto --noextattr --noqtn ${1%/*}/i386/chain0 ${1}/Core/Root/usr/standalone/i386 - ditto --noextattr --noqtn ${1%/*}/i386/fdisk440 ${1}/Core/Root/usr/local/bin - ditto --noextattr --noqtn ${1%/*}/i386/bdmesg ${1}/Core/Root/usr/local/bin - 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 + echo "================= Core =================" + packagesidentity="org.chameleon" + choiceId="Core" + mkdir -p ${1}/${choiceId}/Root/usr/local/bin + mkdir -p ${1}/${choiceId}/Root/usr/standalone/i386 + ditto --noextattr --noqtn ${1%/*}/i386/boot ${1}/${choiceId}/Root/usr/standalone/i386 + ditto --noextattr --noqtn ${1%/*}/i386/boot0 ${1}/${choiceId}/Root/usr/standalone/i386 + ditto --noextattr --noqtn ${1%/*}/i386/boot0md ${1}/${choiceId}/Root/usr/standalone/i386 + ditto --noextattr --noqtn ${1%/*}/i386/boot1f32 ${1}/${choiceId}/Root/usr/standalone/i386 + ditto --noextattr --noqtn ${1%/*}/i386/boot1h ${1}/${choiceId}/Root/usr/standalone/i386 + ditto --noextattr --noqtn ${1%/*}/i386/boot1he ${1}/${choiceId}/Root/usr/standalone/i386 + ditto --noextattr --noqtn ${1%/*}/i386/boot1hp ${1}/${choiceId}/Root/usr/standalone/i386 + ditto --noextattr --noqtn ${1%/*}/i386/cdboot ${1}/${choiceId}/Root/usr/standalone/i386 + ditto --noextattr --noqtn ${1%/*}/i386/chain0 ${1}/${choiceId}/Root/usr/standalone/i386 + ditto --noextattr --noqtn ${1%/*}/i386/fdisk440 ${1}/${choiceId}/Root/usr/local/bin + ditto --noextattr --noqtn ${1%/*}/i386/bdmesg ${1}/${choiceId}/Root/usr/local/bin + echo -e "\t[BUILD] ${choiceId} " + packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}") + buildpackage "$packageRefId" "${choiceId}" "${1}/${choiceId}" "/" >/dev/null 2>&1 + addChoice "${choiceId}" "start_visible=\"false\" start_selected=\"true\"" "$packageRefId" # End build core package - + # build install type - echo "================= Chameleon =================" - outline[$((outlinecount++))]="${indent[$xmlindent]}" - choices[$((choicescount++))]="\t\n\t\n" - ((xmlindent++)) - packagesidentity="org.chameleon.type" - - # build new install package - mkdir -p ${1}/New/Root - echo "" > "${1}/New/Root/install_type_new" - echo " [BUILD] New " - buildpackage "${1}/New" "/$chamTemp" "" "start_enabled=\"true\" selected=\"exclusive(choices['Upgrade'])\"" >/dev/null 2>&1 - # End build new install package + echo "================= Chameleon =================" + outline[$((outlinecount++))]="${indent[$xmlindent]}" + choices[$((choicescount++))]="\t\n\t\n" + ((xmlindent++)) + packagesidentity="org.chameleon.type" + allChoices="New Upgrade" - # build upgrade package - mkdir -p ${1}/Upgrade/Root - echo "" > "${1}/Upgrade/Root/install_type_upgrade" - echo " [BUILD] Upgrade " - buildpackage "${1}/Upgrade" "/$chamTemp" "" "start_selected=\"false\" selected=\"exclusive(choices['New'])\"" >/dev/null 2>&1 - # End build upgrade package + # build new install package + choiceId="New" + mkdir -p ${1}/${choiceId}/Root + echo "" > "${1}/${choiceId}/Root/install_type_new" + echo -e "\t[BUILD] ${choiceId} " + packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}") + buildpackage "$packageRefId" "${choiceId}" "${1}/${choiceId}" "/$chamTemp" >/dev/null 2>&1 + exclusiveChoice=$(exclusive_one_choice "$choiceId" "$allChoices") + addChoice "${choiceId}" "start_selected=\"!choices['Upgrade'].selected\" selected=\"${exclusiveChoice}\"" "$packageRefId" + # End build new install package + # build upgrade package + choiceId="Upgrade" + mkdir -p ${1}/${choiceId}/Root + echo "" > "${1}/${choiceId}/Root/install_type_upgrade" + echo -e "\t[BUILD] ${choiceId} " + packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}") + buildpackage "$packageRefId" "${choiceId}" "${1}/${choiceId}" "/$chamTemp" >/dev/null 2>&1 + exclusiveChoice=$(exclusive_one_choice "$choiceId" "$allChoices") + addChoice "${choiceId}" "start_selected=\"chameleon_boot_plist_exists()\" selected=\"${exclusiveChoice}\"" "$packageRefId" + # End build upgrade package + ((xmlindent--)) outline[$((outlinecount++))]="${indent[$xmlindent]}" -# End build install type +# End build install type # build Chameleon package - echo "================= Chameleon =================" - 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/Standardpostinstall ${1}/Standard/Scripts/postinstall - cp -f ${pkgroot}/Scripts/Sub/* ${1}/Standard/Scripts - ditto --arch i386 `which SetFile` ${1}/Standard/Scripts/Resources/SetFile - echo " [BUILD] Standard " - buildpackage "${1}/Standard" "/" "${coresize}" "start_enabled=\"true\" selected=\"exclusive(choices['EFI']) && exclusive(choices['noboot'])\"" >/dev/null 2>&1 - # End build standard package + echo "================= Chameleon =================" + outline[$((outlinecount++))]="${indent[$xmlindent]}" + choices[$((choicescount++))]="\t\n\t\n" + ((xmlindent++)) - # build efi package - mkdir -p ${1}/EFI/Root - mkdir -p ${1}/EFI/Scripts/Resources - cp -f ${pkgroot}/Scripts/Main/ESPpostinstall ${1}/EFI/Scripts/postinstall - cp -f ${pkgroot}/Scripts/Sub/* ${1}/EFI/Scripts - ditto --arch i386 `which SetFile` ${1}/EFI/Scripts/Resources/SetFile - echo " [BUILD] EFI " - buildpackage "${1}/EFI" "/" "${coresize}" "start_visible=\"systemHasGPT()\" selected=\"exclusive(choices['Standard']) && exclusive(choices['noboot'])\"" >/dev/null 2>&1 - # End build efi package + allChoices="Standard EFI noboot" - # build reset choice package - mkdir -p ${1}/noboot/Root - echo " [BUILD] Reset choice " - buildpackage "${1}/noboot" "/$chamTemp" "" "selected=\"exclusive(choices['Standard']) && exclusive(choices['EFI'])\"" >/dev/null 2>&1 - # End build reset choice package + # build standard package + choiceId="Standard" + mkdir -p ${1}/${choiceId}/Root + mkdir -p ${1}/${choiceId}/Scripts/Resources + cp -f ${pkgroot}/Scripts/Main/${choiceId}postinstall ${1}/${choiceId}/Scripts/postinstall + cp -f ${pkgroot}/Scripts/Sub/* ${1}/${choiceId}/Scripts + ditto --arch i386 `which SetFile` ${1}/${choiceId}/Scripts/Resources/SetFile + echo -e "\t[BUILD] ${choiceId} " + packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}") + buildpackage "$packageRefId" "${choiceId}" "${1}/${choiceId}" "/" >/dev/null 2>&1 + exclusiveChoice=$(exclusive_one_choice "$choiceId" "$allChoices") + addChoice "${choiceId}" "start_selected=\"true\" selected=\"${exclusiveChoice}\"" "$packageRefId" + # End build standard package + # build efi package + choiceId="EFI" + mkdir -p ${1}/${choiceId}/Root + mkdir -p ${1}/${choiceId}/Scripts/Resources + cp -f ${pkgroot}/Scripts/Main/ESPpostinstall ${1}/${choiceId}/Scripts/postinstall + cp -f ${pkgroot}/Scripts/Sub/* ${1}/${choiceId}/Scripts + ditto --arch i386 `which SetFile` ${1}/${choiceId}/Scripts/Resources/SetFile + echo -e "\t[BUILD] ${choiceId} " + packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}") + buildpackage "$packageRefId" "${choiceId}" "${1}/${choiceId}" "/" >/dev/null 2>&1 + exclusiveChoice=$(exclusive_one_choice "$choiceId" "$allChoices") + addChoice "${choiceId}" "start_visible=\"systemHasGPT()\" start_selected=\"false\" selected=\"${exclusiveChoice}\"" "$packageRefId" + # End build efi package + + # build no bootloader choice package + choiceId="noboot" + mkdir -p ${1}/${choiceId}/Root + echo -e "\t[BUILD] ${choiceId} " + packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}") + buildpackage "$packageRefId" "${choiceId}" "${1}/${choiceId}" "/" >/dev/null 2>&1 + exclusiveChoice=$(exclusive_one_choice "$choiceId" "$allChoices") + addChoice "${choiceId}" "start_selected=\"false\" selected=\"${exclusiveChoice}\"" "$packageRefId" + # End build no bootloader choice package + ((xmlindent--)) outline[$((outlinecount++))]="${indent[$xmlindent]}" # End build Chameleon package # build Modules package - echo "================= Modules =================" - ############################### - # Supported Modules # - ############################### - # AMDGraphicsEnabler.dylib # - # ATiGraphicsEnabler.dylib # - # IntelGraphicsEnabler.dylib # - # klibc.dylib # - # NVIDIAGraphicsEnabler.dylib # - # Resolution.dylib # - # uClibcxx.dylib # - # Keylayout.dylib # - ############################### - if [ "$(ls -A "${1%/*}/i386/modules")" ]; then - { - outline[$((outlinecount++))]="${indent[$xmlindent]}" - choices[$((choicescount++))]="\t\n\t\n" - ((xmlindent++)) - packagesidentity="org.chameleon.modules" + echo "================= Modules =================" + ############################### + # Supported Modules # + ############################### + # AMDGraphicsEnabler.dylib # + # ATiGraphicsEnabler.dylib # + # IntelGraphicsEnabler.dylib # + # klibc.dylib # + # NVIDIAGraphicsEnabler.dylib # + # Resolution.dylib # + # uClibcxx.dylib # + # Keylayout.dylib # + ############################### + if [ "$(ls -A "${1%/*}/i386/modules")" ]; then + { + outline[$((outlinecount++))]="${indent[$xmlindent]}" + choices[$((choicescount++))]="\t\n\t\n" + ((xmlindent++)) + # - - if [ -e ${1%/*}/i386/modules/klibc.dylib ]; then - { - mkdir -p ${1}/klibc/Root - ditto --noextattr --noqtn ${1%/*}/i386/modules/klibc.dylib ${1}/klibc/Root - echo " [BUILD] klibc " - buildpackage "${1}/klibc" "/$chamTemp/Extra/modules" "" "start_selected=\"false\"" >/dev/null 2>&1 - } - fi + if [ -e ${1%/*}/i386/modules/klibc.dylib ]; then + { + # Start build klibc package module + choiceId="klibc" + mkdir -p ${1}/${choiceId}/Root + ditto --noextattr --noqtn ${1%/*}/i386/modules/${choiceId}.dylib ${1}/${choiceId}/Root + echo -e "\t[BUILD] ${choiceId} " + packageRefId=$(getPackageRefId "${modules_packages_identity}" "${choiceId}") + buildpackage "$packageRefId" "${choiceId}" "${1}/${choiceId}" "/$chamTemp/Extra/modules" >/dev/null 2>&1 + addChoice "${choiceId}" "start_selected=\"false\"" "$packageRefId" + # End build klibc package module + } + fi + # - - if [ -e ${1%/*}/i386/modules/uClibcxx.dylib ]; then - { - mkdir -p ${1}/uClibc/Root - ditto --noextattr --noqtn ${1%/*}/i386/modules/uClibcxx.dylib ${1}/uClibc/Root - ditto --noextattr --noqtn ${1%/*}/i386/modules/klibc.dylib ${1}/uClibc/Root - echo " [BUILD] uClibc++ " - buildpackage "${1}/uClibc" "/$chamTemp/Extra/modules" "" "start_selected=\"false\"" >/dev/null 2>&1 - } - fi + if [ -e ${1%/*}/i386/modules/uClibcxx.dylib ]; then + { + # Start build uClibc package module + choiceId="uClibc" + mkdir -p ${1}/${choiceId}/Root + ditto --noextattr --noqtn ${1%/*}/i386/modules/uClibcxx.dylib ${1}/${choiceId}/Root + echo -e "\t[BUILD] ${choiceId} " + packageRefId=$(getPackageRefId "${modules_packages_identity}" "${choiceId}") + buildpackage "$packageRefId" "${choiceId}" "${1}/${choiceId}" "/$chamTemp/Extra/modules" >/dev/null 2>&1 + # Add the klibc package because the uClibc module is dependent of klibc module + addChoice "${choiceId}" "start_selected=\"false\"" \ + "$packageRefId" $(getPackageRefId "${modules_packages_identity}" "klibc") + # End build uClibc package module + } + fi + # - - if [ -e ${1%/*}/i386/modules/Resolution.dylib ]; then - { - mkdir -p ${1}/AutoReso/Root - ditto --noextattr --noqtn ${1%/*}/i386/modules/Resolution.dylib ${1}/AutoReso/Root - echo " [BUILD] Resolution " - buildpackage "${1}/AutoReso" "/$chamTemp/Extra/modules" "" "start_selected=\"false\"" >/dev/null 2>&1 - } - fi + if [ -e ${1%/*}/i386/modules/Resolution.dylib ]; then + { + # Start build Resolution package module + choiceId="AutoReso" + mkdir -p ${1}/${choiceId}/Root + ditto --noextattr --noqtn ${1%/*}/i386/modules/Resolution.dylib ${1}/${choiceId}/Root + echo -e "\t[BUILD] ${choiceId} " + packageRefId=$(getPackageRefId "${modules_packages_identity}" "${choiceId}") + buildpackage "$packageRefId" "${choiceId}" "${1}/${choiceId}" "/$chamTemp/Extra/modules" >/dev/null 2>&1 + addChoice "${choiceId}" "start_selected=\"false\"" "$packageRefId" + # End build Resolution package module + } + fi + # - - # Warning Keylayout module need additional files - if [ -e ${1%/*}/i386/modules/Keylayout.dylib ]; then - { - mkdir -p ${1}/Keylayout/Root/Extra/{modules,Keymaps} - mkdir -p ${1}/Keylayout/Root/usr/local/bin - layout_src_dir="${1%/sym/*}/i386/modules/Keylayout/layouts/layouts-src" - if [ -d "$layout_src_dir" ];then - # Create a tar.gz from layout sources - (cd "$layout_src_dir"; \ - tar czf "${1}/Keylayout/Root/Extra/Keymaps/layouts-src.tar.gz" README *.slt) - fi - # Adding module - ditto --noextattr --noqtn ${1%/*}/i386/modules/Keylayout.dylib ${1}/Keylayout/Root/Extra/modules - # Adding Keymaps - ditto --noextattr --noqtn ${1%/sym/*}/Keymaps ${1}/Keylayout/Root/Extra/Keymaps - # Adding tools - ditto --noextattr --noqtn ${1%/*}/i386/cham-mklayout ${1}/Keylayout/Root/usr/local/bin - echo " [BUILD] Keylayout " - buildpackage "${1}/Keylayout" "/" "" "start_selected=\"true\"" >/dev/null 2>&1 - } - fi + # Warning Keylayout module need additional files + if [ -e ${1%/*}/i386/modules/Keylayout.dylib ]; then + { + # Start build Keylayout package module + choiceId="Keylayout" + mkdir -p ${1}/${choiceId}/Root/Extra/{modules,Keymaps} + mkdir -p ${1}/${choiceId}/Root/usr/local/bin + layout_src_dir="${1%/sym/*}/i386/modules/Keylayout/layouts/layouts-src" + if [ -d "$layout_src_dir" ];then + # Create a tar.gz from layout sources + (cd "$layout_src_dir"; \ + tar czf "${1}/Keylayout/Root/Extra/Keymaps/layouts-src.tar.gz" README *.slt) + fi + # Adding module + ditto --noextattr --noqtn ${1%/*}/i386/modules/${choiceId}.dylib ${1}/${choiceId}/Root/Extra/modules + # Adding Keymaps + ditto --noextattr --noqtn ${1%/sym/*}/Keymaps ${1}/${choiceId}/Root/Extra/Keymaps + # Adding tools + ditto --noextattr --noqtn ${1%/*}/i386/cham-mklayout ${1}/${choiceId}/Root/usr/local/bin + echo -e "\t[BUILD] ${choiceId} " + packageRefId=$(getPackageRefId "${modules_packages_identity}" "${choiceId}") + buildpackage "$packageRefId" "${choiceId}" "${1}/${choiceId}" "/$chamTemp" >/dev/null 2>&1 + + # Don't add a choice for Keylayout module + # addChoice "${choiceId}" "start_selected=\"false\"" "$packageRefId" + # End build Keylayout package module + } + fi + # - - if [ -e ${1%/*}/i386/modules/AMDGraphicsEnabler.dylib ]; then - { - mkdir -p ${1}/AMDGraphicsEnabler/Root - ditto --noextattr --noqtn ${1%/*}/i386/modules/AMDGraphicsEnabler.dylib ${1}/AMDGraphicsEnabler/Root - echo " [BUILD] AMDGraphicsEnabler " - buildpackage "${1}/AMDGraphicsEnabler" "/$chamTemp/Extra/modules" "" "start_selected=\"false\"" >/dev/null 2>&1 - } - fi + + if [ -e ${1%/*}/i386/modules/AMDGraphicsEnabler.dylib ]; then + { + # Start build AMDGraphicsEnabler package module + choiceId="AMDGraphicsEnabler" + mkdir -p ${1}/${choiceId}/Root + ditto --noextattr --noqtn ${1%/*}/i386/modules/AMDGraphicsEnabler.dylib ${1}/${choiceId}/Root + echo -e "\t[BUILD] ${choiceId} " + packageRefId=$(getPackageRefId "${modules_packages_identity}" "${choiceId}") + buildpackage "$packageRefId" "${choiceId}" "${1}/${choiceId}" "/$chamTemp/Extra/modules" >/dev/null 2>&1 + addChoice "${choiceId}" "start_selected=\"false\"" "$packageRefId" + # End build AMDGraphicsEnabler package module + } + fi + # - - if [ -e ${1%/*}/i386/modules/ATiGraphicsEnabler.dylib ]; then - { - mkdir -p ${1}/ATiGraphicsEnabler/Root - ditto --noextattr --noqtn ${1%/*}/i386/modules/ATiGraphicsEnabler.dylib ${1}/ATiGraphicsEnabler/Root - echo " [BUILD] ATiGraphicsEnabler " - buildpackage "${1}/ATiGraphicsEnabler" "/$chamTemp/Extra/modules" "" "start_selected=\"false\"" >/dev/null 2>&1 - } - fi + + if [ -e ${1%/*}/i386/modules/ATiGraphicsEnabler.dylib ]; then + { + # Start build ATiGraphicsEnabler package module + choiceId="AMDGraphicsEnabler" + mkdir -p ${1}/${choiceId}/Root + ditto --noextattr --noqtn ${1%/*}/i386/modules/ATiGraphicsEnabler.dylib ${1}/${choiceId}/Root + echo -e "\t[BUILD] ${choiceId} " + packageRefId=$(getPackageRefId "${modules_packages_identity}" "${choiceId}") + buildpackage "$packageRefId" "${choiceId}" "${1}/${choiceId}" "/$chamTemp/Extra/modules" >/dev/null 2>&1 + addChoice "${choiceId}" "start_selected=\"false\"" "$packageRefId" + # End build ATiGraphicsEnabler package module + } + fi + # - - if [ -e ${1%/*}/i386/modules/IntelGraphicsEnabler.dylib ]; then - { - mkdir -p ${1}/IntelGraphicsEnabler/Root - ditto --noextattr --noqtn ${1%/*}/i386/modules/IntelGraphicsEnabler.dylib ${1}/IntelGraphicsEnabler/Root - echo " [BUILD] IntelGraphicsEnabler " - buildpackage "${1}/IntelGraphicsEnabler" "/$chamTemp/Extra/modules" "" "start_selected=\"false\"" >/dev/null 2>&1 - } - fi + + if [ -e ${1%/*}/i386/modules/IntelGraphicsEnabler.dylib ]; then + { + # Start build ATiGraphicsEnabler package module + choiceId="IntelGraphicsEnabler" + mkdir -p ${1}/${choiceId}/Root + ditto --noextattr --noqtn ${1%/*}/i386/modules/IntelGraphicsEnabler.dylib ${1}/${choiceId}/Root + echo -e "\t[BUILD] ${choiceId} " + packageRefId=$(getPackageRefId "${modules_packages_identity}" "${choiceId}") + buildpackage "$packageRefId" "${choiceId}" "${1}/${choiceId}" "/$chamTemp/Extra/modules" >/dev/null 2>&1 + addChoice "${choiceId}" "start_selected=\"false\"" "$packageRefId" + # End build IntelGraphicsEnabler package module + } + fi + # - - if [ -e ${1%/*}/i386/modules/NVIDIAGraphicsEnabler.dylib ]; then - { - mkdir -p ${1}/NVIDIAGraphicsEnabler/Root - ditto --noextattr --noqtn ${1%/*}/i386/modules/NVIDIAGraphicsEnabler.dylib ${1}/NVIDIAGraphicsEnabler/Root - echo " [BUILD] NVIDIAGraphicsEnabler " - buildpackage "${1}/NVIDIAGraphicsEnabler" "/$chamTemp/Extra/modules" "" "start_selected=\"false\"" >/dev/null 2>&1 - } - fi - ((xmlindent--)) - outline[$((outlinecount++))]="${indent[$xmlindent]}" - } - else - { - echo " -= no modules to include =-" - } - fi + if [ -e ${1%/*}/i386/modules/NVIDIAGraphicsEnabler.dylib ]; then + { + # Start build NVIDIAGraphicsEnabler package module + choiceId="NVIDIAGraphicsEnabler" + mkdir -p ${1}/${choiceId}/Root + ditto --noextattr --noqtn ${1%/*}/i386/modules/NVIDIAGraphicsEnabler.dylib ${1}/${choiceId}/Root + echo -e "\t[BUILD] ${choiceId} " + packageRefId=$(getPackageRefId "${modules_packages_identity}" "${choiceId}") + buildpackage "$packageRefId" "${choiceId}" "${1}/${choiceId}" "/$chamTemp/Extra/modules" >/dev/null 2>&1 + addChoice "${choiceId}" "start_selected=\"false\"" "$packageRefId" + # End build NVIDIAGraphicsEnabler package module + } + fi + + ((xmlindent--)) + outline[$((outlinecount++))]="${indent[$xmlindent]}" + } + else + { + echo " -= no modules to include =-" + } + fi # End build Modules packages -# build Extras package - # build options packages +# build Options packages - outline[$((outlinecount++))]="${indent[$xmlindent]}" - choices[$((choicescount++))]="\t\n\t\n" + outline[$((outlinecount++))]="${indent[$xmlindent]}" + choices[$((choicescount++))]="\t\n\t\n" + ((xmlindent++)) + + + # ------------------------------------------------------ + # parse OptionalSettings folder to find files of boot options. + # ------------------------------------------------------ + OptionalSettingsFolder="${pkgroot}/OptionalSettings" + OptionalSettingsFiles=($( find "${OptionalSettingsFolder}" -depth 1 ! -name '.svn' ! -name '.DS_Store' )) + + for (( i = 0 ; i < ${#OptionalSettingsFiles[@]} ; i++ )) + do + + # Take filename and Strip .txt from end and path from front + builtOptionsList=$( echo ${OptionalSettingsFiles[$i]%.txt} ) + builtOptionsList=$( echo ${builtOptionsList##*/} ) + echo "================= $builtOptionsList =================" + outline[$((outlinecount++))]="${indent[$xmlindent]}" + choices[$((choicescount++))]="\t\n\t\n" ((xmlindent++)) + packagesidentity="org.chameleon.options.$builtOptionsList" # ------------------------------------------------------ - # parse OptionalSettings folder to find files of boot options. + # Read boot option file into an array. # ------------------------------------------------------ - OptionalSettingsFolder="${pkgroot}/OptionalSettings" - OptionalSettingsFiles=($( find "${OptionalSettingsFolder}" -depth 1 ! -name '.svn' ! -name '.DS_Store' )) - - for (( i = 0 ; i < ${#OptionalSettingsFiles[@]} ; i++ )) - do - - # Take filename and Strip .txt from end and path from front - builtOptionsList=$( echo ${OptionalSettingsFiles[$i]%.txt} ) - builtOptionsList=$( echo ${builtOptionsList##*/} ) - echo "================= $builtOptionsList =================" - outline[$((outlinecount++))]="${indent[$xmlindent]}" - choices[$((choicescount++))]="\t\n\t\n" - ((xmlindent++)) - packagesidentity="org.chameleon.options.$builtOptionsList" - - # ------------------------------------------------------ - # Read boot option file in to an array. - # ------------------------------------------------------ - availableOptions=() # array to hold the list of boot options, per 'section'. - exclusiveFlag=0 # used to indicate list has exclusive options. - exclusiveName="" # will be appended to exclusive 'none' option name. - count=0 # used as index for stepping through array. - while read textLine - do - # ignore lines in the file beginning with a # and Exclusive=False - if [[ ${textLine} != \#* ]] && [[ ${textLine} != "Exclusive=False" ]];then - # check for 'Exclusive=True' option in file - if [[ ${textLine} == "Exclusive=True" ]];then - exclusiveFlag=1 - exclusiveName=$builtOptionsList - else - availableOptions[count]=$textLine - ((count++)) - fi + availableOptions=() # array to hold the list of boot options, per 'section'. + exclusiveFlag=0 # used to indicate list has exclusive options + count=0 # used as index for stepping through array. + while read textLine; do + # ignore lines in the file beginning with a # and Exclusive=False + if [[ ${textLine} != \#* ]] && [[ ${textLine} != "Exclusive=False" ]];then + # check for 'Exclusive=True' option in file + if [[ ${textLine} == "Exclusive=True" ]];then + exclusiveFlag=1 + else + availableOptions[${#availableOptions[@]}]=$textLine fi - done < ${OptionalSettingsFiles[$i]} - buildoptionalsettings "$1" "${exclusiveFlag}" "${exclusiveName}" - - ((xmlindent--)) - outline[$((outlinecount++))]="${indent[$xmlindent]}" - done + fi + done < ${OptionalSettingsFiles[$i]} - # build KeyLayout options packages - echo "================= Keymaps Options =================" - outline[$((outlinecount++))]="${indent[$xmlindent]}" - choices[$((choicescount++))]="\t\n\t\n" - ((xmlindent++)) - packagesidentity="org.chameleon.options.keylayout" - - # ------------------------------------------------------ - # Available Keylayout boot options are discovered by - # reading contents of /Keymaps folder after compilation - # ------------------------------------------------------ - availableOptions=() - availableOptions=($( find "${1%/sym/*}/Keymaps" -type f -depth 1 -name '*.lyt' | sed 's|.*/||;s|\.lyt||' )) - # Adjust array contents to match expected format - # for boot options which is: name:key=value - for (( i = 0 ; i < ${#availableOptions[@]} ; i++ )) - do - availableOptions[i]=${availableOptions[i]}":KeyLayout="${availableOptions[i]} - done - - # to indicate exclusive option, call buildoptionalsettings with the 2nd parameter set to 1 . - buildoptionalsettings "$1" "1" "keylayout" - - ((xmlindent--)) - outline[$((outlinecount++))]="${indent[$xmlindent]}" + # ------------------------------------------------------ + # Loop through options in array and process each in turn + # ------------------------------------------------------ + allChoices="${availableOptions[@]//:*/}" + for (( c = 0 ; c < ${#availableOptions[@]} ; c++ )); do + textLine=${availableOptions[c]} + # split line - taking all before ':' as option name + # and all after ':' as key/value + optionName=${textLine%:*} + keyValue=${textLine##*:} - # End build KeyLayout options packages + # create folders required for each boot option + mkdir -p "${1}/$optionName/Root/" - ((xmlindent--)) - outline[$((outlinecount++))]="${indent[$xmlindent]}" + # create dummy file with name of key/value + echo "" > "${1}/$optionName/Root/${keyValue}" - # End build options packages - - # build theme packages - echo "================= Themes =================" - outline[$((outlinecount++))]="${indent[$xmlindent]}" - choices[$((choicescount++))]="\t\n\t\n" - ((xmlindent++)) - - # Using themes section from Azi's/package branch. - packagesidentity="org.chameleon.themes" - artwork="${1%/sym/package}/artwork/themes" - themes=($( find "${artwork}" -type d -depth 1 -not -name '.svn' )) - for (( i = 0 ; i < ${#themes[@]} ; i++ )) - do - theme=$( echo ${themes[$i]##*/} | awk 'BEGIN{OFS=FS=""}{$1=toupper($1);print}' ) - mkdir -p "${1}/${theme}/Root/" - rsync -r --exclude=.svn "${themes[$i]}/" "${1}/${theme}/Root/${theme}" - echo " [BUILD] ${theme}" - buildpackage "${1}/${theme}" "/$chamTemp/Extra/Themes" "" "start_selected=\"false\"" >/dev/null 2>&1 + echo -e "\t[BUILD] ${optionName} " + packageRefId=$(getPackageRefId "${packagesidentity}" "${optionName}") + buildpackage "$packageRefId" "${optionName}" "${1}/${optionName}" "/$chamTemp/options" >/dev/null 2>&1 + exclusiveSelect="" + if [[ ${exclusiveFlag} -eq 1 ]];then + exclusiveSelect="selected=\"$(exclusive_zero_or_one_choice "$optionName" "$allChoices")\"" + fi + addChoice "${optionName}" "start_selected=\"false\" ${exclusiveSelect}" "$packageRefId" done ((xmlindent--)) outline[$((outlinecount++))]="${indent[$xmlindent]}" - # End build theme packages# End build Extras package + done -# build post install package - echo "================= Post =================" - packagesidentity="org.chameleon" - mkdir -p ${1}/Post/Root - mkdir -p ${1}/Post/Scripts - cp -f ${pkgroot}/Scripts/Main/postinstall ${1}/Post/Scripts - cp -f ${pkgroot}/Scripts/Sub/InstallLog.sh ${1}/Post/Scripts - cp -f ${pkgroot}/Scripts/Sub/UnMountEFIvolumes.sh ${1}/Post/Scripts - ditto --noextattr --noqtn ${1%/*/*}/revision ${1}/Post/Scripts/Resources/revision - ditto --noextattr --noqtn ${1%/*/*}/version ${1}/Post/Scripts/Resources/version - echo " [BUILD] Post " - buildpackage "${1}/Post" "/" "" "start_visible=\"false\" start_selected=\"true\"" >/dev/null 2>&1 -# End build post install package + # build KeyLayout options packages + echo "================= Keymaps Options =================" + outline[$((outlinecount++))]="${indent[$xmlindent]}" + choices[$((choicescount++))]="\t\n\t\n" + ((xmlindent++)) + packagesidentity="org.chameleon.options.keylayout" + keylayoutPackageRefId=$(getPackageRefId "${modules_packages_identity}" "Keylayout") -((xmlindent--)) -outline[$((outlinecount++))]="${indent[$xmlindent]}" + # ------------------------------------------------------ + # Available Keylayout boot options are discovered by + # reading contents of /Keymaps folder after compilation + # ------------------------------------------------------ + availableOptions=($( find "${1%/sym/*}/Keymaps" -type f -depth 1 -name '*.lyt' | sed 's|.*/||;s|\.lyt||' )) + allChoices="${availableOptions[@]}" + # Adjust array contents to match expected format + # for boot options which is: name:key=value + for (( i = 0 ; i < ${#availableOptions[@]} ; i++ )); do + # availableOptions[i]=${availableOptions[i]}":KeyLayout="${availableOptions[i]} + # Start build of a keymap package module + choiceId="${availableOptions[i]}" + mkdir -p ${1}/${choiceId}/Root -# build meta package + # create dummy file with name of key/value + echo "" > "${1}/${choiceId}/Root/KeyLayout=${availableOptions[i]}" - makedistribution "${1}" "${2}" "${3}" "${4}" #"${5}" + echo -e "\t[BUILD] ${choiceId} " + packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}") + buildpackage "$packageRefId" "${choiceId}" "${1}/${choiceId}" "/$chamTemp/options" >/dev/null 2>&1 + exclusiveChoice=$(exclusive_zero_or_one_choice "$choiceId" "$allChoices") + # Add the Keylayout package because the Keylayout module is needed + addChoice "${choiceId}" "start_selected=\"false\" selected=\"${exclusiveChoice}\"" \ + "$packageRefId" "$keylayoutPackageRefId" + # End build uClibc package module + done -# clean up + ((xmlindent--)) + outline[$((outlinecount++))]="${indent[$xmlindent]}" - rm -R -f "${1}" + # End build KeyLayout options packages -} + ((xmlindent--)) + outline[$((outlinecount++))]="${indent[$xmlindent]}" +# End build options packages -fixperms () -{ - # $1 path - find "${1}" -type f -exec chmod 644 {} \; - find "${1}" -type d -exec chmod 755 {} \; - chown -R 0:0 "${1}" -} +# build theme packages + echo "================= Themes =================" + outline[$((outlinecount++))]="${indent[$xmlindent]}" + choices[$((choicescount++))]="\t\n\t\n" + ((xmlindent++)) -buildoptionalsettings() -{ - # $1 Path to package to build containing Root and or Scripts - # $2 = exclusiveFlag - # S3 = exclusiveName - - # ------------------------------------------------------ - # if exclusiveFlag=1 then re-build array - # adding extra boot option at beginning to give - #user a chance to choose none of them. - # ------------------------------------------------------ - if [ ${2} = "1" ]; then - tempArray=("${availableOptions[@]}") - availableOptions=() - availableOptions[0]="ChooseNone-"$3":DONT=ADD" - position=0 - totalItems="${#tempArray[@]}" - for (( position = 0 ; position < $totalItems ; position++ )) - do - availableOptions[$position+1]=${tempArray[${position}]} - done - fi - - # ------------------------------------------------------ - # Loop through options in array and process each in turn - # ------------------------------------------------------ - for (( c = 0 ; c < ${#availableOptions[@]} ; c++ )) - do - textLine=${availableOptions[c]} - # split line - taking all before ':' as option name - # and all after ':' as key/value - optionName=${textLine%:*} - keyValue=${textLine##*:} + # Using themes section from Azi's/package branch. + packagesidentity="org.chameleon.themes" + artwork="${1%/sym/package}/artwork/themes" + themes=($( find "${artwork}" -type d -depth 1 -not -name '.svn' )) + for (( i = 0 ; i < ${#themes[@]} ; i++ )); do + theme=$( echo ${themes[$i]##*/} | awk 'BEGIN{OFS=FS=""}{$1=toupper($1);print}' ) + mkdir -p "${1}/${theme}/Root/" + rsync -r --exclude=.svn "${themes[$i]}/" "${1}/${theme}/Root/${theme}" + echo -e "\t[BUILD] ${theme}" + packageRefId=$(getPackageRefId "${packagesidentity}" "${theme}") + buildpackage "$packageRefId" "${theme}" "${1}/${theme}" "/$chamTemp/Extra/Themes" >/dev/null 2>&1 + addChoice "${theme}" "start_selected=\"false\"" "$packageRefId" + done - # create folders required for each boot option - mkdir -p "${1}/$optionName/Root/" + ((xmlindent--)) + outline[$((outlinecount++))]="${indent[$xmlindent]}" +# End build theme packages# End build Extras package - # create dummy file with name of key/value - echo "" > "${1}/$optionName/Root/${keyValue}" +# build post install package + echo "================= Post =================" + packagesidentity="org.chameleon" + choiceId="Post" + mkdir -p ${1}/${choiceId}/Root + mkdir -p ${1}/${choiceId}/Scripts + cp -f ${pkgroot}/Scripts/Main/postinstall ${1}/${choiceId}/Scripts + cp -f ${pkgroot}/Scripts/Sub/InstallLog.sh ${1}/${choiceId}/Scripts + cp -f ${pkgroot}/Scripts/Sub/UnMountEFIvolumes.sh ${1}/${choiceId}/Scripts + ditto --noextattr --noqtn ${1%/*/*}/revision ${1}/${choiceId}/Scripts/Resources/revision + ditto --noextattr --noqtn ${1%/*/*}/version ${1}/${choiceId}/Scripts/Resources/version + echo -e "\t[BUILD] ${choiceId} " + packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}") + buildpackage "$packageRefId" "${choiceId}" "${1}/${choiceId}" "/" >/dev/null 2>&1 + addChoice "${choiceId}" "start_visible=\"false\" start_selected=\"true\"" "$packageRefId" +# End build post install package - echo " [BUILD] ${optionName} " + ((xmlindent--)) + outline[$((outlinecount++))]="${indent[$xmlindent]}" - # ------------------------------------------------------ - # Before calling buildpackage, add exclusive options - # to buildpackage call if requested. - # ------------------------------------------------------ - if [ $2 = "1" ]; then +# build meta package - # Prepare individual string parts - stringStart="selected=\"" - stringBefore="exclusive(choices['" - stringAfter="']) && " - stringEnd="'])\"" - x=${stringStart}${stringBefore} + makedistribution "${1}" "${2}" "${3}" "${4}" #"${5}" - # build string for sending to buildpackage - totalItems="${#availableOptions[@]}" - lastItem=$((totalItems-1)) +# clean up + # rm -R -f "${1}" - for (( r = 0 ; r < ${totalItems} ; r++ )) - do - textLineTemp=${availableOptions[r]} - optionNameTemp=${textLineTemp%:*} - if [ "${optionNameTemp}" != "${optionName}" ]; then - x="${x}${optionNameTemp}" - # Only add these to end of string up to the one before the last item - if [ $r -lt $lastItem ]; then - x="${x}${stringAfter}${stringBefore}" - fi - fi - done - x="${x}${stringEnd}" - - # 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 - done } buildpackage () { -# $1 Path to package to build containing Root and or Scripts -# $2 Install Location -# $3 Size -# $4 Options + # $1 Package Reference Id (ie: org.chameleon.themes.default) + # $2 Package Name (ie: Default) + # $3 Path to package to build containing Root and/or Scripts + # $4 Target install location + # $5 Size (optional) + if [[ -d "${3}/Root" ]]; then + local packageRefId="$1" + local packageName="$2" + local packagePath="$3" + local targetPath="$4" + local packageSize="$5" -if [ -d "${1}/Root" ] && [ "${1}/Scripts" ]; then + find "${packagePath}" -name '.DS_Store' -delete + local filecount=$( find "${packagePath}/Root" | wc -l ) + if [ "${packageSize}" ]; then + local installedsize="${packageSize}" + else + local installedsize=$( du -hkc "${packagePath}/Root" | tail -n1 | awk {'print $1'} ) + fi + local header="\n\n\n" + header+="\t\n" + rm -R -f "${packagePath}/Temp" - header+="auth=\"root\">\n" - header+="\t\n" - rm -R -f "${1}/Temp" + [ -d "${packagePath}/Temp" ] || mkdir -m 777 "${packagePath}/Temp" + [ -d "${packagePath}/Root" ] && mkbom "${packagePath}/Root" "${packagePath}/Temp/Bom" - [ -d "${1}/Temp" ] || mkdir -m 777 "${1}/Temp" - [ -d "${1}/Root" ] && mkbom "${1}/Root" "${1}/Temp/Bom" + if [ -d "${packagePath}/Scripts" ]; then + header+="\t\n" + for script in $( find "${packagePath}/Scripts" -type f \( -name 'pre*' -or -name 'post*' \) ); do + header+="\t\t<${script##*/} file=\"./${script##*/}\"/>\n" + done + header+="\t\n" + # Create the Script archive file (cpio format) + (cd "${packagePath}/Scripts" && find . -print | cpio -o -z -R root:wheel --format cpio > "${packagePath}/Temp/Scripts") 2>&1 | \ + grep -vE '^[0-9]+\s+blocks?$' # to remove cpio stderr messages + fi - if [ -d "${1}/Scripts" ]; then - header+="\t\n" - for script in $( find "${1}/Scripts" -type f \( -name 'pre*' -or -name 'post*' \) ) - do - header+="\t\t<${script##*/} file=\"./${script##*/}\"/>\n" - done - header+="\t\n" - chown -R 0:0 "${1}/Scripts" - pushd "${1}/Scripts" >/dev/null - find . -print | cpio -o -z -H cpio > "../Temp/Scripts" - popd >/dev/null - fi + header+="" + echo -e "${header}" > "${packagePath}/Temp/PackageInfo" - header+="" - echo -e "${header}" > "${1}/Temp/PackageInfo" - pushd "${1}/Root" >/dev/null - find . -print | cpio -o -z -H cpio > "../Temp/Payload" - popd >/dev/null - pushd "${1}/Temp" >/dev/null + # Create the Payload file (cpio format) + (cd "${packagePath}/Root" && find . -print | cpio -o -z -R root:wheel --format cpio > "${packagePath}/Temp/Payload") 2>&1 | \ + grep -vE '^[0-9]+\s+blocks?$' # to remove cpio stderr messages - xar -c -f "${1%/*}/${packagename// /}.pkg" --compression none . + # Create the package + (cd "${packagePath}/Temp" && xar -c -f "${packagePath}/../${packageName}.pkg" --compression none .) - popd >/dev/null + # Add the package to the list of build packages + pkgrefs[${#pkgrefs[*]}]="\t#${packageName}.pkg" - outline[$((outlinecount++))]="${indent[$xmlindent]}" - - if [ "${4}" ]; then - local choiceoptions="\t\t${4}" + rm -rf "${packagePath}" fi - choices[$((choicescount++))]="\t\n\t\t#${packagename// /}.pkg\n\t\n" - rm -R -f "${1}" -fi } makedistribution () { - rm -f "${1%/*}/${packagename// /}"*.pkg + distributionDestDir="${1%/*}" + distributionFilename="${packagename// /}-${version}-r${revision}.pkg" + distributionFilePath="${distributionDestDir}/${distributionFilename}" - find "${1}" -type f -name '*.pkg' -depth 1 | while read component + rm -f "${distributionDestDir}/${packagename// /}"*.pkg + + mkdir -p "${1}/${packagename}" + + find "${1}" -type f -name '*.pkg' -depth 1 | while read component do - mkdir -p "${1}/${packagename}/${component##*/}" - pushd "${1}/${packagename}/${component##*/}" >/dev/null - xar -x -f "${1%}/${component##*/}" - popd >/dev/null + pkg="${component##*/}" # ie: EFI.pkg + pkgdir="${1}/${packagename}/${pkg}" + # expand individual packages + pkgutil --expand "${1%}/${pkg}" "$pkgdir" + rm -f "${1%}/${pkg}" + done + +# Create the Distribution file + ditto --noextattr --noqtn "${pkgroot}/Distribution" "${1}/${packagename}/Distribution" + + for (( i=0; i < ${#outline[*]} ; i++)); do + echo -e "${outline[$i]}" >> "${1}/${packagename}/Distribution" done - ditto --noextattr --noqtn "${pkgroot}/Distribution" "${1}/${packagename}/Distribution" - ditto --noextattr --noqtn "${pkgroot}/Resources" "${1}/${packagename}/Resources" + for (( i=0; i < ${#choices[*]} ; i++)); do + echo -e "${choices[$i]}" >> "${1}/${packagename}/Distribution" + done - find "${1}/${packagename}/Resources" -type d -name '.svn' -exec rm -R -f {} \; 2>/dev/null + for (( i=0; i < ${#pkgrefs[*]} ; i++)); do + echo -e "${pkgrefs[$i]}" >> "${1}/${packagename}/Distribution" + done - for (( i=0; i < ${#outline[*]} ; i++)); - do - echo -e "${outline[$i]}" >> "${1}/${packagename}/Distribution" - done + echo -e "\n
" >> "${1}/${packagename}/Distribution" - for (( i=0; i < ${#choices[*]} ; i++)); - do - echo -e "${choices[$i]}" >> "${1}/${packagename}/Distribution" - done +# Create the Resources directory + ditto --noextattr --noqtn "${pkgroot}/Resources" "${1}/${packagename}/Resources" - echo "" >> "${1}/${packagename}/Distribution" +# CleanUp the directory + find "${1}/${packagename}" -type d -name '.svn' -exec rm -rf {} \; 2>/dev/null + find "${1}/${packagename}" -name '.DS_Store' -delete - perl -i -p -e "s/%CHAMELEONVERSION%/${version%%-*}/g" `find "${1}/${packagename}/Resources" -type f` - perl -i -p -e "s/%CHAMELEONREVISION%/${revision}/g" `find "${1}/${packagename}/Resources" -type f` +# Add Chameleon Version and Revision + perl -i -p -e "s/%CHAMELEONVERSION%/${version%%-*}/g" $( find "${1}/${packagename}/Resources" -type f ) + perl -i -p -e "s/%CHAMELEONREVISION%/${revision}/g" $( find "${1}/${packagename}/Resources" -type f ) -# Adding Developer and credits - perl -i -p -e "s/%DEVELOP%/${develop}/g" `find "${1}/${packagename}/Resources" -type f` - perl -i -p -e "s/%CREDITS%/${credits}/g" `find "${1}/${packagename}/Resources" -type f` - perl -i -p -e "s/%PKGDEV%/${pkgdev}/g" `find "${1}/${packagename}/Resources" -type f` +# Add Chameleon Stage + stage=${stage/RC/Release Candidate } + stage=${stage/FINAL/2.0 Final} + perl -i -p -e "s/%CHAMELEONSTAGE%/${stage}/g" $( find "${1}/${packagename}/Resources" -type f ) - stage=${stage/RC/Release Candidate } - stage=${stage/FINAL/2.0 Final} - perl -i -p -e "s/%CHAMELEONSTAGE%/${stage}/g" `find "${1}/${packagename}/Resources" -type f` +# Adding Developer and credits + perl -i -p -e "s/%DEVELOP%/${develop}/g" $( find "${1}/${packagename}/Resources" -type f ) + perl -i -p -e "s/%CREDITS%/${credits}/g" $( find "${1}/${packagename}/Resources" -type f ) + perl -i -p -e "s/%PKGDEV%/${pkgdev}/g" $( find "${1}/${packagename}/Resources" -type f ) - find "${1}/${packagename}" -name '.DS_Store' -delete - pushd "${1}/${packagename}" >/dev/null - xar -c -f "${1%/*}/${packagename// /}-${version}-r${revision}.pkg" --compression none . - popd >/dev/null +# Create the final package + pkgutil --flatten "${1}/${packagename}" "${distributionFilePath}" # Here is the place for assign a Icon to the pkg # command use to generate the file: # ditto -c -k --sequesterRsrc --keepParent Icon.icns Icon.zip # ---- - 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-${version}-r$revision.pkg" - SetFile -a C "${1%/*}/$packagename-${version}-r$revision.pkg" - rm -f tempicns.rsrc - rm -rf "${pkgroot}/Icons/Icons" + ditto -xk "${pkgroot}/Icons/pkg.zip" "${1}/Icons/" + DeRez -only icns "${1}/Icons/Icons/pkg.icns" > "${1}/Icons/tempicns.rsrc" + Rez -append "${1}/Icons/tempicns.rsrc" -o "${distributionFilePath}" + SetFile -a C "${distributionFilePath}" + rm -rf "${1}/Icons" + # End - md5=$( md5 "${1%/*}/${packagename// /}-${version}-r${revision}.pkg" | awk {'print $4'} ) - echo "MD5 (${packagename// /}-${version}-r${revision}.pkg) = ${md5}" > "${1%/*}/${packagename// /}-${version}-r${revision}.pkg.md5" - echo "" + md5=$( md5 "${distributionFilePath}" | awk {'print $4'} ) + echo "MD5 (${distributionFilePath}) = ${md5}" > "${distributionFilePath}.md5" + echo "" - echo -e $COL_GREEN" --------------------------"$COL_RESET - echo -e $COL_GREEN" Building process complete!"$COL_RESET - echo -e $COL_GREEN" --------------------------"$COL_RESET - echo "" - echo -e $COL_GREEN" Build info." - echo -e $COL_GREEN" ===========" - echo -e $COL_BLUE" Package name: "$COL_RESET"$packagename-${version}-r$revision.pkg" - echo -e $COL_BLUE" MD5: "$COL_RESET"$md5" - echo -e $COL_BLUE" Version: "$COL_RESET"$version" - echo -e $COL_BLUE" Stage: "$COL_RESET"$stage" - echo -e $COL_BLUE" Date/Time: "$COL_RESET"$builddate" - echo "" + echo -e $COL_GREEN" --------------------------"$COL_RESET + echo -e $COL_GREEN" Building process complete!"$COL_RESET + echo -e $COL_GREEN" --------------------------"$COL_RESET + echo "" + echo -e $COL_GREEN" Build info." + echo -e $COL_GREEN" ===========" + echo -e $COL_BLUE" Package name: "$COL_RESET"${distributionFilename}" + echo -e $COL_BLUE" MD5: "$COL_RESET"$md5" + echo -e $COL_BLUE" Version: "$COL_RESET"$version" + echo -e $COL_BLUE" Stage: "$COL_RESET"$stage" + echo -e $COL_BLUE" Date/Time: "$COL_RESET"$builddate" + echo "" } main "${1}" "${2}" "${3}" "${4}" #"${5}" - Index: branches/ErmaC/Modules/CREDITS =================================================================== --- branches/ErmaC/Modules/CREDITS (revision 1750) +++ branches/ErmaC/Modules/CREDITS (revision 1751) @@ -11,4 +11,4 @@ Package: --------- -kalyway, AzimutZ, blackosx, ErmaC, scrax +kalyway, AzimutZ, blackosx, ErmaC, scrax, JrCs Index: branches/ErmaC/Modules/Make.rules =================================================================== --- branches/ErmaC/Modules/Make.rules (revision 1750) +++ branches/ErmaC/Modules/Make.rules (revision 1751) @@ -141,13 +141,24 @@ || eval $$failcom; \ done + clean-dep: @if [ -f "$(OBJROOT)/Makedep" ];then echo "\t[RM] $(OBJROOT)/Makedep"; fi @rm -f $(OBJROOT)/Makedep + +FIND_IGNORE := \( -name .git -o -name .svn \) -prune -o -name Cconfig -o + +# clean: remove most generated files clean: clean-recursive clean-dep distclean: distclean-recursive clean-local clean-dep + @find . $(FIND_IGNORE) \ + \( -name '*.orig' -o -name '*.rej' -o -name '*~' \ + -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \ + -o -name '.*.rej' -o -size 0 \ + -o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \ + -type f -print | xargs rm -f clean-local: Index: branches/ErmaC/Modules/CHANGES =================================================================== --- branches/ErmaC/Modules/CHANGES (revision 1750) +++ branches/ErmaC/Modules/CHANGES (revision 1751) @@ -1,3 +1,10 @@ +- Added support for using UUIDs with ext2 filesystems (credits to bitz): http://forge.voodooprojects.org/p/chameleon/issues/208/ +- Added Guerrero's patch on gui.c: http://forge.voodooprojects.org/p/chameleon/issues/178/ +- cparm : Ported the OS detection to the trunk, updated the default theme to v 1.1 (credit to blackosx) +- Added scorpius's patch (to get an unstretched boot screen for nVidia cards on DVI) in boot0.s, + disabled by default: http://forum.voodooprojects.org/index.php/topic,2158.0.html +- Added exFAT volume label support (FAT64) support (credit to dmazar): + http://forum.voodooprojects.org/index.php/topic,2095.0.html - Added AtiPorts option to GraphicsEnabler, so users can override the default number of ports. It proved to be useful when used to limit the number of ports that a framebuffer registers, which seems to be a requirement on laptops that can only use 2 ports at the same time. Index: branches/ErmaC/Modules/Makefile =================================================================== --- branches/ErmaC/Modules/Makefile (revision 1750) +++ branches/ErmaC/Modules/Makefile (revision 1751) @@ -100,10 +100,14 @@ @mv ${DISTFILE}.tar.gz ${DISTFILE}.tgz clean-local: + @if [ -d "$(SYMROOT)/package" ];then echo "\t[RMDIR] $(SYMROOT)/package"; fi @if [ -f "$(HEADER_VERSION)" ];then echo "\t[RM] $(HEADER_VERSION)"; fi @if [ -f "$(SRCROOT)/revision" ];then echo "\t[RM] $(SRCROOT)/revision"; fi - @rm -f $(HEADER_VERSION) $(SRCROOT)/revision + @rm -rf "$(SYMROOT)/package" $(HEADER_VERSION) $(SRCROOT)/revision +AUTOCONF_FILES = $(SRCROOT)/auto.conf $(SRCROOT)/autoconf.h \ + $(SRCROOT)/autoconf.inc $(SRCROOT)/.config $(SRCROOT)/.config.old + distclean-local: @if [ -d "$(OBJROOT)" ];then echo "\t[RMDIR] $(OBJROOT)"; fi @if [ -d "$(SYMROOT)" ];then echo "\t[RMDIR] $(SYMROOT)"; fi @@ -111,29 +115,38 @@ @if [ -d "$(SRCROOT)/i386/modules/module_includes" ];then \ echo "\t[RMDIR] $(SRCROOT)/i386/modules/module_includes"; \ fi - @if [ -f "$(SRCROOT)/auto.conf" ];then echo "\t[RM] $(SRCROOT)/auto.conf"; fi - @if [ -f "$(SRCROOT)/autoconf.h" ];then echo "\t[RM] $(SRCROOT)/autoconf.h"; fi - @if [ -f "$(SRCROOT)/autoconf.inc" ];then echo "\t[RM] $(SRCROOT)/autoconf.inc"; fi - + @for cfg in $(AUTOCONF_FILES); do if [ -f "$${cfg}" ];then echo "\t[RM] $${cfg}"; fi; done @rm -rf $(OBJROOT) $(SYMROOT) $(DSTROOT) \ $(SRCROOT)/i386/modules/module_includes \ - $(SRCROOT)/auto.conf \ - $(SRCROOT)/autoconf.h \ - $(SRCROOT)/autoconf.inc + $(AUTOCONF_FILES) pkg installer: all - ${SRCROOT}/package/buildpkg.sh ${SYMROOT}/package; - @echo "\t[ZIP] ${DISTFILE}.pkg" - @ditto -c -k --sequesterRsrc ${DISTFILE}.pkg ${DISTFILE}.pkg.zip - @rm -r ${DISTFILE}.pkg + ${SRCROOT}/package/buildpkg.sh ${SYMROOT}/package dmg: all ${SRCROOT}/package/slimpkg.sh ${SYMROOT}/package; ${SRCROOT}/package/builddmg.sh ${SYMROOT}/package; +help: + @echo 'Configuration target:' + @echo ' config - Show configuration menu' + @echo + @echo 'Build targets:' + @echo ' all - Build all targets [DEFAULT]' + @echo ' dist - Build distribution tarball' + @echo ' pkg - Build installer package' + @echo + @echo 'Cleaning targets:' + @echo ' clean - Remove most generated files' + @echo ' distclean - Remove all generated files + config' +#@echo +# @echo 'Build options:' +# @echo 'make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build' + .PHONY: config .PHONY: clean .PHONY: image .PHONY: pkg .PHONY: installer .PHONY: dmg +.PHONY: help