Revision 6e3bf290

b/.gitignore
23 23
/autotools/missing
24 24
/autotools/py-compile
25 25
/autotools/replace_vars.sed
26
/autotools/shell-env-init
26 27
/config.log
27 28
/config.status
28 29
/configure
b/Makefile.am
31 31
REPLACE_VARS_SED = autotools/replace_vars.sed
32 32
CONVERT_CONSTANTS = $(top_srcdir)/autotools/convert-constants
33 33
BUILD_RPC = $(top_srcdir)/autotools/build-rpc
34
SHELL_ENV_INIT = autotools/shell-env-init
34 35

  
35 36
# Note: these are automake-specific variables, and must be named after
36 37
# the directory + 'dir' suffix
......
150 151
	$(PYTHON_BOOTSTRAP) \
151 152
	epydoc.conf \
152 153
	$(REPLACE_VARS_SED) \
154
	$(SHELL_ENV_INIT) \
153 155
	daemons/daemon-util \
154 156
	daemons/ganeti-cleaner \
155 157
	devel/upload \
......
1271 1273
lib/_generated_rpc.py: lib/rpc_defs.py $(BUILD_RPC)
1272 1274
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_RPC) lib/rpc_defs.py > $@
1273 1275

  
1274
$(REPLACE_VARS_SED): Makefile stamp-directories
1276
$(SHELL_ENV_INIT): Makefile stamp-directories
1277
	set -e; \
1278
	{ echo '# Allow overriding for tests'; \
1279
	  echo 'readonly LOCALSTATEDIR=$${LOCALSTATEDIR:-$${GANETI_ROOTDIR:-}$(localstatedir)}'; \
1280
	  echo 'readonly SYSCONFDIR=$${SYSCONFDIR:-$${GANETI_ROOTDIR:-}$(sysconfdir)}'; \
1281
	  echo; \
1282
	  echo 'readonly PKGLIBDIR=$(pkglibdir)'; \
1283
	  echo 'readonly LOG_DIR="$$LOCALSTATEDIR/log/ganeti"'; \
1284
	  echo 'readonly RUN_DIR="$$LOCALSTATEDIR/run/ganeti"'; \
1285
	  echo 'readonly DATA_DIR="$$LOCALSTATEDIR/lib/ganeti"'; \
1286
	  echo 'readonly CONF_DIR="$$SYSCONFDIR/ganeti"'; \
1287
	} > $@
1288

  
1289
$(REPLACE_VARS_SED): $(SHELL_ENV_INIT) Makefile stamp-directories
1275 1290
	set -e; \
1276 1291
	{ echo 's#@PREFIX@#$(prefix)#g'; \
1277 1292
	  echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
......
1299 1314
	  echo 's#@CUSTOM_ENABLE_CONFD@#$(ENABLE_CONFD)#g'; \
1300 1315
	  echo 's#@MODULES@#$(strip $(lint_python_code))#g'; \
1301 1316
	  echo 's#@ENABLE_SPLIT_QUERY@#$(ENABLE_SPLIT_QUERY)#g'; \
1317
	  echo; \
1318
	  echo '/^@SHELL_ENV_INIT@$$/ {'; \
1319
	  echo '  r $(SHELL_ENV_INIT)'; \
1320
	  echo '  d'; \
1321
	  echo '}'; \
1302 1322
	} > $@
1303 1323

  
1304 1324
# Using deferred evaluation
b/daemons/daemon-util.in
20 20

  
21 21
set -e
22 22

  
23
readonly defaults_file="${GANETI_ROOTDIR}@SYSCONFDIR@/default/ganeti"
24
readonly localstatedir="${GANETI_ROOTDIR}@LOCALSTATEDIR@"
23
@SHELL_ENV_INIT@
24

  
25
readonly defaults_file="$SYSCONFDIR/default/ganeti"
25 26

  
26 27
# This is a list of all daemons and the order in which they're started. The
27 28
# order is important as there are dependencies between them. On shutdown,
......
57 58
}
58 59

  
59 60
_daemon_pidfile() {
60
  echo "$localstatedir/run/ganeti/$1.pid"
61
  echo "$RUN_DIR/$1.pid"
61 62
}
62 63

  
63 64
_daemon_executable() {
......
86 87

  
87 88
# Checks whether the local machine is part of a cluster
88 89
check_config() {
89
  local server_pem=$localstatedir/lib/ganeti/server.pem
90
  local server_pem=$DATA_DIR/server.pem
90 91
  local fname
91 92

  
92 93
  for fname in $server_pem; do
b/daemons/ganeti-cleaner.in
1 1
#!/bin/bash
2 2
#
3 3

  
4
# Copyright (C) 2009, 2010, 2011 Google Inc.
4
# Copyright (C) 2009, 2010, 2011, 2012 Google Inc.
5 5
#
6 6
# This program is free software; you can redistribute it and/or modify
7 7
# it under the terms of the GNU General Public License as published by
......
18 18
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 19
# 02110-1301, USA.
20 20

  
21
set -e
21
set -e -u
22

  
23
@SHELL_ENV_INIT@
24

  
25
# Overridden by unittest
26
: ${CHECK_CERT_EXPIRED:=$PKGLIBDIR/check-cert-expired}
27

  
28
readonly CLEANER_LOG_DIR=$LOG_DIR/cleaner
29
readonly QUEUE_ARCHIVE_DIR=$DATA_DIR/queue/archive
30
readonly CRYPTO_DIR=$RUN_DIR/crypto
22 31

  
23 32
in_cluster() {
24 33
  [[ -e $DATA_DIR/ssconf_master_node ]]
......
60 69
  xargs -r0 rm -vf
61 70
}
62 71

  
63
# Overridden by unittest
64
: ${LOCALSTATEDIR:=@LOCALSTATEDIR@}
65
: ${CHECK_CERT_EXPIRED:=@PKGLIBDIR@/check-cert-expired}
66

  
67
DATA_DIR=$LOCALSTATEDIR/lib/ganeti
68
CLEANER_LOG_DIR=$LOCALSTATEDIR/log/ganeti/cleaner
69
QUEUE_ARCHIVE_DIR=$DATA_DIR/queue/archive
70
CRYPTO_DIR=$LOCALSTATEDIR/run/ganeti/crypto
71

  
72 72
# Define how many days archived jobs should be left alone
73 73
REMOVE_AFTER=21
74 74

  
b/tools/kvm-ifup.in
18 18
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 19
# 02110-1301, USA.
20 20

  
21
@SHELL_ENV_INIT@
22

  
21 23
if [ -z "$INTERFACE" ]; then
22 24
  echo "No network interface specified"
23 25
  exit 1
......
29 31
fi
30 32

  
31 33
# Execute the user-supplied network script, if applicable
32
if [ -x "@SYSCONFDIR@/ganeti/kvm-vif-bridge" ]; then
33
  exec @SYSCONFDIR@/ganeti/kvm-vif-bridge
34
if [ -x "$CONF_DIR/kvm-vif-bridge" ]; then
35
  exec $CONF_DIR/kvm-vif-bridge
34 36
fi
35 37

  
36 38
if [ "$MODE" = "bridged" ]; then

Also available in: Unified diff