Revision e77e66a9 image_creator/os_type/unix.py
b/image_creator/os_type/unix.py | ||
---|---|---|
35 | 35 |
import sys |
36 | 36 |
|
37 | 37 |
from image_creator.os_type import OSBase, sysprep |
38 |
from image_creator.util import warn, output |
|
39 | 38 |
|
40 | 39 |
|
41 | 40 |
class Unix(OSBase): |
... | ... | |
48 | 47 |
'.thunderbird' |
49 | 48 |
] |
50 | 49 |
|
51 |
def __init__(self, rootdev, ghandler): |
|
52 |
super(Unix, self).__init__(rootdev, ghandler) |
|
50 |
def __init__(self, rootdev, ghandler, output):
|
|
51 |
super(Unix, self).__init__(rootdev, ghandler, output)
|
|
53 | 52 |
|
54 | 53 |
self.meta["USERS"] = " ".join(self._get_passworded_users()) |
55 | 54 |
|
... | ... | |
75 | 74 |
"""Remove all user accounts with id greater than 1000""" |
76 | 75 |
|
77 | 76 |
if print_header: |
78 |
output('Removing all user accounts with id greater than 1000') |
|
77 |
self.out.output( |
|
78 |
'Removing all user accounts with id greater than 1000') |
|
79 | 79 |
|
80 | 80 |
# Remove users from /etc/passwd |
81 | 81 |
passwd = [] |
... | ... | |
123 | 123 |
"""Remove all passwords and lock all user accounts""" |
124 | 124 |
|
125 | 125 |
if print_header: |
126 |
output('Cleaning up passwords & locking all user accounts') |
|
126 |
self.out.output( |
|
127 |
'Cleaning up passwords & locking all user accounts') |
|
127 | 128 |
|
128 | 129 |
shadow = [] |
129 | 130 |
|
... | ... | |
141 | 142 |
"""Remove all regular files under /var/cache""" |
142 | 143 |
|
143 | 144 |
if print_header: |
144 |
output('Removing files under /var/cache') |
|
145 |
self.out.output('Removing files under /var/cache')
|
|
145 | 146 |
|
146 | 147 |
self.foreach_file('/var/cache', self.g.rm, ftype='r') |
147 | 148 |
|
... | ... | |
150 | 151 |
"""Remove all files under /tmp and /var/tmp""" |
151 | 152 |
|
152 | 153 |
if print_header: |
153 |
output('Removing files under /tmp and /var/tmp') |
|
154 |
self.out.output('Removing files under /tmp and /var/tmp')
|
|
154 | 155 |
|
155 | 156 |
self.foreach_file('/tmp', self.g.rm_rf, maxdepth=1) |
156 | 157 |
self.foreach_file('/var/tmp', self.g.rm_rf, maxdepth=1) |
... | ... | |
160 | 161 |
"""Empty all files under /var/log""" |
161 | 162 |
|
162 | 163 |
if print_header: |
163 |
output('Emptying all files under /var/log') |
|
164 |
self.out.output('Emptying all files under /var/log')
|
|
164 | 165 |
|
165 | 166 |
self.foreach_file('/var/log', self.g.truncate, ftype='r') |
166 | 167 |
|
... | ... | |
169 | 170 |
"""Remove all files under /var/mail and /var/spool/mail""" |
170 | 171 |
|
171 | 172 |
if print_header: |
172 |
output('Removing files under /var/mail and /var/spool/mail')
|
|
173 |
self.out.output('Removing files under /var/mail & /var/spool/mail')
|
|
173 | 174 |
|
174 | 175 |
self.foreach_file('/var/spool/mail', self.g.rm_rf, maxdepth=1) |
175 | 176 |
self.foreach_file('/var/mail', self.g.rm_rf, maxdepth=1) |
... | ... | |
181 | 182 |
homedirs = ['/root'] + self.ls('/home/') |
182 | 183 |
|
183 | 184 |
if print_header: |
184 |
output('Removing sensitive user data under %s' % " ". |
|
185 |
self.out.output('Removing sensitive user data under %s' % " ".
|
|
185 | 186 |
join(homedirs)) |
186 | 187 |
|
187 | 188 |
for homedir in homedirs: |
Also available in: Unified diff