#!/bin/sh

ZUSER=@USER@
export HOME="/home/$ZUSER"
GROUPS=$(id -Gn "$ZUSER" | tr ' ' ':')
SVDIR="$HOME/sv"
ID=$(id -u $ZUSER)

[ ! -d /run/user/$ID ] && \
    mkdir -p /run/user/$ZUSER && \
    chown $ZUSER:$ZUSER /run/user/$ZUSER

exec chpst -u "$ZUSER:$GROUPS" sh -l -c "exec runsvdir $SVDIR $ZUSER '...'" $ZUSER
