#!/bin/bash REAL_PATH=`dirname "$0"` SCRIPT_NAME=`basename "$0"` SCRIPT_PARAMS=$* MARJOR=2 MINOR=0 REVISION=0 ARCHIVE="$REAL_PATH/OpenSteam_$MARJOR.$MINOR.$REVISION.tar.bz2" SERVICES="$REAL_PATH/scripts/services.sh" source "$REAL_PATH/scripts/bashlib_positional" source "$REAL_PATH/scripts/bashlib_compress" source "$REAL_PATH/scripts/bashlib_md5" function PrintHelp { echo "usage: $SCRIPT_NAME [action=[value]] --[option=[value]]" echo -e "\tactions" echo -e "\t\tinstall=path\t: install opensteam to [path]" echo -e "\t\tpack\t\t: create a tar.bz2 of the current installation" echo -e "\t\tneuter\t\t: neuter needed files" echo -e "\t\tstart=service\t: start a service (see services name)" echo -e "\t\tstop=service\t: stop a service" echo -e "\t\trestart=service\t: restart a service" echo -e "\t\thelp\t\t: print this help (--help is an alias)" echo "" echo -e "\toptions" echo -e "\t\tgds\t\t: specify GDS address" echo -e "\t\tcsds\t\t: specify CSDS address" echo -e "\t\tip\t\t: force bind ip" echo "" echo -e "\tservices name" echo -e "\t\tgds\t\t: General Directory Server" echo -e "\t\tcsds\t\t: Content Server Directory Server" echo -e "\t\tas\t\t: Authentication Server" echo -e "\t\tcsc\t\t: Configuration Server Client" echo -e "\t\tcspublic\t: Content Server Public" echo -e "\t\tcsclient\t: Content Server Client" echo -e "\t\tcm\t\t: Client Manager" } function DoActions { ParameterName=`GetParameterName $1` ParameterValue=`GetParameterValue $1` case $ParameterName in help) PrintHelp exit ;; install) if [ -z $ParameterValue ] then PrintHelp exit fi ;; start) $SERVICES $SCRIPT_PARAMS ;; stop) $SERVICES $SCRIPT_PARAMS ;; restart) $SERVICES $SCRIPT_PARAMS ;; pack) CompressDirectory $REAL_PATH $ARCHIVE `MD5File $ARCHIVE > $ARCHIVE.md5` exit ;; neuter) exit ;; *) UnknownParameter $ParameterName exit ;; esac } function DoOptions { ParameterName=`GetParameterName $1` ParameterValue=`GetParameterValue $1` case $ParameterName in help) PrintHelp exit ;; *) ;; esac } ParseParameters DoActions DoOptions $*