Skip to content

Commit

Permalink
client: init handle internal cygwin installation
Browse files Browse the repository at this point in the history
  • Loading branch information
rjbou committed May 10, 2023
1 parent 25d8103 commit 0d12eab
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
28 changes: 23 additions & 5 deletions src/client/opamClient.ml
Original file line number Diff line number Diff line change
Expand Up @@ -727,16 +727,34 @@ let windows_checks config =
| Ok cygcheck -> Some (success cygcheck)
| Error msg -> OpamConsole.error "%s" msg; None
in
match enter_paths () with
| Some config -> config
| None -> menu ()
let prompt () =
let options = [
`Internal, "Install and maintain an internal Cygwin installation";
`Specify, "Enter the location of a Cygwin installation and setup path";
`Abort, "Abort initialisation";
] in
OpamConsole.menu "How should opam acquire Cygwin?" ~no:`Internal ~options
in
match prompt () with
| `Abort -> OpamStd.Sys.exit_because `Aborted
| `Internal ->
let cygcheck =
OpamSysInteract.Cygwin.install
~packages:OpamInitDefaults.required_packages_for_cygwin
in
let config = success cygcheck in
config
| `Specify ->
match enter_paths () with
| Some config -> config
| None -> menu ()
in
OpamConsole.header_msg "Unix support infrastructure";
OpamConsole.msg
"\n\
opam and the OCaml ecosystem in general require various Unix tools \
in order to operate correctly. At present, this requires \
an already present Cygwin installation to provide these tools.\n\n";
in order to operate correctly. At present, this requires the \
installation of Cygwin to provide these tools.\n\n";
menu ()
in
let config =
Expand Down
3 changes: 3 additions & 0 deletions src/state/opamSysInteract.ml
Original file line number Diff line number Diff line change
Expand Up @@ -925,8 +925,11 @@ let install_packages_commands_t ?(env=OpamVariable.Map.empty) config sys_package
"--no-shortcuts";
"--no-startmenu";
"--no-desktop";
(*"--only-site"; XXX Commenting out forces use of previous mirror for now
"--site"; mirror; (* Use same mirror as from before? *)*)
"--no-admin";
"--packages";
(* "--upgrade-also"; if internal cygwin install *)
String.concat "," packages
]],
None
Expand Down

0 comments on commit 0d12eab

Please sign in to comment.