diff options
author | Martin Schwenke <martin@meltin.net> | 2014-07-02 17:39:06 +1000 |
---|---|---|
committer | Martin Schwenke <martin@meltin.net> | 2014-07-02 20:26:52 +1000 |
commit | 3301c6b70875131b333cb82bfe9654b57f9ecef0 (patch) | |
tree | 4f0f3a05a6e1235e47fc56d64a715a1836ad3bd0 /base | |
parent | 55b37e687beaf90304fe83edab4210dd56cbbb31 (diff) | |
download | autocluster-3301c6b70875131b333cb82bfe9654b57f9ecef0.tar.gz autocluster-3301c6b70875131b333cb82bfe9654b57f9ecef0.tar.xz autocluster-3301c6b70875131b333cb82bfe9654b57f9ecef0.zip |
Use a single entry-point script for post-boot setup
Signed-off-by: Martin Schwenke <martin@meltin.net>
Diffstat (limited to 'base')
-rwxr-xr-x | base/all/root/scripts/cluster_setup.sh | 38 | ||||
-rwxr-xr-x | base/all/root/scripts/install_extra_packages.sh | 10 | ||||
-rwxr-xr-x | base/all/root/scripts/install_packages.sh | 37 | ||||
-rwxr-xr-x | base/all/root/scripts/setup_cluster.sh | 18 | ||||
-rwxr-xr-x | base/all/root/scripts/setup_clusterfs.sh | 19 |
5 files changed, 48 insertions, 74 deletions
diff --git a/base/all/root/scripts/cluster_setup.sh b/base/all/root/scripts/cluster_setup.sh new file mode 100755 index 0000000..28f42f7 --- /dev/null +++ b/base/all/root/scripts/cluster_setup.sh @@ -0,0 +1,38 @@ +#!/bin/sh + +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) + +for task ; do + case "$task" in + clusterfs) + type="@@CLUSTERFS_TYPE@@" + file="${prefix%_clusterfs}_clusterfs_${type}.sh" + ;; + *) + file="${prefix}_${task}.sh" + esac + + path="${dn}/${file}" + + if [ ! -x "$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 "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" + "$path" +done diff --git a/base/all/root/scripts/install_extra_packages.sh b/base/all/root/scripts/install_extra_packages.sh new file mode 100755 index 0000000..20b0094 --- /dev/null +++ b/base/all/root/scripts/install_extra_packages.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +echo "Updating from YUM repositories" +yum -y update + +extra_packages="@@CONFIG_EXTRA_PACKAGES@@" +if [ -n "$extra_packages" ] ; then + echo "Installing extra packages" + yum -y install $extra_packages +fi diff --git a/base/all/root/scripts/install_packages.sh b/base/all/root/scripts/install_packages.sh deleted file mode 100755 index 2b6a04c..0000000 --- a/base/all/root/scripts/install_packages.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh - -echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" -printf "%% %-66s %%\n" "Install packages doing \"yum update\" on host ${HOSTNAME%%.*}" -echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" -echo "Updating from YUM repositories" -yum -y update - -extra_packages="@@CONFIG_EXTRA_PACKAGES@@" -if [ -n "$extra_packages" ] ; then - yum -y install $extra_packages -fi - -dn=$(dirname $0) - -for task ; do - case "$task" in - clusterfs) - type="@@CLUSTERFS_TYPE@@" - file="install_clusterfs_${type}.sh" - ;; - *) - file="install_${task}.sh" - esac - - path="${dn}/${file}" - - if [ ! -x "$path" ] ; then - echo "Unable to find script \"${file}\" to install task \"${task}\"" - exit 1 - fi - - echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" - printf "%% %-66s %%\n" "Install packages task \"${task}\" on host ${HOSTNAME%%.*}" - echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" - "$path" -done diff --git a/base/all/root/scripts/setup_cluster.sh b/base/all/root/scripts/setup_cluster.sh deleted file mode 100755 index 93aca59..0000000 --- a/base/all/root/scripts/setup_cluster.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -dn=$(dirname $0) - -for task ; do - file="setup_cluster_${task}.sh" - path="${dn}/${file}" - - if [ ! -x "$path" ] ; then - echo "Unable to find script \"${file}\" to setup task \"${task}\"" - exit 1 - fi - - echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" - printf "%% %-66s %%\n" "Setup cluster task \"${task}\"" - echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" - "$path" || exit $? -done diff --git a/base/all/root/scripts/setup_clusterfs.sh b/base/all/root/scripts/setup_clusterfs.sh deleted file mode 100755 index ec7c3e9..0000000 --- a/base/all/root/scripts/setup_clusterfs.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh - -dn=$(dirname $0) - -for task ; do - type="@@CLUSTERFS_TYPE@@" - file="setup_clusterfs_${type}.sh" - path="${dn}/${file}" - - if [ ! -x "$path" ] ; then - echo "Unable to find script \"${file}\" to setup task \"${task}\"" - exit 1 - fi - - echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" - printf "%% %-66s %%\n" "Setup clusterfs task \"${task}\"" - echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" - "$path" || exit $? -done |