From aa2b437efe4a6dedfca0ed85571de74cb53eea75 Mon Sep 17 00:00:00 2001 From: Ludwig Nussel Date: Thu, 20 Jan 2022 10:43:39 +0100 Subject: [PATCH] build as user fixes --- build-vm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/build-vm b/build-vm index 95dc0120c..58a64f8ed 100644 --- a/build-vm +++ b/build-vm @@ -783,7 +783,10 @@ vm_setup() { if test -n "$VM_USE_MKFS_COPYIN" ; then echo "Using mkfs copyin mode to populate the root filesystem" mkdir_build_root - rm -rf "$BUILD_ROOT"/* "$BUILD_ROOT"/.[^.]* + if test ! -w /root ; then + find "$BUILD_ROOT" -type d -not -perm /200 -print0 | xargs -0 --no-run-if-empty chmod +w + fi + find "$BUILD_ROOT" -mindepth 1 -maxdepth 1 -print0 | xargs -0 --no-run-if-empty rm -rf if test -z "$CLEAN_BUILD" -a -e "$VM_ROOT" ; then echo "Recovering former build root" debugfs -f <(echo rdump / "$BUILD_ROOT") "$VM_ROOT"