From: Wouter Wijngaards Date: Mon, 9 Jun 2008 14:59:29 +0000 (+0000) Subject: Bug#183 fixup. X-Git-Tag: release-1.0.1~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=423e1a95a8ed6e02486e6cab0d47d564a4d5fc83;p=thirdparty%2Funbound.git Bug#183 fixup. git-svn-id: file:///svn/unbound/trunk@1114 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/config.h.in b/config.h.in index eeb9639aa..80338878a 100644 --- a/config.h.in +++ b/config.h.in @@ -232,7 +232,7 @@ /* Define to the version of this package. */ #undef PACKAGE_VERSION -/* Pathname to unbound process id file */ +/* default pidfile location */ #undef PIDFILE /* Define to necessary symbol if this constant uses a non-standard name on diff --git a/configure b/configure index 1692c1e22..9c575a8ac 100755 --- a/configure +++ b/configure @@ -815,6 +815,9 @@ CPP GREP EGREP ub_conf_file +UNBOUND_RUN_DIR +UNBOUND_CHROOT_DIR +UNBOUND_PIDFILE debug_enabled libtool AR @@ -1455,6 +1458,12 @@ Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-conf-file=path Pathname to the Unbound configuration file + --with-run-dir=path set default directory to chdir to (by default dir + part of cfg file) + --with-chroot-dir=path set default directory to chroot to (by default same + as run-dir) + --with-pidfile=filename set default pathname to unbound pidfile (default + run-dir/unbound.pid) --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-pic try to use only PIC/non-PIC objects [default=use both] @@ -3301,38 +3310,64 @@ esac # # Determine configuration file -ub_conf_file=${sysconfdir}/unbound/unbound.conf +# the eval is to evaluate shell expansion twice +ub_conf_file=`eval echo "${sysconfdir}/unbound/unbound.conf"` # Check whether --with-conf_file was given. if test "${with_conf_file+set}" = set; then - withval=$with_conf_file; ub_conf_file=$withval + withval=$with_conf_file; ub_conf_file="$withval" fi -# the eval is to evaluate shell expansion twice, once -# for $nsd_conf_file and once for the ${prefix} within it. cat >>confdefs.h <<_ACEOF -#define CONFIGFILE "`eval echo $ub_conf_file`" +#define CONFIGFILE "$ub_conf_file" _ACEOF # Determine run, chroot directory and pidfile locations -ub_cfg=`eval echo $ub_conf_file` -ub_dir=`dirname $ub_cfg` + +# Check whether --with-run-dir was given. +if test "${with_run_dir+set}" = set; then + withval=$with_run_dir; UNBOUND_RUN_DIR="$withval" +else + UNBOUND_RUN_DIR=`dirname "$ub_conf_file"` +fi + + cat >>confdefs.h <<_ACEOF -#define RUN_DIR "$ub_dir" +#define RUN_DIR "$UNBOUND_RUN_DIR" _ACEOF + +# Check whether --with-chroot-dir was given. +if test "${with_chroot_dir+set}" = set; then + withval=$with_chroot_dir; UNBOUND_CHROOT_DIR="$withval" +else + UNBOUND_CHROOT_DIR="$UNBOUND_RUN_DIR" +fi + + + cat >>confdefs.h <<_ACEOF -#define CHROOT_DIR "$ub_dir" +#define CHROOT_DIR "$UNBOUND_CHROOT_DIR" _ACEOF + +# Check whether --with-pidfile was given. +if test "${with_pidfile+set}" = set; then + withval=$with_pidfile; UNBOUND_PIDFILE="$withval" +else + UNBOUND_PIDFILE="$UNBOUND_RUN_DIR/unbound.pid" +fi + + + cat >>confdefs.h <<_ACEOF -#define PIDFILE "$ub_dir/unbound.pid" +#define PIDFILE "$UNBOUND_PIDFILE" _ACEOF @@ -5873,7 +5908,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 5876 "configure"' > conftest.$ac_ext + echo '#line 5911 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -7187,11 +7222,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7190: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7225: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7194: \$? = $ac_status" >&5 + echo "$as_me:7229: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7477,11 +7512,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7480: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7515: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7484: \$? = $ac_status" >&5 + echo "$as_me:7519: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7581,11 +7616,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7584: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7619: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7588: \$? = $ac_status" >&5 + echo "$as_me:7623: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -9932,7 +9967,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:12490: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:12459: \$? = $ac_status" >&5 + echo "$as_me:12494: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -12556,11 +12591,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:12559: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12594: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:12563: \$? = $ac_status" >&5 + echo "$as_me:12598: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -14120,11 +14155,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14123: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14158: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14127: \$? = $ac_status" >&5 + echo "$as_me:14162: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -14224,11 +14259,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14227: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14262: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:14231: \$? = $ac_status" >&5 + echo "$as_me:14266: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -16413,11 +16448,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16416: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16451: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16420: \$? = $ac_status" >&5 + echo "$as_me:16455: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -16703,11 +16738,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16706: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16741: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16710: \$? = $ac_status" >&5 + echo "$as_me:16745: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -16807,11 +16842,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16810: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16845: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:16814: \$? = $ac_status" >&5 + echo "$as_me:16849: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -25428,7 +25463,7 @@ _ACEOF -ac_config_files="$ac_config_files Makefile" +ac_config_files="$ac_config_files Makefile doc/example.conf doc/libunbound.3 doc/unbound.8 doc/unbound-checkconf.8 doc/unbound.conf.5" ac_config_headers="$ac_config_headers config.h" @@ -25985,6 +26020,11 @@ for ac_config_target in $ac_config_targets do case $ac_config_target in "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "doc/example.conf") CONFIG_FILES="$CONFIG_FILES doc/example.conf" ;; + "doc/libunbound.3") CONFIG_FILES="$CONFIG_FILES doc/libunbound.3" ;; + "doc/unbound.8") CONFIG_FILES="$CONFIG_FILES doc/unbound.8" ;; + "doc/unbound-checkconf.8") CONFIG_FILES="$CONFIG_FILES doc/unbound-checkconf.8" ;; + "doc/unbound.conf.5") CONFIG_FILES="$CONFIG_FILES doc/unbound.conf.5" ;; "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 @@ -26098,6 +26138,9 @@ CPP!$CPP$ac_delim GREP!$GREP$ac_delim EGREP!$EGREP$ac_delim ub_conf_file!$ub_conf_file$ac_delim +UNBOUND_RUN_DIR!$UNBOUND_RUN_DIR$ac_delim +UNBOUND_CHROOT_DIR!$UNBOUND_CHROOT_DIR$ac_delim +UNBOUND_PIDFILE!$UNBOUND_PIDFILE$ac_delim debug_enabled!$debug_enabled$ac_delim libtool!$libtool$ac_delim AR!$AR$ac_delim @@ -26134,7 +26177,7 @@ subdirs!$subdirs$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 85; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 88; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 diff --git a/configure.ac b/configure.ac index 03536fd90..576503139 100644 --- a/configure.ac +++ b/configure.ac @@ -46,21 +46,39 @@ esac # # Determine configuration file -ub_conf_file=${sysconfdir}/unbound/unbound.conf +# the eval is to evaluate shell expansion twice +ub_conf_file=`eval echo "${sysconfdir}/unbound/unbound.conf"` AC_ARG_WITH([conf_file], - AC_HELP_STRING([--with-conf-file=path], [Pathname to the Unbound configuration file]), - [ub_conf_file=$withval]) + AC_HELP_STRING([--with-conf-file=path], + [Pathname to the Unbound configuration file]), + [ub_conf_file="$withval"]) AC_SUBST(ub_conf_file) -# the eval is to evaluate shell expansion twice, once -# for $nsd_conf_file and once for the ${prefix} within it. -AC_DEFINE_UNQUOTED(CONFIGFILE, ["`eval echo $ub_conf_file`"], [Pathname to the Unbound configuration file]) +AC_DEFINE_UNQUOTED(CONFIGFILE, ["$ub_conf_file"], [Pathname to the Unbound configuration file]) # Determine run, chroot directory and pidfile locations -ub_cfg=`eval echo $ub_conf_file` -ub_dir=`dirname $ub_cfg` -AC_DEFINE_UNQUOTED(RUN_DIR, ["$ub_dir"], [Directory to chdir to]) -AC_DEFINE_UNQUOTED(CHROOT_DIR, ["$ub_dir"], [Directory to chroot to]) -AC_DEFINE_UNQUOTED(PIDFILE, ["$ub_dir/unbound.pid"], [Pathname to unbound process id file]) +AC_ARG_WITH(run-dir, + AC_HELP_STRING([--with-run-dir=path], + [set default directory to chdir to (by default dir part of cfg file)]), + UNBOUND_RUN_DIR="$withval", + UNBOUND_RUN_DIR=`dirname "$ub_conf_file"`) +AC_SUBST(UNBOUND_RUN_DIR) +AC_DEFINE_UNQUOTED(RUN_DIR, ["$UNBOUND_RUN_DIR"], [Directory to chdir to]) + +AC_ARG_WITH(chroot-dir, + AC_HELP_STRING([--with-chroot-dir=path], + [set default directory to chroot to (by default same as run-dir)]), + UNBOUND_CHROOT_DIR="$withval", + UNBOUND_CHROOT_DIR="$UNBOUND_RUN_DIR") +AC_SUBST(UNBOUND_CHROOT_DIR) +AC_DEFINE_UNQUOTED(CHROOT_DIR, ["$UNBOUND_CHROOT_DIR"], [Directory to chroot to]) + +AC_ARG_WITH(pidfile, + AC_HELP_STRING([--with-pidfile=filename], + [set default pathname to unbound pidfile (default run-dir/unbound.pid)]), + UNBOUND_PIDFILE="$withval", + UNBOUND_PIDFILE="$UNBOUND_RUN_DIR/unbound.pid") +AC_SUBST(UNBOUND_PIDFILE) +AC_DEFINE_UNQUOTED(PIDFILE, ["$UNBOUND_PIDFILE"], [default pidfile location]) AC_DEFINE(WINVER, 0x0502, [the version of the windows API enabled]) @@ -932,6 +950,6 @@ void *unbound_stat_realloc_log(void *ptr, size_t size, const char* file, #define UNBOUND_DNS_PORT 53 ]) -AC_CONFIG_FILES([Makefile]) +AC_CONFIG_FILES([Makefile doc/example.conf doc/libunbound.3 doc/unbound.8 doc/unbound-checkconf.8 doc/unbound.conf.5]) AC_CONFIG_HEADER([config.h]) AC_OUTPUT diff --git a/doc/Changelog b/doc/Changelog index e3096ef29..667a61a38 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -5,6 +5,13 @@ * check if no AA bit for non-forwarder, and thus lame zone. In response to error report by Richard Doty for mail.opusnet.com. - fixup unput warning from lexer on freeBSD. + - bug#183. pidfile, rundir, and chroot configure options. Also the + example.conf and manual pages get the configured defaults. + You can use: (or accept the defaults to /usr/local/etc/unbound/) + --with-conf-file=filename + --with-pidfile=filename + --with-run-dir=path + --with-chroot-dir=path 8 June 2008: Wouter - if multiple CNAMEs, use the first one. Fixup akamai CNAME bug. diff --git a/doc/README b/doc/README index 354549277..c506bd0ca 100644 --- a/doc/README +++ b/doc/README @@ -43,6 +43,18 @@ This software is under BSD license, see LICENSE for details. The server periodically checks if the amount of memory used fits with the amount of memory it thinks it should be using, and reports memory usage in detail. + * --with-conf-file=filename + Set default location of config file, + the default is /usr/local/etc/unbound/unbound.conf. + * --with-pidfile=filename + Set default location of pidfile, + the default is /usr/local/etc/unbound/unbound.pid. + * --with-run-dir=path + Set default working directory, + the default is /usr/local/etc/unbound. + * --with-chroot-dir=path + Set default chroot directory, + the default is /usr/local/etc/unbound. * 'make test' attempts to run a series of tests, depending on the support programs that are installed. diff --git a/doc/example.conf b/doc/example.conf.in similarity index 99% rename from doc/example.conf rename to doc/example.conf.in index 975ff73ae..434bf65a4 100644 --- a/doc/example.conf +++ b/doc/example.conf.in @@ -162,7 +162,7 @@ server: # How to do this is specific to your OS. # # If you give "" no chroot is performed. The path must not end in a /. - # chroot: "/usr/local/etc/unbound" + # chroot: "@UNBOUND_CHROOT_DIR@" # if given, user privileges are dropped (after binding port), # and the given username is assumed. Default is user "unbound". @@ -172,7 +172,7 @@ server: # the working directory. The relative files in this config are # relative to this directory. If you give "" the working directory # is not changed. - # directory: "/usr/local/etc/unbound" + # directory: "@UNBOUND_RUN_DIR@" # the log file, "" means log to stderr. # Use of this option sets use-syslog to "no". @@ -183,7 +183,7 @@ server: # use-syslog: yes # the pid file. - # pidfile: "/usr/local/etc/unbound/unbound.pid" + # pidfile: "@UNBOUND_PIDFILE@" # file to read root hints from. # get one from ftp://FTP.INTERNIC.NET/domain/named.cache diff --git a/doc/libunbound.3 b/doc/libunbound.3.in similarity index 100% rename from doc/libunbound.3 rename to doc/libunbound.3.in diff --git a/doc/unbound-checkconf.8 b/doc/unbound-checkconf.8.in similarity index 96% rename from doc/unbound-checkconf.8 rename to doc/unbound-checkconf.8.in index a982c446c..fc2bd38f2 100644 --- a/doc/unbound-checkconf.8 +++ b/doc/unbound-checkconf.8.in @@ -36,7 +36,7 @@ The unbound-checkconf program exits with status code 1 on error, 0 for a correct config file. .SH "FILES" .TP -.I /usr/local/etc/unbound/unbound.conf +.I @ub_conf_file@ unbound configuration file. .SH "SEE ALSO" \fIunbound.conf\fR(5), diff --git a/doc/unbound.8 b/doc/unbound.8.in similarity index 93% rename from doc/unbound.8 rename to doc/unbound.8.in index fda0a2bba..f268a6c72 100644 --- a/doc/unbound.8 +++ b/doc/unbound.8.in @@ -31,8 +31,8 @@ The available options are: Show the version and commandline option help. .TP .B \-c\fI cfgfile -Set the config file with settings for unbound to read instead of the -file at default location /usr/local/etc/unbound/unbound.conf. The syntax is +Set the config file with settings for unbound to read instead of reading the +file at the default location, @ub_conf_file@. The syntax is described in \fIunbound.conf\fR(5). .TP .B \-d diff --git a/doc/unbound.conf.5 b/doc/unbound.conf.5.in similarity index 98% rename from doc/unbound.conf.5 rename to doc/unbound.conf.5.in index 22bcc43c5..32b5fdcbc 100644 --- a/doc/unbound.conf.5 +++ b/doc/unbound.conf.5.in @@ -254,7 +254,7 @@ Additionally, unbound may need to access /dev/random (for entropy) and to /dev/log (if you use syslog) from inside the chroot. .IP If given a chroot is done to the given directory. The default is -"/usr/local/etc/unbound". If you give "" no chroot is performed. +"@UNBOUND_CHROOT_DIR@". If you give "" no chroot is performed. .TP .B username: \fI If given, after binding the port the user privileges are dropped. Default is @@ -266,7 +266,7 @@ If you change the port number in the config file, and that new port number requires privileges, then a reload will fail; a restart is needed. .TP .B directory: \fI -Sets the working directory for the program. +Sets the working directory for the program. Default is "@UNBOUND_RUN_DIR@". .TP .B logfile: \fI If "" is given, logging goes to stderr, or nowhere once daemonized. @@ -286,14 +286,14 @@ The logfile setting is overridden when use\-syslog is turned on. The default is to log to syslog. .TP .B pidfile: \fI -The process id is written to the file. Default is "/usr/local/etc/unbound/unbound.pid". +The process id is written to the file. Default is "@UNBOUND_PIDFILE@". So, .nf -kill \-HUP `cat /usr/local/etc/unbound/unbound.pid` +kill \-HUP `cat @UNBOUND_PIDFILE@` .fi triggers a reload, .nf -kill \-QUIT `cat /usr/local/etc/unbound/unbound.pid` +kill \-QUIT `cat @UNBOUND_PIDFILE@` .fi gracefully terminates. .TP @@ -663,15 +663,18 @@ server: .fi .SH "FILES" .TP -.I /usr/local/etc/unbound -default unbound working directory and default +.I @UNBOUND_RUN_DIR@ +default unbound working directory. +.TP +.I @UNBOUND_CHROOT_DIR@ +default \fIchroot\fR(2) location. .TP -.I unbound.conf +.I @ub_conf_file@ unbound configuration file. .TP -.I unbound.pid +.I @UNBOUND_PIDFILE@ default unbound pidfile with process ID of the running daemon. .TP .I unbound.log