Shellchecked scripts, fixed spelling errors

This commit is contained in:
BuildTools 2018-09-15 23:11:58 -07:00
parent 44708afbe3
commit 4a2e1edc54
5 changed files with 22 additions and 22 deletions

View File

@ -1,15 +1,15 @@
#!/bin/sh
SLBRUSER=$1
test -z $SLBRUSER && echo "no user provided" && exit
test -z "$SLBRUSER" && echo "no user provided" && exit
if ps -o stat= -p $PPID | grep -qv S+ #check if this is being called from listen.py
then
echo "YOU ARE ABOUT TO PERMANENTLY DELETE USER $SLBRUSER AND ALL OF THEIR DATA. RE-ENTER THE USERS NAME TO CONTINUE"
read ENTEREDUSER
[ $ENTEREDUSER != $SLBRUSER ] && echo "users did not match, exiting..." && exit
read -r ENTEREDUSER
[ "$ENTEREDUSER" != "$SLBRUSER" ] && echo "users did not match, exiting..." && exit
fi
lxc stop $SLBRUSER
lxc delete $SLBRUSER
sudo rm -rf $SLBRUSER
sudo userdel $SLBRUSER
lxc stop "$SLBRUSER"
lxc delete "$SLBRUSER"
sudo rm -rf "$SLBRUSER"
sudo userdel "$SLBRUSER"
tr '\n' ' ' < users | sed "s/$SLBRUSER //" | tr ' ' '\n' > users.temp
mv users.temp users

View File

@ -1,11 +1,11 @@
#!/bin/sh
. /etc/profile.d/apps-bin-path.sh
echo "The game has not started yet! Grab a cup of tea, or just wait here."
while test -z $(cat /home/slbr/gamestatus) || break
while test -z "$(cat /home/slbr/gamestatus)" || break
do
printf "."
sleep 1
done
echo "READY.......BEGIN!"
sleep 1
lxc exec $(whoami) /usr/bin/tmuxinit.sh
lxc exec "$(whoami)" /usr/bin/tmuxinit.sh

View File

@ -2,6 +2,6 @@
#WARRNING: THIS SHOULD ONLY BE INVOKED FROM newuser.sh
echo " Launching container for user $(whoami)"
. /etc/profile.d/apps-bin-path.sh \
&& lxc launch ubuntu: $(whoami)
lxc file push /home/slbr/tmuxinit.sh $(whoami)/usr/bin/tmuxinit.sh
lxc file push /home/slbr/suicidebash.bashrc $(whoami)/etc/bash.bashrc
&& lxc launch ubuntu: "$(whoami)"
lxc file push /home/slbr/tmuxinit.sh "$(whoami)/usr/bin/tmuxinit.sh"
lxc file push /home/slbr/suicidebash.bashrc "$(whoami)/etc/bash.bashrc"

View File

@ -1,16 +1,16 @@
#!/bin/sh
SLBRUSER=$1
test -z $SLBRUSER && echo "no user provided" && exit
test -z "$SLBRUSER" && echo "no user provided" && exit
echo "Creating homedir..."
mkdir "/home/slbr/$SLBRUSER"
echo $SLBRUSER >> users
echo "$SLBRUSER" >> users
echo "lxc exec $SLBRUSER bash" > "/home/slbr/$SLBRUSER/.profile"
chmod -w "/home/slbr/$SLBRUSER/.profile"
echo "Creating user..."
sudo useradd $SLBRUSER -d "/home/slbr/$SLBRUSER"
sudo usermod -a -G lxd $SLBRUSER
sudo useradd "$SLBRUSER" -d "/home/slbr/$SLBRUSER"
sudo usermod -a -G lxd "$SLBRUSER"
sudo chown "$SLBRUSER:$SLBRUSER" "/home/slbr/$SLBRUSER"
sudo chsh $SLBRUSER -s /home/slbr/login.sh
sudo chsh "$SLBRUSER" -s /home/slbr/login.sh
echo "Creating container..."
sudo su $SLBRUSER -s /bin/sh -c "/home/slbr/lxcinit.sh"
sudo su "$SLBRUSER" -s /bin/sh -c "/home/slbr/lxcinit.sh"

View File

@ -1,9 +1,9 @@
#!/bin/bash
function send {
ADRESSES=$(lxc list | cut -f 4 -d '|' \
| grep -Eo "[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*")
for ADRESS in $ADRESSES
ADDRESSES=$(lxc list | cut -f 4 -d '|' \
| grep -Eo "[0-9]*\\.[0-9]*\\.[0-9]*\\.[0-9]*")
for ADDRESS in $ADDRESSES
do
echo $1 | nc -q2 $ADRESS 9090
echo "$1" | nc -q2 "$ADDRESS" 9090
done
}