summaryrefslogtreecommitdiff
path: root/mkosi.build
diff options
context:
space:
mode:
authorDaan De Meyer <daan.j.demeyer@gmail.com>2021-01-14 19:33:42 +0100
committerDaan De Meyer <daan.j.demeyer@gmail.com>2021-01-14 20:08:20 +0100
commite2ebc406ac78cb57612ce5c5d590018572d71df1 (patch)
tree4a089228978a0fb1ae5bd9d7aaba0c24c36492f0 /mkosi.build
parentd8434c523c95c8e4d7f547e2c95b4fbd52b12f74 (diff)
downloadsystemd-e2ebc406ac78cb57612ce5c5d590018572d71df1.tar.gz
mkosi: Only reset file permissions when $SRCDIR is not a mountpoint
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.
Diffstat (limited to 'mkosi.build')
-rwxr-xr-xmkosi.build6
1 files changed, 4 insertions, 2 deletions
diff --git a/mkosi.build b/mkosi.build
index d7fbff78b8..b60a61f8fe 100755
--- a/mkosi.build
+++ b/mkosi.build
@@ -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.