script hacking

Thomas Lange lange at informatik.Uni-Koeln.DE
Thu Jan 13 12:38:49 CET 2005


>>>>> On Thu, 13 Jan 2005 22:28:48 +1100, Nicolas Triantafillou <nick at uow.edu.au> said:

    > I've solved this problem with some hacking of 
    > /usr/lib/fai/sbin/setup_harddisks
That's ugly and bad. You should use a hook for that.

    > <       $command = "";
    > <       `mkfs.ext2 /dev/hda3`;
    > <       `mkfs.ext2 /dev/hda6`;
Write a shell hook, not a perl script that just calls shell commands.

    > Now, this hack works for one set of hardware, but nothing else, so I 
    > need a way to make this work only when one class is defined.
Hook are perfectly for this!

Create a file hooks/partition.MYHARDWARE:

#! /bin/sh

mkfs.ext2 /dev/hda3
mkfs.ext2 /dev/hda6
<echo or cat commands for creating fstab and disk_var.sh>
skiptask partition


Now, if the class MYHARDWARE is defined your is will be executed
(chmod a+rx) before the task partition is called. The command skiptask
tells FAI to skip the normal task partition so setup_harddisks is not
called. You also have to create the file disk_var.sh and the fstab
file in this hook.

-- 
regards Thomas



More information about the linux-fai mailing list