linting fixes
This commit is contained in:
parent
1769396340
commit
0c75b5fb66
|
@ -8,7 +8,7 @@
|
||||||
run_user=$(id -u)
|
run_user=$(id -u)
|
||||||
if [ "$run_user" -eq 0 ]; then
|
if [ "$run_user" -eq 0 ]; then
|
||||||
r="$(/sbin/iptables -L f2b-sshd -n | grep REJECT)"
|
r="$(/sbin/iptables -L f2b-sshd -n | grep REJECT)"
|
||||||
if [ ! -z "$r" ]; then
|
if [ -n "$r" ]; then
|
||||||
printf "%s" "$r" | awk '{print $4}' | xargs /usr/bin/fail2ban-client set sshd unbanip
|
printf "%s" "$r" | awk '{print $4}' | xargs /usr/bin/fail2ban-client set sshd unbanip
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
|
2
bin/log
2
bin/log
|
@ -256,7 +256,7 @@ main() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# new message
|
# new message
|
||||||
if [ ! -z "$arg_new" ]; then
|
if [ -n "$arg_new" ]; then
|
||||||
if [ "$numships" -eq 0 ]; then
|
if [ "$numships" -eq 0 ]; then
|
||||||
printf "No registered ships found in system.\\n"
|
printf "No registered ships found in system.\\n"
|
||||||
elif [ "$numships" -eq 1 ]; then
|
elif [ "$numships" -eq 1 ]; then
|
||||||
|
|
|
@ -6,13 +6,13 @@ if [ "$run_user" -eq 0 ]; then
|
||||||
s="$2"
|
s="$2"
|
||||||
newship="$3"
|
newship="$3"
|
||||||
|
|
||||||
if [ ! -z "$n" ]; then
|
if [ -n "$n" ]; then
|
||||||
user_exists=$(id -u "${n}" 2> /dev/null)
|
user_exists=$(id -u "${n}" 2> /dev/null)
|
||||||
if [ ! -z "${user_exists}" ]; then
|
if [ -n "${user_exists}" ]; then
|
||||||
if [ ! -z "${s}" ]; then
|
if [ -n "${s}" ]; then
|
||||||
path="/var/gopher/${s}"
|
path="/var/gopher/${s}"
|
||||||
if [ -d "$path" ]; then
|
if [ -d "$path" ]; then
|
||||||
if [ ! -z "${newship}" ]; then
|
if [ -n "${newship}" ]; then
|
||||||
newpath="/var/gopher/${newship}"
|
newpath="/var/gopher/${newship}"
|
||||||
ship_exists=$(find /var/gopher -maxdepth 1 -iname "$newship")
|
ship_exists=$(find /var/gopher -maxdepth 1 -iname "$newship")
|
||||||
if [ -z "$ship_exists" ]; then
|
if [ -z "$ship_exists" ]; then
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
if [ ! -z "$1" ]; then
|
if [ -n "$1" ]; then
|
||||||
fort="$*"
|
fort="$*"
|
||||||
printf "%s\\n%%\\n" "$fort" >> /usr/share/games/fortunes/cosmic
|
printf "%s\\n%%\\n" "$fort" >> /usr/share/games/fortunes/cosmic
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -4,10 +4,10 @@ run_user=$(id -u)
|
||||||
if [ "$run_user" -eq 0 ]; then
|
if [ "$run_user" -eq 0 ]; then
|
||||||
n="$1"
|
n="$1"
|
||||||
s="$2"
|
s="$2"
|
||||||
if [ ! -z "$n" ]; then
|
if [ -n "$n" ]; then
|
||||||
user_exists=$(id -u "${n}" 2> /dev/null)
|
user_exists=$(id -u "${n}" 2> /dev/null)
|
||||||
if [ ! -z "${user_exists}" ]; then
|
if [ -n "${user_exists}" ]; then
|
||||||
if [ ! -z "${s}" ]; then
|
if [ -n "${s}" ]; then
|
||||||
path="/var/gopher/${s}"
|
path="/var/gopher/${s}"
|
||||||
if [ -d "$path" ]; then
|
if [ -d "$path" ]; then
|
||||||
printf "Removing ship '%s' for user '%s'\\n" "${s}" "${n}"
|
printf "Removing ship '%s' for user '%s'\\n" "${s}" "${n}"
|
||||||
|
|
4
bin/user
4
bin/user
|
@ -4,7 +4,7 @@ run_user=$(id -u)
|
||||||
if [ "$run_user" -eq 0 ]; then
|
if [ "$run_user" -eq 0 ]; then
|
||||||
n="$1"
|
n="$1"
|
||||||
k="$2"
|
k="$2"
|
||||||
if [ ! -z "$n" ]; then
|
if [ -n "$n" ]; then
|
||||||
user_exists=$(id -u "${n}" 2> /dev/null)
|
user_exists=$(id -u "${n}" 2> /dev/null)
|
||||||
if [ -z "${user_exists}" ]; then
|
if [ -z "${user_exists}" ]; then
|
||||||
printf "Adding new user %s\\n" "${n}"
|
printf "Adding new user %s\\n" "${n}"
|
||||||
|
@ -13,7 +13,7 @@ if [ "$run_user" -eq 0 ]; then
|
||||||
useradd -m -G users,www-data -p "$pwcrypt" -s /bin/bash "${n}" || exit 1
|
useradd -m -G users,www-data -p "$pwcrypt" -s /bin/bash "${n}" || exit 1
|
||||||
sed -e "s/USERNAME/${n}/g" -e "s/PASSWORD/${newpw}/" /etc/templates/welcomemail.tmpl | sendmail "${n}"
|
sed -e "s/USERNAME/${n}/g" -e "s/PASSWORD/${newpw}/" /etc/templates/welcomemail.tmpl | sendmail "${n}"
|
||||||
fi
|
fi
|
||||||
if [ ! -z "${k}" ]; then
|
if [ -n "${k}" ]; then
|
||||||
printf "%s\\n" "${k}" >> "/home/${n}/.ssh/authorized_keys"
|
printf "%s\\n" "${k}" >> "/home/${n}/.ssh/authorized_keys"
|
||||||
else
|
else
|
||||||
${EDITOR:-vim} "/home/${n}/.ssh/authorized_keys"
|
${EDITOR:-vim} "/home/${n}/.ssh/authorized_keys"
|
||||||
|
|
|
@ -5,7 +5,7 @@ _log() {
|
||||||
cur=${COMP_WORDS[COMP_CWORD]}
|
cur=${COMP_WORDS[COMP_CWORD]}
|
||||||
local helplist
|
local helplist
|
||||||
helplist=$(log -z)
|
helplist=$(log -z)
|
||||||
COMPREPLY=( $( compgen -W "$helplist" -- "$cur" ) )
|
mapfile -t COMPREPLY < <( compgen -W "$helplist" -- "$cur" )
|
||||||
}
|
}
|
||||||
|
|
||||||
# Detect if current shell is ZSH, and if so, load this file in bash
|
# Detect if current shell is ZSH, and if so, load this file in bash
|
||||||
|
|
Loading…
Reference in New Issue