package dkml-package-console
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=c975d7d8d193946e268722538621aa4f99acdfcd7ead6a72157a2db80b98cb28
sha512=f799d6f44486ca7a780bb8d9d976056548b37cdf5211dd7608c32d65e1766ae9f4e113c03cfcfb9d0ba546adaf20e1176bc5531f9a5ca8c6c04497e5c76ba991
doc/dkml-package-console.common/Dkml_package_console_common/index.html
Module Dkml_package_console_commonSource
console_component_name is the name of the component that has executables that help run console installers (like gsudo.exe on Windows to elevate privileges).
console_required_components are the names of components that console installers require to be present. It always includes console_component_name but may include other components.
At minimum, these other required components include:
"staging-ocamlrun"becauseDkml_package_console_entry.entryuses ocamlrun to run the dkml-package.bc bytecode.
val needs_install_admin :
reg:Dkml_install_register.Component_registry.t ->
selector:Dkml_install_register.Component_registry.component_selector ->
log_config:Dkml_install_api.Log_config.t ->
target_abi:Dkml_install_api.Context.Abi_v2.t ->
prefix:Fpath.t ->
staging_files_source:Dkml_install_runner.Path_location.staging_files_source ->
bool Dkml_install_api.Forward_progress.tval needs_uninstall_admin :
reg:Dkml_install_register.Component_registry.t ->
selector:Dkml_install_register.Component_registry.component_selector ->
log_config:Dkml_install_api.Log_config.t ->
target_abi:Dkml_install_api.Context.Abi_v2.t ->
prefix:Fpath.t ->
staging_files_source:Dkml_install_runner.Path_location.staging_files_source ->
bool Dkml_install_api.Forward_progress.tError Handling
Author Supplied Types
ver_m_n_o_p ver converts the version ver into the "mmmmm.nnnnn.ooooo.ppppp" format required by an Application Manifest.
Confer https://docs.microsoft.com/en-us/windows/win32/sbscs/application-manifests#assemblyidentity
Running Programs
spawn ?err_ok cmd launches the command cmd and waits for its response.
Use err_ok = true if you want to log errors but continue.
val elevated_cmd :
target_abi:Dkml_install_api.Context.Abi_v2.t ->
staging_files_source:Dkml_install_runner.Path_location.staging_files_source ->
Bos.Cmd.t ->
Bos.Cmd.t Dkml_install_api.Forward_progress.televated_cmd ~target_abi ~staging_files_source cmd translates the command cmd into a command that elevates privileges using "gsudo.exe" from the staging files staging_files_source on Windows machines, or "doas", "sudo" or "su" on the PATH on Unix machines.
Installation Paths
val get_user_installation_prefix :
program_name:Author_types.program_name ->
target_abi:Dkml_install_api__Types.Context.Abi_v2.t ->
prefix_opt:string option ->
Fpath.t Dkml_install_api.Forward_progress.tget_user_installation_prefix ~program_name ~target_abi ~prefix_opt returns where user programs should be installed; either the prefix prefix_opt = Some prefix or uses the platform convention when prefix_opt = None.
Platform Conventions
The user programs would be installed to these locations by default:
Windows: "$env:LOCALAPPDATA\\Programs\\<name_full>" when prefer_spaces = False or "$env:LOCALAPPDATA\\Programs\\<name_camel_case_nospaces>" otherwise. This pattern closely conforms to the standard established by "$env:LOCALAPPDATA\\Programs\\Microsoft VS Code"
macOS: "~/Applications/<name_full>.app" when prefer_spaces = False or "~/Applications/<name_camel_case_nospaces>.app" otherwise.
Linux: If "$XDG_DATA_HOME" is defined then "$XDG_DATA_HOME/<name_kebab_lower_case>" otherwise "$HOME/.local/share/<name_kebab_lower_case>"
Command Line Processing
type package_args = {log_config : Dkml_install_api.Log_config.t;prefix_opt : string option;component_selector : string list;static_files_source : Dkml_install_runner.Path_location.static_files_source;staging_files_source : Dkml_install_runner.Path_location.staging_files_source;
}Common options between setup.exe and uninstaller.exe
val package_args_t :
program_name:Author_types.program_name ->
target_abi:Dkml_install_api__Types.Context.Abi_v2.t ->
install_direction:
Dkml_install_runner.Path_eval.Global_context.install_direction ->
package_args Cmdliner.Term.tCmdliner.Term.t for the common options between setup.exe and uninstaller.exe