Skip to content

Commit 4471936

Browse files
committed
WIP: Avoid FD juggling in scriptlets
1 parent 79e2b98 commit 4471936

File tree

1 file changed

+1
-18
lines changed

1 file changed

+1
-18
lines changed

packaging/common/script-templates/script-common-header-last.sh

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,29 +21,12 @@ is_nova()
2121
test "$PROJECT_TYPE" = "cfengine-nova" || test "$PROJECT_TYPE" = "cfengine-nova-hub"
2222
}
2323

24-
INSTLOG=/var/log/CFEngineHub-Install.log
25-
mkdir -p "$(dirname "$INSTLOG")"
26-
CONSOLE=7
27-
# Redirect most output to log file, but keep console around for custom output.
28-
case "$SCRIPT_TYPE" in
29-
pre*)
30-
eval "exec $CONSOLE>&1 > $INSTLOG 2>&1"
31-
;;
32-
*)
33-
eval "exec $CONSOLE>&1 >> $INSTLOG 2>&1"
34-
;;
35-
esac
3624
echo "$SCRIPT_TYPE:"
3725

3826
# Output directly to console, bypassing log.
3927
cf_console()
4028
{
41-
# Use subshell to prevent "set +x" from leaking out into the rest of the
42-
# execution.
43-
(
44-
set +x
45-
"$@" 1>&$CONSOLE 2>&$CONSOLE
46-
)
29+
"$@"
4730
}
4831

4932
set -x

0 commit comments

Comments
 (0)