From 28533f9411ae99851b9cfa260a04b21f67874b71 Mon Sep 17 00:00:00 2001 From: penguhyang Date: Mon, 28 Sep 2015 23:08:55 -0400 Subject: [PATCH] check the postscripts before running it with 'bash -x' --- xCAT-server/share/xcat/install/scripts/post.ubuntu | 8 ++++++-- xCAT-server/share/xcat/install/scripts/post.xcat | 8 ++++++-- xCAT/postscripts/xcatdsklspost | 8 ++++++-- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/xCAT-server/share/xcat/install/scripts/post.ubuntu b/xCAT-server/share/xcat/install/scripts/post.ubuntu index 935ea4be3..01b35b9e4 100755 --- a/xCAT-server/share/xcat/install/scripts/post.ubuntu +++ b/xCAT-server/share/xcat/install/scripts/post.ubuntu @@ -159,8 +159,12 @@ run_ps () { echo \"\`date\` Running postscript: \$*\" msgutil_r \"\$MASTER_IP\" \"info\" "\"\`date\` Running postscript: \$*\"" \"\$logfile\" if [ \"\$XCATDEBUGMODE\" = \"1\" ]; then - bash -x ./\$@ 2>&1 | tee -a \$logfile - ret_local=\${PIPESTATUS[0]} + local compt=\$(file \$1) + local reg=\"shell script\" + if [[ \"\$compt\" =~ \$reg ]]; then + bash -x ./\$@ 2>&1 | tee -a \$logfile + ret_local=\${PIPESTATUS[0]} + fi else ./\$@ 2>&1 | tee -a \$logfile ret_local=\${PIPESTATUS[0]} diff --git a/xCAT-server/share/xcat/install/scripts/post.xcat b/xCAT-server/share/xcat/install/scripts/post.xcat index 85632056e..7c1719200 100755 --- a/xCAT-server/share/xcat/install/scripts/post.xcat +++ b/xCAT-server/share/xcat/install/scripts/post.xcat @@ -144,8 +144,12 @@ run_ps () { echo \"\`date\` Running postscript: \$*\" msgutil_r \"\$MASTER_IP\" \"info\" "\"\`date\` Running postscript: \$*\"" \"\$logfile\" if [ \"\$XCATDEBUGMODE\" = \"1\" ]; then - bash -x ./\$@ 2>&1 | tee -a \$logfile - ret_local=\${PIPESTATUS[0]} + local compt=\$(file \$1) + local reg=\"shell script\" + if [[ \"\$compt\" =~ \$reg ]]; then + bash -x ./\$@ 2>&1 | tee -a \$logfile + ret_local=\${PIPESTATUS[0]} + fi else ./\$@ 2>&1 | tee -a \$logfile ret_local=\${PIPESTATUS[0]} diff --git a/xCAT/postscripts/xcatdsklspost b/xCAT/postscripts/xcatdsklspost index 646ef18e3..cf86c2e03 100755 --- a/xCAT/postscripts/xcatdsklspost +++ b/xCAT/postscripts/xcatdsklspost @@ -829,8 +829,12 @@ run_ps () { echo \"\`date\` Running postscript: \$*\" msgutil_r \"\$MASTER_IP\" \"info\" "\"\`date\` Running postscript: \$*\"" \"\$logfile\" if [ \"\$XCATDEBUGMODE\" = \"1\" ]; then - bash -x ./\$@ 2>&1 | tee -a \$logfile - ret_local=\${PIPESTATUS[0]} + local compt=\$(file \$1) + local reg=\"shell script\" + if [[ \"\$compt\" =~ \$reg ]]; then + bash -x ./\$@ 2>&1 | tee -a \$logfile + ret_local=\${PIPESTATUS[0]} + fi else ./\$@ 2>&1 | tee -a \$logfile ret_local=\${PIPESTATUS[0]}