[Gllug] Multiple Distro's, one swap partition?

Pete Ryland pdr at createservices.com
Mon Mar 22 11:50:08 UTC 2004


On Sat, Mar 20, 2004 at 06:20:36PM +0000, Nix wrote:
> #!/bin/bash
> #
> # Populate /home with bind-mounts.
> #
> 
> for name in `find /home -type d -maxdepth 1 -mindepth 1 | sed 's,/home/,,' | grep -v '^\.'`; do
>     DIR=`find /home -type d -maxdepth 2 -mindepth 2 -name $name | grep '^/home/\.' | head -1`
>     [[ -n $DIR ]] && mount -o bind $DIR /home/$name
> done
> 
> and that'll pick out the home directories from their dot-directories and
> bind-mount them into place.

*Very* cool.  Just a suggestion, but to remove the dot-leading username
limitation, and make the bind-mount script slightly simpler, wouldn't it be
easier to use a naming scheme like so?  Or am I missing something?

/home/.nfs/svn.esperi.org.uk/nix
/home/.nfs/svn.esperi.org.uk/gerald
/home/.nfs/inferno.esperi.org.uk/locutus
/home/.nfs/inferno.esperi.org.uk/billg
/home/.nfs/inferno.esperi.org.uk/darl
/home/nix
/home/gerald
etc.

making the script:

for name in `find /home -type d -maxdepth 1 -mindepth 1 | sed 's,/home/,,' | grep -v '^\.nfs'`; do
    dir=`echo /home/.nfs/*/$name | cut -d \  -f 1`
    [[ -n $dir ]] && mount -o bind $dir /home/$name
done

or even just this (with reasonable limitations):

for name in /home/*; do
    dir=`echo /home/.nfs/*/$name | cut -d \  -f 1`
    [[ -n $dir ]] && mount -o bind $dir /home/$name
done

BTW, is lost+found not an issue?

Pete
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list