crosstool-ng/testing/docker/common-scripts/su-as-user
Alexey Neyman f6d8c2ffbd Add docker testing for Gentoo
Signed-off-by: Alexey Neyman <stilor@att.net>
2018-04-29 12:06:54 -07:00

18 lines
278 B
Bash
Executable File

#!/bin/bash
usr=$1
uid=$2
grp=$3
gid=$4
shift 4
groupadd -g ${gid} ${grp}
useradd -d /home/${usr} -m -g ${gid} -u ${uid} ${usr}
rm -f /home/${usr}/src
ln -sf /src /home/${usr}/src
if [ -z "$*" ]; then
exec su -l ${usr}
else
exec su -l -c "/bin/bash -c '$*'" ${usr}
fi