123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869(* (c) 2018 Hannes Mehnert, all rights reserved *)letsetup_logsyslogstyle_rendererlevel=Logs.set_levellevel;ifsyslogthenmatchLogs_syslog_unix.unix_reporter()with|Okreporter->Logs.set_reporterreporter|Errormsg->print_endline("ERROR: couldn't install syslog reporter: "^msg);exit2else(Fmt_tty.setup_std_outputs?style_renderer();Logs.set_reporter(Logs_fmt.reporter~dst:Format.std_formatter()))openCmdlinerlets_logging="LOGGING OPTIONS"letsetup_logsyslog=Term.(constsetup_log$syslog$Fmt_cli.style_renderer~docs:s_logging()$Logs_cli.level~docs:s_logging())letversion=Fmt.str"version v2.3.0 protocol version %a"Vmm_commands.pp_versionVmm_commands.current(* This is larger than Vmm_unix.supported as this should work for clients too *)typesupported=FreeBSD|Linux|Darwinletuname=letcmd=Bos.Cmd.(v"uname"%"-s")inmatchBos.OS.Cmd.(run_outcmd|>out_string|>success)with|Ok"FreeBSD"->FreeBSD|Ok"Linux"->Linux|Ok"Darwin"->Darwin|Oks->Fmt.invalid_arg"OS %s not supported"s|Error(`Msge)->invalid_argelets_dir="DIRECTORY OPTIONS"letdefault_tmpdir=matchunamewith|FreeBSD|Darwin->"/var/run/albatross"|Linux->"/run/albatross"lettmpdir=letdoc="Albatross temporary directory"inArg.(value&optdirdefault_tmpdir&info["tmpdir"]~docs:s_dir~doc)letset_tmpdirpath=matchFpath.of_stringpathwith|Okpath->Vmm_core.set_tmpdirpath|Error`Msgm->invalid_argmletdefault_dbdir=matchunamewith|FreeBSD|Darwin->"/var/db/albatross"|Linux->"/var/lib/albatross"letdbdir=letdoc="Albatross database directory"inArg.(value&optdirdefault_dbdir&info["dbdir"]~docs:s_dir~doc)letset_dbdirpath=matchFpath.of_stringpathwith|Okpath->Vmm_unix.set_dbdirpath|Error`Msgm->invalid_argm