aboutsummaryrefslogtreecommitdiff
path: root/fake-client-setup-mounts.sh
blob: c00a0e52bfb908301ba3babfc264150b6cfc8265 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/sh

# SPDX-License-Identifier: CC0-1.0

# Copyright (C) 2022 Wojtek Kosior <koszko@koszko.org>
#
# 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"