Skip to content

Commit

Permalink
Shellcheck cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ottojwittner committed Feb 6, 2024
1 parent 3fbcfe0 commit 01c5f7a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions helpers/shells/deleteRepo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
# This shell **delete the repository** in arg and **all his data** and the line associated in the authorized_keys file.

# DISABLED (until authentiation is improved) 2024-01-30 Otto J Wittner
if [ $1 != "add-reponame-to-delete-here" ]; then
if [ "$1" != "add-reponame-to-delete-here" ]; then
#if [ "$1" != "20ce5d38" ]; then
echo -n "This feature is disabled"; exit 2
fi
# Exit when any command fails
Expand Down Expand Up @@ -53,12 +54,12 @@ fi

HOSTNAME=$2
# Clean up firewall if client hostname is given
if [ $HOSTNAME ]; then
RULENUMS=`sudo ufw status numbered | grep "SSH from $HOSTNAME" | cut -f2 -d "[" | cut -f1 -d"]" | sort -nr`
if [ "$HOSTNAME" ]; then
RULENUMS=$(sudo ufw status numbered | grep "SSH from $HOSTNAME" | cut -f2 -d "[" | cut -f1 -d"]" | sort -nr)
for r in $RULENUMS; do
UFW_CMD="$UFW_CMD sudo ufw --force delete $r; "
done
# Run ufw command
bash -c "$UFW_CMD" 2>&1 >/dev/null
{ bash -c "$UFW_CMD" >/dev/null ; } 2>&1
fi

0 comments on commit 01c5f7a

Please sign in to comment.