Revision 4a2fd05c image_creator/os_type/linux.py
b/image_creator/os_type/linux.py | ||
---|---|---|
126 | 126 |
self.g.rm(rule_file) |
127 | 127 |
|
128 | 128 |
@sysprep() |
129 |
def remove_swap_entry(self, print_header=True): |
|
130 |
"""Remove swap entry from /etc/fstab. If swap is the last partition |
|
131 |
then the partition will be removed when shrinking is performed. If the |
|
132 |
swap partition is not the last partition in the disk or if you are not |
|
133 |
going to shrink the image you should probably disable this. |
|
134 |
""" |
|
135 |
|
|
136 |
if print_header: |
|
137 |
output('Removing swap entry from fstab') |
|
138 |
|
|
139 |
new_fstab = "" |
|
140 |
fstab = self.g.cat('/etc/fstab') |
|
141 |
for line in fstab.splitlines(): |
|
142 |
|
|
143 |
entry = line.split('#')[0].strip().split() |
|
144 |
if len(entry) == 6 and entry[2] == 'swap': |
|
145 |
continue |
|
146 |
|
|
147 |
new_fstab += "%s\n" % line |
|
148 |
|
|
149 |
self.g.write('/etc/fstab', new_fstab) |
|
150 |
|
|
151 |
@sysprep() |
|
129 | 152 |
def persistent_devs(self, print_header=True): |
130 | 153 |
"""Scan fstab & grub configuration files and replace all non-persistent |
131 | 154 |
device appearences with UUIDs. |
Also available in: Unified diff