This repository has been archived on 2024-12-14. You can view files and clone it, but cannot push or open issues or pull requests.
toolchain/scripts/host-env

21 lines
325 B
Plaintext
Raw Normal View History

2023-01-28 00:05:03 +00:00
#!/bin/bash
set -e
uid=${UID?}
gid=${GID?}
user=${USER:-"build"}
export HOME="/home/${user}"
groupadd -g "$gid" "${user}"
useradd \
-g "$gid" \
-u "$uid" \
-md "/home/${user}" \
-s /bin/bash \
"${user}"
mkdir -p "$HOME"
chown -R "$uid:$gid" "$HOME"
cd "$HOME"
setpriv --reuid="$uid" --regid="$gid" --init-groups "$@"