[spindown] Replaced sysvinitscript with a systemd unit
Martin Cermak
mcermak at fedoraproject.org
Thu Jan 26 17:49:35 UTC 2012
commit e8ee4fc44c73eafa9ff14d61817465a6f18ebbac
Author: Martin Cermak <mcermak at redhat.com>
Date: Thu Jan 26 17:48:45 2012 +0100
Replaced sysvinitscript with a systemd unit
spindown-0.4.0-Makefile.patch | 15 ++++++++-------
spindown.service | 11 +++++++++++
spindown.spec | 20 +++++++++++---------
3 files changed, 30 insertions(+), 16 deletions(-)
---
diff --git a/spindown-0.4.0-Makefile.patch b/spindown-0.4.0-Makefile.patch
index 9086635..6c43968 100644
--- a/spindown-0.4.0-Makefile.patch
+++ b/spindown-0.4.0-Makefile.patch
@@ -1,12 +1,13 @@
diff --git a/Makefile b/Makefile
-index 6eee8b8..7e38620 100644
+index 6eee8b8..793059e 100644
--- a/Makefile
+++ b/Makefile
-@@ -1,18 +1,16 @@
+@@ -1,18 +1,17 @@
-SBINDIR = $(DESTDIR)/sbin
-+#SBINDIR = $(DESTDIR)/sbin
++SYSTEMDDIR = $(DESTDIR)/lib/systemd/system
+SBINDIR = $(DESTDIR)/usr/sbin
ETCDIR = $(DESTDIR)/etc
++
VERSION = 0.4.0
-OBJS = main.o diskset.o disk.o spindown.o iniparser.o dictionary.o log.o spindownd.o\
- exceptions.o
@@ -25,7 +26,7 @@ index 6eee8b8..7e38620 100644
@echo "---"
clean:
-@@ -20,47 +18,14 @@ clean:
+@@ -20,47 +19,14 @@ clean:
install: all
install -D -m 755 spindownd $(SBINDIR)/spindownd
@@ -48,7 +49,7 @@ index 6eee8b8..7e38620 100644
- ln -s ../init.d/spindown $(ETCDIR)/rc3.d/S20spindown
- ln -s ../init.d/spindown $(ETCDIR)/rc4.d/S20spindown
- ln -s ../init.d/spindown $(ETCDIR)/rc5.d/S20spindown
-+ install -D -m 755 spindown $(ETCDIR)/rc.d/init.d/spindown
++ install -D -m 644 spindown.service $(SYSTEMDDIR)/spindown.service
+ install -D -m 644 spindown.conf.example $(ETCDIR)/spindown.conf
uninstall:
@@ -69,7 +70,7 @@ index 6eee8b8..7e38620 100644
- cp CHANGELOG README COPYING TODO spindown spindown.conf.example Makefile $(SRCDIR)
- tar -czf $(SRCDIR).tar.gz $(SRCDIR)/*
- rm -d -r -f $(SRCDIR)
-+ rm $(ETCDIR)/spindown.conf $(ETCDIR)/rc.d/init.d/spindown $(SBINDIR)/spindownd
++ rm $(ETCDIR)/spindown.conf $(SYSTEMDDIR)/spindown.service $(SBINDIR)/spindownd
spindownd: $(OBJS)
- g++ $(CFLAGS) -o spindownd $(OBJS)
@@ -77,7 +78,7 @@ index 6eee8b8..7e38620 100644
main.o: $(SRC)main.cpp $(SRC)general.h
g++ $(CFLAGS) -c $(SRC)main.cpp
-@@ -83,8 +48,3 @@ log.o: $(SRC)log.cpp $(SRC)log.h $(SRC)general.h
+@@ -83,8 +49,3 @@ log.o: $(SRC)log.cpp $(SRC)log.h $(SRC)general.h
exceptions.o: $(SRC)exceptions.cpp $(SRC)exceptions.h $(SRC)general.h
g++ $(CFLAGS) -c $(SRC)exceptions.cpp
diff --git a/spindown.service b/spindown.service
new file mode 100644
index 0000000..e1bd4ae
--- /dev/null
+++ b/spindown.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Daemon that can spindown idle disks
+After=syslog.target
+
+[Service]
+Type=forking
+ExecStart=/usr/sbin/spindownd -d -f /var/run/spindown.status -c /etc/spindown.conf -p /var/run/spindownd.pid
+
+[Install]
+WantedBy=multi-user.target
+
diff --git a/spindown.spec b/spindown.spec
index 9261df8..364d6dd 100644
--- a/spindown.spec
+++ b/spindown.spec
@@ -1,21 +1,20 @@
Summary: Daemon that can spin idle disks down
Name: spindown
Version: 0.4.0
-Release: 4%{?dist}
+Release: 5%{?dist}
License: GPLv3+
Group: System Environment/Daemons
Url: http://code.google.com/p/spindown
Source0: http://spindown.googlecode.com/files/spindown-%{version}.tar.gz
-Source1: spindown-fedora-initscript.sh
+Source1: spindown.service
Patch0: spindown-0.4.0-Makefile.patch
Patch1: spindown-0.4.0-iniparser.patch
-Requires(post): chkconfig
-Requires(preun): chkconfig
-Requires(preun): initscripts
+Requires(preun): systemd-units
BuildRequires: iniparser-devel
+BuildRequires: systemd-units
%description
Spindown is a daemon that can spin idle disks down and thus save energy and
@@ -29,7 +28,7 @@ matter if the disk is swapped while the daemon is running.
%prep
%setup -q
rm -rf src/ininiparser3.0b
-cp -pf %{SOURCE1} spindown
+cp -pf %{SOURCE1} spindown.service
%patch0 -p1
%patch1 -p1
@@ -44,18 +43,21 @@ make DESTDIR="$RPM_BUILD_ROOT" install
%preun
if [ "$1" = 0 ]; then
- /sbin/service %{name} stop
- /sbin/chkconfig --del %{name}
+ /bin/systemctl stop spindown.service
+ /bin/systemctl disable spindown.service
fi
%files
%defattr(-,root,root,-)
%doc COPYING CHANGELOG README
-%{_initddir}/spindown
+%{_unitdir}/spindown.service
%{_sbindir}/spindownd
%config(noreplace) %{_sysconfdir}/spindown.conf
%changelog
+* Thu Jan 26 2012 Martin Cermak <mcermak at redhat.com> 0.4.0-5
+- Replaced sysvinitscript with a systemd unit
+
* Sat Jan 14 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.4.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
More information about the scm-commits
mailing list