forked from tildeverse/SLBR
New death mechanics fully functional, general cleanup
This commit is contained in:
parent
0ff808414e
commit
19c77b34d0
|
@ -10,10 +10,9 @@ contact ~ben or sose on tilde.chat (in the #slbr channel) to sign up.
|
|||
## Prerequisites
|
||||
- LXC
|
||||
- LXD with an lxdbr0 device configured
|
||||
- inotifywait
|
||||
- BSD style netcat
|
||||
- Tmux
|
||||
- Python 3
|
||||
- An open ssh port
|
||||
|
||||
## Setup
|
||||
- Switch to the directory you would like to run SLBR in.
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
#!/bin/sh
|
||||
inotifywait -mrqe delete users | while read dir
|
||||
# deathwatch.sh
|
||||
# efficiently checks each user directory to see if the .ssh folder has been deleted
|
||||
# deletes the user if it has
|
||||
|
||||
inotifywait -mrqe delete users | while read -r dir
|
||||
do
|
||||
echo "$dir" | grep -q 'ISDIR .ssh' \
|
||||
&& ./deluser.sh "$(echo $dir | cut -f 2 -d '/')"
|
||||
&& ./deluser.sh "$(echo "$dir" | cut -f 2 -d '/')"
|
||||
done
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
#!/bin/sh
|
||||
# deluser.sh
|
||||
# deletes a user, their container, and their home direcory
|
||||
# can be called manually or by a script
|
||||
|
||||
SLBRUSER=$1
|
||||
test -z "$SLBRUSER" && echo "no user provided" && exit
|
||||
if ! (grep -qE "^$SLBRUSER$" users.txt)
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
#!/bin/sh
|
||||
#This should only be run by users who have been eliminated
|
||||
# killme.sh
|
||||
# deletes a user's .ssh folder signifying they have been eliminated
|
||||
# run by the user's account, hopefully without their control
|
||||
# This should only be run by users who have been eliminated, obviously
|
||||
|
||||
SLBRUSER=$(whoami)
|
||||
test -z "$SLBRUSER" && echo "no user provided" && exit
|
||||
if ! (grep -qE "^$SLBRUSER$" /home/slbr/users.txt)
|
||||
|
@ -10,5 +14,4 @@ fi
|
|||
|
||||
echo "removing /home/slbr/users/$SLBRUSER"
|
||||
rm -rf "/home/slbr/users/$SLBRUSER/.ssh"
|
||||
sleep 10
|
||||
lxc delete -f "$SLBRUSER"
|
||||
|
|
8
login.sh
8
login.sh
|
@ -1,7 +1,13 @@
|
|||
#!/bin/sh
|
||||
# login.sh
|
||||
# the script that runs when a player logs into their account
|
||||
# will put the player in their container and setup a tmux session for them
|
||||
# will also run killme.sh if called from a container
|
||||
# a bit hacky, perhaps we should find a better method?
|
||||
|
||||
. /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?
|
||||
lxc list | grep -q "$(echo "$SSH_CLIENT" | cut -f 1 -d ' ')" && ~/killme.sh && exit
|
||||
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
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#!/bin/bash
|
||||
#WARRNING: THIS SHOULD ONLY BE INVOKED FROM newuser.sh
|
||||
#!/bin/sh
|
||||
# lxcinit.sh
|
||||
# called from newuser.sh to set up an lxc container with the proper files
|
||||
|
||||
echo " Launching container for user $(whoami)"
|
||||
. /etc/profile.d/apps-bin-path.sh \
|
||||
&& lxc launch ubuntu: "$(whoami)"
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
#!/bin/sh
|
||||
# newuser.sh
|
||||
# creates a new player
|
||||
|
||||
SLBRUSER=$1
|
||||
PUBKEY=$2
|
||||
test -z "$SLBRUSER" && echo "no user provided" && exit
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
# sendmsg.sh
|
||||
# sends a message to all conatiners
|
||||
|
||||
ADDRESSES=$(lxc list | cut -f 4 -d '|' \
|
||||
| grep -Eo "[0-9]*\\.[0-9]*\\.[0-9]*\\.[0-9]*")
|
||||
for ADDRESS in $ADDRESSES
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
#!/bin/sh
|
||||
# tmuxinit.sh
|
||||
# sets up a tmux session within the user's container
|
||||
|
||||
tmux new-session -d -n test
|
||||
tmux select-window -t 0:0
|
||||
tmux send -t 0:0 'nc -lkp 9090' ENTER
|
||||
|
|
Loading…
Reference in New Issue