diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2010-09-22 16:29:40 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2010-09-22 16:29:40 -0300 |
commit | fec2db557dcad1f52a1ffa8b612629a0b8b4c054 (patch) | |
tree | 5e1305477007f7720027fa5974824937aa4ffe63 /hydra | |
parent | 9d4d507a6c86412f1815efc1e9345f37f0956465 (diff) | |
download | hydra-fec2db557dcad1f52a1ffa8b612629a0b8b4c054.tar.gz hydra-fec2db557dcad1f52a1ffa8b612629a0b8b4c054.tar.bz2 |
App skeleton
Diffstat (limited to 'hydra')
-rwxr-xr-x | hydra | 76 |
1 files changed, 39 insertions, 37 deletions
@@ -1,6 +1,6 @@ #!/bin/bash # -# Hydra Process Command Tool. +# Hydra Management Tool. # # Copyright (C) 2010 Sarava Group - sarava at lists.riseup.net # @@ -18,52 +18,54 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # -# TODO: get all needed requirements -function hydra_requirements { -} - -# TODO: check debian version and if backports is enabled -# TODO: check backports key signature -function hydra_backports { - echo "deb http://www.backports.org/debian lenny-backports main contrib non-free" >> /etc/apt/sources.list - apt-get update ; apt-get install debian-backports-keyring ; apt-get update - apt-get -t lenny-backports install puppet puppetmaster -} - -function hydra_install_puppet { - apt-get update - # TODO: use option '-t lenny-backports' if installing from backports - apt-get install puppet puppetmaster -} +# Load libraries +function hydra_load { + local dest + local base -# Initializes a new hydra from scratch -function hydra_init { - hydra_backports - hydra_install_puppet + # Determine if we are in a local or system-wide install. + if [ -h "$0" ]; then + dest="$(readlink $0)" - mkdir -p /etc/puppet/modules - git clone git://git.sarava.org/puppet-bootstrap /etc/puppet/modules/bootstrap + # Check again as the caller might be a symlink as well + if [ -h "$dest" ]; then + base="`dirname $dest`" + dest="$(dirname $(readlink $dest))" + else + base="`dirname $0`" + fi - # TODO: edit /etc/puppet/modules/bootstrap/manifests/site.pp to suit your needs. + # Deal with relative or absolute link + if [ "`basename $dest`" == "$dest" ]; then + export APP_BASE="$base" + else + export APP_BASE="$dest" + fi + else + export APP_BASE="`dirname $0`" + fi - puppetd --no-daemonize --debug --verbose --onetime /etc/puppet/modules/bootstrap/manifests/init.pp - puppetd --no-daemonize --debug --verbose -} - -# Register an existing hydra -function hydra_register { - # TODO + export ACTIONS="$APP_BASE/share/$BASENAME" + source $APP_BASE/lib/functions || exit 1 } # Command-line parameters -COMMAND="$1" BASENAME="`basename $0`" +ACTION="$1" # Command-line parser -if [ -z "$COMMAND" ]; then - echo "usage: $BASENAME <comman> [arguments]" +if [ -z "$ACTION" ]; then + echo "usage: $BASENAME <command> [arguments]" + exit 1 fi +# Load functions +hydra_load $* + # Dispatch -hydra_requirements -hydra_$COMMAND +if hydra_has_action $ACTION; then + hydra_dispatch $* +else + echo "No such action $ACTION" + exit 1 +fi |