Bump up to release 2.0.3
[tools/mic.git] / mic / kickstart / custom_commands / partition.py
1 #!/usr/bin/python3 -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
18 from pykickstart.commands.partition import *
19
20 class Mic_PartData(FC4_PartData):
21     removedKeywords = FC4_PartData.removedKeywords
22     removedAttrs = FC4_PartData.removedAttrs
23
24     def __init__(self, *args, **kwargs):
25         FC4_PartData.__init__(self, *args, **kwargs)
26         self.deleteRemovedAttrs()
27         self.align = kwargs.get("align", None)
28         self.extopts = kwargs.get("extopts", None)
29         self.f2fsopts = kwargs.get("f2fsopts", None)
30         self.part_type = kwargs.get("part_type", None)
31         self.uuid = kwargs.get("uuid", None)
32         self.exclude_image = kwargs.get("exclude_from_image", False)
33         self.vdfsopts = kwargs.get("vdfsopts", None)
34         self.squashfsopts = kwargs.get("squashfsopts", None)
35         self.squashfsoptions_maxsize = kwargs.get("squashfsoptions_maxsize", None)
36         self.cpioopts = kwargs.get("cpioopts", None)
37         self.no_shrink = kwargs.get("no_shrink", False)
38         self.init_expand = kwargs.get("init_expand", False)
39
40     def _getArgsAsStr(self):
41         retval = FC4_PartData._getArgsAsStr(self)
42
43         if self.align:
44             retval += " --align"
45         if self.extopts:
46             retval += " --extoptions=%s" % self.extopts
47         if self.f2fsopts:
48             retval += " --f2fsoptions=%s" % self.f2fsopts
49         if self.part_type:
50             retval += " --part-type=%s" % self.part_type
51         if self.uuid:
52             retval += " --uuid=%s" % self.uuid
53         if self.exclude_image:
54             retval += " --exclude-from-image"
55         if self.vdfsopts:
56             retval += " --vdfsoptions=%s" % self.vdfsopts
57         if self.squashfsopts:
58             retval += " --squashfsoptions=%s" % self.squashfsopts
59         if self.squashfsoptions_maxsize:
60             retval += " --squashfsoptions_maxsize=%s" % self.squashfsoptions_maxsize
61         if self.cpioopts:
62             retval += " --cpiooptions=%s" % self.cpioopts
63         if self.no_shrink:
64             retval += " --no-shrink"
65         if self.init_expand:
66             retval += " --init-expand"
67         return retval
68
69 class Mic_Partition(FC4_Partition):
70     removedKeywords = FC4_Partition.removedKeywords
71     removedAttrs = FC4_Partition.removedAttrs
72
73     def _getParser(self):
74         op = FC4_Partition._getParser(self)
75         # The alignment value is given in kBytes. e.g., value 8 means that
76         # the partition is aligned to start from 8096 byte boundary.
77         op.add_argument("--align", type=int, action="store", dest="align",
78                       default=None, version=FC4, help='align')
79         op.add_argument("--extoptions", type=str, action="store", dest="extopts",
80                       default=None, version=FC4, help='extoptions')
81         op.add_argument("--f2fsoptions", type=str, action="store", dest="f2fsopts",
82                       default=None, version=FC4, help='f2fsoptions')
83         op.add_argument("--part-type", type=str, action="store", dest="part_type",
84                       default=None, version=FC4, help='part-type')
85         op.add_argument("--uuid", dest="uuid", action="store", type=str, version=FC4, help='uuid')
86         op.add_argument("--exclude-from-image", action="store_true", dest="exclude_image",
87                       default=False, version=FC4, help='exclude-from-image')
88         op.add_argument("--vdfsoptions", type=str, action="store", dest="vdfsopts",
89                       default=None, version=FC4, help='vdfsoptions')
90         op.add_argument("--squashfsoptions", type=str, action="store", dest="squashfsopts",
91                       default=None, version=FC4, help='squashfsoptions')
92         op.add_argument("--squashfsoptions_maxsize", type=str, action="store", dest="squashfsoptions_maxsize",
93                        default=None, version=FC4, help='squashfsoptions_maxsiz')
94         op.add_argument("--cpiooptions", type=str, action="store", dest="cpioopts",
95                       default=None, version=FC4, help='cpiooptions')
96         op.add_argument("--no-shrink", action="store_true", dest="no_shrink", default=False, version=FC4, help='no-shrink')
97         op.add_argument("--init-expand", action="store_true", dest="init_expand", default=False, version=FC4, help='init-expand')
98         return op