cfengine-masterfiles-3.12.1/0000755000000000000000000000000013377750574015710 5ustar00rootroot00000000000000cfengine-masterfiles-3.12.1/LICENSE0000644000000000000000000000230513377750475016715 0ustar00rootroot00000000000000All software in this repository except where explicitly marked otherwise is under the following license. MIT Public License http://www.opensource.org/licenses/MIT Copyright 2017 Northern.tech AS Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. cfengine-masterfiles-3.12.1/inventory/0000755000000000000000000000000013377750574017745 5ustar00rootroot00000000000000cfengine-masterfiles-3.12.1/inventory/suse.cf0000644000000000000000000000065013377750475021237 0ustar00rootroot00000000000000bundle common inventory_suse # @brief SUSE inventory bundle # # This common bundle is for SUSE Linux inventory work. { classes: "suse_pure" expression => "(sles|sled).!opensuse", comment => "pure SUSE", meta => { "inventory", "attribute_name=none" }; "suse_derived" expression => "opensuse.!suse_pure", comment => "derived from SUSE", meta => { "inventory", "attribute_name=none" }; } cfengine-masterfiles-3.12.1/inventory/debian.cf0000644000000000000000000000730213377750475021503 0ustar00rootroot00000000000000bundle common inventory_debian # @brief Debian inventory # # This common bundle is for Debian inventory work. { vars: has_lsb_release:: "lsb_release_info" string => readfile("/etc/lsb-release","256"), comment => "Read more OS info" ; has_etc_linuxmint_info:: "linuxmint_info" string => readfile("/etc/linuxmint/info","1024"), comment => "Read Linux Mint specific info" ; "lm_info_count" int => parsestringarray("mint_info", # array to populate "$(linuxmint_info)", # data to parse "\s*#[^\n]*", # comments "=", # split 100, # maxentries 2048) ; # maxbytes "mint_release" string => "$(mint_info[RELEASE][1])" ; "mint_codename" string => "$(mint_info[CODENAME][1])" ; classes: any:: "debian_derived_evaluated" scope => "bundle", or => { "has_os_release", "has_lsb_release", "has_etc_linuxmint_info" } ; "linuxmint" expression => "has_etc_linuxmint_info", comment => "this is a Linux Mint system, of some sort", meta => { "inventory", "attribute_name=none" } ; has_lsb_release:: "linuxmint" expression => regcmp("(?ms).*^DISTRIB_ID=LinuxMint$.*", "$(lsb_release_info)"), comment => "this is a Linux Mint system, of some sort", meta => { "inventory", "attribute_name=none" } ; linuxmint.has_os_release:: "lmde" expression => regcmp('(?ms).*^NAME="Linux Mint LMDE"$.*', "$(inventory_linux.os_release_info)"), comment => "this is a Linux Mint Debian Edition", meta => { "inventory", "attribute_name=none", "derived-from=inventory_linux.os_release_info" } ; linuxmint.has_lsb_release:: "lmde" expression => regcmp('(?ms).*^DISTRIB_DESCRIPTION="LMDE.*', "$(lsb_release_info)"), comment => "this is a Linux Mint Debian Edition", meta => { "inventory", "attribute_name=none", "derived-from=inventory_debian.lsb_release_info" } ; has_etc_linuxmint_info:: "lmde" expression => regcmp('(?ms).*^DESCRIPTION="LMDE.*',"$(linuxmint_info)"), comment => "this is a Linux Mint Debian Edition", meta => { "inventory", "attribute_name=none", "derived-from=inventory_debian.linuxmint_info" } ; debian_derived_evaluated.has_etc_linuxmint_info.!lmde:: # These need to be evaluated only after debian_derived_evaluated is defined # to ensure that the mint_info array has been evaluated as well. # Failing to do that will create meaningless classes # On non-LMDE Mint systems, this will create classes like, e.g.: # linuxmint_14, nadia, linuxmint_nadia "linuxmint_$(mint_release)" expression => "any", meta => { "inventory", "attribute_name=none" } ; "$(mint_codename)" expression => "any", meta => { "inventory", "attribute_name=none" } ; "linuxmint_$(mint_codename)" expression => "any", meta => { "inventory", "attribute_name=none" } ; debian_derived_evaluated:: "debian_pure" expression => "debian.!(ubuntu|linuxmint)", comment => "pure Debian", meta => { "inventory", "attribute_name=none" }; "debian_derived" expression => "debian.!debian_pure", comment => "derived from Debian", meta => { "inventory", "attribute_name=none" }; any:: "has_lsb_release" expression => fileexists("/etc/lsb-release"), comment => "Check if we can get more info from /etc/lsb-release"; "has_etc_linuxmint_info" expression => fileexists("/etc/linuxmint/info"), comment => "If this is a Linux Mint system, this *could* be available"; } cfengine-masterfiles-3.12.1/inventory/lsb.cf0000644000000000000000000000576213377750475021051 0ustar00rootroot00000000000000bundle agent inventory_lsb # @brief LSB inventory bundle # # This common bundle is for LSB inventory work. { classes: "have_lsb" expression => fileexists($(lsb_exec)); "_inventory_lsb_found" expression => regcmp("^[1-9][0-9]*$", $(dim)), scope => "namespace"; _inventory_lsb_found:: "lsb_$(os)" expression => "any", comment => "LSB Distributor ID", depends_on => { "inventory_lsb_os" }, scope => "namespace", meta => { "inventory", "attribute_name=none" }; "lsb_$(os)_$(release)" expression => "any", comment => "LSB Distributor ID and Release", depends_on => { "inventory_lsb_os", "inventory_lsb_release" }, scope => "namespace", meta => { "inventory", "attribute_name=none" }; "lsb_$(os)_$(codename)" expression => "any", comment => "LSB Distributor ID and Codename", depends_on => { "inventory_lsb_os", "inventory_lsb_codename" }, scope => "namespace", meta => { "inventory", "attribute_name=none" }; vars: "lsb_exec" string => "$(inventory_control.lsb_exec)"; have_lsb:: "data" string => execresult("$(lsb_exec) -a", "noshell"); "dim" int => parsestringarray( "lsb", $(data), "\s*#[^\n]*", "\s*:\s+", "15", "4095" ); _inventory_lsb_found:: "lsb_keys" slist => getindices("lsb"); "os" string => canonify("$(lsb[Distributor ID][1])"), handle => "inventory_lsb_os", comment => "LSB-provided OS name", meta => { "inventory", "attribute_name=none" }; "codename" string => canonify("$(lsb[Codename][1])"), handle => "inventory_lsb_codename", comment => "LSB-provided OS code name", meta => { "inventory", "attribute_name=none" }; "release" string => "$(lsb[Release][1])", handle => "inventory_lsb_release", comment => "LSB-provided OS release", meta => { "inventory", "attribute_name=none" }; "flavor" string => canonify("$(lsb[Distributor ID][1])_$(lsb[Release][1])"), handle => "inventory_lsb_flavor", comment => "LSB-provided OS flavor", meta => { "inventory", "attribute_name=none" }; "description" string => "$(lsb[Description][1])", handle => "inventory_lsb_description", comment => "LSB-provided OS description", meta => { "inventory", "attribute_name=none" }; reports: (DEBUG|DEBUG_inventory_lsb)._inventory_lsb_found:: "DEBUG $(this.bundle): OS = $(os), codename = $(codename), release = $(release), flavor = $(flavor), description = $(description)"; "DEBUG $(this.bundle): got $(dim) LSB keys"; "DEBUG $(this.bundle): prepared LSB key $(lsb_keys) = '$(lsb[$(lsb_keys)][1])'"; (DEBUG|DEBUG_inventory_lsb).!_inventory_lsb_found:: "DEBUG $(this.bundle): LSB inventory not found"; } cfengine-masterfiles-3.12.1/inventory/freebsd.cf0000644000000000000000000000017413377750475021673 0ustar00rootroot00000000000000bundle common inventory_freebsd # @brief FreeBSD inventory bundle # # This common bundle is for FreeBSD inventory work. { } cfengine-masterfiles-3.12.1/inventory/any.cf0000644000000000000000000011360613377750475021055 0ustar00rootroot00000000000000bundle common inventory_any # @brief Do inventory for any OS # # This common bundle is for any OS work not handled by specific # bundles. { vars: "release_data" string => "$(this.promise_dirname)/../cf_promises_release_id"; "data" data => readjson( $(release_data), inf ), if => fileexists( $(release_data) ); "id" string => "$(data[releaseId])", meta => { "inventory", "attribute_name=Policy Release Id" }; reports: "DEBUG|DEBUG_$(this.bundle)":: "DEBUG $(this.bundle): Inventory Policy Release Id=$(id)"; } bundle agent inventory_autorun # @brief Autorun some inventory bundles # # This agent bundle runs other "autorun" inventory agent bundles # explicitly. It will use bundlesmatching() when CFEngine 3.5 and # earlier are no longer supported. { methods: !disable_inventory_cmdb:: "cmdb" usebundle => cfe_autorun_inventory_cmdb(), handle => "cfe_internal_autorun_inventory_cmdb"; !disable_inventory_LLDP:: "LLDP" usebundle => cfe_autorun_inventory_LLDP(), handle => "cfe_internal_autorun_inventory_LLDP"; !disable_inventory_package_refresh:: "packages_refresh" usebundle => cfe_autorun_inventory_packages(), handle => "cfe_internal_autorun_inventory_packages"; !disable_inventory_proc:: "proc" usebundle => cfe_autorun_inventory_proc(), handle => "cfe_internal_autorun_inventory_proc"; "proc_cpuinfo" usebundle => cfe_autorun_inventory_proc_cpuinfo(), handle => "cfe_internal_autorun_inventory_proc_cpuinfo"; !disable_inventory_cpuinfo:: "cpuinfo" usebundle => cfe_autorun_inventory_cpuinfo(), handle => "cfe_internal_autorun_inventory_cpuinfo"; !disable_inventory_fstab:: "fstab" usebundle => cfe_autorun_inventory_fstab(), handle => "cfe_internal_autorun_inventory_fstab"; !disable_inventory_mtab:: "mtab" usebundle => cfe_autorun_inventory_mtab(), handle => "cfe_internal_autorun_inventory_mtab"; !disable_inventory_dmidecode:: "dmidecode" usebundle => cfe_autorun_inventory_dmidecode(), handle => "cfe_internal_autorun_inventory_dmidecode"; !disable_inventory_aws:: "aws" usebundle => cfe_autorun_inventory_aws(), handle => "cfe_internal_autorun_inventory_aws"; !disable_inventory_aws|disable_inventory_aws_ec2_metadata:: "aws" usebundle => cfe_autorun_inventory_aws_ec2_metadata(), handle => "cfe_internal_autorun_inventory_ec2_metadata"; any:: "listening ports" usebundle => cfe_autorun_inventory_listening_ports(), handle => "cfe_internal_autorun_listening_ports"; "disk" usebundle => cfe_autorun_inventory_disk(), handle => "cfe_internal_autorun_disk"; "memory" usebundle => cfe_autorun_inventory_memory(), handle => "cfe_internal_autorun_memory"; "loadaverage" usebundle => cfe_autorun_inventory_loadaverage(), handle => "cfe_internal_autorun_loadaverage"; "ipv4 addresses" usebundle => cfe_autorun_inventory_ipv4_addresses, handle => "cfe_internal_autorun_ipv4_addresses"; } bundle agent cfe_autorun_inventory_listening_ports # @brief Inventory the listening ports # # This bundle uses `mon.listening_ports` and is always enabled by # default, as it runs instantly and has no side effects. { vars: "ports" -> { "ENT-150" } slist => sort( "mon.listening_ports", "int"), meta => { "inventory", "attribute_name=Ports listening" }, ifvarclass => some("[0-9]+", "mon.listening_ports"), comment => "We only want to inventory the listening ports if we have values that make sense."; } bundle agent cfe_autorun_inventory_ipv4_addresses # @brief Inventory ipv4 addresses # This will filter the loopback address (127.0.0.1, as it is likely not very interesting) { vars: "filter_reg" string => "127\.0\.0\.1", comment => "Addresses that match this regular expression will be filtered from the inventory for ipv4 addresses"; # Strings are displayed more beautifully in Mission Portal than lists, so # we first generate the list of addresses to be inventoried and then do # inventory using an array. "ipv4_addresses" slist => filter( $(filter_reg), "sys.ip_addresses", "true", "true", 999999999); "ipv4[$(ipv4_addresses)]" string => "$(ipv4_addresses)", meta => { "inventory", "attribute_name=IPv4 addresses" }; reports: DEBUG|DEBUG_cfe_autorun_inventory_ipv4_addresses:: "DEBUG $(this.bundle)"; "$(const.t)Inventorying: '$(ipv4_addresses)'"; } bundle agent cfe_autorun_inventory_disk # @brief Inventory the disk (Enterprise only) { vars: enterprise:: "free" string => "$(mon.value_diskfree)", meta => { "inventory", "attribute_name=Disk free (%)" }; } bundle agent cfe_autorun_inventory_memory # @brief Inventory the memory (Enterprise only) { vars: @if minimum_version(3.11) # The `with` attribute is necessary for this to work in a single promise. enterprise_edition.windows:: # wmic returns "TotalVisibleMemorySize=10760224" so split on = and take # the second item (0-based with nth()) "total" -> { "ENT-4188" } meta => { "inventory", "attribute_name=Memory size (MB)" }, string => format( "%d", eval("$(with)/1024", "math", "infix" )), if => not( isvariable( "total" ) ), with => nth( string_split( execresult("wmic OS get TotalVisibleMemorySize /format:list", useshell ), "=", 2), 1); "totalPhysical" -> { "CFE-2896" } meta => { "inventory", "attribute_name=Physical memory (MB)" }, string => format( "%d", eval("$(with)/1024", "math", "infix" )), if => not( isvariable( "total" ) ), with => nth( string_split( execresult("wmic ComputerSystem get TotalPhysicalMemory /format:list", useshell ), "=", 2), 1); # This is a volatile metric, perhaps not well suited for inventory "free" meta => { "report" }, string => format( "%d", eval("$(with)/1024", "math", "infix" )), if => not( isvariable( "free" ) ), with => nth( string_split( execresult("wmic OS get FreePhysicalMemory /format:list", useshell ), "=", 2), 1); @endif enterprise_edition.aix:: "total" -> { "CFE-2797", "CFE-2803" } string => execresult("/usr/bin/lparstat -i | awk '/Online Memory/ { print $4 }'", "useshell"), meta => { "inventory", "attribute_name=Memory size (MB)" }; enterprise_edition.hpux:: "total" -> { "ENT-4188" } string => execresult( "machinfo | awk '/^Memory =/ {print $3}'", useshell ), meta => { "inventory", "attribute_name=Memory size (MB)" }; enterprise_edition.!(aix|windows|hpux):: "total" string => "$(mon.value_mem_total)", meta => { "inventory", "attribute_name=Memory size (MB)" }; "free" string => "$(mon.value_mem_free)", if => not( isvariable( "free" ) ), meta => { "report" }; } bundle agent cfe_autorun_inventory_loadaverage # @brief Inventory the loadaverage (Enterprise only) { vars: enterprise:: "value" string => "$(mon.value_loadavg)", meta => { "report" }; } bundle agent cfe_autorun_inventory_proc # @brief Do procfs inventory # # This bundle will parse these /proc files: consoles, cpuinfo, # meminfo, modules, partitions, version, vmstat. There are # some general patterns you can follow to extend it for other /proc # items of interest. # # Contributions welcome. /proc/net and /proc/sys in general are of # wide interest, if you're looking for something fun. For instance, # the network interfaces could be extracted here without calling # `ifconfig`. { vars: "basefiles" slist => { "consoles", "cpuinfo", "modules", "partitions", "version" }; "files[$(basefiles)]" string => "$(inventory_control.proc)/$(basefiles)"; _have_proc_consoles:: "console_count" int => readstringarrayidx("consoles", "$(files[consoles])", "\s*#[^\n]*", "\s+", 500, 50000); "console_idx" slist => getindices("consoles"); _have_proc_modules:: "module_count" int => readstringarrayidx("modules", "$(files[modules])", "\s*#[^\n]*", "\s+", 2500, 250000); "module_idx" slist => getindices("modules"); _have_proc_cpuinfo:: # this will extract all the keys in one bunch, so you won't get # detailed info for processor 0 for example "cpuinfo_count" int => readstringarrayidx("cpuinfo_array", "$(files[cpuinfo])", "\s*#[^\n]*", "\s*:\s*", 500, 50000); "cpuinfo_idx" slist => getindices("cpuinfo_array"); "cpuinfo[$(cpuinfo_array[$(cpuinfo_idx)][0])]" string => "$(cpuinfo_array[$(cpuinfo_idx)][1])"; "cpuinfo_keys" slist => getindices("cpuinfo"); _have_proc_partitions:: "partitions_count" int => readstringarrayidx("partitions_array", "$(files[partitions])", "major[^\n]*", "\s+", 500, 50000); "partitions_idx" slist => getindices("partitions_array"); "partitions[$(partitions_array[$(partitions_idx)][4])]" string => "$(partitions_array[$(partitions_idx)][3])"; "partitions_keys" slist => getindices("partitions"); _have_proc_version:: "version" string => readfile("$(files[version])", 2048); classes: "have_proc" expression => isdir($(inventory_control.proc)); have_proc:: "_have_proc_$(basefiles)" expression => fileexists("$(files[$(basefiles)])"); _have_proc_consoles:: "have_console_$(consoles[$(console_idx)][0])" expression => "any", scope => "namespace"; _have_proc_modules:: "have_module_$(modules[$(module_idx)][0])" expression => "any", scope => "namespace"; reports: _have_proc_consoles.verbose_mode:: "$(this.bundle): we have console $(consoles[$(console_idx)][0])"; _have_proc_modules.verbose_mode:: "$(this.bundle): we have module $(modules[$(module_idx)][0])"; _have_proc_cpuinfo.verbose_mode:: "$(this.bundle): we have cpuinfo $(cpuinfo_keys) = $(cpuinfo[$(cpuinfo_keys)])"; _have_proc_partitions.verbose_mode:: "$(this.bundle): we have partitions $(partitions_keys) with $(partitions[$(partitions_keys)]) blocks"; _have_proc_version.verbose_mode:: "$(this.bundle): we have kernel version '$(version)'"; } bundle agent cfe_autorun_inventory_proc_cpuinfo { classes: "_have_cpuinfo" expression => isvariable("default:cfe_autorun_inventory_proc.cpuinfo_idx"); # So that we don't inventory non dereferenced variables we check to see # if we have the info first This is only necessary because its currently # invalid to do isvariable on an array key that contains a space # Ref: redmine#7088 https://dev.cfengine.com/issues/7088 "have_cpuinfo_cpu_cores" expression => strcmp("cpu cores", "$(default:cfe_autorun_inventory_proc.cpuinfo_array[$(default:cfe_autorun_inventory_proc.cpuinfo_idx)][0])"); "have_cpuinfo_model_name" expression => strcmp("model name", "$(default:cfe_autorun_inventory_proc.cpuinfo_array[$(default:cfe_autorun_inventory_proc.cpuinfo_idx)][0])"); vars: _have_cpuinfo:: "cpuinfo_physical_cores" string => "$(default:cfe_autorun_inventory_proc.cpuinfo[cpu cores])", ifvarclass => "have_cpuinfo_cpu_cores"; "cpuinfo_cpu_model_name" string => "$(default:cfe_autorun_inventory_proc.cpuinfo[model name])", ifvarclass => "have_cpuinfo_model_name"; # We need to be able to count the number of unique physical id lines in # /proc/cpu in order to get a physical processor count. "cpuinfo_lines" slist => readstringlist( "$(default:cfe_autorun_inventory_proc.files[cpuinfo])", "\s*#[^\n]*", "\n", 500, 50000); "cpuinfo_processor_lines" slist => grep("processor\s+:\s\d+", "cpuinfo_lines"), comment => "The number of processor entries in $(default:cfe_autorun_inventory_proc.files[cpuinfo]). If no 'physical id' entries are found this is the processor count"; "cpuinfo_processor_lines_count" int => length("cpuinfo_processor_lines"); "cpuinfo_physical_id_lines" slist => grep("physical id.*", "cpuinfo_lines"), comment => "This identifies which physical socket a logical core is on, the count of the unique physical id lines tells you how many physical sockets you have. THis would not be present on systems that are not multicore."; "cpuinfo_physical_id_lines_unique" slist => unique("cpuinfo_physical_id_lines"); "cpuinfo_physical_id_lines_unique_count" int => length("cpuinfo_physical_id_lines_unique"); # If we have physical id lines in cpu info use that for socket inventory, # else we should use the number of processor lines. physical id lines # seem to only be present when multiple cores are active. "cpuinfo_physical_socket_inventory" string => ifelse(isgreaterthan( length("cpuinfo_physical_id_lines"), 0 ), "$(cpuinfo_physical_id_lines_unique_count)", "$(cpuinfo_processor_lines_count)"), meta => { "inventory", "attribute_name=CPU sockets" }; reports: DEBUG|DEBUG_cfe_autorun_inventory_proc:: "DEBUG $(this.bundle)"; "$(const.t)cpuinfo[$(default:cfe_autorun_inventory_proc.cpuinfo_array[$(default:cfe_autorun_inventory_proc.cpuinfo_idx)][0])] = $(default:cfe_autorun_inventory_proc.cpuinfo[$(default:cfe_autorun_inventory_proc.cpuinfo_array[$(default:cfe_autorun_inventory_proc.cpuinfo_idx)][0])])"; "$(const.t)CPU physical cores: '$(cpuinfo_physical_cores)'" ifvarclass => "have_cpuinfo_cpu_cores"; "$(const.t)CPU model name: '$(cpuinfo_cpu_model_name)'" ifvarclass => "have_cpuinfo_model_name"; "$(const.t)CPU Physical Sockets: '$(cpuinfo_physical_socket_inventory)'"; } bundle agent cfe_autorun_inventory_cpuinfo { classes: "_have_proc_cpu_model_name" expression => isvariable("default:cfe_autorun_inventory_proc_cpuinfo.cpuinfo_cpu_model_name"); "_have_proc_cpu_physical_cores" expression => isvariable("default:cfe_autorun_inventory_proc_cpuinfo.cpuinfo_physical_cores"); # We only accept dmidecode values that don't look like cfengine variables, # (starting with dollar), or that have an apparent empty value. "_have_dmidecode_cpu_model_name" not => regcmp("($(const.dollar)\(.*\)|^$)", "$(default:cfe_autorun_inventory_dmidecode.dmi[processor-version])"); vars: _have_proc_cpu_physical_cores:: "cpuinfo_physical_cores" string => "$(default:cfe_autorun_inventory_proc.cpuinfo[cpu cores])", #ifvarclass => "have_cpuinfo_cpu_cores", meta => { "inventory", "attribute_name=CPU physical cores", "derived-from=$(default:cfe_autorun_inventory_proc.files[cpuinfo])" }; _have_proc_cpu_model_name:: "cpu_model" string => "$(default:cfe_autorun_inventory_proc_cpuinfo.cpuinfo_cpu_model_name)", meta => { "inventory", "attribute_name=CPU model", "derived-from=$(default:cfe_autorun_inventory_proc.files[cpuinfo])" }; _have_dmidecode_cpu_model_name.!_have_proc_cpu_model_name:: "cpu_model" string => "$(default:cfe_autorun_inventory_dmidecode.dmi[processor-version])", meta => { "inventory", "attribute_name=CPU model", "derived-from=$(inventory_control.dmidecoder) -s processor-version" }; reports: DEBUG|DEBUG_cfe_autorun_inventory_cpuinfo:: "DEBUG $(this.bundle)"; "$(const.t) CPU model: $(cpu_model)"; "$(const.t) CPU physical cores: $(cpuinfo_physical_cores)"; } bundle common cfe_autorun_inventory_aws # @brief inventory AWS EC2 instances # # Provides: # ec2_instance class based on Amazon markers in dmidecode's system-uuid, bios-version or bios-vendor { classes: !disable_inventory_aws:: "ec2_instance" -> { "CFE-2924" } comment => "See http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/identify_ec2_instances.html", scope => "namespace", expression => regcmp("^[eE][cC]2.*", "$(cfe_autorun_inventory_dmidecode.dmi[system-uuid])"), if => isvariable("cfe_autorun_inventory_dmidecode.dmi[system-uuid]"); "ec2_instance" -> { "CFE-2924" } expression => regcmp(".*[aA]mazon.*", "$(cfe_autorun_inventory_dmidecode.dmi[bios-version])"), scope => "namespace", if => isvariable("cfe_autorun_inventory_dmidecode.dmi[bios-version]"); "ec2_instance" -> { "CFE-2924" } expression => regcmp(".*[aA]mazon.*", "$(cfe_autorun_inventory_dmidecode.dmi[bios-vendor])"), scope => "namespace", if => isvariable("cfe_autorun_inventory_dmidecode.dmi[bios-vendor]"); "ec2_instance" -> { "CFE-2924" } expression => regline( "^ec2.*", "/sys/hypervisor/uuid" ), scope => "namespace", if => fileexists("/sys/hypervisor/uuid"); reports: (DEBUG|DEBUG_inventory_aws):: "DEBUG $(this.bundle)"; "$(const.t)+ec2_instance" if => "ec2_instance"; } bundle agent cfe_autorun_inventory_aws_ec2_metadata # @brief Inventory ec2 metadata # Provides: { methods: !(disable_inventory_aws|disable_inventory_aws_ec2_metadata):: "cfe_autorun_inventory_aws_ec2_metadata_cache"; "cfe_aws_ec2_metadata_from_cache"; } bundle agent cfe_autorun_inventory_aws_ec2_metadata_cache # @brief Cache ec2 metadata from http request for one day # # Provides cache of ec2 instance metadata for inventory { vars: ec2_instance.!(disable_inventory_aws|disable_inventory_aws_ec2_metadata):: "curl" string => "$(paths.curl)"; "curl_opts" string => "--max-time 1 --connect-timeout 1 --silent"; "URL" string => "http://169.254.169.254/latest/dynamic/instance-identity/document"; "cache" string => "$(sys.statedir)/aws_ec2_metadata"; commands: ec2_instance.!(disable_inventory_aws|disable_inventory_aws_ec2_metadata):: "$(curl)" args => "$(curl_opts) $(URL) -o $(cache)", if => not( fileexists( $(cache) )); files: ec2_instance.!(disable_inventory_aws|disable_inventory_aws_ec2_metadata):: "$(cache)" delete => tidy, file_select => days_old(1); } bundle agent cfe_aws_ec2_metadata_from_cache # @brief Inventory ec2 metadata from cache # # Provides inventory for EC2 Region, EC2 Instance ID, EC2 Instance Type, EC2 # Image ID, and EC2 Availability Zone { classes: ec2_instance.!(disable_inventory_aws|disable_inventory_aws_ec2_metadata):: "have_cached_instance_identity" expression => fileexists( $(cfe_autorun_inventory_aws_ec2_metadata_cache.cache) ); vars: have_cached_instance_identity.ec2_instance.!(disable_inventory_aws|disable_inventory_aws_ec2_metadata):: "data" data => readjson( $(cfe_autorun_inventory_aws_ec2_metadata_cache.cache), 100K); "region" string => "$(data[region])", meta => { "inventory", "attribute_name=EC2 Region" }; "instanceId" string => "$(data[instanceId])", meta => { "inventory", "attribute_name=EC2 Instance ID" }; "instanceType" string => "$(data[instanceType])", meta => { "inventory", "attribute_name=EC2 Instance Type" }; "imageId" string => "$(data[imageId])", meta => { "inventory", "attribute_name=EC2 Image ID" }; "availabilityZone" string => "$(data[availabilityZone])", meta => { "inventory", "attribute_name=EC2 Availability Zone" }; reports: DEBUG|DEBUG_inventory_ec2_metadata|DEBUG_inventory_ec2_metadata_from_cache:: "DEBUG $(this.bundle):"; "$(const.t)Inventory 'EC2 Region' = '$(region)'"; "$(const.t)Inventory 'EC2 Instance ID' = '$(instanceId)'"; "$(const.t)Inventory 'EC2 Instance Type' = '$(instanceType)'"; "$(const.t)Inventory 'EC2 Image ID' = '$(imageId)'"; "$(const.t)Inventory 'EC2 Availability Zone' = '$(availabilityZone)'"; } bundle agent cfe_autorun_inventory_mtab # @brief Do mtab inventory # # The mtab format is simple: each line looks like this format: # `/dev/sda1 / ext4 rw,noatime,data=ordered 0 0` (in order: `DEV # MOUNTPOINT FSTYPE OPTIONS DUMP-FREQ PASS`). Some older Unices have # a different format and it's really not portable, so enable this only # if you know you want it. It's very handy if you want to check if a # file system is mounted. { vars: have_mtab:: "mount_count" int => readstringarrayidx("mounts", $(inventory_control.mtab), "\s*#[^\n]*", "\s+", 500, 50000); "idx" slist => getindices("mounts"); classes: "have_mtab" expression => fileexists($(inventory_control.mtab)); # define classes like have_mount_ext4__var for a ext4 /var mount "have_mount_$(mounts[$(idx)][2])_$(mounts[$(idx)][1])" expression => "any", scope => "namespace"; # define classes like have_mount_ext4 if there is a ext4 mount "have_mount_$(mounts[$(idx)][2])" expression => "any", scope => "namespace"; reports: verbose_mode:: "$(this.bundle): we have a $(mounts[$(idx)][2]) mount under $(mounts[$(idx)][1])"; } bundle agent cfe_autorun_inventory_fstab # @brief Do fstab inventory # # The fstab format is simple: each line looks like this format: # `/dev/sda1 / auto noatime 0 1` (in order: `DEV MOUNTPOINT FSTYPE # OPTIONS DUMP-FREQ PASS`). Note the FSTYPE is not known from the # fstab. # # Solaris has 'MOUNTDEV FSCKDEV MOUNTPOINT FSTYPE PASS MOUNT-AD-BOOT # OPTIONS' but is not supported here. Contributions welcome. { vars: have_fstab:: "mount_count" int => readstringarrayidx("mounts", $(sys.fstab), "\s*#[^\n]*", "\s+", 500, 50000); "idx" slist => getindices("mounts"); classes: "have_fstab" expression => fileexists($(sys.fstab)); # define classes like have_fs_ext4__var for a ext4 /var entry "have_fs_$(mounts[$(idx)][2])_$(mounts[$(idx)][1])" expression => "any", scope => "namespace"; # define classes like have__var for a /var entry "have_fs_$(mounts[$(idx)][1])" expression => "any", scope => "namespace"; # define classes like have_fs_ext4 if there is a ext4 entry "have_fs_$(mounts[$(idx)][2])" expression => "any", scope => "namespace"; reports: verbose_mode:: "$(this.bundle): we have a $(mounts[$(idx)][2]) fstab entry under $(mounts[$(idx)][1])"; } bundle agent cfe_autorun_inventory_dmidecode # @brief Do hardware related inventory # # This agent bundle runs dmidecode when present to inventory: # - BIOS vendor # - BIOS version # - System serial number # - System manufacturer # - System version # - System product name # - Physical memory (MB) # # On windows where powershell is available this bundle runs gwmi to inventory: # - BIOS vendor # - BIOS version # - System serial number # - System manufacturer { vars: "dmidefs" data => parsejson(' { "bios-vendor": "BIOS vendor", "bios-version": "BIOS version", "system-serial-number": "System serial number", "system-manufacturer": "System manufacturer", "system-version": "System version", "system-product-name": "System product name", "system-uuid": "System UUID", }'); # We override dmidefs from augments when we can. "dmidefs" -> { "CFE-2927" } data => mergedata( "def.cfe_autorun_inventory_dmidecode[dmidefs]" ), if => isvariable( "def.cfe_autorun_inventory_dmidecode[dmidefs]"); # other dmidecode variables you may want: # baseboard-asset-tag # baseboard-manufacturer # baseboard-product-name # baseboard-serial-number # baseboard-version # bios-release-date # chassis-asset-tag # chassis-manufacturer # chassis-serial-number # chassis-type # chassis-version # processor-family # processor-frequency # processor-manufacturer # system-uuid #"processor-version": "CPU model" <- Collected by default, but not by iterating over the list "dmivars" slist => getindices(dmidefs); have_dmidecode:: "decoder" string => "$(inventory_control.dmidecoder)"; # Redhat 4 can support the -s option to dmidecode if # kernel-utils-2.4-15.el4 or greater is installed. have_dmidecode.!(redhat_4|redhat_3):: "dmi[$(dmivars)]" string => execresult("$(decoder) -s $(dmivars)", "useshell"), meta => { "inventory", "attribute_name=$(dmidefs[$(dmivars)])" }; # We do not want to inventory the model name from here, as inventory for # CPU info has been abstracted away from DMI so we just collect it # manually. "dmi[processor-version]" string => execresult("$(decoder) -s processor-version", "useshell"); windows.powershell:: "dmi[bios-vendor]" string => $(bios_array[1]), meta => { "inventory", "attribute_name=BIOS vendor" }; "dmi[system-serial-number]" string => $(bios_array[2]), meta => { "inventory", "attribute_name=System serial number" }; "dmi[bios-version]" string => $(bios_array[3]), meta => { "inventory", "attribute_name=BIOS version" }; "dmi[system-version]" string => $(bios_array[4]), meta => { "inventory", "attribute_name=System version" }; "dmi[processor-version]" string => $(processor_array[1]); "split_pscomputername" slist => string_split($(system_array[1]), "PSComputerName\s.*", 2), comment => "Work around weird appearance of PSComputerName into System manufacturer"; "dmi[system-manufacturer]" string => nth(split_pscomputername, 0), meta => { "inventory", "attribute_name=System manufacturer" }; classes: "have_dmidecode" expression => fileexists($(inventory_control.dmidecoder)); windows.powershell:: "bios_match" expression => regextract(".*Manufacturer\s+:\s([a-zA-Z0-9 ]+)\n.*SerialNumber\W+([a-zA-Z0-9 ]+).*SMBIOSBIOSVersion\W+([a-zA-Z0-9 ]+).*Version\W+([a-zA-Z0-9 -]+)", execresult("gwmi -query 'SELECT SMBIOSBIOSVersion, Manufacturer, SerialNumber, Version FROM WIN32_BIOS'", "powershell"), "bios_array"); "processor_match" expression => regextract(".*Name\W+(.*)", execresult("gwmi -query 'SELECT Name FROM WIN32_PROCESSOR'", "powershell"), "processor_array"); "system_match" expression => regextract(".*Manufacturer\W+(.*)", execresult("gwmi -query 'SELECT Manufacturer FROM WIN32_COMPUTERSYSTEM'", "powershell"), "system_array"); # BEGIN Inventory Total Physical Memory MB vars: "total_physical_memory_MB" -> { "CFE-2896" } string => readfile( "$(sys.statedir)/inventory-$(this.bundle)-total-physical-memory-MB.txt", 100), meta => { "inventory", "attribute_name=Physical memory (MB)" }, if => fileexists( "$(sys.statedir)/inventory-$(this.bundle)-total-physical-memory-MB.txt" ); commands: have_dmidecode:: "$(decoder) -t 17 | $(paths.awk) '/Size.*MB/ {s+=$2} END {print s}' > '$(sys.statedir)/inventory-$(this.bundle)-total-physical-memory-MB.txt'" -> { "CFE-2896" } contain => in_shell, if => not( fileexists( "$(sys.statedir)/inventory-$(this.bundle)-total-physical-memory-MB.txt") ); files: "$(sys.statedir)/inventory-$(this.bundle)-total-physical-memory-MB.txt" -> { "CFE-2896" } delete => tidy, file_select => older_than(0, 0, 1, 0, 0, 0), comment => "Clear the cached value for total physical memory MB once a day."; # END Inventory Total Physical Memory MB reports: DEBUG|DEBUG_cfe_autorun_inventory_dmidecode:: "DEBUG $(this.bundle): Obtained $(dmidefs[$(dmivars)]) = '$(dmi[$(dmivars)])'"; "DEBUG $(this.bundle): Obtained Physical memory (MB) = '$(total_physical_memory_MB)'"; } bundle agent cfe_autorun_inventory_LLDP # @brief Do LLDP-based inventory # # This agent bundle runs lldpctl to discover information. See # http://vincentbernat.github.io/lldpd/ to run this yourself for # testing, and your Friendly Network Admin may be of help too. { classes: "lldpctl_exec_exists" expression => fileexists($(inventory_control.lldpctl_exec)); vars: !disable_inventory_LLDP.lldpctl_exec_exists:: "info" data => parsejson(execresult($(inventory_control.lldpctl_json), "noshell")); } bundle agent cfe_autorun_inventory_packages # @brief Package inventory auto-refresh # # This bundle is for refreshing the package inventory. It runs on # startup, unless disabled. Other package methods can be added below. { classes: "have_patches" or => { "community_edition", # not in Community fileexists("$(sys.workdir)/state/software_patches_avail.csv") }; "have_inventory" and => { "have_patches", fileexists("$(sys.workdir)/state/software_packages.csv"), }; vars: # if we have the patches, 7 days; otherwise keep trying "refresh" string => ifelse("have_inventory", "10080", "0"); packages: # The legacy implementation (package_method) of the packages type promise # requires a packages promise to be triggered in order to generate package # inventory. The following promises ensure that package inventory data # exists. As package modules become available the package_methods should be # removed. suse|sles:: "cfe_internal_non_existing_package" package_policy => "add", package_method => inventory_zypper($(refresh)), action => if_elapsed_day; aix:: "cfe_internal_non_existing_package" package_policy => "add", package_method => inventory_lslpp($(refresh)), action => if_elapsed_day; gentoo:: "cfe_internal_non_existing_package" package_policy => "add", package_method => emerge, action => if_elapsed_day; !redhat.!debian.!gentoo.!(suse|sles).!aix:: "cfe_internal_non_existing_package" package_policy => "add", package_method => generic, action => if_elapsed_day; reports: DEBUG|DEBUG_cfe_autorun_inventory_packages:: "DEBUG $(this.bundle): refresh interval is $(refresh)"; "DEBUG $(this.bundle): we have the inventory files." ifvarclass => "have_inventory"; "DEBUG $(this.bundle): we don't have the inventory files." ifvarclass => "!have_inventory"; } body package_method inventory_lslpp(update_interval) # @brief AIX lslpp installation method for inventory purposes only # @param update_interval how often to update the package and patch list { package_changes => "individual"; package_list_update_command => "/usr/bin/true"; package_list_update_ifelapsed => $(update_interval); package_list_command => "/usr/bin/lslpp -Lqc"; # list RPMs too package_list_version_regex => "[^:]+:[^:]+:([^:]+):.*"; # Make sure version is not included in the name, that indicates RPM # packages, which we should ignore. package_list_name_regex => "[^:]+:(([^-:]|-[^0-9])+):.*"; package_installed_regex => "[^:]+:(([^-:]|-[^0-9])+):[^:]+:[^:]+:.*"; package_name_convention => "$(name)-$(version).+"; package_add_command => "/usr/bin/true"; package_update_command => "/usr/bin/true"; package_patch_command => "/usr/bin/true"; package_delete_command => "/usr/bin/true"; package_verify_command => "/usr/bin/true"; } body package_method inventory_zypper(update_interval) # @depends common_knowledge rpm_knowledge suse_knowledge # @brief SUSE zypper installation method for inventory purposes only # @param update_interval how often to update the package and patch list # # This package method is a copy of the SUSE zypper method just for # inventory purposes. { package_changes => "bulk"; package_list_command => "$(paths.path[rpm]) -qa --queryformat \"i | repos | %{name} | %{version}-%{release} | %{arch}\n\""; # set it to "0" to avoid caching of list during upgrade package_list_update_command => "$(suse_knowledge.call_zypper) list-updates"; package_list_update_ifelapsed => $(update_interval); package_patch_list_command => "$(suse_knowledge.call_zypper) patches"; package_installed_regex => "i.*"; package_list_name_regex => "$(rpm_knowledge.rpm_name_regex)"; package_list_version_regex => "$(rpm_knowledge.rpm_version_regex)"; package_list_arch_regex => "$(rpm_knowledge.rpm_arch_regex)"; package_patch_installed_regex => ".*Installed.*|.*Not Applicable.*"; package_patch_name_regex => "[^|]+\|\s+([^\s]+).*"; package_patch_version_regex => "[^|]+\|[^|]+\|\s+([^\s]+).*"; package_name_convention => "$(name)"; package_add_command => "$(suse_knowledge.call_zypper) --help >/dev/null 2>&1 ; /bin/true"; package_delete_command => "$(suse_knowledge.call_zypper) --non-interactive remove --force-resolution"; package_update_command => "$(suse_knowledge.call_zypper) --non-interactive update"; package_patch_command => "$(suse_knowledge.call_zypper) --non-interactive patch$"; # $ means no args package_verify_command => "$(suse_knowledge.call_zypper) --non-interactive verify$"; } bundle agent cfe_autorun_inventory_cmdb # @brief Copy and load the CMDB inventory # # This bundle is for refreshing the CMDB inventory. It copies the # file me.json from the server, then loads it to create variables and # classes. { vars: "cmdb_dir" string => "$(sys.workdir)/cmdb", comment => "CMDB directory location", meta => { "cmdb" }; "cmdb_file" string => "$(cmdb_dir)/me.json", comment => "CMDB file location", meta => { "cmdb" }; files: "$(cmdb_file)" copy_from => inventory_cmdb_copy_from, classes => inventory_scoped_classes_generic("bundle", "cmdb_file"); methods: cmdb_file_ok:: "load CMDB file" usebundle => inventory_cmdb_load($(cmdb_file)); } bundle agent inventory_cmdb_load(file) # @brief Load the CMDB inventory # # This bundle is for loading the CMDB inventory. { classes: "have_cmdb_data" expression => isvariable("cmdb"); "$(ckeys)" expression => "any", scope => "namespace"; vars: "cmdb" data => readjson($(file), "999999"), ifvarclass => fileexists( $(file) ); "cmdb_string" string => format("%S", cmdb), ifvarclass => isvariable( cmdb ); "bkeys" slist => getindices("cmdb[vars]"); "vkeys_$(bkeys)" slist => getindices("cmdb[vars][$(bkeys)]"); "$(vkeys_$(bkeys))" string => nth("cmdb[vars][$(bkeys)]", $(vkeys)); "ckeys" slist => getindices("cmdb[classes]"); reports: DEBUG|DEBUG_inventory_cmdb_load:: "DEBUG $(this.bundle): Got CMDB data from $(file): $(cmdb_string)" ifvarclass => "have_cmdb_data"; "DEBUG $(this.bundle): Got CMDB key = $(vkeys_$(bkeys)), CMDB value = $((vkeys_$(bkeys)))" ifvarclass => "have_cmdb_data"; "DEBUG $(this.bundle): Got CMDB class = $(ckeys)" ifvarclass => "have_cmdb_data"; "DEBUG $(this.bundle): Could not read the CMDB data from $(file)" ifvarclass => "!have_cmdb_data"; } body copy_from inventory_cmdb_copy_from # @brief Copy from the CMDB source { !cfe_inventory_cmdb_override_file:: source => "me.json"; servers => { "$(sys.policy_hub)" }; cfe_inventory_cmdb_override_file:: source => "$(sys.inputdir)/me.json"; any:: compare => "digest"; encrypt => "true"; verify => "true"; } body classes inventory_scoped_classes_generic(scope, x) # @brief Define `x` prefixed/suffixed with promise outcome # **See also:** `scope` # # @param scope The scope in which the class should be defined # @param x The unique part of the classes to be defined # # Copy of `scoped_classes_generic`, which see. { scope => "$(scope)"; promise_repaired => { "promise_repaired_$(x)", "$(x)_repaired", "$(x)_ok", "$(x)_reached" }; repair_failed => { "repair_failed_$(x)", "$(x)_failed", "$(x)_not_ok", "$(x)_not_kept", "$(x)_not_repaired", "$(x)_reached" }; repair_denied => { "repair_denied_$(x)", "$(x)_denied", "$(x)_not_ok", "$(x)_not_kept", "$(x)_not_repaired", "$(x)_reached" }; repair_timeout => { "repair_timeout_$(x)", "$(x)_timeout", "$(x)_not_ok", "$(x)_not_kept", "$(x)_not_repaired", "$(x)_reached" }; promise_kept => { "promise_kept_$(x)", "$(x)_kept", "$(x)_ok", "$(x)_not_repaired", "$(x)_reached" }; } body contain inventory_in_shell # @brief run command in shell # # Copy of `in_shell`, which see. { useshell => "true"; # canonical "useshell" but this is backwards-compatible } cfengine-masterfiles-3.12.1/inventory/linux.cf0000644000000000000000000000556513377750475021431 0ustar00rootroot00000000000000bundle common inventory_linux # @brief Linux inventory # # This common bundle is for Linux inventory work. # # Provides: # os_release_id, and os_release_version based on parsing of /etc/os-release # systemd class based on linktarget of /proc/1/cmdline { vars: has_os_release:: "os_release_info" string => readfile("/etc/os-release", "512"), comment => "Read /etc/os-release" ; os_release_has_id:: "os_release_id" string => canonify("$(id_array[1])"); os_release_has_version:: "os_release_version" string => canonify("$(version_array[1])"); has_proc_1_cmdline:: "proc_1_cmdline_split" slist => string_split(readfile("/proc/1/cmdline", "512"), " ", "2"), comment => "Read /proc/1/cmdline and split off arguments"; "proc_1_cmdline" string => nth("proc_1_cmdline_split", 0), comment => "Get argv[0] of /proc/1/cmdline"; # this is the same as the original file for non-links "proc_1_process" string => filestat($(proc_1_cmdline), "linktarget"); any:: "proc_routes" data => data_readstringarrayidx("/proc/net/route", "#[^\n]*","\s+",40,4k), ifvarclass => fileexists("/proc/net/route"); "routeidx" slist => getindices("proc_routes"); "dgw_ipv4_iface" string => "$(proc_routes[$(routeidx)][0])", comment => "Name of the interface where default gateway is routed", ifvarclass => strcmp("$(proc_routes[$(routeidx)][1])", "00000000"); classes: any:: "has_os_release" expression => fileexists("/etc/os-release"), comment => "Check if we can get more info from /etc/os-release"; "os_release_has_id" expression => regextract('^ID="?([^"\s]+)"?$', $(os_release_info), "id_array"), comment => "Extract ID= line from os-release to id_array"; "os_release_has_version" expression => regextract('^VERSION_ID="?([^"]+)"?$', $(os_release_info), "version_array"), comment => "Extract VERSION_ID= line from os-release to version_array"; "has_proc_1_cmdline" expression => fileexists("/proc/1/cmdline"), comment => "Check if we can read /proc/1/cmdline"; os_release_has_id:: "$(os_release_id)" expression => "any"; os_release_has_version:: "$(os_release_id)_$(os_release_version)" expression => "any"; has_proc_1_cmdline:: "systemd" expression => strcmp(lastnode($(proc_1_process), "/"), "systemd"), comment => "Check if (the link target of) /proc/1/cmdline is systemd"; reports: (DEBUG|DEBUG_inventory_linux).has_os_release:: "DEBUG $(this.bundle)"; "$(const.t)OS release ID = $(os_release_id), OS release version = $(os_release_version)"; } cfengine-masterfiles-3.12.1/inventory/generic.cf0000644000000000000000000000025013377750475021670 0ustar00rootroot00000000000000bundle common inventory_generic # @brief Generic (unknown OS) inventory # # This common bundle is for unknown operating systems, not handled by # specific bundles. { } cfengine-masterfiles-3.12.1/inventory/README.md0000644000000000000000000002541413377750475021232 0ustar00rootroot00000000000000The CFEngine 3 inventory modules are pieces of CFEngine policy that are loaded and used by `promises.cf` in order to *inventory* the system. CFEngine Enterprise has specific functionality to show and use inventory data, but users of the Community Version can use them as well locally on each host. ## How It Works The inventory modules are called in `promises.cf`: ``` body common control { bundlesequence => { # Common bundle first (Best Practice) inventory_control, @(inventory.bundles), ... ``` As you see, this calls the `inventory_control` bundle, and then each bundle in the list `inventory.bundles`. That list is built in the top-level common `inventory` bundle, which will load the right things for some common cases. The `any.cf` inventory module is always loaded; the rest are loaded if they are appropriate for the platform. For instance, Debian systems will load `debian.cf` and `linux.cf` and `lsb.cf` but may load others as needed. The effect for users is that the right inventory modules will be loaded and evaluated. The `inventory_control` bundle lives in `def.cf` and defines what inventory modules should be disabled. You can simply set `disable_inventory` to avoid the whole system, or you can look for the `disable_inventory_xyz` class to disable module `xyz`. Any inventory module works the same way, by doing some discovery work and then tagging its classes and variables with the `report` or `inventory` tags. For example: ``` vars: "ports" slist => { @(mon.listening_ports) }, meta => { "inventory", "attribute_name=Ports listening" }; ``` This defines a reported attribute "Ports listening" which contains a list of strings representing the listening ports. More on this in a second. ## Your Very Own Inventory Module The good news is, writing an inventory module is incredibly easy. They are just CFEngine bundles. You can see a simple one that collects the listening ports in `any.cf`: ```cf3 bundle agent cfe_autorun_inventory_listening_ports # @brief Inventory the listening ports # # This bundle uses `mon.listening_ports` and is always enabled by # default, as it runs instantly and has no side effects. { vars: "ports" slist => { @(mon.listening_ports) }, meta => { "inventory", "attribute_name=Ports listening" }; } ``` Well, the slist copy is a CFEngine detail (we get the listening ports from the monitoring daemon), so just assume that the data is correct. What's important is the second line that starts with [`meta`][Promise Types and Attributes#meta]. That defines metadata for the promise that CFEngine will use to determine that this data is indeed inventory data and should be reported to the CFEngine Enterprise Hub. That's it. Really. The comments are optional but nice to have. You don't have to put your new bundle in a file under the `inventory` directory, either. The variables and classes can be declared anywhere as long as they have the right tags. So you can use the `services` directory or whatever else makes sense to you. # CFEngine Enterprise vs. Community In CFEngine Enterprise, the reported data is aggregated in the hub and reported across the whole host population. In CFEngine Community, users can use the `classesmatching()` and `variablesmatching()` functions to collect all the inventory variables and classes and report them in other ways. ## Implementation Best Practice for CFEngine Enterprise It is important that inventory variables and classes are continually defined. Only inventory variables and classes defined during the last reported run are available for use by the inventory reporting interface. Inventory items that change frequently can create a burden on the Enterprise reporting infrastructure. Generally, inventory attributes should change infrequently. If you wish to inventory attributes that frequently change or are expensive to discover consider implementing a sample interval and caching mechanism. # What Modules Are Available? As soon as you use the `promises.cf` provided in the parent directory, quite a few inventory modules will be enabled (if appropriate for your system). Here's the list of modules and what they provide. Note they are all enabled by code in `def.cf` as explained above. ## Package Inventory * lives in: `any.cf` * applies to: All systems * runs: package modules in order to report on packages installed and patches available * disable: define the class ```disable_inventory_package_refresh```. Note this also disables the default package inventory used by the new packages promise implementation. This will cause the ```packagesmatching()``` and ```packageupdatesmatching()``` functions to rely on data supplied by the legacy package promise implementation. ## LSB * lives in: `lsb.cf` * applies to: LSB systems (most Linux distributions, basically) * runs: `lsb_release -a` * sample data: ``` Distributor ID: Ubuntu Description: Ubuntu 14.04 LTS Release: 14.04 Codename: trusty ``` * provides: * classes `lsb_$(os)`, `lsb_$(os)_$(release)`, `lsb_$(os)_$(codename)` * variables: `inventory_lsb.os` (Distributor ID), `inventory_lsb.codename`, `inventory_lsb.release`, `inventory_lsb.flavor`, `inventory_lsb.description` * sample output: ``` % cf-agent -KI -binventory_control,inventory_lsb R: inventory_lsb: OS = Ubuntu, codename = trusty, release = 14.04, flavor = Ubuntu_14_04, description = Ubuntu 14.04 LTS ``` ## SUSE * lives in: `suse.cf` * applies to: SUSE Linux * provides classes: `suse_pure` and `suse_derived` ## Debian * lives in: `debian.cf` * applies to: Debian and its derivatives * provides: * variables: `inventory_debian.mint_release` and `inventory_debian.mint_codename` * classes: `debian_pure`, `debian_derived`, `linuxmint`, `lmde`, `linuxmint_$(mint_release)`, `linuxmint_$(mint_codename)`, `$(mint_codename)` ## Red Hat * lives in: `redhat.cf` * applies to: Red Hat and its derivatives * provides classes: `redhat_pure`, `redhat_derived` ## Windows * lives in: `windows.cf` ## Mac OS X * lives in: `macos.cf` ## Generic (unknown OS) * lives in: `generic.cf` (see `any.cf` for generally applicable inventory modules) ## LLDP * lives in: `any.cf` * runs `inventory_control.lldpctl_exec` through a Perl filter * provides variables: `cfe_autorun_inventory_LLDP.K` for each `K` returned by the LLDB executable ## mtab * lives in: `any.cf` * parses: `/etc/mtab` * provides classes: `have_mount_FSTYPE` and `have_mount_FSTYPE_MOUNTPOINT` * sample output (note this is verbose mode with `-v` because there's a lot of output): ``` % cf-agent -Kv -binventory_control,cfe_autorun_inventory_mtab|grep 'cfe_autorun_inventory_mtab: we have' R: cfe_autorun_inventory_mtab: we have a ext4 mount under / ... R: cfe_autorun_inventory_mtab: we have a cgroup mount under /sys/fs/cgroup/systemd R: cfe_autorun_inventory_mtab: we have a tmpfs mount under /run/shm ``` ## fstab * lives in: `any.cf` * parses: `sys.fstab` * provides classes: `have_fs_FSTYPE` `have_fs_MOUNTPOINT` and `have_fs_FSTYPE_MOUNTPOINT` * sample output (note this is verbose mode with `-v` because there's a LOT of output): ``` % cf-agent -Kv -binventory_control,cfe_autorun_inventory_fstab|grep 'cfe_autorun_inventory_fstab: we have' R: cfe_autorun_inventory_fstab: we have a ext4 fstab entry under / R: cfe_autorun_inventory_fstab: we have a cifs fstab entry under /backups/load R: cfe_autorun_inventory_fstab: we have a auto fstab entry under /mnt/cdrom ``` ## CMDB * lives in: `any.cf` * parses: `me.json` (which is copied from the policy server; see implementation) * provides classes: `CLASS` for each CLASS found under the ```classes``` key in the JSON data * provides variables: `inventory_cmdb_load.VARNAME` for each VARNAME found under the `vars` key in the JSON data ## DMI decoding * lives in: `any.cf` * runs: `dmidecode` * provides variables: `cfe_autorun_inventory_dmidecode.dmi[K]` for each key K in the `dmidecode` output * sample output (sudo is needed to access the DMI): ``` % sudo /var/cfengine/bin/cf-agent -KI -binventory_control,cfe_autorun_inventory_dmidecode R: cfe_autorun_inventory_dmidecode: Obtained BIOS vendor = 'Intel Corp.' R: cfe_autorun_inventory_dmidecode: Obtained BIOS version = 'BLH6710H.86A.0146.2013.1555.1888' R: cfe_autorun_inventory_dmidecode: Obtained System serial number = '' R: cfe_autorun_inventory_dmidecode: Obtained System manufacturer = '' R: cfe_autorun_inventory_dmidecode: Obtained System version = '' R: cfe_autorun_inventory_dmidecode: Obtained CPU model = 'Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz' ``` ## Listening ports * lives in: `any.cf` * provides variables: `cfe_autorun_inventory_listening_ports.ports` as a copy of `mon.listening_ports` ## Disk space * lives in: `any.cf` * provides variables: `cfe_autorun_inventory_disk.free` as a copy of `mon.value_diskfree` ## Available memory * lives in: `any.cf` * provides variables: `cfe_autorun_inventory_memory.free` as a copy of `mon.value_mem_free` and `cfe_autorun_inventory_memory.total` as a copy of `mon.value_mem_total` ## Load average * lives in: `any.cf` * provides variables: `cfe_autorun_inventory_loadaverage.value` as a copy of `mon.value_loadavg` ## procfs * lives in: `any.cf` * parses: `consoles`, `cpuinfo`, `modules`, `partitions`, `version` * provides variables: `cfe_autorun_inventory_proc.console_count`, `cfe_autorun_inventory_proc.cpuinfo[K]` for each CPU info key, `cfe_autorun_inventory_proc.paritions[K]` for each partition key * provides classes: `_have_console_CONSOLENAME`, `have_module_MODULENAME` * sample output (note this is verbose mode with `-v` because there's a LOT of output): ``` % cf-agent -Kv -binventory_control,cfe_autorun_inventory_proc|grep 'cfe_autorun_inventory_proc: we have' R: cfe_autorun_inventory_proc: we have console tty0 R: cfe_autorun_inventory_proc: we have module snd_seq_midi ... R: cfe_autorun_inventory_proc: we have module ghash_clmulni_intel R: cfe_autorun_inventory_proc: we have cpuinfo flags = fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx lahf_lm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid ... R: cfe_autorun_inventory_proc: we have cpuinfo model name = Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz R: cfe_autorun_inventory_proc: we have partitions sr0 with 1048575 blocks ... R: cfe_autorun_inventory_proc: we have partitions sda with 468851544 blocks R: cfe_autorun_inventory_proc: we have kernel version 'Linux version 3.11.0-15-generic (buildd@roseapple) (gcc version 4.8.1 (Ubuntu/Linaro 4.8.1-10ubuntu8) ) #25-Ubuntu SMP Thu Jan 30 17:22:01 UTC 2014' ``` cfengine-masterfiles-3.12.1/inventory/macos.cf0000644000000000000000000000017413377750475021363 0ustar00rootroot00000000000000bundle common inventory_macos # @brief Mac OS X inventory bundle # # This common bundle is for Mac OS X inventory work. { } cfengine-masterfiles-3.12.1/inventory/aix.cf0000644000000000000000000000427313377750475021046 0ustar00rootroot00000000000000bundle agent inventory_aix # @brief Red Hat inventory bundle # # This agent bundle is for AIX inventory work. { methods: "oslevel" usebundle => inventory_aix_oslevel; } bundle agent inventory_aix_oslevel # @brief Inventory oslevel # @description This policy inventories oslevel on aix. It caches the information # for up to 1 day before re-discovering. { vars: "oslevel" string => ifelse( isvariable( "paths.oslevel" ), $(paths.oslevel), "/usr/bin/oslevel" ); commands: aix:: "$(oslevel)" handle => "cache_aix_oslevel_s", args => "-s > $(sys.statedir)/aix-oslevel-s", if => not( fileexists( "$(sys.statedir)/aix-oslevel-s" ) ), contain => in_shell, comment => "We cache the highest service pack reached to avoid unnecessary command executions."; "$(oslevel)" handle => "cache_aix_oslevel_r", args => "-r > $(sys.statedir)/aix-oslevel-r", if => not( fileexists( "$(sys.statedir)/aix-oslevel-r" ) ), contain => in_shell, comment => "We cache the highest technology level reached to avoid unnecessary command executions."; files: aix:: "$(sys.statedir)/aix-oslevel-r" handle => "cache_expire_aix_oslevel_r", delete => tidy, file_select => days_old( 1 ), comment => "We regularly clear the cache to avoid stale data"; "$(sys.statedir)/aix-oslevel-s" handle => "cache_expire_aix_oslevel_s", delete => tidy, file_select => days_old( 1 ), comment => "We regularly clear the cache to avoid stale data"; vars: aix:: "oslevel_s" string => readfile("$(sys.statedir)/aix-oslevel-s", 1K ), if => fileexists("$(sys.statedir)/aix-oslevel-s"), meta => { "inventory", "attribute_name=Highest Service Pack" }; "oslevel_r" string => readfile("$(sys.statedir)/aix-oslevel-r", 1K), if => fileexists("$(sys.statedir)/aix-oslevel-r"), meta => { "inventory", "attribute_name=Highest Technology Level" }; reports: DEBUG:: "Highest Service Pack: $(oslevel_s)"; "Highest Technology Level: $(oslevel_r)"; } cfengine-masterfiles-3.12.1/inventory/redhat.cf0000644000000000000000000000163313377750475021531 0ustar00rootroot00000000000000bundle common inventory_redhat # @brief Red Hat inventory bundle # # This common bundle is for Red Hat Linux inventory work. { classes: "redhat_pure" expression => "redhat.!centos.!oracle", comment => "pure Red Hat", meta => { "inventory", "attribute_name=none" }; "redhat_derived" expression => "redhat.!redhat_pure", comment => "derived from Red Hat", meta => { "inventory", "attribute_name=none" }; "cfe_yum_package_module_supported" -> { "CFE-2602" } comment => "Here we see if the version of python found is acceptable for the yum package module. We use this guard to prevent errors related to missing python modules.", expression => returnszero("python -V 2>&1 | grep ^Python | cut -d' ' -f 2 | ( IFS=. read v1 v2 v3 ; [ $v1 -ge 3 ] || [ $v1 -eq 2 -a $v2 -ge 4 ] )", useshell); } cfengine-masterfiles-3.12.1/inventory/windows.cf0000644000000000000000000000017413377750475021753 0ustar00rootroot00000000000000bundle common inventory_windows # @brief Windows inventory bundle # # This common bundle is for Windows inventory work. { } cfengine-masterfiles-3.12.1/inventory/os.cf0000644000000000000000000000076013377750475020703 0ustar00rootroot00000000000000bundle common inventory_os { vars: _inventory_lsb_found:: "description" string => "$(inventory_lsb.os) $(inventory_lsb.release)", meta => { "inventory", "attribute_name=OS" }; !_inventory_lsb_found.windows:: "description" string => "$(sys.release)", meta => { "inventory", "attribute_name=OS" }; !_inventory_lsb_found.!windows:: "description" string => "$(sys.flavor) (LSB missing)", meta => { "inventory", "attribute_name=OS" }; } cfengine-masterfiles-3.12.1/standalone_self_upgrade.cf0000644000000000000000000010676713377750574023113 0ustar00rootroot00000000000000# This policy is designed to be run with an independent agent. # WARNING: Including this policy into the inputs of another policy may result in # duplicate definition of bundles. bundle agent main # @brief This bundle drives the self upgrade. It actuates the appropriate # bundles to download binaries to the hub for serving to clients, caching the # software to remote clients, and managing the version of cfengine installed on # non hubs. { classes: "policy_server_dat_unstable" expression => isnewerthan( "$(sys.workdir)/policy_server.dat", "$(sys.workdir)/outputs" ), comment => "If $(sys.workdir)/policy_server.dat is newer than the outputs directory, it can indicate that the current agent execution is a result of bootstrap. For stability we want to skip upgrades during bootstrap. The outputs directory should be newer than the policy_server.dat on the next agent run and allow upgrade then."; reports: "Running $(this.promise_filename)"; methods: "cfengine_software"; am_policy_hub|policy_server:: "Master Software Repository Data" usebundle => cfengine_master_software_content; !(am_policy_hub|policy_server|policy_server_dat_unstable):: "Local Software Cache" usebundle => cfengine_software_cached_locally; "CFEngine Version" usebundle => cfengine_software_version; } bundle common package_module_knowledge # @brief common package_module_knowledge bundle # # This common bundle defines which package modules are the defaults on different # platforms. { vars: debian|ubuntu:: "platform_default" string => "apt_get"; redhat|centos|amazon_linux:: "platform_default" string => "yum"; } bundle common u_common_knowledge # @brief standalone common packages knowledge bundle # # This common bundle defines general things about platforms. # @see common_knowledge { vars: "list_update_ifelapsed_now" string => "10080"; } bundle agent cfengine_software #@ brief Variables to control the specifics in desired package selection { vars: # Default desired CFEngine software "pkg_name" string => "cfengine-nova"; "pkg_version" string => "3.12.1"; "pkg_release" string => "1"; "pkg_arch" string => "x86_64"; "package_dir" string => "$(sys.flavour)_$(sys.arch)"; !(cfengine_3_7_1|cfengine_3.7.2|cfengine_3.7.3):: # After 3.7.4 a fix to ifelse and isvarible allows for actuating the function # even thought the promise references an unresolved variable. "pkg_name" string => ifelse( isvariable( "def.cfengine_software_pkg_name" ), $(def.cfengine_software_pkg_name), "cfengine-nova"); "pkg_version" string => ifelse( isvariable( "def.cfengine_software_pkg_version" ), $(def.cfengine_software_pkg_version), "3.12.1"); "pkg_release" string => ifelse( isvariable( "def.cfengine_software_pkg_release" ), $(def.cfengine_software_pkg_release), "1"); "pkg_arch" string => ifelse( isvariable( "def.cfengine_software_pkg_arch" ), $(def.cfengine_software_pkg_arch), "x86_64"); "package_dir" string => ifelse( isvariable( "def.cfengine_software_pkg_dir" ), $(def.cfengine_software_pkg_dir), "$(sys.flavour)_$(sys.arch)"); aix:: "pkg_name" string => "cfengine.cfengine-nova"; "pkg_arch" string => "default"; # TODO ENT-3187 solaris|solarisx86:: "pkg_name" string => "CFE.cfengine-nova"; (debian|ubuntu).64_bit:: "pkg_arch" string => "amd64", comment => "On debian hosts it's the standard to use 'amd64' instead of 'x86_64' in package architectures."; (redhat|centos|suse|sles).32_bit:: "pkg_arch" string => "i386", comment => "i686 is the detected architecture, but the package is compatible from i386 up."; hpux:: "package_dir" string => "$(sys.class)_$(sys.arch)", comment => "The directory within software updates to look for packages. On HPUX sys.flavor includes versions, so we use sys.class instead."; any:: "local_software_dir" string => translatepath( "$(sys.workdir)/software_updates/$(package_dir)" ), comment => "So that we converge on the first pass we set this last as package_dir may vary across platforms."; reports: DEBUG|DEBUG_cfengine_software:: "$(this.bundle) pkg_name = $(pkg_name)"; "$(this.bundle) pkg_version = $(pkg_version)"; "$(this.bundle) pkg_release = $(pkg_release)"; "$(this.bundle) pkg_arch = $(pkg_arch)"; "$(this.bundle) package_dir = $(package_dir)"; files: "$(sys.statedir)/MPF/." create => "true"; "$(sys.statedir)/MPF/desired-cfengine-package-version.json" create => "true"; "$(sys.statedir)/MPF/desired-cfengine-package-version.json" -> { "ENT-3592", "ENT-3937" } edit_line => cfengine_software_version_data; } bundle edit_line cfengine_software_version_data # @brief Populate data file with the package information # The data this bundle writes is used by the update policy to determine if the # standalone self upgrade policy should be run or not. # TODO Consider replacing with inline_mustache after 3.10.x is EOL { delete_lines: ".*"; insert_lines: '{ "name": "$(cfengine_software.pkg_name)", "version": "$(cfengine_software.pkg_version)", "release": "$(cfengine_software.pkg_release)", "arch": "$(cfengine_software.pkg_arch)" }'; } bundle agent cfengine_software_cached_locally # @brief Ensure that the internal local software mirror is up to date { reports: inform_mode:: "Ensuring local software cache in $(local_software_dir) is up to date"; vars: "local_software_dir" string => "$(cfengine_software.local_software_dir)"; "package_dir" string => "$(cfengine_software.package_dir)"; # TODO Add shortcut for this path "master_software_location" string => "/var/cfengine/master_software_updates", comment => "The Cfengine binary updates directory on the policy server", handle => "cfe_internal_update_bins_vars_master_software_location"; files: "$(local_software_dir)/." create => "true", comment => "Ensure the local software directory exists for new binaries to be downloaded to"; # NOTE This is pegged to the single upstream policy hub, it won't fail # over to a secondary for copying the binarys to update. "$(local_software_dir)" comment => "Copy binary updates from master source on policy server", handle => "cfe_internal_update_bins_files_pkg_copy", copy_from => u_dsync( "$(master_software_location)/$(package_dir)", $(sys.policy_hub) ), file_select => plain, depth_search => u_recurse_basedir(inf), action => u_immediate, classes => u_if_repaired("bin_newpkg"); } bundle agent cfengine_software_version # @brief Ensure the version of CFEngine installed is correct for supported # platforms. Different platforms leverage different implementations for self # upgrading. { classes: "__supported_platform" or => { "redhat.!redhat_4", "centos.!centos_4", "debian", "ubuntu", "hpux", "aix" }; "__new_implementation" or => { "redhat", "centos", "ubuntu", "debian" }; vars: "pkg_name" string => "$(cfengine_software.pkg_name)"; "pkg_version" string => "$(cfengine_software.pkg_version)"; "pkg_release" string => "$(cfengine_software.pkg_release)"; "pkg_arch" string => "$(cfengine_software.pkg_arch)"; "package_dir" string => "$(cfengine_software.pkg_dir)"; "local_software_dir" string => "$(cfengine_software.local_software_dir)"; methods: __supported_platform.__new_implementation:: "Manage CFEngine Version" usebundle => cfengine_software_version_packages2; __supported_platform.!__new_implementation:: "Manage CFEngine Version" usebundle => cfengine_software_version_packages1; reports: !__supported_platform.inform_mode:: "$(this.bundle) $(package_dir) is not supported"; } bundle agent cfengine_software_version_packages2 #@ brief Ensure the correct version of software is installed using the new packages promise implementation { vars: "pkg_name" string => "$(cfengine_software.pkg_name)"; "pkg_version" string => "$(cfengine_software.pkg_version)"; "pkg_release" string => "$(cfengine_software.pkg_release)"; "pkg_arch" string => "$(cfengine_software.pkg_arch)"; "package_dir" string => "$(cfengine_software.pkg_dir)"; "local_software_dir" string => "$(cfengine_software.local_software_dir)"; packages: (redhat|centos).!__supported:: "$(local_software_dir)/$(cfengine_package_names.my_pkg)" policy => "present", package_module => yum, comment => "Ensure the latest package is installed"; (debian|ubuntu).!__supported:: "$(local_software_dir)/$(cfengine_package_names.my_pkg)" policy => "present", package_module => apt_get, comment => "Ensure the latest package is installed"; reports: "DEBUG|DEBUG_$(this.bundle)":: "Running $(this.bundle)"; } bundle agent cfengine_software_version_packages1 #@ brief Ensure the correct version of software is installed using the legacy self update mechanism #@ **Supported Platforms:** #@ - RedHat|Centos|Suse (rpm) #@ - Debian|Ubuntu (dpkg) #@ - solarisx86|solaris (pkgadd) #@ - windows (msiexec) #@ - aix (installp) #@ **Unsupported Platforms:** (but stubbed) #@ - freebsd|netbsd (pkg_add) { classes: "cf_upgrade" expression => "(redhat|suse|sles|debian|solaris|solarisx86).!(am_policy_hub|policy_server)"; vars: # NOTE These logs are not actively used or cleaned up by anything. Their # use will be phased as platforms migrate to the new packages # implementation for self upgrades. "local_update_log_dir" string => translatepath("$(sys.workdir)/software_updates/update_log"), comment => "Local directory to store update log for this host.", handle => "cfe_internal_update_bins_vars_local_update_log_dir"; "local_software_dir" string => "$(cfengine_software.local_software_dir)"; "desired_version" string => ifelse("linux", "$(cfengine_software.pkg_version)-$(cfengine_software.pkg_release)", "aix", "$(cfengine_software.pkg_version).0", $(cfengine_software.pkg_version) ), comment => "The version attribute sometimes contains package release information and sometimes does not. Here we construct the version used in the package promise for the given platform."; cf_upgrade:: # We only use cf-upgrade for some platforms, the need for it has been # deprecated by the new packages promise implementation. # backup script for cf-upgrade # the script should have 2 conditions, BACKUP and RESTORE # BACKUP and RESTORE status is $(const.dollar)1 variable in the script # see more details at bundle edit_line u_backup_script # NOTE cf-upgrade wants to execute from /tmp by default. This is # problematic for systems where /tmp is mounted with no-exec. "backup_script" string => "/tmp/cf-upgrade_backup.sh"; # a single compressed backup file for cf-upgrade # this backup_file is passed to backup_script as $(const.dollar)2 variable # cf-upgrade will extract this file if return signal of upgrade command is not 0 "backup_file" string => "/tmp/cfengine-nova-$(sys.cf_version).tar.gz"; # install script for cf-upgrade # each distribution has its own way to upgrade a package # see more details at bundle edit_line u_install_script "install_script" string => "/tmp/cf-upgrade_install.sh"; (solarisx86|solaris).enterprise:: # to automatically remove or install packages on Solaris # admin_file is a must to have to avoid pop-up interaction # see more details at bundle edit_line u_admin_file "admin_file" string => "/tmp/cf-upgrade_admin_file"; files: # Remote enterprise agents (non policy hubs) that have `trigger_upgrade` defined cf_upgrade.enterprise.trigger_upgrade:: "$(backup_script)" comment => "Create a backup script for cf-upgrade", handle => "cfe_internal_update_bins_files_backup_script", create => "true", ifvarclass => "!windows", edit_defaults => u_empty_no_backup, edit_line => u_backup_script, perms => u_m("0755"); "$(install_script)" comment => "Create an install script for cf-upgrade", handle => "cfe_internal_update_bins_files_install_script", create => "true", ifvarclass => "!windows", edit_defaults => u_empty_no_backup, edit_line => u_install_script, perms => u_m("0755"); "$(admin_file)" comment => "Create solaris admin_file to automate remove and install packages", handle => "cfe_internal_update_bins_files_solaris_admin_file", create => "true", edit_defaults => u_empty_no_backup, edit_line => u_admin_file, perms => u_m("0644"), ifvarclass => "solarisx86|solaris"; packages: # Only non policy hubs running are allowed to self upgrade # We don't upgrade during bootstrap !(am_policy_hub|policy_server|bootstrap_mode).enterprise_edition:: "$(cfengine_software.pkg_name)" comment => "Update Nova package to a newer version", handle => "cfe_internal_update_bins_packages_nova_update", package_policy => "update", package_select => "==", package_architectures => { "$(cfengine_software.pkg_arch)" }, package_version => "$(desired_version)", package_method => u_generic( $(cfengine_software.local_software_dir) ), classes => u_if_else("bin_update_success", "bin_update_fail"); reports: "DEBUG|DEBUG_$(this.bundle)":: "Running $(this.bundle)"; } bundle common cfengine_package_names { vars: "pkg_name" string => "$(cfengine_software.pkg_name)"; "pkg_version" string => "$(cfengine_software.pkg_version)"; "pkg_release" string => "$(cfengine_software.pkg_release)"; "pkg_arch" string => "$(cfengine_software.pkg_arch)"; # Redhat/Centos 4, 5 use the same package "pkg[redhat_5_x86_64]" string => "$(pkg_name)-$(pkg_version)-$(pkg_release).el4.x86_64.rpm"; "pkg[centos_5_x86_64]" string => "$(pkg[redhat_5_x86_64])"; "pkg[oracle_5_x86_64]" string => "$(pkg[redhat_5_x86_64])"; "pkg[SuSE_11_x86_64]" string => "$(pkg[redhat_5_x86_64])"; "pkg[SuSE_10_x86_64]" string => "$(pkg[redhat_5_x86_64])"; # 32bit RPMs "pkg[redhat_5_i386]" string => "$(pkg_name)-$(pkg_version)-$(pkg_release).el4.i386.rpm"; "pkg[redhat_5_i586]" string => "$(pkg[redhat_5_i386])"; "pkg[redhat_5_i686]" string => "$(pkg[redhat_5_i386])"; "pkg[centos_5_i386]" string => "$(pkg[redhat_5_i386])"; "pkg[centos_5_i586]" string => "$(pkg[redhat_5_i386])"; "pkg[centos_5_i686]" string => "$(pkg[redhat_5_i386])"; "pkg[centos_6_i386]" string => "$(pkg[redhat_5_i386])"; "pkg[redhat_6_i386]" string => "$(pkg[redhat_5_i386])"; "pkg[redhat_6_i586]" string => "$(pkg[redhat_5_i386])"; "pkg[redhat_6_i686]" string => "$(pkg[redhat_5_i386])"; "pkg[centos_7_i386]" string => "$(pkg[redhat_5_i386])"; "pkg[centos_7_i586]" string => "$(pkg[redhat_5_i386])"; "pkg[centos_7_i686]" string => "$(pkg[redhat_5_i386])"; "pkg[SuSE_11_i386]" string => "$(pkg[redhat_5_i386])"; "pkg[SuSE_10_i386]" string => "$(pkg[redhat_5_i386])"; # Redhat/Centos 6, 7 use the same package "pkg[redhat_6_x86_64]" string => "$(pkg_name)-$(pkg_version)-$(pkg_release).el6.x86_64.rpm"; "pkg[centos_6_x86_64]" string => "$(pkg[redhat_6_x86_64])"; "pkg[oracle_6_x86_64]" string => "$(pkg[redhat_6_x86_64])"; "pkg[redhat_7_x86_64]" string => "$(pkg[redhat_6_x86_64])"; "pkg[centos_7_x86_64]" string => "$(pkg[redhat_6_x86_64])"; "pkg[oracle_7_x86_64]" string => "$(pkg[redhat_6_x86_64])"; # Debian 7, 8 and Ubuntu 14, 16 use the same package "pkg[debian_7_x86_64]" string => "$(pkg_name)_$(pkg_version)-$(pkg_release)_amd64-debian7.deb"; "pkg[debian_8_x86_64]" string => "$(pkg[debian_7_x86_64])"; "pkg[ubuntu_14_x86_64]" string => "$(pkg[debian_7_x86_64])"; "pkg[ubuntu_16_x86_64]" string => "$(pkg[debian_7_x86_64])"; "pkg[ubuntu_18_x86_64]" string => "$(pkg[debian_7_x86_64])"; # 32bit DEBs "pkg[debian_4_i386]" string => "$(pkg_name)_$(pkg_version)-$(pkg_release)_i386-debian4.deb"; "pkg[debian_4_i586]" string => "$(pkg[debian_4_i386])"; "pkg[debian_4_i686]" string => "$(pkg[debian_4_i386])"; "pkg[debian_5_i386]" string => "$(pkg[debian_4_i386])"; "pkg[debian_5_i586]" string => "$(pkg[debian_4_i386])"; "pkg[debian_5_i686]" string => "$(pkg[debian_4_i386])"; "pkg[debian_6_i386]" string => "$(pkg[debian_4_i386])"; "pkg[debian_6_i586]" string => "$(pkg[debian_4_i386])"; "pkg[debian_6_i686]" string => "$(pkg[debian_4_i386])"; "pkg[debian_7_i386]" string => "$(pkg[debian_4_i386])"; "pkg[debian_7_i586]" string => "$(pkg[debian_4_i386])"; "pkg[debian_7_i686]" string => "$(pkg[debian_4_i386])"; "pkg[debian_8_i386]" string => "$(pkg[debian_4_i386])"; "pkg[debian_8_i586]" string => "$(pkg[debian_4_i386])"; "pkg[debian_8_i686]" string => "$(pkg[debian_4_i386])"; "pkg[debian_9_i386]" string => "$(pkg[debian_4_i386])"; "pkg[debian_9_i586]" string => "$(pkg[debian_4_i386])"; "pkg[debian_9_i686]" string => "$(pkg[debian_4_i386])"; "pkg[ubuntu_12_i386]" string => "$(pkg[debian_4_i386])"; "pkg[ubuntu_12_i586]" string => "$(pkg[debian_4_i386])"; "pkg[ubuntu_12_i686]" string => "$(pkg[debian_4_i386])"; "pkg[ubuntu_14_i386]" string => "$(pkg[debian_4_i386])"; "pkg[ubuntu_14_i586]" string => "$(pkg[debian_4_i386])"; "pkg[ubuntu_14_i686]" string => "$(pkg[debian_4_i386])"; "pkg[ubuntu_16_i386]" string => "$(pkg[debian_4_i386])"; "pkg[ubuntu_16_i586]" string => "$(pkg[debian_4_i386])"; "pkg[ubuntu_16_i686]" string => "$(pkg[debian_4_i386])"; "pkg[ubuntu_18_i386]" string => "$(pkg[debian_4_i386])"; "pkg[ubuntu_18_i586]" string => "$(pkg[debian_4_i386])"; "pkg[ubuntu_18_i686]" string => "$(pkg[debian_4_i386])"; "my_pkg" string => "$(pkg[$(sys.flavor)_$(sys.arch)])", comment => "The package name for the currently executing platform."; reports: "DEBUG|DEBUG_$(this.bundle)":: "My Package: $(my_pkg)"; } bundle agent cfengine_master_software_content # When cfengine_master_software_content_state_present is defined the software # will try be be automatically downloaded. { vars: "pkg_name" string => "$(cfengine_software.pkg_name)"; "pkg_version" string => "$(cfengine_software.pkg_version)"; "pkg_release" string => "$(cfengine_software.pkg_release)"; "pkg_arch" string => "$(cfengine_software.pkg_arch)"; "package_dir" string => "$(cfengine_software.pkg_dir)"; "base_url" string => "https://cfengine-package-repos.s3.amazonaws.com/enterprise/Enterprise-$(pkg_version)/agent"; # Map platform/directory identifier to upstream package URLs # Better to read in an external explicit data structure? # Redhat/Centos 4, 5 and SuSE 10, 11 all use the same package "dir[redhat_5_x86_64]" string => "agent_rpm_x86_64"; "dir[centos_5_x86_64]" string => "$(dir[redhat_5_x86_64])"; "dir[oracle_5_x86_64]" string => "$(dir[redhat_5_x86_64])"; "dir[SuSE_11_x86_64]" string => "$(dir[redhat_5_x86_64])"; "dir[SuSE_10_x86_64]" string => "$(dir[redhat_5_x86_64])"; # All 32bit rpms use the same package "dir[redhat_5_i386]" string => "agent_rpm_i386"; "dir[centos_5_i386]" string => "$(dir[redhat_5_i386])"; "dir[centos_5_i586]" string => "$(dir[redhat_5_i386])"; "dir[centos_5_i686]" string => "$(dir[redhat_5_i386])"; "dir[centos_6_i386]" string => "$(dir[redhat_5_i386])"; "dir[centos_6_i586]" string => "$(dir[redhat_5_i386])"; "dir[centos_6_i686]" string => "$(dir[redhat_5_i386])"; "dir[redhat_6_i386]" string => "$(dir[redhat_5_i386])"; "dir[redhat_6_i586]" string => "$(dir[redhat_5_i386])"; "dir[redhat_6_i686]" string => "$(dir[redhat_5_i386])"; "dir[centos_7_i386]" string => "$(dir[redhat_5_i386])"; "dir[centos_7_i586]" string => "$(dir[redhat_5_i386])"; "dir[centos_7_i686]" string => "$(dir[redhat_5_i386])"; "dir[SuSE_11_i386]" string => "$(dir[redhat_5_i386])"; "dir[SuSE_10_i386]" string => "$(dir[redhat_5_i386])"; # Redhat/Centos 6, 7 use the same package "dir[redhat_6_x86_64]" string => "agent_rhel6_x86_64"; "dir[centos_6_x86_64]" string => "$(dir[redhat_6_x86_64])"; "dir[oracle_6_x86_64]" string => "$(dir[redhat_6_x86_64])"; "dir[redhat_7_x86_64]" string => "$(dir[redhat_6_x86_64])"; "dir[centos_7_x86_64]" string => "$(dir[redhat_6_x86_64])"; "dir[oracle_7_x86_64]" string => "$(dir[redhat_6_x86_64])"; # Debian 7, 8 and Ubuntu 14, 16 use the same package "dir[debian_7_x86_64]" string => "agent_debian7_x86_64"; "dir[debian_8_x86_64]" string => "$(dir[debian_7_x86_64])"; "dir[ubuntu_14_x86_64]" string => "$(dir[debian_7_x86_64])"; "dir[ubuntu_16_x86_64]" string => "$(dir[debian_7_x86_64])"; # All 32bit debs use the same package "dir[debian_4_i386]" string => "agent_deb_i386"; "dir[debian_4_i586]" string => "$(dir[debian_4_i386])"; "dir[debian_4_i686]" string => "$(dir[debian_4_i386])"; "dir[debian_5_i386]" string => "$(dir[debian_4_i386])"; "dir[debian_5_i586]" string => "$(dir[debian_4_i386])"; "dir[debian_5_i686]" string => "$(dir[debian_4_i386])"; "dir[debian_6_i386]" string => "$(dir[debian_4_i386])"; "dir[debian_6_i586]" string => "$(dir[debian_4_i386])"; "dir[debian_6_i686]" string => "$(dir[debian_4_i386])"; "dir[debian_7_i386]" string => "$(dir[debian_4_i386])"; "dir[debian_7_i586]" string => "$(dir[debian_4_i386])"; "dir[debian_7_i686]" string => "$(dir[debian_4_i386])"; "dir[debian_8_i386]" string => "$(dir[debian_4_i386])"; "dir[debian_8_i586]" string => "$(dir[debian_4_i386])"; "dir[debian_8_i686]" string => "$(dir[debian_4_i386])"; "dir[debian_9_i386]" string => "$(dir[debian_4_i386])"; "dir[debian_9_i586]" string => "$(dir[debian_4_i386])"; "dir[debian_9_i686]" string => "$(dir[debian_4_i386])"; "dir[ubuntu_14_i386]" string => "$(dir[debian_4_i386])"; "dir[ubuntu_14_i586]" string => "$(dir[debian_4_i386])"; "dir[ubuntu_14_i686]" string => "$(dir[debian_4_i386])"; "dir[ubuntu_16_i386]" string => "$(dir[debian_4_i386])"; "dir[ubuntu_16_i586]" string => "$(dir[debian_4_i386])"; "dir[ubuntu_16_i686]" string => "$(dir[debian_4_i386])"; "platform_dir" slist => getindices( dir ); files: "/var/cfengine/master_software_updates/$(platform_dir)/." create => "true", comment => "We need a place to download each packge we build"; commands: # Fetch each package that we don't already have "/usr/bin/curl" args => "-s $(base_url)/$(dir[$(platform_dir)])/$(cfengine_package_names.pkg[$(platform_dir)]) --output /var/cfengine/master_software_updates/$(platform_dir)/$(cfengine_package_names.pkg[$(platform_dir)])", if => not( fileexists( "/var/cfengine/master_software_updates/$(platform_dir)/$(cfengine_package_names.pkg[$(platform_dir)])" ) ); reports: DEBUG|DEBUG_cfengine_master_software_content:: "curl -s $(base_url)/$(dir[$(i)])/$(cfengine_package_names.pkg[$(i)]) --output /var/cfengine/master_software_updates/$(i)/$(cfengine_pacakge_names.pkg[$(i)])"; } bundle edit_line u_backup_script # @brief Backup script used by cf-upgrade { insert_lines: linux:: "#!/bin/sh if [ $(const.dollar)1 = \"BACKUP\" ]; then tar cfzS $(const.dollar)2 $(sys.workdir) > /dev/null fi if [ $(const.dollar)1 = \"RESTORE\" ]; then tar xfz $(const.dollar)2 fi"; solarisx86|solaris:: "#!/bin/sh if [ $(const.dollar)1 = \"BACKUP\" ]; then tar cf $(const.dollar)2 $(sys.workdir); gzip $(const.dollar)2 fi if [ $(const.dollar)1 = \"RESTORE\" ]; then gunzip $(const.dollar)2.gz; tar xf $(const.dollar)2 fi"; } bundle edit_line u_install_script # @brief Install script used by cf-upgrade { insert_lines: redhat|suse|sles:: "#!/bin/sh /bin/rpm -U $(const.dollar)1"; debian:: "#!/bin/sh /usr/bin/dpkg --force-confdef --force-confnew --install $(const.dollar)1 > /dev/null"; solarisx86|solaris:: "#!/bin/sh pkgname=`pkginfo -d $(const.dollar)1 | awk '{print $(const.dollar)2}'` /usr/sbin/pkgrm -n -a $(cfe_internal_update_bins.admin_file) $pkgname /usr/sbin/pkgadd -n -a $(cfe_internal_update_bins.admin_file) -d $(const.dollar)1 all $(sys.workdir)/bin/cf-execd || true exit 0"; } bundle edit_line u_admin_file # @brief Admin file specification to enable unattended installation { insert_lines: sunos_5_8:: "mail= instance=unique partial=nocheck runlevel=nocheck idepend=nocheck rdepend=nocheck space=nocheck setuid=nocheck conflict=nocheck action=nocheck basedir=default"; solaris.!sunos_5_8:: "mail= instance=overwrite partial=nocheck runlevel=nocheck idepend=nocheck rdepend=nocheck space=nocheck setuid=nocheck conflict=nocheck action=nocheck networktimeout=60 networkretries=3 authentication=quit keystore=/var/sadm/security proxy= basedir=default"; } body action u_immediate { ifelapsed => "0"; } body copy_from u_dsync(from,server) { # NOTE policy servers cheat and copy directly from the local file system. # This works even if cf-serverd is down and it makes sense if your serving # yourself. source => "$(from)"; compare => "digest"; trustkey => "false"; purge => "true"; !am_policy_hub:: servers => { "$(server)" }; cfengine_internal_encrypt_transfers:: encrypt => "true"; } body classes u_if_repaired(x) { promise_repaired => { "$(x)" }; } body classes u_if_else(yes,no) { # promise_kept => { "$(yes)" }; promise_repaired => { "$(yes)" }; repair_failed => { "$(no)" }; repair_denied => { "$(no)" }; repair_timeout => { "$(no)" }; } body common control { version => "CFEngine Standalone Self Upgrade 3.12.1"; (debian|ubuntu):: package_inventory => { $(package_module_knowledge.platform_default) }; # We only define pacakge_inventory on redhat like systems that have a # python version that works with the package module. (redhat|centos):: package_inventory => { $(package_module_knowledge.platform_default) }; (debian|redhat):: package_module => $(package_module_knowledge.platform_default); } body depth_search u_recurse_basedir(d) { include_basedir => "true"; depth => "$(d)"; exclude_dirs => { "\.svn", "\.git", "git-core" }; } body edit_defaults u_empty_no_backup # @brief Do not create backups and ensure we are promising the entire content of # the file. { empty_file_before_editing => "true"; edit_backup => "false"; } body file_select plain # @brief Select plain, regular files { file_types => { "plain" }; file_result => "file_types"; } body package_method u_generic(repo) { debian:: package_changes => "individual"; package_list_command => "/usr/bin/dpkg -l"; # package_list_update_command => "/usr/bin/apt-get update"; package_list_update_ifelapsed => "$(u_common_knowledge.list_update_ifelapsed_now)"; package_list_name_regex => "ii\s+([^\s:]+).*"; # package_list_version_regex => "ii\s+[^\s]+\s+([^\s]+).*"; package_list_version_regex => "ii\s+[^\s]+\s+(\d+\.\d+((\.|-)\d+)+).*"; package_installed_regex => ".*"; # all reported are installed package_file_repositories => { "$(repo)" }; package_version_equal_command => "/usr/bin/dpkg --compare-versions '$(v1)' eq '$(v2)'"; package_version_less_command => "/usr/bin/dpkg --compare-versions '$(v1)' lt '$(v2)'"; debian.x86_64:: package_name_convention => "$(name)_$(version)_amd64.deb"; debian.i686:: package_name_convention => "$(name)_$(version)_i386.deb"; debian:: package_add_command => "/usr/bin/dpkg --force-confdef --force-confnew --install"; package_delete_command => "/usr/bin/dpkg --purge"; debian:: package_update_command => "$(sys.workdir)/bin/cf-upgrade -b $(cfe_internal_update_bins.backup_script) -s $(cfe_internal_update_bins.backup_file) -i $(cfe_internal_update_bins.install_script)"; redhat|SuSE|suse|sles:: package_changes => "individual"; package_list_command => "/bin/rpm -qa --queryformat \"i | repos | %{name} | %{version}-%{release} | %{arch}\n\""; package_list_update_ifelapsed => "$(u_common_knowledge.list_update_ifelapsed_now)"; package_list_name_regex => "[^|]+\|[^|]+\|\s+([^\s|]+).*"; package_list_version_regex => "[^|]+\|[^|]+\|[^|]+\|\s+([^\s|]+).*"; package_list_arch_regex => "[^|]+\|[^|]+\|[^|]+\|[^|]+\|\s+([^\s]+).*"; package_installed_regex => "i.*"; package_file_repositories => { "$(repo)" }; package_name_convention => "$(name)-$(version).$(arch).rpm"; package_add_command => "/bin/rpm -ivh "; package_delete_command => "/bin/rpm -e --nodeps"; package_verify_command => "/bin/rpm -V"; package_noverify_regex => ".*[^\s].*"; package_version_less_command => "$(sys.bindir)/rpmvercmp '$(v1)' lt '$(v2)'"; package_version_equal_command => "$(sys.bindir)/rpmvercmp '$(v1)' eq '$(v2)'"; (redhat|SuSE|suse|sles):: package_update_command => "$(sys.workdir)/bin/cf-upgrade -b $(cfe_internal_update_bins.backup_script) -s $(cfe_internal_update_bins.backup_file) -i $(cfe_internal_update_bins.install_script)"; redhat.!redhat_4:: package_list_update_command => "/usr/bin/yum --quiet check-update"; redhat_4:: package_list_update_command => "/usr/bin/yum check-update"; SuSE|suse|sles:: package_list_update_command => "/usr/bin/zypper list-updates"; windows:: package_changes => "individual"; package_list_update_ifelapsed => "$(u_common_knowledge.list_update_ifelapsed_now)"; package_file_repositories => { "$(repo)" }; package_installed_regex => ".*"; package_name_convention => "$(name)-$(version)-$(arch).msi"; package_add_command => "\"$(sys.winsysdir)\msiexec.exe\" /qn /i"; package_update_command => "\"$(sys.winsysdir)\msiexec.exe\" /qn /i"; package_delete_command => "\"$(sys.winsysdir)\msiexec.exe\" /qn /x"; freebsd:: package_changes => "individual"; package_list_command => "/usr/sbin/pkg_info"; package_list_update_command => "/usr/bin/true"; package_list_update_ifelapsed => "$(u_common_knowledge.list_update_ifelapsed_now)"; package_list_name_regex => "^(\S+)-(\d+\.?)+"; package_list_version_regex => "^\S+-((\d+\.?)+\_\d)"; package_file_repositories => { "$(repo)" }; package_installed_regex => ".*"; package_name_convention => "$(name)-$(version).tbz"; package_delete_convention => "$(name)-$(version)"; package_add_command => "/usr/sbin/pkg_add"; package_delete_command => "/usr/sbin/pkg_delete"; netbsd:: package_changes => "individual"; package_list_command => "/usr/sbin/pkg_info"; package_list_update_command => "/usr/bin/true"; package_list_update_ifelapsed => "$(u_common_knowledge.list_update_ifelapsed_now)"; package_list_name_regex => "^(\S+)-(\d+\.?)+"; package_list_version_regex => "^\S+-((\d+\.?)+\nb\d)"; package_file_repositories => { "$(repo)" }; package_installed_regex => ".*"; package_name_convention => "$(name)-$(version).tgz"; package_delete_convention => "$(name)-$(version)"; package_add_command => "/usr/sbin/pkg_add"; package_delete_command => "/usr/sbin/pkg_delete"; solarisx86|solaris:: package_changes => "individual"; package_list_command => "/usr/bin/pkginfo -l"; package_list_update_command => "/usr/bin/true"; package_list_update_ifelapsed => "$(u_common_knowledge.list_update_ifelapsed_now)"; package_multiline_start => "\s*PKGINST:\s+[^\s]+"; package_list_name_regex => "\s*PKGINST:\s+([^\s]+)"; package_list_version_regex => "\s*VERSION:\s+([^\s]+)"; package_list_arch_regex => "\s*ARCH:\s+([^\s]+)"; package_file_repositories => { "$(repo)" }; package_installed_regex => "\s*STATUS:\s*(completely|partially)\s+installed.*"; package_name_convention => "$(name)-$(version)-$(arch).pkg"; package_delete_convention => "$(name)"; # Cfengine appends path to package and package name below, respectively package_add_command => "/bin/sh $(repo)/add_scr $(repo)/admin_file"; package_delete_command => "/usr/sbin/pkgrm -n -a $(repo)/admin_file"; (solarisx86|solaris):: package_update_command => "$(sys.workdir)/bin/cf-upgrade -b $(cfe_internal_update_bins.backup_script) -s $(cfe_internal_update_bins.backup_file) -i $(cfe_internal_update_bins.install_script)"; aix:: package_changes => "individual"; package_list_update_command => "/usr/bin/true"; package_list_update_ifelapsed => "$(u_common_knowledge.list_update_ifelapsed_now)"; package_list_command => "/usr/bin/lslpp -lc"; package_list_name_regex => "[^:]+:([^:]+):[^:]+:.*"; package_list_version_regex => "[^:]+:[^:]+:([^:]+):.*"; package_file_repositories => { "$(repo)" }; package_installed_regex => "[^:]+:[^:]+:[^:]+:[^:]*:(COMMITTED|APPLIED):.*"; package_name_convention => "$(name)-$(version).bff"; package_delete_convention => "$(name)"; # Redirecting the output to '/dev/null' below makes sure 'geninstall' has # its stdout open even if the 'cf-agent' process that started it # terminates (e.g. gets killed). package_add_command => "/usr/bin/rm -f $(repo)/.toc && /usr/sbin/geninstall -IacgXNY -d $(repo) cfengine.cfengine-nova > /dev/null$"; package_update_command => "/usr/bin/rm -f $(repo)/.toc && /usr/sbin/geninstall -IacgXNY -d $(repo) cfengine.cfengine-nova > /dev/null$"; package_delete_command => "/usr/sbin/installp -ug cfengine.cfengine-nova$"; # Internal version comparison model doesn't work for W.X.Y.Z package_version_less_command => "$(sys.bindir)/rpmvercmp '$(v1)' lt '$(v2)'"; package_version_equal_command => "$(sys.bindir)/rpmvercmp '$(v1)' eq '$(v2)'"; } body package_module yum { query_installed_ifelapsed => "10"; query_updates_ifelapsed => "30"; } body package_module apt_get { query_installed_ifelapsed => "10"; query_updates_ifelapsed => "30"; } body perms u_m(p) { mode => "$(p)"; } body copy_from local_dcp(from) # @brief Copy a local file if the hash on the source file differs. # @param from The path to the source file. # # **Example:** # # ```cf3 # bundle agent example # { # files: # "/tmp/file.bak" # copy_from => local_dcp("/tmp/file"); # } # ``` # # **See Also:** `local_cp()`, `remote_dcp()` { source => "$(from)"; compare => "digest"; } cfengine-masterfiles-3.12.1/templates/0000755000000000000000000000000013377750574017706 5ustar00rootroot00000000000000cfengine-masterfiles-3.12.1/templates/cf-serverd.service.mustache0000644000000000000000000000053613377750475025144 0ustar00rootroot00000000000000[Unit] Description=CFEngine Enterprise file server After=syslog.target After=network.target ConditionPathExists={{{vars.sys.bindir}}}/cf-serverd PartOf=cfengine3.service [Service] Type=simple ExecStart={{{vars.sys.bindir}}}/cf-serverd --no-fork --verbose Restart=always RestartSec=10 [Install] WantedBy=multi-user.target WantedBy=cfengine3.service cfengine-masterfiles-3.12.1/templates/cf-execd.service.mustache0000644000000000000000000000052313377750475024556 0ustar00rootroot00000000000000[Unit] Description=CFEngine Execution Scheduler After=syslog.target ConditionPathExists={{{vars.sys.bindir}}}/cf-execd PartOf=cfengine3.service [Service] Type=simple ExecStart={{{vars.sys.bindir}}}/cf-execd --no-fork --verbose Restart=always RestartSec=10 KillMode=process [Install] WantedBy=multi-user.target WantedBy=cfengine3.service cfengine-masterfiles-3.12.1/templates/json_serial.mustache0000644000000000000000000000001313377750475023743 0ustar00rootroot00000000000000{{$-top-}} cfengine-masterfiles-3.12.1/templates/cf-hub.service.mustache0000644000000000000000000000053013377750475024242 0ustar00rootroot00000000000000[Unit] Description=CFEngine Enterprise Hub Report Collector PartOf=cfengine3.service ConditionPathExists={{{vars.sys.bindir}}}/cf-hub After=syslog.target After=network.target [Service] Type=simple ExecStart={{{vars.sys.bindir}}}/cf-hub -F --verbose Restart=always RestartSec=10 [Install] WantedBy=multi-user.target WantedBy=cfengine3.service cfengine-masterfiles-3.12.1/templates/cf-apache.service.mustache0000644000000000000000000000072513377750475024713 0ustar00rootroot00000000000000[Unit] Description=CFEngine Enterprise Webserver After=syslog.target After=cf-postgres.service ConditionPathExists={{{vars.sys.workdir}}}/httpd/bin/apachectl PartOf=cfengine3.service [Service] Type=forking ExecStart={{{vars.sys.workdir}}}/httpd/bin/apachectl start ExecStop={{{vars.sys.workdir}}}/httpd/bin/apachectl stop PIDFile={{{vars.sys.workdir}}}/httpd/logs/httpd.pid Restart=always RestartSec=10 [Install] WantedBy=multi-user.target WantedBy=cfengine3.service cfengine-masterfiles-3.12.1/templates/cfengine3.service.mustache0000644000000000000000000000034713377750475024745 0ustar00rootroot00000000000000[Unit] Description=CFEngine 3 umbrella service Documentation=https://docs.cfengine.com/ After=syslog.target [Install] WantedBy=multi-user.target [Service] Type=oneshot ExecStart=/bin/true ExecReload=/bin/true RemainAfterExit=yes cfengine-masterfiles-3.12.1/templates/cf-monitord.service.mustache0000644000000000000000000000050413377750475025320 0ustar00rootroot00000000000000[Unit] Description=CFEngine Monitor Daemon After=syslog.target ConditionPathExists={{{vars.sys.bindir}}}/cf-monitord PartOf=cfengine3.service [Service] Type=simple ExecStart={{{ vars.sys.bindir}}}/cf-monitord --no-fork --verbose Restart=always RestartSec=10 [Install] WantedBy=multi-user.target WantedBy=cfengine3.service cfengine-masterfiles-3.12.1/templates/json_multiline.mustache0000644000000000000000000000001313377750475024466 0ustar00rootroot00000000000000{{%-top-}} cfengine-masterfiles-3.12.1/templates/cf-runalerts.service.mustache0000644000000000000000000000132313377750475025504 0ustar00rootroot00000000000000[Unit] Description=CFEngine Enterprise SQL Alerts After=syslog.target ConditionPathExists={{{vars.sys.bindir}}}/runalerts.php ConditionFileIsExecutable={{{vars.sys.workdir}}}/httpd/php/bin/php PartOf=cfengine3.service After=cf-postgres.service Requires=cf-postgres.service [Service] # We simply launch this script every 60 seconds to perform alert related checks Type=simple # The cfapache user doesn't have the rights to write to {{{vars.sys.workdir}}}/httpd/php/runalerts_* User={{{vars.def.cf_apache_user}}} ExecStart={{{vars.sys.workdir}}}/httpd/php/bin/php {{{vars.sys.bindir}}}/runalerts.php Restart=always RestartSec=10 [Install] WantedBy=multi-user.target WantedBy=cfengine3.service WantedBy=cf-postgres.service cfengine-masterfiles-3.12.1/templates/host_info_report.mustache0000644000000000000000000000366613377750475025037 0ustar00rootroot00000000000000# Host Information Generated: {{vars.sys.date}} ## Identity Fully Qualified Hostname: {{vars.sys.fqhost}} Host ID: {{vars.sys.key_digest}} ## CFEngine Version: CFEngine {{#classes.enterprise}}Enterprise{{/classes.enterprise}} {{vars.sys.cf_version}} Last Agent Run: {{vars.host_info_report_cfengine.last_agent_run}} Policy Release ID: {{vars.host_info_report_cfengine.cf_promises_release_id.releaseId}} Policy Last Updated: {{vars.host_info_report_cfengine.cf_promises_validated_timestamp_formatted}} Bootstrapped to: {{vars.sys.policy_hub}} ## OS Architecture: {{vars.sys.arch}} Os: {{vars.sys.os}} Release: {{vars.sys.release}} Flavor: {{vars.sys.flavor}} Version: {{vars.sys.version}} Uptime: {{vars.sys.uptime}} minutes ## Hardware No. CPUs: {{vars.sys.cpus}} Total Memory: {{{vars.mon.value_mem_total}}} MB Total Swap: {{{vars.mon.value_mem_swap}}} MB Free Memory: {{{vars.mon.value_mem_free}}} MB Free Swap: {{{vars.mon.value_mem_freeswap}}} MB ## Network ### Interfaces {{#vars.host_info_report_cfengine.interface_info}} * {{.}} {{/vars.host_info_report_cfengine.interface_info}} {{! Redmine:4506 https://cfengine.com/dev/issues/4506 }} ### IPv4 TCP Ports listening {{#vars.mon.listening_tcp4_ports}} * {{.}} {{/vars.mon.listening_tcp4_ports}} {{#classes.show_software}} {{! Redmine:4507 https://cfengine.com/dev/issues/4507 }} ## Software {{#vars.host_info_report_software.packages}} [{{method}}] {{name}}: version {{version}}, arch {{arch}} {{/vars.host_info_report_software.packages}} {{/classes.show_software}} ## Policy Information about the policy set on this host. ### Inventory #### Variables tagged for inventory {{%vars.host_info_report_inventory.inventory_vars}} {{#classes.enterprise_edition}} ### Enterprise maintanance bundles available {{#vars.cfe_internal_enterprise_maintenance.enterprise_maintenance_bundles}} {{{.}}} {{/vars.cfe_internal_enterprise_maintenance.enterprise_maintenance_bundles}} {{/classes.enterprise_edition}} cfengine-masterfiles-3.12.1/templates/cf-postgres.service.mustache0000644000000000000000000000130713377750475025335 0ustar00rootroot00000000000000[Unit] Description=CFEngine Enterprise PostgreSQL Database After=syslog.target ConditionPathExists={{{vars.sys.bindir}}}/pg_ctl PartOf=cfengine3.service [Service] Type=forking WorkingDirectory=/tmp User=cfpostgres ExecStart={{{vars.sys.bindir}}}/pg_ctl -w -D {{{vars.sys.statedir}}}/pg/data -l /var/log/postgresql.log start ExecStop={{{vars.sys.bindir}}}/pg_ctl -w -D {{{vars.sys.statedir}}}/pg/data -l /var/log/postgresql.log stop -m fast ExecReload={{{vars.sys.bindir}}}/pg_ctl -w -D {{{vars.sys.statedir}}}/pg/data -l /var/log/postgresql.log reload -m fast PIDFile={{{vars.sys.statedir}}}/pg/data/postmaster.pid Restart=always RestartSec=10 [Install] WantedBy=multi-user.target WantedBy=cfengine3.service cfengine-masterfiles-3.12.1/templates/cfengine_watchdog.mustache0000644000000000000000000000041213377750475025074 0ustar00rootroot00000000000000# This file is managed by CFEngine # If cf-execd is executable and if no process matching cf-execd can be found then restart cf-execd * * * * * root [ -x {{{vars.sys.cf_execd}}} ] && if ! {{{vars.paths.pgrep}}} cf-execd > /dev/null; then {{{vars.sys.cf_execd}}}; fi cfengine-masterfiles-3.12.1/config.sub0000755000000000000000000010577513377750537017711 0ustar00rootroot00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2014 Free Software Foundation, Inc. timestamp='2014-09-11' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches with a ChangeLog entry to config-patches@gnu.org. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright 1992-2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | be32 | be64 \ | bfin \ | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | k1om \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa32r6 | mipsisa32r6el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64r6 | mipsisa64r6el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ | open8 | or1k | or1knd | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ | riscv32 | riscv64 \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | k1om-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa32r6-* | mipsisa32r6el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64r6-* | mipsisa64r6el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | or1k*-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze*) basic_machine=microblaze-xilinx ;; mingw64) basic_machine=x86_64-pc os=-mingw64 ;; mingw32) basic_machine=i686-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; moxiebox) basic_machine=moxie-unknown os=-moxiebox ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i686-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos | rdos64) basic_machine=x86_64-pc os=-rdos ;; rdos32) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; c8051-*) os=-elf ;; hexagon-*) os=-elf ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: cfengine-masterfiles-3.12.1/missing0000755000000000000000000001533013377750537017310 0ustar00rootroot00000000000000#! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2013-10-28.13; # UTC # Copyright (C) 1996-2013 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try '$0 --help' for more information" exit 1 fi case $1 in --is-lightweight) # Used by our autoconf macros to check whether the available missing # script is modern enough. exit 0 ;; --run) # Back-compat with the calling convention used by older automake. shift ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due to PROGRAM being missing or too old. Options: -h, --help display this help and exit -v, --version output version information and exit Supported PROGRAM values: aclocal autoconf autoheader autom4te automake makeinfo bison yacc flex lex help2man Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 'g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: unknown '$1' option" echo 1>&2 "Try '$0 --help' for more information" exit 1 ;; esac # Run the given program, remember its exit status. "$@"; st=$? # If it succeeded, we are done. test $st -eq 0 && exit 0 # Also exit now if we it failed (or wasn't found), and '--version' was # passed; such an option is passed most likely to detect whether the # program is present and works. case $2 in --version|--help) exit $st;; esac # Exit code 63 means version mismatch. This often happens when the user # tries to use an ancient version of a tool on a file that requires a # minimum version. if test $st -eq 63; then msg="probably too old" elif test $st -eq 127; then # Program was missing. msg="missing on your system" else # Program was found and executed, but failed. Give up. exit $st fi perl_URL=http://www.perl.org/ flex_URL=http://flex.sourceforge.net/ gnu_software_URL=http://www.gnu.org/software program_details () { case $1 in aclocal|automake) echo "The '$1' program is part of the GNU Automake package:" echo "<$gnu_software_URL/automake>" echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/autoconf>" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; autoconf|autom4te|autoheader) echo "The '$1' program is part of the GNU Autoconf package:" echo "<$gnu_software_URL/autoconf/>" echo "It also requires GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; esac } give_advice () { # Normalize program name to check for. normalized_program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` printf '%s\n' "'$1' is $msg." configure_deps="'configure.ac' or m4 files included by 'configure.ac'" case $normalized_program in autoconf*) echo "You should only need it if you modified 'configure.ac'," echo "or m4 files included by it." program_details 'autoconf' ;; autoheader*) echo "You should only need it if you modified 'acconfig.h' or" echo "$configure_deps." program_details 'autoheader' ;; automake*) echo "You should only need it if you modified 'Makefile.am' or" echo "$configure_deps." program_details 'automake' ;; aclocal*) echo "You should only need it if you modified 'acinclude.m4' or" echo "$configure_deps." program_details 'aclocal' ;; autom4te*) echo "You might have modified some maintainer files that require" echo "the 'autom4te' program to be rebuilt." program_details 'autom4te' ;; bison*|yacc*) echo "You should only need it if you modified a '.y' file." echo "You may want to install the GNU Bison package:" echo "<$gnu_software_URL/bison/>" ;; lex*|flex*) echo "You should only need it if you modified a '.l' file." echo "You may want to install the Fast Lexical Analyzer package:" echo "<$flex_URL>" ;; help2man*) echo "You should only need it if you modified a dependency" \ "of a man page." echo "You may want to install the GNU Help2man package:" echo "<$gnu_software_URL/help2man/>" ;; makeinfo*) echo "You should only need it if you modified a '.texi' file, or" echo "any other file indirectly affecting the aspect of the manual." echo "You might want to install the Texinfo package:" echo "<$gnu_software_URL/texinfo/>" echo "The spurious makeinfo call might also be the consequence of" echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" echo "want to install GNU make:" echo "<$gnu_software_URL/make/>" ;; *) echo "You might have modified some files without having the proper" echo "tools for further handling them. Check the 'README' file, it" echo "often tells you about the needed prerequisites for installing" echo "this package. You may also peek at any GNU archive site, in" echo "case some other package contains this missing '$1' program." ;; esac } give_advice "$1" | sed -e '1s/^/WARNING: /' \ -e '2,$s/^/ /' >&2 # Propagate the correct exit status (expected to be 127 for a program # not found, 63 for a program that failed due to version mismatch). exit $st # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: cfengine-masterfiles-3.12.1/install-sh0000755000000000000000000003413713377750537017723 0ustar00rootroot00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2011-11-20.07; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # 'make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. nl=' ' IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit=${DOITPROG-} if test -z "$doit"; then doit_exec=exec else doit_exec=$doit fi # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_glob='?' initialize_posix_glob=' test "$posix_glob" != "?" || { if (set -f) 2>/dev/null; then posix_glob= else posix_glob=: fi } ' posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false no_target_directory= usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) dst_arg=$2 # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) no_target_directory=true;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call 'install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for 'test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. dstdir=` (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ X"$dst" : 'X\(//\)$' \| \ X"$dst" : 'X\(/\)' \| . 2>/dev/null || echo X"$dst" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q' ` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) # $RANDOM is not portable (e.g. dash); use it when possible to # lower collision chance tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0 # As "mkdir -p" follows symlinks and we work in /tmp possibly; so # create the $tmpdir first (and fail if unsuccessful) to make sure # that nobody tries to guess the $tmpdir name. if (umask $mkdir_umask && $mkdirprog $mkdir_mode "$tmpdir" && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. test_tmpdir="$tmpdir/a" ls_ld_tmpdir=`ls -ld "$test_tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac eval "$initialize_posix_glob" oIFS=$IFS IFS=/ $posix_glob set -f set fnord $dstdir shift $posix_glob set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && eval "$initialize_posix_glob" && $posix_glob set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && $posix_glob set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: cfengine-masterfiles-3.12.1/config.guess0000755000000000000000000012355013377750537020235 0ustar00rootroot00000000000000#! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2014 Free Software Foundation, Inc. timestamp='2014-03-23' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD # # Please send patches with a ChangeLog entry to config-patches@gnu.org. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright 1992-2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown case "${UNAME_SYSTEM}" in Linux|GNU|GNU/*) # If the system lacks a compiler, then just pick glibc. # We could probably try harder. LIBC=gnu eval $set_cc_for_build cat <<-EOF > $dummy.c #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #else LIBC=gnu #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` ;; esac # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW64*:*) echo ${UNAME_MACHINE}-pc-mingw64 exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; *:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="gnulibc1" ; fi echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arc:Linux:*:* | arceb:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-${LIBC} else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi else echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf fi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; cris:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; hexagon:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:Linux:*:*) echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; openrisc*:Linux:*:*) echo or1k-unknown-linux-${LIBC} exit ;; or32:Linux:*:* | or1k*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; padre:Linux:*:*) echo sparc-unknown-linux-${LIBC} exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; *) echo hppa-unknown-linux-${LIBC} ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-${LIBC} exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-${LIBC} exit ;; ppc64le:Linux:*:*) echo powerpc64le-unknown-linux-${LIBC} exit ;; ppcle:Linux:*:*) echo powerpcle-unknown-linux-${LIBC} exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; x86_64:Haiku:*:*) echo x86_64-unknown-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown eval $set_cc_for_build if test "$UNAME_PROCESSOR" = unknown ; then UNAME_PROCESSOR=powerpc fi if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi fi elif test "$UNAME_PROCESSOR" = i386 ; then # Avoid executing cc on OS X 10.9, as it ships with a stub # that puts up a graphical alert prompting to install # developer tools. Any system running Mac OS X 10.7 or # later (Darwin 11 and later) is required to have a 64-bit # processor. This is not true of the ARM version of Darwin # that Apple uses in portable devices. UNAME_PROCESSOR=x86_64 fi echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx exit ;; esac cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: cfengine-masterfiles-3.12.1/lib/0000755000000000000000000000000013377750574016456 5ustar00rootroot00000000000000cfengine-masterfiles-3.12.1/lib/users.cf0000644000000000000000000000472713377750475020143 0ustar00rootroot00000000000000############################################################################ # Copyright 2017 Northern.tech AS # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License LGPL as published by the # Free Software Foundation; version 3. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # To the extent this program is licensed as part of the Enterprise # versions of CFEngine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. ########################################################################### # # CFEngine Community Open Promise-Body Library # # This initiative started by CFEngine promotes a # standardized set of names and promise specifications # for template functionality within CFEngine 3. # # The aim is to promote an industry standard for # naming of configuration patterns, leading to a # de facto middleware of standardized syntax. # # Names should be intuitive and parameters should be # minimal to assist readability and comprehensibility. # Contributions to this file are voluntarily given to # the cfengine community, and are moderated by CFEngine. # No liability or warranty for misuse is implied. # # If you add to this file, please try to make the # contributions "self-documenting". Comments made # after the bundle/body statement are retained in # the online docs # # For CFEngine Core: 3.7.0 to 3.7.x # Users bodies ################################################### # If you find CFEngine useful, please consider # # purchasing a commercial version of the software.# ################################################### body password plaintext_password(text) # @brief Sets the plaintext password for the user to `text` # @param text the plain text version of the password # # **Note:** Don't use that unless you really have no choice # # **See also:** `hashed_password()` { format => "plaintext"; data => $(text); } body password hashed_password(hash) # @brief Sets the hashed password for the user to `hash` # @param hash the hashed representation of the password # # The hashing method is up to the platform. # # **See also:** `plaintext_password()` { format => "hash"; data => $(hash); } cfengine-masterfiles-3.12.1/lib/paths.cf0000644000000000000000000006034213377750475020114 0ustar00rootroot00000000000000############################################################################ # Copyright 2017 Northern.tech AS # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License LGPL as published by the # Free Software Foundation; version 3. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # To the extent this program is licensed as part of the Enterprise # versions of CFEngine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. ########################################################################### # # CFEngine Community Open Promise-Body Library # # This initiative started by CFEngine promotes a # standardized set of names and promise specifications # for template functionality within CFEngine 3. # # The aim is to promote an industry standard for # naming of configuration patterns, leading to a # de facto middleware of standardized syntax. # # Names should be intuitive and parameters should be # minimal to assist readability and comprehensibility. # Contributions to this file are voluntarily given to # the cfengine community, and are moderated by CFEngine. # No liability or warranty for misuse is implied. # # If you add to this file, please try to make the # contributions "self-documenting". Comments made # after the bundle/body statement are retained in # the online docs # # For CFEngine Core: 3.7.0 to 3.7.x # Paths bundle (used by other bodies) ################################################### # If you find CFEngine useful, please consider # # purchasing a commercial version of the software.# ################################################### bundle common paths # @brief Defines an array `path` with common paths to standard binaries, # and classes for defined and existing paths. # # If the current platform knows that binary XYZ should be present, # `_stdlib_has_path_XYZ` is defined. Furthermore, if XYZ is actually present # (i.e. the binary exists) in the expected location, `_stdlib_path_exists_XYZ` is # defined. # # **Example:** # # ```cf3 # bundle agent repair_newlines(filename) # { # commands: # _stdlib_path_exists_sed:: # "$(path[sed])" # args => "-i 's/^M//' $(filename)" # } # ``` { vars: # # Common full pathname of commands for OS # enterprise.(am_policy_hub|policy_server):: "path[git]" string => "$(sys.workdir)/bin/git", comment => "CFEngine Enterprise Hub ships with its own git which is used internally"; !(enterprise.(am_policy_hub|policy_server)):: "path[git]" string => "/usr/bin/git"; !(freebsd|darwin|smartos):: "path[npm]" string => "/usr/bin/npm"; "path[pip]" string => "/usr/bin/pip"; "path[virtualenv]" string => "/usr/bin/virtualenv"; !(freebsd|darwin):: "path[getfacl]" string => "/usr/bin/getfacl"; freebsd|darwin:: "path[npm]" string => "/usr/local/bin/npm"; "path[pip]" string => "/usr/local/bin/pip"; "path[virtualenv]" string => "/usr/local/bin/virtualenv"; "path[automount]" string => "/usr/sbin/automount"; _have_bin_env:: "path[env]" string => "/bin/env"; !_have_bin_env:: "path[env]" string => "/usr/bin/env"; _have_bin_systemctl:: "path[systemctl]" string => "/bin/systemctl"; !_have_bin_systemctl:: "path[systemctl]" string => "/usr/bin/systemctl"; linux:: "path[lsattr]" string => "/usr/bin/lsattr"; "path[tar]" string => "/bin/tar"; "path[pgrep]" string => "/usr/bin/pgrep"; "path[getent]" string => "/usr/bin/getent"; "path[mailx]" string => "/usr/bin/mailx"; aix:: "path[awk]" string => "/usr/bin/awk"; "path[bc]" string => "/usr/bin/bc"; "path[cat]" string => "/bin/cat"; "path[cksum]" string => "/usr/bin/cksum"; "path[crontabs]" string => "/var/spool/cron/crontabs"; "path[cut]" string => "/usr/bin/cut"; "path[dc]" string => "/usr/bin/dc"; "path[df]" string => "/usr/bin/df"; "path[diff]" string => "/usr/bin/diff"; "path[dig]" string => "/usr/bin/dig"; "path[echo]" string => "/usr/bin/echo"; "path[egrep]" string => "/usr/bin/egrep"; "path[find]" string => "/usr/bin/find"; "path[grep]" string => "/usr/bin/grep"; "path[ls]" string => "/usr/bin/ls"; "path[netstat]" string => "/usr/bin/netstat"; "path[oslevel]" string => "/usr/bin/oslevel"; "path[ping]" string => "/usr/bin/ping"; "path[perl]" string => "/usr/bin/perl"; "path[printf]" string => "/usr/bin/printf"; "path[sed]" string => "/usr/bin/sed"; "path[sort]" string => "/usr/bin/sort"; "path[tr]" string => "/usr/bin/tr"; archlinux:: "path[awk]" string => "/usr/bin/awk"; "path[bc]" string => "/usr/bin/bc"; "path[cat]" string => "/usr/bin/cat"; "path[cksum]" string => "/usr/bin/cksum"; "path[crontab]" string => "/usr/bin/crontab"; "path[cut]" string => "/usr/bin/cut"; "path[dc]" string => "/usr/bin/dc"; "path[df]" string => "/usr/bin/df"; "path[diff]" string => "/usr/bin/diff"; "path[dig]" string => "/usr/bin/dig"; "path[dmidecode]" string => "/usr/bin/dmidecode"; "path[echo]" string => "/usr/bin/echo"; "path[egrep]" string => "/usr/bin/egrep"; "path[ethtool]" string => "/usr/bin/ethtool"; "path[find]" string => "/usr/bin/find"; "path[free]" string => "/usr/bin/free"; "path[grep]" string => "/usr/bin/grep"; "path[hostname]" string => "/usr/bin/hostname"; "path[init]" string => "/usr/bin/init"; "path[iptables]" string => "/usr/bin/iptables"; "path[iptables_save]" string => "/usr/bin/iptables-save"; "path[iptables_restore]" string => "/usr/bin/iptables-restore"; "path[ls]" string => "/usr/bin/ls"; "path[lsof]" string => "/usr/bin/lsof"; "path[netstat]" string => "/usr/bin/netstat"; "path[ping]" string => "/usr/bin/ping"; "path[perl]" string => "/usr/bin/perl"; "path[printf]" string => "/usr/bin/printf"; "path[sed]" string => "/usr/bin/sed"; "path[sort]" string => "/usr/bin/sort"; "path[test]" string => "/usr/bin/test"; "path[top]" string => "/usr/bin/top"; "path[tr]" string => "/usr/bin/tr"; # "path[pacman]" string => "/usr/bin/pacman"; "path[yaourt]" string => "/usr/bin/yaourt"; "path[useradd]" string => "/usr/bin/useradd"; "path[groupadd]" string => "/usr/bin/groupadd"; "path[ip]" string => "/usr/bin/ip"; "path[ifconfig]" string => "/usr/bin/ifconfig"; "path[journalctl]" string => "/usr/bin/journalctl"; "path[netctl]" string => "/usr/bin/netctl"; coreos:: "path[awk]" string => "/usr/bin/awk"; "path[cat]" string => "/usr/bin/cat"; "path[cksum]" string => "/usr/bin/cksum"; "path[curl]" string => "/usr/bin/curl"; "path[cut]" string => "/usr/bin/cut"; "path[diff]" string => "/usr/bin/diff"; "path[dig]" string => "/usr/bin/dig"; "path[echo]" string => "/usr/bin/echo"; "path[ip]" string => "/usr/bin/ip"; "path[lsof]" string => "/usr/bin/lsof"; "path[netstat]" string => "/usr/bin/netstat"; "path[ping]" string => "/usr/bin/ping"; "path[printf]" string => "/usr/bin/printf"; "path[sed]" string => "/usr/bin/sed"; "path[sort]" string => "/usr/bin/sort"; "path[test]" string => "/usr/bin/test"; "path[wget]" string => "/usr/bin/wget"; freebsd|netbsd|openbsd:: "path[awk]" string => "/usr/bin/awk"; "path[bc]" string => "/usr/bin/bc"; "path[cat]" string => "/bin/cat"; "path[crontabs]" string => "/var/cron/tabs"; "path[cut]" string => "/usr/bin/cut"; "path[dc]" string => "/usr/bin/dc"; "path[df]" string => "/bin/df"; "path[diff]" string => "/usr/bin/diff"; "path[dig]" string => "/usr/bin/dig"; "path[echo]" string => "/bin/echo"; "path[egrep]" string => "/usr/bin/egrep"; "path[find]" string => "/usr/bin/find"; "path[grep]" string => "/usr/bin/grep"; "path[ls]" string => "/bin/ls"; "path[netstat]" string => "/usr/bin/netstat"; "path[perl]" string => "/usr/bin/perl"; "path[printf]" string => "/usr/bin/printf"; "path[sed]" string => "/usr/bin/sed"; "path[sort]" string => "/usr/bin/sort"; "path[tr]" string => "/usr/bin/tr"; freebsd.!(freebsd_9_3|freebsd_10|freebsd_11)|netbsd|openbsd:: "path[ping]" string => "/usr/bin/ping"; freebsd_9_3|freebsd_10|freebsd_11:: "path[ping]" string => "/sbin/ping"; freebsd|netbsd:: "path[cksum]" string => "/usr/bin/cksum"; "path[realpath]" string => "/bin/realpath"; freebsd:: "path[bhyvectl]" string => "/usr/sbin/bhyvectl"; "path[getfacl]" string => "/bin/getfacl"; "path[dtrace]" string => "/usr/sbin/dtrace"; "path[service]" string => "/usr/sbin/service"; "path[zpool]" string => "/sbin/zpool"; "path[zfs]" string => "/sbin/zfs"; openbsd:: "path[cksum]" string => "/bin/cksum"; smartos:: "path[npm]" string => "/opt/local/bin/npm"; "path[pip]" string => "/opt/local/bin/pip"; solaris:: "path[bc]" string => "/usr/bin/bc"; "path[cat]" string => "/usr/bin/cat"; "path[cksum]" string => "/usr/bin/cksum"; "path[crontab]" string => "/usr/bin/crontab"; "path[crontabs]" string => "/var/spool/cron/crontabs"; "path[curl]" string => "/usr/bin/curl"; "path[cut]" string => "/usr/bin/cut"; "path[dc]" string => "/usr/bin/dc"; "path[diff]" string => "/usr/bin/diff"; "path[dig]" string => "/usr/sbin/dig"; "path[echo]" string => "/usr/bin/echo"; "path[netstat]" string => "/usr/bin/netstat"; "path[ping]" string => "/usr/bin/ping"; "path[perl]" string => "/usr/bin/perl"; "path[printf]" string => "/usr/bin/printf"; "path[wget]" string => "/usr/bin/wget"; # "path[svcs]" string => "/usr/bin/svcs"; "path[svcadm]" string => "/usr/sbin/svcadm"; "path[svccfg]" string => "/usr/sbin/svccfg"; "path[svcprop]" string => "/usr/bin/svcprop"; "path[netadm]" string => "/usr/sbin/netadm"; "path[dladm]" string => "/usr/sbin/dladm"; "path[ipadm]" string => "/usr/sbin/ipadm"; "path[pkg]" string => "/usr/bin/pkg"; "path[pkginfo]" string => "/usr/bin/pkginfo"; "path[pkgadd]" string => "/usr/sbin/pkgadd"; "path[pkgrm]" string => "/usr/sbin/pkgrm"; "path[zoneadm]" string => "/usr/sbin/zoneadm"; "path[zonecfg]" string => "/usr/sbin/zonecfg"; solaris.(mpf_stdlib_use_posix_utils.!disable_mpf_stdlib_use_posix_utils):: "path[awk]" string => "/usr/xpg4/bin/awk"; "path[df]" string => "/usr/xpg4/bin/df"; "path[egrep]" string => "/usr/xpg4/bin/egrep"; "path[find]" string => "/usr/xpg4/bin/find"; "path[grep]" string => "/usr/xpg4/bin/grep"; "path[ls]" string => "/usr/xpg4/bin/ls"; "path[sed]" string => "/usr/xpg4/bin/sed"; "path[sort]" string => "/usr/xpg4/bin/sort"; "path[tr]" string => "/usr/xpg4/bin/tr"; solaris.!(mpf_stdlib_use_posix_utils.!disable_mpf_stdlib_use_posix_utils):: "path[awk]" string => "/usr/bin/awk"; "path[df]" string => "/usr/bin/df"; "path[egrep]" string => "/usr/bin/egrep"; "path[find]" string => "/usr/bin/find"; "path[grep]" string => "/usr/bin/grep"; "path[ls]" string => "/usr/bin/ls"; "path[sed]" string => "/usr/bin/sed"; "path[sort]" string => "/usr/bin/sort"; "path[tr]" string => "/usr/bin/tr"; redhat:: "path[awk]" string => "/bin/awk"; "path[bc]" string => "/usr/bin/bc"; "path[cat]" string => "/bin/cat"; "path[cksum]" string => "/usr/bin/cksum"; "path[createrepo]" string => "/usr/bin/createrepo"; "path[crontab]" string => "/usr/bin/crontab"; "path[crontabs]" string => "/var/spool/cron"; "path[curl]" string => "/usr/bin/curl"; "path[cut]" string => "/bin/cut"; "path[dc]" string => "/usr/bin/dc"; "path[df]" string => "/bin/df"; "path[diff]" string => "/usr/bin/diff"; "path[dig]" string => "/usr/bin/dig"; "path[domainname]" string => "/bin/domainname"; "path[echo]" string => "/bin/echo"; "path[egrep]" string => "/bin/egrep"; "path[ethtool]" string => "/usr/sbin/ethtool"; "path[find]" string => "/usr/bin/find"; "path[free]" string => "/usr/bin/free"; "path[grep]" string => "/bin/grep"; "path[hostname]" string => "/bin/hostname"; "path[init]" string => "/sbin/init"; "path[iptables]" string => "/sbin/iptables"; "path[iptables_save]" string => "/sbin/iptables-save"; "path[ls]" string => "/bin/ls"; "path[lsof]" string => "/usr/sbin/lsof"; "path[netstat]" string => "/bin/netstat"; "path[nologin]" string => "/sbin/nologin"; "path[ping]" string => "/usr/bin/ping"; "path[perl]" string => "/usr/bin/perl"; "path[printf]" string => "/usr/bin/printf"; "path[sed]" string => "/bin/sed"; "path[sort]" string => "/bin/sort"; "path[test]" string => "/usr/bin/test"; "path[tr]" string => "/usr/bin/tr"; "path[wc]" string => "/usr/bin/wc"; "path[wget]" string => "/usr/bin/wget"; "path[realpath]" string => "/usr/bin/realpath"; # "path[chkconfig]" string => "/sbin/chkconfig"; "path[groupadd]" string => "/usr/sbin/groupadd"; "path[groupdel]" string => "/usr/sbin/groupdel"; "path[ifconfig]" string => "/sbin/ifconfig"; "path[ip]" string => "/sbin/ip"; "path[rpm]" string => "/bin/rpm"; "path[service]" string => "/sbin/service"; "path[svc]" string => "/sbin/service"; "path[useradd]" string => "/usr/sbin/useradd"; "path[userdel]" string => "/usr/sbin/userdel"; "path[yum]" string => "/usr/bin/yum"; darwin:: "path[awk]" string => "/usr/bin/awk"; "path[bc]" string => "/usr/bin/bc"; "path[cat]" string => "/bin/cat"; "path[cksum]" string => "/usr/bin/cksum"; "path[createrepo]" string => "/usr/bin/createrepo"; "path[crontab]" string => "/usr/bin/crontab"; "path[crontabs]" string => "/usr/lib/cron/tabs"; "path[cut]" string => "/usr/bin/cut"; "path[dc]" string => "/usr/bin/dc"; "path[df]" string => "/bin/df"; "path[diff]" string => "/usr/bin/diff"; "path[dig]" string => "/usr/bin/dig"; "path[domainname]" string => "/bin/domainname"; "path[dscl]" string => "/usr/bin/dscl"; "path[echo]" string => "/bin/echo"; "path[egrep]" string => "/usr/bin/egrep"; "path[find]" string => "/usr/bin/find"; "path[grep]" string => "/usr/bin/grep"; "path[hostname]" string => "/bin/hostname"; "path[ls]" string => "/bin/ls"; "path[lsof]" string => "/usr/sbin/lsof"; "path[netstat]" string => "/usr/sbin/netstat"; "path[ping]" string => "/sbin/ping"; "path[perl]" string => "/usr/bin/perl"; "path[printf]" string => "/usr/bin/printf"; "path[sed]" string => "/usr/bin/sed"; "path[sort]" string => "/usr/bin/sort"; "path[test]" string => "/bin/test"; "path[tr]" string => "/usr/bin/tr"; # "path[brew]" string => "/usr/local/bin/brew"; "path[sudo]" string => "/usr/bin/sudo"; debian:: "path[awk]" string => "/usr/bin/awk"; "path[bc]" string => "/usr/bin/bc"; "path[cat]" string => "/bin/cat"; "path[chkconfig]" string => "/sbin/chkconfig"; "path[cksum]" string => "/usr/bin/cksum"; "path[createrepo]" string => "/usr/bin/createrepo"; "path[crontab]" string => "/usr/bin/crontab"; "path[crontabs]" string => "/var/spool/cron/crontabs"; "path[curl]" string => "/usr/bin/curl"; "path[cut]" string => "/usr/bin/cut"; "path[dc]" string => "/usr/bin/dc"; "path[df]" string => "/bin/df"; "path[diff]" string => "/usr/bin/diff"; "path[dig]" string => "/usr/bin/dig"; "path[dmidecode]" string => "/usr/sbin/dmidecode"; "path[domainname]" string => "/bin/domainname"; "path[echo]" string => "/bin/echo"; "path[egrep]" string => "/bin/egrep"; "path[ethtool]" string => "/sbin/ethtool"; "path[find]" string => "/usr/bin/find"; "path[free]" string => "/usr/bin/free"; "path[grep]" string => "/bin/grep"; "path[hostname]" string => "/bin/hostname"; "path[init]" string => "/sbin/init"; "path[iptables]" string => "/sbin/iptables"; "path[iptables_save]" string => "/sbin/iptables-save"; "path[ls]" string => "/bin/ls"; "path[lsof]" string => "/usr/bin/lsof"; "path[netstat]" string => "/bin/netstat"; "path[nologin]" string => "/usr/sbin/nologin"; "path[ping]" string => "/bin/ping"; "path[perl]" string => "/usr/bin/perl"; "path[printf]" string => "/usr/bin/printf"; "path[sed]" string => "/bin/sed"; "path[sort]" string => "/usr/bin/sort"; "path[test]" string => "/usr/bin/test"; "path[tr]" string => "/usr/bin/tr"; "path[wc]" string => "/usr/bin/wc"; "path[wget]" string => "/usr/bin/wget"; "path[realpath]" string => "/usr/bin/realpath"; # "path[apt_cache]" string => "/usr/bin/apt-cache"; "path[apt_config]" string => "/usr/bin/apt-config"; "path[apt_get]" string => "/usr/bin/apt-get"; "path[apt_key]" string => "/usr/bin/apt-key"; "path[aptitude]" string => "/usr/bin/aptitude"; "path[dpkg]" string => "/usr/bin/dpkg"; "path[dpkg_divert]" string => "/usr/bin/dpkg-divert"; "path[groupadd]" string => "/usr/sbin/groupadd"; "path[groupdel]" string => "/usr/sbin/groupdel"; "path[groupmod]" string => "/usr/sbin/groupmod"; "path[ifconfig]" string => "/sbin/ifconfig"; "path[ip]" string => "/sbin/ip"; "path[service]" string => "/usr/sbin/service"; "path[svc]" string => "/usr/sbin/service"; "path[update_alternatives]" string => "/usr/bin/update-alternatives"; "path[update_rc_d]" string => "/usr/sbin/update-rc.d"; "path[useradd]" string => "/usr/sbin/useradd"; "path[userdel]" string => "/usr/sbin/userdel"; "path[usermod]" string => "/usr/sbin/usermod"; archlinux||darwin:: "path[sysctl]" string => "/usr/bin/sysctl"; !(archlinux||darwin):: "path[sysctl]" string => "/sbin/sysctl"; !(suse|sles):: "path[logger]" string => "/usr/bin/logger"; suse|sles:: "path[awk]" string => "/usr/bin/awk"; "path[bc]" string => "/usr/bin/bc"; "path[cat]" string => "/bin/cat"; "path[cksum]" string => "/usr/bin/cksum"; "path[createrepo]" string => "/usr/bin/createrepo"; "path[crontab]" string => "/usr/bin/crontab"; "path[crontabs]" string => "/var/spool/cron/tabs"; "path[curl]" string => "/usr/bin/curl"; "path[cut]" string => "/usr/bin/cut"; "path[dc]" string => "/usr/bin/dc"; "path[df]" string => "/bin/df"; "path[diff]" string => "/usr/bin/diff"; "path[dig]" string => "/usr/bin/dig"; "path[dmidecode]" string => "/usr/sbin/dmidecode"; "path[domainname]" string => "/bin/domainname"; "path[echo]" string => "/bin/echo"; "path[egrep]" string => "/usr/bin/egrep"; "path[ethtool]" string => "/usr/sbin/ethtool"; "path[find]" string => "/usr/bin/find"; "path[free]" string => "/usr/bin/free"; "path[grep]" string => "/usr/bin/grep"; "path[hostname]" string => "/bin/hostname"; "path[init]" string => "/sbin/init"; "path[iptables]" string => "/usr/sbin/iptables"; "path[iptables_save]" string => "/usr/sbin/iptables-save"; "path[ls]" string => "/bin/ls"; "path[lsof]" string => "/usr/bin/lsof"; "path[netstat]" string => "/bin/netstat"; "path[nologin]" string => "/sbin/nologin"; "path[ping]" string => "/bin/ping"; "path[perl]" string => "/usr/bin/perl"; "path[printf]" string => "/usr/bin/printf"; "path[sed]" string => "/bin/sed"; "path[sort]" string => "/usr/bin/sort"; "path[test]" string => "/usr/bin/test"; "path[tr]" string => "/usr/bin/tr"; "path[logger]" string => "/bin/logger"; "path[wget]" string => "/usr/bin/wget"; # "path[chkconfig]" string => "/sbin/chkconfig"; "path[groupadd]" string => "/usr/sbin/groupadd"; "path[groupdel]" string => "/usr/sbin/groupdel"; "path[groupmod]" string => "/usr/sbin/groupmod"; "path[ifconfig]" string => "/sbin/ifconfig"; "path[ip]" string => "/sbin/ip"; "path[rpm]" string => "/bin/rpm"; "path[service]" string => "/sbin/service"; "path[useradd]" string => "/usr/sbin/useradd"; "path[userdel]" string => "/usr/sbin/userdel"; "path[usermod]" string => "/usr/sbin/usermod"; "path[zypper]" string => "/usr/bin/zypper"; linux|solaris:: "path[shadow]" string => "/etc/shadow"; freebsd|openbsd|netbsd|darwin:: "path[shadow]" string => "/etc/master.passwd"; "path[mailx]" string => "/usr/bin/mailx"; aix:: "path[shadow]" string => "/etc/security/passwd"; any:: "all_paths" slist => getindices("path"); "$(all_paths)" string => "$(path[$(all_paths)])"; classes: "_have_bin_env" expression => fileexists("/bin/env"); "_have_bin_systemctl" expression => fileexists("/bin/systemctl"); "_stdlib_has_path_$(all_paths)" expression => isvariable("$(all_paths)"), comment => "It's useful to know if a given path is defined"; "_stdlib_path_exists_$(all_paths)" expression => fileexists("$(path[$(all_paths)])"), comment => "It's useful to know if $(all_paths) exists on the filesystem as defined"; } cfengine-masterfiles-3.12.1/lib/guest_environments.cf0000644000000000000000000000714113377750475022731 0ustar00rootroot00000000000000############################################################################ # Copyright 2017 Northern.tech AS # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License LGPL as published by the # Free Software Foundation; version 3. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # To the extent this program is licensed as part of the Enterprise # versions of CFEngine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. ########################################################################### # # CFEngine Community Open Promise-Body Library # # This initiative started by CFEngine promotes a # standardized set of names and promise specifications # for template functionality within CFEngine 3. # # The aim is to promote an industry standard for # naming of configuration patterns, leading to a # de facto middleware of standardized syntax. # # Names should be intuitive and parameters should be # minimal to assist readability and comprehensibility. # Contributions to this file are voluntarily given to # the cfengine community, and are moderated by CFEngine. # No liability or warranty for misuse is implied. # # If you add to this file, please try to make the # contributions "self-documenting". Comments made # after the bundle/body statement are retained in # the online docs # # For CFEngine Core: 3.7.0 to 3.7.x # Guest environments bodies ################################################### # If you find CFEngine useful, please consider # # purchasing a commercial version of the software.# ################################################### ##------------------------------------------------------- ## guest_environment promises ##------------------------------------------------------- body environment_resources kvm(name, arch, cpu_count, mem_kb, disk_file) # @brief An `environment_resources` body for a KVM virtual machine. # # The `env_spec` attribute is set to a KVM XML specification. # # @param name The name of the virtual machine # @param arch The architecture # @param cpu_count The number of CPUs the virtual machine should have # @param mem_kb The amount of RAM in kilobyte # @param disk_file The file on the host system for the virtual machine's harddrive # # **Example:** # # ```cf3 # bundle agent manage_vm # { # guest_environments: # am_vm_host:: # "db_server" # environment_host => atlas, # environment_type => "kvm", # environment_state => "create", # environment_resources => kvm("PSQL1, "x86_64", "4", "4096", "/var/lib/libvirt/images/psql1.iso") # } # ``` { env_spec => " $(name) $(mem_kb) $(mem_kb) $(cpu_count) hvm destroy restart restart /usr/bin/kvm "; } cfengine-masterfiles-3.12.1/lib/services.cf0000644000000000000000000012535113377750475020622 0ustar00rootroot00000000000000############################################################################ # Copyright 2017 Northern.tech AS # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License LGPL as published by the # Free Software Foundation; version 3. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # To the extent this program is licensed as part of the Enterprise # versions of CFEngine, the applicable Commercial Open Source License # (COSL) may apply to this file if you as a licensee so wish it. See # included file COSL.txt. ########################################################################### # # CFEngine Community Open Promise-Body Library # # This initiative started by CFEngine promotes a # standardized set of names and promise specifications # for template functionality within CFEngine 3. # # The aim is to promote an industry standard for # naming of configuration patterns, leading to a # de facto middleware of standardized syntax. # # Names should be intuitive and parameters should be # minimal to assist readability and comprehensibility. # Contributions to this file are voluntarily given to # the cfengine community, and are moderated by CFEngine. # No liability or warranty for misuse is implied. # # If you add to this file, please try to make the # contributions "self-documenting". Comments made # after the bundle/body statement are retained in # the online docs # # For CFEngine Core: 3.7.0 to 3.7.x # Services bodies ################################################### # If you find CFEngine useful, please consider # # purchasing a commercial version of the software.# ################################################### bundle common services_common # @ignore { vars: "inputs" slist => { "$(this.promise_dirname)/common.cf", "$(this.promise_dirname)/paths.cf" }; } body file control # @ignore { inputs => { @(services_common.inputs) }; } ##------------------------------------------------------- ## service promises ##------------------------------------------------------- body service_method bootstart # @brief Start the service and all its dependencies at boot time # # **See also:** `service_autostart_policy`, `service_dependence_chain` { service_autostart_policy => "boot_time"; service_dependence_chain => "start_parent_services"; windows:: service_type => "windows"; } ## body service_method force_deps # @brief Start all dependendencies when this service starts, and stop all # dependent services when this service stops. # # The service does not get automatically started. # # **See also:** `service_autostart_policy`, `service_dependence_chain` { service_dependence_chain => "all_related"; windows:: service_type => "windows"; } body service_method standard_services # @brief Default services_method for when you wan't to call it explicitly # # By default this service_method is *not* used. The call for standard_services # is within the core and not here. In case you use a promise like: # # ```cf3 # services: # "ssh" # service_policy => "start"; # ``` # # Then this method is skipped and CFEngine calls standard_services bundle # directly. This is here as a helper in case you wan't to be explicit # with your service promise and point it to standard_services (for readability, # documentation, etc). # # Do note that any options defined in this method does not apply to service # promises without explicit template_method call for standard_services. # # **Example:** # # ```cf3 # services: # "ssh" # service_policy => "start", # service_method => standard_services; # ``` { service_bundle => standard_services( $(this.promiser), $(this.service_policy) ); } ## bundle agent standard_services(service,state) # @brief Standard services bundle, used by CFEngine by default # @author CFEngine AS # @param service Name of service to control # @param state The desired state for that service: "start", "restart", "reload", "stop", or "disable" # # This bundle is used by CFEngine if you don't specify a services # handler explicitly, and will work with systemd or chkconfig or other # non-sysvinit service managers. It will try to automate service # discovery, unlike `classic_services` which requires known service # names. If it can't do the automatic management, it will pass control # to `classic_services`. # # This bundle receives the service name and the desired service state, # then does the needful to reach the desired state. # # If you're running systemd, systemctl will be used. # # Else, if chkconfig is present, it will be used. # # Else, if the service command is available, if will be used. # # Else, if the svcadm command is available, if will be used. Note you # have to supply the full SMF service identifier. # # Else, control is passed to `classic_services`. # # Note you do **not** have to call this bundle from `services` # promises. You can simply make a `methods` call to it. That would # enable you to use systemd states like `try-restart` for instance. # # **Example:** # # ```cf3 # services: # "sshd" service_policy => "start"; # uses `standard_services` # # methods: # "" usebundle => standard_services("sshd", "start"); # direct # ``` { vars: "call_systemctl" string => "$(paths.systemctl) --no-ask-password --global --system"; "systemd_properties" string => "-pLoadState,CanStop,UnitFileState,ActiveState,LoadState,CanStart,CanReload"; "init" string => "/etc/init.d/$(service)"; "c_service" string => canonify("$(service)"); start|restart|reload:: "chkconfig_mode" string => "on"; "svcadm_mode" string => "enable"; stop|disable:: "chkconfig_mode" string => "off"; "svcadm_mode" string => "disable"; systemd:: "systemd_service_info" slist => string_split(execresult("$(call_systemctl) $(systemd_properties) show $(service)", "noshell"), "\n", "10"); classes: # define a class named after the desired state "$(state)" expression => "any"; "non_disabling" or => { "start", "stop", "restart", "reload" }; "chkconfig" expression => "!systemd._stdlib_path_exists_chkconfig"; "sysvservice" expression => "!systemd.!chkconfig._stdlib_path_exists_service"; "smf" expression => "!systemd.!chkconfig.!sysvservice._stdlib_path_exists_svcadm"; "fallback" expression => "!systemd.!chkconfig.!sysvservice.!smf"; "have_init" expression => fileexists($(init)); chkconfig.have_init:: "running" expression => returnszero("$(init) status > /dev/null", "useshell"); sysvservice.have_init:: "running" expression => returnszero("$(paths.service) $(service) status > /dev/null", "useshell"); chkconfig.SuSE:: "onboot" expression => returnszero("$(paths.chkconfig) $(service) | $(paths.grep) 'on$' >/dev/null", "useshell"), comment => "SuSE chkconfig outputs current state to stdout rather than as an exit code"; chkconfig.!SuSE:: "onboot" expression => returnszero("$(paths.chkconfig) $(service)", "noshell"), comment => "We need to know if the service is configured to start at boot or not"; # We redirect stderr and stdout to dev null so that we do not create noise in the logs "chkconfig_$(c_service)_unregistered" not => returnszero("$(paths.chkconfig) --list $(service) &> /dev/null", "useshell"), comment => "We need to know if the service is registered with chkconfig so that we can perform other chkconfig operations, if the service is not registered it must be added. Note we do not automatically try to add the service at this time."; ### BEGIN ### # @brief probe the state of a systemd service # @author Bryan Burke # # A collection of classes to determine the capabilities of a given systemd # service, then start, stop, etc. the service. Also supports a custom action # for anything not supported # systemd:: "service_enabled" expression => reglist(@(systemd_service_info), "UnitFileState=enabled"); "service_enabled" -> { "CFE-2923" } expression => returnszero( "$(call_systemctl) is-enabled $(service) > /dev/null 2>&1", useshell); "service_active" expression => reglist(@(systemd_service_info), "ActiveState=active"); "service_loaded" expression => reglist(@(systemd_service_info), "LoadState=loaded"); "service_notfound" expression => reglist(@(systemd_service_info), "LoadState=not-found"); "can_stop_service" expression => reglist(@(systemd_service_info), "CanStop=yes"); "can_start_service" expression => reglist(@(systemd_service_info), "CanStart=yes"); "can_reload_service" expression => reglist(@(systemd_service_info), "CanReload=yes"); "request_start" expression => strcmp("start", "$(state)"); "request_stop" expression => strcmp("stop", "$(state)"); "request_reload" expression => strcmp("reload", "$(state)"); "request_restart" expression => strcmp("restart", "$(state)"); "action_custom" expression => "!(request_start|request_stop|request_reload|request_restart)"; "action_start" expression => "request_start.!service_active.can_start_service"; "action_stop" expression => "request_stop.service_active.can_stop_service"; "action_reload" expression => "request_reload.service_active.can_reload_service"; "action_restart" or => { "request_restart", # Possibly undesirable... if a reload is # requested, and the service "can't" be # reloaded, then we restart it instead. "request_reload.!can_reload_service.service_active", }; # Starting a service implicitly enables it "action_enable" expression => "request_start.!service_enabled"; # Respectively, stopping it implicitly disables it "action_disable" expression => "request_stop.service_enabled"; commands: systemd.service_loaded:: # note this class is defined in `inventory/linux.cf` # conveniently, systemd states map to `services` states, except # for `enable` "$(call_systemctl) -q start $(service)" ifvarclass => "action_start"; "$(call_systemctl) -q stop $(service)" ifvarclass => "action_stop"; "$(call_systemctl) -q reload $(service)" ifvarclass => "action_reload"; "$(call_systemctl) -q restart $(service)" ifvarclass => "action_restart"; "$(call_systemctl) -q enable $(service)" ifvarclass => "action_enable"; "$(call_systemctl) -q disable $(service)" ifvarclass => "action_disable"; # Custom action for any of the non-standard systemd actions such a # status, try-restart, isolate, et al. "$(call_systemctl) $(state) $(service)" ifvarclass => "action_custom"; ### END systemd section ### chkconfig.stop.onboot:: # Only chkconfig disable if it's currently set to start on boot "$(paths.chkconfig) $(service) $(chkconfig_mode)" classes => kept_successful_command, contain => silent; chkconfig.start.!onboot:: # Only chkconfig enable service if it's not already set to start on boot, and if its a registered chkconfig service "$(paths.chkconfig) $(service) $(chkconfig_mode)" ifvarclass => "!chkconfig_$(c_service)_unregistered", classes => kept_successful_command, contain => silent; chkconfig.have_init.(((start|restart).!running)|((stop|restart|reload).running)).non_disabling:: "$(init) $(state)" contain => silent; sysvservice.start.!running:: "$(paths.service) $(service) start" handle => "standard_services_sysvservice_not_running_start", classes => kept_successful_command, comment => "If the service should be running and it is not currently running then we should issue the standard service command to start the service."; sysvservice.restart:: "$(paths.service) $(service) restart" handle => "standard_services_sysvservice_restart", classes => kept_successful_command, comment => "If the service should be restarted we issue the standard service command to restart or reload the service. There is no restriction based on the services current state as restart can start a service that was not already running."; sysvservice.reload.running:: "$(paths.service) $(service) reload" handle => "standard_services_sysvservice_reload", classes => kept_successful_command, comment => "If the service should be reloaded we issue the standard service command to reload the service. It is restricted to when the service is running as a reload should not start services that are not already running. This may not be triggered as service state parameters are limited and translated to the closest meaning."; sysvservice.((stop|disable).running):: "$(paths.service) $(service) stop" handle => "standard_services_sysvservice_stop", classes => kept_successful_command, comment => "If the service should be stopped or disabled and it is currently running then we should issue the standard service command to stop the service."; smf:: "$(paths.svcadm) $(svcadm_mode) $(service)" classes => kept_successful_command; methods: fallback:: "classic" usebundle => classic_services($(service), $(state)); reports: verbose_mode.systemd:: "$(this.bundle): using systemd layer to $(state) $(service)"; verbose_mode.systemd.!service_loaded:: "$(this.bundle): Service $(service) unit file is not loaded; doing nothing"; verbose_mode.chkconfig:: "$(this.bundle): using chkconfig layer to $(state) $(service) (chkconfig mode $(chkconfig_mode))" ifvarclass => "!chkconfig_$(c_service)_unregistered.((start.!onboot)|(stop.onboot))"; verbose_mode.chkconfig:: "$(this.bundle): skipping chkconfig layer to $(state) $(service) because $(service) is not registered with chkconfig (chkconfig --list $(service))" ifvarclass => "chkconfig_$(c_service)_unregistered"; verbose_mode.sysvservice:: "$(this.bundle): using System V service / Upstart layer to $(state) $(service)"; verbose_mode.smf:: "$(this.bundle): using Solaris SMF to $(state) $(service) (svcadm mode $(svcadm_mode))"; verbose_mode.fallback:: "$(this.bundle): falling back to classic_services to $(state) $(service)"; systemd.service_notfound.(start|restart|reload).(inform_mode|verbose_mode):: "$(this.bundle): Could not find service: $(service)"; } bundle agent classic_services(service,state) # @brief Classic services bundle # @author CFEngine AS # @author Tero Kantonen # @param service specific service to control # @param state desired state for that service # # This bundle is used by `standard_services` if it doesn't have an # automatic driver for the current service manager. # # It receives the service name and the desired service state, then # does the needful to reach the desired state. # # **Example:** # # ```cf3 # services: # "ntp" service_policy => "start"; # "ssh" service_policy => "stop"; # ``` # # There's multiple ways you can add new services to this list. # Here's few examples: # # a) The zeroconf mode; If the new service matches these rules, # you don't need to add anything to the standard_services: # # 1. Your init script basename = `$(service)` # 2. Your init script argument = `$(state)` # 3. Your init script lives in `/etc/init.d/` (for non-*bsd), # or `/etc/rc.d/` (for *bsd) # 4. Your process regex pattern = `\b$(service)\b` # 5. You call the init as `/etc/init.d/