linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: sagi@grimberg.me (Sagi Grimberg)
Subject: [PATCH RFC nvme-cli 1/2] debain: generate hostnqn file on install and remove on uninstall
Date: Sun,  6 Nov 2016 21:13:00 +0200	[thread overview]
Message-ID: <1478459581-22654-2-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>
---
 debian/postinst | 22 ++++++++++++++++++++++
 debian/prerm    |  5 +++++
 2 files changed, 27 insertions(+)
 create mode 100644 debian/postinst
 create mode 100644 debian/prerm

diff --git a/debian/postinst b/debian/postinst
new file mode 100644
index 000000000000..f0e3aaf8c4d0
--- /dev/null
+++ b/debian/postinst
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+    configure|install)
+	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
+        ;;
+
+    upgrade|abort-upgrade)
+        ;;
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 0
+        ;;
+esac
+exit 0
diff --git a/debian/prerm b/debian/prerm
new file mode 100644
index 000000000000..40c6fea42284
--- /dev/null
+++ b/debian/prerm
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+if [ "$1" = "remove" ]; then
+    rm -rf /etc/nvme
+fi
-- 
2.7.4

  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 ` Sagi Grimberg [this message]
2016-11-06 19:25   ` [PATCH RFC nvme-cli 1/2] debain: generate hostnqn file on install and remove on uninstall Christoph Hellwig
2016-11-06 21:41     ` Sagi Grimberg
2016-11-14 14:55       ` Gabriel Krisman Bertazi
2016-11-06 19:13 ` [PATCH RFC nvme-cli 2/2] nvme.spec: " Sagi Grimberg
2016-11-07  8:36   ` 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-2-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).