#!/bin/sh
#
# Secioss access manager administration command
#
# Copyright(c) SECIOSS CORPORATION 2008
#

TMPDIR=/usr/share/seciossadmin/tmp
APPDIR=/var/www/sso

host=$1
shift

for file in `echo $*`; do
    if [[ $file == *.ini ]] && [[ $file != config.ini ]]; then
        APP=`echo $file | sed s/\.ini//`.php
    fi

    if [ -f $TMPDIR/`basename $file` ]; then
        $file = $TMPDIR/`basename $file`
    fi
    scp $file root@$host:$file
    if [ -n "$APP" ]; then
        ssh root@$host ln -s $APPDIR/autologin.php $APPDIR/$APP
    fi
    if [[ $file != *.php ]]; then
        ssh root@$host /etc/init.d/httpd restart
    fi
done
