Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Commit 1e2c45c

Browse files
authored
Merge pull request #12 from darrenldl/dev
Added main menu
2 parents 127e04e + 5880d96 commit 1e2c45c

File tree

8 files changed

+187
-87
lines changed

8 files changed

+187
-87
lines changed

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ script:
2424
- docker exec installer_builder bash -c 'cp -r ~/oali-master ~/oali'
2525
- docker exec installer_builder bash -c 'chmod u=rwx ~/oali'
2626
- docker exec installer_builder bash -c 'eval $(opam env); cd ~/oali/installer_ml; make'
27-
- docker cp installer_builder:/home/opam/oali/installer_ml/_build/default/src/installer.exe ./installer
28-
- strip installer
27+
- docker cp installer_builder:/home/opam/oali/installer_ml/_build/default/src/oali.exe ./oali
28+
- strip oali
2929

3030
deploy:
3131
provider: releases
3232
api_key:
3333
secure: iSx+Ztrz9rI97R3waKGM3Lv8GehszPnjEEdY7U2wePRbOwXrdlTohoIotyGY1TbfyluzOKF51tvctpJbezRWEPUGQb173C+nv35o/fHiN6CGDT77DUzqEtFYEBlb6o4sUPtRTkKaD1qw7Jei7ttk+CDA4zRmyd/fdp/krdNdyFVYzlXklobt3+XRikRxmHioxfI9vd7AJp4VebO+4UmC9Ja7HLu7UiHtwxZOJHvpS0NFaaucN7RsgFIYQLf+pPca6M0RFSuBUS4xCA+D27/sTEjGpQicVu50uI4sMpJx2rzqf4m2OW1IERn+p2tegMofJBTxPqQERG1N1nmzbOGYKp3u9WJsV5/XmbvWrXk9LV5DbkDn7v6lkKSby905FFgqAVKxtE2VXib0rGBIJ/kHcgoz1Bvt3t6uHUMCV4R8azy400NesqpRDZc6ocKFleKEvDkYJQB5INWLUiu9rLpV2wEPjNV56EY7zULgbwlHCedKtVoHT7SCpVb6Gt4onr/GqrKKdC+0jiNWbfyKoYfNbDAonSt/mhgA4GIG/6D5/2O1hkymbtAsiOCkrPyVlh/9p8sTiWg6DxkNANkqHasn+uJPWaXKKjhSSzWuwS516uqdVdyj3xUjiyMNLeIrSvYJwbJKN4zfogsYXvHrwj7WwAqX0DV3otweCGtZt8LpWYU=
34-
file: installer
34+
file: oali
3535
on:
3636
tags: true
3737
repo: darrenldl/oali

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- Previously partition name may not be correctly deduced during formatting
66
- Added task unit for using `reflector` to generate more optimised mirrorlist
77
- Added SSH server setup and SSH keys transfer code
8+
- Added a very rough main menu
89

910
# 0.0.2
1011
- Added following user options when task unit fails

README.md

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,28 +17,41 @@ Oali is an installer written in OCaml which sets up a Arch Linux installation wi
1717
- Optional full disk encryption
1818
- Optional `linux-hardened` kernel installation
1919

20-
Oali aims to be smart and hassle free, so following features are included as a result
21-
- Automatic adjustment of dialogues and settings based on whether the live CD is running in UEFI or BIOS mode
20+
Overall oali aims to be snappy, minimal, smart, and hassle free. See **Specifics** section below for more information.
2221

23-
## Prerequisites
22+
## Getting started
23+
#### Prerequisites
2424
- Working internet connection
2525
- Partitioning done for system partition
2626
- USB key (data will be lost)
2727

28-
## Space requirement
28+
#### Space requirement
2929
- USB key (if you intend to use disk layout that utilises a USB key)
3030
- 1 GiB USB drive will be very sufficient
3131
- System drive
3232
- Current salt states download/install around 10 GiB of data
3333

34-
## Instructions
34+
#### Instructions
3535
The OCaml code is not self contained, thus if you choose to compile it yourself, you will need to install various dependencies.
3636

