001-ufw-target-path.patch 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. diff -Naurp a/.applied_patches_list b/.applied_patches_list
  2. --- a/.applied_patches_list 2017-12-11 12:39:29.935135715 +0100
  3. +++ b/.applied_patches_list 2017-12-11 12:38:33.543052804 +0100
  4. @@ -0,0 +1 @@
  5. +/home/ru/BUILD/B_IOT/PSG/package/python-ufw/001-set-executable.patch
  6. diff -Naurp a/setup.py b/setup.py
  7. --- a/setup.py 2016-02-18 06:26:44.000000000 +0100
  8. +++ b/setup.py 2017-12-11 12:38:43.075066819 +0100
  9. @@ -63,6 +63,9 @@ class Install(_install, object):
  10. real_prefix = self.home + '/usr'
  11. real_sharedir = os.path.join(real_prefix, 'share', 'ufw')
  12. + br_target_dir = os.environ.get('TARGET_DIR')
  13. + real_statedir = br_target_dir + real_statedir
  14. +
  15. # Update the modules' paths
  16. for fn in [ 'common.py' ]:
  17. # 'staging' is used with just 'install' but build_lib is used when
  18. @@ -123,10 +126,10 @@ class Install(_install, object):
  19. self.mkpath(os.path.dirname(f))
  20. # update the interpreter to that of the one the user specified for setup
  21. - print("Updating staging/ufw to use %s" % (sys.executable))
  22. + print("Updating staging/ufw to use %s" % ('/usr/bin/env python'))
  23. subprocess.call(["sed",
  24. "-i",
  25. - "1s%^#.*python.*%#! /usr/bin/env " + sys.executable + "%g",
  26. + "1s%^#.*python.*%#! /usr/bin/env " + 'python' + "%g",
  27. 'staging/ufw'])
  28. self.copy_file('staging/ufw', script)
  29. self.copy_file('doc/ufw.8', manpage)
  30. @@ -158,6 +161,9 @@ class Install(_install, object):
  31. if self.root != None:
  32. confdir = self.root + real_confdir
  33. + if br_target_dir != None:
  34. + confdir = br_target_dir + confdir
  35. +
  36. defaults = os.path.join(confdir, 'default', 'ufw')
  37. ufwconf = os.path.join(confdir, 'ufw', 'ufw.conf')
  38. sysctl = os.path.join(confdir, 'ufw', 'sysctl.conf')
  39. @@ -169,13 +175,16 @@ class Install(_install, object):
  40. user6_rules = os.path.join(confdir, 'ufw', 'user6.rules')
  41. apps_dir = os.path.join(confdir, 'ufw', 'applications.d')
  42. +
  43. init_before_hook = os.path.join(confdir, 'ufw', 'before.init')
  44. init_after_hook = os.path.join(confdir, 'ufw', 'after.init')
  45. for f in [ defaults, ufwconf ]:
  46. self.mkpath(os.path.dirname(f))
  47. +
  48. self.mkpath(apps_dir)
  49. +
  50. for f in os.listdir('profiles'):
  51. self.copy_file(os.path.join('profiles', f), apps_dir)