root/pxe/pxemngr

Revision 8737b88d9b6d483af2a8f09c6f50de7ce0a644a8, 1.3 kB (checked in by Frederic Lepied <frederic.lepied@…>, 19 months ago)

display sub-command names

  • Property mode set to 100755
Line 
1#!/bin/sh
2#---------------------------------------------------------------
3# Project         : pxemngr
4# File            : pxemngr
5# Copyright       : 2009 Splitted-Desktop Systems
6# Author          : Frederic Lepied
7# Created On      : Fri Feb  6 09:12:51 2009
8# Purpose         : execute pxemngr sub-commands according to the
9#                  configuration file.
10#---------------------------------------------------------------
11
12CONF=${PXEMNGR_CONF=/etc/pxemngr.conf}
13
14. $CONF
15
16if [ -z "$BASEDIR" ]; then
17    echo "BASEDIR not defined in $CONF" 1>&2
18    exit 1
19fi
20
21print_subcommands() {
22    echo "Available sub-commands:"
23    cd "$BASEDIR"/pxe/$1
24    find . -perm -111 -a -type f|sed 's@./@    @'
25    cd "$BASEDIR"/tester/$1
26    find . -perm -111 -a -type f|sed 's@./@    @'
27}
28
29if [ $# -lt 1 ]; then
30    echo "Usage: `basename $0` <sub-command> [<args>...]" 1>&2
31    print_subcommands
32    exit 1
33fi
34
35if [ ! -x "$BASEDIR"/pxe/$1 -a ! -x "$BASEDIR"/tester/$1 ]; then
36    echo "Invalid pxemngr sub-command $1" 1>&2
37    print_subcommands
38    exit 1
39fi
40
41PYTHONPATH="$BASEDIR":$PYTHONPATH
42DJANGO_SETTINGS_MODULE=settings
43export PYTHONPATH
44export DJANGO_SETTINGS_MODULE
45
46cmd="$1"
47shift
48
49if [ -x "$BASEDIR"/pxe/$cmd ]; then
50    exec "$BASEDIR/pxe/$cmd" "$@"
51else
52    exec "$BASEDIR/tester/$cmd" "$@"
53fi
54
55# pxemngr ends here
Note: See TracBrowser for help on using the browser.