Revision: 2685
          http://ipcop.svn.sourceforge.net/ipcop/?rev=2685&view=rev
Author:   gespinasse
Date:     2009-04-09 20:33:53 +0000 (Thu, 09 Apr 2009)

Log Message:
-----------
Replace libparted usage by a script
That's far easier to debug

Probably the script could do more (create filesystem), will see later
Tested with one disk and raid1

Modified Paths:
--------------
    ipcop/trunk/lfs/initramfs
    ipcop/trunk/src/installer/partition.c

Added Paths:
-----------
    ipcop/trunk/src/scripts/disk-partition

Modified: ipcop/trunk/lfs/initramfs
===================================================================
--- ipcop/trunk/lfs/initramfs   2009-04-09 20:27:03 UTC (rev 2684)
+++ ipcop/trunk/lfs/initramfs   2009-04-09 20:33:53 UTC (rev 2685)
@@ -164,9 +164,11 @@
        # Install mke2fs (from e2fsprogs)
        install -c -D /sbin/mke2fs                              
$(INITRAMFS_DIR)/usr/bin/mke2fs
 
-       # Install parted (libparted will be later)
+       # Install parted and disk-partition helper script (libparted will be 
later)
        install -c -D /usr/sbin/{parted,partprobe}              
$(INITRAMFS_DIR)/usr/bin
+       install -c -D /usr/local/bin/disk-partition             
$(INITRAMFS_DIR)/usr/bin
 
+
        # Install some console fonts needed by the installer
        mkdir -p                                                
$(INITRAMFS_DIR)/usr/share/kbd/consolefonts
 
@@ -201,6 +203,10 @@
        # Debugging only, strace sometimes helpful for problem tracking
        #install -c -D /usr/bin/strace                  
$(INITRAMFS_DIR)/usr/bin/strace
 
+       # For debugging only
+       install -c -D /usr/bin/nano                     
$(INITRAMFS_DIR)/usr/bin/nano
+
+
        # Finish up initramfs directory
        install --owner=root --group=root $(DIR_SRC)/config/install/* 
$(INITRAMFS_DIR)/etc/
        mv $(INITRAMFS_DIR)/etc/init                            
$(INITRAMFS_DIR)/

Modified: ipcop/trunk/src/installer/partition.c
===================================================================
--- ipcop/trunk/src/installer/partition.c       2009-04-09 20:27:03 UTC (rev 
2684)
+++ ipcop/trunk/src/installer/partition.c       2009-04-09 20:33:53 UTC (rev 
2685)
@@ -71,7 +71,8 @@
     and avoids passing pointers to pointers, addresses of pointers, etc. 
between functions.
 */
 static int raid;
-static int numpartitions = 0;
+static char arch[STRING_SIZE];                                  // alpha, 
powerpc, sparc, x86
+static char install_type[STRING_SIZE];                           // onedisk, 
raid, flash
 static char partition_label[NR_PARTITIONS][STRING_SIZE];        // add 1 
string for terminator mark
 static char partition_mount[NR_PARTITIONS][STRING_SIZE];        // mountpoints 
for partitions
 static char partition_uuidenc[NR_PARTITIONS][STRING_SIZE];      // UUIDs
@@ -82,89 +83,6 @@
                                             // [1] is /var/log partition 
number, 0 translates to hda1
                                             // this may seem complicated but 
helps for differences in architectures
 
