hooks for/replacing task_partition

Eric Mumpower nocturne at permabit.com
Wed Jan 30 23:06:43 CET 2002


In older versions of fai/scripts/rcS_fai, the chain via which
setup_harddisks could be called was that rcS_fai (CVS version 1.62)
contained this code:

    call_hook partition
    if [ ! -s /tmp/fstab ];then
        echo "Partitioning local harddisks"
        setup_harddisks -X > /tmp/format.log 2>&1
    fi
    if [ ! -s $diskvar ]; then
        cat /tmp/format.log
        die "Error: $diskvar not found."
    fi
    . $diskvar

Thus, any partition hooks would be called, and then *if* none of them had
created the fstab, setup_harddisks would be called upon to do the work, and
then the diskvar file would be sourced.

The current scheme, involving both rcS_fai and fai/lib/subroutines seems
different in one key way: it's currently tedious for a hook script to
supersede the normal operation of setup_harddisks in the way that was
previously possible (*). If it tries to do so, the diskvar file is never
sourced, and the only way to get around this would be to create a
hooks/partition.MYPART.sh consisting solely of '. /tmp/disk_var.sh' .

Is this increase in complexity deliberate?

While I don't think it's the best solution to this problem, in case it
interests you, I offer this patch which restores the behavior implemented by
v1.62 of rcS_fai:

*** subroutines 2002/01/16 19:50:51     1.2
--- subroutines 2002/01/30 21:20:16
***************
*** 482,488 ****
  task_partition() {
  
      echo "Partitioning local harddisks"
!     setup_harddisks -X > /tmp/format.log 2>&1
      if [ ! -s $diskvar ]; then
        cat /tmp/format.log
        die "Error: $diskvar not found."
--- 482,488 ----
  task_partition() {
  
      echo "Partitioning local harddisks"
!     [ ! -s $diskvar ] && setup_harddisks -X > /tmp/format.log 2>&1
      if [ ! -s $diskvar ]; then
        cat /tmp/format.log
        die "Error: $diskvar not found."



(* rcS_fai simply invokes 'task partition', and then task() calls the
partition hooks, and if none of them created the file /tmp/skip.partition,
task_partition is called. It is only task_partition which calls
setup_harddisks and sources the diskvar file. Thus, if you skip
task_partition, you must use some other mechanism to cause the diskvar file
to be sourced.)



More information about the linux-fai mailing list