@@ -219,24 +219,18 @@ User is allowed to continue said setup if they wishes to however
219219 selected to not encrypt root" ;
220220 confirm_answer_is_correct_end_retry ~ret :encrypt_sys )
221221 in
222- if encrypt then (
223- if encrypt_boot then
224- { config with encrypt_sys = Some `Keyfile }
222+ if encrypt then
223+ if encrypt_boot then { config with encrypt_sys = Some `Keyfile }
225224 else (
226- print_endline "Since boot partition is not encrypted, please specify whether system partition should use passphrase or keyfile" ;
225+ print_endline
226+ "Since boot partition is not encrypted, please specify whether \
227+ system partition should use passphrase or keyfile" ;
227228 let choices =
228- [
229- ("passphrase" , `Passphrase);
230- ("keyfile" , `Keyfile);
231- ]
229+ [ ("passphrase" , `Passphrase); ("keyfile" , `Keyfile) ]
232230 in
233231 let choice = pick_choice_kv choices in
234- { config with encrypt_sys = Some choice }
235- )
236- )
237- else
238- { config with encrypt_sys = Some `None }
239- );
232+ { config with encrypt_sys = Some choice } )
233+ else { config with encrypt_sys = Some `None } );
240234 reg ~name :"Adjust cryptsetup parameters for root partition" ~doc :luks_doc
241235 (fun answer_store config ->
242236 if Option. get config .encrypt_sys <> `None then
@@ -663,31 +657,28 @@ if using the USB key disk layout|}
663657 config );
664658 reg ~name :"Install keyfile for /"
665659 ~doc :{|Sets up keyfile to be embedded into the initramfs|}
666- (fun _answer_store config -> (
667- match Option. get config .encrypt_sys with
668- | `None | `Passphrase ->
669- print_endline "Skipped"
670- | `Keyfile -> (
671- let disk_layout = Option. get config .disk_layout in
672- let root = Disk_layout. get_root disk_layout in
673- match root .l1 with
674- | Clear _ -> failwith "Expected LUKS"
675- | Luks { info; _ } ->
676- let keyfile_path =
677- concat_file_names
678- [
679- Config. root_mount_point ;
680- Config. root_dir ;
681- Config. sys_part_keyfile_name ;
682- ]
683- in
684- let oc = open_out_bin keyfile_path in
685- Fun. protect
686- ~finally :(fun () -> close_out oc )
687- (fun () -> output_string oc info .primary_key );
688- Unix. chmod keyfile_path 0o000 )
689- )
690- ;
660+ (fun _answer_store config ->
661+ (match Option. get config .encrypt_sys with
662+ | `None | `Passphrase -> print_endline "Skipped"
663+ | `Keyfile -> (
664+ let disk_layout = Option. get config .disk_layout in
665+ let root = Disk_layout. get_root disk_layout in
666+ match root .l1 with
667+ | Clear _ -> failwith "Expected LUKS"
668+ | Luks { info; _ } ->
669+ let keyfile_path =
670+ concat_file_names
671+ [
672+ Config. root_mount_point ;
673+ Config. root_dir ;
674+ Config. sys_part_keyfile_name ;
675+ ]
676+ in
677+ let oc = open_out_bin keyfile_path in
678+ Fun. protect
679+ ~finally :(fun () -> close_out oc )
680+ (fun () -> output_string oc info .primary_key );
681+ Unix. chmod keyfile_path 0o000 ));
691682 config );
692683 reg ~name :"Install keyfile for unlocking /boot"
693684 ~doc :
@@ -774,15 +765,15 @@ The line is then commented if disk layout uses USB key|}
774765 fun s ->
775766 match Re. matches re s with
776767 | [] -> [ s ]
777- | _ ->
778- match encrypt_sys with
779- | `Keyfile ->
780- [
781- Printf. sprintf "FILES=(%s)"
782- (concat_file_names
783- [ "/root" ; Config. sys_part_keyfile_name ]);
784- ]
785- | `None | `Passphrase -> [ s ]
768+ | _ -> (
769+ match encrypt_sys with
770+ | `Keyfile ->
771+ [
772+ Printf. sprintf "FILES=(%s)"
773+ (concat_file_names
774+ [ "/root" ; Config. sys_part_keyfile_name ]);
775+ ]
776+ | `None | `Passphrase -> [ s ])
786777 in
787778 let fill_in_HOOKS =
788779 let re = "^HOOKS" |> Re.Posix. re |> Re. compile in
@@ -793,7 +784,8 @@ The line is then commented if disk layout uses USB key|}
793784 [
794785 Printf. sprintf "HOOKS=(%s)"
795786 (String. concat " "
796- (Mkinitcpio_utils. gen_mkinitcpio_hooks ~encrypt_sys ~use_lvm ));
787+ (Mkinitcpio_utils. gen_mkinitcpio_hooks ~encrypt_sys
788+ ~use_lvm ));
797789 ]
798790 in
799791 File. filter_map_lines ~file fill_in_FILES ;
0 commit comments