package dkml-package-console

  1. Overview
  2. Docs
val console_component_name : string

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).

val console_required_components : string list

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:

Error Handling

val get_ok_or_failwith_string : ('a, string) result -> 'a
val get_ok_or_failwith_rresult : ('a, Rresult.R.msg) result -> 'a
val box_err : string -> 'a

Author Supplied Types

module Author_types : sig ... end
val version_m_n_o_p : string -> string

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

val spawn : ?err_ok:bool -> Bos.Cmd.t -> unit Dkml_install_api.Forward_progress.t

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.

elevated_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.t

get_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 = {
  1. log_config : Dkml_install_api.Log_config.t;
  2. prefix_opt : string option;
  3. component_selector : string list;
  4. static_files_source : Dkml_install_runner.Path_location.static_files_source;
  5. 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.t

Cmdliner.Term.t for the common options between setup.exe and uninstaller.exe

module Windows_registry : sig ... end