packages: varnish/varnish.init - import some env from parent process if pos...
glen
glen at pld-linux.org
Mon Apr 5 18:28:05 CEST 2010
Author: glen Date: Mon Apr 5 16:28:05 2010 GMT
Module: packages Tag: HEAD
---- Log message:
- import some env from parent process if possible, make vcl labels more informative
---- Files affected:
packages/varnish:
varnish.init (1.17 -> 1.18)
---- Diffs:
================================================================
Index: packages/varnish/varnish.init
diff -u packages/varnish/varnish.init:1.17 packages/varnish/varnish.init:1.18
--- packages/varnish/varnish.init:1.17 Mon Apr 5 14:19:58 2010
+++ packages/varnish/varnish.init Mon Apr 5 18:28:00 2010
@@ -29,13 +29,19 @@
PIDFILE=/var/run/varnishd.pid
+# import some env from parent process
+if [ -f /proc/$PPID/environ ]; then
+ eval $(tr '\0' '\n' < /proc/$PPID/environ | grep -E '^(USER|SUDO_USER|LOGNAME)')
+ LOGNAME=${SUDO_USER:-${LOGNAME:-$USER}}
+fi
+
# Generate a label, prefixed with the caller's username, from the
# kernel random uuid generator, fallback to timestamp
if [ -f /proc/sys/kernel/random/uuid ]; then
read uuid < /proc/sys/kernel/random/uuid
- vcl_label="${LOGNAME}${LOGNAME:+:}${uuid}"
+ vcl_label="$(date +${LOGNAME}${LOGNAME:+:}%Y-%m-%d:%H.%M:${uuid})"
else
- vcl_label="$($date +${LOGNAME}${LOGNAME:+:}%s.%N)"
+ vcl_label="$(date +${LOGNAME}${LOGNAME:+:}%s.%N)"
fi
varnishadm() {
================================================================
---- CVS-web:
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/varnish/varnish.init?r1=1.17&r2=1.18&f=u
More information about the pld-cvs-commit
mailing list