[syslog-ng] New files for contrib/cygwin-packaging

Corinna Vinschen vinschen at redhat.com
Wed Jan 14 13:16:15 CET 2009


Hi,

so far I didn't upgrade Cygwin's syslog-ng beyond 2.1.x.  The changes
in 3.0 require to change the Cygwin specific files in the contrib
directory.  Both files are attached.  Could these both please applied
to the syslog-ng repository?


Thanks in advance,
Corinna

-- 
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat
-------------- next part --------------
#!/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 \
        --prefix=/usr \
        --sysconfdir=/etc \
        --libexecdir='$(prefix)/sbin' \
        --localstatedir=/var \
        --datadir='$(prefix)/share' \
        --mandir='$(prefix)/share/man' \
        --infodir='$(prefix)/share/info' \
	--enable-dynamic-linking \
	--with-pidfile-dir=/var
make
make install-strip
contrib/cygwin-packaging/cygwin-postinstall
EOF
-------------- next part --------------
#!/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
@version 3.0
options {
  keep_hostname(yes);
  owner("system");
  group("root");
  perm(0664);
  flush_lines(0);
};

source applications {
  unix-dgram("/dev/log");
  internal();
};

source kernel {
  file("/dev/kmsg", program_override("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 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 --fd-limit 256"
    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

echo
echo "Configuration finished. Have fun!"


More information about the syslog-ng mailing list