MT#7577 services: check for newly added config files

`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.
mprokop/7577_services
Michael Prokop 12 years ago
parent 409f1f2c58
commit 7b489ed25d

2
debian/control vendored

@ -26,7 +26,7 @@ Package: ngcp-ngcpcfg
Architecture: all
Depends: etckeeper,
file,
git-core,
git (>= 1:1.7.2.5-3~),
libdata-validate-ip-perl,
libdbd-mysql-perl,
libdbi-perl,

@ -42,18 +42,7 @@ unifyer() {
fi
}
# NOTES:
# * 'git ls-files -o' also shows ignored files
# * 'git status --porcelain |grep '^?? ' not available in git 1.5
# The 'git diff' command fixes a strange race condition where 'git diff-index'
# lists *all* generated file(s) where the time stamp differs, resulting in a
# list of *all* generated files (which is not what we want).
# After running 'git diff' the following 'git diff-index ...' command lists
# only the modified files as we want and need it. See BTS #211 for bugreport.
git diff &>/dev/null
for file in $(git diff-index --name-only HEAD) ; do
for file in $(git status --porcelain | sed 's/^...//') ; do
if [ -r "$file" ] && [ -r "${SERVICES_POOL}/${file}".services ] ; then
log_debug "unifyer ${SERVICES_POOL}/${file}.services"
unifyer "${SERVICES_POOL}/${file}".services

Loading…
Cancel
Save