-static PedDevice *ped_dev;
-static PedDisk *ped_disk;
-static PedPartition *ped_part;
-static PedConstraint *ped_constraint;
-
-
-/*  Since we do this only slightly different for every architecture,
-    bundle it in 1 function.
-    Parameter is partition table labeltype, can be something like bsd, mac, 
msdos, sun.
-    Returns SUCCESS if OK.
-*/
-static int my_partition_table(const char *disk_type)
-{
-    if ((ped_disk = ped_disk_new_fresh(ped_dev, ped_disk_type_get(disk_type))) 
== NULL) {
-        fprintf(flog, "Error in ped_disk_new_fresh\n");
-        return FAILURE;
-    }
-    if (!ped_disk_commit_to_dev(ped_disk)) {
-        fprintf(flog, "Error in ped_disk_commit disktype\n");
-        return FAILURE;
-    }
-
-    fprintf(flog, "Table of type %s created\n", disk_type);
-    return SUCCESS;
-}
-
-
-/*  Create an additional partition, label it and flag as bootable if wanted.
-    Parameters: start sector and length, filesystemtype (ext2, hfs), label and 
boot flag.
-    Returns SUCCESS if OK.
-*/
-static int my_partition_create(PedSector start, PedSector length, const char 
*fstype, const char *label, int boot)
-{
-    PedFileSystemType *ped_fstype;
-
-    if ((ped_fstype = ped_file_system_type_get(fstype)) == NULL) {
-        fprintf(flog, "Error in ped_file_system_type_get (%s)\n", fstype);
-        return FAILURE;
-    }
-
-    if ((ped_part = ped_partition_new(ped_disk, PED_PARTITION_NORMAL, 
ped_fstype, start, length)) == NULL) {
-        fprintf(flog, "Error in ped_partition_new (%s)\n", fstype);
-        return FAILURE;
-    }
-
-    /* If labels are supported, make it so */
-    if (ped_disk_type_check_feature(ped_disk->type, 
PED_DISK_TYPE_PARTITION_NAME)) {
-        ped_partition_set_name(ped_part, label);
-    }
-    /* Set the boot flag */
-    if (boot) {
-        if (ped_partition_set_flag(ped_part, PED_PARTITION_BOOT, 1) == 0) {
-            fprintf(flog, "Error in ped_partition_set_flag boot (%s)\n", 
label);
-            return FAILURE;
-        }
-    }
-    if (raid) {
-        if (ped_partition_set_flag(ped_part, PED_PARTITION_RAID, 1) == 0) {
-            fprintf(flog, "Error in ped_partition_set_flag raid (%s)\n", 
label);
-            return FAILURE;
-        }
-    }
-
-    if ((ped_constraint = ped_constraint_new_from_max(&ped_part->geom)) == 
NULL) {
-        fprintf(flog, "Error in ped_constraint_new_from_max (%s)\n", label);
-        return FAILURE;
-    }
-
-    if (ped_disk_add_partition(ped_disk, ped_part, ped_constraint) == 0) {
-        fprintf(flog, "Error in ped_disk_add_partition (%s)\n", label);
-        return FAILURE;
-    }
-
-    if (!ped_disk_commit_to_dev(ped_disk)) {
-        fprintf(flog, "Error in ped_disk_commit (%s)\n", label);
-        return FAILURE;
-    }
-    fprintf(flog, "Partition added %s (%s)\n", label, fstype);
-
-    return SUCCESS;
-}
-
-
 /*  Calculate for the user a useable disk schema partition
     and make it so.
 */
@@ -173,13 +91,10 @@
     int i;
     int retcode = FAILURE;
     long int root_partition, log_partition;
-    long int start_partition, current_free;
+    long int current_free;
     char command[STRING_SIZE];
     char device[STRING_SIZE];
     char device2[STRING_SIZE];
-    PedSector pedsector_start;
-    PedSector pedsector_root;
-    PedSector pedsector_log;
 
     snprintf(device, STRING_SIZE, "/dev/%s", dev);
     snprintf(device2, STRING_SIZE, "/dev/%s", dev2);
@@ -194,8 +109,14 @@
         *swap_file = 0;
         log_partition = LOGCOMPRESSED;
         root_partition = disk_size - log_partition;
