File _preinstallimage of Package preinstallimage-nut

Name: preinstallimage-nut
### Start of "if RPM"
%if 0%{?rhel_version} || 0%{?rhel} || 0%{?sle_version} || 0%{?suse_version} || 0%{?centos_version} || 0%{?centos} || 0%{?fedora_version} || 0%{?fedora} || 0%{?opensuse_version}
%define LIBEXECPATH     %{_libexecdir}/ups
%if "0%{?apache_serverroot_cgi}" == "0" || 0%(echo '%{apache_serverroot_cgi}' | grep -E '^%{_datadir}' >/dev/null && echo 1 || echo 0) > 0
%define CGIPATH         %{LIBEXECPATH}/cgi-bin
%else
%define CGIPATH         %{apache_serverroot_cgi}/nut
%endif
%if "0%{?apache_serverroot_data}" == "0" || 0%(test x'%{apache_serverroot_data}' = x'^%{_datadir}' && echo 1 || echo 0) > 0
%define HTMLPATH        %{_datadir}/nut/htdocs
%else
%define HTMLPATH        %{apache_serverroot_data}/nut
%endif
%define MODELPATH       %{LIBEXECPATH}/driver
%define STATEPATH       %{_localstatedir}/lib/ups
%define CONFPATH        %{_sysconfdir}/ups
%define DOCPATH         %{_docdir}/nut
%define UDEVRULEPATH    %(test -d /usr/lib/udev && echo /usr/lib/udev || echo "%{_sysconfdir}/udev")
%define BASHCOMPLETIONPATH      %(test -d /usr/share/bash-completion/completions && echo /usr/share/bash-completion/completions || echo "%{_sysconfdir}/bash_completion.d")
%define NUT_USER                upsd
%define NUT_GROUP               daemon
%define LBRACE (
%define RBRACE )
%define QUOTE "
%define BACKSLASH \\
%define USBHIDDRIVERS    %(zcat %{SOURCE0} | tr a-z A-Z | fgrep -a -A1 USBHID-UPS | sed -n 's/.*ATTR{IDVENDOR}==%{QUOTE}%{BACKSLASH}%{LBRACE}[^%{QUOTE}]*%{BACKSLASH}%{RBRACE}%{QUOTE}, ATTR{IDPRODUCT}==%{QUOTE}%{BACKSLASH}%{LBRACE}[^%{QUOTE}]*%{BACKSLASH}%{RBRACE}%{QUOTE}, MODE=.*/modalias%{LBRACE}usb:v%{BACKSLASH}1p%{BACKSLASH}2d*dc*dsc*dp*ic*isc*ip*%{RBRACE}/p' | tr '%{BACKSLASH}n' ' ')
%define USBNONHIDDRIVERS %(zcat %{SOURCE0} | tr a-z A-Z | fgrep -a -A1 _USB       | sed -n 's/.*ATTR{IDVENDOR}==%{QUOTE}%{BACKSLASH}%{LBRACE}[^%{QUOTE}]*%{BACKSLASH}%{RBRACE}%{QUOTE}, ATTR{IDPRODUCT}==%{QUOTE}%{BACKSLASH}%{LBRACE}[^%{QUOTE}]*%{BACKSLASH}%{RBRACE}%{QUOTE}, MODE=.*/modalias%{LBRACE}usb:v%{BACKSLASH}1p%{BACKSLASH}2d*dc*dsc*dp*ic*isc*ip*%{RBRACE}/p' | tr '%{BACKSLASH}n' ' ')
%define systemdsystemunitdir %(pkg-config --variable=systemdsystemunitdir systemd)
%define systemdsystempresetdir %(pkg-config --variable=systemdsystempresetdir systemd || pkg-config --variable=systemdsystempresetdir libsystemd)
%define systemdtmpfilesdir %(pkg-config --variable=tmpfilesdir systemd || pkg-config --variable=tmpfilesdir libsystemd)
%define systemdsystemdutildir %(pkg-config --variable=systemdutildir systemd)
%define systemdshutdowndir %(pkg-config --variable=systemdshutdowndir systemd)
# % define NUT_SYSTEMD_UNITS_SERVICE_TARGET     % (cd scripts/systemd && ls -1 *.{service,target,path,timer}{,.in} | sed 's,.in$,,' | sort | uniq)
%define NUT_SYSTEMD_UNITS_SERVICE_TARGET        nut-driver-enumerator.service nut-driver.target nut-driver@.service nut-logger.service nut-monitor.service nut-server.service nut-sleep.service nut-udev-settle.service nut.target nut-driver-enumerator.path
%define NUT_SYSTEMD_UNITS_UNCOMMON_NDE  nut-driver-enumerator-daemon-activator.path nut-driver-enumerator-daemon-activator.service nut-driver-enumerator-daemon.service
%define NUT_SYSTEMD_UNITS_PRESET        %(cd scripts/systemd && ls -1 *.preset{,.in} | sed 's,.in$,,' | sort | uniq)
%define NUTPKG_WITH_DMF %( test -d scripts/DMF && echo 1 || echo 0 )
%define SO_MAJOR_LIBUPSCLIENT   7
%define SO_MAJOR_LIBNUTCLIENT   2
%define SO_MAJOR_LIBNUTCLIENTSTUB       1
%define SO_MAJOR_LIBNUTSCAN     4
%define SO_MAJOR_LIBNUTCONF     0
%define NUTPKG_WITH_LIBNUTCONF  0
###BuildRequires:  % {_sbindir}/chroot
BuildRequires:       usbutils
#%if 0 % {?suse_version}
#%endif
BuildRequires:  dos2unix
%if ! 0%{?rhel_version}
BuildRequires:  fdupes
%endif
%if ( ! 0%{?rhel_version} )  &&  ( ! 0%{?rhel} )
%define NUTPKG_WITH_AVAHI       1
BuildRequires:  avahi-devel
%else
%define NUTPKG_WITH_AVAHI       0
%endif
%if ( ! 0%{?rhel_version} )  &&  ( ! 0%{?rhel} )  &&  ( 0%{?sle_version}>=150000 || ! 0%{?sle_version} )  &&  ( 0%{?suse_version}>=1300 || ! 0%{?suse_version} )
%define NUTPKG_WITH_FREEIPMI    1
BuildRequires:  (libfreeipmi-devel or freeipmi-devel)
%else
%define NUTPKG_WITH_FREEIPMI    0
%endif
%if ( 0%{?rhel_version}>=800 || ! 0%{?rhel_version} )  &&  ( 0%{?rhel}>=8 || ! 0%{?rhel} )
%define NUTPKG_WITH_LIBGD       1
BuildRequires:  gd-devel
%else
%define NUTPKG_WITH_LIBGD       0
%endif
BuildRequires:  gcc-c++
BuildRequires:  libtool
%if ( 0%{?rhel_version}>=800 || ! 0%{?rhel_version} )  &&  ( 0%{?rhel}>=8 || ! 0%{?rhel} )
%define NUTPKG_WITH_LTDL        1
BuildRequires:  libtool-ltdl-devel
%else
%define NUTPKG_WITH_LTDL        0
%endif
BuildRequires:  (libusb-devel or libusbx-devel)
#!Prefer:       libusbx-devel
BuildRequires:  net-snmp-devel
BuildRequires:  libxml2-devel
BuildRequires:  pkg-config
BuildRequires:  (python >= 2.6 or python3 or python2)
%if 0%{?NUTPKG_WITH_DMF}
BuildRequires:  lua-devel
#BuildRequires:  python-pycparser
%endif
#   % if 0 % {?centos_version}
#   % if 0 % {?suse_version}
#   % if 0 % {?rhel_version}>=700
%if ( (0%{?rhel_version}>0 && 0%{?rhel_version}<800) || ! 0%{?rhel_version} )  &&  ( (0%{?centos_version}>0 && 0%{?centos_version}!=800) || ! 0%{?centos_version} )
BuildRequires:  (httpd-devel or apache2-devel)
%endif
BuildRequires:  (dbus-1-glib-devel or dbus-glib-devel)
%if ( ! 0%{?rhel_version} )  &&  ( ! 0%{?rhel} )
BuildRequires:  (libcppunit-devel or cppunit-devel)
%endif
%if ( (0%{?rhel_version}>0 && 0%{?rhel_version}<800) || ! 0%{?rhel_version} )  &&  ( (0%{?centos_version}>0 && 0%{?centos_version}<800) || ! 0%{?centos_version} )  &&  ( (0%{?fedora_version}>0 && 0%{?fedora_version}<=27) || ! 0%{?fedora_version} )
%define NUTPKG_WITH_TCPWRAP     1
BuildRequires:  (tcpd-devel or tcp_wrappers-devel)
%else
%define NUTPKG_WITH_TCPWRAP     0
%endif
# OBS: This may need `osc meta prjconf` to `Prefer:` one
BuildRequires:  (libneon-devel or neon-devel or neon)
#!Prefer:       (libneon-devel or neon-devel)
BuildRequires:  (libopenssl-devel or openssl-devel or openssl)
#!Prefer:       (libopenssl-devel or openssl-devel)
%if ( ! 0%{?rhel_version} )  &&  ( ! 0%{?rhel} )  &&  ( (0%{?centos_version}>0 && 0%{?centos_version}<1000) || ! 0%{?centos_version} )  &&  ( (0%{?fedora_version}>0 && 0%{?fedora_version}<4200) || ! 0%{?fedora_version} )  &&  ( (0%{?fedora}>0 && 0%{?fedora}<42) || ! 0%{?fedora} )
%define NUTPKG_WITH_POWERMAN    1
BuildRequires:  powerman-devel
%else
%define NUTPKG_WITH_POWERMAN    0
%endif
%if ( 0%{?suse_version}>0 || ! 0%{?suse_version} )  &&  (0%{?centos_version}>=800 || ! 0%{?centos_version} )  &&  ( ! 0%{?rhel_version} )  &&  ( ! 0%{?rhel} )
BuildRequires:  systemd-rpm-macros
%endif
%if ( 0%{?rhel_version}>=800 || ! 0%{?rhel_version} )  &&  ( 0%{?rhel}>=8 || ! 0%{?rhel} )
#BuildRequires:  dblatex
BuildRequires:  (libxslt-tools or libxslt)
BuildRequires:  asciidoc
%endif
%if 0%{?opensuse_version}
%endif
%if 0%{?NUTPKG_WITH_LTDL}
%if 0%{?NUTPKG_WITH_LIBNUTCONF} > 0
%endif
%endif
%if 0%{?NUTPKG_WITH_LIBGD}
%endif
BuildRequires:  (python >= 2.6 or python3 or python2)
BuildRequires:       openssl-devel
%if 0%{?NUTPKG_WITH_LIBNUTCONF} > 0
%endif
%if 0%{?NUTPKG_WITH_DMF}
%endif
%if "x%{?systemdsystemunitdir}" == "x"
%else
%endif
%if "x%{?systemdtmpfilesdir}" == "x"
%else
%endif
%if "x%{?systemdsystemunitdir}" == "x"
%else
%endif
%if "x%{?systemdsystemunitdir}" == "x"
%else
%endif
%if "x%{?systemdsystemunitdir}" == "x"
%else
%endif
%if 0%{?NUTPKG_WITH_LTDL} > 0
%if 0%{?NUTPKG_WITH_LIBNUTCONF} > 0
%endif
%endif
%if "x%{?systemdsystemunitdir}" == "x"
%else
%endif
%if "x%{?systemdsystempresetdir}" == "x"
%else
%endif
%if "x%{?systemdtmpfilesdir}" == "x"
%else
%endif
%if "x%{?systemdshutdowndir}" == "x"
%else
%endif
%if 0%{?NUTPKG_WITH_DMF}
%endif
%if 0%{?NUTPKG_WITH_DMF}
%endif
%if "x%{?systemdsystemunitdir}" == "x"
%else
%endif
%if "x%{?systemdsystempresetdir}" == "x"
%else
%endif
%if "x%{?systemdtmpfilesdir}" == "x"
%else
%endif
%if "x%{?systemdshutdowndir}" == "x"
%else
%endif
%if 0%{?NUTPKG_WITH_DMF}
%endif
%if 0%{?NUTPKG_WITH_LTDL}
%if 0%{?NUTPKG_WITH_LIBNUTCONF} > 0
%endif
%endif
%if 0%{?NUTPKG_WITH_LIBGD}
%endif
%endif
### End of "if RPM"
# ---- blank ----
### Start of "if DEB"
%if 0%{?debian_version} || 0%{?debian} || 0%{?ubuntu_version} || 0%{?ubuntu}
BuildRequires: debhelper>=8.1.3
BuildRequires: cdbs>=0.4.122~
BuildRequires: autotools-dev
BuildRequires: dh-autoreconf
BuildRequires: libsystemd-dev
BuildRequires: libjpeg-dev
BuildRequires: libgd-dev|libgd2-xpm-dev|libgd2-noxpm-dev
BuildRequires: libssl1.0-dev|libssl-dev
BuildRequires: libsnmp-dev|libsnmp9-dev
BuildRequires: libusb-dev>=0.1.8
BuildRequires: libneon27-gnutls-dev|libneon27-dev
BuildRequires: libpowerman0-dev>=2.3.3
BuildRequires: libwrap0-dev>=7.6
BuildRequires: python2|python3
BuildRequires: libfreeipmi-dev>=0.8.5
BuildRequires: libipmimonitoring-dev>=1.1.5-2
BuildRequires: libnss3-dev
BuildRequires: libtool
BuildRequires: libltdl-dev
BuildRequires: liblua5.1-0-dev
BuildRequires: lua5.1
BuildRequires: pkg-config
BuildRequires: dh-python|dh-python2|dh-python3|dh-pypy
BuildRequires: libmodbus-dev
BuildRequires: libi2c-dev
BuildRequires: asciidoc>=8.6.3
BuildRequires: docbook-xsl
BuildRequires: dblatex>=0.2.5
BuildRequires: libxml2-utils
%endif
### End of "if DEB"
openSUSE Build Service is sponsored by