summaryrefslogtreecommitdiff
path: root/src/flufigut-client.sh
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2018-01-25 22:28:46 +0100
committerChristian Pointner <equinox@spreadspace.org>2018-01-25 22:28:46 +0100
commit80ae6d9411035e35a650d06eab23b140a8309816 (patch)
tree347942dc0e9fd8cc32fdeaa12f573e165f60a0b7 /src/flufigut-client.sh
parentfixed hostname for sfive plug (diff)
started a complete rewrite
Diffstat (limited to 'src/flufigut-client.sh')
-rwxr-xr-xsrc/flufigut-client.sh140
1 files changed, 0 insertions, 140 deletions
diff --git a/src/flufigut-client.sh b/src/flufigut-client.sh
deleted file mode 100755
index d02b9d7..0000000
--- a/src/flufigut-client.sh
+++ /dev/null
@@ -1,140 +0,0 @@
-#!/bin/sh
-#
-# flufigut
-#
-# flufigut, the flumotion configuration utility, is a simple tool
-# that generates flumotion configuration files using pyhton jinja2
-# template engine and simplejson. flufigut generates planet.xml
-# and worker.xml files from configuration templates and an easy to
-# understand representation of the flow structure written in json.
-#
-#
-# Copyright (C) 2012-2014 Christian Pointner <equinox@spreadspace.org>
-# Michael Gebetsroither <michael@mgeb.org>
-#
-# This file is part of flufigut.
-#
-# flufigut is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 2 of the License, or
-# any later version.
-#
-# flufigut is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with flufigut. If not, see <http://www.gnu.org/licenses/>.
-#
-
-NAME="flumotion"
-LOGFILE="/var/log/flumotion/service.log"
-DAEMON="/usr/sbin/$NAME"
-DAEMON_ARGS="-d 3 -l $LOGFILE"
-CONF_DIR="/etc/flumotion"
-
-
-if [ "install" = "$1" ]; then
- UID=`/usr/bin/id -u`
- if [ $UID -ne 0 ]; then
- echo "ERROR: this script must run as root for installation."
- exit 1
- fi
- cp $0 /usr/local/bin
- getent passwd flufigut > /dev/null 2>&1
- if [ $? -ne 0 ]; then
- echo -n "copy&paste public key and press enter: "
- read pubkey
- if [ -z "$pubkey" ]; then
- echo "ERROR: no keyfile given"
- exit 1
- fi
- adduser flufigut --disabled-password --home /var/lib/flufigut --gecos "flufigut management" --shell "/bin/sh"
- adduser flufigut flumotion
- mkdir -p /var/lib/flufigut/.ssh
- 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, /bin/rm" >> /etc/sudoers
- fi
- echo "successfully installed flufigut client."
-
- exit 0
-fi
-
-remove_instance() {
- 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() {
- sudo -u flumotion $DAEMON $DAEMON_ARGS start "$1" "$2"
- return "$?"
-}
-
-stop_instance() {
- sudo -u flumotion $DAEMON $DAEMON_ARGS stop "$1" "$2"
- return "$?"
-}
-
-command=`echo $SSH_ORIGINAL_COMMAND | awk '{ print $1 }'`
-param=`echo $SSH_ORIGINAL_COMMAND | awk '{ print $2 }'`
-
-case "$command" in
- install)
- echo -n "install files from '$param' ... "
- sudo -u flumotion tar -C "$CONF_DIR" --strip-components 1 -xzf "$param"
- 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."
- ;;
- wipe)
- echo -n "wiping files ... "
- sudo -u flumotion rm "$CONF_DIR/workers/$param-"*.xml 2> /dev/null
- sudo -u flumotion rm -rf "$CONF_DIR/managers/$param/" 2> /dev/null
- sudo -u flumotion rm "$CONF_DIR/$param.passwd" 2> /dev/null
- echo "done."
- ;;
- start)
- echo -n "starting ... "
- while read line; do
- type=`echo $line | awk '{ print $1 }'`
- name=`echo $line | awk '{ print $2 }'`
- start_instance $type $name
- done
- echo "ok."
- ;;
- stop)
- echo -n "stopping ... "
- while read line; do
- type=`echo $line | awk '{ print $1 }'`
- name=`echo $line | awk '{ print $2 }'`
- stop_instance $type $name
- done
- echo "ok."
- ;;
- scp)
- $SSH_ORIGINAL_COMMAND
- ;;
- *)
- echo "Unknown command: '$command'"
- exit 1
- ;;
-esac
-
-exit 0