+        strcpy(install_type,"flash");
     }
     else {
+        if (raid) {
+            strcpy(install_type,"raid");
+        } else {
+            strcpy(install_type,"onedisk");
+        }
         /* set the minimum size(s) */
         root_partition = ROOT_MINIMUM;
 
@@ -238,8 +159,6 @@
     /* recalc log */
     log_partition = disk_size - root_partition;
 
-    start_partition = 1;        /* in MB */
-
     /* 
        We now have auto-partition data (in MB)
        start:                    end:
@@ -256,18 +175,22 @@
 
     /* define all label and mountpoints for the architectures we support */
 #if defined(__i386__) || defined(__x86_64__)
+    strcpy(arch, "x86");
     partition_index[PART_INDEX_ROOT] = 0;
     partition_index[PART_INDEX_VARLOG] = 1;
 #endif
 #if defined(__powerpc__) || defined(__powerpc64__)
+    strcpy(arch, "powerpc");
     partition_index[PART_INDEX_ROOT] = 2;
     partition_index[PART_INDEX_VARLOG] = 3;
 #endif
 #if defined(__sparc__) || defined(__sparc64__)
+    strcpy(arch, "sparc");
     partition_index[PART_INDEX_ROOT] = 0;
     partition_index[PART_INDEX_VARLOG] = 1;
 #endif
 #if defined(__alpha__)
+    strcpy(arch, "alpha");
     partition_index[PART_INDEX_ROOT] = 0;
     partition_index[PART_INDEX_VARLOG] = 1;
 #endif
@@ -277,7 +200,7 @@
 
     if (partition_index[PART_INDEX_ROOT] == -1) {
         /* Can't be, probably because of non-supported arch. */
-        fprintf(flog, "Partition# for / is 0, non-supported arch?\n");
+        fprintf(flog, "Partition# for / is not set, non-supported arch?\n");
         goto PARTITION_EXIT;
     }
     if (partition_index[PART_INDEX_VARLOG] == -1) {
@@ -298,47 +221,7 @@
 
     if (parted && (access("/usr/bin/parted", 0) == 0)) {
         /* OK, user thinks he's smart enough to do by himself */
-        FILE *f;
 
-        f = fopen("/tmp/parthelp", "w");
-
-        fprintf(f, "#Selected device is %s\n", device);
-        fprintf(f, "#suggested partitioning:\n");
-        fprintf(f, "/bin/dd if=/dev/zero of=%s bs=512 count=1\n", device);
-
-#if defined(__i386__) || defined(__x86_64__)
-        fprintf(f, "/usr/bin/parted -s %s mklabel msdos\n", device);
-        fprintf(f, "/usr/bin/parted -s %s mkpart primary ext2 %ld %ld\n", 
device, start_partition, root_partition);
-        fprintf(f, "/usr/bin/parted -s %s mkpart primary ext2 %ld %ld\n", 
device, root_partition, disk_size);
-        fprintf(f, "/usr/bin/parted -s %s set 1 boot on\n", device);
-#endif
-#if defined(__powerpc__) || defined(__powerpc64__)
-        fprintf(f, "/usr/bin/parted -s %s mklabel mac\n", device);
-        fprintf(f, "/usr/bin/parted -s %s mkpart primary hfs 33k %ld\n", 
device, start_partition);
-        fprintf(f, "/usr/bin/parted -s %s name 2 bootstrap\n", device);
-        fprintf(f, "/usr/bin/parted -s %s set 2 boot on\n", device);
-        fprintf(f, "/usr/bin/parted -s %s mkpart primary ext2 %ld %ld\n", 
device, start_partition, root_partition);
-        fprintf(f, "/usr/bin/parted -s %s name 3 %s\n", device, "root");
-        fprintf(f, "/usr/bin/parted -s %s mkpart primary ext2 %ld %ld\n", 
device, root_partition, disk_size);
-        fprintf(f, "/usr/bin/parted -s %s name 4 %s\n", device, 
partition_label[partition_index[PART_INDEX_VARLOG]]);
-#endif
-#if defined(__sparc__) || defined(__sparc64__)
-        fprintf(f, "/usr/bin/parted -s %s mklabel sun\n", device);
-        fprintf(f, "/usr/bin/parted -s %s mkpart primary ext2 %ld %ld\n", 
device, start_partition, root_partition);
-        fprintf(f, "/usr/bin/parted -s %s set 1 boot on\n", device);
-        fprintf(f, "/usr/bin/parted -s %s mkpart primary ext2 %ld %ld\n", 
device, root_partition, disk_size);
-#endif
-#if defined(__alpha__)
-        fprintf(f, "/usr/bin/parted -s %s mklabel bsd\n", device);
-        fprintf(f, "/usr/bin/parted -s %s mkpart primary ext2 %ld %ld\n", 
device, start_partition, root_partition);
-        fprintf(f, "/usr/bin/parted -s %s mkpart primary ext2 %ld %ld\n", 
device, root_partition, disk_size);
-        fprintf(f, "/usr/bin/parted -s %s set 1 boot on\n", device);
-#endif
-
-        fclose(f);
-
-        mysystem("/bin/chmod 755 /tmp/parthelp");
-
         newtWinMessage(ipcop_gettext("TR_TITLE_DISK"), ipcop_gettext("TR_OK"), 
"Do your thing with parted now!");
         return SUCCESS;
     }
@@ -348,188 +231,29 @@
     }
 
     statuswindow(72, 5, ipcop_gettext("TR_TITLE_DISK"), 
ipcop_gettext("TR_MAKING_PARTITIONS"));
-
-    /* OWES: ped_device_get fails after this on some CF card/adapter.
-        Using nodma install parameter helps. */
-    snprintf(command, STRING_SIZE, "/bin/dd if=/dev/zero of=%s bs=512 
count=1", device);
-    mysystem(command);
-    mysystem("/bin/sync");
-    sleep(1);
-
-    ped_dev = ped_device_get(device);
-    if (!ped_dev) {
-        fprintf(flog, "error in ped_device_get\n");
-        goto PARTITION_EXIT;
+        /* disk-partition parameters
+         #1 arch (alpha, powerpc, sparc, x86)
+         #2 dev name (without /dev)
+         #3 size of root partition (in MiB)
+         #4 disk size (in MiB) as seen by parted <device> unit MiB print
+         #5 install type (onedisk , raid , flash) */
+    snprintf(command, STRING_SIZE, "/usr/bin/disk-partition %s %s %ld %ld %s",
+             arch, dev, root_partition, disk_size, install_type);
+    if (mysystem(command)) {
+        fprintf(flog, "error partitioning %s\n", device);
+        return FAILURE;
     }
-
-    fprintf(flog, "FYI ped_dev sector_size is %lld\n", ped_dev->sector_size);
-
-    /* convert MByte to PedSector */
-    pedsector_start = ((PedSector) 1 * 1024 * 1024 / ped_dev->sector_size);
-    pedsector_root = ((PedSector) root_partition * 1024 * 1024 / 
ped_dev->sector_size);
-    pedsector_log = ((PedSector) log_partition * 1024 * 1024 / 
ped_dev->sector_size);
-
-#if defined(__i386__) || defined(__x86_64__)
-    /* create a new partition table */
-    if (my_partition_table("msdos") != SUCCESS)
-        goto PARTITION_EXIT;
-
-    /* / partition */
-    if (my_partition_create(1, pedsector_root, "ext2", "root", 1) != SUCCESS)
-        goto PARTITION_EXIT;
-
-    /* /var/log partition */
-    if (my_partition_create(ped_part->geom.end + 1, ped_part->geom.end + 1 + 
pedsector_log, "ext2", 
-            partition_label[partition_index[PART_INDEX_VARLOG]], 0) != SUCCESS)
-        goto PARTITION_EXIT;
-
     if (!raid) {
         goto PARTITION_NORAID;
     }
-    /* finalize disk 1 */
-    ped_disk_commit(ped_disk);
-    ped_disk_destroy(ped_disk);
-    sleep(1);
-    mysystem("/bin/sync");
-
-    /* second disk */
-    ped_dev = ped_device_get(device2);
-    if (!ped_dev) {
-        fprintf(flog, "error in ped_device_get\n");
-        goto PARTITION_EXIT;
+    snprintf(command, STRING_SIZE, "/usr/bin/disk-partition %s %s %ld %ld %s",
+             arch, dev2, root_partition, disk_size, install_type);
+    if (mysystem(command)) {
+        fprintf(flog, "error partitioning %s\n", device2);
+        return FAILURE;
     }
 
-    /* create a new partition table */
-    if (my_partition_table("msdos") != SUCCESS)
-        goto PARTITION_EXIT;
-
-    /* / partition */
-    if (my_partition_create(1, pedsector_root, "ext2", "root", 1) != SUCCESS)
-        goto PARTITION_EXIT;
-
-    /* /var/log partition */
-    if (my_partition_create(ped_part->geom.end + 1, ped_part->geom.end + 1 + 
pedsector_log, "ext2", 
-            partition_label[partition_index[PART_INDEX_VARLOG]], 0) != SUCCESS)
-        goto PARTITION_EXIT;
-
-#endif /* End of i386/x86_64 partitioning block */
-
-#if defined(__powerpc__) || defined(__powerpc64__)
-    /* create a new partition table */
-    if (my_partition_table("mac") != SUCCESS)
-        goto PARTITION_EXIT;
-
-    /* hfs bootstrap partition */
-    if (my_partition_create(1, pedsector_start, "hfs", "bootstrap", 1) != 
SUCCESS)
-        goto PARTITION_EXIT;
-
-    /* / partition */
-    if (my_partition_create(ped_part->geom.end + 1, ped_part->geom.end + 1 + 
pedsector_root, "ext2", "root", 0) != SUCCESS)
-        goto PARTITION_EXIT;
-
-    /* /var/log partition */
-    if (my_partition_create(ped_part->geom.end + 1, ped_part->geom.end + 1 + 
pedsector_log, "ext2", 
-            partition_label[partition_index[PART_INDEX_VARLOG]], 0) != SUCCESS)
-        goto PARTITION_EXIT;
-
-    if (!raid) {
-        goto PARTITION_NORAID;
-    }
-    /* finalize disk 1 */
-    ped_disk_commit(ped_disk);
-    ped_disk_destroy(ped_disk);
-    sleep(1);
-    mysystem("/bin/sync");
-
-    /* second disk */
-    ped_dev = ped_device_get(device2);
-    if (!ped_dev) {
-        fprintf(flog, "error in ped_device_get\n");
-        goto PARTITION_EXIT;
-    }
-
-    /* create a new partition table */
-    if (my_partition_table("mac") != SUCCESS)
-        goto PARTITION_EXIT;
-
-    /* hfs bootstrap partition */
-    if (my_partition_create(1, pedsector_start, "hfs", "bootstrap", 1) != 
SUCCESS)
-        goto PARTITION_EXIT;
-
-    /* / partition */
-    if (my_partition_create(ped_part->geom.end + 1, ped_part->geom.end + 1 + 
pedsector_root, "ext2", "root", 0) != SUCCESS)
-        goto PARTITION_EXIT;
-
-    /* /var/log partition */
-    if (my_partition_create(ped_part->geom.end + 1, ped_part->geom.end + 1 + 
pedsector_log, "ext2", 
-            partition_label[partition_index[PART_INDEX_VARLOG]], 0) != SUCCESS)
-        goto PARTITION_EXIT;
-
-#endif /* End of ppc/ppc64 partitioning block */
-
-#if defined(__sparc__) || defined(__sparc64__)
-    /* create a new partition table */
-    if (my_partition_table("sun") != SUCCESS)
-        goto PARTITION_EXIT;
-
-    /* / partition */
-    if (my_partition_create(0, pedsector_root, "ext2", "root", 1) != SUCCESS)
-        goto PARTITION_EXIT;
-
-    /* /var/log partition */
-    if (my_partition_create(ped_part->geom.end + 1, ped_part->geom.end + 1 + 
pedsector_log, "ext2", 
-            partition_label[partition_index[PART_INDEX_VARLOG]], 0) != SUCCESS)
-        goto PARTITION_EXIT;
-
-    if (!raid) {
-        goto PARTITION_NORAID;
-    }
-    /* finalize disk 1 */
-    ped_disk_commit(ped_disk);
-    ped_disk_destroy(ped_disk);
-    sleep(1);
-    mysystem("/bin/sync");
-
-    /* second disk */
-    ped_dev = ped_device_get(device2);
-    if (!ped_dev) {
-        fprintf(flog, "error in ped_device_get\n");
-        goto PARTITION_EXIT;
-    }
-
-    /* create a new partition table */
-    if (my_partition_table("sun") != SUCCESS)
-        goto PARTITION_EXIT;
-
-    /* / partition */
-    if (my_partition_create(0, pedsector_root, "ext2", "root", 1) != SUCCESS)
-        goto PARTITION_EXIT;
-
-    /* /var/log partition */
-    if (my_partition_create(ped_part->geom.end + 1, ped_part->geom.end + 1 + 
pedsector_log, "ext2", 
-            partition_label[partition_index[PART_INDEX_VARLOG]], 0) != SUCCESS)
-        goto PARTITION_EXIT;
-
-#endif /* End of sparc/sparc64 partitioning block */
-
-#if defined(__alpha__)
-    /* create a new partition table */
-    if (my_partition_table("bsd") != SUCCESS)
-        goto PARTITION_EXIT;
-
-    /* /  partition */
-    if (my_partition_create(1, pedsector_root, "ext2", "root", 1) != SUCCESS)
-        goto PARTITION_EXIT;
-
-    /* /var/log partition */
-    if (my_partition_create(ped_part->geom.end + 1, ped_part->geom.end + 1 + 
pedsector_log, "ext2", 
-            partition_label[partition_index[PART_INDEX_VARLOG]], 0) != SUCCESS)
-        goto PARTITION_EXIT;
-#endif /* End of alpha partitioning block */
-
   PARTITION_NORAID:
-    ped_disk_commit(ped_disk);
-    ped_disk_destroy(ped_disk);
     retcode = SUCCESS;
 
   PARTITION_EXIT:
@@ -539,20 +263,7 @@
     else {
         fprintf(flog, "Make partitions done ...\n");
     }
-    sleep(1);
-    mysystem("/bin/sync");
 
-#if defined(__sparc__) || defined(__sparc64__)
-    /* rmmod/modprobe hack to make hd?3/sd?3 appear */
-    if (mysystem("/sbin/rmmod ide-disk") == 0) {
-        mysystem("/sbin/modprobe ide-disk");
-    }
-    if (mysystem("/sbin/rmmod sd_mod") == 0) {
-        mysystem("/sbin/modprobe sd_mod");
-    }
-    sleep(1);
-#endif
-
     if ((retcode == SUCCESS) && raid) {
         newtComponent *f;
         newtComponent scale;
@@ -655,7 +366,7 @@
                 /* FIXME: cannot be, can it? */
                 break;
             }
-            return FAILURE;                        
+            return FAILURE;
         }
 
 #ifdef USE_UUID

Added: ipcop/trunk/src/scripts/disk-partition
===================================================================
--- ipcop/trunk/src/scripts/disk-partition                              (rev 0)
+++ ipcop/trunk/src/scripts/disk-partition      2009-04-09 20:33:53 UTC (rev 
2685)
@@ -0,0 +1,133 @@
+#!/bin/sh
+
+# something too easy to run would not be good on installed machine
+# to be simplier, we do not count partitions size before '/ partition' that 
are present on some arch
+# /var/log partition size is what remain from disk size after '/ partition'
+# parameters list
+if [ $# -ne 5 ]; then
+       echo "bad parameters number"
+       echo "#1 arch (alpha, powerpc, sparc, x86)"
+       echo "#2 device name (without /dev/)"
+       echo "#3 size of root partition (in MiB)"
+       echo "#4 disk size (in MiB) as seen by parted <device> unit MiB print"
+       echo "#5 install type (onedisk , raid , flash)"
+       exit 1
+fi
+
+arch=$1
+dev="/dev/$2"
+root_size=$3
+disk_size=$4
+install_type=$5
+
+erase_partition()
+{
+       # OWES: ped_device_get fails after this on some CF card/adapter.
+       # Using nodma install parameter helps. */
+       if ( ! /bin/dd if=/dev/zero of=$dev bs=512 count=1 ); then
+               echo "Fail: erase partition table, maybe dma issue"
+               exit 1
+       else
+               echo "Done: partition table erased"
+       fi
+}
+
+parted_call()
+{
+       if ( ! /usr/bin/parted -s $1 ); then
+               echo "Fail: parted $1"
+               exit 1
+       else
+               echo "Done: parted $1"
+       fi
+
+}
+
+case "$install_type" in
+  onedisk | raid )
+       varlog_name="varlog"
+       ;;
+  flash)
+       varlog_name="varlog_comp"
+       ;;
+  *)
+       echo "Unsupported install_type:$install_type"
+       exit 1
+       ;;
+esac
+
+# check for device
+if ( ! /usr/bin/partprobe $dev 2>&1 1>/dev/null ); then
+       echo "device:$dev not found"
+       exit 1
+fi
+
+# Create partitions
+# generally sector 0 contain the partition table,
+# so first partition start at sector 1
+# sparc is different
+case "$arch" in
+  x86)
+       erase_partition
+       parted_call "$dev mklabel msdos"
+       parted_call "$dev mkpart primary ext2 1s ${root_size}MiB"
+       parted_call "$dev mkpart primary ext2 ${root_size}MiB ${disk_size}MiB"
+       parted_call "$dev set 1 boot on"
+       if [ x$install_type = x"raid" ]; then
+               parted_call "$dev set 1 raid"
+               parted_call "$dev set 2 raid"
+       fi
+       ;;
+  alpha)
+       erase_partition
+       parted_call "$dev mklabel bsd"
+       # aboot need 70k or 150sectors * 512B at disk start
+       parted_call "$dev mkpart primary ext2 150s ${root_size}MiB"
+       parted_call "$dev mkpart primary ext2 ${root_size}MiB ${disk_size}MiB"
+       parted_call "$dev set 1 boot on"
+       if [ x$install_type = x"raid" ]; then
+               parted_call "$dev set 1 raid"
+               parted_call "$dev set 2 raid"
+       fi
+       ;;
+  powerpc)
+       erase_partition
+       # mac label create a first partition from sector 1 to 63
+       parted_call "$dev mklabel mac"
+       # so second partition start at sector 64 and contain boot code
+       # (don't know if it could be smaller than 1MiB)
+       parted_call "$dev mkpart primary hfs 64s 1MiB"
+       parted_call "$dev name 2 bootstrap"
+       parted_call "$dev set 2 boot on"
+       parted_call "$dev mkpart primary ext2 1MiB ${root_size}MiB"
+       parted_call "$dev name 3 root"
+       parted_call "$dev mkpart primary ext2 ${root_size}MiB ${disk_size}MiB"
+       parted_call "$dev name 4 $varlog_name"
+       if [ x$install_type = x"raid" ]; then
+               parted_call "$dev set 3 raid"
+               parted_call "$dev set 4 raid"
+       fi
+       ;;
+  sparc)
+       erase_partition
+       parted_call "$dev mklabel sun"
+       # '/ partition' need to be on the first partition and start at sector 0
+       parted_call "$dev mkpart primary ext2 0 ${root_size}MiB"
+       parted_call "$dev mkpart primary ext2 ${root_size}MiB ${disk_size}MiB"
+       parted_call "$dev set 1 boot on"
+       if [ x$install_type = x"raid" ]; then
+               parted_call "$dev set 1 raid"
+               parted_call "$dev set 2 raid"
+       fi
+       ;;
+  *)
+       echo "Unsupported arch:$arch"
+       exit 1
+       ;;
+esac
+
+/bin/sync
+/usr/bin/partprobe $dev
+# still look needed
+# or I curiously had an error during file system creation
+sleep 1


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
Ipcop-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ipcop-svn

Reply via email to