Browse Source

Added --enable-os-type=ArchLinux option to ./configure command. This

installs the ArchLinux startup script modifed from the one supplied by
nixadmins@eugenebiro.com (need to test on ArchLinux OSes).

Added testmode.snf, and modified installation to install it in the
same directory as GBUdbIgnoreList.txt.sample.

Incremented tarball version from 3.0.13 to 3.0.14.

Tested tarball with 'make dist; make distcheck'.


git-svn-id: https://svn.microneil.com/svn/PKG-SNF-CS-NIX/trunk@60 233e721a-07f6-49eb-a7da-05e0e16828fc
master
adeniz 12 years ago
parent
commit
5385f40e8c

+ 7
- 0
SNF_CS_Developer_Package/Scripts/Makefile.am View File

@@ -51,6 +51,12 @@ snf-server.in: snf-server.redhat Makefile
chmod +x $@
endif

if ArchLinux
snf-server.in: snf-server.archlinux Makefile
cp @top_srcdir@/Scripts/snf-server.archlinux snf-server.in
chmod +x $@
endif

if Suse
snf-server.in: snf-server.suse Makefile
cp @top_srcdir@/Scripts/snf-server.suse snf-server.in
@@ -89,6 +95,7 @@ EXTRA_DIST = \
snf-server.openbsd \
snf-server.freebsd \
snf-server.redhat \
snf-server.archlinux \
snf-server.ubuntu \
snf-server.suse \
$(pkgdata_DATA)

+ 214
- 0
SNF_CS_Developer_Package/Scripts/snf-server.archlinux View File

@@ -0,0 +1,214 @@
#!/bin/bash
#
# snf-server Starts and stops the SNFServer daemon (RedHat).
#
# Author-- Alban Deniz
#
# Copyright (C) 2008 ARM Research Labs, LLC.
# See www.armresearch.com for the copyright terms.
#
# chkconfig: 345 80 30
# description: SNFServer provides email filtering (anti-spam) services \
# See www.armresearch.com for details.
# processname: SNFServer

# Directory to run in.
runDir=PREFIX/share/PACKAGE_NAME

# Define mode files.
debugModeFile=$runDir/debug_mode
productionModeFile=$runDir/production_mode

# Set debug mode flag.
if [ -f $debugModeFile ]
then
debugMode=true
fi

# Source function library.
. /etc/rc.d/functions

# Debug output file.
debugOutputFile=/var/log/PACKAGE_NAME/debug.log

# Location of installation.
installedDir="PREFIX"

# Location of programs.
dir="$installedDir/sbin"

# Name of config file.
configFile="CONFFILE"

# Name of daemon.
debugProg="SNFDebugServer"
productionProg="SNFServer"

# Name of client.
clientProg="SNFClient"

# Name of user to run as.
userName="snfuser"

# Name of lockfile.
lockFile="/var/PACKAGE_NAME/PACKAGE_NAME"
#
# Function to create the mode file.
#
createModeFile()
{
fileName=$1

# Remove any existing mode files.
rm -f $productionModeFile $debugModeFile $fileName
(
echo $"PACKAGE_NAME mode file"
echo
echo $"This file specifies whether PACKAGE_NAME is configured to run in"
echo $"production mode or debug mode. If the name of this file is"
echo $"'production_mode', then PACKAGE_NAME is configured to run in"
echo $"production mode. If the name is 'debug_mode', then PACKAGE_NAME is"
echo $"configured to run in debug mode."
echo
echo $"To run in debug mode:"
echo
echo $" 1) Run 'PACKAGE_NAME debug_mode'"
echo
echo $" 2) Run 'PACKAGE_NAME restart' (if PACKAGE_NAME is already running),"
echo $" or 'PACKAGE_NAME start' (to start PACKAGE_NAME)"
echo
echo $"To run in production mode:"
echo
echo $" 1) Run 'PACKAGE_NAME production_mode'"
echo
echo $" 2) Run 'PACKAGE_NAME restart' (if PACKAGE_NAME is already running),"
echo $" or 'PACKAGE_NAME start' (to start PACKAGE_NAME)"
echo
echo $"By default, PACKAGE_NAME is configured to run in production mode."
) > $fileName

}

start(){
echo -n $"Starting $productionProg: "
for prog in $productionProg $debugProg
do
SNFPID=$(pidof -s $dir/$prog)
if [ -n "$SNFPID" ] ; then
echo -n $"$productionProg is already running"
failure
echo
return 1
fi
done

# Start.
if [ $debugMode ]
then

# Enable core dumps and start with strace and output redirected.
(ulimit -c unlimited; \
su $userName -s /bin/sh -c \
"echo Starting $dir/$debugProg on $(date) >> $debugOutputFile"; \
cd PREFIX/share/PACKAGE_NAME; \
su $userName -c \
"strace -r -tt -v $dir/$debugProg $configFile >> $debugOutputFile 2>&1 &" \
-s /bin/sh)

else
(cd PREFIX/share/PACKAGE_NAME; \
su $userName -c "$dir/$productionProg $configFile > /dev/null 2>&1 &" \
-s /bin/sh > /dev/null 2>&1)
fi

RETVAL=$?
if [ $RETVAL -eq 0 ]; then
$dir/$clientProg -status.second > /dev/null 2>&1
RETVAL=$?
fi

if [ $RETVAL -eq 0 ]; then
touch $lockFile
echo success
echo
else
failure
echo
fi
return $RETVAL
}

