Skip to content

Commit 260f8a5

Browse files
committed
nhc: Activate lazy creation of /etc/nhc/sysconfig
The new fallback for "/etc/sysconfig" is a directly which will rarely be needed, but if/when it *is* necessary, this change allows NHC to create the directory lazily on the fly. And by adding that directory as a `%ghost` to the spec file, we ensure that RPM will handle it correctly if and when necessary.
1 parent b376272 commit 260f8a5

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

Makefile.am

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ EXTRA_DIST = COPYING ChangeLog LICENSE autogen.sh nhc.logrotate \
2323
nhc-test.conf lbnl-nhc.spec contrib/nhc.cron
2424

2525
install-data-local:
26-
$(MKDIR_P) '$(DESTDIR)$(logrotatedir)' '$(DESTDIR)$(localstatedir)/lib/nhc' '$(DESTDIR)$(localstatedir)/run/nhc'
26+
$(MKDIR_P) '$(DESTDIR)$(logrotatedir)' '$(DESTDIR)$(localstatedir)/lib/nhc' \
27+
'$(DESTDIR)$(localstatedir)/run/nhc' '$(DESTDIR)$(confdir)/sysconfig'
2728
$(INSTALL_DATA) $(srcdir)/nhc.logrotate '$(DESTDIR)$(logrotatedir)/nhc'
2829

2930
uninstall-local:

lbnl-nhc.spec.in

+1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ test "$RPM_BUILD_ROOT" != "/" && %{__rm} -rf $RPM_BUILD_ROOT
7575
%dir %{_localstatedir}/run/%{sname}/
7676
%dir %{nhc_script_dir}/
7777
%dir %{nhc_helper_dir}/
78+
%ghost %dir %{_sysconfdir}/%{sname}/sysconfig/
7879
%config(noreplace) %{_sysconfdir}/%{sname}/%{sname}.conf
7980
%config(noreplace) %{_sysconfdir}/logrotate.d/%{sname}
8081
%config(noreplace) %{nhc_script_dir}/*.nhc

nhc

+3-4
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,9 @@ function nhcmain_init_env() {
191191
SYSCONFIGDIR="/etc/default"
192192
else
193193
SYSCONFIGDIR="/etc/nhc/sysconfig"
194-
# We could auto-create here, but that may cause RPM removal issues.
195-
#if [[ ! -d "${SYSCONFIGDIR}" ]]; then
196-
# mkdir -p -m 0700 "${SYSCONFIGDIR}" >&/dev/null
197-
#fi
194+
if [[ ! -d "${SYSCONFIGDIR}" ]]; then
195+
mkdir -p -m 0700 "${SYSCONFIGDIR}" >&/dev/null
196+
fi
198197
fi
199198
if [[ -d "/usr/libexec" ]]; then
200199
LIBEXECDIR="/usr/libexec"

0 commit comments

Comments
 (0)