Right, it does sound like we need a '--prepend-confdir' option instead:
# read jobs+overrides from /foo, then /etc/init/ (PID 1)
--prepend-confdir /foo
# read jobs+overrides from /foo, then /bar, then /etc/init/ (PID 1)
--prepend-confdir /foo --prepend-confdir /bar
# read jobs+overrides from /foo, then /bar, then /hello
--confdir /hello --prepend-confdir /foo --prepend-confdir /bar
# read jobs+overrides from /bar, then /qux, then /foo, then /bar (PID 1)
--confdir /foo --prepend-confdir /bar --confdir /baz --prepend-confdir /qux
# read jobs+overrides from /bar, then /qux, then the normal Session Init directories
--user --prepend-confdir /bar --prepend-confdir /qux
# read jobs+overrides from /bar, then /qux, then /foo, then /baz
--user --confdir /foo --prepend-confdir /bar --confdir /baz --prepend-confdir /qux
When booting in --debug mode, Upstart will display the directories it is reading jobs from in the order it reads those directories. However, I do wonder if -- to mimimize confusion -- we should add a further option that simply displays the list of directories that would be searched. If that option is specified anywhere on the command line, it would display the search order, then exit. Something like:
Right, it does sound like we need a '--prepend-confdir' option instead:
# read jobs+overrides from /foo, then /etc/init/ (PID 1)
--prepend-confdir /foo
# read jobs+overrides from /foo, then /bar, then /etc/init/ (PID 1)
--prepend-confdir /foo --prepend-confdir /bar
# read jobs+overrides from /foo, then /bar, then /hello
--confdir /hello --prepend-confdir /foo --prepend-confdir /bar
# read jobs+overrides from /bar, then /qux, then /foo, then /bar (PID 1)
--confdir /foo --prepend-confdir /bar --confdir /baz --prepend-confdir /qux
# read jobs+overrides from /bar, then /qux, then the normal Session Init directories
--user --prepend-confdir /bar --prepend-confdir /qux
# read jobs+overrides from /bar, then /qux, then /foo, then /baz
--user --confdir /foo --prepend-confdir /bar --confdir /baz --prepend-confdir /qux
When booting in --debug mode, Upstart will display the directories it is reading jobs from in the order it reads those directories. However, I do wonder if -- to mimimize confusion -- we should add a further option that simply displays the list of directories that would be searched. If that option is specified anywhere on the command line, it would display the search order, then exit. Something like:
$ init --prepend-confdir /foo --list-confdirs
/foo
/etc/init
$ init --user --confdir /foo --prepend-confdir /bar --confdir /baz --prepend-confdir /qux --list-confdirs
/bar
/qux
/foo
/baz