build-sys: Make dirs writable on rootfs creation
authorLucas De Marchi <lucas.demarchi@profusion.mobi>
Tue, 19 Jun 2012 16:09:23 +0000 (13:09 -0300)
committerLucas De Marchi <lucas.demarchi@profusion.mobi>
Tue, 19 Jun 2012 16:27:56 +0000 (13:27 -0300)
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
testsuite/init_module.c

index 7bfa8f1..d681118 100644 (file)
@@ -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
 
index 6db0d17..814998a 100644 (file)
@@ -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"));