summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorSerge Schneider <serge@raspberrypi.com>2023-03-29 07:55:37 +0100
committerSerge Schneider <serge@raspberrypi.com>2023-03-29 07:56:32 +0100
commit4e9275398278c4cab8ba68f3d9ca54ab97b73922 (patch)
treed60ef400787253a1a3be3efe5a9d6080d811b60a /scripts
parentb8437a77ba9e52ae23ee80414198d5d92f2babf5 (diff)
Use tmpfs for chroot /run and /tmp
Diffstat (limited to 'scripts')
-rw-r--r--scripts/common8
1 files changed, 8 insertions, 0 deletions
diff --git a/scripts/common b/scripts/common
index 82bd726..5731b72 100644
--- a/scripts/common
+++ b/scripts/common
@@ -86,6 +86,14 @@ on_chroot() {
mount --bind /sys "${ROOTFS_DIR}/sys"
fi
+ if ! mount | grep -q "$(realpath "${ROOTFS_DIR}"/run)"; then
+ mount -t tmpfs tmpfs "${ROOTFS_DIR}/run"
+ fi
+
+ if ! mount | grep -q "$(realpath "${ROOTFS_DIR}"/tmp)"; then
+ mount -t tmpfs tmpfs "${ROOTFS_DIR}/tmp"
+ fi
+
setarch linux32 capsh $CAPSH_ARG "--chroot=${ROOTFS_DIR}/" -- -e "$@"
}
export -f on_chroot