link-intel-driver.py 885 B

12345678910111213141516171819202122232425262728
  1. #!/usr/bin/python
  2. import sys, os, string, subprocess, shutil, fileinput, multiprocessing, re, resource
  3. try:
  4. #########################################
  5. #### get the locations of directories ###
  6. #########################################
  7. print "Make sure you have downloaded and installed the Intel sgx driver " + \
  8. "from https://github.com/01org/linux-sgx-driver."
  9. while True:
  10. isgx = raw_input('Enter the Intel sgx driver derctory: ')
  11. if os.path.exists(isgx + '/isgx.h'):
  12. break
  13. print '{0} is not a directory for the Intel sgx driver'.format(isgx)
  14. isgx_link = 'linux-sgx-driver'
  15. isgx = os.path.abspath(isgx)
  16. print isgx_link + ' -> ' + isgx
  17. if os.path.exists(isgx_link):
  18. os.unlink(isgx_link)
  19. os.symlink(isgx, isgx_link)
  20. except:
  21. print 'uh-oh: {0}'.format(sys.exc_info()[0])
  22. exit(-1)