From 33202e84f344794b1ae261874883874a2c15dc80 Mon Sep 17 00:00:00 2001 From: Lucas De Marchi Date: Tue, 19 Jun 2012 13:09:23 -0300 Subject: [PATCH] build-sys: Make dirs writable on rootfs creation Autofoo make the dist dir as readonly. If we copy it, tools needing to create sysfs entries will not be able to do so, because they can't create the needed directories/files. It would be much better if autofoo allowed to let the files as is instead of converting them to read-only. --- Makefile.am | 4 ++-- testsuite/init_module.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index 7bfa8f1c..d681118c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -127,7 +127,8 @@ ROOTFS = testsuite/rootfs ROOTFS_PRISTINE = $(top_srcdir)/testsuite/rootfs-pristine CREATE_ROOTFS = $(AM_V_GEN) ( $(RM) -rf $(ROOTFS) && \ cp -r $(ROOTFS_PRISTINE) $(ROOTFS) && \ - touch testsuite/stamp-rootfs ) + touch testsuite/stamp-rootfs && \ + find $(ROOTFS) -type d -exec chmod +w {} \; ) rootfs: $(CREATE_ROOTFS) @@ -193,7 +194,6 @@ testsuite_test_dependencies_LDADD = $(TESTSUITE_LDADD) testsuite_test_dependencies_CPPFLAGS = $(TESTSUITE_CPPFLAGS) testsuite-distclean: - -find $(ROOTFS) -type d -exec chmod +w {} \; -$(RM) -rf $(ROOTFS) -$(RM) testsuite/stamp-rootfs diff --git a/testsuite/init_module.c b/testsuite/init_module.c index 6db0d17e..814998aa 100644 --- a/testsuite/init_module.c +++ b/testsuite/init_module.c @@ -147,7 +147,7 @@ static int create_sysfs_files(const char *modname) strcpy(buf + len, modname); len += strlen(modname); - mkdir_p(buf, 0755); + assert(mkdir_p(buf, 0755) >= 0); strcpy(buf + len, "/initstate"); return write_one_line_file(buf, "live\n", strlen("live\n")); -- 2.47.2