diff options
author | Jörg Frings-Fürst <debian@jff.email> | 2019-08-10 12:03:13 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff.email> | 2019-08-10 12:03:13 +0200 |
commit | 05425539f8f939ea2edc03c1e011e41952612836 (patch) | |
tree | 96f72afa6e9f48aaa63c13c6ef6f1a3944952bdc /doc/ipmiutil.spec | |
parent | 5f532f12bf9a32e4fe135280c22a12de32c8ebd3 (diff) | |
parent | 27df2893a39a9da083841e37c12fc24b2bdad80f (diff) |
Merge branch 'feature/upstream' into develop
Diffstat (limited to 'doc/ipmiutil.spec')
-rw-r--r-- | doc/ipmiutil.spec | 87 |
1 files changed, 56 insertions, 31 deletions
diff --git a/doc/ipmiutil.spec b/doc/ipmiutil.spec index 3587484..5d80dab 100644 --- a/doc/ipmiutil.spec +++ b/doc/ipmiutil.spec @@ -3,7 +3,7 @@ # Copyright (c) 2012 Andy Cress # Name: ipmiutil -Version: 3.1.3 +Version: 3.1.4 Release: 1%{?dist} Summary: Easy-to-use IPMI server management utilities License: BSD @@ -207,17 +207,19 @@ rm -rf %{buildroot} %post /sbin/ldconfig # POST_INSTALL, $1 = 1 if rpm -i, $1 = 2 if rpm -U -if [ "$1" = "1" ] -then - # doing rpm -i, first time - vardir=%{_var}/lib/%{name} - scr_dir=%{_datadir}/%{name} +vardir=%{_var}/lib/%{name} +scr_dir=%{_datadir}/%{name} +# Install right scripts/service files no matter install or upgrade %if 0%{?req_systemd} %service_add_post ipmi_port.service ipmiutil_evt.service ipmiutil_asy.service ipmiutil_wdt.service %else if [ -x /bin/systemctl ] && [ -d %{unit_dir} ]; then - echo "IINITDIR=%{init_dir}" >>%{_datadir}/%{name}/ipmiutil.env + # Replace if exists, append if not. + # Use # as the sed delimiter to prevent handling slash in the path. + grep -q 'IINITDIR' %{_datadir}/%{name}/ipmiutil.env \ + && sed -i 's#^IINITDIR=.*#IINITDIR=%{init_dir}#' %{_datadir}/%{name}/ipmiutil.env \ + || echo "IINITDIR=%{init_dir}" >> %{_datadir}/%{name}/ipmiutil.env cp -f ${scr_dir}/ipmiutil_evt.service %{unit_dir} cp -f ${scr_dir}/ipmiutil_asy.service %{unit_dir} cp -f ${scr_dir}/ipmiutil_wdt.service %{unit_dir} @@ -232,6 +234,8 @@ then fi %endif +if [ "$1" = "1" ] +then # Test whether an IPMI interface is known to the motherboard IPMIret=1 which dmidecode >/dev/null 2>&1 && IPMIret=0 @@ -290,7 +294,7 @@ else fi fi fi -%if 0%{?fedora} >= 18 +%if 0%{?fedora} >= 18 || 0%{?rhel} >= 7 %systemd_post ipmiutil_evt.service %systemd_post ipmiutil_asy.service %systemd_post ipmiutil_wdt.service @@ -306,12 +310,15 @@ then %else if [ -x /bin/systemctl ]; then if [ -f %{unit_dir}/ipmiutil_evt.service ]; then -%if 0%{?fedora} >= 18 +%if 0%{?fedora} >= 18 || 0%{?rhel} >= 7 %systemd_preun ipmiutil_evt.service %systemd_preun ipmiutil_asy.service %systemd_preun ipmiutil_wdt.service %systemd_preun ipmi_port.service %else + ret=1 + which systemctl >/dev/null 2>&1 && ret=0 + if [ $ret -eq 0 ]; then systemctl disable ipmi_port.service >/dev/null 2>&1 || : systemctl disable ipmiutil_evt.service >/dev/null 2>&1 || : systemctl disable ipmiutil_asy.service >/dev/null 2>&1 || : @@ -320,6 +327,7 @@ then systemctl stop ipmiutil_asy.service >/dev/null 2>&1 || : systemctl stop ipmiutil_wdt.service >/dev/null 2>&1 || : systemctl stop ipmi_port.service >/dev/null 2>&1 || : + fi %endif fi else @@ -345,36 +353,53 @@ fi %postun # after uninstall, $1 = 1 if update, $1 = 0 if rpm -e /sbin/ldconfig +# Remove files from scr_dir only when uninstall +if [ "$1" = "0" ] +then + if [ -x /bin/systemctl ] && [ -d %{unit_dir} ]; then + if [ -f %{unit_dir}/ipmiutil_evt.service ]; then + rm -f %{unit_dir}/ipmiutil_evt.service 2>/dev/null || : + rm -f %{unit_dir}/ipmiutil_asy.service 2>/dev/null || : + rm -f %{unit_dir}/ipmiutil_wdt.service 2>/dev/null || : + rm -f %{unit_dir}/ipmi_port.service 2>/dev/null || : + fi + else + if [ -f %{init_dir}/ipmiutil_evt.service ]; then + rm -f %{init_dir}/ipmiutil_wdt 2>/dev/null || : + rm -f %{init_dir}/ipmiutil_asy 2>/dev/null || : + rm -f %{init_dir}/ipmiutil_evt 2>/dev/null || : + rm -f %{init_dir}/ipmi_port 2>/dev/null || : + fi + fi +fi + %if 0%{?req_systemd} %service_del_postun ipmi_port.service ipmiutil_evt.service ipmiutil_asy.service ipmiutil_wdt.service %else -if [ -x /bin/systemctl ]; then -%if 0%{?fedora} >= 18 -%systemd_postun_with_restart ipmi_port.service +%if 0%{?fedora} >= 18 || 0%{?rhel} >= 7 +%systemd_postun_with_restart ipmi_port.service +%systemd_postun_with_restart ipmiutil_evt.service +%systemd_postun_with_restart ipmiutil_asy.service +%systemd_postun_with_restart ipmiutil_wdt.service %else - systemctl daemon-reload || : - if [ $1 -ge 1 ] ; then - # Package upgrade, not uninstall - systemctl try-restart ipmi_port.service || : - fi -%endif - if [ -f %{unit_dir}/ipmiutil_evt.service ]; then - rm -f %{unit_dir}/ipmiutil_evt.service 2>/dev/null || : - rm -f %{unit_dir}/ipmiutil_asy.service 2>/dev/null || : - rm -f %{unit_dir}/ipmiutil_wdt.service 2>/dev/null || : - rm -f %{unit_dir}/ipmi_port.service 2>/dev/null || : - fi -else - if [ -f %{init_dir}/ipmiutil_evt.service ]; then - rm -f %{init_dir}/ipmiutil_wdt 2>/dev/null || : - rm -f %{init_dir}/ipmiutil_asy 2>/dev/null || : - rm -f %{init_dir}/ipmiutil_evt 2>/dev/null || : - rm -f %{init_dir}/ipmi_port 2>/dev/null || : - fi +ret=1 +which systemctl >/dev/null 2>&1 && ret=0 +if [ $ret -eq 0 ]; then + systemctl daemon-reload || : + if [ $1 -ge 1 ]; then + # Package upgrade, not uninstall + systemctl try-restart ipmi_port.service || : + systemctl try-restart ipmiutil_evt.service || : + systemctl try-restart ipmiutil_asy.service || : + systemctl try-restart ipmiutil_wdt.service || : + fi fi %endif +%endif %changelog +* Mon Oct 29 2018 Andrew Cress <arcress at users.sourceforge.net> 3.1.3-1 +- clean up systemd scripts with macros, fix update for systemd (Aska Wu) * Fri Jul 20 2018 Andrew Cress <arcress at users.sourceforge.net> 3.1.2-1 - resolve doubly-defined Group for Fedora * Mon Jun 29 2015 Andrew Cress <arcress at users.sourceforge.net> 2.9.7-1 |