Merge branch 'usuarix-real' into 'antifascista'

Crear usuarix dentro de haini.sh

See merge request sutty/haini.sh!30
This commit is contained in:
fauno 2021-09-28 17:26:29 +00:00
commit 84444bba04

View file

@ -40,9 +40,17 @@ ENTORNO=${ENTORNO:-${ROOT}/hain}
correr() {
echo "> $1" >&2
if test "$AS_ROOT"; then
SET_UID=0
SET_GID=0
else
SET_UID="$(id -u)"
SET_GID="$(id -g)"
fi
env -i \
TERM="$TERM" \
USER="$USER" \
USER="suttier" \
HOME="/home/suttier" \
HAIN_ENV=true \
RAILS_ENV="${RAILS_ENV:-development}" \
@ -51,15 +59,15 @@ correr() {
PAGER="less -niSFX" \
bwrap \
--die-with-parent \
--unshare-user-try \
--unshare-user \
--uid "$SET_UID" \
--gid "$SET_GID" \
--unshare-ipc \
--unshare-uts \
--unshare-cgroup-try \
--bind "$ENTORNO" / \
--bind "$ROOT" /Sutty \
--ro-bind /etc/hosts /etc/hosts \
--ro-bind /etc/passwd /etc/passwd \
--ro-bind /etc/group /etc/group \
--ro-bind /etc/resolv.conf /etc/resolv.conf \
--ro-bind /etc/localtime /etc/localtime \
--dev-bind /dev /dev \
@ -169,6 +177,22 @@ crear_entorno() {
&& mv "$ENTORNO$HOME" "$ENTORNO/home/suttier"
mkdir -p "$ENTORNO/home/suttier"
if ! grep ^suttier: "$ENTORNO/etc/group" >/dev/null 2>&1 ; then
AS_ROOT=true correr "addgroup \
-g $(id -g) \
suttier"
fi
if ! correr "id suttier" >/dev/null 2>&1 ; then
AS_ROOT=true correr "adduser \
--disabled-password \
--gecos '' \
--home /home/suttier \
--no-create-home \
--uid $(id -u) \
--ingroup suttier \
suttier"
fi
# Configurar rubygems para que descargue las gemas desde Sutty
install -m 640 "$DIR/.gemrc" "$ENTORNO/home/suttier/.gemrc"