3737
For deployment purposes, it is recommended that you use the static binaries provided, which you can download via [GitHub releases](https://github.com/darrenldl/ocaml-linux-installer/releases)
3838

3939
The static binaries of the installer are built via Travis CI using `ocaml/opam2:alpine` Docker image, and should be able to run on Arch Linux live CD without any further setup
4040

41+
## Answers to some "Why?" questions
42+
- Why make an installer to begin with?
43+
- Mildly complex FDE setups are really laborious and error prone to set up, and unfortunately you can't really afford human errors during these set ups depending on the nature of installation
44+
- A lot of decisions are based on information processing and very mechanical - no point in having a human devoted to repeating deterministic steps
45+
- Why not bash?
46+
- The previous iteration of this installer was written in bash actually (see `scripts/setup.sh`), but it only supported one disk layout and always have encryption
47+
- Adding a lot of decision making code and information handling code to bash code was really tedious and difficult
48+
- Why OCaml?
49+
- I know I can do OCaml/Rust reasonably fast, but slow to a crawl with dynamically typed langs
50+
- Here is mostly a lot of handling of immutable information (e.g. processing of system information), where Rust doesn't carry a significant advantage over OCaml, and the overhead didn't seem worth it to me
51+
4152
## Specifics
53+
#### EFI/BIOS
54+
Oali automatically adjusts dialogues and settings based on whether the live CD is running in UEFI or BIOS mode
4255

4356
#### Disk layout choices
4457
**Single system disk** - Oali slices the disks into ESP (if in EFI mode), boot and root partitions automatically

installer_ml/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ all : exe
2222

2323
.PHONY: exe
2424
exe:
25-
dune build src/installer.exe
25+
dune build src/oali.exe
2626

2727
.PHONY: format
2828
format :

installer_ml/src/disk_utils.ml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
let sync () = Proc_utils.exec "sync"
2+
13
let list_disk_block_devs () =
4+
sync ();
25
let dir = "/dev/disk/by-path/" in
36
let paths = Sys.readdir dir |> Array.to_list in
47
let dsts =
@@ -78,5 +81,3 @@ let uuid_of_dev dev =
7881
|> List.filter (fun (s, _) -> s = Filename.basename dev)
7982
|> List.hd
8083
|> fun (_, uuid) -> uuid
81-
82-
let sync () = Proc_utils.exec "sync"

installer_ml/src/dune

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
(executable
2-
(name installer)
2+
(name oali)
33
(libraries core_kernel
44
sexplib
55
re
Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,6 @@ let () =
258258
disk boot_part_end_MB
259259
(frac_to_perc Config.total_disk_usage_frac));
260260
exec (Printf.sprintf "parted %s set 1 boot on" disk);
261-
Disk_utils.sync ();
262261
let parts = Disk_utils.parts_of_disk disk in
263262
let esp_part_path = List.nth parts 0 |> Option.some in
264263
let boot_part_path = List.nth parts 1 in
@@ -283,7 +282,6 @@ let () =
283282
disk boot_part_end_MB
284283
(frac_to_perc Config.total_disk_usage_frac));
285284
exec (Printf.sprintf "parted %s set 1 boot on" disk);
286-
Disk_utils.sync ();
287285
let parts = Disk_utils.parts_of_disk disk in
288286
let boot_part_path = List.nth parts 0 in
289287
let sys_part_path = List.nth parts 1 in
@@ -428,7 +426,6 @@ let () =
428426
(Printf.sprintf "parted -a optimal %s mkpart primary %dMB %dMB"
429427
usb_key boot_part_beg_MB boot_part_end_MB);
430428
exec (Printf.sprintf "parted %s set 1 boot on" usb_key);
431-
Disk_utils.sync ();
432429
let parts = Disk_utils.parts_of_disk usb_key in
433430
let esp_part_path = List.nth parts 0 |> Option.some in
434431
let boot_part_path = List.nth parts 1 in
@@ -448,7 +445,6 @@ let () =
448445
(Printf.sprintf "parted -a optimal %s mkpart primary 0%% %dMB"
449446
usb_key boot_part_end_MB);
450447
exec (Printf.sprintf "parted %s set 1 boot on" usb_key);
451-
Disk_utils.sync ();
452448
let parts = Disk_utils.parts_of_disk usb_key in
453449
let boot_part_path = List.nth parts 0 in
454450
let disk_layout =
@@ -893,8 +889,7 @@ let () =
893889
{config with enable_ssh_server = Some enable_ssh_server});
894890
reg ~name:"Installing SSH server" (fun config ->
895891
Arch_chroot.install ["openssh"];
896-
config
897-
);
892+
config);
898893
reg ~name:"Copying sshd_config over" (fun config ->
899894
FileUtil.cp [Config.sshd_config_path_in_repo] Config.etc_ssh_dir_path;
900895
config);
@@ -930,8 +925,9 @@ let () =
930925
ip port otp;
931926
print_endline "or";
932927
Printf.printf
933-
"cat PUBKEY | gpg --batch --yes --passphrase %s -c | ncat %s %d\n"
928+
" cat PUBKEY | gpg --batch --yes --passphrase %s -c | ncat %s %d\n"
934929
otp ip port;
930+
print_newline ();
935931
exec (Printf.sprintf "ncat -lp %d > %s" port recv_dst_path);
936932
print_newline ();
937933
print_endline "File received";

0 commit comments

Comments
 (0)