1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
#!/bin/bash
# (c) 2006 Henning Glawe <glaweh@debian.org>
### BEGIN SUBROUTINE INFO
# Provides-Var:
# Requires-Var: $FAI_CONFIG_SRC $FAI
# Suggests-Var:
# Short-Description: get $FAI directory from $FAI_CONFIG_SRC
### END SUBROUTINE INFO
if [ -z "$FAI_CONFIG_SRC" ]; then
sendmon "TASKERROR get_fai_dir 21"
echo "Error: Provide the URL to obtain the fai config storage in \$FAI_CONFIG_SRC"
exit 21
fi
# extract method to get the config dir
# matched string: "cvs[+ssh]://user@host/path/to/cvsroot module[=tag]"
# ^^^
# "nfs://host/path/to/exported/config"
# ^^^
# the "major" protocol name is the one up to the first "+", if it exists
method=$(expr match "$FAI_CONFIG_SRC" '\([^+]*\).*://')
# run get-config-dir-$method script if it exists
if which get-config-dir-$method &>/dev/null ; then
get-config-dir-$method
else
sendmon "TASKERROR get_fai_dir 22"
echo "Error: get-config-dir-"$method "not found"
exit 22
fi
ln -s $FAI /var/run/fai/current_config
if [ ! -d $FAI/class ]; then
echo "WARNING: directory $FAI/class not found."
sendmon "TASKERROR get_fai_dir 23"
exit 23
fi
exit 0
|