toolchain/scripts/host-env

21 lines
306 B
Bash
Executable File

#!/bin/bash
set -e
uid=${UID?}
gid=${GID?}
user=${USER:-"build"}
export HOME="/home/${user}"
groupdel dialout
groupadd -g "$gid" "${user}"
useradd \
-g "$gid" \
-G sudo \
-u "$uid" \
-d "/home/${user}" \
-s /bin/bash \
"${user}"
cd "$HOME"
setpriv --reuid="$uid" --regid="$gid" --init-groups "$@"