diff options
author | Alexey Neyman <stilor@att.net> | 2018-11-01 23:19:12 -0700 |
---|---|---|
committer | Alexey Neyman <stilor@att.net> | 2018-11-01 23:19:12 -0700 |
commit | d72f065e71931c7f95f08e394d320b235b523ee4 (patch) | |
tree | 5149e00fc73f66346e04beab16730e27f10348d0 | |
parent | 5958d54350a7ab4543db6a0c7627e35089a43b93 (diff) | |
download | crosstool-ng-d72f065e71931c7f95f08e394d320b235b523ee4.tar.gz crosstool-ng-d72f065e71931c7f95f08e394d320b235b523ee4.tar.bz2 crosstool-ng-d72f065e71931c7f95f08e394d320b235b523ee4.zip |
Check if .config is a regular file before clobbering it
Fixes #1014.
Signed-off-by: Alexey Neyman <stilor@att.net>
-rw-r--r-- | ct-ng.in | 15 | ||||
-rw-r--r-- | samples/samples.mk | 2 |
2 files changed, 10 insertions, 7 deletions
@@ -101,26 +101,29 @@ NCONF := $(CT_LIBEXEC_DIR)/nconf # TBD needed? We do supply the defconfig name explicitly below export srctree=$(CT_LIB_DIR) -.PHONY: menuconfig nconfig oldconfig savedefconfig defconfig +.PHONY: menuconfig nconfig oldconfig savedefconfig defconfig check-config -menuconfig: +check-config: + @[ ! -e .config -o -f .config ] || { echo ".config is not a regular file:"; ls -dl .config; exit 1; } >&2 + +menuconfig: check-config @$(CT_ECHO) " CONF $@" $(SILENT)$(MCONF) $(KCONFIG_TOP) -nconfig: +nconfig: check-config @$(CT_ECHO) " CONF $@" $(SILENT)$(NCONF) $(KCONFIG_TOP) -oldconfig: .config +oldconfig: .config check-config @$(CT_ECHO) " CONF $@" $(SILENT)$(sed) -i -r -f $(CT_LIB_DIR)/scripts/upgrade.sed $< $(SILENT)$(CONF) --silent$@ $(KCONFIG_TOP) -savedefconfig: .config +savedefconfig: .config check-config @$(CT_ECHO) ' GEN $@' $(SILENT)$(CONF) --savedefconfig=$${DEFCONFIG-defconfig} $(KCONFIG_TOP) -defconfig: +defconfig: check-config @$(CT_ECHO) ' CONF $@' $(SILENT)$(CONF) --defconfig=$${DEFCONFIG-defconfig} $(KCONFIG_TOP) diff --git a/samples/samples.mk b/samples/samples.mk index 7b356dd2..13f8779c 100644 --- a/samples/samples.mk +++ b/samples/samples.mk @@ -130,7 +130,7 @@ endef # How we do recall one sample PHONY += $(CT_SAMPLES) -$(CT_SAMPLES): +$(CT_SAMPLES): check-config @$(CT_ECHO) " CONF $@" $(SILENT)$(CONF) --defconfig=$(call sample_dir,$@)/crosstool.config $(KCONFIG_TOP) @echo |