micpartition.py 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #!/usr/bin/env python -tt
  2. #
  3. # Marko Saukko <marko.saukko@cybercom.com>
  4. #
  5. # Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
  6. #
  7. # This copyrighted material is made available to anyone wishing to use, modify,
  8. # copy, or redistribute it subject to the terms and conditions of the GNU
  9. # General Public License v.2. This program is distributed in the hope that it
  10. # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the
  11. # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  12. # See the GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License along with
  15. # this program; if not, write to the Free Software Foundation, Inc., 51
  16. # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  17. from pykickstart.commands.partition import *
  18. class Mic_PartData(FC4_PartData):
  19. removedKeywords = FC4_PartData.removedKeywords
  20. removedAttrs = FC4_PartData.removedAttrs
  21. def __init__(self, *args, **kwargs):
  22. FC4_PartData.__init__(self, *args, **kwargs)
  23. self.deleteRemovedAttrs()
  24. self.align = kwargs.get("align", None)
  25. self.extopts = kwargs.get("extopts", None)
  26. self.part_type = kwargs.get("part_type", None)
  27. def _getArgsAsStr(self):
  28. retval = FC4_PartData._getArgsAsStr(self)
  29. if self.align:
  30. retval += " --align"
  31. if self.extopts:
  32. retval += " --extoptions=%s" % self.extopts
  33. if self.part_type:
  34. retval += " --part-type=%s" % self.part_type
  35. return retval
  36. class Mic_Partition(FC4_Partition):
  37. removedKeywords = FC4_Partition.removedKeywords
  38. removedAttrs = FC4_Partition.removedAttrs
  39. def _getParser(self):
  40. op = FC4_Partition._getParser(self)
  41. # The alignment value is given in kBytes. e.g., value 8 means that
  42. # the partition is aligned to start from 8096 byte boundary.
  43. op.add_option("--align", type="int", action="store", dest="align",
  44. default=None)
  45. op.add_option("--extoptions", type="string", action="store", dest="extopts",
  46. default=None)
  47. op.add_option("--part-type", type="string", action="store", dest="part_type",
  48. default=None)
  49. return op