stop(){
echo -n $"Stopping $productionProg: "
DEBUG_SNFPID=$(pidof -s $dir/$debugProg)
PRODUCTION_SNFPID=$(pidof -s $dir/$productionProg)
if [ -n "$DEBUG_SNFPID" ] || [ -n "$PRODUCTION_SNFPID" ]; then
$dir/$clientProg -shutdown > /dev/null 2>&1
sleep 10

# Check that the programs are no longer running.
RETVAL=0
for prog in $debugProg $productionProg
do

SNFPID=$(pidof -s $dir/$prog)
if [ -n "$SNFPID" ]; then
kill $SNFPID
RETVAL=$(($RETVAL+$?))
fi
done
else
echo -n $"$productionProg is not running"
RETVAL=1
failure
echo
fi
if [ $RETVAL -eq 0 ]; then
echo
rm -f $lockFile
fi
return $RETVAL
}

restart(){
stop
start
}


# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status $productionProg
status $debugProg
;;
restart)
restart
;;
debug_mode)
#
# Remove any mode flags, and create the debug_mode file.
#
echo $"Switching to debug mode"
createModeFile $debugModeFile
;;
production_mode)
#
# Remove any mode flags, and create the debug_mode file.
#
echo $"Switching to production mode"
createModeFile $productionModeFile
;;
*)
echo $"Usage: $0 {start|stop|status|restart|production_mode|debug_mode}"
exit 1
esac

exit $?

+ 3
- 1
SNF_CS_Developer_Package/config_files/Makefile.am View File

@@ -39,12 +39,14 @@ identity.xml.sample: identity.xml.sample.in
cp @top_srcdir@/config_files/identity.xml.sample.in $@

pkgdata_DATA = \
GBUdbIgnoreList.txt.sample
GBUdbIgnoreList.txt.sample \
testmode.snf

EXTRA_DIST = \
SNFServer.xml.sample.in \
identity.xml.sample.in \
GBUdbIgnoreList.txt.sample \
testmode.snf \
Makefile.am

clean-local:

BIN
SNF_CS_Developer_Package/config_files/testmode.snf View File


+ 6
- 4
SNF_CS_Developer_Package/configure.ac View File

@@ -13,7 +13,7 @@ dnl
dnl
AC_PREREQ(2.52)

AC_INIT(snf-server, 3.0.13)
AC_INIT(snf-server, 3.0.14)
AC_CONFIG_SRCDIR(SNFMulti/snfCFGmgr.cpp)
AC_CONFIG_AUX_DIR(config)
AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
@@ -42,10 +42,10 @@ dnl Load the user-specified OS.
dnl
AC_ARG_ENABLE(os-type,
[AS_HELP_STRING([--enable-os-type=TYPE],
[where TYPE is OpenBSD, FreeBSD, RedHat, Suse, or Ubuntu])],
[where TYPE is OpenBSD, FreeBSD, RedHat, Suse, Ubuntu, or ArchLinux])],
[SNF_OSTYPE="${enableval}" ])
case "$SNF_OSTYPE" in
OpenBSD|OpenBSD|FreeBSD|RedHat|Suse|Ubuntu)
OpenBSD|OpenBSD|FreeBSD|RedHat|Suse|Ubuntu|ArchLinux)
:
;;
*)
@@ -55,7 +55,8 @@ You must specify a valid OS type with --enable-os-type=TYPE, where TYPE is one o
FreeBSD
Suse
RedHat
Ubuntu])
Ubuntu
ArchLinux])
;;
esac
AM_CONDITIONAL([OpenBSD], [test x$SNF_OSTYPE = xOpenBSD])
@@ -63,6 +64,7 @@ AM_CONDITIONAL([FreeBSD], [test x$SNF_OSTYPE = xFreeBSD])
AM_CONDITIONAL([Suse], [test x$SNF_OSTYPE = xSuse])
AM_CONDITIONAL([RedHat], [test x$SNF_OSTYPE = xRedHat])
AM_CONDITIONAL([Ubuntu], [test x$SNF_OSTYPE = xUbuntu])
AM_CONDITIONAL([ArchLinux], [test x$SNF_OSTYPE = xArchLinux])

dnl
dnl Load whether this is for a package.

Loading…
Cancel
Save