]>
Commit | Line | Data |
---|---|---|
289fa4b8 ER |
1 | # NOTE: |
2 | # - release notes: https://github.com/mitchellh/vagrant/blob/master/CHANGELOG.md | |
d9278297 ER |
3 | # |
4 | # Conditional build: | |
5 | %bcond_without vagrant # build vagrant package | |
6 | ||
2f2a2f85 ER |
7 | Summary: Provisioning and deployment of virtual instances |
8 | Name: vagrant | |
77d9f457 | 9 | Version: 1.1.2 |
062cfa5f | 10 | Release: 0.16 |
2f2a2f85 ER |
11 | License: MIT |
12 | Group: Applications/Emulators | |
13 | URL: http://vagrantup.com/ | |
77d9f457 ER |
14 | Source0: http://files.vagrantup.com/packages/67bd4d30f7dbefa7c0abc643599f0244986c38c8/vagrant_i686.rpm?/%{name}-%{version}.i686.rpm |
15 | # Source0-md5: 83093a71588f97a9eb69fa7fe07418b9 | |
16 | Source1: http://files.vagrantup.com/packages/67bd4d30f7dbefa7c0abc643599f0244986c38c8/vagrant_x86_64.rpm?/%{name}-%{version}.x86_64.rpm | |
17 | # Source1-md5: 3efa3ac73988c565e6b3236da6867557 | |
062cfa5f ER |
18 | Source2: https://raw.github.com/mitchellh/vagrant/master/keys/%{name}.pub |
19 | # Source2-md5: b440b5086dd12c3fd8abb762476b9f40 | |
bf59fba0 ER |
20 | Patch0: https://github.com/glensc/vagrant/commit/bd8a24e945a26dbae418680d570d33dced910088.patch |
21 | # Patch0-md5: 15aeb8e5fe95457bc0040035c3801541 | |
d9278297 | 22 | BuildRequires: bash |
f27e06d0 | 23 | BuildRequires: file |
376b9a6d ER |
24 | BuildRequires: pkgconfig |
25 | BuildRequires: rpm-pythonprov | |
32f7fb06 | 26 | BuildRequires: rpm-utils |
376b9a6d | 27 | BuildRequires: ruby |
a08aa0c6 | 28 | BuildRequires: sed >= 4.0 |
376b9a6d | 29 | BuildRequires: which |
32f7fb06 ER |
30 | ExclusiveArch: %{ix86} %{x8664} |
31 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
32 | ||
33 | %define _appdir %{_libdir}/%{name} | |
34 | ||
d9278297 | 35 | %define vg_home /home/vagrant |
289fa4b8 | 36 | %define vg_root /vagrant |
d9278297 | 37 | |
32f7fb06 | 38 | %define no_install_post_check_so 1 |
2f2a2f85 ER |
39 | |
40 | %description | |
41 | Vagrant offers scripted provisioning and deployment of virtual | |
42 | instances. While VirtualBox is the main target, future versions may | |
43 | support other hypervizors as well. | |
44 | ||
45 | The vision of the project is to create a tool to transparently manage | |
46 | all the complex parts of modern development within a virtual | |
47 | environment without affecting the everyday workflow of the developer | |
48 | too much. A long term goal is moving all development into virtualized | |
49 | environments by making it easier to do so than not to. Additionally, | |
50 | work is ongoing to have Vagrant run identically on every major | |
51 | consumer OS platform (Linux, Mac OS X, and Windows). | |
52 | ||
ff67adbf ER |
53 | %package -n bash-completion-%{name} |
54 | Summary: bash-completion for %{name} | |
55 | Group: Applications/Shells | |
56 | Requires: %{name} | |
57 | Requires: bash-completion | |
58 | %if "%{_rpmversion}" >= "5" | |
59 | BuildArch: noarch | |
60 | %endif | |
61 | ||
62 | %description -n bash-completion-%{name} | |
63 | bash-completion for %{name}. | |
64 | ||
d9278297 ER |
65 | %package guest |
66 | Summary: Vagrant guest | |
67 | Group: Development/Building | |
062cfa5f | 68 | URL: http://docs-v1.vagrantup.com/v1/docs/base_boxes.html |
d9278297 ER |
69 | Requires(postun): /usr/sbin/userdel |
70 | Requires(pre): /bin/id | |
71 | Requires(pre): /usr/bin/getgid | |
72 | Requires(pre): /usr/sbin/groupadd | |
73 | Requires(pre): /usr/sbin/useradd | |
bf59fba0 | 74 | Requires: /etc/pld-release |
062cfa5f | 75 | Requires: kernel(vboxsf) |
d9278297 | 76 | Requires: openssh-server |
062cfa5f | 77 | Requires: sudo |
d9278297 ER |
78 | Provides: group(vagrant) |
79 | Provides: user(vagrant) | |
80 | %if "%{_rpmversion}" >= "5" | |
81 | BuildArch: noarch | |
82 | %endif | |
83 | ||
84 | %description guest | |
85 | This is the package to be installed in Vagrant guest. | |
86 | ||
87 | WARNING: This package installs insecure keypair to vagant user. Do not | |
88 | install this package in a box that is accessible others but you. | |
89 | ||
90 | These keys are the "insecure" public/private keypair we offer to base | |
91 | box creators for use in their base boxes so that vagrant installations | |
92 | can automatically SSH into the boxes. | |
93 | ||
94 | See: <https://github.com/mitchellh/vagrant/tree/master/keys/>. | |
95 | ||
2f2a2f85 ER |
96 | %package doc |
97 | Summary: Documentation for %{name} | |
98 | Group: Documentation | |
99 | Requires: %{name} = %{version}-%{release} | |
100 | %if "%{_rpmversion}" >= "5" | |
101 | BuildArch: noarch | |
102 | %endif | |
103 | ||
104 | %description doc | |
105 | Ruby documentation for %{gem_name} | |
106 | ||
107 | %prep | |
32f7fb06 ER |
108 | %setup -qcT |
109 | %ifarch %{ix86} | |
110 | SOURCE=%{S:0} | |
111 | %endif | |
112 | %ifarch %{x8664} | |
113 | SOURCE=%{S:1} | |
114 | %endif | |
2f2a2f85 | 115 | |
32f7fb06 ER |
116 | V=$(rpm -qp --nodigest --nosignature --qf '%{V}' $SOURCE) |
117 | test "$V" = "%{version}" | |
32f7fb06 | 118 | rpm2cpio $SOURCE | cpio -i -d |
2f2a2f85 | 119 | |
32f7fb06 | 120 | mv opt/vagrant/* . |
e61ff64e ER |
121 | |
122 | # causes chrpath on th-i686 to fail | |
123 | rm embedded/rgloader/rgloader*.freebsd*.so | |
124 | %ifarch %{ix86} | |
125 | rm embedded/rgloader/rgloader*.x86_64.so | |
126 | %endif | |
127 | ||
bf59fba0 ER |
128 | cd embedded/gems/gems/vagrant-%{version} |
129 | %patch0 -p1 | |
2f2a2f85 | 130 | |
f27e06d0 ER |
131 | %build |
132 | # update RPATH, not to contain insecure /tmp/vagrant-temp/embedded (insecure, | |
133 | # because /tmp is world writable dir) for the rest, just substitute with sed | |
134 | # (so shebangs would be correct) | |
135 | grep -r '/tmp/vagrant-temp/embedded' . -l | xargs -r file -i | while read path mime; do | |
136 | path=${path%:} | |
137 | case "$mime" in | |
138 | text/*) | |
139 | sed -i -e 's,/tmp/vagrant-temp/embedded,%{_appdir}/embedded,' "$path" | |
140 | ;; | |
141 | application/x-executable*|application/x-sharedlib*) | |
142 | rpath=$(chrpath -l $path) || continue | |
143 | rpath=${rpath#$path: RPATH=} | |
144 | [ "$rpath" ] || continue | |
145 | ||
146 | case "$rpath" in | |
147 | '${ORIGIN}/../lib:/tmp/vagrant-temp/embedded/lib' | \ | |
148 | '/tmp/vagrant-temp/embedded/lib:${ORIGIN}/../lib') | |
149 | rpath=%{_appdir}/embedded/lib | |
150 | chrpath -r "$rpath" $path | |
151 | ;; | |
152 | esac | |
153 | ;; | |
154 | esac | |
155 | done | |
a08aa0c6 | 156 | |
2f2a2f85 ER |
157 | %install |
158 | rm -rf $RPM_BUILD_ROOT | |
d9278297 | 159 | %if %{with vagrant} |
32f7fb06 | 160 | install -d $RPM_BUILD_ROOT{%{_bindir},%{_appdir}} |
32f7fb06 ER |
161 | cp -a bin embedded $RPM_BUILD_ROOT%{_appdir} |
162 | ln -s %{_appdir}/bin/%{name} $RPM_BUILD_ROOT%{_bindir} | |
d9278297 ER |
163 | %endif |
164 | ||
062cfa5f ER |
165 | cd $RPM_BUILD_ROOT%{_appdir}/embedded/gems/gems/vagrant-%{version} |
166 | ||
ff67adbf | 167 | install -d $RPM_BUILD_ROOT/etc/bash_completion.d |
062cfa5f | 168 | mv contrib/bash/completion.sh $RPM_BUILD_ROOT/etc/bash_completion.d/%{name}.sh |
ff67adbf | 169 | |
d9278297 | 170 | # guest |
289fa4b8 | 171 | install -d $RPM_BUILD_ROOT{%{vg_root},%{vg_home}/.ssh} |
d9278297 | 172 | cp -a /etc/skel/.bash* $RPM_BUILD_ROOT%{vg_home} |
2f2a2f85 | 173 | |
062cfa5f ER |
174 | # Since Vagrant only supports key-based authentication for SSH, we must |
175 | # set up the vagrant user to use key-based authentication. We can get the | |
176 | # public key used by the Vagrant gem directly from its Github repository. | |
177 | mv keys/vagrant.pub $RPM_BUILD_ROOT%{vg_home}/.ssh/authorized_keys | |
178 | ||
2f2a2f85 ER |
179 | %clean |
180 | rm -rf $RPM_BUILD_ROOT | |
181 | ||
d9278297 ER |
182 | %pre guest |
183 | # FIXME: register user in uid_gid.db.txt | |
184 | %groupadd -g 2000 vagrant | |
185 | %useradd -u 2000 -g vagrant -G wheel -c "Vagrant user" -s /bin/bash -d %{vg_home} vagrant | |
186 | ||
187 | %postun guest | |
188 | if [ "$1" = "0" ]; then | |
189 | %userremove vagrant | |
190 | %groupremove vagrant | |
191 | fi | |
192 | ||
193 | %if %{with vagrant} | |
2f2a2f85 ER |
194 | %files |
195 | %defattr(644,root,root,755) | |
196 | %attr(755,root,root) %{_bindir}/vagrant | |
2f2a2f85 | 197 | |
32f7fb06 ER |
198 | %defattr(-,root,root,-) |
199 | %{_appdir} | |
d9278297 ER |
200 | %endif |
201 | ||
ff67adbf ER |
202 | %files -n bash-completion-%{name} |
203 | %defattr(644,root,root,755) | |
204 | /etc/bash_completion.d/* | |
205 | ||
d9278297 ER |
206 | %files guest |
207 | %defattr(644,root,root,755) | |
208 | %dir %attr(750,vagrant,vagrant) %{vg_home} | |
209 | %dir %attr(700,vagrant,vagrant) %{vg_home}/.ssh | |
062cfa5f | 210 | %attr(600,vagrant,vagrant) %config(noreplace) %verify(not md5 mtime size) %{vg_home}/.ssh/authorized_keys |
d9278297 | 211 | %dir %attr(640,vagrant,vagrant) %{vg_home}/.bash* |
289fa4b8 | 212 | %dir %attr(700,root,root) %{vg_root} |
32f7fb06 ER |
213 | |
214 | %if 0 | |
2f2a2f85 ER |
215 | %files doc |
216 | %defattr(644,root,root,755) | |
217 | %doc %{gem_docdir} | |
32f7fb06 | 218 | %endif |