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"
# shellcheck disable=SC1091
. /etc/lsb-release
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}" ] \
&& echo present || echo absent

View file

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

View file

@ -39,7 +39,7 @@ fi
# backslash-escaped $jaildir
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
echo "STARTED"

View file

@ -39,7 +39,7 @@ fi
# backslash-escaped $jaildir
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
echo "STARTED"

View file

@ -20,7 +20,7 @@
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"
else
echo "absent"

View file

@ -20,7 +20,7 @@
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"
else
echo "absent"

View file

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

View file

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

View file

@ -27,4 +27,4 @@ else
fi
# simpler command which works only on SLES11 SP3 or newer:
# 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