File: get-config-dir

package info (click to toggle)
fai 3.1.8
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,144 kB
  • ctags: 164
  • sloc: sh: 3,410; perl: 1,780; makefile: 113
file content (41 lines) | stat: -rw-r--r-- 1,151 bytes parent folder | download | duplicates (2)
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