mirror of https://github.com/vitalif/e2fsprogs
Compile the default mke2fs.conf into mke2fs program
People are getting surprised by mke2fs creating filesystems with different defaults than earlier versions of mke2fs if mke2fs.conf is not present. Having gotten two complaints about ramdisks getting created by with 4k blocksizes which then blow up when the ramdisk is mounted with a "Magic mismatch, very weird" error message from the kernel, let's fix this by making sure mke2fs has a built-in version of mke2fs.conf file. People can still override the built-in version of mke2fs.conf by editing /etc/mke2fs.conf, but this maintains the previous behavior. Addresses-Sourceforge-Bug: #1745818 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>bitmap-optimize
parent
6f890e516d
commit
d48bc60459
|
@ -29,7 +29,7 @@ LPROGS= @E2INITRD_PROG@
|
|||
|
||||
TUNE2FS_OBJS= tune2fs.o util.o
|
||||
MKLPF_OBJS= mklost+found.o
|
||||
MKE2FS_OBJS= mke2fs.o util.o profile.o prof_err.o
|
||||
MKE2FS_OBJS= mke2fs.o util.o profile.o prof_err.o default_profile.o
|
||||
CHATTR_OBJS= chattr.o
|
||||
LSATTR_OBJS= lsattr.o
|
||||
UUIDGEN_OBJS= uuidgen.o
|
||||
|
@ -74,6 +74,10 @@ prof_err.c prof_err.h: $(srcdir)/../e2fsck/prof_err.et
|
|||
@echo " COMPILE_ET prof_err.et"
|
||||
@$(COMPILE_ET) $(srcdir)/../e2fsck/prof_err.et
|
||||
|
||||
default_profile.c: $(srcdir)/mke2fs.conf $(srcdir)/profile-to-c.awk
|
||||
@echo " PROFILE_TO_C mke2fs.conf"
|
||||
$(AWK) -f $(srcdir)/profile-to-c.awk < $(srcdir)/mke2fs.conf \
|
||||
> default_profile.c
|
||||
profile.o:
|
||||
@echo " CC $<"
|
||||
@$(CC) -c $(ALL_CFLAGS) $(srcdir)/../e2fsck/profile.c -o $@
|
||||
|
@ -351,7 +355,8 @@ clean:
|
|||
$(RM) -f $(SPROGS) $(USPROGS) $(UPROGS) $(UMANPAGES) $(SMANPAGES) \
|
||||
$(FMANPAGES) \
|
||||
base_device base_device.out mke2fs.static filefrag \
|
||||
e2initrd_helper partinfo prof_err.[ch] \#* *.s *.o *.a *~ core
|
||||
e2initrd_helper partinfo prof_err.[ch] default_profile.c \
|
||||
\#* *.s *.o *.a *~ core
|
||||
|
||||
mostlyclean: clean
|
||||
distclean: clean
|
||||
|
|
|
@ -900,6 +900,9 @@ static void edit_feature(const char *str, __u32 *compat_array)
|
|||
}
|
||||
}
|
||||
|
||||
extern const char *mke2fs_default_profile;
|
||||
static const char *default_files[] = { "<default>", 0 };
|
||||
|
||||
static void PRS(int argc, char *argv[])
|
||||
{
|
||||
int b, c;
|
||||
|
@ -958,7 +961,11 @@ static void PRS(int argc, char *argv[])
|
|||
if ((tmp = getenv("MKE2FS_CONFIG")) != NULL)
|
||||
config_fn[0] = tmp;
|
||||
profile_set_syntax_err_cb(syntax_err_report);
|
||||
profile_init(config_fn, &profile);
|
||||
retval = profile_init(config_fn, &profile);
|
||||
if (retval == ENOENT) {
|
||||
profile_init(default_files, &profile);
|
||||
profile_set_default(profile, mke2fs_default_profile);
|
||||
}
|
||||
|
||||
setbuf(stdout, NULL);
|
||||
setbuf(stderr, NULL);
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/awk
|
||||
BEGIN {
|
||||
printf("const char *mke2fs_default_profile = \n");
|
||||
}
|
||||
|
||||
{
|
||||
printf(" \"%s\\n\"\n", $0);
|
||||
}
|
||||
|
||||
END {
|
||||
printf(";\n", str)
|
||||
}
|
Loading…
Reference in New Issue