Shellchecked scripts, fixed spelling errors
This commit is contained in:
parent
44708afbe3
commit
4a2e1edc54
14
deluser.sh
14
deluser.sh
|
@ -1,15 +1,15 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
SLBRUSER=$1
|
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
|
if ps -o stat= -p $PPID | grep -qv S+ #check if this is being called from listen.py
|
||||||
then
|
then
|
||||||
echo "YOU ARE ABOUT TO PERMANENTLY DELETE USER $SLBRUSER AND ALL OF THEIR DATA. RE-ENTER THE USERS NAME TO CONTINUE"
|
echo "YOU ARE ABOUT TO PERMANENTLY DELETE USER $SLBRUSER AND ALL OF THEIR DATA. RE-ENTER THE USERS NAME TO CONTINUE"
|
||||||
read ENTEREDUSER
|
read -r ENTEREDUSER
|
||||||
[ $ENTEREDUSER != $SLBRUSER ] && echo "users did not match, exiting..." && exit
|
[ "$ENTEREDUSER" != "$SLBRUSER" ] && echo "users did not match, exiting..." && exit
|
||||||
fi
|
fi
|
||||||
lxc stop $SLBRUSER
|
lxc stop "$SLBRUSER"
|
||||||
lxc delete $SLBRUSER
|
lxc delete "$SLBRUSER"
|
||||||
sudo rm -rf $SLBRUSER
|
sudo rm -rf "$SLBRUSER"
|
||||||
sudo userdel $SLBRUSER
|
sudo userdel "$SLBRUSER"
|
||||||
tr '\n' ' ' < users | sed "s/$SLBRUSER //" | tr ' ' '\n' > users.temp
|
tr '\n' ' ' < users | sed "s/$SLBRUSER //" | tr ' ' '\n' > users.temp
|
||||||
mv users.temp users
|
mv users.temp users
|
||||||
|
|
4
login.sh
4
login.sh
|
@ -1,11 +1,11 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
. /etc/profile.d/apps-bin-path.sh
|
. /etc/profile.d/apps-bin-path.sh
|
||||||
echo "The game has not started yet! Grab a cup of tea, or just wait here."
|
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
|
do
|
||||||
printf "."
|
printf "."
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
echo "READY.......BEGIN!"
|
echo "READY.......BEGIN!"
|
||||||
sleep 1
|
sleep 1
|
||||||
lxc exec $(whoami) /usr/bin/tmuxinit.sh
|
lxc exec "$(whoami)" /usr/bin/tmuxinit.sh
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
#WARRNING: THIS SHOULD ONLY BE INVOKED FROM newuser.sh
|
#WARRNING: THIS SHOULD ONLY BE INVOKED FROM newuser.sh
|
||||||
echo " Launching container for user $(whoami)"
|
echo " Launching container for user $(whoami)"
|
||||||
. /etc/profile.d/apps-bin-path.sh \
|
. /etc/profile.d/apps-bin-path.sh \
|
||||||
&& lxc launch ubuntu: $(whoami)
|
&& lxc launch ubuntu: "$(whoami)"
|
||||||
lxc file push /home/slbr/tmuxinit.sh $(whoami)/usr/bin/tmuxinit.sh
|
lxc file push /home/slbr/tmuxinit.sh "$(whoami)/usr/bin/tmuxinit.sh"
|
||||||
lxc file push /home/slbr/suicidebash.bashrc $(whoami)/etc/bash.bashrc
|
lxc file push /home/slbr/suicidebash.bashrc "$(whoami)/etc/bash.bashrc"
|
||||||
|
|
12
newuser.sh
12
newuser.sh
|
@ -1,16 +1,16 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
SLBRUSER=$1
|
SLBRUSER=$1
|
||||||
test -z $SLBRUSER && echo "no user provided" && exit
|
test -z "$SLBRUSER" && echo "no user provided" && exit
|
||||||
|
|
||||||
echo "Creating homedir..."
|
echo "Creating homedir..."
|
||||||
mkdir "/home/slbr/$SLBRUSER"
|
mkdir "/home/slbr/$SLBRUSER"
|
||||||
echo $SLBRUSER >> users
|
echo "$SLBRUSER" >> users
|
||||||
echo "lxc exec $SLBRUSER bash" > "/home/slbr/$SLBRUSER/.profile"
|
echo "lxc exec $SLBRUSER bash" > "/home/slbr/$SLBRUSER/.profile"
|
||||||
chmod -w "/home/slbr/$SLBRUSER/.profile"
|
chmod -w "/home/slbr/$SLBRUSER/.profile"
|
||||||
echo "Creating user..."
|
echo "Creating user..."
|
||||||
sudo useradd $SLBRUSER -d "/home/slbr/$SLBRUSER"
|
sudo useradd "$SLBRUSER" -d "/home/slbr/$SLBRUSER"
|
||||||
sudo usermod -a -G lxd $SLBRUSER
|
sudo usermod -a -G lxd "$SLBRUSER"
|
||||||
sudo chown "$SLBRUSER:$SLBRUSER" "/home/slbr/$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..."
|
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"
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
function send {
|
function send {
|
||||||
ADRESSES=$(lxc list | cut -f 4 -d '|' \
|
ADDRESSES=$(lxc list | cut -f 4 -d '|' \
|
||||||
| grep -Eo "[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*")
|
| grep -Eo "[0-9]*\\.[0-9]*\\.[0-9]*\\.[0-9]*")
|
||||||
for ADRESS in $ADRESSES
|
for ADDRESS in $ADDRESSES
|
||||||
do
|
do
|
||||||
echo $1 | nc -q2 $ADRESS 9090
|
echo "$1" | nc -q2 "$ADDRESS" 9090
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue