Clean quotes; su - -> su -l
This commit is contained in:
parent
62f1e1db00
commit
1388487199
43 changed files with 149 additions and 141 deletions
|
@ -34,9 +34,9 @@ fi
|
||||||
case "$state_should" in
|
case "$state_should" in
|
||||||
present)
|
present)
|
||||||
keyserver="$(cat "$__object/parameter/keyserver")"
|
keyserver="$(cat "$__object/parameter/keyserver")"
|
||||||
echo "apt-key adv --keyserver \"$keyserver\" --recv-keys \"$keyid\""
|
echo "apt-key adv --keyserver '$keyserver' --recv-keys '$keyid'"
|
||||||
;;
|
;;
|
||||||
absent)
|
absent)
|
||||||
echo "apt-key del \"$keyid\""
|
echo "apt-key del '$keyid'"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -29,9 +29,9 @@ fi
|
||||||
|
|
||||||
case "$state_should" in
|
case "$state_should" in
|
||||||
present)
|
present)
|
||||||
echo add-apt-repository \""$name"\"
|
echo "add-apt-repository '$name'"
|
||||||
;;
|
;;
|
||||||
absent)
|
absent)
|
||||||
echo remove-apt-repository \""$name"\"
|
echo "remove-apt-repository '$name'"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -42,18 +42,18 @@ get_current_value() {
|
||||||
}
|
}
|
||||||
|
|
||||||
set_group() {
|
set_group() {
|
||||||
echo chgrp \""$1"\" \""$destination"\"
|
echo "chgrp '$1' '$destination'"
|
||||||
echo chgrp "$1" >> "$__messages_out"
|
echo "chgrp $1" >> "$__messages_out"
|
||||||
}
|
}
|
||||||
|
|
||||||
set_owner() {
|
set_owner() {
|
||||||
echo chown \""$1"\" \""$destination"\"
|
echo "chown '$1' '$destination'"
|
||||||
echo chown "$1" >> "$__messages_out"
|
echo "chown $1" >> "$__messages_out"
|
||||||
}
|
}
|
||||||
|
|
||||||
set_mode() {
|
set_mode() {
|
||||||
echo chmod \""$1"\" \""$destination"\"
|
echo "chmod '$1' '$destination'"
|
||||||
echo chmod "$1" >> "$__messages_out"
|
echo "chmod $1" >> "$__messages_out"
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$state_should" in
|
case "$state_should" in
|
||||||
|
@ -80,7 +80,7 @@ case "$state_should" in
|
||||||
|
|
||||||
absent)
|
absent)
|
||||||
if [ "$type" = "file" ]; then
|
if [ "$type" = "file" ]; then
|
||||||
echo rm -f \""$destination"\"
|
echo "rm -f '$destination'"
|
||||||
echo remove >> "$__messages_out"
|
echo remove >> "$__messages_out"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -79,18 +79,24 @@ DONE
|
||||||
case "$state_should" in
|
case "$state_should" in
|
||||||
present)
|
present)
|
||||||
# if we insert new entry, filter also all entrys out with the same id
|
# if we insert new entry, filter also all entrys out with the same id
|
||||||
echo "("
|
cat <<EOF
|
||||||
echo "crontab -u $user -l 2>/dev/null | grep -v -E \"$filter\" | grep -v \"# $name\\$\" 2>/dev/null || true"
|
(
|
||||||
echo "echo '$entry'"
|
crontab -u $user -l 2>/dev/null | grep -v -E '$filter' | grep -v '# $name\\$' 2>/dev/null || true
|
||||||
echo ") | crontab -u $user -"
|
echo '$entry'
|
||||||
|
) | crontab -u $user -
|
||||||
|
EOF
|
||||||
;;
|
;;
|
||||||
absent)
|
absent)
|
||||||
if [ -f "$__object/parameter/raw_command" ]; then
|
if [ -f "$__object/parameter/raw_command" ]; then
|
||||||
echo "( crontab -u $user -l 2>/dev/null | grep -v -E \"$filter\" 2>/dev/null || true ) | \\"
|
cat <<EOF
|
||||||
echo "grep -v \"^$entry\\$\" | crontab -u $user -"
|
( crontab -u $user -l 2>/dev/null | grep -v -E '$filter' 2>/dev/null || true ) | \\
|
||||||
|
grep -v '^$entry\\$' | crontab -u $user -
|
||||||
|
EOF
|
||||||
else
|
else
|
||||||
echo "( crontab -u $user -l 2>/dev/null | grep -v -E \"$filter\" 2>/dev/null || true ) | \\"
|
cat <<EOF
|
||||||
echo "grep -v \"# $name\\$\" | crontab -u $user -"
|
( crontab -u $user -l 2>/dev/null | grep -v -E '$filter' 2>/dev/null || true ) | \\
|
||||||
|
grep -v '# $name\\$' | crontab -u $user -
|
||||||
|
EOF
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -57,18 +57,18 @@ get_current_value() {
|
||||||
}
|
}
|
||||||
|
|
||||||
set_group() {
|
set_group() {
|
||||||
echo chgrp "$recursive" \""$1"\" \""$destination"\"
|
echo "chgrp '$recursive' '$1' '$destination'"
|
||||||
echo chgrp "$recursive" "$1" >> "$__messages_out"
|
echo "chgrp $recursive $1" >> "$__messages_out"
|
||||||
}
|
}
|
||||||
|
|
||||||
set_owner() {
|
set_owner() {
|
||||||
echo chown "$recursive" \""$1"\" \""$destination"\"
|
echo "chown '$recursive' '$1' '$destination'"
|
||||||
echo chown "$recursive" "$1" >> "$__messages_out"
|
echo "chown $recursive $1" >> "$__messages_out"
|
||||||
}
|
}
|
||||||
|
|
||||||
set_mode() {
|
set_mode() {
|
||||||
echo chmod "$recursive" \""$1"\" \""$destination"\"
|
echo "chmod '$recursive' '$1' '$destination'"
|
||||||
echo chmod "$recursive" "$1" >> "$__messages_out"
|
echo "chmod $recursive $1" >> "$__messages_out"
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$state_should" in
|
case "$state_should" in
|
||||||
|
@ -78,10 +78,10 @@ case "$state_should" in
|
||||||
if [ "$type" != "none" ]; then
|
if [ "$type" != "none" ]; then
|
||||||
# our destination is not a directory, remove whatever is there
|
# our destination is not a directory, remove whatever is there
|
||||||
# and then create our directory and set all attributes
|
# and then create our directory and set all attributes
|
||||||
echo rm -f "\"$destination\""
|
echo "rm -f '$destination'"
|
||||||
echo "remove non directory" >> "$__messages_out"
|
echo "remove non directory" >> "$__messages_out"
|
||||||
fi
|
fi
|
||||||
echo "mkdir $mkdiropt \"$destination\""
|
echo "mkdir $mkdiropt '$destination'"
|
||||||
echo "create" >> "$__messages_out"
|
echo "create" >> "$__messages_out"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ case "$state_should" in
|
||||||
;;
|
;;
|
||||||
absent)
|
absent)
|
||||||
if [ "$type" = "directory" ]; then
|
if [ "$type" = "directory" ]; then
|
||||||
echo rm -rf \""$destination"\"
|
echo "rm -rf '$destination'"
|
||||||
echo remove >> "$__messages_out"
|
echo remove >> "$__messages_out"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -54,7 +54,7 @@ if [ "$state_should" = "present" ] || [ "$state_should" = "exists" ]; then
|
||||||
source="$__object/stdin"
|
source="$__object/stdin"
|
||||||
fi
|
fi
|
||||||
if [ ! -f "$source" ]; then
|
if [ ! -f "$source" ]; then
|
||||||
echo "Source \"$source\" does not exist." >&2
|
echo "Source '$source' does not exist." >&2
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
if [ "$type" != "file" ]; then
|
if [ "$type" != "file" ]; then
|
||||||
|
@ -96,7 +96,7 @@ DONE
|
||||||
fi
|
fi
|
||||||
# move uploaded file into place
|
# move uploaded file into place
|
||||||
cat << DONE
|
cat << DONE
|
||||||
$__remote_exec $__target_host "rm -rf \"$destination\"; mv \"\$destination_upload\" \"$destination\""
|
$__remote_exec $__target_host "rm -rf '$destination'; mv \"\$destination_upload\" '$destination'"
|
||||||
DONE
|
DONE
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -43,18 +43,18 @@ get_current_value() {
|
||||||
}
|
}
|
||||||
|
|
||||||
set_group() {
|
set_group() {
|
||||||
echo chgrp \""$1"\" \""$destination"\"
|
echo "chgrp '$1' '$destination'"
|
||||||
echo chgrp "$1" >> "$__messages_out"
|
echo "chgrp $1" >> "$__messages_out"
|
||||||
}
|
}
|
||||||
|
|
||||||
set_owner() {
|
set_owner() {
|
||||||
echo chown \""$1"\" \""$destination"\"
|
echo "chown '$1' '$destination'"
|
||||||
echo chown "$1" >> "$__messages_out"
|
echo "chown $1" >> "$__messages_out"
|
||||||
}
|
}
|
||||||
|
|
||||||
set_mode() {
|
set_mode() {
|
||||||
echo chmod \""$1"\" \""$destination"\"
|
echo "chmod '$1' '$destination'"
|
||||||
echo chmod "$1" >> "$__messages_out"
|
echo "chmod $1" >> "$__messages_out"
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$state_should" in
|
case "$state_should" in
|
||||||
|
@ -81,7 +81,7 @@ case "$state_should" in
|
||||||
|
|
||||||
absent)
|
absent)
|
||||||
if [ "$type" = "file" ]; then
|
if [ "$type" = "file" ]; then
|
||||||
echo rm -f \""$destination"\"
|
echo "rm -f '$destination'"
|
||||||
echo remove >> "$__messages_out"
|
echo remove >> "$__messages_out"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -33,13 +33,13 @@ rule="$(cat "$__object/parameter/rule")"
|
||||||
|
|
||||||
case "$state_should" in
|
case "$state_should" in
|
||||||
present)
|
present)
|
||||||
echo firewall-cmd --quiet --permanent --direct --add-rule \""$protocol"\" \""$table"\" \""$chain"\" \""$priority"\" "$rule"
|
echo "firewall-cmd --quiet --permanent --direct --add-rule '$protocol' '$table' '$chain' '$priority' $rule"
|
||||||
echo firewall-cmd --quiet --direct --add-rule \""$protocol"\" \""$table"\" \""$chain"\" \""$priority"\" "$rule"
|
echo "firewall-cmd --quiet --direct --add-rule '$protocol' '$table' '$chain' '$priority' $rule"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
absent)
|
absent)
|
||||||
echo firewall-cmd --quiet --permanent --direct --remove-rule \""$protocol"\" \""$table"\" \""$chain"\" \""$priority"\" "$rule"
|
echo "firewall-cmd --quiet --permanent --direct --remove-rule '$protocol' '$table' '$chain' '$priority' $rule"
|
||||||
echo firewall-cmd --quiet --direct --remove-rule \""$protocol"\" \""$table"\" \""$chain"\" \""$priority"\" "$rule"
|
echo "firewall-cmd --quiet --direct --remove-rule '$protocol' '$table' '$chain' '$priority' $rule"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Unknown state $state_should" >&2
|
echo "Unknown state $state_should" >&2
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/sh -e
|
"#!/bin/sh -2
|
||||||
#
|
#
|
||||||
# 2016 Darko Poljak(darko.poljak at ungleich.ch)
|
# 2016 Darko Poljak(darko.poljak at ungleich.ch)
|
||||||
#
|
#
|
||||||
|
@ -42,16 +42,16 @@ esac
|
||||||
if [ "$init" = 'systemd' ]; then
|
if [ "$init" = 'systemd' ]; then
|
||||||
# this handles ALL linux distros with systemd
|
# this handles ALL linux distros with systemd
|
||||||
# e.g. archlinux, gentoo in some cases, new RHEL and SLES versions
|
# e.g. archlinux, gentoo in some cases, new RHEL and SLES versions
|
||||||
echo "systemctl \"$cmd\" \"$name\""
|
echo "systemctl '$cmd' '$name'"
|
||||||
else
|
else
|
||||||
case "$os" in
|
case "$os" in
|
||||||
debian)
|
debian)
|
||||||
case "$os_version" in
|
case "$os_version" in
|
||||||
[1-7]*)
|
[1-7]*)
|
||||||
echo "service \"$name\" \"$cmd\""
|
echo "service '$name' '$cmd'"
|
||||||
;;
|
;;
|
||||||
8*)
|
8*)
|
||||||
echo "systemctl \"$cmd\" \"$name\""
|
echo "systemctl '$cmd' '$name'"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Unsupported version $os_version of $os" >&2
|
echo "Unsupported version $os_version of $os" >&2
|
||||||
|
@ -61,19 +61,19 @@ else
|
||||||
;;
|
;;
|
||||||
|
|
||||||
gentoo)
|
gentoo)
|
||||||
echo service \"$name\" \"$cmd\"
|
echo "service '$name' '$cmd'"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
amazon|scientific|centos|fedora|owl|redhat|suse)
|
amazon|scientific|centos|fedora|owl|redhat|suse)
|
||||||
echo service \"$name\" \"$cmd\"
|
echo "service '$name' '$cmd'"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
openwrt)
|
openwrt)
|
||||||
echo "/etc/init.d/\"$name\" \"$cmd\""
|
echo "'/etc/init.d/$name' '$cmd'"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
ubuntu)
|
ubuntu)
|
||||||
echo "service \"$name\" \"$cmd\""
|
echo "service '$name' '$cmd'"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
|
|
|
@ -87,7 +87,7 @@ primary_count=0
|
||||||
for object in $objects; do
|
for object in $objects; do
|
||||||
device="$(cat "$object/parameter/device")"
|
device="$(cat "$object/parameter/device")"
|
||||||
if [ "$current_device" != "$device" ]; then
|
if [ "$current_device" != "$device" ]; then
|
||||||
echo "create_disklabel \"$device\" || die 'Failed to create disklabel for $device'"
|
echo "create_disklabel '$device' || die 'Failed to create disklabel for $device'"
|
||||||
current_device="$device"
|
current_device="$device"
|
||||||
device_name=$(echo "${device}" | sed -e 's:^/dev/::;s:/:\\/:g')
|
device_name=$(echo "${device}" | sed -e 's:^/dev/::;s:/:\\/:g')
|
||||||
available_device_size=$(( $(awk "/${device_name}\$/ { print \$3; }" "$partitions") / 1024))
|
available_device_size=$(( $(awk "/${device_name}\$/ { print \$3; }" "$partitions") / 1024))
|
||||||
|
|
|
@ -130,11 +130,11 @@ deleteJail() {
|
||||||
fi
|
fi
|
||||||
EOF
|
EOF
|
||||||
# Remove the jail's rw mountpoints
|
# Remove the jail's rw mountpoints
|
||||||
echo "rm -rf \"${jaildir}/rw/${name}\""
|
echo "rm -rf '${jaildir}/rw/${name}'"
|
||||||
# Remove the jail directory
|
# Remove the jail directory
|
||||||
echo "rm -rf \"${jaildir}/${name}\""
|
echo "rm -rf '${jaildir}/${name}'"
|
||||||
# Remove the jail's fstab
|
# Remove the jail's fstab
|
||||||
echo "rm -f \"/etc/fstab.${name}\""
|
echo "rm -f '/etc/fstab.${name}'"
|
||||||
# Remove jail entry from jail.conf
|
# Remove jail entry from jail.conf
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
sed -i .bak -E -e "/^${name} {\$/,/^}\\\$/d" /etc/jail.conf
|
sed -i .bak -E -e "/^${name} {\$/,/^}\\\$/d" /etc/jail.conf
|
||||||
|
|
|
@ -135,11 +135,11 @@ deleteJail() {
|
||||||
fi
|
fi
|
||||||
EOF
|
EOF
|
||||||
# Remove the jail's rw mountpoints
|
# Remove the jail's rw mountpoints
|
||||||
echo "rm -rf \"${jaildir}/rw/${name}\""
|
echo "rm -rf '${jaildir}/rw/${name}'"
|
||||||
# Remove the jail directory
|
# Remove the jail directory
|
||||||
echo "rm -rf \"${jaildir}/${name}\""
|
echo "rm -rf '${jaildir}/${name}'"
|
||||||
# Remove the jail's fstab
|
# Remove the jail's fstab
|
||||||
echo "rm -f \"/etc/fstab.${name}\""
|
echo "rm -f '/etc/fstab.${name}'"
|
||||||
# Remove jail_$name_* lines from rc.conf
|
# Remove jail_$name_* lines from rc.conf
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
sed -i '.bak' "/^jail_${name}_/d" /etc/rc.conf
|
sed -i '.bak' "/^jail_${name}_/d" /etc/rc.conf
|
||||||
|
|
|
@ -34,13 +34,13 @@ case "$os" in
|
||||||
__key_value KEYTABLE \
|
__key_value KEYTABLE \
|
||||||
--file /etc/sysconfig/keyboard \
|
--file /etc/sysconfig/keyboard \
|
||||||
--delimiter '=' \
|
--delimiter '=' \
|
||||||
--value "\"$keyboard_type\""
|
--value "'$keyboard_type'"
|
||||||
|
|
||||||
require="__file/etc/sysconfig/keyboard" \
|
require="__file/etc/sysconfig/keyboard" \
|
||||||
__key_value LAYOUT \
|
__key_value LAYOUT \
|
||||||
--file /etc/sysconfig/keyboard \
|
--file /etc/sysconfig/keyboard \
|
||||||
--delimiter '=' \
|
--delimiter '=' \
|
||||||
--value "\"$keyboard_type\""
|
--value "'$keyboard_type'"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Your operating system ($os) is currently not supported by this type (${__type##*/})." >&2
|
echo "Your operating system ($os) is currently not supported by this type (${__type##*/})." >&2
|
||||||
|
|
|
@ -64,7 +64,7 @@ esac
|
||||||
|
|
||||||
# Hint if we need to avoid questions at some point:
|
# Hint if we need to avoid questions at some point:
|
||||||
# DEBIAN_PRIORITY=critical can reduce the number of questions
|
# DEBIAN_PRIORITY=critical can reduce the number of questions
|
||||||
aptget="DEBIAN_FRONTEND=noninteractive apt-get --quiet --yes --no-install-recommends -o Dpkg::Options::=\"--force-confdef\" -o Dpkg::Options::=\"--force-confold\""
|
aptget="DEBIAN_FRONTEND=noninteractive apt-get --quiet --yes --no-install-recommends -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confold"
|
||||||
|
|
||||||
if [ "$state_is" = "$state_should" ]; then
|
if [ "$state_is" = "$state_should" ]; then
|
||||||
if [ -z "$version" ] || [ "$version" = "$version_is" ]; then
|
if [ -z "$version" ] || [ "$version" = "$version_is" ]; then
|
||||||
|
|
|
@ -63,10 +63,10 @@ fi
|
||||||
|
|
||||||
case "$state_should" in
|
case "$state_should" in
|
||||||
present)
|
present)
|
||||||
echo "emerge \"$name\" &>/dev/null || exit 1"
|
echo "emerge '$name' &>/dev/null || exit 1"
|
||||||
;;
|
;;
|
||||||
absent)
|
absent)
|
||||||
echo "emerge -C \"$name\" &>/dev/null || exit 1"
|
echo "emerge -C '$name' &>/dev/null || exit 1"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Unknown state: $state_should" >&2
|
echo "Unknown state: $state_should" >&2
|
||||||
|
|
|
@ -42,10 +42,10 @@ fi
|
||||||
|
|
||||||
case "$state_should" in
|
case "$state_should" in
|
||||||
present)
|
present)
|
||||||
echo luarocks install \""$name"\"
|
echo "luarocks install '$name'"
|
||||||
;;
|
;;
|
||||||
absent)
|
absent)
|
||||||
echo luarocks remove \""$name"\"
|
echo "luarocks remove '$name'"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Unknown state: $state_should" >&2
|
echo "Unknown state: $state_should" >&2
|
||||||
|
|
|
@ -43,12 +43,12 @@ esac
|
||||||
case "$state_should" in
|
case "$state_should" in
|
||||||
present)
|
present)
|
||||||
if [ "$present" = "notpresent" ]; then
|
if [ "$present" = "notpresent" ]; then
|
||||||
echo opkg --verbosity=0 update
|
echo "opkg --verbosity=0 update"
|
||||||
fi
|
fi
|
||||||
echo opkg --verbosity=0 install \""$name"\"
|
echo "opkg --verbosity=0 install '$name'"
|
||||||
;;
|
;;
|
||||||
absent)
|
absent)
|
||||||
echo opkg --verbosity=0 remove \""$name"\"
|
echo "opkg --verbosity=0 remove '$name'"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Unknown state: $state" >&2
|
echo "Unknown state: $state" >&2
|
||||||
|
|
|
@ -45,10 +45,10 @@ fi
|
||||||
|
|
||||||
case "$state_should" in
|
case "$state_should" in
|
||||||
present)
|
present)
|
||||||
echo pacman --needed --noconfirm --noprogressbar -S \""$name"\"
|
echo "pacman --needed --noconfirm --noprogressbar -S '$name'"
|
||||||
;;
|
;;
|
||||||
absent)
|
absent)
|
||||||
echo pacman --noconfirm --noprogressbar -R \""$name"\"
|
echo "pacman --noconfirm --noprogressbar -R '$name'"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Unknown state: $state_should" >&2
|
echo "Unknown state: $state_should" >&2
|
||||||
|
|
|
@ -53,7 +53,7 @@ case "$state_should" in
|
||||||
present)
|
present)
|
||||||
if [ "$runas" ]
|
if [ "$runas" ]
|
||||||
then
|
then
|
||||||
echo "su -c \"$pip install -q $name\" $runas"
|
echo "su -c '$pip install -q $name' $runas"
|
||||||
else
|
else
|
||||||
echo $pip install -q "$name"
|
echo $pip install -q "$name"
|
||||||
fi
|
fi
|
||||||
|
@ -61,7 +61,7 @@ case "$state_should" in
|
||||||
absent)
|
absent)
|
||||||
if [ "$runas" ]
|
if [ "$runas" ]
|
||||||
then
|
then
|
||||||
echo "su -c \"$pip uninstall -q -y $name\" $runas"
|
echo "su -c '$pip uninstall -q -y $name' $runas"
|
||||||
else
|
else
|
||||||
echo $pip uninstall -q -y "$name"
|
echo $pip uninstall -q -y "$name"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -27,8 +27,8 @@ assert () # If condition false,
|
||||||
|
|
||||||
if [ ! "$1" ]
|
if [ ! "$1" ]
|
||||||
then
|
then
|
||||||
echo "Assertion failed: \"$1\""
|
echo "Assertion failed: '$1'"
|
||||||
echo "File \"$0\""
|
echo "File '$0'"
|
||||||
exit $E_ASSERT_FAILED
|
exit $E_ASSERT_FAILED
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -64,12 +64,14 @@ execcmd(){
|
||||||
[ -n "$version" ] && pkgsite="${pkgsite}/All/" || pkgsite="${pkgsite}/Latest/"
|
[ -n "$version" ] && pkgsite="${pkgsite}/All/" || pkgsite="${pkgsite}/Latest/"
|
||||||
echo "${pkgsite}"
|
echo "${pkgsite}"
|
||||||
fi
|
fi
|
||||||
echo "${2} 2>&- >&-" # Silence the output of the command
|
cat <<EOF
|
||||||
echo "status=\$?"
|
${2} 2>&- >&- # Silence the output of the command
|
||||||
echo "if [ \"\$status\" -ne \"0\" ]; then"
|
status=\$?
|
||||||
echo " echo \"Error: ${cmd} exited nonzero with \$status\"'!' >&2"
|
if [ "\$status" -ne "0" ]; then
|
||||||
echo " exit 1"
|
echo "Error: ${cmd} exited nonzero with \$status!" >&2
|
||||||
echo "fi"
|
exit 1
|
||||||
|
fi
|
||||||
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -n "$curr_version" ]; then # PKG *is* installed
|
if [ -n "$curr_version" ]; then # PKG *is* installed
|
||||||
|
|
|
@ -39,10 +39,10 @@ fi
|
||||||
|
|
||||||
case "$state_should" in
|
case "$state_should" in
|
||||||
present)
|
present)
|
||||||
echo gem install \""$name"\" --no-ri --no-rdoc
|
echo "gem install '$name' --no-ri --no-rdoc"
|
||||||
;;
|
;;
|
||||||
absent)
|
absent)
|
||||||
echo gem uninstall \""$name"\"
|
echo "gem uninstall '$name'"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Unknown state: $state_should" >&2
|
echo "Unknown state: $state_should" >&2
|
||||||
|
|
|
@ -44,7 +44,7 @@ else
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
aptget="DEBIAN_FRONTEND=noninteractive apt-get --quiet --yes --no-install-recommends -o Dpkg::Options::=\"--force-confdef\" -o Dpkg::Options::=\"--force-confold\""
|
aptget="DEBIAN_FRONTEND=noninteractive apt-get --quiet --yes --no-install-recommends -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confold"
|
||||||
|
|
||||||
case "$type" in
|
case "$type" in
|
||||||
yum)
|
yum)
|
||||||
|
|
|
@ -60,10 +60,10 @@ fi
|
||||||
|
|
||||||
case "$state_should" in
|
case "$state_should" in
|
||||||
present)
|
present)
|
||||||
echo yum $opts install \""$install_name"\"
|
echo "yum $opts install '$install_name'"
|
||||||
;;
|
;;
|
||||||
absent)
|
absent)
|
||||||
echo yum $opts remove \""$name"\"
|
echo "yum $opts remove '$name'"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Unknown state: $state_should" >&2
|
echo "Unknown state: $state_should" >&2
|
||||||
|
|
|
@ -61,15 +61,15 @@ case "$state_should" in
|
||||||
present)
|
present)
|
||||||
if [ -z "$version_should" ]; then
|
if [ -z "$version_should" ]; then
|
||||||
[ "$state_is" = "present" ] && exit 0 # if state is present, we dont need to do anything
|
[ "$state_is" = "present" ] && exit 0 # if state is present, we dont need to do anything
|
||||||
echo zypper $globalopts install --type \""$ptype"\" --auto-agree-with-licenses \""$name"\" ">/dev/null"
|
echo "zypper $globalopts install --type '$ptype' --auto-agree-with-licenses '$name' >/dev/null"
|
||||||
else
|
else
|
||||||
[ "$state_is" = "present" ] && [ "$version_should" = "$version_is" ] && exit 0 # if state is present and version is correct, we dont need to do anything
|
[ "$state_is" = "present" ] && [ "$version_should" = "$version_is" ] && exit 0 # if state is present and version is correct, we dont need to do anything
|
||||||
echo zypper $globalopts install --oldpackage --type \""$ptype"\" --auto-agree-with-licenses \""$name"\" = \""$version_should"\" ">/dev/null"
|
echo "zypper $globalopts install --oldpackage --type '$ptype' --auto-agree-with-licenses '$name' = '$version_should' >/dev/null"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
absent)
|
absent)
|
||||||
[ "$state_is" = "absent" ] && exit 0 # if state is absent, we dont need to do anything
|
[ "$state_is" = "absent" ] && exit 0 # if state is absent, we dont need to do anything
|
||||||
echo zypper $globalopts remove --type \""$ptype"\" \""$name"\" ">/dev/null"
|
echo "zypper $globalopts remove --type '$ptype' '$name' >/dev/null"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Unknown state: $state_should" >&2
|
echo "Unknown state: $state_should" >&2
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
name="$__object_id"
|
name="$__object_id"
|
||||||
|
|
||||||
if su - postgres -c "echo '\q' | psql '$name'" 2>/dev/null; then
|
if su -l postgres -c "echo '\q' | psql '$name'" 2>/dev/null; then
|
||||||
echo "present"
|
echo "present"
|
||||||
else
|
else
|
||||||
echo "absent"
|
echo "absent"
|
||||||
|
|
|
@ -29,10 +29,10 @@ if [ "$state_should" != "$state_is" ]; then
|
||||||
if [ -f "$__object/parameter/owner" ]; then
|
if [ -f "$__object/parameter/owner" ]; then
|
||||||
owner="-O '$(cat "$__object/parameter/owner")'"
|
owner="-O '$(cat "$__object/parameter/owner")'"
|
||||||
fi
|
fi
|
||||||
echo "su - postgres -c \"createdb $owner '$name'\""
|
echo "su -l postgres -c \"createdb $owner '$name'\""
|
||||||
;;
|
;;
|
||||||
absent)
|
absent)
|
||||||
echo "su - postgres -c \"dropdb '$name'\""
|
echo "su -l postgres -c \"dropdb '$name'\""
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -30,10 +30,10 @@ state_should=$( cat "$__object/parameter/state" )
|
||||||
case "$state_should" in
|
case "$state_should" in
|
||||||
present)
|
present)
|
||||||
cmd="CREATE EXTENSION IF NOT EXISTS $extension"
|
cmd="CREATE EXTENSION IF NOT EXISTS $extension"
|
||||||
echo "su - postgres -c 'psql -c \"$cmd\" \"$dbname\"'"
|
echo "su -l postgres -c 'psql -c \"$cmd\" \"$dbname\"'"
|
||||||
;;
|
;;
|
||||||
absent)
|
absent)
|
||||||
cmd="DROP EXTENSION IF EXISTS $extenstion"
|
cmd="DROP EXTENSION IF EXISTS $extenstion"
|
||||||
echo "su - postgres -c 'psql -c \"$cmd\" \"$dbname\"'"
|
echo "su -l postgres -c 'psql -c \"$cmd\" \"$dbname\"'"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
name="$__object_id"
|
name="$__object_id"
|
||||||
|
|
||||||
if su - postgres -c "psql -c '\du' | grep -q '^ *$name *|'"; then
|
if su -l postgres -c "psql -c '\du' | grep -q '^ *$name *|'"; then
|
||||||
echo "present"
|
echo "present"
|
||||||
else
|
else
|
||||||
echo "absent"
|
echo "absent"
|
||||||
|
|
|
@ -41,9 +41,9 @@ case "$state_should" in
|
||||||
[ -n "$password" ] && password="PASSWORD '$password'"
|
[ -n "$password" ] && password="PASSWORD '$password'"
|
||||||
|
|
||||||
cmd="CREATE ROLE $name WITH $password $booleans"
|
cmd="CREATE ROLE $name WITH $password $booleans"
|
||||||
echo "su - postgres -c \"psql -c \\\"$cmd\\\"\""
|
echo "su -l postgres -c \"psql -c \\\"$cmd\\\"\""
|
||||||
;;
|
;;
|
||||||
absent)
|
absent)
|
||||||
echo "su - postgres -c \"dropuser \\\"$name\\\"\""
|
echo "su -l postgres -c \"dropuser \\\"$name\\\"\""
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -18,4 +18,4 @@ format="$(cat "$__object/parameter/format")"
|
||||||
size="$(cat "$__object/parameter/size")"
|
size="$(cat "$__object/parameter/size")"
|
||||||
diskimage="/$__object_id"
|
diskimage="/$__object_id"
|
||||||
|
|
||||||
echo qemu-img create -f \""$format"\" \""$diskimage"\" \""$size"\"
|
echo "qemu-img create -f '$format' '$diskimage' '$size'"
|
||||||
|
|
|
@ -28,12 +28,12 @@ state_should="$(cat "$__object/parameter/state")"
|
||||||
case "$state_should" in
|
case "$state_should" in
|
||||||
present)
|
present)
|
||||||
cat << DONE
|
cat << DONE
|
||||||
su - $user -c "unset rvm_path; unset rvm_bin_path; unset rvm_prefix; unset rvm_version; curl -L get.rvm.io | bash -s stable"
|
su -l $user -c "unset rvm_path; unset rvm_bin_path; unset rvm_prefix; unset rvm_version; curl -L get.rvm.io | bash -s stable"
|
||||||
DONE
|
DONE
|
||||||
;;
|
;;
|
||||||
absent)
|
absent)
|
||||||
cat << DONE
|
cat << DONE
|
||||||
su - $user -c "rm -Rf \"\\\$HOME/.rvm\";
|
su -l $user -c "rm -Rf \"\\\$HOME/.rvm\";
|
||||||
sed '/rvm\/scripts\/rvm/d' \"\\\$HOME/.bashrc\" > \"\\\$HOME/.bashrc.cdist-tmp\"
|
sed '/rvm\/scripts\/rvm/d' \"\\\$HOME/.bashrc\" > \"\\\$HOME/.bashrc.cdist-tmp\"
|
||||||
mv \"\\\$HOME/.bashrc.cdist-tmp\" \"\\\$HOME/.bashrc\""
|
mv \"\\\$HOME/.bashrc.cdist-tmp\" \"\\\$HOME/.bashrc\""
|
||||||
DONE
|
DONE
|
||||||
|
|
|
@ -24,13 +24,13 @@ gemset="$(cat "$__object/parameter/gemset")"
|
||||||
ruby="$(echo "$gemset" | cut -d '@' -f 1)"
|
ruby="$(echo "$gemset" | cut -d '@' -f 1)"
|
||||||
gemsetname="$(echo "$gemset" | cut -d '@' -f2)"
|
gemsetname="$(echo "$gemset" | cut -d '@' -f2)"
|
||||||
user="$(cat "$__object/parameter/user")"
|
user="$(cat "$__object/parameter/user")"
|
||||||
if su - "$user" -c "[ ! -d \"\$HOME/.rvm\" ]" ; then
|
if su -l "$user" -c "[ ! -d \"\$HOME/.rvm\" ]" ; then
|
||||||
echo "absent"
|
echo "absent"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
if su - "$user" -c "source \"\$HOME/.rvm/scripts/rvm\"
|
if su -l "$user" -c "source \"\$HOME/.rvm/scripts/rvm\"
|
||||||
rvm list | grep -q $ruby"; then
|
rvm list | grep -q $ruby"; then
|
||||||
if su - "$user" -c "source \"\$HOME/.rvm/scripts/rvm\"
|
if su -l "$user" -c "source \"\$HOME/.rvm/scripts/rvm\"
|
||||||
rvm use $ruby > /dev/null 2>&1; rvm gemset list | grep -q $gemsetname &&
|
rvm use $ruby > /dev/null 2>&1; rvm gemset list | grep -q $gemsetname &&
|
||||||
rvm use $gemset > /dev/null 2>&1 && gem list | grep -q $gem"; then
|
rvm use $gemset > /dev/null 2>&1 && gem list | grep -q $gem"; then
|
||||||
echo "present"
|
echo "present"
|
||||||
|
|
|
@ -29,12 +29,12 @@ state_should="$(cat "$__object/parameter/state")"
|
||||||
case "$state_should" in
|
case "$state_should" in
|
||||||
present)
|
present)
|
||||||
cat << DONE
|
cat << DONE
|
||||||
su - "$user" -c 'source ~/.rvm/scripts/rvm; rvm use "$gemset"; gem install "$gem"'
|
su -l "$user" -c 'source ~/.rvm/scripts/rvm; rvm use "$gemset"; gem install "$gem"'
|
||||||
DONE
|
DONE
|
||||||
;;
|
;;
|
||||||
absent)
|
absent)
|
||||||
cat << DONE
|
cat << DONE
|
||||||
su - "$user" -c 'source ~/.rvm/scripts/rvm; rvm use "$gemset"; gem uninstall "$gem"'
|
su -l "$user" -c 'source ~/.rvm/scripts/rvm; rvm use "$gemset"; gem uninstall "$gem"'
|
||||||
DONE
|
DONE
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -28,8 +28,8 @@ if [ ! -e "~$user/.rvm/scripts/rvm" ] ; then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if su - "$user" -c "source ~/.rvm/scripts/rvm; rvm list strings | grep -q \"^$ruby\$\""; then
|
if su -l "$user" -c "source ~/.rvm/scripts/rvm; rvm list strings | grep -q \"^$ruby\$\""; then
|
||||||
if su - "$user" -c "source ~/.rvm/scripts/rvm; rvm use \"$ruby\" > /dev/null; rvm gemset list strings | cut -f 1 -d " " | grep -q \"^$gemsetname\$\""; then
|
if su -l "$user" -c "source ~/.rvm/scripts/rvm; rvm use \"$ruby\" > /dev/null; rvm gemset list strings | cut -f 1 -d " " | grep -q \"^$gemsetname\$\""; then
|
||||||
echo "present"
|
echo "present"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -31,18 +31,18 @@ state_should="$(cat "$__object/parameter/state")"
|
||||||
case "$state_should" in
|
case "$state_should" in
|
||||||
present)
|
present)
|
||||||
cat << DONE
|
cat << DONE
|
||||||
su - "$user" -c "source ~/.rvm/scripts/rvm; rvm $gemset --create"
|
su -l "$user" -c "source ~/.rvm/scripts/rvm; rvm $gemset --create"
|
||||||
DONE
|
DONE
|
||||||
if -f "$__object/parameter/default"; then
|
if -f "$__object/parameter/default"; then
|
||||||
cat << DONE
|
cat << DONE
|
||||||
su - "$user" -c "source ~/.rvm/scripts/rvm; rvm use --default $gemset"
|
su -l "$user" -c "source ~/.rvm/scripts/rvm; rvm use --default $gemset"
|
||||||
DONE
|
DONE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
;;
|
;;
|
||||||
absent)
|
absent)
|
||||||
cat << DONE
|
cat << DONE
|
||||||
su - "$user" -c "source ~/.rvm/scripts/rvm; rvm use $ruby; rvm --force gemset delete $gemsetname"
|
su -l "$user" -c "source ~/.rvm/scripts/rvm; rvm use $ruby; rvm --force gemset delete $gemsetname"
|
||||||
DONE
|
DONE
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -20,11 +20,11 @@
|
||||||
|
|
||||||
ruby="$__object_id"
|
ruby="$__object_id"
|
||||||
user="$(cat "$__object/parameter/user")"
|
user="$(cat "$__object/parameter/user")"
|
||||||
if su - "$user" -c "[ ! -d \"\$HOME/.rvm\" ]" ; then
|
if su -l "$user" -c "[ ! -d \"\$HOME/.rvm\" ]" ; then
|
||||||
echo "absent"
|
echo "absent"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
if su - "$user" -c "source \"\$HOME/.rvm/scripts/rvm\"
|
if su -l "$user" -c "source \"\$HOME/.rvm/scripts/rvm\"
|
||||||
rvm list | grep -q $ruby"; then
|
rvm list | grep -q $ruby"; then
|
||||||
echo "present"
|
echo "present"
|
||||||
else
|
else
|
||||||
|
|
|
@ -27,15 +27,15 @@ state_should="$(cat "$__object/parameter/state")"
|
||||||
|
|
||||||
case "$state_should" in
|
case "$state_should" in
|
||||||
present)
|
present)
|
||||||
echo "su - \"$user\" -c \"source \\\$HOME/.rvm/scripts/rvm;"\
|
echo "su -l \"$user\" -c \"source \\\$HOME/.rvm/scripts/rvm;"\
|
||||||
"rvm install $ruby\""
|
"rvm install $ruby\""
|
||||||
if [ -f "$__object/parameter/default" ]; then
|
if [ -f "$__object/parameter/default" ]; then
|
||||||
echo "su - \"$user\" -c \"source \\\$HOME/.rvm/scripts/rvm;"\
|
echo "su -l \"$user\" -c \"source \\\$HOME/.rvm/scripts/rvm;"\
|
||||||
"rvm use --default $ruby\""
|
"rvm use --default $ruby\""
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
absent)
|
absent)
|
||||||
echo "su - \"$user\" -c \"source \\\$HOME/.rvm/scripts/rvm;"\
|
echo "su -l \"$user\" -c \"source \\\$HOME/.rvm/scripts/rvm;"\
|
||||||
"rvm remove $ruby\""
|
"rvm remove $ruby\""
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ the_key="$(cat "$__object/parameter/key")"
|
||||||
validated_key="$(echo "${the_key}" | tr ' ' '\n' | awk '/^(ssh|ecdsa)-[^ ]+/ { printf $1" "; getline; printf $1 }')"
|
validated_key="$(echo "${the_key}" | tr ' ' '\n' | awk '/^(ssh|ecdsa)-[^ ]+/ { printf $1" "; getline; printf $1 }')"
|
||||||
if [ -z "${validated_key}" ]
|
if [ -z "${validated_key}" ]
|
||||||
then
|
then
|
||||||
echo "Key is invalid: \"${the_key}\"" >&2
|
echo "Key is invalid: '${the_key}'" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -37,16 +37,16 @@ case "$state_should" in
|
||||||
if [ "$init" = 'systemd' ]; then
|
if [ "$init" = 'systemd' ]; then
|
||||||
# this handles ALL linux distros with systemd
|
# this handles ALL linux distros with systemd
|
||||||
# e.g. archlinux, gentoo in some cases, new RHEL and SLES versions
|
# e.g. archlinux, gentoo in some cases, new RHEL and SLES versions
|
||||||
echo "systemctl -q enable \"$name\""
|
echo "systemctl -q enable '$name'"
|
||||||
else
|
else
|
||||||
case "$os" in
|
case "$os" in
|
||||||
debian)
|
debian)
|
||||||
case "$os_version" in
|
case "$os_version" in
|
||||||
[1-7]*)
|
[1-7]*)
|
||||||
echo "update-rc.d \"$name\" defaults >/dev/null"
|
echo "update-rc.d '$name' defaults >/dev/null"
|
||||||
;;
|
;;
|
||||||
8*)
|
8*)
|
||||||
echo "systemctl enable \"$name\""
|
echo "systemctl enable '$name'"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Unsupported version $os_version of $os" >&2
|
echo "Unsupported version $os_version of $os" >&2
|
||||||
|
@ -55,26 +55,26 @@ case "$state_should" in
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
devuan)
|
devuan)
|
||||||
echo "update-rc.d \"$name\" defaults >/dev/null"
|
echo "update-rc.d '$name' defaults >/dev/null"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
gentoo)
|
gentoo)
|
||||||
echo "rc-update add \"$name\" \"$target_runlevel\""
|
echo "rc-update add '$name' '$target_runlevel'"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
amazon|scientific|centos|fedora|owl|redhat|suse)
|
amazon|scientific|centos|fedora|owl|redhat|suse)
|
||||||
echo "chkconfig \"$name\" on"
|
echo "chkconfig '$name' on"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
openwrt)
|
openwrt)
|
||||||
# 'enable' can be successful and still return a non-zero exit
|
# 'enable' can be successful and still return a non-zero exit
|
||||||
# code, deal with it by checking for success ourselves in that
|
# code, deal with it by checking for success ourselves in that
|
||||||
# case (the || ... part).
|
# case (the || ... part).
|
||||||
echo "/etc/init.d/\"$name\" enable || [ -f /etc/rc.d/S??\"$name\" ]"
|
echo "/etc/init.d/$name enable || [ -f /etc/rc.d/S??$name ]"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
ubuntu)
|
ubuntu)
|
||||||
echo "update-rc.d \"$name\" defaults >/dev/null"
|
echo "update-rc.d '$name' defaults >/dev/null"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
freebsd)
|
freebsd)
|
||||||
|
@ -93,24 +93,24 @@ case "$state_should" in
|
||||||
if [ "$init" = 'systemd' ]; then
|
if [ "$init" = 'systemd' ]; then
|
||||||
# this handles ALL linux distros with systemd
|
# this handles ALL linux distros with systemd
|
||||||
# e.g. archlinux, gentoo in some cases, new RHEL and SLES versions
|
# e.g. archlinux, gentoo in some cases, new RHEL and SLES versions
|
||||||
echo "systemctl -q disable \"$name\""
|
echo "systemctl -q disable '$name'"
|
||||||
|
|
||||||
else
|
else
|
||||||
case "$os" in
|
case "$os" in
|
||||||
debian|ubuntu|devuan)
|
debian|ubuntu|devuan)
|
||||||
echo "update-rc.d -f \"$name\" remove"
|
echo "update-rc.d -f '$name' remove"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
gentoo)
|
gentoo)
|
||||||
echo "rc-update del \"$name\" \"$target_runlevel\""
|
echo "rc-update del '$name' '$target_runlevel'"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
centos|fedora|owl|redhat|suse)
|
centos|fedora|owl|redhat|suse)
|
||||||
echo "chkconfig \"$name\" off"
|
echo "chkconfig '$name' off"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
openwrt)
|
openwrt)
|
||||||
echo "\"/etc/init.d/$name\" disable"
|
echo "'/etc/init.d/$name' disable"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
|
|
|
@ -30,6 +30,6 @@ fi
|
||||||
|
|
||||||
case "$os" in
|
case "$os" in
|
||||||
ubuntu|debian|devuan|coreos)
|
ubuntu|debian|devuan|coreos)
|
||||||
echo "echo \"$timezone_should\" > /etc/timezone"
|
echo "echo '$timezone_should' > /etc/timezone"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -48,7 +48,7 @@ case "$os" in
|
||||||
__key_value ZONE \
|
__key_value ZONE \
|
||||||
--file /etc/sysconfig/clock \
|
--file /etc/sysconfig/clock \
|
||||||
--delimiter '=' \
|
--delimiter '=' \
|
||||||
--value "\"$timezone\""
|
--value "'$timezone'"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Your operating system ($os) is currently not supported by this type (${__type##*/})." >&2
|
echo "Your operating system ($os) is currently not supported by this type (${__type##*/})." >&2
|
||||||
|
|
|
@ -44,23 +44,23 @@ fi
|
||||||
for group in $changed_groups; do
|
for group in $changed_groups; do
|
||||||
if [ "$os" = "netbsd" ] || [ "$os" = "openbsd" ]; then
|
if [ "$os" = "netbsd" ] || [ "$os" = "openbsd" ]; then
|
||||||
case "$state_should" in
|
case "$state_should" in
|
||||||
present) echo "usermod -G \"$group\" \"$user\"" ;;
|
present) echo "usermod -G '$group' '$user'" ;;
|
||||||
absent) echo 'NetBSD and OpenBSD do not have a command to remove a user from a group' >&2 ; exit 1 ;;
|
absent) echo 'NetBSD and OpenBSD do not have a command to remove a user from a group' >&2 ; exit 1 ;;
|
||||||
esac
|
esac
|
||||||
elif [ "$os" = "freebsd" ]; then
|
elif [ "$os" = "freebsd" ]; then
|
||||||
case "$state_should" in
|
case "$state_should" in
|
||||||
present) echo "pw groupmod \"$group\" -m \"$user\"" ;;
|
present) echo "pw groupmod '$group' -m '$user'" ;;
|
||||||
absent) echo "pw groupmod \"$group\" -d \"$user\"" ;;
|
absent) echo "pw groupmod '$group' -d '$user'" ;;
|
||||||
esac
|
esac
|
||||||
elif [ "$oldusermod" = "true" ]; then
|
elif [ "$oldusermod" = "true" ]; then
|
||||||
case "$state_should" in
|
case "$state_should" in
|
||||||
present) echo "usermod -A \"$group\" \"$user\"" ;;
|
present) echo "usermod -A '$group' '$user'" ;;
|
||||||
absent) echo "usermod -R \"$group\" \"$user\"" ;;
|
absent) echo "usermod -R '$group' '$user'" ;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
case "$state_should" in
|
case "$state_should" in
|
||||||
present) echo "gpasswd -a \"$user\" \"$group\"" ;;
|
present) echo "gpasswd -a '$user' '$group'" ;;
|
||||||
absent) echo "gpasswd -d \"$user\" \"$group\"" ;;
|
absent) echo "gpasswd -d '$user' '$group'" ;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
|
@ -71,14 +71,14 @@ fi
|
||||||
|
|
||||||
case "$state_should" in
|
case "$state_should" in
|
||||||
present)
|
present)
|
||||||
echo zypper $zypper_def_opts addservice -t "$stype" "$uri" \"$desc\"
|
echo "zypper $zypper_def_opts addservice -t '$stype' '$uri' '$desc'"
|
||||||
echo zypper $zypper_def_opts refs
|
echo "zypper $zypper_def_opts refs"
|
||||||
echo zypper $zypper_def_opts ref
|
echo "zypper $zypper_def_opts ref"
|
||||||
;;
|
;;
|
||||||
absent)
|
absent)
|
||||||
echo zypper $zypper_def_opts removeservice "$service_id"
|
echo "zypper $zypper_def_opts removeservice '$service_id'"
|
||||||
echo zypper $zypper_def_opts refs
|
echo "zypper $zypper_def_opts refs"
|
||||||
echo zypper $zypper_def_opts ref
|
echo "zypper $zypper_def_opts ref"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Unknown state: $state_should" >&2
|
echo "Unknown state: $state_should" >&2
|
||||||
|
|
Loading…
Reference in a new issue