From: sagi@grimberg.me (Sagi Grimberg)
Subject: [PATCH RFC nvme-cli 2/2] nvme.spec: generate hostnqn file on install and remove on uninstall
Date: Sun, 6 Nov 2016 21:13:01 +0200 [thread overview]
Message-ID: <1478459581-22654-3-git-send-email-sagi@grimberg.me> (raw)
In-Reply-To: <1478459581-22654-1-git-send-email-sagi@grimberg.me>
Signed-off-by: Sagi Grimberg <sagi at grimberg.me>
---
nvme.spec.in | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/nvme.spec.in b/nvme.spec.in
index a4718773a962..e95810995395 100644
--- a/nvme.spec.in
+++ b/nvme.spec.in
@@ -33,6 +33,20 @@ make install DESTDIR=%{buildroot} PREFIX=/usr
%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
+ year_month=$(date | awk '{print $6"-"$3}')
+ uuid=$(cat /proc/sys/kernel/random/uuid)
+ echo "nqn.$year_month.org.nvmexpress:NVMf:uuid:$uuid" > /etc/nvme/hostnqn
+ fi
+fi
+
+%preun
+if [ "$1" = "remove" ]; then
+ rm -rf /etc/nvme
+fi
%changelog
* Thu Oct 15 2015 Keith Busch <keith.busch at intel.com>
- Initial RPM spec
--
2.7.4
next prev parent reply other threads:[~2016-11-06 19:13 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-06 19:12 [PATCH RFC nvme-cli 0/2] auto generate hostnqn file on installation Sagi Grimberg
2016-11-06 19:13 ` [PATCH RFC nvme-cli 1/2] debain: generate hostnqn file on install and remove on uninstall Sagi Grimberg
2016-11-06 19:25 ` Christoph Hellwig
2016-11-06 21:41 ` Sagi Grimberg
2016-11-14 14:55 ` Gabriel Krisman Bertazi
2016-11-06 19:13 ` Sagi Grimberg [this message]
2016-11-07 8:36 ` [PATCH RFC nvme-cli 2/2] nvme.spec: " Johannes Thumshirn
2016-11-08 10:31 ` Sagi Grimberg
2016-11-08 10:42 ` Johannes Thumshirn
2016-11-07 20:25 ` J Freyensee
2016-11-08 10:29 ` Sagi Grimberg
2016-11-06 19:24 ` [PATCH RFC nvme-cli 0/2] auto generate hostnqn file on installation Christoph Hellwig
2016-11-06 21:36 ` Sagi Grimberg
2016-11-07 20:34 ` J Freyensee
2016-11-08 10:30 ` Sagi Grimberg
2016-11-08 17:11 ` J Freyensee
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1478459581-22654-3-git-send-email-sagi@grimberg.me \
--to=sagi@grimberg.me \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).