Hello Ofer Schreiber,

I'd like you to do a code review.  Please visit

    http://gerrit.ovirt.org/21187

to review the following change.

Change subject: packaging: Avoid using the file command
......................................................................

packaging: Avoid using the file command

There is no need to execute `file` in order to determine if a given file
is an executable, the bulitin -x test is enough.

Change-Id: I190571c5b36f08772fc795eca9fbd082ba248c04
Signed-off-by: Ofer Schreiber <oschr...@redhat.com>
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1029036
---
M packaging/dbscripts/dbfunctions.sh
1 file changed, 1 insertion(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/87/21187/1

diff --git a/packaging/dbscripts/dbfunctions.sh 
b/packaging/dbscripts/dbfunctions.sh
index e4def77..2125fc6 100755
--- a/packaging/dbscripts/dbfunctions.sh
+++ b/packaging/dbscripts/dbfunctions.sh
@@ -220,8 +220,7 @@
 
 run_file() {
    local execFile=${1}
-   isShellScript=$(file $execFile | grep "shell" | wc -l)
-   if [ $isShellScript -gt 0 ]; then
+   if [ -x "${execFile}" ]; then
        echo "Running upgrade shell script $execFile ..."
        export  DATABASE="${DATABASE}" SERVERNAME="${SERVERNAME}" 
PORT="${PORT}" USERNAME="${USERNAME}"
       ./$execFile


-- 
To view, visit http://gerrit.ovirt.org/21187
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I190571c5b36f08772fc795eca9fbd082ba248c04
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.3
Gerrit-Owner: Sandro Bonazzola <sbona...@redhat.com>
Gerrit-Reviewer: Ofer Schreiber <oschr...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to