3 from monitor.wrapper import plc
4 from monitor import config
5 import monitor.parser as parsermodule
10 def getconf(hostname, force=False, media=None):
11 n = api.GetNodes(hostname)
12 filename = "bootcd/" + hostname + ".txt"
13 if not os.path.exists(filename) or force:
14 f = open("bootcd/" + hostname + ".txt", 'w')
15 f.write( api.AdmGenerateNodeConfFile(n[0]['node_id']) )
17 print os.system("cd bootcd; ./build.sh -f %s.txt -t iso -o /plc/data/var/www/html/bootcds/%s.iso &> /dev/null" % ( hostname, hostname))
18 print os.system("cd bootcd; ./build.sh -f %s.txt -t usb_partition -o /plc/data/var/www/html/bootcds/%s-partition.usb &> /dev/null" % ( hostname, hostname))
20 # assume that the images have already been generated..
25 args['url_list'] = " http://%s/bootcds/%s-partition.usb\n" % (config.MONITOR_HOSTNAME, hostname)
26 args['url_list'] += " http://%s/bootcds/%s.iso" % (config.MONITOR_HOSTNAME, hostname)
29 args['url_list'] = " http://%s/bootcds/%s-partition.usb\n" % (config.MONITOR_HOSTNAME, hostname)
31 args['url_list'] = " http://%s/bootcds/%s.iso" % (config.MONITOR_HOSTNAME, hostname)
33 args['url_list'] = " http://%s/bootcds/%s-partition.usb\n" % (config.MONITOR_HOSTNAME, hostname)
34 args['url_list'] += " http://%s/bootcds/%s.iso" % (config.MONITOR_HOSTNAME, hostname)
39 if __name__ == '__main__':
40 parser = parsermodule.getParser()
41 parser.set_defaults(media='both', force=False)
42 parser.add_option("", "--media", dest="media", metavar="usb, iso, both",
43 help="""Which media to generate the message for.""")
44 parser.add_option("", "--force", dest="force", action="store_true",
45 help="""Force the recreation of the usb images.""")
46 parser = parsermodule.getParser(['defaults'], parser)
48 config = parsermodule.parse_args(parser)
50 ret = {'url_list' : ''}
52 conf = getconf(i, config.force, config.media)
53 ret['url_list'] += conf['url_list']
56 if config.media == "both":
60 Here are links to both the ISO CD image, and partitioned, USB image for the
61 DC7800 and others. These are based on the new 4.2 BootImage, and are the most
62 up-to-date software for PlanetLab nodes.
66 All that is necessary is to raw-write these images to a usb stick or CD-ROM, and
67 then boot from them. If using USB, please use a command like:
69 dd if=%(hostname)s.usb of=/dev/sdX
71 Where sdX is your USB device. It is not necessary to run any other formatting
72 commands for these images, because they already include a MBR, partition
75 Please let me know if you have any trouble.
81 elif config.media == "iso":
85 Here are links to the ISO CD image(s) for your machines. These are based on
86 the new 4.2 BootImage, and are the most up-to-date software for PlanetLab
91 All that is necessary is to burn these images to a CD-ROM, and
94 Please let me know if you have any trouble.
100 elif config.media == "usb":
104 Here are links to the partitioned, USB images for the DC7800 and others.
105 These are based on the new 4.2 BootImage, and are the most
106 up-to-date software for PlanetLab nodes.
110 All that is necessary is to raw-write these images to a usb stick, and
111 then boot from them. Please use a command like:
113 dd if=%(hostname)s.usb of=/dev/sdX
115 Where sdX is your direct, USB device. Do not use a partition on the usb
116 image, or the boot will fail. It is not necessary to run any other formatting
117 commands for these images, because they already include a MBR, partition
120 Please let me know if you have any trouble.