From 9bc697b85a69af4d1a270aa5272db150c98bed42 Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Mon, 21 Nov 2022 13:55:12 +0100 Subject: initial commit --- fake-client-setup-mounts.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 fake-client-setup-mounts.sh (limited to 'fake-client-setup-mounts.sh') diff --git a/fake-client-setup-mounts.sh b/fake-client-setup-mounts.sh new file mode 100755 index 0000000..c00a0e5 --- /dev/null +++ b/fake-client-setup-mounts.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +# SPDX-License-Identifier: CC0-1.0 + +# Copyright (C) 2022 Wojtek Kosior +# +# Available under the terms of Creative Commons Zero v1.0 Universal. + +set -e + +SHELL_TO_USE="$1" +USER_ID_TO_USE="$2" +GROUP_ID_TO_USE="$3" + +mount --bind hosts /etc/hosts; +mount -t tmpfs dummy /var/run/nscd 2>/dev/null || true; +unshare --map-user="$USER_ID_TO_USE" --map-group="$GROUP_ID_TO_USE" \ + "$SHELL_TO_USE" -- cgit v1.2.3