37 lines
1.1 KiB
Bash
37 lines
1.1 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
export OLDUSER=${DUSER:-user}
|
|
export USER=${REALUSER:?}
|
|
|
|
groupmod --new-name $USER $(id -gn $OLDUSER)
|
|
usermod --home /home/$USER $OLDUSER
|
|
usermod --login $USER $OLDUSER
|
|
echo "$USER ALL=(ALL) NOPASSWD:ALL" | tee /etc/sudoers.d/$USER
|
|
|
|
|
|
#
|
|
# Add a user to a detected "video" group
|
|
# so that it can access the nvidia devices
|
|
#
|
|
if [ -e /dev/nvidiactl ]; then
|
|
GID=$(stat -c '%g' /dev/nvidiactl)
|
|
groupadd -r -g $GID nvidia1
|
|
if [ $? -eq 0 ]; then
|
|
usermod -aG nvidia1 $USER
|
|
else
|
|
GROUP=$(stat -c '%G' /dev/nvidiactl)
|
|
usermod -aG $GROUP $USER
|
|
fi
|
|
fi
|
|
|
|
#
|
|
# Try to load host's libGL (generic or Nvidia 32/64-bit) drivers
|
|
#
|
|
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$(echo /h{1..20}_{32,64} | tr ' ' ':')"
|
|
export LD_LIBRARY_PATH
|
|
|
|
sudo LD_LIBRARY_PATH=${LD_LIBRARY_PATH:?} PULSE_SERVER=${PULSE_SERVER:?} su -s /bin/bash -c /opt/cool-retro-term/cool-retro-term $USER
|
|
|
|
# QT_X11_NO_MITSHM - stops Qt form using the MIT-SHM X11 extension
|
|
# sudo QT_X11_NO_MITSHM=${QT_X11_NO_MITSHM:-1} PULSE_SERVER=${PULSE_SERVER:?} su -s /bin/bash -c /opt/cool-retro-term/cool-retro-term $USER
|