name: "centreon-gorgone"
arch: "${ARCH}"
platform: "linux"
version_schema: "none"
version: "${VERSION}"
release: "${RELEASE}${DIST}"
section: "default"
priority: "optional"
maintainer: "Centreon <contact@centreon.com>"
description: |
  Centreon gorgone daemon
  Commit: @COMMIT_HASH@
vendor: "Centreon"
homepage: "https://www.centreon.com"
license: "Apache-2.0"

contents:
  - dst: "/etc/centreon-gorgone"
    type: dir
    file_info:
      owner: centreon-gorgone
      group: centreon-gorgone
      mode: 0755

  - dst: "/etc/centreon-gorgone/config.d"
    type: dir
    file_info:
      owner: centreon-gorgone
      group: centreon-gorgone
      mode: 0770

  - dst: "/etc/centreon-gorgone/config.d/cron.d"
    type: dir
    file_info:
      owner: centreon-gorgone
      group: centreon-gorgone
      mode: 0770

  - dst: "/etc/centreon-gorgone/config.d/whitelist.conf.d"
    type: dir
    file_info:
      owner: centreon-gorgone
      group: centreon-gorgone
      mode: 0770

  - src: "./configuration/config.yaml"
    dst: "/etc/centreon-gorgone/config.yaml"
    file_info:
      owner: centreon-gorgone
      group: centreon-gorgone
      mode: 0640

  - src: "./configuration/action.yaml"
    dst: "/etc/centreon-gorgone/config.d/39-action.yaml"
    file_info:
      owner: centreon-gorgone
      group: centreon-gorgone
      mode: 0640

  - src: "./configuration/whitelist.conf.d/centreon.yaml"
    dst: "/etc/centreon-gorgone/config.d/whitelist.conf.d/centreon.yaml"
    file_info:
      owner: centreon-gorgone
      group: centreon-gorgone
      mode: 0640

  - dst: "/var/lib/centreon-gorgone"
    type: dir
    file_info:
      owner: centreon-gorgone
      group: centreon-gorgone
      mode: 0775

  - dst: "/var/log/centreon-gorgone"
    type: dir
    file_info:
      owner: centreon-gorgone
      group: centreon-gorgone
      mode: 0775

  - dst: "/var/cache/centreon-gorgone"
    type: dir
    file_info:
      owner: centreon-gorgone
      group: centreon-gorgone
      mode: 0775

  - src: "./sudoers.d/centreon-gorgone"
    dst: "/etc/sudoers.d/centreon-gorgone"
    file_info:
      mode: 0600

  - src: "../config/systemd/gorgoned.rpm.service"
    dst: "/etc/systemd/system/gorgoned.service"
    file_info:
      mode: 0644
    packager: rpm
  - src: "../config/systemd/gorgoned.deb.service"
    dst: "/lib/systemd/system/gorgoned.service"
    file_info:
      mode: 0644
    packager: deb

  - src: "../config/systemd/gorgoned-sysconfig"
    dst: "/etc/sysconfig/gorgoned"
    type: config|noreplace
    packager: rpm
  - src: "../config/systemd/gorgoned-sysconfig"
    dst: "/etc/default/gorgoned"
    type: config|noreplace
    packager: deb

  - src: "../config/logrotate/gorgoned"
    dst: "/etc/logrotate.d/gorgoned"
    type: config|noreplace

  - src: "../gorgoned"
    dst: "/usr/bin/gorgoned"
    file_info:
      mode: 0755

  - src: "../gorgone"
    dst: "${PERL_VENDORLIB}/gorgone"
    expand: true

  - src: "../contrib/gorgone_config_init.pl"
    dst: "/usr/local/bin/"
    file_info:
      mode: 0755

  - src: "../contrib/gorgone_audit.pl"
    dst: "/usr/local/bin/"
    file_info:
      mode: 0755

  - src: "../contrib/gorgone_install_plugins.pl"
    dst: "/usr/local/bin/"
    file_info:
      mode: 0750

  - src: "../contrib/gorgone_key_thumbprint.pl"
    dst: "/usr/local/bin/"
    file_info:
      mode: 0750

  - src: "../contrib/gorgone_key_generation.pl"
    dst: "/usr/local/bin/"
    file_info:
      mode: 0750

scripts:
  preinstall: ./scripts/centreon-gorgone-preinstall.sh
  postinstall: ./scripts/centreon-gorgone-postinstall.sh
  preremove: ./scripts/centreon-gorgone-preremove.sh

overrides:
  rpm:
    depends:
      - bzip2
      - perl-Libssh-Session >= 0.8
      - perl-CryptX
      - perl-Mojolicious
      - perl(Mojo::IOLoop::Signal)
      - perl(Archive::Tar)
      - perl(Schedule::Cron)
      - perl(ZMQ::FFI)
      - perl(EV)
      - perl(JSON::XS)
      - perl(JSON::PP)
      - perl(XML::Simple)
      - perl(XML::LibXML::Simple)
      - perl(Net::SMTP)
      - perl(YAML::XS)
      - perl(DBD::SQLite)
      - perl(DBD::mysql)
      - perl(DBI)
      - perl(UUID)
      - perl(HTTP::Daemon)
      - perl(HTTP::Status)
      - perl(MIME::Base64)
      - perl(Digest::MD5::File)
      - perl(Net::Curl::Easy)
      - perl(HTTP::Daemon::SSL)
      - perl(NetAddr::IP)
      - perl(Hash::Merge)
      - perl(Clone)
      - perl(Sys::Syslog)
      - perl(DateTime)
      - perl(Try::Tiny)
      - tar
      - perl(JSON) # gorgone_key_thumbprint.pl needs the json module, even when json::xs is already installed
      - perl(RRDs)
      - perl(lib)
      - perl(Safe)
  deb:
    depends:
      - libdatetime-perl
      - libtime-parsedate-perl
      - libtry-tiny-perl
      - libxml-simple-perl
      - libxml-libxml-simple-perl
      - libdigest-md5-file-perl
      - libjson-pp-perl
      - libjson-xs-perl
      - libyaml-libyaml-perl
      - libdbi-perl
      - libdbd-sqlite3-perl
      - libdbd-mysql-perl
      - libhttp-daemon-perl
      - libhttp-daemon-ssl-perl
      - libnetaddr-ip-perl
      - libschedule-cron-perl
      - libhash-merge-perl
      - libcryptx-perl
      - libmojolicious-perl
      - libmojo-ioloop-signal-perl
      - libauthen-simple-perl
      - libauthen-simple-net-perl
      - libnet-curl-perl
      - libssh-session-perl
      - libssh-4
      - libev-perl
      - libzmq-ffi-perl
      - libclone-choose-perl
      - libjson-perl # gorgone_key_thumbprint.pl needs the json module, even when json::xs is already installed
      - librrds-perl
      - perl-base
      - perl-modules

rpm:
  summary: Centreon gorgone daemon
  signature:
    key_file: ${RPM_SIGNING_KEY_FILE}
    key_id: ${RPM_SIGNING_KEY_ID}
