build fixes

This commit is contained in:
SJ 2013-09-28 21:47:34 +02:00
parent bbdc87aaa8
commit c951d7c79a
6 changed files with 214 additions and 164 deletions

25
configure vendored
View File

@ -621,6 +621,7 @@ ac_includes_default="\
ac_subst_vars='LTLIBOBJS ac_subst_vars='LTLIBOBJS
LIBOBJS LIBOBJS
LIBEXECDIR
DATADIR DATADIR
CFGDIR CFGDIR
PSQL_CONFIG PSQL_CONFIG
@ -4564,6 +4565,30 @@ _ACEOF
libexec_dir=`echo $libexecdir | grep prefix`
if test -n "$libexec_dir"; then
if test "$prefix" = "NONE"
then
libexec_dir="$ac_default_prefix/libexec"
else
libexec_dir="$prefix/libexec"
fi
else
libexec_dir="$libexecdir"
fi
LIBEXECDIR=$libexec_dir
cat >>confdefs.h <<_ACEOF
#define LIBEXECDIR "$libexec_dir"
_ACEOF
cat >>confdefs.h <<_ACEOF cat >>confdefs.h <<_ACEOF
#define VIRUS_TEMPLATE "$my_prefix/share/clapf/template.virus" #define VIRUS_TEMPLATE "$my_prefix/share/clapf/template.virus"
_ACEOF _ACEOF

View File

@ -310,6 +310,27 @@ DATADIR=$data_dir
AC_SUBST(DATADIR) AC_SUBST(DATADIR)
AC_DEFINE_UNQUOTED(DATADIR,"$data_dir",[where to look for the data files]) AC_DEFINE_UNQUOTED(DATADIR,"$data_dir",[where to look for the data files])
dnl configure libexec directory
libexec_dir=`echo $libexecdir | grep prefix`
if test -n "$libexec_dir"; then
if test "$prefix" = "NONE"
then
libexec_dir="$ac_default_prefix/libexec"
else
libexec_dir="$prefix/libexec"
fi
else
libexec_dir="$libexecdir"
fi
LIBEXECDIR=$libexec_dir
AC_SUBST(LIBEXECDIR)
AC_DEFINE_UNQUOTED(LIBEXECDIR,"$libexec_dir",[where to look for the piler helpers])
AC_DEFINE_UNQUOTED(VIRUS_TEMPLATE, "$my_prefix/share/clapf/template.virus", [where the virus template is]) AC_DEFINE_UNQUOTED(VIRUS_TEMPLATE, "$my_prefix/share/clapf/template.virus", [where the virus template is])
AC_DEFINE_UNQUOTED(ZOMBIE_NET_REGEX, "$my_prefix/share/clapf/zombienets.regex", [where the virus template is]) AC_DEFINE_UNQUOTED(ZOMBIE_NET_REGEX, "$my_prefix/share/clapf/zombienets.regex", [where the virus template is])

View File

@ -29,6 +29,8 @@ all:
install: install:
$(INSTALL) -m 0755 $(srcdir)/rc.piler $(DESTDIR)/etc/init.d/rc.piler
$(INSTALL) -m 0755 $(srcdir)/rc.searchd $(DESTDIR)/etc/init.d/rc.searchd
clean: clean:
rm -f rc.piler rc.pilergetd rc.searchd rm -f rc.piler rc.pilergetd rc.searchd

View File

@ -25,6 +25,8 @@ RUNNING_GROUP = `@id_bin@ -gn $(RUNNING_USER)`
INSTALL = @INSTALL@ INSTALL = @INSTALL@
all: all:
sed -e "s%BINDIR%$(bindir)%" -e "s%__SYSCONFDIR%$(sysconfdir)%" -e "s%__LOCALSTATEDIR%$($localstatedir)%" -e "s%__LIBEXECDIR%$($libexecdir)%" $(srcdir)/postinstall.sh.in > $(srcdir)/postinstall.sh
install: install:
$(INSTALL) -m 0755 $(srcdir)/daily-report.php $(DESTDIR)$(libexecdir)/piler $(INSTALL) -m 0755 $(srcdir)/daily-report.php $(DESTDIR)$(libexecdir)/piler
@ -33,6 +35,7 @@ install:
$(INSTALL) -m 0755 $(srcdir)/indexer.delta.sh $(DESTDIR)$(libexecdir)/piler $(INSTALL) -m 0755 $(srcdir)/indexer.delta.sh $(DESTDIR)$(libexecdir)/piler
$(INSTALL) -m 0755 $(srcdir)/indexer.main.sh $(DESTDIR)$(libexecdir)/piler $(INSTALL) -m 0755 $(srcdir)/indexer.main.sh $(DESTDIR)$(libexecdir)/piler
$(INSTALL) -m 0755 $(srcdir)/import.sh $(DESTDIR)$(libexecdir)/piler $(INSTALL) -m 0755 $(srcdir)/import.sh $(DESTDIR)$(libexecdir)/piler
$(INSTALL) -m 0755 $(srcdir)/postinstall.sh $(DESTDIR)$(libexecdir)/piler
clean: clean:

