From 70fdcf95d1ff3c002f496516ab59e4c23d655262 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Tue, 16 Oct 2012 02:21:33 +0200 Subject: flufigut clean works now --- src/flufigut-client.sh | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) (limited to 'src/flufigut-client.sh') diff --git a/src/flufigut-client.sh b/src/flufigut-client.sh index aad3a06..e62a465 100755 --- a/src/flufigut-client.sh +++ b/src/flufigut-client.sh @@ -56,25 +56,34 @@ if [ "install" = "$1" ]; then echo 'command="/usr/local/bin/flufigut-client.sh",no-X11-forwarding,no-agent-forwarding,no-port-forwarding '$pubkey > /var/lib/flufigut/.ssh/authorized_keys chown -R flufigut:flufigut /var/lib/flufigut/.ssh chmod 600 /var/lib/flufigut/.ssh/authorized_keys - echo "flufigut ALL = (flumotion) NOPASSWD: $DAEMON, /bin/tar" >> /etc/sudoers + echo "flufigut ALL = (flumotion) NOPASSWD: $DAEMON, /bin/tar, /bin/rm" >> /etc/sudoers fi echo "successfully installed flufigut client." exit 0 fi +remove_instance() { + type="$1" + name="$2" + if [ "$1" = "worker" ]; then + sudo -u flumotion rm "$CONF_DIR/workers/$2.xml" + elif [ "$1" = "manager" ]; then + sudo -u flumotion rm -rf "$CONF_DIR/managers/$2/" + sudo -u flumotion rm "$CONF_DIR/$2.passwd" + else + echo "WARN: ignorng unknown type $1" + fi +} + start_instance() { - type="$1" - name="$2" - sudo -u flumotion $DAEMON $DAEMON_ARGS start $type $name - return "$?" + sudo -u flumotion $DAEMON $DAEMON_ARGS start "$1" "$2" + return "$?" } stop_instance() { - type="$1" - name="$2" - sudo -u flumotion $DAEMON $DAEMON_ARGS stop $type $name - return "$?" + sudo -u flumotion $DAEMON $DAEMON_ARGS stop "$1" "$2" + return "$?" } command=`echo $SSH_ORIGINAL_COMMAND | awk '{ print $1 }'` @@ -88,6 +97,15 @@ case "$command" in rm "$param" echo "done." ;; + remove) + echo -n "removing files ... " + while read line; do + type=`echo $line | awk '{ print $1 }'` + name=`echo $line | awk '{ print $2 }'` + remove_instance $type $name + done + echo "ok." + ;; start) echo -n "starting ... " while read line; do -- cgit v1.2.3