mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-21 20:51:27 +00:00
scstadmin: Add infrastructure for building an RPM
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5055 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -2,13 +2,20 @@ ifndef PREFIX
|
||||
PREFIX=/usr/local
|
||||
endif
|
||||
|
||||
VERSION = $(shell echo -n "$$(sed -n 's/^[[:blank:]]*\$$VERSION[[:blank:]]*=[[:blank:]]*[\"'"'"']\([0-9.]*\)[\"'"'"'];$$/\1/p' scstadmin/scst-*/lib/SCST/SCST.pm)."; \
|
||||
if svn info >/dev/null 2>&1; \
|
||||
then svn info | sed -n 's/^Revision:[[:blank:]]*/r/p';\
|
||||
else git show | sed -n 's/^commit[[:blank:]]*\(.......\).*/\1/p'; \
|
||||
fi)
|
||||
|
||||
SCSTADMIN_DIR = $(shell if [ ! -h scstadmin ]; then \
|
||||
rm -f scstadmin; \
|
||||
ln -s scstadmin.sysfs scstadmin; \
|
||||
fi; \
|
||||
echo scstadmin)
|
||||
|
||||
MANDIR := $(DESTDIR)$(PREFIX)/man
|
||||
MANDIR ?= $(DESTDIR)$(PREFIX)/man
|
||||
|
||||
INITDIR := $(shell if [ -f /etc/slackware-version ]; then \
|
||||
echo /etc/rc.d; \
|
||||
else \
|
||||
@@ -110,6 +117,29 @@ uninstall:
|
||||
perl-module:
|
||||
cd $(SCSTADMIN_DIR) && $(MAKE) $@
|
||||
|
||||
dist-gzip:
|
||||
name=$(shell basename $$PWD) && \
|
||||
mkdir $${name}-$(VERSION) && \
|
||||
{ ../scripts/list-source-files | tar -T- -cf- | \
|
||||
tar -C $${name}-$(VERSION) -xf-; } && \
|
||||
rm -f $${name}-$(VERSION).tar.bz2 && \
|
||||
tar -cjf $${name}-$(VERSION).tar.bz2 $${name}-$(VERSION) && \
|
||||
rm -rf $${name}-$(VERSION)
|
||||
|
||||
rpm:
|
||||
name=$(shell basename $$PWD) && \
|
||||
rpmtopdir="$$(if [ $$(id -u) = 0 ]; then echo /usr/src/packages;\
|
||||
else echo $$PWD/rpmbuilddir; fi)" && \
|
||||
$(MAKE) dist-gzip && \
|
||||
rm -rf $${rpmtopdir} && \
|
||||
mkdir -p $${rpmtopdir}/{BUILD,RPMS,SOURCES,SPECS,SRPMS} && \
|
||||
cp $${name}-$(VERSION).tar.bz2 $${rpmtopdir}/SOURCES && \
|
||||
rpmbuild --define="%_topdir $${rpmtopdir}" \
|
||||
--define="%rpm_version $(VERSION)" \
|
||||
--define="%make $(MAKE)" \
|
||||
-ba $${name}.spec && \
|
||||
rm -f $${name}-$(VERSION).tar.bz2
|
||||
|
||||
clean:
|
||||
cd $(SCSTADMIN_DIR) && $(MAKE) $@
|
||||
|
||||
|
||||
78
scstadmin/scstadmin.spec
Normal file
78
scstadmin/scstadmin.spec
Normal file
@@ -0,0 +1,78 @@
|
||||
Name: scstadmin
|
||||
Version: %{rpm_version}
|
||||
Release: 1
|
||||
Summary: SCST configuration tool
|
||||
Group: Productivity/Networking/Other
|
||||
License: GPLv2
|
||||
Vendor: http://scst.sourceforge.net/
|
||||
URL: http://scst.sourceforge.net/
|
||||
BuildRequires: make perl
|
||||
|
||||
Source: %{name}-%{version}.tar.bz2
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
AutoReqProv: yes
|
||||
|
||||
%description
|
||||
A tool for configuring SCST via the SCST sysfs interface. Allows to save,
|
||||
restore and modify any aspect of the SCST configuration. An extensive set of
|
||||
commands is available to modify any configurable parameter of target drivers,
|
||||
target ports, SCST devices, LUNs, initiator groups and ALUA configuration
|
||||
information.
|
||||
|
||||
Authors:
|
||||
--------
|
||||
Mark R. Buechler, Bart Van Assche and others
|
||||
|
||||
%define scstadmin_perl_installsiteman3dir \
|
||||
%(perl -V:installsiteman3dir | sed "s|.*='||;s|'.*||")
|
||||
%define scstadmin_perl_process_packlist \
|
||||
set -x;\
|
||||
if test -n "$RPM_BUILD_ROOT" -a -d $RPM_BUILD_ROOT%perl_vendorarch/auto; then \
|
||||
find $RPM_BUILD_ROOT%perl_vendorarch/auto -name .packlist -print0 | \
|
||||
xargs -0 -r rm; \
|
||||
if [ %{_target_cpu} == noarch ]; then \
|
||||
find $RPM_BUILD_ROOT%perl_vendorarch/auto -depth -type d -print0 | \
|
||||
xargs -0 -r rmdir; \
|
||||
fi; \
|
||||
fi; \
|
||||
rm -f $RPM_BUILD_ROOT%{perl_archlib}/perllocal.pod; set +x
|
||||
|
||||
%prep
|
||||
|
||||
%setup -q
|
||||
|
||||
%build
|
||||
export PREFIX=%{_prefix} DESTDIR=%{buildroot} MANDIR=%{buildroot}%{_mandir}
|
||||
%{make}
|
||||
|
||||
%install
|
||||
export PREFIX=%{_prefix} DESTDIR=%{buildroot} MANDIR=%{buildroot}%{_mandir}
|
||||
%{make} install
|
||||
%scstadmin_perl_process_packlist
|
||||
rm -rf %{buildroot}/var/adm/perl-modules/scst
|
||||
|
||||
%clean
|
||||
rm -rf %{buildroot}
|
||||
|
||||
%pre
|
||||
rm -f /usr/local/sbin/scstadmin
|
||||
rm -f /usr/local/man/man1/scstadmin.1*
|
||||
rm -f /usr/local/man/man3/SCST::SCST.3pm*
|
||||
rm -f /usr/local/man/man5/scst.5*
|
||||
rm -f /usr/local/man/man5/scst.conf.5*
|
||||
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
%config(noreplace) /etc/default/scst
|
||||
/etc/init.d/scst
|
||||
%{_sbindir}/scstadmin
|
||||
%{perl_sitelib}/SCST
|
||||
%{perl_sitearch}/auto/SCST-SCST
|
||||
%{_mandir}/man1/scstadmin.1*
|
||||
%{scstadmin_perl_installsiteman3dir}/SCST::SCST.3pm*
|
||||
%{_mandir}/man5/scst.5*
|
||||
%{_mandir}/man5/scst.conf.5*
|
||||
|
||||
%changelog
|
||||
* Fri Oct 04 2013 Bart Van Assche <bvanassche@acm.org>
|
||||
- Initial spec file.
|
||||
@@ -10,7 +10,7 @@ SBINDIR := $(PREFIX)/sbin
|
||||
all: perl-module
|
||||
|
||||
install: all
|
||||
$(MAKE) -C scst-$(MODULE_VERSION) install
|
||||
$(MAKE) -C scst-$(MODULE_VERSION) install DESTDIR=$(DESTDIR)
|
||||
install -d $(DESTDIR)$(SBINDIR)
|
||||
install -m 755 $(TOOL) $(DESTDIR)$(SBINDIR)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user