- let rec loop () =
- open_centered_window ~stage:"Network"
- 60 20 "Configure network";
-
- let autolist = Newt.listbox 4 2 4 [Newt.SCROLL] in
- Newt.listbox_set_width autolist 52;
-
- (* Populate the "Automatic" listbox with RHEL/Fedora
- * root partitions found which allow us to do
- * automatic configuration in a known way.
- *)
- let partition_map = Hashtbl.create 13 in
- let maplen = ref 1 in
- let rec iloop = function
- | [] -> ()
- | (partition, LinuxRoot (_, ((RHEL _|Fedora _) as distro)))
- :: parts ->
- let label =
- sprintf "%s (%s)"
- (dev_of_partition partition)
- (string_of_linux_distro distro) in
- Hashtbl.add partition_map (!maplen) partition;
- ignore (
- Newt.listbox_append_entry autolist label (!maplen)
- );
- incr maplen;
- iloop parts
- | _ :: parts -> iloop parts
- in
- iloop all_partitions;
-
- (* If there is no suitable root partition (the listbox
- * is empty) then disable the auto option and the listbox.
- *)
- let no_auto = Hashtbl.length partition_map = 0 in
-
- let auto =
- Newt.radio_button 1 1
- "Automatic from:" (not no_auto) None in
- let shell =
- Newt.radio_button 1 6
- "Start a shell" no_auto (Some auto) in
-
- if no_auto then (
- Newt.component_takes_focus auto false;
- Newt.component_takes_focus autolist false
- );
-
- let qemu =
- Newt.radio_button 1 7
- "QEMU user network" false (Some shell) in
- let nonet =
- Newt.radio_button 1 8
- "No network or network already configured" false
- (Some qemu) in
- let static =
- Newt.radio_button 1 9
- "Static configuration:" false (Some nonet) in
-
- let label1 = Newt.label 4 10 "Interface" in
- let entry1 = Newt.entry 16 10 (Some "eth0") 8 [] in
- let label2 = Newt.label 4 11 "Address" in
- let entry2 = Newt.entry 16 11 None 16 [] in
- let label3 = Newt.label 4 12 "Netmask" in
- let entry3 = Newt.entry 16 12 (Some "255.255.255.0") 16 [] in
- let label4 = Newt.label 4 13 "Gateway" in
- let entry4 = Newt.entry 16 13 None 16 [] in
- let label5 = Newt.label 4 14 "Nameserver" in
- let entry5 = Newt.entry 16 14 None 16 [] in
-
- let enable_static () =
- Newt.component_takes_focus entry1 true;
- Newt.component_takes_focus entry2 true;
- Newt.component_takes_focus entry3 true;
- Newt.component_takes_focus entry4 true;
- Newt.component_takes_focus entry5 true
- in
-
- let disable_static () =
- Newt.component_takes_focus entry1 false;
- Newt.component_takes_focus entry2 false;
- Newt.component_takes_focus entry3 false;
- Newt.component_takes_focus entry4 false;
- Newt.component_takes_focus entry5 false
- in
+ open_centered_window ~stage:"Network"
+ 60 20 "Configure network";
+
+ let autolist = Newt.listbox 4 2 4 [Newt.SCROLL] in
+ Newt.listbox_set_width autolist 52;
+
+ (* Populate the "Automatic" listbox with RHEL/Fedora
+ * root partitions found which allow us to do
+ * automatic configuration in a known way.
+ *)
+ let partition_map = Hashtbl.create 13 in
+ let maplen = ref 1 in
+ let rec loop = function
+ | [] -> ()
+ | (partition, LinuxRoot (_, ((RHEL _|Fedora _) as distro)))
+ :: parts ->
+ let label =
+ sprintf "%s (%s)"
+ (dev_of_partition partition)
+ (string_of_linux_distro distro) in
+ Hashtbl.add partition_map (!maplen) partition;
+ ignore (
+ Newt.listbox_append_entry autolist label (!maplen)
+ );
+ incr maplen;
+ loop parts
+ | _ :: parts -> loop parts
+ in
+ loop all_partitions;
+
+ (* If there is no suitable root partition (the listbox
+ * is empty) then disable the auto option and the listbox.
+ *)
+ let no_auto = Hashtbl.length partition_map = 0 in
+
+ let auto =
+ Newt.radio_button 1 1
+ "Automatic from:" (not no_auto) None in
+ let shell =
+ Newt.radio_button 1 6
+ "Start a shell" no_auto (Some auto) in
+
+ if no_auto then (
+ Newt.component_takes_focus auto false;
+ Newt.component_takes_focus autolist false
+ );