| Line | |
|---|
| 1 | #!/usr/bin/python |
|---|
| 2 | #--------------------------------------------------------------- |
|---|
| 3 | # Project : pxemngr |
|---|
| 4 | # File : nextboot |
|---|
| 5 | # Copyright : 2009 Splitted-Desktop Systems |
|---|
| 6 | # Author : Frederic Lepied |
|---|
| 7 | # Created On : Sun Feb 1 13:54:41 2009 |
|---|
| 8 | # Purpose : configure the profile for the next PXE boot |
|---|
| 9 | # of a system. |
|---|
| 10 | #--------------------------------------------------------------- |
|---|
| 11 | |
|---|
| 12 | import sys |
|---|
| 13 | import os |
|---|
| 14 | import settings |
|---|
| 15 | from pxe.models import * |
|---|
| 16 | from pxe.common import * |
|---|
| 17 | |
|---|
| 18 | if len(sys.argv) != 3: |
|---|
| 19 | error('Usage: %s <system name> <boot name>' % sys.argv[0]) |
|---|
| 20 | |
|---|
| 21 | name = sys.argv[1] |
|---|
| 22 | |
|---|
| 23 | try: |
|---|
| 24 | system = System.objects.get(name=name) |
|---|
| 25 | except System.DoesNotExist: |
|---|
| 26 | if name == 'default': |
|---|
| 27 | system = System(name=name) |
|---|
| 28 | system.save() |
|---|
| 29 | else: |
|---|
| 30 | error('System %s not defined' % name) |
|---|
| 31 | |
|---|
| 32 | set_next_boot(system, sys.argv[2]) |
|---|
| 33 | |
|---|
| 34 | # nextboot ends here |
|---|