From: Thierry Parmentelat Date: Sat, 26 May 2018 07:52:01 +0000 (+0200) Subject: the big cleanup : prune init.d/ and debian/ subdirs altogether X-Git-Tag: sfa-4.0-0~10 X-Git-Url: http://git.onelab.eu/?p=sfa.git;a=commitdiff_plain;h=b4367b068a36661344b199080944c09cfd5c9abf the big cleanup : prune init.d/ and debian/ subdirs altogether --- diff --git a/Makefile b/Makefile index 23c1be31..0bedea4e 100644 --- a/Makefile +++ b/Makefile @@ -58,36 +58,6 @@ wsdl-clean: .PHONY: wsdl wsdl-install wsdl-clean -######################################## debian packaging -# The 'debian' target is called from the build with the following variables set -# (see build/Makefile and target_debian) -# (.) RPMTARBALL -# (.) RPMVERSION -# (.) RPMRELEASE -# (.) RPMNAME -# -PROJECT=$(RPMNAME) -DEBVERSION=$(RPMVERSION).$(RPMRELEASE) -DEBTARBALL=../$(PROJECT)_$(DEBVERSION).orig.tar.bz2 - -DATE=$(shell date -u +"%a, %d %b %Y %T") - -debian: debian/changelog debian.source debian.package - -debian/changelog: debian/changelog.in - sed -e "s|@VERSION@|$(DEBVERSION)|" -e "s|@DATE@|$(DATE)|" debian/changelog.in > debian/changelog - -debian.source: force - rsync -a $(RPMTARBALL) $(DEBTARBALL) - -debian.package: - debuild -uc -us -b - -debian.clean: - $(MAKE) -f debian/rules clean - rm -rf build/ MANIFEST ../*.tar.gz ../*.dsc ../*.build - find . -name '*.pyc' -delete - ########## tests-install: mkdir -p $(DESTDIR)/usr/share/sfa/tests @@ -232,8 +202,9 @@ syncmigrations: +$(RSYNC) ./sfa/storage/migrations/versions/*.py $(SSHURL)/usr/share/sfa/migrations/versions/ syncbin: synccheck +$(RSYNC) $(BINS) $(SSHURL)/usr/bin/ -syncinit: synccheck - +$(RSYNC) ./init.d/sfa $(SSHURL)/etc/init.d/ +syncservices: synccheck + +$(RSYNC) ./systemd/*.service $(SSHURL)/usr/lib/systemd/system + +$(RSYNC) ./systemd/sfa-db-init.sh $(SSHURL)/usr/bin syncconfig: +$(RSYNC) ./config/default_config.xml $(SSHURL)/etc/sfa/ synctest: synccheck @@ -247,8 +218,8 @@ syncmig: # full-fledged -sync: synclib syncbin syncinit syncconfig syncrestart -syncdeb: synclibdeb syncbin syncinit syncconfig syncrestart +sync: synclib syncbin syncservices syncconfig syncrestart +syncdeb: synclibdeb syncbin syncservices syncconfig syncrestart # 99% of the time this is enough syncfast: synclib syncrestart diff --git a/debian/changelog.in b/debian/changelog.in deleted file mode 100644 index 381dc15a..00000000 --- a/debian/changelog.in +++ /dev/null @@ -1,5 +0,0 @@ -sfa (@VERSION@) UNRELEASED; urgency=low - - * Initial release. - - -- Thierry Parmentelat @DATE@ +0000 diff --git a/debian/compat b/debian/compat deleted file mode 100644 index 45a4fb75..00000000 --- a/debian/compat +++ /dev/null @@ -1 +0,0 @@ -8 diff --git a/debian/control b/debian/control deleted file mode 100644 index ffe90032..00000000 --- a/debian/control +++ /dev/null @@ -1,63 +0,0 @@ -Source: sfa -Maintainer: Thierry Parmentelat -Section: misc -Priority: optional -Standards-Version: 3.9.2 -Build-Depends: devscripts, debhelper (>=7.0.50~), debconf, dpatch, python-setuptools, make -X-Python-Version: >= 2.7 - -Package: sfa -Architecture: any -Depends: postgresql (>= 8.2), python-psycopg2, python-sqlalchemy, python-migrate, uuid-runtime, sfa-common -Description: Server-side for SFA, generic implementation derived from PlanetLab - -Package: sfa-common -Architecture: any -Depends: python (>= 2.7), python-openssl (>= 0.7), python-m2crypto, python-dateutil, python-lxml, python-libxslt1, python-zsi, xmlsec1 -Description: Python libraries for SFA, generic implementation derived from PlanetLab - -Package: sfa-flashpolicy -Architecture: any -Depends: sfa-common -Description: SFA support for flash clients - -Package: sfa-client -Architecture: any -Depends: sfa-common -Description: sfi, the SFA experimenter-side CLI - -Package: sfa-plc -Architecture: any -Depends: sfa-common -Description: the SFA layer around MyPLC - -Package: sfa-federica -Architecture: any -Depends: sfa-common -Description: the SFA layer around Federica - -Package: sfa-nitos -Architecture: any -Depends: sfa-common -Description: the SFA layer around NITOS - -Package: sfa-iotlab -Architecture: any -Depends: sfa-common, python-passlib, python-ldap -Description: the SFA layer around IotLab - -Package: sfa-dummy -Architecture: any -Depends: sfa-common -Description: the SFA layer around a Dummy Testbed - -Package: sfa-sfatables -Architecture: any -Depends: sfa-common -Description: sfatables policy tool for SFA - -Package: sfa-tests -Architecture: any -Depends: sfa-common -Description: unit tests suite for SFA - diff --git a/debian/copyright b/debian/copyright deleted file mode 100644 index e69de29b..00000000 diff --git a/debian/rules b/debian/rules deleted file mode 100755 index 113ecdfc..00000000 --- a/debian/rules +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/make -f -# -*- makefile -*- - -%: - dh $@ --with python2 --buildsystem=python_distutils - -override_dh_prep: - $(MAKE) version - $(MAKE) wsdl - dh_prep -O--buildsystem=python_distutils diff --git a/debian/sfa-client.install b/debian/sfa-client.install deleted file mode 100644 index 26951b5a..00000000 --- a/debian/sfa-client.install +++ /dev/null @@ -1,9 +0,0 @@ -etc/sfa/sfi_config -usr/bin/sfi*.py* -#usr/bin/sfi -usr/bin/get*.py* -usr/bin/setRecord.py* -usr/bin/sfascan.py* -#usr/bin/sfascan -usr/bin/sfadump.py* -usr/bin/sfax509.py* diff --git a/debian/sfa-common.install b/debian/sfa-common.install deleted file mode 100644 index 4dc6b252..00000000 --- a/debian/sfa-common.install +++ /dev/null @@ -1,11 +0,0 @@ -usr/lib*/python*/dist-packages/sfa/__init__.py* -usr/lib*/python*/dist-packages/sfa/trust -usr/lib*/python*/dist-packages/sfa/storage -usr/lib*/python*/dist-packages/sfa/util -usr/lib*/python*/dist-packages/sfa/server -usr/lib*/python*/dist-packages/sfa/methods -usr/lib*/python*/dist-packages/sfa/generic -usr/lib*/python*/dist-packages/sfa/managers -usr/lib*/python*/dist-packages/sfa/importer -usr/lib*/python*/dist-packages/sfa/rspecs -usr/lib*/python*/dist-packages/sfa/client diff --git a/debian/sfa-dummy.install b/debian/sfa-dummy.install deleted file mode 100644 index ee42546d..00000000 --- a/debian/sfa-dummy.install +++ /dev/null @@ -1 +0,0 @@ -usr/lib*/python*/dist-packages/sfa/dummy diff --git a/debian/sfa-federica.install b/debian/sfa-federica.install deleted file mode 100644 index 2ff7d0b3..00000000 --- a/debian/sfa-federica.install +++ /dev/null @@ -1 +0,0 @@ -usr/lib*/python*/dist-packages/sfa/federica diff --git a/debian/sfa-flashpolicy.install b/debian/sfa-flashpolicy.install deleted file mode 100644 index c0601a85..00000000 --- a/debian/sfa-flashpolicy.install +++ /dev/null @@ -1,2 +0,0 @@ -usr/bin/sfa_flashpolicy.py* -etc/sfa/sfa_flashpolicy_config.xml diff --git a/debian/sfa-iotlab.install b/debian/sfa-iotlab.install deleted file mode 100644 index 62f08d94..00000000 --- a/debian/sfa-iotlab.install +++ /dev/null @@ -1 +0,0 @@ -usr/lib*/python*/dist-packages/sfa/iotlab diff --git a/debian/sfa-nitos.install b/debian/sfa-nitos.install deleted file mode 100644 index 848cf58a..00000000 --- a/debian/sfa-nitos.install +++ /dev/null @@ -1 +0,0 @@ -usr/lib*/python*/dist-packages/sfa/nitos diff --git a/debian/sfa-plc.install b/debian/sfa-plc.install deleted file mode 100644 index 6c6e6a37..00000000 --- a/debian/sfa-plc.install +++ /dev/null @@ -1,9 +0,0 @@ -usr/lib*/python*/dist-packages/sfa/planetlab -usr/lib*/python*/dist-packages/sfa/openstack -etc/sfa/pl.rng -etc/sfa/credential.xsd -etc/sfa/top.xsd -etc/sfa/sig.xsd -etc/sfa/xml.xsd -etc/sfa/protogeni-rspec-common.xsd -etc/sfa/topology diff --git a/debian/sfa-sfatables.install b/debian/sfa-sfatables.install deleted file mode 100644 index 20b9e7c5..00000000 --- a/debian/sfa-sfatables.install +++ /dev/null @@ -1,3 +0,0 @@ -etc/sfatables/* -usr/bin/sfatables -usr/lib*/python*/dist-packages/sfatables diff --git a/debian/sfa-tests.install b/debian/sfa-tests.install deleted file mode 100644 index d4561706..00000000 --- a/debian/sfa-tests.install +++ /dev/null @@ -1 +0,0 @@ -tests/*.py /usr/share/sfa/tests/ diff --git a/debian/sfa.install b/debian/sfa.install deleted file mode 100644 index 13d801f8..00000000 --- a/debian/sfa.install +++ /dev/null @@ -1,14 +0,0 @@ -usr/bin/sfa-start.py* -usr/bin/sfaadmin.py* -#usr/bin/sfaadmin -usr/bin/keyconvert.py* -usr/bin/sfa-config-tty -usr/bin/sfa-config -etc/sfa/default_config.xml -etc/sfa/aggregates.xml -etc/sfa/registries.xml -etc/init.d/sfa -etc/init.d/functions.sfa -usr/share/sfa/migrations -usr/share/sfa/examples -wsdl/*.wsdl var/www/html/wsdl/ diff --git a/debian/sfa.postinst b/debian/sfa.postinst deleted file mode 100644 index ef165d88..00000000 --- a/debian/sfa.postinst +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -# this file is not used yet -# I take it the idea was to implement -# something like chkconfig sfa on - -update-rc.d sfa defaults diff --git a/debian/source/format b/debian/source/format deleted file mode 100644 index 163aaf8d..00000000 --- a/debian/source/format +++ /dev/null @@ -1 +0,0 @@ -3.0 (quilt) diff --git a/init.d/functions.sfa b/init.d/functions.sfa deleted file mode 100644 index 038adc9b..00000000 --- a/init.d/functions.sfa +++ /dev/null @@ -1,844 +0,0 @@ -# -*-Shell-script-*- -# -# Thierry, jan 17 2013 -# this file was put together by Jordan to provide the same interface as -# /etc/init.d/functions on fedora systems -# (probably is extracted from one of the fedora releases as is, not sure about that) -# -# we unconditionnally ship this as /etc/init.d/functions.sfa, -# and then our own initscript (init.d/sfa) does source that -# conditionnally, i.e. when run on debian systems -#################### -# -# functions This file contains functions to be used by most or all -# shell scripts in the /etc/init.d directory. -# - -TEXTDOMAIN=initscripts - -# Make sure umask is sane -umask 022 - -# Set up a default search path. -PATH="/sbin:/usr/sbin:/bin:/usr/bin" -export PATH - -if [ $PPID -ne 1 -a -z "$SYSTEMCTL_SKIP_REDIRECT" ] && \ - ( /bin/mountpoint -q /cgroup/systemd || /bin/mountpoint -q /sys/fs/cgroup/systemd ) ; then - case "$0" in - /etc/init.d/*|/etc/rc.d/init.d/*) - _use_systemctl=1 - ;; - esac -fi - -# ubuntu does not have /bin/systemctl -[ -f /bin/systemctl ] || _use_systemctl=0 - - -systemctl_redirect () { - local s - local prog=${1##*/} - local command=$2 - - case "$command" in - start) - s=$"Starting $prog (via systemctl): " - ;; - stop) - s=$"Stopping $prog (via systemctl): " - ;; - reload|try-reload) - s=$"Reloading $prog configuration (via systemctl): " - ;; - restart|try-restart|condrestart) - s=$"Restarting $prog (via systemctl): " - ;; - esac - - action "$s" /bin/systemctl $command "$prog.service" -} - -# Get a sane screen width -[ -z "${COLUMNS:-}" ] && COLUMNS=80 - -#if [ -z "${CONSOLETYPE:-}" ]; then -# if [ -r "/dev/stderr" ]; then -# CONSOLETYPE="$(/sbin/consoletype < /dev/stderr)" -# else -# CONSOLETYPE="$(/sbin/consoletype)" -# fi -#fi - -if [ -z "${NOLOCALE:-}" ] && [ -z "${LANGSH_SOURCED:-}" ] && [ -f /etc/sysconfig/i18n ] ; then - . /etc/profile.d/lang.sh 2>/dev/null - # avoid propagating LANGSH_SOURCED any further - unset LANGSH_SOURCED -fi - -# Read in our configuration -if [ -z "${BOOTUP:-}" ]; then - if [ -f /etc/sysconfig/init ]; then - . /etc/sysconfig/init - else - # This all seem confusing? Look in /etc/sysconfig/init, - # or in /usr/doc/initscripts-*/sysconfig.txt - BOOTUP=color - RES_COL=60 - MOVE_TO_COL="echo -en \\033[${RES_COL}G" - SETCOLOR_SUCCESS="echo -en \\033[1;32m" - SETCOLOR_FAILURE="echo -en \\033[1;31m" - SETCOLOR_WARNING="echo -en \\033[1;33m" - SETCOLOR_NORMAL="echo -en \\033[0;39m" - LOGLEVEL=1 - fi - if [ "$CONSOLETYPE" = "serial" ]; then - BOOTUP=serial - MOVE_TO_COL= - SETCOLOR_SUCCESS= - SETCOLOR_FAILURE= - SETCOLOR_WARNING= - SETCOLOR_NORMAL= - fi -fi - -# Interpret escape sequences in an fstab entry -fstab_decode_str() { - fstab-decode echo "$1" -} - -# Check if any of $pid (could be plural) are running -checkpid() { - local i - - for i in $* ; do - [ -d "/proc/$i" ] && return 0 - done - return 1 -} - -__readlink() { - ls -bl "$@" 2>/dev/null| awk '{ print $NF }' -} - -__fgrep() { - s=$1 - f=$2 - while read line; do - if strstr "$line" "$s"; then - echo $line - return 0 - fi - done < $f - return 1 -} - -# __umount_loop awk_program fstab_file first_msg retry_msg umount_args -# awk_program should process fstab_file and return a list of fstab-encoded -# paths; it doesn't have to handle comments in fstab_file. -__umount_loop() { - local remaining sig= - local retry=3 count - - remaining=$(LC_ALL=C awk "/^#/ {next} $1" "$2" | sort -r) - while [ -n "$remaining" -a "$retry" -gt 0 ]; do - if [ "$retry" -eq 3 ]; then - action "$3" fstab-decode umount $5 $remaining - else - action "$4" fstab-decode umount $5 $remaining - fi - count=4 - remaining=$(LC_ALL=C awk "/^#/ {next} $1" "$2" | sort -r) - while [ "$count" -gt 0 ]; do - [ -z "$remaining" ] && break - count=$(($count-1)) - # jordan # usleep 500000 - sleep 0.5 - remaining=$(LC_ALL=C awk "/^#/ {next} $1" "$2" | sort -r) - done - [ -z "$remaining" ] && break - fstab-decode /sbin/fuser -k -m $sig $remaining >/dev/null - sleep 3 - retry=$(($retry -1)) - sig=-9 - done -} - -# Similar to __umount loop above, specialized for loopback devices -__umount_loopback_loop() { - local remaining devremaining sig= - local retry=3 - - remaining=$(awk '$1 ~ /^\/dev\/loop/ && $2 != "/" {print $2}' /proc/mounts) - devremaining=$(awk '$1 ~ /^\/dev\/loop/ && $2 != "/" {print $1}' /proc/mounts) - while [ -n "$remaining" -a "$retry" -gt 0 ]; do - if [ "$retry" -eq 3 ]; then - action $"Unmounting loopback filesystems: " \ - fstab-decode umount $remaining - else - action $"Unmounting loopback filesystems (retry):" \ - fstab-decode umount $remaining - fi - for dev in $devremaining ; do - losetup $dev > /dev/null 2>&1 && \ - action $"Detaching loopback device $dev: " \ - losetup -d $dev - done - remaining=$(awk '$1 ~ /^\/dev\/loop/ && $2 != "/" {print $2}' /proc/mounts) - devremaining=$(awk '$1 ~ /^\/dev\/loop/ && $2 != "/" {print $1}' /proc/mounts) - [ -z "$remaining" ] && break - fstab-decode /sbin/fuser -k -m $sig $remaining >/dev/null - sleep 3 - retry=$(($retry -1)) - sig=-9 - done -} - -# __proc_pids {program} [pidfile] -# Set $pid to pids from /var/run* for {program}. $pid should be declared -# local in the caller. -# Returns LSB exit code for the 'status' action. -__pids_var_run() { - local base=${1##*/} - local pid_file=${2:-/var/run/$base.pid} - - pid= - if [ -f "$pid_file" ] ; then - local line p - - [ ! -r "$pid_file" ] && return 4 # "user had insufficient privilege" - while : ; do - read line - [ -z "$line" ] && break - for p in $line ; do - [ -z "${p//[0-9]/}" ] && [ -d "/proc/$p" ] && pid="$pid $p" - done - done < "$pid_file" - - if [ -n "$pid" ]; then - return 0 - fi - return 1 # "Program is dead and /var/run pid file exists" - fi - return 3 # "Program is not running" -} - -# Output PIDs of matching processes, found using pidof -__pids_pidof() { - pidof -c -o $$ -o $PPID -o %PPID -x "$1" || \ - pidof -c -o $$ -o $PPID -o %PPID -x "${1##*/}" -# jordan # pidof -c -m -o $$ -o $PPID -o %PPID -x "$1" || \ -# jordan # pidof -c -m -o $$ -o $PPID -o %PPID -x "${1##*/}" -} - - -# A function to start a program. -daemon() { - # Test syntax. - local gotbase= force= nicelevel corelimit - local pid base= user= nice= bg= pid_file= - local cgroup= - nicelevel=0 - while [ "$1" != "${1##[-+]}" ]; do - case $1 in - '') echo $"$0: Usage: daemon [+/-nicelevel] {program}" - return 1;; - --check) - base=$2 - gotbase="yes" - shift 2 - ;; - --check=?*) - base=${1#--check=} - gotbase="yes" - shift - ;; - --user) - user=$2 - shift 2 - ;; - --user=?*) - user=${1#--user=} - shift - ;; - --pidfile) - pid_file=$2 - shift 2 - ;; - --pidfile=?*) - pid_file=${1#--pidfile=} - shift - ;; - --force) - force="force" - shift - ;; - [-+][0-9]*) - nice="nice -n $1" - shift - ;; - *) echo $"$0: Usage: daemon [+/-nicelevel] {program}" - return 1;; - esac - done - - # Save basename. - [ -z "$gotbase" ] && base=${1##*/} - - # See if it's already running. Look *only* at the pid file. - __pids_var_run "$base" "$pid_file" - - [ -n "$pid" -a -z "$force" ] && return - - # make sure it doesn't core dump anywhere unless requested - corelimit="ulimit -S -c ${DAEMON_COREFILE_LIMIT:-0}" - - # if they set NICELEVEL in /etc/sysconfig/foo, honor it - [ -n "${NICELEVEL:-}" ] && nice="nice -n $NICELEVEL" - - # if they set CGROUP_DAEMON in /etc/sysconfig/foo, honor it - if [ -n "${CGROUP_DAEMON}" ]; then - if [ ! -x /bin/cgexec ]; then - echo -n "Cgroups not installed"; warning - echo - else - cgroup="/bin/cgexec"; - for i in $CGROUP_DAEMON; do - cgroup="$cgroup -g $i"; - done - fi - fi - - # Echo daemon - [ "${BOOTUP:-}" = "verbose" -a -z "${LSB:-}" ] && echo -n " $base" - - # And start it up. - if [ -z "$user" ]; then - $cgroup $nice /bin/bash -c "$corelimit >/dev/null 2>&1 ; $*" - else - $cgroup $nice runuser -s /bin/bash $user -c "$corelimit >/dev/null 2>&1 ; $*" - fi - - [ "$?" -eq 0 ] && success $"$base startup" || failure $"$base startup" -} - -# A function to stop a program. -killproc() { - local RC killlevel= base pid pid_file= delay - - RC=0; delay=3 - # Test syntax. - if [ "$#" -eq 0 ]; then - echo $"Usage: killproc [-p pidfile] [ -d delay] {program} [-signal]" - return 1 - fi - if [ "$1" = "-p" ]; then - pid_file=$2 - shift 2 - fi - if [ "$1" = "-d" ]; then - delay=$2 - shift 2 - fi - - - # check for second arg to be kill level - [ -n "${2:-}" ] && killlevel=$2 - - # Save basename. - base=${1##*/} - - # Find pid. - __pids_var_run "$1" "$pid_file" - RC=$? - if [ -z "$pid" ]; then - if [ -z "$pid_file" ]; then - pid="$(__pids_pidof "$1")" - else - [ "$RC" = "4" ] && { failure $"$base shutdown" ; return $RC ;} - fi - fi - - # Kill it. - if [ -n "$pid" ] ; then - [ "$BOOTUP" = "verbose" -a -z "${LSB:-}" ] && echo -n "$base " - if [ -z "$killlevel" ] ; then - if checkpid $pid 2>&1; then - # TERM first, then KILL if not dead - kill -TERM $pid >/dev/null 2>&1 - sleep 0.1 - # jordan # usleep 100000 - if checkpid $pid && sleep 1 && - checkpid $pid && sleep $delay && - checkpid $pid ; then - kill -KILL $pid >/dev/null 2>&1 - sleep 0.1 - # jordan # usleep 100000 - fi - fi - checkpid $pid - RC=$? - [ "$RC" -eq 0 ] && failure $"$base shutdown" || success $"$base shutdown" - RC=$((! $RC)) - # use specified level only - else - if checkpid $pid; then - kill $killlevel $pid >/dev/null 2>&1 - RC=$? - [ "$RC" -eq 0 ] && success $"$base $killlevel" || failure $"$base $killlevel" - elif [ -n "${LSB:-}" ]; then - RC=7 # Program is not running - fi - fi - else - if [ -n "${LSB:-}" -a -n "$killlevel" ]; then - RC=7 # Program is not running - else - failure $"$base shutdown" - RC=0 - fi - fi - - # Remove pid file if any. - if [ -z "$killlevel" ]; then - rm -f "${pid_file:-/var/run/$base.pid}" - fi - return $RC -} - -# A function to find the pid of a program. Looks *only* at the pidfile -pidfileofproc() { - local pid - - # Test syntax. - if [ "$#" = 0 ] ; then - echo $"Usage: pidfileofproc {program}" - return 1 - fi - - __pids_var_run "$1" - [ -n "$pid" ] && echo $pid - return 0 -} - -# A function to find the pid of a program. -pidofproc() { - local RC pid pid_file= - - # Test syntax. - if [ "$#" = 0 ]; then - echo $"Usage: pidofproc [-p pidfile] {program}" - return 1 - fi - if [ "$1" = "-p" ]; then - pid_file=$2 - shift 2 - fi - fail_code=3 # "Program is not running" - - # First try "/var/run/*.pid" files - __pids_var_run "$1" "$pid_file" - RC=$? - if [ -n "$pid" ]; then - echo $pid - return 0 - fi - - [ -n "$pid_file" ] && return $RC - __pids_pidof "$1" || return $RC -} - -status() { - local base pid lock_file= pid_file= - - # Test syntax. - if [ "$#" = 0 ] ; then - echo $"Usage: status [-p pidfile] {program}" - return 1 - fi - if [ "$1" = "-p" ]; then - pid_file=$2 - shift 2 - fi - if [ "$1" = "-l" ]; then - lock_file=$2 - shift 2 - fi - base=${1##*/} - - if [ "$_use_systemctl" = "1" ]; then - systemctl status ${0##*/}.service - return $? - fi - - # First try "pidof" - __pids_var_run "$1" "$pid_file" - RC=$? - if [ -z "$pid_file" -a -z "$pid" ]; then - pid="$(__pids_pidof "$1")" - fi - if [ -n "$pid" ]; then - echo $"${base} (pid $pid) is running..." - return 0 - fi - - case "$RC" in - 0) - echo $"${base} (pid $pid) is running..." - return 0 - ;; - 1) - echo $"${base} dead but pid file exists" - return 1 - ;; - 4) - echo $"${base} status unknown due to insufficient privileges." - return 4 - ;; - esac - if [ -z "${lock_file}" ]; then - lock_file=${base} - fi - # See if /var/lock/subsys/${lock_file} exists - if [ -f /var/lock/subsys/${lock_file} ]; then - echo $"${base} dead but subsys locked" - return 2 - fi - echo $"${base} is stopped" - return 3 -} - -echo_success() { - [ "$BOOTUP" = "color" ] && $MOVE_TO_COL - echo -n "[" - [ "$BOOTUP" = "color" ] && $SETCOLOR_SUCCESS - echo -n $" OK " - [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL - echo -n "]" - echo -ne "\r" - return 0 -} - -echo_failure() { - [ "$BOOTUP" = "color" ] && $MOVE_TO_COL - echo -n "[" - [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE - echo -n $"FAILED" - [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL - echo -n "]" - echo -ne "\r" - return 1 -} - -echo_passed() { - [ "$BOOTUP" = "color" ] && $MOVE_TO_COL - echo -n "[" - [ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING - echo -n $"PASSED" - [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL - echo -n "]" - echo -ne "\r" - return 1 -} - -echo_warning() { - [ "$BOOTUP" = "color" ] && $MOVE_TO_COL - echo -n "[" - [ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING - echo -n $"WARNING" - [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL - echo -n "]" - echo -ne "\r" - return 1 -} - -# Inform the graphical boot of our current state -update_boot_stage() { - if [ -x /usr/bin/plymouth ]; then - /usr/bin/plymouth --update="$1" - fi - return 0 -} - -# Log that something succeeded -success() { - [ "$BOOTUP" != "verbose" -a -z "${LSB:-}" ] && echo_success - return 0 -} - -# Log that something failed -failure() { - local rc=$? - [ "$BOOTUP" != "verbose" -a -z "${LSB:-}" ] && echo_failure - [ -x /usr/bin/plymouth ] && /usr/bin/plymouth --details - return $rc -} - -# Log that something passed, but may have had errors. Useful for fsck -passed() { - local rc=$? - [ "$BOOTUP" != "verbose" -a -z "${LSB:-}" ] && echo_passed - return $rc -} - -# Log a warning -warning() { - local rc=$? - [ "$BOOTUP" != "verbose" -a -z "${LSB:-}" ] && echo_warning - return $rc -} - -# Run some action. Log its output. -action() { - local STRING rc - - STRING=$1 - echo -n "$STRING " - shift - "$@" && success $"$STRING" || failure $"$STRING" - rc=$? - echo - return $rc -} - -# returns OK if $1 contains $2 -strstr() { - [ "${1#*$2*}" = "$1" ] && return 1 - return 0 -} - -# Confirm whether we really want to run this service -confirm() { - [ -x /usr/bin/plymouth ] && /usr/bin/plymouth --hide-splash - while : ; do - echo -n $"Start service $1 (Y)es/(N)o/(C)ontinue? [Y] " - read answer - if strstr $"yY" "$answer" || [ "$answer" = "" ] ; then - return 0 - elif strstr $"cC" "$answer" ; then - rm -f /var/run/confirm - [ -x /usr/bin/plymouth ] && /usr/bin/plymouth --show-splash - return 2 - elif strstr $"nN" "$answer" ; then - return 1 - fi - done -} - -# resolve a device node to its major:minor numbers in decimal or hex -get_numeric_dev() { -( - fmt="%d:%d" - if [ "$1" = "hex" ]; then - fmt="%x:%x" - fi - ls -lH "$2" | awk '{ sub(/,/, "", $5); printf("'"$fmt"'", $5, $6); }' -) 2>/dev/null -} - -# Check whether file $1 is a backup or rpm-generated file and should be ignored -is_ignored_file() { - case "$1" in - *~ | *.bak | *.orig | *.rpmnew | *.rpmorig | *.rpmsave) - return 0 - ;; - esac - return 1 -} - -# Evaluate shvar-style booleans -is_true() { - case "$1" in - [tT] | [yY] | [yY][eE][sS] | [tT][rR][uU][eE]) - return 0 - ;; - esac - return 1 -} - -# Evaluate shvar-style booleans -is_false() { - case "$1" in - [fF] | [nN] | [nN][oO] | [fF][aA][lL][sS][eE]) - return 0 - ;; - esac - return 1 -} - -key_is_random() { - [ "$1" = "/dev/urandom" -o "$1" = "/dev/hw_random" \ - -o "$1" = "/dev/random" ] -} - -find_crypto_mount_point() { - local fs_spec fs_file fs_vfstype remaining_fields - local fs - while read fs_spec fs_file remaining_fields; do - if [ "$fs_spec" = "/dev/mapper/$1" ]; then - echo $fs_file - break; - fi - done < /etc/fstab -} - -# Because of a chicken/egg problem, init_crypto must be run twice. /var may be -# encrypted but /var/lib/random-seed is needed to initialize swap. -init_crypto() { - local have_random dst src key opt mode owner params makeswap skip arg opt - local param value rc ret mke2fs mdir prompt mount_point - - ret=0 - have_random=$1 - while read dst src key opt; do - [ -z "$dst" -o "${dst#\#}" != "$dst" ] && continue - [ -b "/dev/mapper/$dst" ] && continue; - if [ "$have_random" = 0 ] && key_is_random "$key"; then - continue - fi - if [ -n "$key" -a "x$key" != "xnone" ]; then - if test -e "$key" ; then - owner=$(ls -l $key | (read a b owner rest; echo $owner)) - if ! key_is_random "$key"; then - mode=$(ls -l "$key" | cut -c 5-10) - if [ "$mode" != "------" ]; then - echo $"INSECURE MODE FOR $key" - fi - fi - if [ "$owner" != root ]; then - echo $"INSECURE OWNER FOR $key" - fi - else - echo $"Key file for $dst not found, skipping" - ret=1 - continue - fi - else - key="" - fi - params="" - makeswap="" - mke2fs="" - skip="" - # Parse the src field for UUID= and convert to real device names - if [ "${src%%=*}" == "UUID" ]; then - src=$(/sbin/blkid -t "$src" -l -o device) - elif [ "${src/^\/dev\/disk\/by-uuid\/}" != "$src" ]; then - src=$(__readlink $src) - fi - # Is it a block device? - [ -b "$src" ] || continue - # Is it already a device mapper slave? (this is gross) - devesc=${src##/dev/} - devesc=${devesc//\//!} - for d in /sys/block/dm-*/slaves ; do - [ -e $d/$devesc ] && continue 2 - done - # Parse the options field, convert to cryptsetup parameters and - # contruct the command line - while [ -n "$opt" ]; do - arg=${opt%%,*} - opt=${opt##$arg} - opt=${opt##,} - param=${arg%%=*} - value=${arg##$param=} - - case "$param" in - cipher) - params="$params -c $value" - if [ -z "$value" ]; then - echo $"$dst: no value for cipher option, skipping" - skip="yes" - fi - ;; - size) - params="$params -s $value" - if [ -z "$value" ]; then - echo $"$dst: no value for size option, skipping" - skip="yes" - fi - ;; - hash) - params="$params -h $value" - if [ -z "$value" ]; then - echo $"$dst: no value for hash option, skipping" - skip="yes" - fi - ;; - verify) - params="$params -y" - ;; - swap) - makeswap=yes - ;; - tmp) - mke2fs=yes - esac - done - if [ "$skip" = "yes" ]; then - ret=1 - continue - fi - if [ -z "$makeswap" ] && cryptsetup isLuks "$src" 2>/dev/null ; then - if key_is_random "$key"; then - echo $"$dst: LUKS requires non-random key, skipping" - ret=1 - continue - fi - if [ -n "$params" ]; then - echo "$dst: options are invalid for LUKS partitions," \ - "ignoring them" - fi - if [ -n "$key" ]; then - /sbin/cryptsetup -d $key luksOpen "$src" "$dst" <&1 2>/dev/null && success || failure - rc=$? - else - mount_point="$(find_crypto_mount_point $dst)" - [ -n "$mount_point" ] || mount_point=${src##*/} - prompt=$(printf $"%s is password protected" "$mount_point") - plymouth ask-for-password --prompt "$prompt" --command="/sbin/cryptsetup luksOpen -T1 $src $dst" <&1 - rc=$? - fi - else - [ -z "$key" ] && plymouth --hide-splash - /sbin/cryptsetup $params ${key:+-d $key} create "$dst" "$src" <&1 2>/dev/null && success || failure - rc=$? - [ -z "$key" ] && plymouth --show-splash - fi - if [ $rc -ne 0 ]; then - ret=1 - continue - fi - if [ -b "/dev/mapper/$dst" ]; then - if [ "$makeswap" = "yes" ]; then - mkswap "/dev/mapper/$dst" 2>/dev/null >/dev/null - fi - if [ "$mke2fs" = "yes" ]; then - if mke2fs "/dev/mapper/$dst" 2>/dev/null >/dev/null \ - && mdir=$(mktemp -d /tmp/mountXXXXXX); then - mount "/dev/mapper/$dst" "$mdir" && chmod 1777 "$mdir" - umount "$mdir" - rmdir "$mdir" - fi - fi - fi - done < /etc/crypttab - return $ret -} - -# A sed expression to filter out the files that is_ignored_file recognizes -__sed_discard_ignored_files='/\(~\|\.bak\|\.orig\|\.rpmnew\|\.rpmorig\|\.rpmsave\)$/d' - -if [ "$_use_systemctl" = "1" ]; then - if [ "x$1" = xstart -o \ - "x$1" = xstop -o \ - "x$1" = xrestart -o \ - "x$1" = xreload -o \ - "x$1" = xtry-restart -o \ - "x$1" = xforce-reload -o \ - "x$1" = xcondrestart ] ; then - - systemctl_redirect $0 $1 - exit $? - fi -fi diff --git a/init.d/sfa b/init.d/sfa deleted file mode 100755 index d77a58d7..00000000 --- a/init.d/sfa +++ /dev/null @@ -1,349 +0,0 @@ -#!/bin/bash -# -# sfa -# Provides a generic SFA wrapper based on the initial PlanetLab Implementation -# -# hopefully right after plc -# chkconfig: 2345 61 39 -# -### BEGIN INIT INFO -# Provides: sfa -# Required-Start: postgresql -# Required-Stop: postgresql -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: An implementation of the SFA Architecture -### END INIT INFO - -#################### -# borrowed from postgresql -function debian_get_postgresql_versions () { - versions=() - for v in `ls /usr/lib/postgresql/ 2>/dev/null`; do - if [ -x /usr/lib/postgresql/$v/bin/pg_ctl ] && [ ! -x /etc/init.d/postgresql-$v ]; then - versions+=($v) - fi - done - if [[ ${#versions[*]} == "0" ]]; then - echo "E: Missing postgresql installation. Aborting." - exit - fi - if [[ ${#versions[*]} != "1" ]]; then - echo "E: Too many postgresql versions installed. Aborting." - exit - fi - pgver=${versions[0]} -} - -#################### -POSTGRESQL_STARTED=/etc/sfa/postgresql-started -if [ -f /etc/redhat-release ] ; then - # source function library - . /etc/init.d/functions - PGDATA=/var/lib/pgsql/data/ - PGWATCH=postmaster - PGLOCK=/var/lock/subsys/postgresql - SFALOCK=/var/lock/subsys/sfa-start.pid -elif [ -f /etc/debian_version ] ; then - . /etc/init.d/functions.sfa - debian_get_postgresql_versions - PGDATA=/etc/postgresql/$pgver/main/ - PGWATCH=postgres - PGLOCK=/var/run/postgresql/$pgver-main.pid - SFALOCK=/var/run/sfa-start.pid -else - echo "initscript can only handle redhat/fedora or debian/ubuntu systems" - exit 1 -fi - - -postgresql_conf=$PGDATA/postgresql.conf -pg_hba_conf=$PGDATA/pg_hba.conf -postgresql_sysconfig=/etc/sysconfig/pgsql - -# SFA consolidated (merged) config file -sfa_whole_config=/etc/sfa/sfa_config -# SFA default config (read-only template) -sfa_default_config=/etc/sfa/default_config.xml -# SFA local (site-dependent) file -sfa_local_config=/etc/sfa/configs/site_config -sfa_local_config_xml=/etc/sfa/configs/site_config.xml - -# Source sfa shell config if present -[ -f /etc/sfa/sfa_config.sh ] && . /etc/sfa/sfa_config.sh - -# Export so that we do not have to specify -p to psql invocations -export PGPORT=$SFA_DB_PORT - -########## -# Total number of errors -ERRORS=0 - -# Count the exit status of the last command -check () -{ - ERRORS=$(($ERRORS+$?)) -} - -# can't trust the return of service postgresql start / nor status -function postgresql_check () { - - # wait until postmaster is up and running - or 10s max - if status $PGWATCH >& /dev/null && [ -f $PGLOCK ] ; then - # The only way we can be sure is if we can access it - for i in $(seq 1 10) ; do - # Must do this as the postgres user initially (before we - # fix pg_hba.conf to passwordless localhost access). - su -c 'psql -U postgres -c "" template1' postgres && return 0 - sleep 1 - done - fi - - return 1 -} - -# use a single date of this script invocation for the dump_*_db functions. -DATE=$(date +"%Y-%m-%d-%H-%M-%S") - -# Dumps the database - optional argument to specify filename suffix -function dump_sfa_db() { - if [ -n "$1" ] ; then suffix="-$1" ; else suffix="" ; fi - mkdir -p /usr/share/sfa/backups - dumpfile=/usr/share/sfa/backups/$(date +"${SFA_DB_NAME}.${DATE}${suffix}.sql") - pg_dump -U $SFA_DB_USER $SFA_DB_NAME > $dumpfile - echo "Saved sfa database in $dumpfile" - check -} - -# Regenerate configuration files - almost verbatim from plc.init -function reload () { - force=$1 - - # Regenerate the main configuration file from default values - # overlaid with site-specific and current values. - files=( $sfa_default_config $sfa_local_config ) - for file in "${files[@]}" ; do - if [ -n "$force" -o $file -nt $sfa_whole_config ] ; then - tmp=$(mktemp /tmp/sfa_config.XXXXXX) - sfa-config --python "${files[@]}" >$tmp - if [ $? -eq 0 ] ; then - mv $tmp $sfa_whole_config - chmod 444 $sfa_whole_config - else - echo "SFA: Warning: Invalid configuration file(s) detected" - rm -f $tmp - fi - break - fi - done - - # Convert configuration to various formats - if [ -f $sfa_local_config_xml ] ; then - sfa-config --python $sfa_local_config_xml > $sfa_local_config - rm $sfa_local_config_xml - fi - if [ -n "$force" -o $sfa_local_config -nt $sfa_whole_config ] ; then - sfa-config --python $sfa_default_config $sfa_local_config > $sfa_whole_config - fi - if [ -n "$force" -o $sfa_whole_config -nt /etc/sfa/sfa_config.sh ] ; then - sfa-config --shell $sfa_default_config $sfa_local_config > /etc/sfa/sfa_config.sh - fi - - # [re]generate the sfa_component_config - # this is a server-side thing but produces a file that somehow needs to be pushed - # on the planetlab nodes; in the case where sfa and myplc run on different boxes - # (or there is no myplc at all) this should be turned off - # as the component manager is not operational yet we skip this for now - #gen-sfa-cm-config.py - - # reload the shell version - [ -f /etc/sfa/sfa_config.sh ] && . /etc/sfa/sfa_config.sh - -} - -### initialize DB (don't chkconfig postgresql on) -function db_start () { - - # only if enabled - [ "$SFA_DB_ENABLED" == 1 -o "$SFA_DB_ENABLED" == True ] || return - - ######## sysconfig - # Set data directory and redirect startup output to /var/log/pgsql - mkdir -p $(dirname $postgresql_sysconfig) - # remove previous definitions - touch $postgresql_sysconfig - tmp=${postgresql_sysconfig}.new - ( egrep -v '^(PGDATA=|PGLOG=|PGPORT=)' $postgresql_sysconfig - echo "PGDATA=$PGDATA" - echo "PGLOG=/var/log/pgsql" - echo "PGPORT=$SFA_DB_PORT" - ) >> $tmp ; mv -f $tmp $postgresql_sysconfig - - ######## /var/lib/pgsql/data - # Fix ownership (rpm installation may have changed it) - chown -R -H postgres:postgres $(dirname $PGDATA) - - # PostgreSQL must be started at least once to bootstrap - # /var/lib/pgsql/data - if [ ! -f $postgresql_conf ] ; then - service postgresql initdb &> /dev/null || : - check - fi - - ######## /var/lib/pgsql/data/postgresql.conf - registry_ip="" - foo=$(python -c "import socket; print socket.gethostbyname(\"$SFA_REGISTRY_HOST\")") && registry_ip="$foo" - # Enable DB server. drop Postgresql<=7.x - # PostgreSQL >=8.0 defines listen_addresses - # listen on a specific IP + localhost, more robust when run within a vserver - sed -i -e '/^listen_addresses/d' $postgresql_conf - if [ -z "$registry_ip" ] ; then - echo "listen_addresses = 'localhost'" >> $postgresql_conf - else - echo "listen_addresses = '${registry_ip},localhost'" >> $postgresql_conf - fi - # tweak timezone to be 'UTC' - sed -i -e '/^timezone=/d' $postgresql_conf - echo "timezone='UTC'" >> $postgresql_conf - - ######## /var/lib/pgsql/data/pg_hba.conf - # Disable access to all DBs from all hosts - sed -i -e '/^\(host\|local\)/d' $pg_hba_conf - - # Enable passwordless localhost access - echo "local all all trust" >>$pg_hba_conf - # grant access - ( - echo "host $SFA_DB_NAME $SFA_DB_USER 127.0.0.1/32 password" - [ -n "$registry_ip" ] && echo "host $SFA_DB_NAME $SFA_DB_USER ${registry_ip}/32 password" - ) >>$pg_hba_conf - - if [ "$SFA_GENERIC_FLAVOUR" == "openstack" ] ; then - [ -n "$registry_ip" ] && echo "host nova nova ${registry_ip}/32 password" >> $pg_hba_conf - fi - - # Fix ownership (sed -i changes it) - chown postgres:postgres $postgresql_conf $pg_hba_conf - - ######## compute a password if needed - if [ -z "$SFA_DB_PASSWORD" ] ; then - SFA_DB_PASSWORD=$(uuidgen) - sfa-config --category=sfa_db --variable=password --value="$SFA_DB_PASSWORD" --save=$sfa_local_config $sfa_local_config >& /dev/null - reload force - fi - - ######## Start up the server - # not too nice, but.. when co-located with myplc we'll let it start/stop postgresql - postgresql_check || { - service postgresql start >& /dev/null - MESSAGE=$"Starting PostgreSQL server" - echo -n "$MESSAGE" - [ "$ERRORS" == 0 ] && success "$MESSAGE" || failure "$MESSAGE" ; echo - # best-effort to make sure we turn it back off when running stop - touch $POSTGRESQL_STARTED - } - postgresql_check - check - - ######## make sure we have the user and db created - # user - if ! psql -U $SFA_DB_USER -c "" template1 >/dev/null 2>&1 ; then - psql -U postgres -c "CREATE USER $SFA_DB_USER PASSWORD '$SFA_DB_PASSWORD'" template1 >& /dev/null - else - psql -U postgres -c "ALTER USER $SFA_DB_USER WITH PASSWORD '$SFA_DB_PASSWORD'" template1 >& /dev/null - fi - check - - # db - if ! psql -U $SFA_DB_USER -c "" $SFA_DB_NAME >/dev/null 2>&1 ; then - createdb -U postgres --template=template0 --encoding=UNICODE --owner=$SFA_DB_USER $SFA_DB_NAME - check - fi - check - # mention sfaadmin.py instead of just sfaadmin for safety - sfaadmin.py reg sync_db - - MESSAGE=$"SFA: Checking for PostgreSQL server" - echo -n "$MESSAGE" - [ "$ERRORS" == 0 ] && success "$MESSAGE" || failure "$MESSAGE" ; echo -} - -# shutdown DB -function db_stop () { - - # only if enabled - [ "$SFA_DB_ENABLED" == 1 -o "$SFA_DB_ENABLED" == True ] || return - - # not too nice, but.. when co-located with myplc we'll let it start/stop postgresql - if [ -f $POSTGRESQL_STARTED ] ; then - service postgresql stop >& /dev/null - check - MESSAGE=$"Stopping PostgreSQL server" - echo -n "$MESSAGE" - [ "$ERRORS" == 0 ] && success "$MESSAGE" || failure "$MESSAGE" ; echo - rm -f $POSTGRESQL_STARTED - fi -} - -function start() { - - reload - - db_start - # migrations are now handled in the code by sfa.storage.dbschema - - # install peer certs - action $"SFA: installing peer certs" daemon /usr/bin/sfa-start.py -t -d $OPTIONS - - [ "$SFA_REGISTRY_ENABLED" == 1 -o "$SFA_REGISTRY_ENABLED" == True ] && action $"SFA: Registry" daemon /usr/bin/sfa-start.py -r -d $OPTIONS - - [ "$SFA_AGGREGATE_ENABLED" == 1 -o "$SFA_AGGREGATE_ENABLED" == True ] && action $"SFA: Aggregate" daemon /usr/bin/sfa-start.py -a -d $OPTIONS - - [ "$SFA_SM_ENABLED" == 1 -o "$SFA_SM_ENABLED" == True ] && action "SFA: SliceMgr" daemon /usr/bin/sfa-start.py -s -d $OPTIONS - - [ "$SFA_FLASHPOLICY_ENABLED" == 1 -o "$SFA_FLASHPOLICY_ENABLED" == True ] && \ - action "Flash Policy Server" daemon /usr/bin/sfa_flashpolicy.py --file="$SFA_FLASHPOLICY_CONFIG_FILE" --port=$SFA_FLASHPOLICY_PORT -d - - touch $SFALOCK - -} - -function stop() { - action $"Shutting down SFA" killproc sfa-start.py -# a possible alternative reads; esp. as we remove lock manually below -# echo $"Shutting down SFA" ; pkill '^sfa-start' - - db_stop - - rm -f $SFALOCK -} - - -case "$1" in - start) start ;; - stop) stop ;; - reload) reload force ;; - restart) stop; start ;; - condrestart) - if [ -f $SFALOCK ]; then - stop - start - fi - ;; - status) - status sfa-start.py -# possible alternative for debian -# pids=$(pgrep '^sfa-start'); [ -n "$pids" ] && ps $pids - - RETVAL=$? - ;; - dbdump) - dump_sfa_db - ;; - *) - echo $"Usage: $0 {start|stop|reload|restart|condrestart|status|dbdump}" - exit 1 - ;; -esac - -exit $RETVAL diff --git a/init.d/sfa-cm b/init.d/sfa-cm deleted file mode 100755 index aaa5b3b6..00000000 --- a/init.d/sfa-cm +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/bash -# -# sfa Wraps PLCAPI into the SFA compliant API -# -# chkconfig: 2345 5 99 -# -# description: Wraps PLCAPI into the SFA compliant API -# - -echo "sfa-cm is no longer supported" -echo "you should consider rpm -e sfa-cm" -exit 1 - -# Source config -[ -f /etc/sfa/sfa_config.sh ] && . /etc/sfa/sfa_config.sh - -# source function library -. /etc/init.d/functions - -init_key() { - # if key doesnt exist use sfa_componenet_setup to get it - if [ ! -f /var/lib/sfa/server.key ]; then - /usr/bin/sfa_component_setup.py -k - fi -} - -start() { - echo -n $"Starting SFA: " - - if [ "$SFA_CM_ENABLED" ]; then - echo "Component Mgr" - # make sure server key (nodes private key) exists first - init_key - /usr/bin/sfa-start.py -c -d $OPTIONS - fi - - RETVAL=$? - echo - [ $RETVAL -eq 0 ] && touch /var/lock/subsys/sfa - -} - -stop() { - echo -n $"Shutting down SFA: " - killproc sfa-start.py - RETVAL=$? - - echo - [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/sfa -} - - - -case "$1" in - start) - start - ;; - stop) - stop - ;; - restart|reload) - stop - start - ;; - condrestart) - if [ -f /var/lock/subsys/sfa ]; then - stop - start - fi - ;; - status) - status sfa - RETVAL=$? - ;; - *) - echo $"Usage: $0 {start|stop|restart|condrestart|status}" - exit 1 -esac - -exit $RETVAL -