~xnox/ubuntu/vivid/upstart/fix-rotate-logs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
/* upstart
 *
 * Copyright © 2010-2011 Canonical Ltd.
 * Author: Scott James Remnant <scott@netsplit.com>.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2, as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

#ifndef INIT_PATHS_H
#define INIT_PATHS_H

/**
 * PATH:
 *
 * This is the default PATH set by the init process itself.
 **/
#ifndef PATH
#define _PATH "/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin"
#ifdef EXTRA_PATH
#define PATH _PATH ":" EXTRA_PATH
#else
#define PATH _PATH
#endif
#endif


/**
 * CONSOLE:
 *
 * This is the console device we give to processes that want one.
 **/
#ifndef CONSOLE
#define CONSOLE "/dev/console"
#endif

/**
 * DEV_NULL:
 *
 * This is the console device we give to processes that do not want any
 * console.
 **/
#ifndef DEV_NULL
#define DEV_NULL "/dev/null"
#endif


/**
 * CONFFILE:
 *
 * Init daemon configuration file.
 **/
#ifndef CONFFILE
#define CONFFILE "/etc/init.conf"
#endif

/**
 * CONFDIR:
 *
 * Default top-level directory of the system configuration files.
 **/
#ifndef CONFDIR
#define CONFDIR "/etc/init"
#endif

/**
 * USERCONFDIR:
 *
 * Sub-directory of user's home directory for their jobs.
 **/
#ifndef USERCONFDIR
#define USERCONFDIR ".init"
#endif


/**
 * CONFDIR_ENV:
 *
 * If this environment variable is set, read configuration files
 * from the location specified, rather than CONFDIR.
 *
 * Value is expected to be the full path to an alternative job
 * configuration directory.
 **/
#ifndef CONFDIR_ENV
#define CONFDIR_ENV "UPSTART_CONFDIR"
#endif

/**
 * STATE_FILE_ENV:
 *
 * If set, write STATE_FILE on any re-exec.
 **/
#ifndef STATE_FILE_ENV
#define STATE_FILE_ENV "UPSTART_WRITE_STATEFILE"
#endif

/**
 * INIT_XDG_SUBDIR:
 *
 * This is the name of the sub folder we will use when constructing
 * config source dirs with XDG compliant folders.
 **/
#ifndef INIT_XDG_SUBDIR
#define INIT_XDG_SUBDIR "upstart"
#endif

/**
 * SYSTEM_USERCONFDIR:
 *
 * This is the path to system-wide user session jobs.
 **/
#ifndef SYSTEM_USERCONFDIR
#define SYSTEM_USERCONFDIR "/usr/share/upstart/sessions"
#endif

/**
 * INIT_XDG_SESSION_SUBDIR:
 *
 * Directory below XDG_RUNTIME_DIR/INIT_XDG_SUBDIR used to
 * store session details.
 **/
#ifndef INIT_XDG_SESSION_SUBDIR
#define INIT_XDG_SESSION_SUBDIR "sessions"
#endif

/**
 * SHELL:
 *
 * This is the shell binary used whenever we need special processing for
 * a command or when we need to run a script.
 **/
#ifndef SHELL
#define SHELL "/bin/sh"
#endif

/**
 * SBINDIR:
 *
 * Directory containing system binaries.
 **/
#ifndef SBINDIR
#define SBINDIR "/sbin"
#endif

/**
 * TELINIT:
 *
 * This is the telinit binary used when init is executed as an ordinary
 * process.
 **/
#ifndef TELINIT
#define TELINIT SBINDIR "/telinit"
#endif

/**
 * JOB_LOGDIR:
 *
 * Directory that jobs which specify CONSOLE_LOG will have their output
 * logged to.
 *
 **/
#ifndef JOB_LOGDIR
#define JOB_LOGDIR "/var/log/upstart"
#endif

/**
 * LOGDIR_ENV:
 *
 * Environment variable that if set specifies an alternative directory
 * to JOB_LOGDIR to write log files to.
 *
 **/
#ifndef LOGDIR_ENV
#define LOGDIR_ENV "UPSTART_LOGDIR" 
#endif

/**
 * SESSION_ENV:
 *
 * Environment variable that is set when running as a Session Init.
 **/
#ifndef SESSION_ENV
#define SESSION_ENV "UPSTART_SESSION"
#endif

/**
 * CONF_EXT_STD:
 *
 * File extension for standard configuration files.
 **/
#define CONF_EXT_STD ".conf"

/**
 * CONF_EXT_OVERRIDE:
 *
 * File extension for override files.
 *
 * Note that override files are not stored in the ConfSource 'files' hash:
 * all JobClass information from override files is added to the JobClass for
 * the corresponding (CONF_EXT_STD) object.
 **/
#define CONF_EXT_OVERRIDE ".override"

/**
 * SESSION_EXT:
 *
 * File extension for session files.
 **/
#ifndef SESSION_EXT
#define SESSION_EXT ".session"
#endif

/**
 * Determine if specified path extension representes a standard
 * configuration file.
 *
 * @period: pointer to last period in path to check.
 *
 * Returns 1 if specified path extension matches that for a
 * standard configuration file, else return 0.
 **/
#define IS_CONF_EXT_STD(period) \
	(!strcmp (period, CONF_EXT_STD))

/**
 * Determine if specified path extension representes an
 * override file.
 *
 * @period: pointer to last period in path to check.
 *
 * Returns 1 if specified path extension matches that for
 * an override file, else return 0.
 **/
#define IS_CONF_EXT_OVERRIDE(period) \
	(!strcmp (period, CONF_EXT_OVERRIDE))

/**
 * Determine if specified filename has a valid configuration
 * file name extension.
 *
 * @period: pointer to last period in filename.
 *
 * Returns: TRUE if extension beyond @period is one of the
 * recognized types, else FALSE.
 **/
#define IS_CONF_EXT(period) \
	(IS_CONF_EXT_STD(period) || \
	 IS_CONF_EXT_OVERRIDE(period))

#endif /* INIT_PATHS_H */