View File

@ -7,7 +7,167 @@ CRON_ORIG="/tmp/crontab.piler.orig"
CRON_TMP="/tmp/crontab.piler" CRON_TMP="/tmp/crontab.piler"
PILERCONF_TMP="/tmp/config.piler.88" PILERCONF_TMP="/tmp/config.piler.88"
. ./util/utilfunc.sh
load_default_values() {
PILERUSER="piler"
PILERGROUP="piler"
SYSCONFDIR=__SYSCONFDIR
LOCALSTATEDIR=__LOCALSTATEDIR
LIBEXECDIR=__LIBEXECDIR
KEYTMPFILE="piler.key"
KEYFILE="$SYSCONFDIR/piler.key"
HOSTNAME=`hostname --fqdn`
MYSQL_HOSTNAME="localhost"
MYSQL_DATABASE="piler"
MYSQL_USERNAME="piler"
MYSQL_PASSWORD=""
MYSQL_ROOT_PASSWORD=""
SPHINXCFG="/usr/local/etc/sphinx.conf"
WWWGROUP="apache"
DOCROOT="/var/www/$HOSTNAME"
SMARTHOST=""
SMARTHOST_PORT=25
SSL_CERT_DATA="/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com"
}
make_certificate() {
if [ ! -f $SYSCONFDIR/piler.pem ]; then
echo -n "Making an ssl certificate ... "
openssl req -new -newkey rsa:4096 -days 3650 -nodes -x509 -subj "$SSL_CERT_DATA" -keyout $SYSCONFDIR/piler.pem -out 1.cert
cat 1.cert >> $SYSCONFDIR/piler.pem
chmod 600 $SYSCONFDIR/piler.pem
rm 1.cert
fi
}
display_install_intro() {
echo ""
echo ""
echo "This is the postinstall utility for piler"
echo "It should be run only at the first install. DO NOT run on an existing piler installation!"
echo ""
askYN "Continue? [Y/N]" "N"
if [ $response != "yes" ]; then
echo "Aborted."
exit
fi
echo ""
}
check_user() {
user=$1
if [ x`whoami` != x$user ]; then echo "ERROR: postinstaller must be run as $user user"; exit 1; fi
}
isFQDN() {
# we need min. 2 dots
if [ x"$1" = "xdogfood" ]; then
echo 1
return
fi
if [ x"$1" = "x" ]; then
echo 0
return
fi
NF=`echo $1 | awk -F. '{print NF}'`
if [ $NF -ge 2 ]; then
echo 1
else
echo 0
fi
}
ask() {
PROMPT=$1
DEFAULT=$2
echo ""
echo -n "$PROMPT [$DEFAULT] "
read response
if [ -z $response ]; then
response=$DEFAULT
fi
}
askNonBlankNoEcho() {
PROMPT=$1
DEFAULT=$2
while [ 1 ]; do
stty -echo
ask "$PROMPT" "$DEFAULT"
stty echo
echo ""
if [ ! -z $response ]; then
break
fi
echo "A non-blank answer is required"
done
}
askNonBlank() {
PROMPT=$1
DEFAULT=$2
while [ 1 ]; do
ask "$PROMPT" "$DEFAULT"
if [ ! -z $response ]; then
break
fi
echo "A non-blank answer is required"
done
}
askYN() {
PROMPT=$1
DEFAULT=$2
if [ "x$DEFAULT" = "xyes" -o "x$DEFAULT" = "xYes" -o "x$DEFAULT" = "xy" -o "x$DEFAULT" = "xY" ]; then
DEFAULT="Y"
else
DEFAULT="N"
fi
while [ 1 ]; do
ask "$PROMPT" "$DEFAULT"
response=$(perl -e "print lc(\"$response\");")
if [ -z $response ]; then
:
else
if [ $response = "yes" -o $response = "y" ]; then
response="yes"
break
else
if [ $response = "no" -o $response = "n" ]; then
response="no"
break
fi
fi
fi
echo "A Yes/No answer is required"
done
}
preinstall_check() { preinstall_check() {
@ -195,6 +355,8 @@ execute_post_install_tasks() {
rm -f $KEYTMPFILE rm -f $KEYTMPFILE
echo "Done." echo "Done."
make_certificate
sed "s/mysqlpwd=verystrongpassword/mysqlpwd=$MYSQL_PASSWORD/" $SYSCONFDIR/piler.conf > $PILERCONF_TMP sed "s/mysqlpwd=verystrongpassword/mysqlpwd=$MYSQL_PASSWORD/" $SYSCONFDIR/piler.conf > $PILERCONF_TMP
cat $PILERCONF_TMP > $SYSCONFDIR/piler.conf cat $PILERCONF_TMP > $SYSCONFDIR/piler.conf
rm -f $PILERCONF_TMP rm -f $PILERCONF_TMP
@ -259,14 +421,6 @@ clean_up_temp_stuff() {
load_default_values load_default_values
if [ $# -ne 5 ]; then usage; fi
PILERUSER=$1
PILERGROUP=$2
SYSCONFDIR=$3
LOCALSTATEDIR=$4
LIBEXECDIR=$5
#LOGFILE="/tmp/piler-install.log.$$" #LOGFILE="/tmp/piler-install.log.$$"
#touch $LOGFILE #touch $LOGFILE
#chmod 600 $LOGFILE #chmod 600 $LOGFILE

View File

@ -1,155 +0,0 @@
#!/bin/sh
usage() {
echo "usage: $0 <username> <group> <sysconfdir> <localstatedir> <libexecdir>";
exit 1;
}
load_default_values() {
PILERUSER="piler"
SYSCONFDIR="/usr/local/etc"
LOCALSTATEDIR="/var"
LIBEXECDIR="/usr/local/libexec"
KEYTMPFILE="piler.key"
KEYFILE="$SYSCONFDIR/piler.key"
HOSTNAME=`hostname --fqdn`
MYSQL_HOSTNAME="localhost"
MYSQL_DATABASE="piler"
MYSQL_USERNAME="piler"
MYSQL_PASSWORD=""
MYSQL_ROOT_PASSWORD=""
SPHINXCFG="/usr/local/etc/sphinx.conf"
WWWGROUP="apache"
DOCROOT="/var/www/$HOSTNAME"
SMARTHOST=""
SMARTHOST_PORT=25
}
display_install_intro() {
echo ""
echo ""
echo "This is the postinstall utility for piler"
echo "It should be run only at the first install. DO NOT run on an existing piler installation!"
echo ""
askYN "Continue? [Y/N]" "N"
if [ $response != "yes" ]; then
echo "Aborted."
exit
fi
echo ""
}
check_user() {
user=$1
if [ x`whoami` != x$user ]; then echo "ERROR: postinstaller must be run as $user user"; exit 1; fi
}
isFQDN() {
# we need min. 2 dots
if [ x"$1" = "xdogfood" ]; then
echo 1
return
fi
if [ x"$1" = "x" ]; then
echo 0
return
fi
NF=`echo $1 | awk -F. '{print NF}'`
if [ $NF -ge 2 ]; then
echo 1
else
echo 0
fi
}
ask() {
PROMPT=$1
DEFAULT=$2
echo ""
echo -n "$PROMPT [$DEFAULT] "
read response
if [ -z $response ]; then
response=$DEFAULT
fi
}
askNonBlankNoEcho() {
PROMPT=$1
DEFAULT=$2
while [ 1 ]; do
stty -echo
ask "$PROMPT" "$DEFAULT"
stty echo
echo ""
if [ ! -z $response ]; then
break
fi
echo "A non-blank answer is required"
done
}
askNonBlank() {
PROMPT=$1
DEFAULT=$2
while [ 1 ]; do
ask "$PROMPT" "$DEFAULT"
if [ ! -z $response ]; then
break
fi
echo "A non-blank answer is required"
done
}
askYN() {
PROMPT=$1
DEFAULT=$2
if [ "x$DEFAULT" = "xyes" -o "x$DEFAULT" = "xYes" -o "x$DEFAULT" = "xy" -o "x$DEFAULT" = "xY" ]; then
DEFAULT="Y"
else
DEFAULT="N"
fi
while [ 1 ]; do
ask "$PROMPT" "$DEFAULT"
response=$(perl -e "print lc(\"$response\");")
if [ -z $response ]; then
:
else
if [ $response = "yes" -o $response = "y" ]; then
response="yes"
break
else
if [ $response = "no" -o $response = "n" ]; then
response="no"
break
fi
fi
fi
echo "A Yes/No answer is required"
done
}