]> git.pld-linux.org Git - packages/lxd.git/blob - lxd.spec
cef404cf067becfe1929cc35928ed772b4a0e028
[packages/lxd.git] / lxd.spec
1 # TODO
2 # - lxdbr0 interface setup for systemd
3
4 Summary:        Fast, dense and secure container management
5 Name:           lxd
6 Version:        2.1
7 Release:        0.3
8 License:        Apache v2.0
9 Group:          Applications/System
10 Source0:        https://linuxcontainers.org/downloads/lxd/%{name}-%{version}.tar.gz
11 # Source0-md5:  535d78758d3ca3542326eb6f3e072ccf
12 Source1:        %{name}.service
13 Source2:        %{name}.init
14 Source3:        %{name}br.init
15 Source4:        %{name}.sysconfig
16 Source5:        %{name}.sh
17 URL:            http://linuxcontainers.org/
18 %ifarch %{x8664} arm aarch64 ppc64
19 BuildRequires:  criu-devel >= 1.7
20 %endif
21 BuildRequires:  golang >= 1.5
22 BuildRequires:  lxc-devel >= 1.1
23 BuildRequires:  pkgconfig
24 BuildRequires:  rpmbuild(macros) >= 1.228
25 Requires(post,preun):   /sbin/chkconfig
26 Requires(postun):       /usr/sbin/groupdel
27 Requires(pre):  /usr/bin/getgid
28 Requires(pre):  /usr/sbin/groupadd
29 Requires:       rc-scripts >= 0.4.0.10
30 Requires:       rsync
31 Requires:       squashfs
32 Requires:       iproute2
33 Requires:       uname(release) >= 4.1
34 Provides:       group(lxd)
35 ExclusiveArch:  %{ix86} %{x8664} %{arm}
36 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
37
38 %define         _enable_debug_packages 0
39 %define         gobuild(o:) go build -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n')" -a -v -x %{?**};
40 %define         gopath          %{_libdir}/golang
41 %define         import_path     github.com/lxc/lxd
42 %define         _libexecdir     %{_prefix}/lib
43
44 %description
45 LXD is a container "hypervisor" and a new user experience for LXC.
46
47 Specifically, it is made of three components:
48 - A system-wide daemon (lxd)
49 - A command line client (lxc)
50 - An OpenStack Nova plugin (nova-compute-lxd)
51
52 The daemon exports a REST API both locally and if enabled, over the
53 network.
54
55 The command line tool is designed to be a very simple, yet very
56 powerful tool to manage all your containers. It can handle connect to
57 multiple container hosts and easily give you an overview of all the
58 containers on your network, let you create some more where you want
59 them and even move them around while they are running.
60
61 The OpenStack plugin then allows you to use your lxd hosts as compute
62 nodes, running workloads on containers rather than virtual machines.
63
64 %prep
65 %setup -q
66
67 %build
68 export GOPATH=$(pwd)/dist
69 cd $GOPATH/src/%{import_path}
70
71 %gobuild -o dist/bin/lxd ./lxd
72 %gobuild -o dist/bin/lxc ./lxc
73
74 %install
75 rm -rf $RPM_BUILD_ROOT
76 install -d $RPM_BUILD_ROOT{%{_bindir},%{_sbindir},%{_mandir}/man1,/etc/{rc.d/init.d,sysconfig},%{systemdunitdir}} \
77         $RPM_BUILD_ROOT%{_libexecdir} \    
78         $RPM_BUILD_ROOT/var/lib/%{name}/{containers,devices,devlxd,images,security,shmounts,snapshots} \
79         $RPM_BUILD_ROOT/var/log/%{name}
80
81 # lxd refuses to start containter without this directory
82 install -d $RPM_BUILD_ROOT%{_libdir}/%{name}/rootfs
83
84 install -p dist/bin/lxd $RPM_BUILD_ROOT%{_sbindir}
85 install -p dist/bin/lxc $RPM_BUILD_ROOT%{_bindir}
86
87 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{systemdunitdir}
88 install -p %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
89 install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}br
90 cp -p %{SOURCE4} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
91
92 install -p %{SOURCE5} $RPM_BUILD_ROOT%{_libexecdir}/lxd-wrapper
93
94 %pre
95 %groupadd -g 273 %{name}
96
97 %post
98 /sbin/chkconfig --add %{name}br
99 /sbin/chkconfig --add %{name}
100 %service -n %{name} restart
101 %systemd_post %{name}.service
102
103 %preun
104 if [ "$1" = "0" ]; then
105         %service -q %{name} stop
106         %service -q %{name}br stop
107         /sbin/chkconfig --del %{name}
108         /sbin/chkconfig --del %{name}br
109 fi
110 %systemd_preun %{name}.service
111
112 %postun
113 if [ "$1" = "0" ]; then
114         %groupremove %{name}
115 fi
116 %systemd_reload
117
118 %clean
119 rm -rf $RPM_BUILD_ROOT
120
121 %files
122 %defattr(644,root,root,755)
123 %doc README.md CONTRIBUTING.md AUTHORS doc/*
124 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
125 %attr(754,root,root) /etc/rc.d/init.d/%{name}
126 %attr(754,root,root) /etc/rc.d/init.d/%{name}br
127 %attr(755,root,root) %{_bindir}/lxc
128 %attr(755,root,root) %{_sbindir}/lxd
129 %{systemdunitdir}/%{name}.service
130 %dir %attr(750,root,root) %{_libdir}/%{name}
131 %dir %attr(750,root,root) %{_libdir}/%{name}/rootfs
132 %attr(750,root,root) %{_libexecdir}/%{name}-wrapper
133 %dir %attr(750,root,logs) /var/log/%{name}
134 %dir %attr(711,root,root) /var/lib/%{name}
135 %dir %attr(711,root,root) /var/lib/%{name}/containers
136 %dir %attr(700,root,root) /var/lib/%{name}/devices
137 %dir %attr(700,root,root) /var/lib/%{name}/devlxd
138 %dir %attr(700,root,root) /var/lib/%{name}/images
139 %dir %attr(700,root,root) /var/lib/%{name}/security
140 %dir %attr(711,root,root) /var/lib/%{name}/shmounts
141 %dir %attr(700,root,root) /var/lib/%{name}/snapshots
This page took 0.046752 seconds and 2 git commands to generate.