Christian Abels wrote:

>
> I have been looking in to changing the 'Documents and Settings' folder
> to be stored at a second partition(D:\Documents and Settings)
>
> But I have a problem...
> Does anyone know how I can format this second partition before the
> installation tries to create the folder on my second partition which
> havent been formated at this point? 


I use

[GuiUnattended]
    ProfilesDir = "D:\Dokumente und Einstellungen"
    ...

and the following vars in the unattended.txt [_meta] section
(can be overwritten by unattended.csv / mysql db entries):

bottom=ntfs_d.bat
fdisk_confirm=1
replace_mbr=1

partition_cmds="parted /dev/dsk mklabel msdos;parted /dev/dsk mkpart
primary fat32 0 4000;parted -- /dev/dsk mkpart extended 10000 -0;parted
-- /dev/dsk mkpart logical fat32 10000 -0;sleep 2;parted /dev/dsk set 1
boot on;make-blkdev-nodes hda;mkfs.vfat /dev/dsk1 -F 32;mkfs.vfat
/dev/dsk5 -F 32"

partition_cmds_sys="parted /dev/dsk rm 1; parted /dev/dsk mkpart primary
fat32 0 4000; parted /dev/dsk set 1 boot on;make-blkdev-nodes
hda;mkfs.vfat /dev/dsk1 -F 32;"


In config.pl I have:

---------------------------------------------------------------------------------
use warnings;
use strict;

if ($ENV{'Z_PATH'} !~/^dvd$/)
{
 # Set db for mysql interface
 require "conf-mysql.pl";
 CONFIG->setup('DBI:mysql:database=unattended;host=ip_of_mysql_db_host',
'username', 'password');
}
else
{
 # Setup db for CSV interface
 require "conf-csv.pl";
 CONFIG->setup(dos_to_host('z:\\site\\unattend.csv'), '', '');
}
# Lookup property value using all possible owners
sub lookup_property ($) {
    my ($property) = @_;
    defined $property
        or return undef;
    foreach my $lookup ($u->{'_meta'}->{'macaddr'},
                        $u->{'UserData'}->{'ComputerName'},
                        $u->{'UserData'}->{'FullName'},
                        $u->{'UserData'}->{'OrgName'},
                        'Default') {
        my $value = CONFIG->lookup_value($lookup, $property);
        defined $value
            and return $value;
    }
    return undef;
}

sub my_partition_cmds {
      chdir ("/usr/sbin");
      symlink "/z/linuxaux/usr/sbin/mkfs.vfat", "mkfs.vfat";
      chdir ("/");

      my $partition_cmds = $u->{'_meta'}->{'partition_cmds'};
    defined $partition_cmds
        or $partition_cmds = $u->{'_meta'}->{'partition_cmds_sys'}
        or return undef ;

  while (1) {
    ($u->{'_meta'}->{'fdisk_confirm'})
        or last;

        print "\n";
        print "About to PARTITION the WHOLE FIRST HARD DRIVE!\n\n";
        print "WARNING: This operation ERASES the disk!\n";
        print "If unsure, say no, and ONLY C: will be DELETED.\n";
        print "If you won't neither, press CTRL-ALT-DEL!\n\n";
        print "Sie sind dabei, die ERSTE FESTPLATTE zu PARTITIONIEREN!\n\n";
        print "ACHTUNG: Diese Operation LOESCHT die FESTPLATTE!\n";
        print "Wenn unsicher: no eingeben, dann wird NUR C: GELOESCHT!\n\n";
        print "Wenn nichts geaendert werden soll: CTRL-ALT-DEL DRUECKEN!\n";
        yes_no_choice ("Are you sure")
            and last;

        $partition_cmds = '';
        $partition_cmds = $u->{'_meta'}->{'partition_cmds_sys'};
            defined $partition_cmds
                or return undef;
        last;
      }
      foreach my $cmd (split /;/, $partition_cmds) {
        print "Executing command to partition: $cmd...\n";
        system ("$cmd");
  }
};

$u->{'_meta'}->{'fdisk_cmds'} = \&my_partition_cmds;

# here follows some other code for the other properties from database
# e.g. lookup_property('JoinDomain') etc.
# ....
#
#
# Make this file evaluate to "true".
1;
--------------------------------------------------------------------------------------------

If you use the linuxboot.iso from 4.7pre (see former post in this list)
a newer, better working
parted is included, so the partition_cmds can be used without the
"mkfs.vfat", e.g.

partition_cmds="parted /dev/dsk mklabel msdos;parted /dev/dsk mkpartfs
primary fat32 0 4000;parted -- /dev/dsk mkpart extended 20000 -0;parted
-- /dev/dsk mkpartfs logical fat32 20000 -0;sleep 2;parted /dev/dsk set
1 boot on;

partition_cmds_sys="parted /dev/dsk rm 1; parted /dev/dsk mkpartfs
primary fat32 0 4000; parted /dev/dsk set 1 boot on;"

These vars mean:

partition_cmds_sys   ... commands to partition/format only C: 
                                        (D: with user profiles and data
stays as it is)
partition_cmds          ... commands to partition/format whole drive

Of course you can create more partitions, but note the use of mkpart :
mkpartfs.

The ntfs_d.bat in bottom script is this:

todo.pl ".ignore-err 1 echo j|convert D: /FS:NTFS /X "
(you have to use "y" here for sure).


So, first there is a BIG warning, then the one in front of the desk
may decide to just make the system partition new, the whole drive, or
leave all as it is.

HTH
Falko

-- 
Falko Trojahn                     fon +49-341-3581294
Dipl.-Ingenieur Netzwerke/Support fax +49-341-3581295
SMI Softmark Informationstechnologien GmbH
www.smi-softmark.de



-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
unattended-info mailing list
unattended-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/unattended-info

Reply via email to