1 %define name lxc-sliceimage
5 %define release %{taglevel}%{?pldistro:.%{pldistro}}%{?date:.%{date}}
8 Packager: PlanetLab Central <support@planet-lab.org>
9 Distribution: PlanetLab %{plrelease}
12 Summary: lxc-specific node code for slice families
16 Source0: %{name}-%{version}.tar.bz2
18 Group: Applications/System
19 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
21 Requires: nodemanager-lxc >= 5.2-3
26 A simple package to deploy reference images for lxc
34 rm -rf $RPM_BUILD_ROOT
35 install -D -m 755 bin/lxc-sliceimage ${RPM_BUILD_ROOT}/%{_bindir}/lxc-sliceimage
36 install -D -m 644 systemd/lxc-sliceimage.service ${RPM_BUILD_ROOT}/usr/lib/systemd/system/lxc-sliceimage.service
37 install -D -m 644 cron.d/lxc-sliceimage $RPM_BUILD_ROOT/%{_sysconfdir}/cron.d/lxc-sliceimage
38 install -D -m 644 logrotate/lxc-sliceimage $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d/lxc-sliceimage
39 install -D -m 644 lxc_template.xml $RPM_BUILD_ROOT/vservers/.lvref/lxc_template.xml
42 rm -rf $RPM_BUILD_ROOT
45 %{_bindir}/lxc-sliceimage
46 /usr/lib/systemd/system/lxc-sliceimage.service
47 %{_sysconfdir}/cron.d/lxc-sliceimage
48 %{_sysconfdir}/logrotate.d/lxc-sliceimage
51 # observed on a f23 node on jan-15-2016
52 # it feels like this call to restarting the service does not trigger
54 # the daily crontab job should save the day though
55 # also just in case, we don't anymore disable the service when uninstalling either
57 systemctl enable lxc-sliceimage.service
58 if [ "$PL_BOOTCD" != "1" ] ; then
59 systemctl restart lxc-sliceimage.service
62 # Randomize daily run time
63 M=$((60 * $RANDOM / 32768))
64 H=$((24 * $RANDOM / 32768))
65 sed -i -e "s/@M@/$M/" -e "s/@H@/$H/" %{_sysconfdir}/cron.d/lxc-sliceimage