checkbashisms

This commit is contained in:
Darko Poljak 2016-03-30 12:43:59 +02:00
parent 4233a0913a
commit f55d00fe96
14 changed files with 32 additions and 17 deletions

View File

@ -1,3 +1,4 @@
#!/bin/sh
#
# 2015 Nico Schottelius (nico-cdist at schottelius.org)
#

View File

@ -1,3 +1,4 @@
#!/bin/sh
#
# 2015 Nico Schottelius (nico-cdist at schottelius.org)
#

View File

@ -1,3 +1,5 @@
#!/bin/sh
if grep -q "^__file/etc/iptables.d/" "$__messages_in"; then
echo /etc/init.d/iptables restart
fi

View File

@ -1,3 +1,4 @@
#!/bin/sh
#
# 2013 Nico Schottelius (nico-cdist at schottelius.org)
#

View File

@ -1,3 +1,4 @@
#!/bin/sh
#
# 2013 Nico Schottelius (nico-cdist at schottelius.org)
#

View File

@ -1,3 +1,5 @@
#!/bin/sh
export key="$(cat "$__object/parameter/key" 2>/dev/null \
|| echo "$__object_id")"
export state="$(cat "$__object/parameter/state")"

View File

@ -1,3 +1,5 @@
#!/bin/sh
#
# 2013 Nico Schottelius (nico-cdist at schottelius.org)
#
# This file is part of cdist.

View File

@ -42,7 +42,7 @@ case "$ptype" in
zypper search --match-exact --installed-only --type "$ptype" "$name" | grep -E '^i' | cut -d " " -f 3 || true
;;
*)
echo "unknown ptype in __package_zypper explorer" &>2
echo "unknown ptype in __package_zypper explorer" >&2
exit 1
;;
esac

View File

@ -42,11 +42,12 @@ contains_element() {
MATCH=0
target=$1
keys="${@:2}"
# keys="${@:2}"
shift
for key in ${keys}; do
if [ "${key}" == "${target}" ]; then
# for key in ${keys}; do
for key in "$@"; do
if [ "${key}" = "${target}" ]; then
MATCH=1
return 0
fi
@ -58,14 +59,14 @@ if [ "${file}" ]; then
__file "${sec_path}/plain_file_${file}"\
--state exists --mode 666
if [ "${state}" == "present" ]; then
if [ "${state}" = "present" ]; then
require="__file/${sec_path}/plain_file_${file}" __key_value ${file}_${key}\
--file ${sec_path}/plain_file_${file} --key ${key} --value ${value} --delimiter ' = '
exit 0
elif [ "${state}" == "absent" ]; then
elif [ "${state}" = "absent" ]; then
require="__file/${sec_path}/plain_file_${file}" __key_value ${file}_${key}\
--state absent
exit 0
@ -76,7 +77,7 @@ if [ "${file}" ]; then
fi
fi
if [ "${section}" == "options" ]; then
if [ "${section}" = "options" ]; then
__file "${sec_path}/${section}"\
--state exists --mode 666 --source - << eof
@ -87,10 +88,10 @@ eof
contains_element "${key}" "${boolean_option_keys}"
if [ "${MATCH}" -eq 1 ]; then
if [ "${value}" == "on" ]; then
if [ "${value}" = "on" ]; then
require="__file/${sec_path}/${section}" __line ${key}_${value}\
--file ${sec_path}/${section} --line ${key}
elif [ "${value}" == "off" ]; then
elif [ "${value}" = "off" ]; then
require="__file/${sec_path}/${section}" __line ${key}_${value}\
--file ${sec_path}/${section} --line ${key} --state absent
fi
@ -111,7 +112,7 @@ else
--state exists --mode 666 --source - << eof
[${section}]
eof
if [ "${state}" == "present" ]; then
if [ "${state}" = "present" ]; then
#check if key is valid
contains_element "${key}" "${allowed_repo_keys}"
@ -122,7 +123,7 @@ eof
require="__file/${sec_path}/repo_${section}" __key_value ${section}_${key}\
--file ${sec_path}/repo_${section} --key ${key} --value ${value} --delimiter ' = '
elif [ "${state}" == "absent" ]; then
elif [ "${state}" = "absent" ]; then
require="__file/${sec_path}/repo_${section}" __key_value ${section}_${key}\
--state absent

View File

@ -22,7 +22,7 @@ state=$(cat $__object/parameter/state 2>/dev/null)
path="/etc/"
if [ "${state}" == "present" ]; then
if [ "${state}" = "present" ]; then
__file /etc/pacman.conf\
--owner root --group root --mode 644 --source $__type/files/pacman.conf.cdist
@ -35,7 +35,7 @@ if [ "${state}" == "present" ]; then
__file /etc/pacman.d/plain_file_empty_placeholder\
--owner root --group root --mode 644
elif [ "${state}" == "absent" ]; then
elif [ "${state}" = "absent" ]; then
__file /etc/pacman.conf\
--owner root --group root --mode 644 --source $__type/files/pacman.conf.pacman

View File

@ -1,3 +1,5 @@
#!/bin/sh
#
################################################################################
# State: absent is handled by manifest - we need only to do stuff if image is
# not existing and state != absent

View File

@ -1,3 +1,5 @@
#!/bin/sh
#
################################################################################
# Default settings
#

View File

@ -28,7 +28,7 @@ init=$("$__explorer/init")
target_runlevel="$(cat "$__object/parameter/target_runlevel")"
name="$__object_id"
if [ "$init" == 'systemd' ]; then
if [ "$init" = 'systemd' ]; then
# this handles ALL linux distros with systemd
# e.g. archlinux, gentoo, new RHEL and SLES versions
state=$(systemctl is-enabled "$name" >/dev/null 2>&1 \

View File

@ -34,7 +34,7 @@ name="$__object_id"
case "$state_should" in
present)
if [ "$init" == 'systemd' ]; then
if [ "$init" = 'systemd' ]; then
# this handles ALL linux distros with systemd
# e.g. archlinux, gentoo in some cases, new RHEL and SLES versions
echo "systemctl -q enable \"$name\""
@ -85,7 +85,7 @@ case "$state_should" in
;;
absent)
if [ "$init" == 'systemd' ]; then
if [ "$init" = 'systemd' ]; then
# this handles ALL linux distros with systemd
# e.g. archlinux, gentoo in some cases, new RHEL and SLES versions
echo "systemctl -q disable \"$name\""