2017-01-23 22:47:50 +00:00
|
|
|
#!/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
|
|
|
|
|
2017-01-24 19:03:42 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# 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
|
2017-01-23 22:47:50 +00:00
|
|
|
|
|
|
|
# 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
|