Adam C Powell IV wrote:

> Junichi Uekawa (Junichi Uekawa mikilab) wrote:
>
>> On Mon, 01 Jul 2002 19:32:47 -0400
>> Adam C Powell IV <[EMAIL PROTECTED]> wrote:
>>
>> Hi,
>>
>>> I have three questions.  First, when I chroot to 
>>> /var/lib/diskless/default/root and install new packages, /etc and 
>>> /var updates don't propagate to the host /etc and /var directories.  
>>> Are there plans to make this work -- for example, to have a 
>>> "diskless-update" script to update all of those dirs?
>>>   
>>
>> I think that would be very difficult to implement, considering that 
>> the differences on each individual clients would be pretty difficult 
>> to track, to say the least.
>
Okay, I've come up with three possible ways to do this:

   1. Touch a file e.g. $diskless-rootdir/lastupdate, and after
      subsequent updates, copy newer files than it from /etc and /var to
      all of the $diskless-hostdir/etc and var.  Problem: though there
      are some conffiles in /var, we don't want to copy everything in
      /var, that could overwrite some important information there.
   2. Update individual packages.  Look at the package's
      /var/lib/dpkg/info/<package>.conffiles and copy them all from
      $diskless-rootdir to $diskless-hostdirs.
   3. Have a "diskless-rebuild-hosts" script which looks at each
      $diskless-hostdir, gets etc/hostname, removes that dir, and runs
      diskless-newhost for that host.  If nothing else, this would
      automate the process of rebuilding all of the host files, which
      we've been doing by hand (and is kind of annoying).  The problem
      is that this seriously messes up running systems, and can't be
      done on the fly, only once in a while as major maintenance with
      all of the nodes shut down.

I've attached a simple hybrid of 1 and 2 which uses update-cluster and a 
hypothetical (but optional) /etc/default/diskless for variable settings, 
I've put it in /usr/lib/update-cluster so it will run with the other 
scripts called by update-cluster-regenerate.  It's pretty simple and 
non-invasive, and should be okay to do with a running cluster.  I 
suppose it should also check to see whether a particular hostdir exists, 
and if not, then run diskless-newhost to create it...

I've also attached a simple script for 3, though if there's a new entry 
in cluster.xml without a corresponding dir, then it doesn't have a 
hostname or mailname, so diskless-newhost prompts the user.  I haven't 
tested it just yet, but plan to do so next time we bring down the cluster...

What do you think?

One other thing: it would be nice if diskless-newhost could use the 
root/etc/fstab to create the $ip/etc/fstab, so one can easily set up 
uniform swap, /scratch (or /tmp overrides), etc.  Also, if /home should 
be mounted from an NFS server different from the head node, this 
override could also go in root/etc/fstab, and take the place of the 
standard /home entry.  Makes sense?  If so I'll investigate a patch.

> Thanks again for a really nice package!

Zeen,
-- 

-Adam P.

GPG fingerprint: D54D 1AEE B11C CE9B A02B  C5DD 526F 01E8 564E E4B6

Welcome to the best software in the world today cafe! 
<http://lyre.mit.edu/%7Epowell/The_Best_Stuff_In_The_World_Today_Cafe.ogg>


#!/bin/bash

IMAGEROOT=/var/lib/diskless/default/root
UPDATEFILE=$IMAGEROOT/.lastupdate
HOSTROOT=/var/lib/diskless/default

[ -f /etc/default/diskless ] && . /etc/default/diskless

conffilelist=`cat $IMAGEROOT/var/lib/dpkg/info/*.conffiles`

for file in $conffilelist; do \
  if [ `find $IMAGEROOT/$file -cnewer $UPDATEFILE` ]; then\
    echo Copying $file to host directories; \
    for hostip in `cat $CLUSTERXML | \
                   update-cluster-remove --master | \
                   update-cluster-parseconfig ip`; do \
      install -p $IMAGEROOT/$file $HOSTROOT/$hostip/$file; \
    done; \
  fi; \
done

touch $UPDATEFILE
#!/bin/bash

IMAGEROOT=/var/lib/diskless/default/root
UPDATEFILE=$IMAGEROOT/.lastupdate
HOSTROOT=/var/lib/diskless/default

[ -f /etc/default/diskless ] && . /etc/default/diskless

for hostip in `cat $CLUSTERXML | \
               update-cluster-remove --master | \
               update-cluster-parseconfig ip`; do \
  if [ -f $HOSTROOT/$hostip/etc/hostname ]; then \
    hostname=`cat $HOSTROOT/$hostip/etc/hostname`; \
    mailname=`cat $HOSTROOT/$hostip/etc/mailname`;
    diskless-newhost $IMAGEROOT $hostip host=$hostname mailname=$mailname; \
  else \
    diskless-newhost $IMAGEROOT $hostip; \
  fi; \
done

Reply via email to