OLD | NEW |
1 # Copyright 2009 Google Inc. Released under the GPL v2 | 1 # Copyright 2009 Google Inc. Released under the GPL v2 |
2 | 2 |
3 import re | 3 import re |
4 | 4 |
5 | 5 |
6 class boottool(object): | 6 class boottool(object): |
7 """ | 7 """ |
8 Common class for the client and server side boottool wrappers. | 8 Common class for the client and server side boottool wrappers. |
9 """ | 9 """ |
10 | 10 |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 """ | 257 """ |
258 Removes a specific entry from the bootloader configuration. | 258 Removes a specific entry from the bootloader configuration. |
259 | 259 |
260 @param kernel: can be 'start', 'end', entry position or entry title. | 260 @param kernel: can be 'start', 'end', entry position or entry title. |
261 """ | 261 """ |
262 self._run_boottool('--remove-kernel=%s' % kernel) | 262 self._run_boottool('--remove-kernel=%s' % kernel) |
263 | 263 |
264 | 264 |
265 def boot_once(self, title=None): | 265 def boot_once(self, title=None): |
266 """ | 266 """ |
267 Sets a specific entry for the next boot Then falls back to the | 267 Sets a specific entry for the next boot, then falls back to the |
268 default kernel. | 268 default kernel. |
269 | 269 |
270 @param kernel: title that identifies the entry to set for booting. If | 270 @param kernel: title that identifies the entry to set for booting. If |
271 evaluates to false it will use the default entry title. | 271 evaluates to false, this becomes a no-op. |
272 (FIXME: that does not make much sense, if an entry is default | |
273 by definition that means it boots next anyways so maybe it | |
274 should be a NOP for title evaluating to False) | |
275 """ | 272 """ |
276 if not title: | 273 if title: |
277 title = self.get_default_title() | 274 self._run_boottool('--boot-once', '--title=%s' % title) |
278 self._run_boottool('--boot-once', '--title=%s' % title) | |
279 | 275 |
280 | 276 |
281 def enable_xen_mode(self): | 277 def enable_xen_mode(self): |
282 """ | 278 """ |
283 Enables xen mode. Future operations will assume xen is being used. | 279 Enables xen mode. Future operations will assume xen is being used. |
284 """ | 280 """ |
285 self._xen_mode = True | 281 self._xen_mode = True |
286 | 282 |
287 | 283 |
288 def disable_xen_mode(self): | 284 def disable_xen_mode(self): |
289 """ | 285 """ |
290 Disables xen mode. | 286 Disables xen mode. |
291 """ | 287 """ |
292 self._xen_mode = False | 288 self._xen_mode = False |
293 | 289 |
294 | 290 |
295 def get_xen_mode(self): | 291 def get_xen_mode(self): |
296 """ | 292 """ |
297 Returns a boolean with the current status of xen mode. | 293 Returns a boolean with the current status of xen mode. |
298 """ | 294 """ |
299 return self._xen_mode | 295 return self._xen_mode |
OLD | NEW |