remove pseudo debug output redirection

Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
Steven Armstrong 2013-09-17 22:41:10 +02:00
parent f67cdc8afa
commit bfae291cf7
4 changed files with 3 additions and 74 deletions

View file

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# #
# 2011 Steven Armstrong (steven-cdist at armstrong.cc) # 2011-2013 Steven Armstrong (steven-cdist at armstrong.cc)
# #
# This file is part of cdist. # This file is part of cdist.
# #
@ -21,17 +21,6 @@
device="$(cat "$__object/parameter/device")" device="$(cat "$__object/parameter/device")"
type="$(cat "$__object/parameter/type")" type="$(cat "$__object/parameter/type")"
# show command output in debug mode
cat << DONE
__debug=$__cdist_debug
if [ "\$__debug" != "yes" ]; then
# Link file descriptor #6 with stdout
exec 6>&1
# redirect all output to /dev/null
exec > /dev/null
fi
DONE
case "$type" in case "$type" in
swap) swap)
echo "mkswap $device" echo "mkswap $device"
@ -62,10 +51,3 @@ case "$type" in
fi fi
echo "$command" echo "$command"
esac esac
cat << DONE
if [ "\$__debug" != "yes" ]; then
# Restore stdout and close file descriptor #6.
exec 1>&6 6>&-
fi
DONE

View file

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# #
# 2011 Steven Armstrong (steven-cdist at armstrong.cc) # 2011-2013 Steven Armstrong (steven-cdist at armstrong.cc)
# #
# This file is part of cdist. # This file is part of cdist.
# #
@ -18,18 +18,6 @@
# along with cdist. If not, see <http://www.gnu.org/licenses/>. # along with cdist. If not, see <http://www.gnu.org/licenses/>.
# #
# show command output in debug mode
cat << DONE
__debug=$__cdist_debug
if [ "\$__debug" != "yes" ]; then
# Link file descriptor #6 with stdout
exec 6>&1
# redirect all output to /dev/null
exec > /dev/null
fi
DONE
get_type_from_mkfs() { get_type_from_mkfs() {
_device="$1" _device="$1"
for mkfs_object in $(find "$__global/object/__install_mkfs" -path "*.cdist"); do for mkfs_object in $(find "$__global/object/__install_mkfs" -path "*.cdist"); do
@ -69,10 +57,3 @@ else
echo "[ -d \"$mount_point\" ] || mkdir -p \"$mount_point\"" echo "[ -d \"$mount_point\" ] || mkdir -p \"$mount_point\""
echo "mount -t \"$type\" $options \"$device\" \"$mount_point\"" echo "mount -t \"$type\" $options \"$device\" \"$mount_point\""
fi fi
cat << DONE
if [ "\$__debug" != "yes" ]; then
# Restore stdout and close file descriptor #6.
exec 1>&6 6>&-
fi
DONE

View file

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# #
# 2011 Steven Armstrong (steven-cdist at armstrong.cc) # 2011-2013 Steven Armstrong (steven-cdist at armstrong.cc)
# #
# This file is part of cdist. # This file is part of cdist.
# #
@ -71,15 +71,6 @@ get_objects() {
} }
# include function library for use on target # include function library for use on target
cat << DONE
__debug=$__cdist_debug
if [ "\$__debug" != "yes" ]; then
# Link file descriptor #6 with stdout
exec 6>&1
# redirect all output to /dev/null
exec > /dev/null
fi
DONE
cat "$__type/files/lib.sh" cat "$__type/files/lib.sh"
partitions="$__object/explorer/partitions" partitions="$__object/explorer/partitions"
@ -166,10 +157,3 @@ for object in $objects; do
echo "toggle_bootable '$device' '$minor' || die 'Failed to toogle bootable flag for partition: $partition'" echo "toggle_bootable '$device' '$minor' || die 'Failed to toogle bootable flag for partition: $partition'"
fi fi
done done
cat << DONE
if [ "\$__debug" != "yes" ]; then
# Restore stdout and close file descriptor #6.
exec 1>&6 6>&-
fi
DONE

View file

@ -18,17 +18,6 @@
# along with cdist. If not, see <http://www.gnu.org/licenses/>. # along with cdist. If not, see <http://www.gnu.org/licenses/>.
# #
# show command output in debug mode
cat << DONE
__debug=$__cdist_debug
if [ "\$__debug" != "yes" ]; then
# Link file descriptor #6 with stdout
exec 6>&1
# redirect all output to /dev/null
exec > /dev/null
fi
DONE
uri="$(cat "$__object/parameter/uri" 2>/dev/null \ uri="$(cat "$__object/parameter/uri" 2>/dev/null \
|| echo "$__object_id")" || echo "$__object_id")"
target="$(cat "$__object/parameter/target")" target="$(cat "$__object/parameter/target")"
@ -38,10 +27,3 @@ target="$(cat "$__object/parameter/target")"
[ "$__debug" = "yes" ] && tar="tar -xvzp" || tar="tar -xzp" [ "$__debug" = "yes" ] && tar="tar -xvzp" || tar="tar -xzp"
echo "$curl '$uri' | $tar -C '$target'" echo "$curl '$uri' | $tar -C '$target'"
cat << DONE
if [ "\$__debug" != "yes" ]; then
# Restore stdout and close file descriptor #6.
exec 1>&6 6>&-
fi
DONE