/[scire]/webgli/bootloader.php
Gentoo

Contents of /webgli/bootloader.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 69 - (show annotations) (download)
Sun May 21 01:37:31 2006 UTC (12 years, 5 months ago) by codeman
File size: 2938 byte(s)
updating svn with current webgli.  not sure of any
significant updates here.

1 <?php
2
3 include('webgliIP.php');
4 include('webgliCF.php');
5 include('webgliUtility.php');
6
7 include('Smarty.class.php');
8 $smarty = new Smarty;
9
10 $smarty->template_dir = './templates';
11 $smarty->compile_dir = './templates_c';
12 $smarty->cache_dir = './cache';
13 $smarty->config_dir = './configs';
14
15 $ip = new InstallProfile();
16 $ip->parse('test.xml');
17 $cf = new ClientConfiguration();
18 $cf->parse('testcc.xml');
19
20 $error_msg = "";
21
22 if ($_POST['setbootloader']) {
23 if ($_POST['bootloader']) {
24 $ip->set("bootloader_pkg",$_POST['bootloader']);
25 $error_msg .= "ERROR: Could not set the bootloader pkg!";
26 }
27 if ($_POST['bootmbr']) {
28 $ip->set("bootloader_mbr",True);
29 $error_msg .= "ERROR: Could not set the bootloader MBR flag to TRUE";
30 if ($_POST['boot_drive_choice']) {
31 $ip->set("boot_device",$_POST['boot_drive_choice']);
32 $error_msg .= "ERROR! Could not set the boot device! ".$_POST['boot_drive_choice'];
33 }
34 }
35 else {
36 $ip->set("bootloader_mbr",False);
37 $error_msg .= "ERROR: Could not set the bootloader MBR flag to FALSE.";
38 }
39 if ($_POST['bootargs']) {
40 $ip->set("bootloader_kernel_args",$_POST['bootargs']);
41 $error_msg .= "ERROR: Could not set the bootloader kernel arguments!";
42 }
43
44 if (!$error_msg) {
45 $error_msg = "Values saved successfully";
46 }
47 }
48 $arch = $cf->get("architecture_template");
49
50 $boot_device = $ip->get("boot_device");
51 #Bootloader code yanked from the x86ArchTemplate
52 $devices = $ip->get("partition_tables");
53 $foundboot = False;
54 $drives = array_keys($devices);
55 sort($drives);
56 foreach ($drives as $drive) {
57 $partlist = $devices[$drive];
58 sort($partlist);
59 foreach( $partlist as $part) {
60 if ($part["mountpoint"] == "/boot") {
61 print "found! <br>";
62 $boot_device = $drive;
63 $foundboot = True;
64 }
65 if ( ($part["mountpoint"] == "/") and (!$foundboot)) {
66 $boot_device = $drive;
67 print "set! $boot_device<br>";
68 }
69 }
70 }
71 }
72 print "Boot device: $boot_device <br>";
73 print substr($boot_device,-1);
74 /*
75 bootloader = shared_info.install_profile.get_boot_loader_pkg()
76 $arch_loaders = array('x86': [
77 ("grub",(u"GRand Unified Bootloader, newer, RECOMMENDED")),
78 ("lilo",(u"LInux LOader, older, traditional.(detects windows partitions)"))],
79 'amd64': [
80 ("grub",(u"GRand Unified Bootloader, newer, RECOMMENDED"))]} #FIXME ADD OTHER ARCHS
81 boot_loaders = arch_loaders[arch]
82 boot_loaders.append(("none", (u"Do not install a bootloader. (System may be unbootable!)")))
83 bootargs = shared_info.install_profile.get_bootloader_kernel_args()
84 */
85 $bootloaders = array();
86 array_push($bootloaders, array("grub", "GRand Unified Bootloader, newer, RECOMMENDED") );
87 array_push($bootloaders, array("lilo", "LInux LOader, older, traditional.(detects windows partitions)") );
88
89 $smarty->assign('boot_device', $boot_device);
90 $smarty->assign('bootargs', $bootargs);
91 $smarty->assign('bootloaders', $bootloaders);
92 $smarty->assign('advanced', True); #FIXME
93
94 $smarty->display('bootloader.tpl');
95 ?>

  ViewVC Help
Powered by ViewVC 1.1.20