Fix problems found by sellcheck in type explorers.

This commit is contained in:
Darko Poljak 2018-10-07 19:41:44 +02:00
parent ab8f87864e
commit 638ddd95d6
9 changed files with 28 additions and 10 deletions

View File

@ -23,10 +23,11 @@
name="$__object_id" name="$__object_id"
# shellcheck disable=SC1091
. /etc/lsb-release . /etc/lsb-release
repo_name="${name#ppa:}" repo_name="${name#ppa:}"
repo_file_name="$(echo "$repo_name" | sed -e "s|[/:]|-|" -e "s|\.|_|")-${DISTRIB_CODENAME}.list" repo_file_name="$(echo "$repo_name" | sed -e 's|[/:]|-|' -e 's|\.|_|')-${DISTRIB_CODENAME}.list"
[ -s "/etc/apt/sources.list.d/${repo_file_name}" ] \ [ -s "/etc/apt/sources.list.d/${repo_file_name}" ] \
&& echo present || echo absent && echo present || echo absent

View File

@ -1,4 +1,6 @@
#!/bin/sh #!/bin/sh
# shellcheck disable=SC1091
[ -f /etc/environment ] && . /etc/environment [ -f /etc/environment ] && . /etc/environment
# shellcheck disable=SC1091
[ -f /etc/profile ] && . /etc/profile [ -f /etc/profile ] && . /etc/profile
go version 2>/dev/null || true go version 2>/dev/null || true

View File

@ -39,7 +39,7 @@ fi
# backslash-escaped $jaildir # backslash-escaped $jaildir
sjaildir="$(echo ${jaildir} | sed 's#/#\\/#g')" sjaildir="$(echo ${jaildir} | sed 's#/#\\/#g')"
jls_output="$(jls | grep "[ ]${sjaildir}\/${name}\$")" || true jls_output="$(jls | grep "[ ]${sjaildir}\\/${name}\$")" || true
if [ -n "${jls_output}" ]; then if [ -n "${jls_output}" ]; then
echo "STARTED" echo "STARTED"

View File

@ -39,7 +39,7 @@ fi
# backslash-escaped $jaildir # backslash-escaped $jaildir
sjaildir="$(echo ${jaildir} | sed 's#/#\\/#g')" sjaildir="$(echo ${jaildir} | sed 's#/#\\/#g')"
jls_output="$(jls | grep "[ ]${sjaildir}\/${name}\$")" || true jls_output="$(jls | grep "[ ]${sjaildir}\\/${name}\$")" || true
if [ -n "${jls_output}" ]; then if [ -n "${jls_output}" ]; then
echo "STARTED" echo "STARTED"

View File

@ -20,7 +20,7 @@
name="$__object_id" name="$__object_id"
if su - postgres -c "echo '\q' | psql '$name'" 2>/dev/null; then if su - postgres -c "echo '\\q' | psql '$name'" 2>/dev/null; then
echo "present" echo "present"
else else
echo "absent" echo "absent"

View File

@ -20,7 +20,7 @@
name="$__object_id" name="$__object_id"
if su - postgres -c "psql -c '\du' | grep -q '^ *$name *|'"; then if su - postgres -c "psql -c '\\du' | grep -q '^ *$name *|'"; then
echo "present" echo "present"
else else
echo "absent" echo "absent"

View File

@ -27,5 +27,5 @@ then
file="$(cat "$__object/parameter/file")" file="$(cat "$__object/parameter/file")"
# get any entries that match the type and key # get any entries that match the type and key
grep ".*$type_and_key\([ \n]\|$\)" "$file" || true grep ".*$type_and_key\\([ \\n]\\|$\\)" "$file" || true
fi fi

View File

@ -38,12 +38,27 @@ if [ "$init" = 'systemd' ]; then
else else
case "$os" in case "$os" in
debian|openwrt|devuan) debian|openwrt|devuan)
state="present" state="absent"
[ -f "/etc/rc$runlevel.d/S"??"$name" ] || state="absent" for file in "/etc/rc$runlevel.d/S"??"$name"
do
if [ -f "$file" ]
then
state="present"
break
fi
done
;; ;;
ubuntu) ubuntu)
state="absent" state="absent"
[ -f "/etc/rc$runlevel.d/S"??"$name" ] && state="present" for file in "/etc/rc$runlevel.d/S"??"$name"
do
if [ -f "$file" ]
then
state="present"
break
fi
done
[ -f "/etc/init/${name}.conf" ] && state="present" [ -f "/etc/init/${name}.conf" ] && state="present"
;; ;;

View File

@ -27,4 +27,4 @@ else
fi fi
# simpler command which works only on SLES11 SP3 or newer: # simpler command which works only on SLES11 SP3 or newer:
# echo $(zypper ls -u -E | grep -E "\<$uri\>" | cut -d'|' -f 1 ) # echo $(zypper ls -u -E | grep -E "\<$uri\>" | cut -d'|' -f 1 )
zypper ls -u | grep -E '^([^|]+\|){3,3} Yes' | grep -E "\<$uri\>" | cut -d'|' -f 1 zypper ls -u | grep -E '^([^|]+\|){3,3} Yes' | grep -E "\\<$uri\\>" | cut -d'|' -f 1