]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
mkosi: Only reset file permissions when $SRCDIR is not a mountpoint
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 14 Jan 2021 18:33:42 +0000 (19:33 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 14 Jan 2021 19:08:20 +0000 (20:08 +0100)
If $SRCDIR is mounted into the build image (via mkosi overrides),
let's not reset the permissions fo the source tree so as to not
modify the original files on the host.

mkosi.build

index d7fbff78b8068066459c8c9dd2307deadd047e5d..b60a61f8fe60d2f8095402187e916ba230d56069 100755 (executable)
@@ -9,8 +9,10 @@ set -e
 # so the files keep those permissions, otherwise details of what umask
 # was set at the time the git tree was cloned will leak all the way
 # through. Also set umask explicitly during the build.
-chmod -R u+w,go-w,a+rX .
-umask 022
+if ! mountpoint -q "$SRCDIR"; then
+        chmod -R u+w,go-w,a+rX .
+        umask 022
+fi
 
 # If mkosi.builddir/ exists mkosi will set $BUILDDIR to it, let's then use it
 # as out-of-tree build dir. Otherwise, let's make up our own builddir.