Skip to content

Commit b077d8a

Browse files
committed
build: automate directory creation and default configuration install
This patch improves the 'make install' process by: 1. Creating the runstatedir (e.g., /usr/local/var/run) to ensure ksmbd.mountd can create its lock files. 2. Creating the sysconfdir (e.g., /usr/local/etc/ksmbd) and installing a default ksmbd.conf if one does not already exist. This prevents startup failures caused by missing runtime paths or the absence of a primary configuration file. Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
1 parent dc21489 commit b077d8a

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

Makefile.am

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,19 @@ CLEANFILES = $(man_MANS) $(systemdsystemunit_DATA)
2222

2323
AM_DISTCHECK_CONFIGURE_FLAGS = \
2424
--with-systemdsystemunitdir=$${dc_install_base}/$(systemdsystemunitdir)
25+
26+
# Create runtime and configuration directories, and install default config if missing.
27+
install-data-hook:
28+
$(MKDIR_P) $(DESTDIR)$(runstatedir)
29+
chmod 755 $(DESTDIR)$(runstatedir)
30+
$(MKDIR_P) $(DESTDIR)$(sysconfdir)/ksmbd
31+
@if test ! -f $(DESTDIR)$(sysconfdir)/ksmbd/ksmbd.conf; then \
32+
echo "Installing default ksmbd.conf to $(sysconfdir)/ksmbd/"; \
33+
$(INSTALL_DATA) $(srcdir)/ksmbd.conf.example $(DESTDIR)$(sysconfdir)/ksmbd/ksmbd.conf; \
34+
fi
35+
36+
# Remove installed configuration file during uninstall to pass distcheck.
37+
uninstall-hook:
38+
@if test -f $(DESTDIR)$(sysconfdir)/ksmbd/ksmbd.conf; then \
39+
rm -f $(DESTDIR)$(sysconfdir)/ksmbd/ksmbd.conf; \
40+
fi

0 commit comments

Comments
 (0)