From patchwork Fri Sep 21 14:46:12 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 1491871 X-Patchwork-Delegate: alexne@voltaire.com Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id CE6C8DF28C for ; Fri, 21 Sep 2012 14:46:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755542Ab2IUOqV (ORCPT ); Fri, 21 Sep 2012 10:46:21 -0400 Received: from [178.239.52.149] ([178.239.52.149]:40728 "EHLO wimaserver10.be" rhost-flags-FAIL-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1755239Ab2IUOqU (ORCPT ); Fri, 21 Sep 2012 10:46:20 -0400 Received: from 178-119-64-133.access.telenet.be ([178.119.64.133] helo=[192.168.1.100]) by wimaserver10.be with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1TF4bJ-0006h3-MT; Fri, 21 Sep 2012 16:53:05 +0200 Message-ID: <505C7DB4.3090803@acm.org> Date: Fri, 21 Sep 2012 16:46:12 +0200 From: Bart Van Assche User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120825 Thunderbird/15.0 MIME-Version: 1.0 To: Alex Netes CC: "linux-rdma@vger.kernel.org" , Doug Ledford Subject: [PATCH 4/4 for opensm] opensm.spec.in: Improve portability Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org Add support for Debian and for other systems that do not support chkconfig. See also http://refspecs.linuxbase.org/LSB_4.0.0/LSB-Core-generic/LSB-Core-generic/command.html. Also, after having installed /etc/init.d/opensmd on a system where systemd is present, tell systemd to reload the files in /etc/init.d. Signed-off-by: Bart Van Assche Cc: Doug Ledford --- opensm.spec.in | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/opensm.spec.in b/opensm.spec.in index 65e46c9..0187069 100644 --- a/opensm.spec.in +++ b/opensm.spec.in @@ -36,8 +36,6 @@ Source: http://www.openfabrics.org/downloads/management/@TARBALL@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: libibumad-devel, libtool Requires: %{name}-libs = %{version}-%{release}, logrotate -Requires(post): /sbin/service, /sbin/chkconfig -Requires(preun): /sbin/chkconfig, /sbin/service %description OpenSM provides an implementation of an InfiniBand Subnet Manager and @@ -109,15 +107,30 @@ rm -rf $RPM_BUILD_ROOT %post if [ $1 = 1 ]; then - /sbin/chkconfig --add opensmd + if [ -e /sbin/chkconfig ]; then + /sbin/chkconfig --add opensmd + elif [ -e /usr/sbin/update-rc.d ]; then + /usr/sbin/update-rc.d opensmd defaults + else + /usr/lib/lsb/install_initd /etc/init.d/opensmd + fi + if type systemctl >/dev/null 2>&1; then + systemctl --system daemon-reload + fi else - /sbin/service opensmd condrestart + /etc/init.d/opensmd condrestart fi %preun if [ $1 = 0 ]; then - /sbin/service opensmd stop - /sbin/chkconfig --del opensmd + /etc/init.d/opensmd stop + if [ -e /sbin/chkconfig ]; then + /sbin/chkconfig --del opensmd + elif [ -e /usr/sbin/update-rc.d ]; then + /usr/sbin/update-rc.d -f opensmd remove + else + /usr/lib/lsb/remove_initd /etc/init.d/opensmd + fi rm -f /var/cache/opensm/* fi