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 "cd bootcd; ./build.sh -f %s.txt -t usb_partition -o /plc/data/var/www/html/bootcds/%s-partition.usb &> /dev/null" % ( hostname, hostname)
19 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))
21 #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))
22 print "cd bootcd; ./build.sh -f %s.txt -t usb_partition -o /plc/data/var/www/html/bootcds/%s-partition.usb &> /dev/null" % ( hostname, hostname)
23 #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))
24 # assume that the images have already been generated..
29 args['url_list'] = " http://%s/bootcds/%s-partition.usb\n" % (config.MONITOR_HOSTNAME, hostname)
30 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)
35 args['url_list'] = " http://%s/bootcds/%s.iso" % (config.MONITOR_HOSTNAME, hostname)
37 args['url_list'] = " http://%s/bootcds/%s-partition.usb\n" % (config.MONITOR_HOSTNAME, hostname)
38 args['url_list'] += " http://%s/bootcds/%s.iso" % (config.MONITOR_HOSTNAME, hostname)
43 if __name__ == '__main__':
44 parser = parsermodule.getParser()
45 parser.set_defaults(media='both', force=False)
46 parser.add_option("", "--media", dest="media", metavar="usb, iso, both",
47 help="""Which media to generate the message for.""")
48 parser.add_option("", "--force", dest="force", action="store_true",
49 help="""Force the recreation of the usb images.""")
50 parser = parsermodule.getParser(['defaults'], parser)
52 config = parsermodule.parse_args(parser)
54 ret = {'url_list' : ''}
56 conf = getconf(i, config.force, config.media)
57 ret['url_list'] += conf['url_list']
60 if config.media == "both":
64 Here are links to both the ISO CD image, and partitioned, USB image for the
65 DC7800 and others. These are based on the new 4.2 BootImage, and are the most
66 up-to-date software for PlanetLab nodes.
70 All that is necessary is to raw-write these images to a usb stick or CD-ROM, and
71 then boot from them. If using USB, please use a command like:
73 dd if=%(hostname)s.usb of=/dev/sdX
75 Where sdX is your USB device. It is not necessary to run any other formatting
76 commands for these images, because they already include a MBR, partition
79 Please let me know if you have any trouble.
85 elif config.media == "iso":
89 Here are links to the ISO CD image(s) for your machines. These are based on
90 the new 4.2 BootImage, and are the most up-to-date software for PlanetLab
95 All that is necessary is to burn these images to a CD-ROM, and
98 Please let me know if you have any trouble.
104 elif config.media == "usb":
108 Here are links to the partitioned, USB images for the DC7800 and others.
109 These are based on the new 4.2 BootImage, and are the most
110 up-to-date software for PlanetLab nodes.
114 All that is necessary is to raw-write these images to a usb stick, and
115 then boot from them. Please use a command like:
117 dd if=%(hostname)s.usb of=/dev/sdX
119 Where sdX is your direct, USB device. Do not use a partition on the usb
120 image, or the boot will fail. It is not necessary to run any other formatting
121 commands for these images, because they already include a MBR, partition
124 Please let me know if you have any trouble.