Make the path to the binary independent from CWD

Change-Id: Ib30d619b0603759640e7a52f5d954daa98a25554
Signed-off-by: Stefan Tauner <stefan.tauner@gmx.at>
Reviewed-on: http://review.coreboot.org/1518
Tested-by: build bot (Jenkins)
Reviewed-by: Anton Kochkov <anton.kochkov@gmail.com>
diff --git a/xfv/xfv.py b/xfv/xfv.py
index 0a1b97e..5e6d141 100755
--- a/xfv/xfv.py
+++ b/xfv/xfv.py
@@ -4,6 +4,7 @@
 import os
 from struct import unpack
 
+efidecomp_path = os.path.dirname(os.path.realpath(__file__)) + "/efidecomp"
 fvh_count = 0
 
 ### Formatting: GUIDs
@@ -151,7 +152,7 @@
         f.write(compdata[9:])
         f.close()
 
-        os.system("./efidecomp <_tmp_decompress >_tmp_result")
+        os.system("%s <_tmp_decompress >_tmp_result" % efidecomp_path)
 
         f = file("_tmp_result", "rb")
         decompdata = f.read()
@@ -307,10 +308,12 @@
 ### main code
 
 if __name__ == '__main__':
+    if not (os.path.isfile(efidecomp_path) and os.access(efidecomp_path, os.X_OK)):
+        print "ERROR: %s is not executable!" % efidecomp_path
+        exit(1)
+
     if len(sys.argv) > 1:
         for filename in sys.argv[1:]:
             analyze_diskfile(filename)
     else:
         print "No file specified, giving up"
-
-# EOF