forked from linux-nvme/nvme-cli
-
Notifications
You must be signed in to change notification settings - Fork 3
/
nvme.spec.in
59 lines (51 loc) · 1.25 KB
/
nvme.spec.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
Name: nvme
Version: @@VERSION@@
Release: 1%{?dist}
Summary: Core nvme tools
License: GPL
Group: Development/Tools
URL: https://github.com/linux-nvme/nvme-cli/
Source: nvme-@@VERSION@@.tar.gz
Provides: nvme
Requires(post): uuidgen
BuildRoot: %{_tmppath}/%{name}-%{version}-root
%description
NVMe is a fast, scalable, direct attached storage interface. The nvme
cli rpm installs core management tools with minimal dependencies.
%prep
%setup
%build
make
%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=%{buildroot} PREFIX=/usr
%files
%defattr(-,root,root)
%doc Documentation/nvme*.1
%{_sbindir}/nvme
%{_mandir}/man1/nvme*.1*
%{_datadir}/bash_completion.d/nvme
%clean
rm -rf $RPM_BUILD_ROOT
%post
if [ $1 = 1 ]; then # 1 : This package is being installed for the first time
if [ ! -f /etc/nvme/hostnqn ]; then
install -D /dev/null /etc/nvme/hostnqn
echo $(nvme gen-hostnqn) > /etc/nvme/hostnqn
fi
if [ ! -f /etc/nvme/hostid ]; then
uuidgen > /etc/nvme/hostid
fi
fi
%preun
if [ "$1" = "remove" ]; then
if [ -d /etc/nvme ]; then
rm -f /etc/nvme/hostnqn
if [ ! -n "`ls -A /etc/nvme`" ]; then
rm -rf /etc/nvme
fi
fi
fi
%changelog
* Thu Oct 15 2015 Keith Busch <[email protected]>
- Initial RPM spec