@@ -21,6 +21,7 @@ libdir = @libdir@
datadir= @datadir@
localedir = $(datadir)/locale
root_sysconfdir= @root_sysconfdir@
+confdir= @confdir@
includedir = @includedir@
mandir = @mandir@
man1dir = $(mandir)/man1
@@ -1268,11 +1268,13 @@ if test "$sysconfdir" != '${prefix}/etc'; then
root_sysconfdir=$sysconfdir
AC_MSG_RESULT([Setting root_sysconfdir to $root_sysconfdir])
fi
+confdir=$datadir/defaults/e2fsprogs
AC_SUBST(root_prefix)
AC_SUBST(root_bindir)
AC_SUBST(root_sbindir)
AC_SUBST(root_libdir)
AC_SUBST(root_sysconfdir)
+AC_SUBST(confdir)
dnl
dnl Allow specification of the multiarch arch
dnl
@@ -755,6 +755,7 @@ static void syntax_err_report(const char *filename, long err, int line_num)
}
static const char *config_fn[] = { ROOT_SYSCONFDIR "/e2fsck.conf", 0 };
+static const char *config_default_fn[] = { DEFAULT_CONFDIR "e2fsck.conf", 0};
static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx)
{
@@ -996,8 +997,9 @@ static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx)
if ((cp = getenv("E2FSCK_CONFIG")) != NULL)
config_fn[0] = cp;
profile_set_syntax_err_cb(syntax_err_report);
- profile_init(config_fn, &ctx->profile);
-
+ retval = profile_init(config_fn, &ctx->profile);
+ if (retval == ENOENT)
+ retval = profile_init(config_default_fn, &ctx->profile);
profile_get_boolean(ctx->profile, "options", "report_time", 0, 0,
&c);
if (c)
@@ -71,10 +71,10 @@ clean::
-rmdir doc
install: ext2ed
- install -d $(root_sysconfdir)
+ install -d $(confdir)
install -m 755 ext2ed $(sbindir)
install -m 644 $(srcdir)/ext2.descriptors $(datadir)
- install -m 644 ext2ed.conf $(root_sysconfdir)
+ install -m 644 ext2ed.conf $(confdir)
install -m 644 ext2ed.8 $(man8dir)
# +++ Dependency line eater +++
@@ -8,3 +8,6 @@
/* Where to find the mke2fs.conf and e2fsck.conf files */
#define ROOT_SYSCONFDIR "@root_sysconfdir@"
+
+/* Where to find the default mke2fs.conf and e2fsck.conf files */
+#define DEFAULT_CONFDIR "@datadir@/defaults/e2fsprogs"
@@ -486,12 +486,12 @@ filefrag.8: $(DEP_SUBSTITUTE) $(srcdir)/filefrag.8.in
$(Q) $(SUBSTITUTE_UPTIME) $(srcdir)/filefrag.8.in filefrag.8
installdirs:
- $(E) " MKINSTALLDIRS $(sbindir) $(root_sbindir) $(bindir) $(man1dir) $(man8dir) $(libdir) $(root_sysconfdir)"
+ $(E) " MKINSTALLDIRS $(sbindir) $(root_sbindir) $(bindir) $(man1dir) $(man8dir) $(libdir) $(confdir)"
$(Q) $(MKINSTALLDIRS) $(DESTDIR)$(sbindir) \
$(DESTDIR)$(root_sbindir) $(DESTDIR)$(bindir) \
$(DESTDIR)$(man1dir) $(DESTDIR)$(man8dir) \
$(DESTDIR)$(man1dir) $(DESTDIR)$(man5dir) \
- $(DESTDIR)$(libdir) $(DESTDIR)/$(root_sysconfdir)
+ $(DESTDIR)$(libdir) $(DESTDIR)/$(confdir)
install: all $(SMANPAGES) $(UMANPAGES) installdirs
$(Q) for i in $(SPROGS); do \
@@ -555,33 +555,33 @@ install: all $(SMANPAGES) $(UMANPAGES) installdirs
(cd $(DESTDIR)$(man5dir); \
$(LN) $(LINK_INSTALL_FLAGS) ext4.5 $$i.5); \
done
- $(Q) if test -f $(DESTDIR)$(root_sysconfdir)/mke2fs.conf; then \
- if cmp -s $(DESTDIR)$(root_sysconfdir)/mke2fs.conf \
+ $(Q) if test -f $(DESTDIR)$(confdir)/mke2fs.conf; then \
+ if cmp -s $(DESTDIR)$(confdir)/mke2fs.conf \
mke2fs.conf; then \
true; \
else \
- if grep -q ext4dev $(DESTDIR)$(root_sysconfdir)/mke2fs.conf ; then \
- $(ES) " INSTALL_DATA $(root_sysconfdir)/mke2fs.conf.e2fsprogs-new"; \
+ if grep -q ext4dev $(DESTDIR)$(confdir)/mke2fs.conf ; then \
+ $(ES) " INSTALL_DATA $(confdir)/mke2fs.conf.e2fsprogs-new"; \
$(INSTALL_DATA) mke2fs.conf \
- $(DESTDIR)$(root_sysconfdir)/mke2fs.conf.e2fsprogs-new; \
- echo "Warning: installing mke2fs.conf in $(DESTDIR)$(root_sysconfdir)/mke2fs.conf.e2fsprogs-new"; \
- echo "Check to see if you need to update your $(root_sysconfdir)/mke2fs.conf"; \
+ $(DESTDIR)$(confdir)/mke2fs.conf.e2fsprogs-new; \
+ echo "Warning: installing mke2fs.conf in $(DESTDIR)$(confdir)/mke2fs.conf.e2fsprogs-new"; \
+ echo "Check to see if you need to update your $(confdir)/mke2fs.conf"; \
else \
- $(ES) " INSTALL_DATA $(root_sysconfdir)/mke2fs.conf"; \
- mv $(DESTDIR)$(root_sysconfdir)/mke2fs.conf \
- $(DESTDIR)$(root_sysconfdir)/mke2fs.conf.e2fsprogs-old; \
+ $(ES) " INSTALL_DATA $(confdir)/mke2fs.conf"; \
+ mv $(DESTDIR)$(confdir)/mke2fs.conf \
+ $(DESTDIR)$(confdir)/mke2fs.conf.e2fsprogs-old; \
$(INSTALL_DATA) mke2fs.conf \
- $(DESTDIR)$(root_sysconfdir)/mke2fs.conf; \
+ $(DESTDIR)$(confdir)/mke2fs.conf; \
echo "Your mke2fs.conf is too old. Backing up old version in"; \
- echo "$(DESTDIR)$(root_sysconfdir)/mke2fs.conf.e2fsprogs-old. Please check to see"; \
+ echo "$(DESTDIR)$(confdir)/mke2fs.conf.e2fsprogs-old. Please check to see"; \
echo "if you have any local customizations that you wish to preserve."; \
fi; \
echo " "; \
fi; \
else \
- $(ES) " INSTALL_DATA $(root_sysconfdir)/mke2fs.conf"; \
+ $(ES) " INSTALL_DATA $(confdir)/mke2fs.conf"; \
$(INSTALL_DATA) mke2fs.conf \
- $(DESTDIR)$(root_sysconfdir)/mke2fs.conf; \
+ $(DESTDIR)$(confdir)/mke2fs.conf; \
fi
install-strip: install
@@ -636,8 +636,8 @@ uninstall:
$(ES) " LINK $$i.5"; \
$(RM) -f $(DESTDIR)$(man5dir)/$$i.5; \
done
- if cmp -s mke2fs.conf $(DESTDIR)/$(root_sysconfdir)/mke2fs.conf; then \
- $(RM) $(DESTDIR)/$(root_sysconfdir)/mke2fs.conf; \
+ if cmp -s mke2fs.conf $(DESTDIR)/$(confdir)/mke2fs.conf; then \
+ $(RM) $(DESTDIR)/$(confdir)/mke2fs.conf; \
fi
clean::
@@ -1104,6 +1104,7 @@ static void syntax_err_report(const char *filename, long err, int line_num)
}
static const char *config_fn[] = { ROOT_SYSCONFDIR "/mke2fs.conf", 0 };
+static const char *config_default_fn[] = { DEFAULT_CONFDIR "/mke2fs.conf", 0};
static void edit_feature(const char *str, __u32 *compat_array)
{
@@ -1521,6 +1522,9 @@ static void PRS(int argc, char *argv[])
profile_set_syntax_err_cb(syntax_err_report);
retval = profile_init(config_fn, &profile);
if (retval == ENOENT) {
+ retval = profile_init(config_default_fn, &profile);
+ }
+ if (retval == ENOENT) {
retval = profile_init(default_files, &profile);
if (retval)
goto profile_error;
@@ -12,6 +12,7 @@ SIZEOF_SHORT @SIZEOF_SHORT@
datarootdir @datarootdir@
datadir @datadir@
root_sysconfdir @root_sysconfdir@
+confdir @confdir@
$datarootdir @datarootdir@
$root_prefix @root_prefix@
$prefix @prefix@
With this change, distribution defaults are now read from the distribution defaults directory, /usr/share/defaults/e2fsprogs. These files are expected to be the sensible defaults required for basic operation. Site administrators may still override the default configuration by placing the files within the site config directory (i.e. /etc) - and those configuration values will be read instead. The distribution files within the defaults directory are percieved as immutable, and as such resiliant to upgrades over time. A side effect of this stateless configuration is that a site admiministrator is able to reset their configuration to the sane defaults by simply removing the files they placed within the site configuration directory. To users already making use of an altered configuration within /etc, this change is transparent and does not affect existing operation. The fundamental goal within this change, and stateless itself, is to separate OS configuration from the system administrator configuration. Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com> --- MCONFIG.in | 1 + configure.in | 2 ++ e2fsck/unix.c | 6 ++++-- ext2ed/Makefile.in | 4 ++-- lib/dirpaths.h.in | 3 +++ misc/Makefile.in | 36 ++++++++++++++++++------------------ misc/mke2fs.c | 4 ++++ util/subst.conf.in | 1 + 8 files changed, 35 insertions(+), 22 deletions(-)