Fix immutable flag handling in our mtree(8) invocations.
authorSascha Wildner <saw@online.de>
Sun, 6 Oct 2019 13:33:04 +0000 (15:33 +0200)
committerSascha Wildner <saw@online.de>
Sun, 6 Oct 2019 13:33:04 +0000 (15:33 +0200)
All of this only affects /var/empty so far.

* If NOSCHG isn't set (which is the default), pass -i to mtree(8) when
  installing the system or building an installer img.

* Pass -i always when we install a system from the installer. This
  installer usage of mtree(8) should not be needed. Expand the comment
  a bit.

Reported-by: zrj
etc/Makefile
nrelease/Makefile
usr.sbin/installer/dfuibe_installer/fn_install.c

index fe1d8ef..04b8c98 100644 (file)
@@ -46,6 +46,9 @@ DEFAULTS= compilers.conf devfs.conf make.conf periodic.conf \
          pfi.conf rc.conf uuids
 
 MTREE= BSD.include.dist BSD.root.dist BSD.usr.dist BSD.var.dist
+.if !defined(NOFSCHG)
+MTREE_FSCHG=   -i
+.endif
 
 PPPCNF=        ppp.conf
 
@@ -356,10 +359,13 @@ distribution:
 #
 #
 distrib-dirs:
-       mtree -deU -f ${.CURDIR}/mtree/BSD.root.dist -p ${DESTDIR}/
-       mtree -deU -f ${.CURDIR}/mtree/BSD.var.dist -p ${DESTDIR}/var
-       mtree -deU -f ${.CURDIR}/mtree/BSD.usr.dist -p ${DESTDIR}/usr
-       mtree -deU -f ${.CURDIR}/mtree/BSD.include.dist \
+       mtree ${MTREE_FSCHG} -deU -f ${.CURDIR}/mtree/BSD.root.dist \
+               -p ${DESTDIR}/
+       mtree ${MTREE_FSCHG} -deU -f ${.CURDIR}/mtree/BSD.var.dist \
+               -p ${DESTDIR}/var
+       mtree ${MTREE_FSCHG} -deU -f ${.CURDIR}/mtree/BSD.usr.dist \
+               -p ${DESTDIR}/usr
+       mtree ${MTREE_FSCHG} -deU -f ${.CURDIR}/mtree/BSD.include.dist \
                -p ${DESTDIR}/usr/include
        -chflags xlink ${DESTDIR}/* ${DESTDIR}/usr/* ${DESTDIR}/var/* \
                        ${DESTDIR}/home/*
index c559819..ba38bb7 100644 (file)
@@ -21,6 +21,9 @@ OBJSYS=               ${.OBJDIR}/../sys
 GITURL_SRC?=   git://git.dragonflybsd.org/dragonfly.git
 GITURL_DPORTS?=        git://mirror-master.dragonflybsd.org/dports.git
 MAKE_JOBS?=    $$(sysctl -n hw.ncpu)
+.if !defined(NOFSCHG)
+MTREE_FSCHG=   -i
+.endif
 
 # XXX makeshift fix to build the right kernel for the (target) architecture
 # We should configure this in the platform files somehow
@@ -191,7 +194,8 @@ buildiso:
                done )
        rm -rf ${ISOROOT}/boot/kernel.old
        ln -sf kernel ${ISOROOT}/boot/kernel/kernel.BOOTP
-       mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.var.dist -p ${ISOROOT}/var
+       mtree ${MTREE_FSCHG} -deU -f ${.CURDIR}/../etc/mtree/BSD.var.dist \
+               -p ${ISOROOT}/var
        dev_mkdb -f ${ISOROOT}/var/run/dev.db ${ISOROOT}/dev
 
 # The GUI build includes the ports tree (~1G+) while the nominal release
index b0b83fe..79b04fb 100644 (file)
@@ -463,9 +463,12 @@ fn_install_os(struct i_fn_args *a)
        }
 
        /*
+        * XXX This should not be needed. It was added to fix /var/run/sem
+        *     issues, see d4c25c30fc5f9ffeb258150a9590ef56954435bb.
+        *
         * Ensure /var has all directories it needs.
         */
-       command_add(cmds, "%s%s -deU -f %setc/mtree/BSD.var.dist -p %smnt/var",
+       command_add(cmds, "%s%s -deiU -f %setc/mtree/BSD.var.dist -p %smnt/var",
            a->os_root, cmd_name(a, "MTREE"), a->os_root, a->os_root);
 
        /*