It was initially introduced in the commit:
> commit 7d422b7878
> Author: Victor Seva <vseva@sipwise.com>
> Date: Fri Aug 22 17:03:39 2014 +0200
>
> MT#8763 check for .git before running the services
>
> On a multi directory config, the services depends on git. Check
> first if the git repository exists and warn about it
The subshell here was necessary to isolate 'cd $dir' call.
In the same time the "proper" bash way is to use pushd/popd.
For the history, 'shellcheck disable' was muting the warning:
> This only exits the subshell caused by the (..) group. [SC2106]
Change-Id: I3546fa9615858dbbc4c0f91d74de003e22837d55
Previously 'systemd daemon-reload' and 'systemctl preset-all'
were executed only if changes detected in configs.
Otherwise the early exit happened if no .service files were triggered:
> DEBUG: No services file(s) reported - nothing to do.
Move the code into the function systed_daemon_reload_preset and
execute it on the top of the script. Also print info message
informing users about reloaded systemd and newly preset units.
It should provide better visibility here.
Change-Id: I992af9fb274ea93a37b812a51cebcd7af5c54133
Otherwise the code in between the functions can be easily missed
which cause issues as described in the ticket and will be fixed
in the following commit.
Change-Id: I57decfcbcd41691d35d085b13881e1e6b5208f6e
This will collect all service actions, synthetize them into their
minimal expression and execute them in a single batch per action.
Change-Id: I950d5db32e0ec6327964faac4ce8f15449f90e90
Remove any stale .wants/ relationships as systemd does not always seem
to be able to cleanup those by itself. This makes sure we always start
from a clean slate.
Change-Id: I1b241d4530c45658b7245cdbca33e34dde5beaf6
Under systemd we need to issue "daemon-reload" after applying
templates, to avoid spurious warnings when adding/changing/removing
systemd unit files.
Change-Id: Ifd474bec25b94ee9cb1c247b1390103a29c7b7b3
A random order of service restarts might not work because
a service might depend on specific monit resource(s).
Therefore restart monit before any other service(s).
Change-Id: If6eae434014f00a76fdd66aac8c82dfd69b86f1b
On a multi directory config, the services depends on git. Check
first if the git repository exists and warn about it
Change-Id: I52e335c85ecf4a330da44b3088725623f3c04531
`git diff-index --name-only HEAD` was used because it was the
only reasonable way to check for modified files back in Git 1.5.
Sadly this command can't detect files that didn't exist inside
the Git repository at all yet (so if a file was generated for the
very first time the according services script wasn't executed
necessarily).
Instead nowadays we can rely on `git status --porcelain`, which
wasn't available in Git 1.5 back then yet. Even in Debian/squeeze
there's Git version 1.7.2.5-3 available, so it's save to depend
on it. Updated Git package dependency accordingly, also switch
from transitional git-core package to the actual git one.
Tested-by: Alexander Lutay <alutay@sipwise.com>