[syslog-ng] cygwin-packaging (was Re: [patch] Fixes for 2.0.7 on not ipv6 aware systems)

Corinna Vinschen vinschen at redhat.com
Mon Jan 21 12:53:05 CET 2008


Ping?

Btw., my signed CLA should be in your (snail-)mailbox.


Corinna

On Jan 14 17:09, Corinna Vinschen wrote:
> On Jan 14 15:18, Balazs Scheidler wrote:
> > On Mon, 2008-01-14 at 14:51 +0100, Corinna Vinschen wrote:
> > > Would it be ok to add a contrib/cygwin subdir with these two scripts
> > > upstream?  I have send the CLA to our legal dept but this might take
> > > some time.  So I was wondering... do I need the CLA for the stuff under
> > > contrib as well?
> > 
> > No, contrib is for contributions, they are redistributed with the
> > Premium Edition of syslog-ng, but in source format.
> > 
> > So if you submit patches against contrib/, I'm going to include that,
> > and you don't need a CLA.
> 
> Thank you.  It's always nice to be able to build upstream without having
> to tweak anything locally :)
> 
> Here is a ChangeLog and the diff
> 
> 	* contrib/cygwin-packaging/cygwin-postinstall: New script for
> 	packing Cygwin net distribution.
> 	* contrib/cygwin-packaging/syslog-ng-config: New script for
> 	run-time configuration of syslog-ng as part of a Cygwin net
> 	distribution.
> 
> diff --git a/contrib/cygwin-packaging/cygwin-postinstall b/contrib/cygwin-packaging/cygwin-postinstall
> new file mode 100755
> index 0000000..85daf28
> --- /dev/null
> +++ b/contrib/cygwin-packaging/cygwin-postinstall
> @@ -0,0 +1,57 @@
> +#!/bin/sh
> +DESTDIR=""
> +if [ -n "$1" ]
> +then
> +  DESTDIR=$1
> +fi
> +if [ ! -d "contrib/cygwin-packaging" ]
> +then
> +  echo "Please run 'contrib/cygwin-packaging/cygwin-postinstall' from the top-level source directory."
> +  exit 1
> +fi
> +if [ ! -f "${DESTDIR}/usr/sbin/syslog-ng.exe" ]
> +then
> +  echo "Please run 'make install-strip' first."
> +  exit 2
> +fi
> +if [ ! -f "config.log" ]
> +then
> +  echo "Please run './configure' first."
> +  echo "Have a look into 'contrib/cygwin-packaging/cygwin-postinstall' how to do it."
> +  exit 3
> +fi
> +mkdir -p "${DESTDIR}/usr/bin"
> +mkdir -p "${DESTDIR}/usr/share/doc/syslog-ng"
> +mkdir -p "${DESTDIR}/usr/share/doc/Cygwin"
> +cp contrib/cygwin-packaging/syslog-ng-config "${DESTDIR}/usr/bin"
> +cp -rp doc/examples/syslog-ng.conf.s* doc/reference/syslog-ng.[tx]* "${DESTDIR}/usr/share/doc/syslog-ng"
> +tar xzfC doc/reference/syslog-ng.html.tar.gz "${DESTDIR}/usr/share/doc/syslog-ng"
> +cat > "${DESTDIR}/usr/share/doc/Cygwin/syslog-ng.README" <<'EOF'
> +If you want to use syslog-ng, just run the /usr/bin/syslog-ng-config
> +script.  This script will create a default configuration file
> +/etc/syslog-ng.conf and it will install syslog-ng as a service on NT
> +systems on request.
> +
> +Please note that you cannot use syslogd from the inetutils package
> +and syslog-ng together.  Only one syslog daemon should run at a time.
> +The syslog-ng-config script, as well as the latest version of the
> +syslogd-config script are taking care of this when requested to install
> +as service.
> +
> +The syslog-ng package has been built using the following command
> +sequence from the top level source dir:
> +
> +./configure \
> +	--disable-ipv6 \
> +	--disable-tcp-wrapper \
> +        --prefix=/usr \
> +        --sysconfdir=/etc \
> +        --libexecdir='$(prefix)/sbin' \
> +        --localstatedir=/var \
> +        --datadir='$(prefix)/share' \
> +        --mandir='$(prefix)/share/man' \
> +        --infodir='$(prefix)/share/info'
> +make
> +make install-strip
> +contrib/cygwin-packaging/cygwin-postinstall
> +EOF
> diff --git a/contrib/cygwin-packaging/syslog-ng-config b/contrib/cygwin-packaging/syslog-ng-config
> new file mode 100755
> index 0000000..24738c5
> --- /dev/null
> +++ b/contrib/cygwin-packaging/syslog-ng-config
> @@ -0,0 +1,284 @@
> +#!/bin/sh
> +#
> +# syslog-ng-config, Copyright 2005, 2006 Corinna Vinschen
> +#
> +# This file is part of the Cygwin port of syslog-ng.
> +
> +# set -x
> +
> +# Subdirectory where the new package is being installed
> +PREFIX=/usr
> +
> +# Directory where the config files are stored
> +SYSCONFDIR=/etc
> +DEVDIR=/dev
> +LOGDIR=/var/log
> +RUNDIR=/var/run
> +
> +progname=$0
> +auto_answer=""
> +
> +request()
> +{
> +  if [ "${auto_answer}" = "yes" ]
> +  then
> +    return 0
> +  elif [ "${auto_answer}" = "no" ]
> +  then
> +    return 1
> +  fi
> +
> +  answer=""
> +  while [ "X${answer}" != "Xyes" -a "X${answer}" != "Xno" ]
> +  do
> +    echo -n "$1 (yes/no) "
> +    read answer
> +  done
> +  if [ "X${answer}" = "Xyes" ]
> +  then
> +    return 0
> +  else
> +    return 1
> +  fi
> +}
> +
> +# Check options
> +
> +while :
> +do
> +  case $# in
> +  0)
> +    break
> +    ;;
> +  esac
> +
> +  option=$1
> +  shift
> +
> +  case "$option" in
> +  -d | --debug )
> +    set -x
> +    ;;
> +
> +  -y | --yes )
> +    auto_answer=yes
> +    ;;
> +
> +  -n | --no )
> +    auto_answer=no
> +    ;;
> +  *)
> +    echo "usage: ${progname} [OPTION]..."
> +    echo
> +    echo "This script creates a basic syslog-ng configuration."
> +    echo
> +    echo "Options:"
> +    echo "    --debug  -d     Enable shell's debug output."
> +    echo "    --yes    -y     Answer all questions with \"yes\" automatically."
> +    echo "    --no     -n     Answer all questions with \"no\" automatically."
> +    echo
> +    exit 1
> +    ;;
> +
> +  esac
> +done
> +
> +# Check for ${SYSCONFDIR} directory
> +
> +if [ -e "${SYSCONFDIR}" -a ! -d "${SYSCONFDIR}" ]
> +then
> +  echo
> +  echo "${SYSCONFDIR} is existant but not a directory."
> +  echo "Cannot create global configuration files."
> +  echo
> +  exit 1
> +fi
> +
> +# Create it if necessary
> +
> +if [ ! -e "${SYSCONFDIR}" ]
> +then
> +  mkdir "${SYSCONFDIR}"
> +  if [ ! -e "${SYSCONFDIR}" ]
> +  then
> +    echo
> +    echo "Creating ${SYSCONFDIR} directory failed."
> +    echo
> +    exit 1
> +  fi
> +fi
> +setfacl -m u:system:rwx "${SYSCONFDIR}"
> +
> +# Check for ${DEVDIR} directory
> +
> +if [ -e "${DEVDIR}" -a ! -d "${DEVDIR}" ]
> +then
> +  echo
> +  echo "${DEVDIR} is existant but not a directory."
> +  echo "syslogging using syslog-ng will not work."
> +  echo
> +  exit 1
> +fi
> +
> +# Create it if necessary
> +
> +if [ ! -e "${DEVDIR}" ]
> +then
> +  mkdir "${DEVDIR}"
> +  if [ ! -e "${DEVDIR}" ]
> +  then
> +    echo
> +    echo "Creating ${DEVDIR} directory failed."
> +    echo
> +    exit 1
> +  fi
> +fi
> +setfacl -m u:system:rwx "${DEVDIR}"
> +
> +# Check for ${LOGDIR} directory
> +
> +if [ -e "${LOGDIR}" -a ! -d "${LOGDIR}" ]
> +then
> +  echo
> +  echo "${LOGDIR} is existant but not a directory."
> +  echo "syslogging using syslog-ng will not work."
> +  echo
> +  exit 1
> +fi
> +
> +# Create it if necessary
> +
> +if [ ! -e "${LOGDIR}" ]
> +then
> +  mkdir -p "${LOGDIR}"
> +  if [ ! -e "${LOGDIR}" ]
> +  then
> +    echo
> +    echo "Creating ${LOGDIR} directory failed."
> +    echo
> +    exit 1
> +  fi
> +fi
> +setfacl -m u:system:rwx "${LOGDIR}"
> +
> +# Check for ${RUNDIR} directory
> +
> +if [ -e "${RUNDIR}" -a ! -d "${RUNDIR}" ]
> +then
> +  echo
> +  echo "${RUNDIR} is existant but not a directory."
> +  echo "syslogging using syslog-ng will not work."
> +  echo
> +  exit 1
> +fi
> +
> +# Create it if necessary
> +
> +if [ ! -e "${RUNDIR}" ]
> +then
> +  mkdir -p "${RUNDIR}"
> +  if [ ! -e "${RUNDIR}" ]
> +  then
> +    echo
> +    echo "Creating ${RUNDIR} directory failed."
> +    echo
> +    exit 1
> +  fi
> +fi
> +setfacl -m u:system:rwx "${RUNDIR}"
> +
> +# Check if syslog-ng.conf exists. If yes, ask for overwriting
> +
> +if [ -f "${SYSCONFDIR}/syslog-ng.conf" ]
> +then
> +  if request "Overwrite existing ${SYSCONFDIR}/syslog-ng.conf file?"
> +  then
> +    rm -f "${SYSCONFDIR}/syslog-ng.conf"
> +    if [ -f "${SYSCONFDIR}/syslog-ng.conf" ]
> +    then
> +      echo "Can't overwrite. ${SYSCONFDIR}/syslog-ng.conf is write protected."
> +    fi
> +  fi
> +fi
> +
> +if [ ! -f "${SYSCONFDIR}/syslog-ng.conf" ]
> +then
> +  echo "Creating default ${SYSCONFDIR}/syslog-ng.conf file"
> +  cat > ${SYSCONFDIR}/syslog-ng.conf << EOF
> +options {
> +  keep_hostname(yes);
> +  chain_hostnames(no);
> +  owner("system");
> +  group("root");
> +  perm(0664);
> +  sync(0);
> +};
> +
> +source applications {
> +  unix-dgram("/dev/log");
> +  internal();
> +};
> +
> +source kernel {
> +  file("/dev/kmsg", log_prefix("kernel: "));
> +};
> +
> +destination messages {
> +  file("/var/log/messages");
> +};
> +
> +log {
> +  source(applications);
> +  destination(messages);
> +};
> +
> +log {
> +  source(kernel);
> +  destination(messages);
> +};
> +EOF
> +fi
> +setfacl -m u:system:rw- "${SYSCONFDIR}/syslog-ng.conf"
> +
> +# Check if running on NT
> +_sys="`uname`"
> +_nt=`expr "${_sys}" : "CYGWIN_NT"`
> +# On NT ask if syslog-ng should be installed as service
> +if [ ${_nt} -gt 0 ]
> +then
> +  # Check if syslogd is installed and remove on user request.
> +  if cygrunsrv -Q syslogd > /dev/null 2>&1
> +  then
> +    echo "Warning: The syslogd service is already installed.  You can not"
> +    echo "run both, syslogd and syslog-ng in parallel."
> +    echo
> +    if request "Do you want to deinstall the syslogd service in favor of syslog-ng?"
> +    then
> +      cygrunsrv -E syslogd
> +      cygrunsrv -R syslogd
> +    fi
> +  fi
> +  # Install syslog-ng service if it is not already installed
> +  if ! cygrunsrv -Q syslog-ng > /dev/null 2>&1
> +  then
> +    echo
> +    echo
> +    echo "Warning: The following function requires administrator privileges!"
> +    echo
> +    echo "Do you want to install syslog-ng as service?"
> +    if request "(Say \"no\" if it's already installed as service)"
> +    then
> +      if cygrunsrv -I syslog-ng -d "CYGWIN syslog-ng" -p /usr/sbin/syslog-ng -a -F
> +      then
> +	echo
> +	echo "The service has been installed under LocalSystem account."
> +	echo "To start the service, call \`net start syslog-ng' or \`cygrunsrv -S syslog-ng'."
> +	echo
> +	echo "Check ${SYSCONFDIR}/syslog-ng.conf first, if it suits your needs."
> +      fi
> +    fi
> +  fi
> +fi
> +
> +echo
> +echo "Configuration finished. Have fun!"
> 
> 
> Corinna
> 
> -- 
> Corinna Vinschen
> Cygwin Project Co-Leader
> Red Hat
> _______________________________________________
> syslog-ng maillist  -  syslog-ng at lists.balabit.hu
> https://lists.balabit.hu/mailman/listinfo/syslog-ng
> Frequently asked questions at http://www.campin.net/syslog-ng/faq.html

-- 
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat


More information about the syslog-ng mailing list