summaryrefslogtreecommitdiffstats
path: root/base/all/root/scripts/cluster_setup.sh
blob: 6a32c13f016edc4bc42e12499e8213bebcd79d02 (plain)
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
42
43
44
45
46
47
48
#!/bin/sh

#config: CLUSTERFS_TYPE

set -e

stage="$1" ; shift

prefix="$stage"
case "$stage" in
    install_packages)
	prefix="install"
	# Always do the extra packages task
	set -- "extra_packages" "$@"
	;;
esac

dn=$(dirname $0)

config="${dn}/cluster_setup.config"
if [ ! -r "$config" ] ; then
    echo "Can not local configuration file \"${config}\""
fi
. "$config"

for task ; do
    case "$task" in
	clusterfs)
	    type="$CLUSTERFS_TYPE"
	    file="${prefix%_clusterfs}_clusterfs_${type}.sh"
	    ;;
	*)
	    file="${prefix}_${task}.sh"
    esac

    path="${dn}/tasks/${file}"

    if [ ! -r "$path" ] ; then
	echo "Unable to find script \"${file}\" for stage \"${stage}\" task \"${task}\""
	exit 1
    fi

    echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
    printf "%% %-66s %%\n" "Stage \"${stage}\", task \"${task}\" on host ${HOSTNAME%%.*}"
    echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
    set -- # pass no arguments
    . "$path"
done