SLBR/login.sh

18 lines
741 B
Bash
Executable File

#!/bin/sh
. /etc/profile.d/apps-bin-path.sh
SLBRUSER="$(whoami)"
lxc list | grep -q "$(echo $SSH_CLIENT | cut -f 1 -d ' ')" && ~/killme.sh && exit #this is a bit hacky, maybe something better?
echo "The game has not started yet! Grab a cup of tea, or just wait here."
while test -z "$(cat /home/slbr/gamestatus)" || break
do
printf "."
sleep 1
done
echo "READY.......BEGIN!"
sleep 1
echo "Setting up your container..."
lxc exec "$SLBRUSER" ssh-keygen -- -t rsa -N '' -f /root/.ssh/id_rsa
lxc file pull "$SLBRUSER/root/.ssh/id_rsa.pub" "/home/slbr/$SLBRUSER/pubkey.temp"
cat "/home/slbr/$SLBRUSER/pubkey.temp" >> "/home/slbr/$SLBRUSER/.ssh/authorized_keys" && rm "/home/slbr/$SLBRUSER/pubkey.temp"
lxc exec "$SLBRUSER" /usr/bin/tmuxinit.sh