#!/bin/sh # # @(#)$Id: import.sh,v 1.8 2002/04/29 07:05:27 oskar Exp $ # # Script to import a component into the Contelligent System via an xml-file. # Requires environment variable 'CONTELLIGENT_BASEURL' to be set. # # author: Robin Sander # scriptName=`basename $0` bindir=`dirname "$0"` test -r "$bindir/procs.sh" || { echo "? $scriptname"": internal error - cannot read \`$bindir/procs.sh'." >&2; exit 1; } . "$bindir/procs.sh" # read external funtions makeabs bindir # make 'bindir' contain an absolute path printUsage() { echo "usage: $scriptName " echo " - the xml files containing the components to import" echo "" echo "Note that the environment variable 'CONTELLIGENT_BASEURL' must contain" echo "the URL of a (running) Contelligent server." } #------------------------------------------------------------------------------ # # defaults # wget_opts="-nv -T 0 --spider" # --spider: don't download anything. if [ "$CONTELLIGENT_BASEURL" = "" ]; then printUsage>&2 exit 1 fi importURL="${CONTELLIGENT_BASEURL}/system/action/import.nac?FILENAME" for f in "$@"; do file="$f" makeabs file # make 'file' contain an absolute path if [ ! -r "$file" ]; then echo "cannot read file '$file' !">&2 exit 2 fi echo "importing '$file' using URL '$CONTELLIGENT_BASEURL' ..." wget $wget_opts "${importURL}=$file" rc=$? if [ $rc -ne 0 ]; then echo "error while importing file '$file' !">&2 exit 3 fi done