Setting tag sliceimage-5.1-12
[vserver-reference.git] / lxc-sliceimage.spec
1 %define name lxc-sliceimage
2 %define version 5.1
3 %define taglevel 12
4
5 %define release %{taglevel}%{?pldistro:.%{pldistro}}%{?date:.%{date}}
6
7 Vendor: PlanetLab
8 Packager: PlanetLab Central <support@planet-lab.org>
9 Distribution: PlanetLab %{plrelease}
10 URL: %{SCMURL}
11
12 Summary: lxc-specific node code for slice families
13 Name: %{name}
14 Version: %{version}
15 Release: %{release}
16 Source0: %{name}-%{version}.tar.bz2
17 License: GPL
18 Group: Applications/System
19 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
20 Requires: btrfs-progs
21 Requires: nodemanager-lxc >= 5.2-3
22 Requires: systemd
23 BuildArch: noarch
24
25 %description
26 A simple package to deploy reference images for lxc
27
28 %prep
29 %setup -q
30
31 %build
32
33 %install
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
40
41 %clean
42 rm -rf $RPM_BUILD_ROOT
43
44 %files
45 %{_bindir}/lxc-sliceimage
46 /usr/lib/systemd/system/lxc-sliceimage.service
47 %{_sysconfdir}/cron.d/lxc-sliceimage
48 %{_sysconfdir}/logrotate.d/lxc-sliceimage
49 /vservers/.lvref
50
51 # observed on a f23 node on jan-15-2016
52 # it feels like this call to restarting the service does not trigger
53 # or not reliably
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
56 %post
57 systemctl enable lxc-sliceimage.service
58 if [ "$PL_BOOTCD" != "1" ] ; then
59    systemctl restart lxc-sliceimage.service
60 fi
61
62 # Randomize hourly run time (used to be daily)
63 #H=$((24 * $RANDOM / 32768))
64 #sed -i -e "s/@M@/$M/" -e "s/@H@/$H/" %{_sysconfdir}/cron.d/lxc-sliceimage
65 M=$((60 * $RANDOM / 32768))
66 sed -i -e "s/@M@/$M/" %{_sysconfdir}/cron.d/lxc-sliceimage