#!/bin/bash
#
# sccl_get_config
#
# Konfiguration ueber sccl_dist_config von anderem Knoten bekommen
##################################################################
#
cd ${0%/*}
if [[ $PWD != */bin ]]
 then
  cd bin
fi
#
if [[ -f /etc/sccl/sccl.conf ]]
 then
  . /etc/sccl/sccl.conf
  #
  if [[ "$STARTSTOPDIR" != /etc/sccl/* ]]
   then
    STARTSTOPDIR=''
  else
    STARTSTOPDIR="${STARTSTOPDIR#/}"
  fi
  PACKAGES="${PACKAGES#/}"
  RESOURCES="${RESOURCES#/}"
  U2WPWDDAT="${U2WPWDDAT#/}"
  U2WHOSTSDAT="${U2WHOSTSDAT#/}"
  if [[ -f /etc/sccl/capwd.dat || -f /etc/sccl/certs/private/${CLUSTER}-cakey.pem ]]
   then
    MASTERFILES=''
  else
    MASTERFILES="etc/sccl/capwd.dat etc/sccl/certs/private/${CLUSTER}-cakey.pem"
  fi
  #
  tar xvfz "$1" -C / etc/sccl/sccl.conf etc/sccl/adminpwd.dat etc/sccl/userpwd.dat $U2WPWDDAT $U2WHOSTSDAT $STARTSTOPDIR $PACKAGES $RESOURCES $MASTERFILES
else
  echo "Cluster nicht konfiguriert."
fi
