diff -ur 20010604/distrib/utils/sysinst/arch/macppc/md.c src/distrib/utils/sysinst/arch/macppc/md.c --- 20010604/distrib/utils/sysinst/arch/macppc/md.c Sun Jan 14 20:22:26 2001 +++ src/distrib/utils/sysinst/arch/macppc/md.c Thu Jun 28 14:09:47 2001 @@ -61,6 +61,7 @@ #define PART_RAW C #define PART_USR G +extern int hfs_exist (const char *); int md_get_info() { @@ -138,11 +139,23 @@ { const char *bootfile = target_expand("/boot"); /*XXX*/ + if (! hfs_exist(diskdev)) { + printf ("Proceeding for installboot.\n"); +process_menu(MENU_noyes); + if (!yesno) { msg_display(MSG_abort); + process_menu(MENU_ok); + return 0;} + printf (msg_string(MSG_dobootblks), diskdev); cp_to_target("/usr/mdec/ofwboot", "/boot"); sync(); run_prog(RUN_DISPLAY, NULL, "/usr/mdec/installboot %s %s /dev/r%sa", bootfile, "/usr/mdec/bootxx", diskdev); + } + else { + printf (msg_string(MSG_applelabelexists), diskdev); + printf ("\nLabel looks like Apples one. Will not run installboot. OK?\n"); +process_menu(MENU_noyes);} return 0; } @@ -163,6 +176,7 @@ char isize[20]; int maxpart = getmaxpartitions(); + struct disklabel disklabel; /* * Initialize global variables that track space used on this disk. * Standard 4.3BSD 8-partition labels always cover whole disk. @@ -318,7 +332,24 @@ remain = fsdsize - partstart; part++; } + case 4: /* Use Existing */ + if (get_real_geom(diskdev,&disklabel ) == 0) { + msg_display(MSG_abort); /* XXX more informative */ + } + for (i = 0; i < maxpart; i++) { +#define p disklabel.d_partitions[i] + bsdlabel[i].pi_size = p.p_size; + bsdlabel[i].pi_offset = p.p_offset; + if (i != RAW_PART) { + bsdlabel[i].pi_fstype = p.p_fstype; + bsdlabel[i].pi_bsize = p.p_fsize * p.p_frag; + bsdlabel[i].pi_fsize = p.p_fsize; + /* menu to get fsmount[] entry */ +#undef p + } else + bsdlabel[i].pi_fstype = FS_UNUSED; + } break; } @@ -391,4 +422,28 @@ toggle_getit (11); toggle_getit (12); toggle_getit (13); +} +/* added for macppc only*/ +int +hfs_exist(dev) + const char *dev; +{ + /* partinfo parts[16]; */ + int i, maxpart; + int hfs = 0; + /* + if (pp == NULL) { + emptylabel(parts); + if (incorelabel(dev, parts) < 0) + return -1; + } + */ + maxpart = getmaxpartitions(); + printf(" ** maxpart(%d)\n",maxpart); + for (i = 0; i < maxpart; i++) { + if (bsdlabel[i].pi_fstype == FS_HFS) { + hfs++; + } + } + return hfs; } diff -ur 20010604/distrib/utils/sysinst/arch/macppc/menus.md.en src/distrib/utils/sysinst/arch/macppc/menus.md.en --- 20010604/distrib/utils/sysinst/arch/macppc/menus.md.en Sat Jan 13 02:24:04 2001 +++ src/distrib/utils/sysinst/arch/macppc/menus.md.en Sun Jun 24 06:06:01 2001 @@ -53,6 +53,14 @@ option "Change f", action { editpart = F;}, sub menu edfspart; option "Change g", action { editpart = G;}, sub menu edfspart; option "Change h", action { editpart = H;}, sub menu edfspart; + option "Change i", action { editpart = I;}, sub menu edfspart; + option "Change j", action { editpart = J;}, sub menu edfspart; + option "Change k", action { editpart = K;}, sub menu edfspart; + option "Change l", action { editpart = L;}, sub menu edfspart; + option "Change m", action { editpart = M;}, sub menu edfspart; + option "Change n", action { editpart = N;}, sub menu edfspart; + option "Change o", action { editpart = O;}, sub menu edfspart; + option "Change p", action { editpart = P;}, sub menu edfspart; option "Set new allocation size", action { reask_sizemult(dlcylsize); }; menu md_distcustom, x=26, y=5, exit, title "Selection toggles inclusion"; diff -ur 20010604/distrib/utils/sysinst/arch/macppc/msg.md.en src/distrib/utils/sysinst/arch/macppc/msg.md.en --- 20010604/distrib/utils/sysinst/arch/macppc/msg.md.en Sat Jan 13 02:24:04 2001 +++ src/distrib/utils/sysinst/arch/macppc/msg.md.en Thu Jun 28 14:19:47 2001 @@ -80,3 +80,7 @@ message askfspart {The next partition is /dev/%s%c. You have %d %s left on your disk. Partition size? } + +message applelabelexists +{The Apple type partition label found on %s. Install boot will not be +done. ok? } diff -ur 20010604/distrib/utils/sysinst/defs.h src/distrib/utils/sysinst/defs.h --- 20010604/distrib/utils/sysinst/defs.h Thu Jun 28 13:59:55 2001 +++ src/distrib/utils/sysinst/defs.h Thu Jun 28 14:11:44 2001 @@ -278,7 +278,9 @@ void md_init (void); void md_set_sizemultname (void); void md_set_no_x (void); - +#ifdef macppc +int hfs_exist(const char *); +#endif /* from main.c */ void toplevel (void); diff -ur 20010604/distrib/utils/sysinst/disks.c src/distrib/utils/sysinst/disks.c --- 20010604/distrib/utils/sysinst/disks.c Mon Jan 15 20:37:20 2001 +++ src/distrib/utils/sysinst/disks.c Thu Jun 28 14:12:30 2001 @@ -235,12 +235,34 @@ write_disklabel (void) { +#ifndef macppc #ifdef DISKLABEL_CMD /* disklabel the disk */ return run_prog(RUN_DISPLAY, MSG_cmdfail, "%s %s %s", DISKLABEL_CMD, diskdev, bsddiskname); #endif return 0; +#else +/* +For macppc only, check if HFS partition exists and if found, +not to write disk label +*/ +if ( hfs_exist(diskdev)) { + printf("HFS partition exists,\nskip writing disklabel\n"); + sleep (2); + return 0; + } + else { + printf ("HFS partition DOES NOT exist, writing disklabel\n"); + sleep (2); +#ifdef DISKLABEL_CMD + /* disklabel the disk */ + return run_prog(RUN_DISPLAY, MSG_cmdfail, + "%s %s %s", DISKLABEL_CMD, diskdev, bsddiskname); +#endif + return 0; + } +#endif } int @@ -280,6 +302,9 @@ "/sbin/newfs" : "/sbin/newfs_lfs", partname); else error = 0; +#ifdef macppc + if ( hfs_exist(diskdev)) error = 0; /* XXX MacOS special */ +#endif if (*mountpoint && error == 0) { snprintf(devname, STRSIZE, "/dev/%s", partname); if (partno > 0) /* XXX strcmp(mountpoint, "/") ? XXX */