Re: default user

From: Amos Jeffries <squid3@dont-contact.us>
Date: Tue, 10 Jul 2007 20:34:23 +1200

Duane Wessels wrote:

> On Tue, 10 Jul 2007, Amos Jeffries wrote:
>
>> Hey guys,
>> I find myself in need of a ./configure option to set the
>> cache_effective_user other than 'nobody' on a per-dist basis, leaving
>> the squid.conf setup as-is.
>> Can someone please explain to me how the @HTTP_PORT@ etc get
>> replaced in squid.conf / cf.data.pre
>> I have tried modifying src/makefile.am and ./configure.in to no
>> visible effect.
>
> Calling AC_DEFINE (etc) causes the variables to be set for autoconf.
> After ./configure runs, you should see them in config.status. eg:
>
> s,@CACHE_HTTP_PORT@,3128,;t t
>
>
> config.status does the substitutions from Makefile.in to Makefile.
> for example:
>
> $ sh config.status
> ...
> config.status: creating src/Makefile
>
>
> So in src/Makefile.in you have:
>
> DEFAULT_HTTP_PORT = @CACHE_HTTP_PORT@
>
> While in src/Makefile you have:
>
> DEFAULT_HTTP_PORT = 3128
>
>
> Our src/Makefile (but you must edit src/Makefile.am of course) has
> a long-ish sed commands to do very similar substitutions on the
> cf.data.pre file:
>
> cf.data: cf.data.pre Makefile
> sed "\
> s%@DEFAULT_HTTP_PORT@%$(DEFAULT_HTTP_PORT)%g;\
> s%@DEFAULT_ICP_PORT@%$(DEFAULT_ICP_PORT)%g;\
> ...
>

Thanks Duane,
   What you have just written matched perfectly with my earlier reading
straight from the code. So I still can't see whats going wrong here.

> So if you want to add your own macro goop you have to (at least):
>
> - modify configure.in (if you want it to be set via ./configure)

yes:::

AC_ARG_WITH(cache-user,
[ --with-cache-user=USER System user account for squid permissions.
                          default: nobody],
[ if tets -z "$withval"; then
    AC_DEFINE(cfg_CACHE_EFFECTIVE_USER, "$withval", [change User for
squid to $withval])
  else
    AC_DEFINE(cfg_CACHE_EFFECTIVE_USER, "nobody", [default User for squid])
  fi
])
AC_SUBST(cfg_CACHE_EFFECTIVE_USER)

> - modify src/Makefile.am

yes:::
s%@DEFAULT_CACHE_EFFECTIVE_USER@%$(cfg_CACHE_EFFECTIVE_USER)%g;\

> - run bootstrap.sh (Makefile.am -> Makefile.in)

yes. it gives me ...
./src/Makefile.in: (looks OK)

cfg_CACHE_EFFECTIVE_USER = @cfg_CACHE_EFFECTIVE_USER@
...
s%@DEFAULT_CACHE_EFFECTIVE_USER@%$(cfg_DEFAULT_CACHE_EFFECTIVE_USER)%g;\

./configure: (looks OK)

# Check whether --with-cache-user was given.
if test "${with_cache_user+set}" = set; then
   withval=$with_cache_user; if test -z "$withval"; then
cat >>confdefs.h <<\_ACEOF
#define cfg_CACHE_EFFECTIVE_USER "$withval"
_ACEOF
   else
cat >>confdefs.h <<\_ACEOF
#define cfg_CACHE_EFFECTIVE_USER "nobody"
_ACEOF
   fi
fi

> - modify the sed command in the cf.data target of src/Makefile

?? was done in Makefile.am, bootstrap did it for src/Makefile automatically.

> - modify cf.data.pre to use the new macro

yes:::
DEFAULT: @DEFAULT_CACHE_EFFECTIVE_USER@

> - run ./configure and test it..

yes, gives me ...
./src/Makefile:

cfg_CACHE_EFFECTIVE_USER =
...
s%@DEFAULT_CACHE_EFFECTIVE_USER@%$(cfg_CACHE_EFFECTIVE_USER)%g;\

And thats where I see the problem. Running make now will replace with ""
instead of "nobody" (default option wanted for this test)

Amos
Received on Tue Jul 10 2007 - 02:34:28 MDT

This archive was generated by hypermail pre-2.1.9 : Wed Aug 01 2007 - 12:00:06 MDT