From 1674281a5e6ae4c9f92a1ac54cf06e3850520953 Mon Sep 17 00:00:00 2001 From: David Allsopp Date: Fri, 21 Jun 2024 17:20:23 +0100 Subject: [PATCH 1/2] Adjust common Cygwin setup flags Always pass --no-version-check and --no-write-registry: - Setup should have been updated, so the version check is an interactive risk - Running setup on a root shouldn't interfere with the user's most recent settings (although for most users this should make no difference) --- master_changes.md | 1 + src/state/opamSysInteract.ml | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/master_changes.md b/master_changes.md index 1ab70ae3e4a..b8b8659c634 100644 --- a/master_changes.md +++ b/master_changes.md @@ -59,6 +59,7 @@ users) ## Opamfile ## External dependencies + * Always pass --no-version-check and --no-write-registry to Cygwin setup [#6046 @dra27] ## Format upgrade diff --git a/src/state/opamSysInteract.ml b/src/state/opamSysInteract.ml index c14b8f1eb26..5790d09335e 100644 --- a/src/state/opamSysInteract.ml +++ b/src/state/opamSysInteract.ml @@ -1033,14 +1033,14 @@ let install_packages_commands_t ?(env=OpamVariable.Map.empty) config sys_package "--no-startmenu"; "--no-desktop"; "--no-admin"; + "--no-version-check"; + "--no-write-registry"; "--packages"; String.concat "," packages; ] @ (if Cygwin.is_internal config then let common = [ "--upgrade-also"; "--only-site"; - "--no-write-registry"; - "--no-version-check"; "--site"; Cygwin.mirror; "--local-package-dir"; OpamFilename.Dir.to_string (Cygwin.internal_cygcache ()); From 6d904cab4e6065a20a01e331e237721ea57a69bb Mon Sep 17 00:00:00 2001 From: David Allsopp Date: Tue, 25 Jun 2024 12:24:01 +0100 Subject: [PATCH 2/2] Use --quiet-mode unattended for external Cygwin Given that the user may be prompted, ensure that the dialogs can be used! --- master_changes.md | 1 + src/state/opamSysInteract.ml | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/master_changes.md b/master_changes.md index b8b8659c634..6dc9c175144 100644 --- a/master_changes.md +++ b/master_changes.md @@ -60,6 +60,7 @@ users) ## External dependencies * Always pass --no-version-check and --no-write-registry to Cygwin setup [#6046 @dra27] + * Use --quiet-mode noinput for the internal Cygwin installation (which is definitely a fully-specified command line) and --quiet-mode unattended for external Cygwin installations (in case the user does need to select something, e.g. a mirror) [#6046 @dra27] ## Format upgrade diff --git a/src/state/opamSysInteract.ml b/src/state/opamSysInteract.ml index 5790d09335e..a3d6f3f9b45 100644 --- a/src/state/opamSysInteract.ml +++ b/src/state/opamSysInteract.ml @@ -1026,9 +1026,10 @@ let install_packages_commands_t ?(env=OpamVariable.Map.empty) config sys_package | Cygwin -> (* We use setup_x86_64 to install package instead of `cygcheck` that is stored in `sys-pkg-manager-cmd` field *) + let is_internal = Cygwin.is_internal config in [`AsUser (OpamFilename.to_string (Cygwin.cygsetup ())), [ "--root"; (OpamFilename.Dir.to_string (Cygwin.cygroot config)); - "--quiet-mode"; "noinput"; + "--quiet-mode"; (if is_internal then "noinput" else "unattended"); "--no-shortcuts"; "--no-startmenu"; "--no-desktop"; @@ -1037,7 +1038,7 @@ let install_packages_commands_t ?(env=OpamVariable.Map.empty) config sys_package "--no-write-registry"; "--packages"; String.concat "," packages; - ] @ (if Cygwin.is_internal config then + ] @ (if is_internal then let common = [ "--upgrade-also"; "--only-site";