generating links via fcopy
Michael Tautschnig
michael.tautschnig at zt-consulting.com
Fri Sep 16 11:25:07 CEST 2005
> Hi!
>
> We'll be using fai to upgrade our Woody workstations to Sarge and
> maintain them. But sometimes we'd like to create links on the target
> machine in the same way, we copy files via fcopy (because we have to
> generate a lot of them).
Isn't it just as easy to create the links in one of your scripts, i.e.
> Example: a relative link is located for example in
> $fairoot/files/etc/mylink.extension/MYCLASS and points to
> ../usr/local/myrealfile.extension. It should be copied as is and
> /etc/mylink.extension should remain as relative link. Current behavior
> is following the link and copying the target file.
>
fcopy /usr/local/myrealfile.extension && ln -s /usr/local/myrealfile.extension ${target}/etc/mylink.extension
> We'd like to extend fcopy that it uses readlink/symlink to keep links
> intact if the parameter for example -H is present and the current file
> is a link.
>
> Has someone did something like this before? Is the dev-team interested
> in the patch?
>
In my opinion, this is somewhat dangerous: It changes the semantics of the
files/ directory, although, of course, only if the -H switch is given.
I'd rather suggest to build a small function:
fcopy_links() {
local fcopy_args sources eff_sources
for arg ; do
if echo $arg | grep -q "^-" then
fcopy_args="$fcopy_args $arg"
else
sources="$sources $arg"
fi
done
for i in $sources ; do
if [ -L ${FAI}/$i ] ; then
$eff_sources="$eff_sources $i/`readlink ${FAI}/$i`"
ln -s $i/`readlink ${FAI}/$i` ${target}/$i
else
$eff_sources="$eff_sources $i"
fi
done
fcopy $fcopy_args $eff_sources
}
HTH,
Michael
More information about the linux-fai
mailing list