lxc-sliceimage - formerly an initscript - becomes a regular script in /usr/bin
a new systemd service unit file comes as a replacement to the former initscript
cron script adapted
# Copyright (C) 2006 The Trustees of Princeton University
#
# Copyright (C) 2006 The Trustees of Princeton University
#
-@M@ @H@ * * * root /etc/init.d/lxc-sliceimage start >/dev/null 2>&1
+@M@ @H@ * * * root /usr/bin/lxc-sliceimage start >/dev/null 2>&1
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
Requires: btrfs-progs
Requires: nodemanager-lxc >= 5.2-3
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
Requires: btrfs-progs
Requires: nodemanager-lxc >= 5.2-3
BuildArch: noarch
%description
BuildArch: noarch
%description
%install
rm -rf $RPM_BUILD_ROOT
%install
rm -rf $RPM_BUILD_ROOT
-install -D -m 755 initscripts/lxc-sliceimage ${RPM_BUILD_ROOT}/%{_initrddir}/lxc-sliceimage
+install -D -m 755 bin/lxc-sliceimage ${RPM_BUILD_ROOT}/%{_bindir}/lxc-sliceimage
+install -D -m 644 systemd/lxc-sliceimage.service ${RPM_BUILD_ROOT}/usr/lib/systemd/system/lxc-sliceimage.service
install -D -m 644 cron.d/lxc-sliceimage $RPM_BUILD_ROOT/%{_sysconfdir}/cron.d/lxc-sliceimage
install -D -m 644 logrotate/lxc-sliceimage $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d/lxc-sliceimage
install -D -m 644 lxc_template.xml $RPM_BUILD_ROOT/vservers/.lvref/lxc_template.xml
install -D -m 644 cron.d/lxc-sliceimage $RPM_BUILD_ROOT/%{_sysconfdir}/cron.d/lxc-sliceimage
install -D -m 644 logrotate/lxc-sliceimage $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d/lxc-sliceimage
install -D -m 644 lxc_template.xml $RPM_BUILD_ROOT/vservers/.lvref/lxc_template.xml
rm -rf $RPM_BUILD_ROOT
%files
rm -rf $RPM_BUILD_ROOT
%files
-%{_initrddir}/lxc-sliceimage
+%{_bindir}/lxc-sliceimage
+/lib/systemd/system/lxc-sliceimage.service
%{_sysconfdir}/cron.d/lxc-sliceimage
%{_sysconfdir}/logrotate.d/lxc-sliceimage
/vservers/.lvref
%post
%{_sysconfdir}/cron.d/lxc-sliceimage
%{_sysconfdir}/logrotate.d/lxc-sliceimage
/vservers/.lvref
%post
-chkconfig --add lxc-sliceimage
-chkconfig lxc-sliceimage on
+systemctl enable lxc-sliceimage.service
+if [ "$PL_BOOTCD" != "1" ] ; then
+ systemctl restart lxc-sliceimage.service
+fi
+
+%preun
+# 0 = erase, 1 = upgrade
+if [ $1 -eq 0 ] ; then
+ systemctl disable lxc-sliceimage.service
+fi
+
# Randomize daily run time
M=$((60 * $RANDOM / 32768))
H=$((24 * $RANDOM / 32768))
# Randomize daily run time
M=$((60 * $RANDOM / 32768))
H=$((24 * $RANDOM / 32768))
--- /dev/null
+[Unit]
+Description=LXC Sliceimage service
+Before=nm.service
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/lxc-sliceimage start
+ExecStop=/usr/bin/lxc-sliceimage stop
+ExecReload=/usr/bin/lxc-sliceimage reload
+
+[Install]
+WantedBy=multi-user.target