From ea59dd32f9d94b8d818afde649f10707e5370d7f Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Wed, 1 Jun 2016 20:28:47 +0200 Subject: [PATCH] add a systemd unit file This restores the configuration when started and clears it when shut down. Signed-off-by: Christoph Hellwig --- debian/control | 2 +- debian/install | 1 + debian/rules | 2 +- nvmet.service | 15 +++++++++++++++ 4 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 nvmet.service diff --git a/debian/control b/debian/control index d8eaa3b..9ba8d0e 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,7 @@ Source: nvmetcli Section: python Priority: optional Maintainer: Christoph Hellwig -Build-Depends: debhelper(>= 8), python, python-setuptools, dh-python +Build-Depends: debhelper(>= 8), python, python-setuptools, dh-python, dh-systemd (>= 1.5) Standards-Version: 3.9.4 Package: nvmetcli diff --git a/debian/install b/debian/install index 33bc693..eb4ad04 100644 --- a/debian/install +++ b/debian/install @@ -1 +1,2 @@ nvmetcli /usr/sbin +nvmet.service /lib/systemd/system diff --git a/debian/rules b/debian/rules index c21e5a2..1869a24 100755 --- a/debian/rules +++ b/debian/rules @@ -8,7 +8,7 @@ export http_proxy = http://127.0.0.1:9 %: - dh $@ --with python2 + dh $@ --with python2 --with systemd override_dh_auto_build: python setup.py build diff --git a/nvmet.service b/nvmet.service new file mode 100644 index 0000000..5c7991e --- /dev/null +++ b/nvmet.service @@ -0,0 +1,15 @@ +[Unit] +Description=Restore NVMe kernel target configuration +Requires=sys-kernel-config.mount +After=sys-kernel-config.mount network.target local-fs.target + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=/usr/sbin/nvmetcli restore +ExecStop=/usr/sbin/nvmetcli clear +SyslogIdentifier=nvmetcli + +[Install] +WantedBy=multi-user.target + -- 2.49.0