jre_package.py 931 B

1234567891011121314151617181920212223242526272829303132
  1. #!/usr/bin/env python
  2. import os
  3. from pisi.util import join_path
  4. executables = (
  5. 'jaotc', 'java', 'jfr', 'jjs', 'jrunscript', 'keytool', 'pack200', 'rmid', 'rmiregistry', 'unpack200'
  6. )
  7. bin_dir = '/usr/bin'
  8. jvm_dir = '/usr/lib/jvm/java-openjdk'
  9. def postInstall(fromVersion, fromRelease, toVersion, toRelease):
  10. for executable in executables:
  11. try:
  12. os.system('update-alternatives --install %s %s %s 2' % (
  13. join_path(bin_dir, executable), executable, join_path(jvm_dir, 'bin', executable)
  14. ))
  15. os.system('update-alternatives --auto %s' % executable)
  16. except:
  17. pass
  18. def postRemove():
  19. for executable in executables:
  20. try:
  21. os.system('update-alternatives --remove %s %s' % (executable, join_path(jvm_dir, 'bin', executable)))
  22. os.system('update-alternatives --auto %s' % executable)
  23. except:
  24. pass