From: aburford Date: Sun, 15 May 2022 00:33:55 +0000 (-0400) Subject: add comments at top of idmap-test.sh X-Git-Url: https://git.fsl.cs.sunysb.edu/?a=commitdiff_plain;h=61052348e5b5f426a858ecc701972dc462193294;p=wrapfs-mgmt.git add comments at top of idmap-test.sh --- diff --git a/idmap-tests/idmap-test.sh b/idmap-tests/idmap-test.sh index 40359fb..1f40db8 100755 --- a/idmap-tests/idmap-test.sh +++ b/idmap-tests/idmap-test.sh @@ -1,10 +1,21 @@ #!/bin/sh -# XXX: fill in +# +# This script creates an idmapped mount of an ext4 file system and tries to +# stack wrapfs on top of it. It creates a third user called luser if they do +# not exist and sets the following idmap: +# root -> ubuntu +# ubuntu -> luser +# luser -> root +# Files are created belonging to each user on the original mount of the ext4 +# filesystem. They should show up as different users on the id mapped mount and +# also on the wrapfs mount if wrapfs correctly supports idmapped mounts on the +# lower fs. SCRATCH_DEV=/dev/sdb SCRATCH_DIR=/n/scratch LOWER_DIR=/n/lower TMP_DIR=/n/tmp +TMP_DIR=/n/tmp FS_TYPE=ext4 function runcmd @@ -19,6 +30,10 @@ function runcmd fi } +if ! id luser &>/dev/null; then + runcmd adduser --disabled-password -q --gecos luser luser +fi + dirs="$TMP_DIR $LOWER_DIR $SCRATCH_DIR" for d in $dirs; do echo checking dir $d @@ -37,7 +52,10 @@ runcmd touch $SCRATCH_DIR/luser runcmd chown luser $SCRATCH_DIR/luser ls1=$(ls -l $SCRATCH_DIR) -runcmd ./mount-idmapped --map-mount b:0:1000:1 --map-mount b:1000:1001:1 --map-mount b:1001:0:1 $SCRATCH_DIR $LOWER_DIR +ubuntu=$(id -u ubuntu) +luser=$(id -u luser) + +runcmd ./mount-idmapped --map-mount b:0:$ubuntu:1 --map-mount b:$ubuntu:$luser:1 --map-mount b:$luser:0:1 $SCRATCH_DIR $LOWER_DIR runcmd mount -t wrapfs $LOWER_DIR $TMP_DIR if test $ret != 32; then echo wrapfs returned unexpected error: $ret