├── .gitignore
├── .gitmodules
├── README.md
├── build-scripts
├── 05-meta-openxt-haskell-platform.layer
├── 07-meta-openxt-ocaml-platform.layer
├── 20-xenclient-oe.layer
├── LICENSE
├── README.md
├── build.sh
├── centos
│ ├── build.sh
│ ├── install.sh
│ └── setup.sh
├── clean.sh
├── debian
│ ├── build.sh
│ ├── install.sh
│ └── setup.sh
├── fetch.sh
├── oe
│ ├── build.sh
│ └── setup.sh
├── setup.sh
└── windows
│ ├── build.sh
│ ├── setup.sh
│ └── xmls
│ ├── xml_get_ssh_public_key
│ ├── xmlbuild
│ └── xmlhello
├── build
├── bb
└── conf
│ ├── bblayers.conf
│ └── local.conf-dist
├── build_helpers.sh
├── do_branch.sh
├── do_build.sh
├── do_installer_iso.sh
├── do_sync_xt.sh
├── example-config
├── github
├── clone_organization.sh
├── commit_to_pull_request.sh
├── list_merges.sh
├── list_open_pull_requests.sh
├── list_repos.sh
├── list_teams.sh
├── pr_merger.sh
└── release.sh
├── info_sr.sh
├── manifest
├── merge_src_info.py
├── pkg-xctools
├── README
├── build.sh
├── centos
│ ├── xblanker
│ └── xenstore-agent
├── control
│ ├── control
│ ├── postinst
│ ├── postrm
│ └── prerm
├── copy.sh
├── data
│ └── etc
│ │ ├── X11
│ │ └── Xsession.d
│ │ │ └── 95root_access
│ │ └── init.d
│ │ ├── xblanker
│ │ └── xenstore-agent
├── dkms-2.2.0.3-20.el6.noarch.rpm
├── install.sh
├── udev-rules
│ └── 44-v4v.rules
├── utilities.sh
└── xc-tools.spec
├── setup_build
├── sign_repo.sh
├── sync-xt
├── common.inc
├── description.inc
└── python.inc
├── version
├── version.README
└── windows
├── BuildDaemon
├── callit.sh
├── start.ps1
├── winbuild.cfg
├── winbuildd.bat
├── winbuildd.py
├── xmlhello
└── xmlsample
├── BuildSupport
├── checked-copy.psm1
├── invoke.psm1
├── winbuild-installer.ps1
├── winbuild-stage.ps1
└── winbuild-utils.ps1
├── PackageLibrary.psm1
├── PerformDownload.psm1
├── config
└── sample-config.xml
├── inspectbuildmachine.ps1
├── makecert.bat
├── mkbuildmachine.ps1
├── mkbuildserver.ps1
├── winbuild-all.ps1
└── winbuild-prepare.ps1
/.gitignore:
--------------------------------------------------------------------------------
1 | build/bitbake.lock
2 | build/conf/local.conf
3 | build/conf/sanity_info
4 | build/local.settings
5 | build/manifest
6 | build/oe
7 | build/oeenv
8 | build/pseudodone
9 | build/cache
10 | build/sstate-cache
11 | build/tmp-glibc
12 | build-output/*
13 | .config
14 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "build/repos/openembedded-core"]
2 | path = build/repos/openembedded-core
3 | url = git://git.openembedded.org/openembedded-core
4 | branch = zeus
5 | [submodule "build/repos/bitbake"]
6 | path = build/repos/bitbake
7 | url = git://git.openembedded.org/bitbake.git
8 | branch = 1.44
9 | [submodule "build/repos/meta-java"]
10 | path = build/repos/meta-java
11 | url = git://git.yoctoproject.org/meta-java
12 | branch = zeus
13 | [submodule "build/repos/meta-openembedded"]
14 | path = build/repos/meta-openembedded
15 | url = git://git.openembedded.org/meta-openembedded
16 | branch = zeus
17 | [submodule "build/repos/meta-selinux"]
18 | path = build/repos/meta-selinux
19 | url = git://git.yoctoproject.org/meta-selinux
20 | branch = zeus
21 | [submodule "build/repos/meta-intel"]
22 | path = build/repos/meta-intel
23 | url = git://git.yoctoproject.org/meta-intel
24 | branch = zeus
25 | [submodule "build/repos/meta-virtualization"]
26 | path = build/repos/meta-virtualization
27 | url = git://git.yoctoproject.org/meta-virtualization
28 | branch = zeus
29 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | UNMAINTAINED!!! Please use [bordel](https://github.com/OpenXT/bordel)
2 |
3 | This build system only supports stable-9 and earlier. For xenclient-oe.git as
4 | of [the merging of vGlass](https://github.com/OpenXT/xenclient-oe/commit/8522fd8c43d57c33cece73a26b4c7498f3d8a58d), see
5 | [bordel](https://github.com/OpenXT/bordel)
6 |
7 | See [the OpenXT wiki](https://github.com/openxt/openxt/wiki) for more
8 | information. Specifically, see the [How to build OpenXT
9 | page](https://github.com/OpenXT/openxt/wiki/How-to-build-OpenXT).
10 |
11 |
12 |
--------------------------------------------------------------------------------
/build-scripts/05-meta-openxt-haskell-platform.layer:
--------------------------------------------------------------------------------
1 | openxt_layer_meta_openxt_haskell_platform_name="meta-openxt-haskell-platform"
2 |
3 | # Specify a URL here to avoid using the mirror
4 | #openxt_layer_meta_openxt_haskell_platform_repository="https://github.com/OpenXT/meta-openxt-haskell-platform.git"
5 | # Specify a revision here to freeze the repository
6 | # If not revision is specified, $BRANCH will be used
7 | #openxt_layer_meta_openxt_haskell_platform_revision="master"
8 |
9 | openxt_layer_meta_openxt_haskell_platform_images=( \
10 | #Machine Step Format \
11 | #None
12 | )
13 |
14 | # We append to openxt_layers, so the list will be sorted
15 | # in priority order (01 is the highest priority)
16 | openxt_layers="${openxt_layers} meta_openxt_haskell_platform"
17 |
--------------------------------------------------------------------------------
/build-scripts/07-meta-openxt-ocaml-platform.layer:
--------------------------------------------------------------------------------
1 | openxt_layer_meta_openxt_ocaml_platform_name="meta-openxt-ocaml-platform"
2 |
3 | # Specify a URL here to avoid using the mirror
4 | #openxt_layer_meta_openxt_ocaml_platform_repository="https://github.com/OpenXT/meta-openxt-ocaml-platform.git"
5 | # Specify a revision here to freeze the repository
6 | # If not revision is specified, $BRANCH will be used
7 | #openxt_layer_meta_openxt_ocaml_platform_revision="master"
8 |
9 | openxt_layer_meta_openxt_ocaml_platform_images=( \
10 | #Machine Step Format \
11 | #None
12 | )
13 |
14 | # We append to openxt_layers, so the list will be sorted
15 | # in priority order (01 is the highest priority)
16 | openxt_layers="${openxt_layers} meta_openxt_ocaml_platform"
17 |
--------------------------------------------------------------------------------
/build-scripts/20-xenclient-oe.layer:
--------------------------------------------------------------------------------
1 | openxt_layer_xenclient_oe_name="xenclient-oe"
2 |
3 | # Specify a URL here to avoid using the mirror
4 | #openxt_layer_xenclient_oe_repository="https://github.com/OpenXT/xenclient-oe.git"
5 | # Specify a revision here to freeze the repository
6 | # If not revision is specified, $BRANCH will be used
7 | #openxt_layer_xenclient_oe_revision="master"
8 |
9 | openxt_layer_xenclient_oe_images=( \
10 | #Machine Step Format \
11 | "xenclient-stubdomain xenclient-stubdomain-initramfs cpio.gz" \
12 | "xenclient-dom0 xenclient-initramfs cpio.gz" \
13 | "xenclient-dom0 xenclient-dom0 ext3.gz" \
14 | "openxt-installer xenclient-installer cpio.gz" \
15 | "openxt-installer xenclient-installer-part2 tar.bz2" \
16 | "xenclient-uivm xenclient-uivm ext3.vhd.gz" \
17 | "xenclient-ndvm xenclient-ndvm ext3.disk.vhd.gz" \
18 | )
19 |
20 | # We append to openxt_layers, so the list will be sorted
21 | # in priority order (01 is the highest priority)
22 | openxt_layers="${openxt_layers} xenclient_oe"
23 |
--------------------------------------------------------------------------------
/build-scripts/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 2, June 1991
3 |
4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6 | Everyone is permitted to copy and distribute verbatim copies
7 | of this license document, but changing it is not allowed.
8 |
9 | Preamble
10 |
11 | The licenses for most software are designed to take away your
12 | freedom to share and change it. By contrast, the GNU General Public
13 | License is intended to guarantee your freedom to share and change free
14 | software--to make sure the software is free for all its users. This
15 | General Public License applies to most of the Free Software
16 | Foundation's software and to any other program whose authors commit to
17 | using it. (Some other Free Software Foundation software is covered by
18 | the GNU Lesser General Public License instead.) You can apply it to
19 | your programs, too.
20 |
21 | When we speak of free software, we are referring to freedom, not
22 | price. Our General Public Licenses are designed to make sure that you
23 | have the freedom to distribute copies of free software (and charge for
24 | this service if you wish), that you receive source code or can get it
25 | if you want it, that you can change the software or use pieces of it
26 | in new free programs; and that you know you can do these things.
27 |
28 | To protect your rights, we need to make restrictions that forbid
29 | anyone to deny you these rights or to ask you to surrender the rights.
30 | These restrictions translate to certain responsibilities for you if you
31 | distribute copies of the software, or if you modify it.
32 |
33 | For example, if you distribute copies of such a program, whether
34 | gratis or for a fee, you must give the recipients all the rights that
35 | you have. You must make sure that they, too, receive or can get the
36 | source code. And you must show them these terms so they know their
37 | rights.
38 |
39 | We protect your rights with two steps: (1) copyright the software, and
40 | (2) offer you this license which gives you legal permission to copy,
41 | distribute and/or modify the software.
42 |
43 | Also, for each author's protection and ours, we want to make certain
44 | that everyone understands that there is no warranty for this free
45 | software. If the software is modified by someone else and passed on, we
46 | want its recipients to know that what they have is not the original, so
47 | that any problems introduced by others will not reflect on the original
48 | authors' reputations.
49 |
50 | Finally, any free program is threatened constantly by software
51 | patents. We wish to avoid the danger that redistributors of a free
52 | program will individually obtain patent licenses, in effect making the
53 | program proprietary. To prevent this, we have made it clear that any
54 | patent must be licensed for everyone's free use or not licensed at all.
55 |
56 | The precise terms and conditions for copying, distribution and
57 | modification follow.
58 |
59 | GNU GENERAL PUBLIC LICENSE
60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61 |
62 | 0. This License applies to any program or other work which contains
63 | a notice placed by the copyright holder saying it may be distributed
64 | under the terms of this General Public License. The "Program", below,
65 | refers to any such program or work, and a "work based on the Program"
66 | means either the Program or any derivative work under copyright law:
67 | that is to say, a work containing the Program or a portion of it,
68 | either verbatim or with modifications and/or translated into another
69 | language. (Hereinafter, translation is included without limitation in
70 | the term "modification".) Each licensee is addressed as "you".
71 |
72 | Activities other than copying, distribution and modification are not
73 | covered by this License; they are outside its scope. The act of
74 | running the Program is not restricted, and the output from the Program
75 | is covered only if its contents constitute a work based on the
76 | Program (independent of having been made by running the Program).
77 | Whether that is true depends on what the Program does.
78 |
79 | 1. You may copy and distribute verbatim copies of the Program's
80 | source code as you receive it, in any medium, provided that you
81 | conspicuously and appropriately publish on each copy an appropriate
82 | copyright notice and disclaimer of warranty; keep intact all the
83 | notices that refer to this License and to the absence of any warranty;
84 | and give any other recipients of the Program a copy of this License
85 | along with the Program.
86 |
87 | You may charge a fee for the physical act of transferring a copy, and
88 | you may at your option offer warranty protection in exchange for a fee.
89 |
90 | 2. You may modify your copy or copies of the Program or any portion
91 | of it, thus forming a work based on the Program, and copy and
92 | distribute such modifications or work under the terms of Section 1
93 | above, provided that you also meet all of these conditions:
94 |
95 | a) You must cause the modified files to carry prominent notices
96 | stating that you changed the files and the date of any change.
97 |
98 | b) You must cause any work that you distribute or publish, that in
99 | whole or in part contains or is derived from the Program or any
100 | part thereof, to be licensed as a whole at no charge to all third
101 | parties under the terms of this License.
102 |
103 | c) If the modified program normally reads commands interactively
104 | when run, you must cause it, when started running for such
105 | interactive use in the most ordinary way, to print or display an
106 | announcement including an appropriate copyright notice and a
107 | notice that there is no warranty (or else, saying that you provide
108 | a warranty) and that users may redistribute the program under
109 | these conditions, and telling the user how to view a copy of this
110 | License. (Exception: if the Program itself is interactive but
111 | does not normally print such an announcement, your work based on
112 | the Program is not required to print an announcement.)
113 |
114 | These requirements apply to the modified work as a whole. If
115 | identifiable sections of that work are not derived from the Program,
116 | and can be reasonably considered independent and separate works in
117 | themselves, then this License, and its terms, do not apply to those
118 | sections when you distribute them as separate works. But when you
119 | distribute the same sections as part of a whole which is a work based
120 | on the Program, the distribution of the whole must be on the terms of
121 | this License, whose permissions for other licensees extend to the
122 | entire whole, and thus to each and every part regardless of who wrote it.
123 |
124 | Thus, it is not the intent of this section to claim rights or contest
125 | your rights to work written entirely by you; rather, the intent is to
126 | exercise the right to control the distribution of derivative or
127 | collective works based on the Program.
128 |
129 | In addition, mere aggregation of another work not based on the Program
130 | with the Program (or with a work based on the Program) on a volume of
131 | a storage or distribution medium does not bring the other work under
132 | the scope of this License.
133 |
134 | 3. You may copy and distribute the Program (or a work based on it,
135 | under Section 2) in object code or executable form under the terms of
136 | Sections 1 and 2 above provided that you also do one of the following:
137 |
138 | a) Accompany it with the complete corresponding machine-readable
139 | source code, which must be distributed under the terms of Sections
140 | 1 and 2 above on a medium customarily used for software interchange; or,
141 |
142 | b) Accompany it with a written offer, valid for at least three
143 | years, to give any third party, for a charge no more than your
144 | cost of physically performing source distribution, a complete
145 | machine-readable copy of the corresponding source code, to be
146 | distributed under the terms of Sections 1 and 2 above on a medium
147 | customarily used for software interchange; or,
148 |
149 | c) Accompany it with the information you received as to the offer
150 | to distribute corresponding source code. (This alternative is
151 | allowed only for noncommercial distribution and only if you
152 | received the program in object code or executable form with such
153 | an offer, in accord with Subsection b above.)
154 |
155 | The source code for a work means the preferred form of the work for
156 | making modifications to it. For an executable work, complete source
157 | code means all the source code for all modules it contains, plus any
158 | associated interface definition files, plus the scripts used to
159 | control compilation and installation of the executable. However, as a
160 | special exception, the source code distributed need not include
161 | anything that is normally distributed (in either source or binary
162 | form) with the major components (compiler, kernel, and so on) of the
163 | operating system on which the executable runs, unless that component
164 | itself accompanies the executable.
165 |
166 | If distribution of executable or object code is made by offering
167 | access to copy from a designated place, then offering equivalent
168 | access to copy the source code from the same place counts as
169 | distribution of the source code, even though third parties are not
170 | compelled to copy the source along with the object code.
171 |
172 | 4. You may not copy, modify, sublicense, or distribute the Program
173 | except as expressly provided under this License. Any attempt
174 | otherwise to copy, modify, sublicense or distribute the Program is
175 | void, and will automatically terminate your rights under this License.
176 | However, parties who have received copies, or rights, from you under
177 | this License will not have their licenses terminated so long as such
178 | parties remain in full compliance.
179 |
180 | 5. You are not required to accept this License, since you have not
181 | signed it. However, nothing else grants you permission to modify or
182 | distribute the Program or its derivative works. These actions are
183 | prohibited by law if you do not accept this License. Therefore, by
184 | modifying or distributing the Program (or any work based on the
185 | Program), you indicate your acceptance of this License to do so, and
186 | all its terms and conditions for copying, distributing or modifying
187 | the Program or works based on it.
188 |
189 | 6. Each time you redistribute the Program (or any work based on the
190 | Program), the recipient automatically receives a license from the
191 | original licensor to copy, distribute or modify the Program subject to
192 | these terms and conditions. You may not impose any further
193 | restrictions on the recipients' exercise of the rights granted herein.
194 | You are not responsible for enforcing compliance by third parties to
195 | this License.
196 |
197 | 7. If, as a consequence of a court judgment or allegation of patent
198 | infringement or for any other reason (not limited to patent issues),
199 | conditions are imposed on you (whether by court order, agreement or
200 | otherwise) that contradict the conditions of this License, they do not
201 | excuse you from the conditions of this License. If you cannot
202 | distribute so as to satisfy simultaneously your obligations under this
203 | License and any other pertinent obligations, then as a consequence you
204 | may not distribute the Program at all. For example, if a patent
205 | license would not permit royalty-free redistribution of the Program by
206 | all those who receive copies directly or indirectly through you, then
207 | the only way you could satisfy both it and this License would be to
208 | refrain entirely from distribution of the Program.
209 |
210 | If any portion of this section is held invalid or unenforceable under
211 | any particular circumstance, the balance of the section is intended to
212 | apply and the section as a whole is intended to apply in other
213 | circumstances.
214 |
215 | It is not the purpose of this section to induce you to infringe any
216 | patents or other property right claims or to contest validity of any
217 | such claims; this section has the sole purpose of protecting the
218 | integrity of the free software distribution system, which is
219 | implemented by public license practices. Many people have made
220 | generous contributions to the wide range of software distributed
221 | through that system in reliance on consistent application of that
222 | system; it is up to the author/donor to decide if he or she is willing
223 | to distribute software through any other system and a licensee cannot
224 | impose that choice.
225 |
226 | This section is intended to make thoroughly clear what is believed to
227 | be a consequence of the rest of this License.
228 |
229 | 8. If the distribution and/or use of the Program is restricted in
230 | certain countries either by patents or by copyrighted interfaces, the
231 | original copyright holder who places the Program under this License
232 | may add an explicit geographical distribution limitation excluding
233 | those countries, so that distribution is permitted only in or among
234 | countries not thus excluded. In such case, this License incorporates
235 | the limitation as if written in the body of this License.
236 |
237 | 9. The Free Software Foundation may publish revised and/or new versions
238 | of the General Public License from time to time. Such new versions will
239 | be similar in spirit to the present version, but may differ in detail to
240 | address new problems or concerns.
241 |
242 | Each version is given a distinguishing version number. If the Program
243 | specifies a version number of this License which applies to it and "any
244 | later version", you have the option of following the terms and conditions
245 | either of that version or of any later version published by the Free
246 | Software Foundation. If the Program does not specify a version number of
247 | this License, you may choose any version ever published by the Free Software
248 | Foundation.
249 |
250 | 10. If you wish to incorporate parts of the Program into other free
251 | programs whose distribution conditions are different, write to the author
252 | to ask for permission. For software which is copyrighted by the Free
253 | Software Foundation, write to the Free Software Foundation; we sometimes
254 | make exceptions for this. Our decision will be guided by the two goals
255 | of preserving the free status of all derivatives of our free software and
256 | of promoting the sharing and reuse of software generally.
257 |
258 | NO WARRANTY
259 |
260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268 | REPAIR OR CORRECTION.
269 |
270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278 | POSSIBILITY OF SUCH DAMAGES.
279 |
280 | END OF TERMS AND CONDITIONS
281 |
282 | How to Apply These Terms to Your New Programs
283 |
284 | If you develop a new program, and you want it to be of the greatest
285 | possible use to the public, the best way to achieve this is to make it
286 | free software which everyone can redistribute and change under these terms.
287 |
288 | To do so, attach the following notices to the program. It is safest
289 | to attach them to the start of each source file to most effectively
290 | convey the exclusion of warranty; and each file should have at least
291 | the "copyright" line and a pointer to where the full notice is found.
292 |
293 | {description}
294 | Copyright (C) {year} {fullname}
295 |
296 | This program is free software; you can redistribute it and/or modify
297 | it under the terms of the GNU General Public License as published by
298 | the Free Software Foundation; either version 2 of the License, or
299 | (at your option) any later version.
300 |
301 | This program is distributed in the hope that it will be useful,
302 | but WITHOUT ANY WARRANTY; without even the implied warranty of
303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304 | GNU General Public License for more details.
305 |
306 | You should have received a copy of the GNU General Public License along
307 | with this program; if not, write to the Free Software Foundation, Inc.,
308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309 |
310 | Also add information on how to contact you by electronic and paper mail.
311 |
312 | If the program is interactive, make it output a short notice like this
313 | when it starts in an interactive mode:
314 |
315 | Gnomovision version 69, Copyright (C) year name of author
316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317 | This is free software, and you are welcome to redistribute it
318 | under certain conditions; type `show c' for details.
319 |
320 | The hypothetical commands `show w' and `show c' should show the appropriate
321 | parts of the General Public License. Of course, the commands you use may
322 | be called something other than `show w' and `show c'; they could even be
323 | mouse-clicks or menu items--whatever suits your program.
324 |
325 | You should also get your employer (if you work as a programmer) or your
326 | school, if any, to sign a "copyright disclaimer" for the program, if
327 | necessary. Here is a sample; alter the names:
328 |
329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330 | `Gnomovision' (which makes passes at compilers) written by James Hacker.
331 |
332 | {signature of Ty Coon}, 1 April 1989
333 | Ty Coon, President of Vice
334 |
335 | This General Public License does not permit incorporating your program into
336 | proprietary programs. If your program is a subroutine library, you may
337 | consider it more useful to permit linking proprietary applications with the
338 | library. If this is what you want to do, use the GNU Lesser General
339 | Public License instead of this License.
340 |
341 |
--------------------------------------------------------------------------------
/build-scripts/README.md:
--------------------------------------------------------------------------------
1 | # build-scripts
2 | Scripts to setup and run OpenXT builds in containers
3 |
4 | ## How to use
5 |
6 | - Do a fresh Debian install. Recommended configuration: bare-metal 64 bits Jessie
7 | - Login as root
8 | - Install git
9 | - Clone this repository and `cd` to it
10 | - Optional: create /etc/lxc/lxc.conf and set the storage directory using `lxc.lxcpath = `
11 | - Optional: edit setup.sh to change the Debian mirror
12 | - Run `./setup.sh -u user` to setup a build environment for "user"
13 | - Logout and login as user
14 | - Run ./build.sh
15 |
--------------------------------------------------------------------------------
/build-scripts/build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash -e
2 | #
3 | # OpenXT build script.
4 | # Software license: see accompanying LICENSE file.
5 | #
6 | # Copyright (c) 2016 Assured Information Security, Inc.
7 | # Copyright (c) 2016 BAE Systems
8 | #
9 | # Contributions by Jean-Edouard Lejosne
10 | # Contributions by Christopher Clark
11 | #
12 | # This program is free software; you can redistribute it and/or modify
13 | # it under the terms of the GNU General Public License as published by
14 | # the Free Software Foundation; either version 2 of the License, or
15 | # (at your option) any later version.
16 | #
17 | # This program is distributed in the hope that it will be useful,
18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 | # GNU General Public License for more details.
21 | #
22 | # You should have received a copy of the GNU General Public License
23 | # along with this program; if not, write to the Free Software
24 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 | #
26 | # Invocation:
27 | # Takes a build identifier as an optional argument to the script
28 | # to enable rerunning this script to continue an interrupted build
29 | # or run a build with a specified directory name.
30 |
31 | # -- Script configuration settings.
32 |
33 | # The branch to build. Has to be at least OpenXT 6.
34 | # Note: this branch will be used for *everything*.
35 | # The build will fail if one of the OpenXT repositories doesn't have it
36 | # To change just the OE branch, please edit oe/build.sh
37 | BRANCH="master"
38 |
39 | BUILD_ID=
40 |
41 | BUILD_DIR=""
42 | CONTINUE=
43 |
44 | NO_OE=
45 | NO_DEBIAN=
46 | NO_CENTOS=
47 | NO_WINDOWS=
48 |
49 | THREADS=
50 |
51 | # -- End of script configuration settings.
52 |
53 | usage() {
54 | cat >&2 </dev/null
137 | NEW_BUILD=$((LAST_BUILD + 1))
138 | BUILD_DIR="${BUILD_DATE}-${NEW_BUILD}"
139 | fi
140 |
141 | BUILD_DIR_PATH="${ALL_BUILDS_DIRECTORY}/${BUILD_DIR}"
142 | if [ -e "$BUILD_DIR_PATH" ] ; then
143 | echo "Build path is already present: ${BUILD_DIR_PATH}"
144 | fi
145 | if ! mkdir -p "${BUILD_DIR_PATH}" ; then
146 | echo "Error: Failed to create build directory: ${BUILD_DIR_PATH}" >&2
147 | exit 1
148 | fi
149 |
150 | if [ -z $CONTINUE ] ; then
151 | echo "Fetching git mirrors..."
152 | ./fetch.sh $BRANCH > "${BUILD_DIR_PATH}/git_heads"
153 | echo "Done"
154 | fi
155 |
156 | echo "Running build: ${BUILD_DIR}"
157 | mkdir -p "${BUILD_DIR_PATH}/raw"
158 |
159 | if [ ! -e "${BUILD_DIR_PATH}/build-openxt" ] ; then
160 | echo "Retrieving the branch-specific build data and scripts"
161 | git clone -b "${BRANCH}" \
162 | "git://${SUBNET_PREFIX}.${IP_C}.1/${BUILD_USER}/openxt.git" \
163 | "${BUILD_DIR_PATH}/build-openxt"
164 | fi
165 |
166 | source "${BUILD_DIR_PATH}/build-openxt/version"
167 |
168 | build_container() {
169 | NUMBER=$1 # 01
170 | NAME=$2 # oe
171 |
172 | CONTAINER_IP="${SUBNET_PREFIX}.${IP_C}.1${NUMBER}"
173 |
174 | echo "Building container $NUMBER : $NAME"
175 |
176 | # Build
177 | # Note: we cat all the layers and the build script to the ssh command
178 | # Another approach could be to `source *.layer` here and send them to the
179 | # container using the ssh option "SendEnv".
180 | # The way we do it here, the shell will for example turn tabulations into
181 | # completion requests, which is not ideal...
182 | # Note: the build script and layer data is obtained from the branch being built
183 |
184 | cat "${BUILD_DIR_PATH}/build-openxt/build-scripts/"*.layer \
185 | "${BUILD_DIR_PATH}/build-openxt/build-scripts/$NAME/build.sh" | \
186 | sed -e "s|\%BUILD_USER\%|${BUILD_USER}|" \
187 | -e "s|\%BUILD_DIR\%|${BUILD_DIR}|" \
188 | -e "s|\%SUBNET_PREFIX\%|${SUBNET_PREFIX}|" \
189 | -e "s|\%IP_C\%|${IP_C}|" \
190 | -e "s|\%BUILD_ID\%|${BUILD_ID}|" \
191 | -e "s|\%BRANCH\%|${BRANCH}|" \
192 | -e "s|\%THREADS\%|${THREADS}|" \
193 | -e "s|\%ALL_BUILDS_SUBDIR_NAME\%|${ALL_BUILDS_SUBDIR_NAME}|" |\
194 | ssh -i "${BUILD_USER_HOME}"/ssh-key/openxt \
195 | -oStrictHostKeyChecking=no ${CONTAINER_USER}@${CONTAINER_IP}
196 | }
197 |
198 | build_windows() {
199 | NUMBER=$1 # 04
200 |
201 | DEST="${ALL_BUILDS_SUBDIR_NAME}/${BUILD_DIR}/windows"
202 |
203 | if [ -d windows ]; then
204 | echo "Building the Windows tools"
205 | else
206 | echo "Skipping the Windows tools"
207 | return
208 | fi
209 |
210 | mkdir -p $DEST
211 |
212 | # Build
213 | cd "${BUILD_DIR_PATH}/build-openxt/build-scripts/windows"
214 | ./build.sh "$NUMBER" \
215 | "$BUILD_ID" \
216 | "$BRANCH" \
217 | "$BUILD_USER" \
218 | "${SUBNET_PREFIX}.${IP_C}" \
219 | "${DEST}"
220 | cd - >/dev/null
221 | }
222 |
223 | build_tools_iso() {
224 | WORKDIR="${ALL_BUILDS_DIRECTORY}/${BUILD_DIR}"
225 | BUILD_SCRIPTS="${BUILD_DIR_PATH}/build-openxt/build-scripts"
226 | TOOLS_VERSION=${XC_TOOLS_MAJOR}.${XC_TOOLS_MINOR}.${XC_TOOLS_MICRO}.${BUILD_ID}
227 |
228 | cd $WORKDIR
229 | mkdir -p raw
230 | rm -rf iso_tmp
231 | mkdir -p iso_tmp/linux
232 | if [ -r windows/xctools-iso.zip ]; then
233 | unzip -q windows/xctools-iso.zip -d iso_tmp
234 | fi
235 | if [ -d debian ]; then
236 | ln -s ../../debian iso_tmp/linux/debian
237 | if [ -f ${BUILD_SCRIPTS}/debian/install.sh ]; then
238 | sed "s/%VERSION%/${TOOLS_VERSION}/" ${BUILD_SCRIPTS}/debian/install.sh > iso_tmp/linux/debian_install.sh
239 | fi
240 | fi
241 | if [ -d rpms ]; then
242 | ln -s ../../rpms iso_tmp/linux/rpms
243 | if [ -f ${BUILD_SCRIPTS}/centos/install.sh ]; then
244 | sed "s/%VERSION%/${TOOLS_VERSION}/" ${BUILD_SCRIPTS}/centos/install.sh > iso_tmp/linux/centos_install.sh
245 | fi
246 | fi
247 | echo "Creating xc-tools.iso..."
248 | genisoimage -o "raw/xc-tools.iso" \
249 | -R \
250 | -J \
251 | -joliet-long \
252 | -input-charset utf8 \
253 | -V "OpenXT-tools" \
254 | -f \
255 | -quiet \
256 | iso_tmp
257 | echo "Done"
258 | rm -rf iso_tmp
259 | }
260 |
261 | build_repository () {
262 | WORKDIR="${ALL_BUILDS_DIRECTORY}/${BUILD_DIR}"
263 |
264 | local repository="$WORKDIR/repository/packages.main"
265 |
266 | cp -f "${BUILD_DIR_PATH}/build-openxt/manifest" .
267 |
268 | echo "Creating the repository..."
269 | mkdir -p "$repository"
270 | echo -n > "$repository/XC-PACKAGES"
271 |
272 | # Format of the manifest file is
273 | # name format optional/required source_filename dest_path
274 | while read l; do
275 | local name=`echo "$l" | awk '{print $1}'`
276 | local format=`echo "$l" | awk '{print $2}'`
277 | local opt_req=`echo "$l" | awk '{print $3}'`
278 | local src=`echo "$l" | awk '{print $4}'`
279 | local dest=`echo "$l" | awk '{print $5}'`
280 |
281 | if [ ! -e "$WORKDIR/raw/$src" ] ; then
282 | if [ "$opt_req" = "required" ] ; then
283 | echo "Error: Required file $src is missing"
284 | exit 1
285 | fi
286 |
287 | echo "Optional file $src is missing: skipping"
288 | continue
289 | fi
290 |
291 | cp "$WORKDIR/raw/$src" "$repository/$src"
292 |
293 | local filesize=$( du -b $repository/$src | awk '{print $1}' )
294 | local sha256sum=$( sha256sum $repository/$src | awk '{print $1}' )
295 |
296 | echo "$name" "$filesize" "$sha256sum" "$format" \
297 | "$opt_req" "$src" "$dest" >> "${repository}/XC-PACKAGES"
298 | done < manifest
299 |
300 | PACKAGES_SHA256SUM=$(sha256sum "$repository/XC-PACKAGES" |
301 | awk '{print $1}')
302 |
303 | set +o pipefail #fragile part
304 |
305 | # Pad XC-REPOSITORY to 1 MB with blank lines. If this is changed, the
306 | # repository-signing process will also need to change.
307 | {
308 | cat < "$repository/XC-REPOSITORY"
320 |
321 | set -o pipefail #end of fragile part
322 |
323 | openssl smime -sign \
324 | -aes256 \
325 | -binary \
326 | -in "$repository/XC-REPOSITORY" \
327 | -out "$repository/XC-SIGNATURE" \
328 | -outform PEM \
329 | -signer "$BUILD_USER_HOME/certificates/dev-cacert.pem" \
330 | -inkey "$BUILD_USER_HOME/certificates/dev-cakey.pem"
331 | echo "Done"
332 | }
333 |
334 | build_iso() {
335 | WORKDIR="${ALL_BUILDS_DIRECTORY}/${BUILD_DIR}"
336 |
337 | cd $WORKDIR
338 | mkdir -p iso
339 | rm -rf iso_tmp
340 | mkdir -p iso_tmp/isolinux
341 | cp -rf netboot/* iso_tmp/isolinux/
342 | cp -rf iso/* iso_tmp/isolinux/
343 | ln -s ../repository/packages.main iso_tmp/packages.main
344 | # If we already ran build_finalize(), netboot has a copy of rootfs.gz.
345 | # Since netboot/* was just copied into iso_tmp/isolinux, we'd now have it.
346 | if [ ! -e iso_tmp/isolinux/rootfs.gz ]; then
347 | ln -s ../../raw/installer-rootfs.cpio.gz iso_tmp/isolinux/rootfs.gz
348 | fi
349 | sed -i -re "s|[$]OPENXT_VERSION|$VERSION|g" iso_tmp/isolinux/bootmsg.txt
350 | sed -i -re "s|[$]OPENXT_BUILD_ID|$BUILD_ID|g" iso_tmp/isolinux/bootmsg.txt
351 |
352 | EFIBOOTIMG="iso_tmp/isolinux/efiboot.img"
353 | dd if=/dev/zero bs=1M count=5 of=${EFIBOOTIMG}
354 | /sbin/mkfs.fat ${EFIBOOTIMG}
355 | mmd -i ${EFIBOOTIMG} EFI
356 | mmd -i ${EFIBOOTIMG} EFI/BOOT
357 | mcopy -i ${EFIBOOTIMG} raw/grubx64.efi ::EFI/BOOT/BOOTX64.EFI
358 | sync
359 |
360 | echo "Creating installer.iso..."
361 | xorriso -as mkisofs \
362 | -o "iso/installer.iso" \
363 | -isohybrid-mbr "raw/isohdpfx.bin" \
364 | -c "isolinux/boot.cat" \
365 | -b "isolinux/isolinux.bin" \
366 | -no-emul-boot \
367 | -boot-load-size 4 \
368 | -boot-info-table \
369 | -eltorito-alt-boot \
370 | -e "isolinux/efiboot.img" \
371 | -no-emul-boot \
372 | -isohybrid-gpt-basdat \
373 | -r \
374 | -J \
375 | -l \
376 | -V "OpenXT-${VERSION}" \
377 | -f \
378 | -quiet \
379 | "iso_tmp"
380 | echo "Done"
381 | rm -rf iso_tmp
382 | cd - > /dev/null
383 | }
384 |
385 | build_finalize() {
386 | WORKDIR="${ALL_BUILDS_DIRECTORY}/${BUILD_DIR}"
387 |
388 | cd $WORKDIR
389 |
390 | # Build info file (should be safe to remove)
391 | cat > info < /etc/yum.repos.d/OpenXT.repo <> /etc/modules-load.d/openxt.conf
81 | done
82 |
83 | echo "Writing the tools version to xenstore..."
84 | MAJORVERSION=$(echo "${VERSION}" | cut -d. -f1)
85 | MINORVERSION=$(echo "${VERSION}" | cut -d. -f2)
86 | MICROVERSION=$(echo "${VERSION}" | cut -d. -f3)
87 | BUILDVERSION=$(echo "${VERSION}" | cut -d. -f4)
88 | mount -t xenfs none /proc/xen || true
89 | xenstore-exists attr || xenstore-write "attr" ""
90 | xenstore-exists "attr/PVAddons" || xenstore-write "attr/PVAddons" ""
91 | xenstore-write "attr/PVAddons/Installed" "1"
92 | xenstore-write "attr/PVAddons/MajorVersion" "${MAJORVERSION}"
93 | xenstore-write "attr/PVAddons/MinorVersion" "${MINORVERSION}"
94 | xenstore-write "attr/PVAddons/MicroVersion" "${MICROVERSION}"
95 | xenstore-write "attr/PVAddons/BuildVersion" "${BUILDVERSION}"
96 |
97 | echo "Done. Reboot to enable the new kernel modules."
98 |
--------------------------------------------------------------------------------
/build-scripts/centos/setup.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # Copyright (c) 2016 Assured Information Security, Inc.
3 | # Copyright (c) 2016 BAE Systems
4 | #
5 | # Contributions by Jean-Edouard Lejosne
6 | # Contributions by Christopher Clark
7 | #
8 | # This program is free software; you can redistribute it and/or modify
9 | # it under the terms of the GNU General Public License as published by
10 | # the Free Software Foundation; either version 2 of the License, or
11 | # (at your option) any later version.
12 | #
13 | # This program is distributed in the hope that it will be useful,
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | # GNU General Public License for more details.
17 | #
18 | # You should have received a copy of the GNU General Public License
19 | # along with this program; if not, write to the Free Software
20 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 | #
22 |
23 | CONTAINER_USER=%CONTAINER_USER%
24 |
25 | # Remove the root password
26 | passwd -d root
27 |
28 | # Install required packages
29 | # The following line must be done first,
30 | # it will make the next yum command use the correct packages
31 | yum -y install centos-release-xen
32 | yum -y groupinstall "Development tools"
33 | rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
34 | yum -y install rpm-build createrepo which sudo git which wget gcc make kernel-devel tar dkms libaio bc iproute2 net-tools python-devel python-argparse python-pip
35 |
36 | # Setup symlinks to make dkms happy
37 | for kernelpath in `ls -d /usr/src/kernels/*`; do
38 | kernel=`basename $kernelpath`
39 | mkdir -p /lib/modules/virt
40 | [ -e /lib/modules/virt/build ] || ln -s ${kernelpath} /lib/modules/virt/build
41 | [ -e /lib/modules/virt/source ] || ln -s ${kernelpath} /lib/modules/virt/source
42 | done
43 |
44 | # Get rid of a broken lib
45 | if [ -f /usr/lib64/security/pam_systemd.so ]; then
46 | mv /usr/lib64/security/pam_systemd.so /usr/lib64/security/pam_systemd.so.bak
47 | fi
48 |
49 | # Make sudo happy even without a TTY
50 | sed -i 's/^Defaults requiretty$/Defaults !requiretty/' /etc/sudoers
51 |
52 | # Add a build user
53 | adduser ${CONTAINER_USER}
54 | mkdir -p /home/${CONTAINER_USER}/.ssh
55 | ssh-keygen -N "" -t rsa -C ${CONTAINER_USER}@openxt-centos -f /home/${CONTAINER_USER}/.ssh/id_rsa
56 | chown -R ${CONTAINER_USER}:${CONTAINER_USER} /home/${CONTAINER_USER}/.ssh
57 |
58 | # Make the user a passwordless sudoer, as dkms unfortunately needs to run as root
59 | echo "${CONTAINER_USER} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
60 |
--------------------------------------------------------------------------------
/build-scripts/clean.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash -e
2 | #
3 | # OpenXT build script.
4 | # Software license: see accompanying LICENSE file.
5 | #
6 | # Copyright (c) 2016 Assured Information Security, Inc.
7 | #
8 | # Contributions by Ross Philipson
9 | #
10 | # This program is free software; you can redistribute it and/or modify
11 | # it under the terms of the GNU General Public License as published by
12 | # the Free Software Foundation; either version 2 of the License, or
13 | # (at your option) any later version.
14 | #
15 | # This program is distributed in the hope that it will be useful,
16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | # GNU General Public License for more details.
19 | #
20 | # You should have received a copy of the GNU General Public License
21 | # along with this program; if not, write to the Free Software
22 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 | #
24 | # Invocation:
25 | # Used to cleanup a single build or all builds.
26 | #
27 | # N.B. this script starts outside the containers in the OUT OF CONTAINER
28 | # block. It then sets the variables in the IN CONTAINER part and sends
29 | # the modified script to each container to run the IN CONTAINER block.
30 | # Finally back out in the OUT OF CONTAINER block it cleans up the local
31 | # build dirs in xt-builds.
32 |
33 | BDLIST=
34 |
35 | #------------ IN CONTAINER ------------
36 |
37 | IN_CONTAINER=%IN_CONTAINER%
38 | C_BUILD_DIR=%C_BUILD_DIR%
39 | C_CLEAN_ALL=%C_CLEAN_ALL%
40 |
41 | if [ "$IN_CONTAINER" = "y" ]; then
42 | if [ -n "$C_BUILD_DIR" ]; then
43 | echo "Cleaning up: $C_BUILD_DIR"
44 | rm -rf $C_BUILD_DIR
45 | exit 0
46 | fi
47 |
48 | if [ -z "$C_CLEAN_ALL" ]; then
49 | exit 0
50 | fi
51 |
52 | BDLIST=`ls | grep -e "^[0-9]\{6\}-[0-9]\+$"`
53 | for i in $BDLIST; do
54 | echo "Cleaning up: $i"
55 | rm -rf $i
56 | done
57 |
58 | exit 0
59 | fi
60 |
61 | #------------ OUT OF CONTAINER ------------
62 |
63 | BUILD_DIR=""
64 | CLEAN_ALL=""
65 |
66 | usage() {
67 | cat >&2 </dev/null
58 | mkdir wheezy
59 | cd wheezy
60 | # Build Wheezy-specific packages here.
61 | cd - >/dev/null
62 | mkdir jessie
63 | cd jessie
64 | # Build Jessie-specific packages here.
65 | cd - >/dev/null
66 |
67 | # Create a repository
68 | mkdir repo
69 | cd repo
70 | mkdir conf
71 | cat > conf/distributions </dev/null 2>&1 && reprepro includedeb wheezy ../wheezy/*.deb
92 | # Add Jessie-specific packages to Wheezy
93 | ls ../jessie/*.deb >/dev/null 2>&1 && reprepro includedeb jessie ../jessie/*.deb
94 | cd - >/dev/null
95 |
96 | # Copy the resulting repository
97 | scp -r repo "${BUILD_USER}@${SUBNET_PREFIX}.${IP_C}.1:${ALL_BUILDS_SUBDIR_NAME}/${BUILD_DIR}/debian"
98 |
99 | # The script may run in an "ssh -t -t" environment, that won't exit on its own
100 | set +e
101 | exit
102 |
--------------------------------------------------------------------------------
/build-scripts/debian/install.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # This script installs the Debian tools into Debian-based guests.
3 | # Tested on Debian Wheezy, Debian Jessie and Ubuntu 16.04.
4 |
5 | set -e
6 |
7 | cd `dirname $0`
8 |
9 | VERSION=%VERSION%
10 | DKMS_PACKAGES="openxt-vusb-dkms"
11 |
12 | DEBIAN_NAME=jessie
13 | DEBIAN_VERSION=`cut -d '.' -f 1 /etc/debian_version 2>/dev/null || true`
14 | [ "x$DEBIAN_VERSION" = "x7" ] && DEBIAN_NAME=wheezy
15 |
16 | echo "Removing old tools..."
17 | # Kernel modules
18 | for pkg in `dpkg -l | awk '{print $2}' | grep "^openxt-.*-dkms$\|^v4v-dkms$"`; do
19 | apt-get -y remove --purge $pkg
20 | done
21 | # Others
22 | for pkg in libv4v; do
23 | if [ `dpkg -l | awk '{print $2}' | grep "^${pkg}$"` ]; then
24 | apt-get -y remove $pkg
25 | fi
26 | done
27 | rm -rf /var/opt/openxt
28 | rm -f /etc/apt/sources.list.d/openxt.list
29 | rm -f /etc/modules-load.d/openxt.conf
30 |
31 | echo "Copying the packages to /var/opt..."
32 | mkdir -p /var/opt/openxt
33 | cp -r debian /var/opt/openxt/
34 |
35 | echo "Writing /etc/apt/sources.list.d/openxt.list"
36 | cat > /etc/apt/sources.list.d/openxt.list <> $mod_file
53 | done
54 |
55 | echo "Writing the tools version to xenstore..."
56 | apt-get -y install xenstore-utils
57 | MAJORVERSION=$(echo "${VERSION}" | cut -d. -f1)
58 | MINORVERSION=$(echo "${VERSION}" | cut -d. -f2)
59 | MICROVERSION=$(echo "${VERSION}" | cut -d. -f3)
60 | BUILDVERSION=$(echo "${VERSION}" | cut -d. -f4)
61 | mount -t xenfs none /proc/xen || true
62 | xenstore-exists attr || xenstore-write "attr" ""
63 | xenstore-exists "attr/PVAddons" || xenstore-write "attr/PVAddons" ""
64 | xenstore-write "attr/PVAddons/Installed" "1"
65 | xenstore-write "attr/PVAddons/MajorVersion" "${MAJORVERSION}"
66 | xenstore-write "attr/PVAddons/MinorVersion" "${MINORVERSION}"
67 | xenstore-write "attr/PVAddons/MicroVersion" "${MICROVERSION}"
68 | xenstore-write "attr/PVAddons/BuildVersion" "${BUILDVERSION}"
69 |
70 | echo "Done. Reboot to enable the new kernel modules."
71 |
--------------------------------------------------------------------------------
/build-scripts/debian/setup.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # Copyright (c) 2016 Assured Information Security, Inc.
3 | # Copyright (c) 2016 BAE Systems
4 | #
5 | # Contributions by Jean-Edouard Lejosne
6 | # Contributions by Christopher Clark
7 | #
8 | # This program is free software; you can redistribute it and/or modify
9 | # it under the terms of the GNU General Public License as published by
10 | # the Free Software Foundation; either version 2 of the License, or
11 | # (at your option) any later version.
12 | #
13 | # This program is distributed in the hope that it will be useful,
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | # GNU General Public License for more details.
17 | #
18 | # You should have received a copy of the GNU General Public License
19 | # along with this program; if not, write to the Free Software
20 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 | #
22 |
23 | MIRROR=%MIRROR%
24 | CONTAINER_USER=%CONTAINER_USER%
25 |
26 | # Remove the root password
27 | passwd -d root
28 |
29 | # Install required packages
30 | PKGS=""
31 | PKGS="$PKGS openssh-server openssl git"
32 | # Debian package building deps
33 | PKGS="$PKGS schroot sbuild reprepro dh-make dkms pkg-config libfile-fcntllock-perl dh-autoreconf"
34 | apt-get update
35 | apt-get -y install $PKGS /dev/null 2>&1
37 | git show-ref -s $BRANCH || echo "BRANCH $BRANCH NOT FOUND"
38 | cd - > /dev/null
39 | done | tee /tmp/git_heads_$BUILD_USER
40 |
41 | # Start the git service if needed
42 | ps -p `cat /tmp/openxt_git.pid 2>/dev/null` >/dev/null 2>&1 || {
43 | rm -f /tmp/openxt_git.pid
44 | git daemon --base-path=${GIT_ROOT_PATH} \
45 | --pid-file=/tmp/openxt_git.pid \
46 | --detach \
47 | --syslog \
48 | --export-all
49 | chmod 666 /tmp/openxt_git.pid
50 | }
51 |
--------------------------------------------------------------------------------
/build-scripts/oe/build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Copyright (c) 2016 Assured Information Security, Inc.
3 | # Copyright (c) 2016 BAE Systems
4 | #
5 | # Contributions by Jean-Edouard Lejosne
6 | # Contributions by Christopher Clark
7 | #
8 | # This program is free software; you can redistribute it and/or modify
9 | # it under the terms of the GNU General Public License as published by
10 | # the Free Software Foundation; either version 2 of the License, or
11 | # (at your option) any later version.
12 | #
13 | # This program is distributed in the hope that it will be useful,
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | # GNU General Public License for more details.
17 | #
18 | # You should have received a copy of the GNU General Public License
19 | # along with this program; if not, write to the Free Software
20 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 | #
22 |
23 | set -e
24 |
25 | BUILD_USER=%BUILD_USER%
26 | BUILD_DIR=%BUILD_DIR%
27 | IP_C=%IP_C%
28 | BUILD_ID=%BUILD_ID%
29 | BRANCH=%BRANCH%
30 | THREADS=%THREADS%
31 | SUBNET_PREFIX=%SUBNET_PREFIX%
32 | ALL_BUILDS_SUBDIR_NAME=%ALL_BUILDS_SUBDIR_NAME%
33 |
34 | HOST_IP=${SUBNET_PREFIX}.${IP_C}.1
35 | LOCAL_USER=`whoami`
36 | BUILD_PATH=`pwd`/${BUILD_DIR}/openxt/build
37 | RSYNC="rsync -a --copy-links"
38 |
39 | cd ~/certs
40 | CERTS_PATH=`pwd`
41 | cd ..
42 |
43 | setupoe() {
44 | source version
45 | cp build/conf/local.conf-dist build/conf/local.conf
46 | if [ -f common-config ]; then
47 | cat common-config >> build/conf/local.conf
48 | fi
49 | cat >> build/conf/local.conf </dev/null
203 | echo "BBLAYERS =+ \"\${TOPDIR}/repos/${!name_var}\"" >> build/conf/bblayers.conf
204 | done
205 |
206 | # Configure OpenXT
207 | setupoe
208 | else
209 | cd openxt
210 | fi
211 |
212 | configure_threads
213 |
214 | # Build
215 | mkdir -p build
216 | cd build
217 | for layer in $openxt_layers; do
218 | echo "Building layer ${layer}..."
219 | images_var="openxt_layer_${layer}_images[@]"
220 | for image in "${!images_var}"; do
221 | echo $image
222 | machine=`echo $image | awk '{print $1}'`
223 | step=`echo $image | awk '{print $2}'`
224 | format=`echo $image | awk '{print $3}'`
225 | echo "Building $step for $machine in $format"
226 | build_image $machine $step $format
227 | done
228 | done
229 |
230 | collect_packages
231 | collect_logs
232 |
233 | # The script may run in an "ssh -t -t" environment, that won't exit on its own
234 | set +e
235 | exit
236 |
--------------------------------------------------------------------------------
/build-scripts/oe/setup.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # Copyright (c) 2016 Assured Information Security, Inc.
3 | # Copyright (c) 2016 BAE Systems
4 | #
5 | # Contributions by Jean-Edouard Lejosne
6 | # Contributions by Christopher Clark
7 | #
8 | # This program is free software; you can redistribute it and/or modify
9 | # it under the terms of the GNU General Public License as published by
10 | # the Free Software Foundation; either version 2 of the License, or
11 | # (at your option) any later version.
12 | #
13 | # This program is distributed in the hope that it will be useful,
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | # GNU General Public License for more details.
17 | #
18 | # You should have received a copy of the GNU General Public License
19 | # along with this program; if not, write to the Free Software
20 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 | #
22 |
23 | # This scripts sets up the OE container for OpenXT
24 |
25 | CONTAINER_USER=%CONTAINER_USER%
26 |
27 | # Remove root password
28 | passwd -d root
29 |
30 | # Fix networking
31 | sed -i '/^start)$/a mkdir -p /dev/shm/network/' /etc/init.d/networking
32 | PKGS=""
33 | PKGS="$PKGS openssh-server openssl"
34 | PKGS="$PKGS sed wget cvs subversion git-core coreutils unzip texi2html texinfo docbook-utils gawk python-pysqlite2 diffstat help2man make gcc build-essential g++ desktop-file-utils chrpath cpio screen bash-completion python3 iputils-ping" # OE main deps
35 | PKGS="$PKGS guilt iasl quilt bin86 bcc libsdl1.2-dev liburi-perl genisoimage policycoreutils unzip vim sudo rpm curl libncurses5-dev libncursesw5 libc6-dev-i386 libelf-dev" # OpenXT-specific deps
36 | PKGS="$PKGS xorriso mtools dosfstools" # installer & efiboot.img
37 |
38 | apt-get update
39 | # That's a lot of packages, a fetching failure can happen, try twice.
40 | apt-get -y install $PKGS sums <sums < /tmp/preseed.txt
70 | debconf-set-selections /tmp/preseed.txt
71 | dpkg-reconfigure -f noninteractive dash
72 |
73 | # Add a symlink required to build some packages, like hkg-hsyslog
74 | ln -s /lib64/ld-linux-x86-64.so.2 /lib/
75 |
76 | # Add a build user
77 | adduser --disabled-password --gecos "" ${CONTAINER_USER}
78 | mkdir -p /home/${CONTAINER_USER}/.ssh
79 | ssh-keygen -N "" -t rsa -C ${CONTAINER_USER}@openxt-oe -f /home/${CONTAINER_USER}/.ssh/id_rsa
80 | chown -R ${CONTAINER_USER}:${CONTAINER_USER} /home/${CONTAINER_USER}/.ssh
81 | echo "export MACHINE=xenclient-dom0" >> /home/${CONTAINER_USER}/.bashrc
82 | chown ${CONTAINER_USER}:${CONTAINER_USER} /home/${CONTAINER_USER}/.bashrc
83 |
84 | cat >/home/${CONTAINER_USER}/.quiltrc < $xmlfile
43 | dobuild="curl -s --connect-timeout 5 -H \"Content-Type: text/xml\" --data @${xmlfile} http://${IP}:6288"
44 |
45 | buildout=`mktemp`
46 | $dobuild > $buildout
47 |
48 | result=`xmllint --xpath 'string(methodResponse/params/param/value/string)' $buildout`
49 |
50 | rm $xmlfile
51 | rm $buildout
52 |
53 | echo "Windows build result: ${result}"
54 |
55 | [[ "x$result" = "xSUCCESS" ]]
56 |
--------------------------------------------------------------------------------
/build-scripts/windows/setup.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash -e
2 | #
3 | # OpenXT setup script.
4 | # This script sets up the build host (just installs packages and adds a user),
5 | # and sets up LXC containers to build OpenXT.
6 | #
7 | # Copyright (c) 2016 Assured Information Security, Inc.
8 | #
9 | # Contributions by Jean-Edouard Lejosne
10 | #
11 | # This program is free software; you can redistribute it and/or modify
12 | # it under the terms of the GNU General Public License as published by
13 | # the Free Software Foundation; either version 2 of the License, or
14 | # (at your option) any later version.
15 | #
16 | # This program is distributed in the hope that it will be useful,
17 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | # GNU General Public License for more details.
20 | #
21 | # You should have received a copy of the GNU General Public License
22 | # along with this program; if not, write to the Free Software
23 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 | #
25 |
26 | NUMBER=$1
27 | BUILD_USER=$2
28 | MAC_PREFIX=$3
29 | MAC_E=$4
30 | ISO_URL=$5
31 | IP_PREFIX=$6
32 |
33 | MAC_ADDR=${MAC_PREFIX}:${MAC_E}:${NUMBER}
34 | IP=${IP_PREFIX}.1${NUMBER}
35 | BUILD_USER_HOME="$(eval echo ~${BUILD_USER})"
36 |
37 | continue_or_fail() {
38 | cat <&2
49 | set +e
50 | set -x
51 | virsh destroy ${vm_name}
52 | virsh undefine ${vm_name}
53 | virsh vol-delete --pool ${disk_pool} disk
54 | virsh pool-destroy ${disk_pool}
55 | virsh pool-delete ${disk_pool}
56 | virsh pool-undefine ${disk_pool}
57 | /etc/init.d/libvirtd restart
58 | exit 1
59 | }
60 | done
61 | }
62 |
63 | mkdir -p /home/${BUILD_USER}/windows
64 | cd /home/${BUILD_USER}/windows
65 |
66 | disk_pool=${BUILD_USER}-pool
67 | vm_name=${BUILD_USER}-win
68 | mkdir -p $disk_pool
69 |
70 | if [ -e ${disk_pool}/disk ]; then
71 | echo "Windows disk already present, not setting up the Windows VM."
72 | exit
73 | fi
74 |
75 | [ -e win.iso ] || wget -O win.iso $ISO_URL || rm -f win.iso
76 | [ -e tools.iso ] || wget -O tools.iso 'https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso'
77 |
78 | apt-get install qemu-kvm virtinst
79 |
80 | virt-install \
81 | --virt-type kvm \
82 | --boot hd,cdrom \
83 | --name ${vm_name} \
84 | --memory 2048 \
85 | --disk /home/${BUILD_USER}/windows/${disk_pool}/disk,format=raw,bus=virtio,size=80 \
86 | --disk /home/${BUILD_USER}/windows/win.iso,device=cdrom,bus=ide \
87 | --disk /home/${BUILD_USER}/windows/tools.iso,device=cdrom,bus=ide \
88 | -w bridge=${BUILD_USER}br0,mac=${MAC_ADDR},model=virtio \
89 | --graphics vnc,listen=0.0.0.0,port=59${MAC_E} \
90 | --noautoconsole \
91 | --autostart || {
92 | rm /home/${BUILD_USER}/windows/${disk_pool}/disk
93 | echo "virt-install failed. Please make sure vt-x is enabled."
94 | echo "If it is, try to rmmod kvm_intel and kvm and modprobe them back."
95 | echo "Then restart this script."
96 | exit 2
97 | }
98 |
99 | cat < /dev/null
144 |
145 | set +e
146 | get_ssh_public_key="curl -s -m 5 -H \"Content-Type: text/xml\" --data @xmls/xml_get_ssh_public_key http://${IP}:6288"
147 | ssh_public_key=`$get_ssh_public_key | xmllint --xpath 'string(methodResponse/params/param/value/string)' -`
148 | while [ -z "$ssh_public_key" ]; do
149 | echo "winbuildd is not installed/running/configured properly."
150 | continue_or_fail
151 | ssh_public_key=`$get_ssh_public_key | xmllint --xpath 'string(methodResponse/params/param/value/string)' -`
152 | done
153 | echo "$ssh_public_key" >> ${BUILD_USER_HOME}/.ssh/authorized_keys
154 | set -e
155 |
156 | echo
157 | echo 'Success! The Windows build VM is now properly configured.'
158 | echo
159 |
--------------------------------------------------------------------------------
/build-scripts/windows/xmls/xml_get_ssh_public_key:
--------------------------------------------------------------------------------
1 |
2 |
3 | get_ssh_public_key
4 |
5 |
--------------------------------------------------------------------------------
/build-scripts/windows/xmls/xmlbuild:
--------------------------------------------------------------------------------
1 |
2 |
3 | make
4 |
5 |
6 | %BUILD_ID%
7 |
8 |
9 | %BRANCH%
10 |
11 |
12 | %CERTIFICATE%
13 |
14 |
15 | %IS_DEVELOPER%
16 |
17 |
18 | %RSYNC_DESTINATION%
19 |
20 |
21 | %GIT_PATH%
22 |
23 |
24 | sample-config.xml
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/build-scripts/windows/xmls/xmlhello:
--------------------------------------------------------------------------------
1 |
2 |
3 | hello
4 |
5 |
--------------------------------------------------------------------------------
/build/bb:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | #
3 | # Copyright (c) 2012 Citrix Systems, Inc.
4 | #
5 | # This program is free software; you can redistribute it and/or modify
6 | # it under the terms of the GNU General Public License as published by
7 | # the Free Software Foundation; either version 2 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # This program is distributed in the hope that it will be useful,
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | # GNU General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU General Public License
16 | # along with this program; if not, write to the Free Software
17 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 | #
19 |
20 | BDIR=`readlink -f \`dirname $0\``
21 | REPOS="$BDIR/repos"
22 |
23 | export BB_ENV_EXTRAWHITE="MACHINE BUILD_UID"
24 | PATH="$REPOS/bitbake/bin:$PATH"
25 |
26 | # allow to disble OE wrapper script
27 | if [ "x$1" = "x--disable-wrapper" ];then
28 | shift
29 | else
30 | PATH="$REPOS/openembedded-core/scripts:$PATH"
31 | fi
32 | export PATH
33 |
34 | exec bitbake "$@"
35 |
--------------------------------------------------------------------------------
/build/conf/bblayers.conf:
--------------------------------------------------------------------------------
1 | # LAYER_CONF_VERSION is increased each time build/conf/bblayers.conf
2 | # changes incompatibly
3 | LCONF_VERSION = "7"
4 |
5 | BBPATH = "${TOPDIR}"
6 | BBFILES ?= ""
7 | BBLAYERS ?= " \
8 | ${TOPDIR}/repos/openembedded-core/meta \
9 | ${TOPDIR}/repos/meta-openembedded/meta-xfce \
10 | ${TOPDIR}/repos/meta-openembedded/meta-oe \
11 | ${TOPDIR}/repos/meta-openembedded/meta-gnome \
12 | ${TOPDIR}/repos/meta-openembedded/meta-networking \
13 | ${TOPDIR}/repos/meta-openembedded/meta-python \
14 | ${TOPDIR}/repos/meta-openembedded/meta-multimedia \
15 | ${TOPDIR}/repos/meta-openembedded/meta-filesystems \
16 | ${TOPDIR}/repos/meta-virtualization \
17 | ${TOPDIR}/repos/meta-java \
18 | ${TOPDIR}/repos/meta-selinux \
19 | ${TOPDIR}/repos/meta-intel \
20 | "
21 |
22 |
--------------------------------------------------------------------------------
/build/conf/local.conf-dist:
--------------------------------------------------------------------------------
1 | CONF_VERSION = "1"
2 |
3 | # 1) Basic config
4 | #
5 | ## TODO: DISTRO should be in auto.conf
6 | DISTRO ?= "openxt-main"
7 |
8 | ## TODO: TMPDIR should be defined in site.conf
9 | TMPDIR ?= "${TOPDIR}/build"
10 |
11 | ENABLE_BINARY_LOCALE_GENERATION = "1"
12 | GLIBC_GENERATE_LOCALES += " \
13 | de_DE.UTF-8 \
14 | en_US.UTF-8 \
15 | en_GB.UTF-8 \
16 | es_ES.UTF-8 \
17 | fr_FR.UTF-8 \
18 | ja_JP.UTF-8 \
19 | zh_CN.UTF-8 \
20 | "
21 |
22 | # OpenXT specific OE tasks
23 | INHERIT += "xenclient-customtask"
24 |
25 | IMAGE_FEATURES[validitems] += "web-certificates"
26 | # Un-comment the following line to enable https
27 | # certificates in dom0 and the installer
28 | #EXTRA_IMAGE_FEATURES += "web-certificates"
29 |
30 | # 2) Build tweaks/hacks
31 | #
32 |
33 | VIRTUAL-RUNTIME_keymaps = "xenclient-console-keymaps"
34 |
35 | # overwrite debian mirror for screen, as the debian version it's based on (lenny) is in oldstable now
36 | DEBIAN_MIRROR_pn-screen = "http://archive.debian.org/debian/pool"
37 |
38 | # Common URL translations.
39 | MIRRORS += " \
40 | http://code.coreboot.org/p/seabios/downloads/.* https://www.seabios.org/downloads/ \n \
41 | http://www.seabios.org/downloads/.* https://www.seabios.org/downloads/ \n \
42 | git://anonscm.debian.org/collab-maint/ltrace.git git://github.com/sparkleholic/ltrace.git \n \
43 | "
44 |
--------------------------------------------------------------------------------
/build_helpers.sh:
--------------------------------------------------------------------------------
1 | die()
2 | {
3 | echo "$1" 1>&2
4 | exit 1
5 | }
6 |
7 |
8 |
9 | git_clone()
10 | {
11 | local path="$1"
12 | local url="$2"
13 | local tag="$3"
14 | local allow_switch_branch_fail="$4"
15 |
16 | rm -rf "$path.tmp"
17 | if [ $VERBOSE -eq 0 ]; then
18 | ex="-q"
19 | fi
20 | git clone $ex -n "$url" "$path.tmp" && mkdir -p "$path" && rsync -lr "$path.tmp/" "$path/"
21 | rm -rf "$path.tmp"
22 | set +e
23 | (cd "$path" && git checkout $ex $tag || git checkout $ex -b $tag origin/$tag)
24 | if [ -z "$allow_switch_branch_fail" -a $? -ne 0 ]; then
25 | die "Switching to $tag failed while checking out $url, terminating. You can enforce fallback to default branch by setting ALLOW_SWITCH_BRANCH_FAIL in config"
26 | fi
27 | current_branch=`( cd "$path" && git branch) | grep -e ^* | cut -d ' ' -f2-`
28 | if [ "$current_branch" != "$tag" ]; then
29 | (cd "$path" && git checkout -b $tag)
30 | fi
31 | set -e
32 | }
33 |
--------------------------------------------------------------------------------
/do_branch.sh:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | set -e
4 |
5 | REPO="/home/xc_source/git/xenclient"
6 | BRANCH="master"
7 | NEW_BRANCH=""
8 |
9 | usage()
10 | {
11 | echo "$0: [-N] [-b BRANCH] [-r REPO] -n NEW_BRANCH"
12 | }
13 |
14 | unset NOACTION
15 | while [ "$#" -ne 0 ]; do
16 | case "$1" in
17 | -b) BRANCH="$2"; shift 2 ;;
18 | -n) NEW_BRANCH="$2"; shift 2;;
19 | -r) REPO="$2"; shift 2;;
20 | -N) NOACTION=-n; shift;;
21 | --) shift ; break ;;
22 | *) usage ; exit 1;;
23 | esac
24 | done
25 |
26 | if [ "x$REPO" == "x" -o "x$BRANCH" == "x" -o "x$NEW_BRANCH" == "x" ]
27 | then
28 | usage
29 | exit 1
30 | fi
31 |
32 |
33 | log() { "$@" ; }
34 |
35 | for i in "$REPO"/*.git
36 | do
37 | dir="`basename "${i%.git}"`"
38 | branch="$BRANCH"
39 |
40 | if [ ! -d "$dir" ]; then
41 | rm -rf "$dir.tmp"
42 | log git clone -n "$i" "$dir.tmp"
43 | mv "$dir.tmp" "$dir"
44 | fi
45 |
46 | branches=$(cd $dir && git branch -a)
47 | if [ "x${branches}" == "x" ]; then
48 | echo "NOTE: no branches in $dir"
49 | continue
50 | fi
51 |
52 | (
53 | cd $dir
54 | if ! git show-ref $branch ; then
55 | headbranch="`cat .git/HEAD | cut -d'/' -f3`"
56 | echo "Branch $branch doesn't exist, use ${headbranch} for $dir"
57 | branch=${headbranch}
58 | fi
59 | git checkout ${branch}
60 |
61 | git branch ${NEW_BRANCH} ${branch}
62 | sudo git push ${NOACTION} origin ${NEW_BRANCH}
63 | )
64 | done
65 |
--------------------------------------------------------------------------------
/do_installer_iso.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | #
3 | # Generates a XenClient installer iso image.
4 |
5 | usage()
6 | {
7 | cat <&2
8 | Usage: $(basename $0) ISO_DIR ISO_IMAGE ISO_LABEL ISO_HDPFX
9 | e.g. $(basename $0) installer installer.iso XC_installer isohdpfx.bin
10 |
11 | Generates a XenClient installer iso image ISO_IMAGE from the contents of the
12 | directory ISO_DIR.
13 | EOF
14 | }
15 |
16 | die()
17 | {
18 | echo "$(basename $0): $*" >&2
19 | exit 1
20 | }
21 |
22 | if [ $# -ne 4 ] ; then
23 | usage
24 | exit 1
25 | fi
26 |
27 | ISO_DIR="$1"
28 | ISO_IMAGE="$2"
29 | ISO_LABEL="$3"
30 | ISO_HDPFX="$4"
31 |
32 | xorriso -as mkisofs \
33 | -o "${ISO_IMAGE}" \
34 | -isohybrid-mbr "${ISO_HDPFX}" \
35 | -c "isolinux/boot.cat" \
36 | -b "isolinux/isolinux.bin" \
37 | -no-emul-boot \
38 | -boot-load-size 4 \
39 | -boot-info-table \
40 | -eltorito-alt-boot \
41 | -e "isolinux/efiboot.img" \
42 | -no-emul-boot \
43 | -isohybrid-gpt-basdat \
44 | -r \
45 | -J \
46 | -l \
47 | -V "${ISO_LABEL}" \
48 | -f \
49 | -quiet \
50 | "${ISO_DIR}" || die "xorriso failed"
51 |
--------------------------------------------------------------------------------
/do_sync_xt.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | #
3 | # Builds the Synchronizer XT RPMs. This should be run on a 64-bit CentOS 6
4 | # machine.
5 |
6 | set -e
7 |
8 | DEFAULT_REPOS="sync-database sync-cli sync-server sync-ui-helper"
9 |
10 | parse_args()
11 | {
12 | BUILD_ID="unknown"
13 | REPOS=
14 | VERBOSE=
15 |
16 | while getopts :i:r:v OPT; do
17 | case $OPT in
18 | i) BUILD_ID="$OPTARG " ;;
19 | r) REPOS="$REPOS$OPTARG " ;;
20 | v) VERBOSE="1" ;;
21 | *) usage ;;
22 | esac
23 | done
24 |
25 | shift $((OPTIND - 1))
26 | [ $# -eq 1 ] || usage
27 |
28 | BASE_DIR="$1"
29 |
30 | [ "$BASE_DIR" ] || usage
31 | [ "$REPOS" ] || REPOS="$DEFAULT_REPOS"
32 | }
33 |
34 | usage()
35 | {
36 | cat <&2
37 | Usage: $(basename $0) [-i BUILD_ID] [-r REPO_NAME ...] [-v] BASE_DIR
38 |
39 | Builds the Synchronizer XT RPMs.
40 |
41 | Requires the relevant git repositories to be checked out in BASE_DIR/src.
42 | Unless overridden with the -r option, these are:
43 |
44 | EOF
45 |
46 | for REPO in $DEFAULT_REPOS ; do
47 | echo " $REPO" >&2
48 | done
49 |
50 | cat <&2
51 |
52 | Builds the RPMs under BASE_DIR/build and copies the result to BASE_DIR/out.
53 | Should be run on a 64-bit CentOS 6 machine with the following installed:
54 |
55 | Oracle client
56 | python-argparse
57 | cx_Oracle
58 |
59 | EOF
60 |
61 | exit 1
62 | }
63 |
64 | check_repos()
65 | {
66 | echo "++++++++ Checking repositories ++++++++"
67 |
68 | for REPO in $REPOS ; do
69 | if [ ! -d src/$REPO ] ; then
70 | echo "Error: Need to check out $REPO in $BASE_DIR/src" >&2
71 | exit 1
72 | fi
73 | done
74 | }
75 |
76 | generate_source_tarballs()
77 | {
78 | echo "++++++++ Generating source tarballs ++++++++"
79 |
80 | for REPO in $REPOS ; do
81 | if [ -e src/$REPO/FILTER ] ; then
82 | FILTER=
83 | while read LINE ; do
84 | FILTER="$FILTER$REPO/$LINE "
85 | done < src/$REPO/FILTER
86 | else
87 | FILTER=$REPO
88 | fi
89 |
90 | echo $REPO.tar.gz
91 | tar -czf build/SOURCES/$REPO.tar.gz -C src --exclude .git $FILTER
92 | done
93 | }
94 |
95 | build_rpms()
96 | {
97 | cp "$OPENXT_DIR/sync-xt/"*.inc build/SPECS
98 |
99 | for REPO in $REPOS ; do
100 | for FILE in src/$REPO/*.spec src/$REPO/*.inc ; do
101 | if [ -e "$FILE" ] ; then
102 | cp "$FILE" build/SPECS
103 | fi
104 | done
105 | done
106 |
107 | BUILD_DIR="$(pwd)/build"
108 |
109 | (
110 | cd build/SPECS
111 |
112 | for SPEC in *.spec ; do
113 | echo "++++++++ Building $SPEC ++++++++"
114 |
115 | rm -rf ../BUILD
116 | mkdir ../BUILD
117 |
118 | rpmbuild --define "_topdir $BUILD_DIR" \
119 | --define "xc_build $BUILD_ID" \
120 | --define "xc_release $RELEASE" -bb "$SPEC"
121 | done
122 | )
123 | }
124 |
125 | copy_rpms_to_output_dir()
126 | {
127 | echo "++++++++ Copying RPMs to output directory ++++++++"
128 |
129 | install -m 644 build/RPMS/*/*.rpm out/
130 | ls -1 out
131 | }
132 |
133 | parse_args "$@"
134 |
135 | [ "$VERBOSE" ] && set -x
136 |
137 | OPENXT_DIR="$(pwd)/$(dirname $0)"
138 |
139 | cd "$BASE_DIR" || exit 1
140 |
141 | check_repos
142 |
143 | rm -rf build out
144 | mkdir build/{,RPMS,SOURCES,SPECS,SRPMS} out
145 |
146 | # Get RELEASE
147 | . "$OPENXT_DIR/version"
148 |
149 | generate_source_tarballs
150 | build_rpms
151 | copy_rpms_to_output_dir
152 |
--------------------------------------------------------------------------------
/example-config:
--------------------------------------------------------------------------------
1 | # OpenXT branch to build.
2 | BRANCH="master"
3 |
4 | # OpenEmbedded branch to build.
5 | OE_BRANCH="pyro"
6 |
7 | # OpenXT git repositories. Optionally replace with a local mirror.
8 | OPENXT_GIT_MIRROR="github.com/OpenXT"
9 | OPENXT_GIT_PROTOCOL="git"
10 |
11 | # Optional mirror of upstream OpenEmbedded git repositories.
12 | OE_GIT_MIRROR=
13 |
14 | # Bitbake default version to checkout
15 | BB_BRANCH="1.34"
16 | # Bitbake tag to override checkout
17 | #BITBAKE_TAG="1.34"
18 |
19 | # OpenXT repos and tags REPO and TAG must be set
20 | XENCLIENT_REPO=git://github.com/OpenXT/xenclient-oe.git
21 | XENCLIENT_TAG=${BRANCH}
22 | META_OPENXT_OCAML_PLATFORM_REPO=https://github.com/OpenXT/meta-openxt-ocaml-platform.git
23 | META_OPENXT_OCAML_PLATFORM_TAG=${BRANCH}
24 | META_OPENXT_HASKELL_PLATFORM_REPO=https://github.com/OpenXT/meta-openxt-haskell-platform.git
25 | META_OPENXT_HASKELL_PLATFORM_TAG=${BRANCH}
26 |
27 | # OpenEmbedded repos (TAG defaults to ${OE_BRANCH} if not set)
28 | #BITBAKE_REPO=git://git.openembedded.org/bitbake.git
29 | #OE_CORE_REPO=git://git.openembedded.org/openembedded-core
30 | #META_OE_REPO=git://git.openembedded.org/meta-openembedded
31 | #META_JAVA_REPO=git://git.yoctoproject.org/meta-java
32 | #META_SELINUX_REPO=git://git.yoctoproject.org/meta-selinux
33 | #META_INTEL_REPO=git://git.yoctoproject.org/meta-intel
34 | #META_VIRTUALIZATION_REPO=git://git.yoctoproject.org/meta-virtualization.git
35 |
36 | # Ideally this would be the same branch of meta-selinux as OE_BRANCH (e.g.
37 | # pyro), but meta-selinux doesn't have a pyro branch. So we set it to master
38 | # for now.
39 | # Edit if you need a specific commit from meta-selinux.
40 | #META_SELINUX_TAG=master
41 |
42 | # Downloads needed for OpenXT build. Optionally replace with a local mirror.
43 | OPENXT_MIRROR="http://mirror.openxt.org"
44 |
45 | # Used to construct build name.
46 | NAME_SITE="openxt"
47 | BUILD_TYPE="dev"
48 |
49 | # Disables bitbake's "rm_work" task. Leaves sources in build tree at end.
50 | INHIBIT_RMWORK="yes"
51 |
52 | # Uncomment for more verbose build output.
53 | #DEBUG="yes"
54 |
55 | # Certificates for signing OpenXT install/upgrade repositories:
56 | #
57 | # - development CA cert, included in dom0 filesystem
58 | # - development signing cert (child of CA cert) and private key
59 | # - production CA cert, also included in dom0 filesystem
60 | #
61 | # Every build is signed by the development signing key. Release builds can
62 | # then be re-signed by the production signing key.
63 | #
64 | # TODO: Explain how to generate these files.
65 | REPO_PROD_CACERT=
66 | REPO_DEV_CACERT=
67 | REPO_DEV_SIGNING_CERT=
68 | REPO_DEV_SIGNING_KEY=
69 |
70 | # NEVER_GET_LOG disable log collection, which makes the build faster
71 | #NEVER_GET_LOG=1
72 |
73 | # IMPORTANT: Some of the next options may not work correctly if you did not \
74 | # specify a unique build ID using ./do_build.sh -i
75 |
76 | # SYNC_CACHE_OE is an rsync destination for OE downloads and archives.
77 | # It is used by those do_build.sh steps:
78 | # - sync_cache: rsync oe-download (tarballs) to SYNC_CACHE_OE
79 | # - sync_cache_back: rsync oe-download from SYNC_CACHE_OE to the tree
80 | #SYNC_CACHE_OE=/home/builds/oe
81 |
82 | # BUILD_RSYNC_DESTINATION is where the build output is copied to
83 | # It is used by those do_build.sh steps:
84 | # - copy: copies the build output to BUILD_RSYNC_DESTINATION
85 | #BUILD_RSYNC_DESTINATION=/home/builds
86 |
87 | # NETBOOT_HTTP_URL is used by the package manager to find the package repository
88 | #NETBOOT_HTTP_URL=http://openxt.example.org/builds
89 |
90 | # TODO: Add descriptions for:
91 | # - FREEZE_URIS
92 | # - OE_TARBALL_MIRROR
93 |
--------------------------------------------------------------------------------
/github/clone_organization.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Generate a token there: https://github.com/settings/tokens
4 | if [ -e "$1" ]; then
5 | TOKEN=$(cat $1)
6 | else
7 | TOKEN="$1"
8 | fi
9 | ORGANIZATION=$2
10 |
11 | # Get the list of OpenXT repos
12 | repos=`curl -H "Authorization: token $TOKEN" -s "https://api.github.com/users/$ORGANIZATION/repos?page=1&per_page=100" | jq '.[].name' | cut -d '"' -f 2`
13 | repos+=`curl -H "Authorization: token $TOKEN" -s "https://api.github.com/users/$ORGANIZATION/repos?page=2&per_page=100" | jq '.[].name' | cut -d '"' -f 2`
14 | repos+=`curl -H "Authorization: token $TOKEN" -s "https://api.github.com/users/$ORGANIZATION/repos?page=3&per_page=100" | jq '.[].name' | cut -d '"' -f 2`
15 |
16 | for i in $repos;
17 | do
18 | echo "Cloning $i..."
19 | git clone git://github.com/$ORGANIZATION/$i $i.git
20 | done
21 |
--------------------------------------------------------------------------------
/github/commit_to_pull_request.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | [ $# -eq 3 ] || exit 1
4 |
5 | # Generate a token there: https://github.com/settings/tokens
6 | if [ -e "$1" ]; then
7 | TOKEN=$(cat $1)
8 | else
9 | TOKEN="$1"
10 | fi
11 | REPO="$2"
12 | COMMIT="$3"
13 |
14 | total=`curl -I -H "Authorization: token $TOKEN" -s "https://api.github.com/repos/openxt/${REPO}/pulls?state=closed" 2>&1 | grep ^Link | sed 's/.*page=\([0-9]\+\)>; rel="last".*/\1/'`
15 | [ -z $total ] && total=1
16 |
17 | page=1
18 | pull_requests=""
19 | while [ $page -le $total ]; do
20 | pull_requests="$pull_requests `curl -H "Authorization: token $TOKEN" -s "https://api.github.com/repos/openxt/${REPO}/pulls?state=closed&page=$page" | jq '.[].number'`"
21 | page=$(( $page + 1 ))
22 | done
23 |
24 | for pr in $pull_requests; do
25 | # Filtering out rejected pull requests would make sense
26 | # However it makes everything slower and uses twice as many requests
27 | # Uncomment if needed
28 | # merged=`curl -H "Authorization: token $TOKEN" -s "https://api.github.com/repos/openxt/${REPO}/pulls/${pr}" | jq '.merged'`
29 | # [ "x$merged" != "xtrue" ] && continue
30 | commits="`curl -H "Authorization: token $TOKEN" -s https://api.github.com/repos/openxt/${REPO}/pulls/${pr}/commits | jq '.[].sha'`"
31 | if [ "$commits" != "" ]; then
32 | for commit in $commits; do
33 | sha=`echo $commit | cut -d '"' -f 2`
34 | if [[ ${sha} == ${COMMIT}* ]]; then
35 | echo "https://github.com/OpenXT/${REPO}/pull/${pr}"
36 | exit 0
37 | fi
38 | done
39 | fi
40 | done
41 |
42 | echo "Not found"
43 | exit 1
44 |
--------------------------------------------------------------------------------
/github/list_merges.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Generate a token there: https://github.com/settings/tokens
4 |
5 | usage()
6 | {
7 | echo "./list_merges.sh "
8 | exit $1
9 | }
10 |
11 | [ $# -eq 3 ] || usage 1
12 |
13 | # Generate a token there: https://github.com/settings/tokens
14 | if [ -e "$1" ]; then
15 | TOKEN=$(cat $1)
16 | else
17 | TOKEN="$1"
18 | fi
19 | USER="$2"
20 | DATE="$3"
21 |
22 | # Get the list of OpenXT repos
23 | repos=`curl -H "Authorization: token $TOKEN" -s "https://api.github.com/users/openxt/repos?per_page=100" | jq '.[].name' | cut -d '"' -f 2`
24 |
25 | for i in $repos;
26 | do
27 | # Get the json list of commits
28 | declare -a "commits=(`curl -H "Authorization: token $TOKEN" -s "https://api.github.com/repos/openxt/$i/commits?author=$USER&since=${DATE}-01&until=${DATE}-31" | jq '.[].commit.message'`)"
29 | for commit in "${commits[@]}"; do
30 | echo $commit | grep "^Merge pull request" >/dev/null 2>&1 || continue
31 | id=`echo $commit | sed 's/Merge pull request #\([0-9]\+\).*/\1/'`
32 | echo "https://github.com/OpenXT/$i/pull/$id"
33 | done
34 | done
35 |
--------------------------------------------------------------------------------
/github/list_open_pull_requests.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | [ $# -ge 1 ] || exit 1
4 |
5 | SHORT=
6 | if [ "$1" = "-s" ]; then
7 | SHORT=1
8 | shift
9 | fi
10 |
11 | [ $# -eq 1 ] || exit 2
12 |
13 | # Generate a token there: https://github.com/settings/tokens
14 | if [ -e "$1" ]; then
15 | TOKEN=$(cat $1)
16 | else
17 | TOKEN="$1"
18 | fi
19 |
20 | # Get the list of OpenXT repos
21 | repos=`curl -H "Authorization: token $TOKEN" -s "https://api.github.com/users/openxt/repos?per_page=100" | jq '.[].name' | cut -d '"' -f 2`
22 |
23 | total=0
24 | for i in $repos;
25 | do
26 | # Get the json list of pull requests
27 | PULLS="`curl -H "Authorization: token $TOKEN" -s https://api.github.com/repos/openxt/$i/pulls`"
28 | # Get the list of pull request numbers
29 | PRS="`echo $PULLS | jq '.[].number'`"
30 | OIFS=$IFS
31 | IFS=$'\n'
32 | TITLES=(`echo $PULLS | jq '.[].title'`)
33 | LOGINS=(`echo $PULLS | jq '.[].user.login' | tr -d '"'`)
34 | [ -z $SHORT ] && BRANCHES=(`echo $PULLS | jq '.[].head.ref' | tr -d '"'`)
35 | [ -z $SHORT ] && ORIG_BRANCHES=(`echo $PULLS | jq '.[].base.ref' | tr -d '"'`)
36 | IFS=$OIFS
37 | if [ "$PRS" != "" ]; then
38 | echo "Repository: $i -- Open pull requests:"
39 | n=0
40 | for PR in $PRS; do
41 | if [ -z $SHORT ]; then
42 | b=`echo ${ORIG_BRANCHES[$n]} | sed -e 's/^master$/MA/' -e 's/^stable-\([0-9]\+\)$/S\1/'`
43 | echo " ## $b ## ${TITLES[$n]} ##"
44 | echo " PR URL: https://github.com/OpenXT/$i/pull/$PR"
45 | echo " Buildbot: github.com/${LOGINS[$n]}:${BRANCHES[$n]}"
46 | echo " Code: https://github.com/${LOGINS[$n]}/$i/tree/${BRANCHES[$n]}"
47 | else
48 | echo -n "https://github.com/OpenXT/$i/pull/$PR"
49 | echo " - ${TITLES[$n]} (${LOGINS[$n]})"
50 | fi
51 | n=$(( $n + 1 ))
52 | done
53 | total=$(( $total + $n ))
54 | echo
55 | fi
56 | done
57 |
58 | echo "TOTAL: $total open pull requests"
59 |
--------------------------------------------------------------------------------
/github/list_repos.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Generate a token there: https://github.com/settings/tokens
4 | if [ -e "$1" ]; then
5 | TOKEN=$(cat $1)
6 | else
7 | TOKEN="$1"
8 | fi
9 |
10 | # Get the list of OpenXT repos
11 | repos=`curl -H "Authorization: token $TOKEN" -s "https://api.github.com/users/openxt/repos?per_page=100" | jq '.[].name' | cut -d '"' -f 2`
12 |
13 | for i in $repos;
14 | do
15 | echo $i
16 | done
17 |
--------------------------------------------------------------------------------
/github/list_teams.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | [ $# -eq 1 ] || exit 1
4 |
5 | # Generate a token there: https://github.com/settings/tokens
6 | if [ -e "$1" ]; then
7 | TOKEN=$(cat $1)
8 | else
9 | TOKEN="$1"
10 | fi
11 |
12 | # Get the list of OpenXT repos
13 | teams_list=`curl -H "Authorization: token $TOKEN" -s "https://api.github.com/orgs/OpenXT/teams?per_page=100"`
14 | declare -a "teams=(`echo $teams_list | jq '.[].name'`)"
15 | declare -a "members=(`echo $teams_list | jq '.[].members_url' | sed 's/{.*}//g'`)"
16 | declare -a "repositories=(`echo $teams_list | jq '.[].repositories_url'`)"
17 |
18 | n=0
19 | for team in "${teams[@]}";
20 | do
21 | declare -a "mems=(`curl -H "Authorization: token $TOKEN" -s "${members[$n]}?per_page=100" | jq '.[].login'`)"
22 | declare -a "repos=(`curl -H "Authorization: token $TOKEN" -s "${repositories[$n]}?per_page=100" | jq '.[].name'`)"
23 | echo "Team: $team"
24 | echo " Repositories:"
25 | for repo in "${repos[@]}"; do
26 | echo " $repo"
27 | done
28 | echo " Members:"
29 | for mem in "${mems[@]}"; do
30 | echo " $mem"
31 | done
32 | echo
33 | n=$(( $n + 1 ))
34 | done
35 |
--------------------------------------------------------------------------------
/github/pr_merger.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash -e
2 |
3 | usage() {
4 | echo "usage: pr_merger.sh [PR2 [PR3 [PR4 [...]]]]" >&2
5 | echo " where PRX is the pull request number" >&2
6 | exit $1
7 | }
8 |
9 | [ $# -lt 3 ] && usage 1
10 |
11 | # Generate a token there: https://github.com/settings/tokens
12 | if [ -e "$1" ]; then
13 | TOKEN=$(cat $1)
14 | else
15 | TOKEN="$1"
16 | fi
17 | REPO="$2"
18 | shift 2
19 |
20 | TEMPDIR=`mktemp -d`
21 | TEMPFILE=`mktemp`
22 |
23 | login=`curl -H "Authorization: token $TOKEN" -s "https://api.github.com/user" | jq '.login' | cut -d '"' -f 2`
24 |
25 | cloned=0
26 | branch=""
27 | final="prs"
28 |
29 | for pr in $@; do
30 | curl -H "Authorization: token ${TOKEN}" -s "https://api.github.com/repos/openxt/${REPO}/pulls/${pr}" > $TEMPFILE
31 | base_branch=`cat $TEMPFILE | jq '.base.ref' | cut -d '"' -f 2`
32 | if [ $cloned -eq 0 ]; then
33 | branch=$base_branch
34 | git clone -q -b $branch https://github.com/OpenXT/${REPO}.git ${TEMPDIR}/${REPO}
35 | cd ${TEMPDIR}/${REPO}
36 | git remote add $login git@github.com:${login}/${REPO}.git
37 | cloned=1
38 | fi
39 | if [ $base_branch != $branch ]; then
40 | echo "Branch mismatch" >&2
41 | exit 2
42 | fi
43 | head=`cat $TEMPFILE | jq '.head.repo.html_url' | cut -d '"' -f 2`
44 | head_branch=`cat $TEMPFILE | jq '.head.ref' | cut -d '"' -f 2`
45 | git remote add "pr${pr}" $head
46 | git fetch -q "pr${pr}"
47 | git merge -q --no-edit "pr${pr}/${head_branch}"
48 | final="${final}-${pr}"
49 | done
50 |
51 | git push -q $login $branch:$final
52 |
53 | echo "Done!"
54 | echo "URL: https://github.com/${login}/${REPO}/tree/${final}"
55 | echo "BuildBot: github.com/${login}:${final}"
56 |
57 | cd - >/dev/null
58 | chmod -R +w ${TEMPDIR}
59 | rm -rf ${TEMPDIR}
60 | rm ${TEMPFILE}
61 |
--------------------------------------------------------------------------------
/github/release.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash -e
2 |
3 | # Generate a token there: https://github.com/settings/tokens
4 |
5 | usage()
6 | {
7 | echo "./release.sh "
8 | exit $1
9 | }
10 |
11 | [ $# -eq 3 ] || usage 1
12 |
13 | if [ -e "$1" ]; then
14 | TOKEN=$(cat $1)
15 | else
16 | TOKEN="$1"
17 | fi
18 | BRANCH="$2"
19 | TAG="$3"
20 |
21 | # Get the list of OpenXT repos
22 | repos=`curl -H "Authorization: token $TOKEN" -s "https://api.github.com/users/openxt/repos?per_page=100" | jq '.[].name' | cut -d '"' -f 2`
23 |
24 | for i in $repos;
25 | do
26 | # Release!
27 | curl -s -X POST "https://api.github.com/repos/openxt/${i}/releases" \
28 | -H "Authorization: token $TOKEN" \
29 | -H "Content-Type: application/json" \
30 | -d "{\"tag_name\":\"${TAG}\",\"target_commitish\":\"${BRANCH}\",\"name\":\"OpenXT ${TAG}\",\"body\":\"\",\"draft\":false,\"prerelease\":false}"
31 | done
32 |
--------------------------------------------------------------------------------
/info_sr.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh -e
2 |
3 | get_cpu()
4 | {
5 | cat cpuinfo.log | sed -n -re 's/^model name.*: (.*)$/\1/p'
6 | }
7 |
8 | get_pci_class()
9 | {
10 | local class="$1"
11 | cat lspci-mmnn.log | grep "\[${class}\]" | sed -re 's/"//g'
12 | }
13 |
14 | get_xc_build_info()
15 | {
16 | local info="$1"
17 |
18 | cat xenclient.conf.log | sed -n -re "s/^${info} = (.*)$/\1/p"
19 | }
20 |
21 | get_txt_measured()
22 | {
23 | if grep -q 'TXT measured launch: TRUE' txt-stat.log
24 | then
25 | echo "true"
26 | else
27 | echo "false"
28 | fi
29 | }
30 |
31 | get_wired_mac()
32 | {
33 | cat ifconfig.log | grep brbridged | sed -n -re 's/.* HWaddr ([0-9A-F:]*).*/\1/p'
34 | }
35 |
36 | get_asset()
37 | {
38 | f="/home/xc_assets/data/by_mac/`get_wired_mac`/ham"
39 | [ -f "$f" ] && cat "$f"
40 | }
41 |
42 | get_dmi_info()
43 | {
44 | local table="$1"
45 | local field="$2"
46 | sed -n -re "/DMI type ${table},/,/^$/ s/.*${field}: (.*)$/\1/p" dmidecode.log
47 | }
48 |
49 | get_bios_info()
50 | {
51 | get_dmi_info "0" "$1"
52 | }
53 |
54 | get_machine_info()
55 | {
56 | get_dmi_info "1" "$1"
57 | }
58 |
59 | get_xenops_physinfo()
60 | {
61 | cat xenops_physinfo.log | sed -n -re "s/${1} = (.*)$/\1/p"
62 | }
63 |
64 | get_vm_node()
65 | {
66 | local db="$1"
67 | local field="$2"
68 | sed -n -re "s|.*\"${field}\": \"(.*)\".*|\1|p" "${db}"
69 | }
70 |
71 | display_vm()
72 | {
73 | local db="$1"
74 | local format=""
75 |
76 | printf "%s\n" "`get_vm_node "$db" "uuid"`"
77 |
78 | format=" %-20s: %s\n"
79 |
80 | for i in \
81 | name hvm slot start_on_boot \
82 | memory amt-pt hibernated \
83 | gpu \
84 | pv-addons-installed pv-addons-version portica-installed \
85 | portica-enabled
86 | do
87 | printf "$format" "$i" "`get_vm_node "$db" "$i"`"
88 | done
89 | echo ""
90 | }
91 |
92 | tmp=`mktemp -d`
93 |
94 | tar -C ${tmp} -xf "$1"
95 | cd "${tmp}"/*
96 | tar -xf vms.tar.bz2
97 | tar -xf syslog.tar.bz2
98 |
99 | format="%-40s %s\n"
100 | printf "$format" "XenClient build" "`get_xc_build_info 'build'`"
101 | printf "$format" "XenClient build date" "`get_xc_build_info 'build_date'`"
102 | printf "$format" "XenClient build branch" "`get_xc_build_info 'build_branch'`"
103 | printf "$format" "XenClient build tools" "`get_xc_build_info 'tools'`"
104 | printf "$format" "XenClient release" "`get_xc_build_info 'release'`"
105 |
106 | echo ""
107 | printf "$format" "Asset" "`get_asset`"
108 | printf "$format" "BIOS Vendor" "`get_bios_info 'Vendor'`"
109 | printf "$format" "BIOS Version" "`get_bios_info 'Version'`"
110 | printf "$format" "BIOS Release Date" "`get_bios_info 'Release Date'`"
111 |
112 | echo ""
113 | printf "$format" "Manufacturer" "`get_machine_info 'Manufacturer'`"
114 | printf "$format" "Product" "`get_machine_info 'Product Name'`"
115 | printf "$format" "Serial" "`get_machine_info 'Serial Number'`"
116 | printf "$format" "Wake UP" "`get_machine_info 'Wake-up Type'`"
117 | printf "$format" "SKU" "`get_machine_info 'SKU Number'`"
118 | printf "$format" "UUID" "`get_machine_info 'UUID'`"
119 |
120 | echo ""
121 | printf "$format" "CPU" "`get_cpu`"
122 | printf "$format" "CPUs" "`get_xenops_physinfo 'nr_cpus'`"
123 | printf "$format" "RAM" "`get_xenops_physinfo 'total_pages'`"
124 | printf "$format" "GPU" "`get_pci_class 0300`"
125 | printf "$format" "Wireless Card" "`get_pci_class 0280`"
126 | printf "$format" "Wired Card" "`get_pci_class 0200`"
127 | printf "$format" "Wired Mac" "`get_wired_mac`"
128 | printf "$format" "TXT measured" "`get_txt_measured`"
129 |
130 | echo ""
131 | for i in *.db
132 | do
133 | display_vm "$i"
134 | done
135 |
136 |
137 |
138 |
139 | cd /tmp
140 | rm -rf "${tmp}"
141 |
--------------------------------------------------------------------------------
/manifest:
--------------------------------------------------------------------------------
1 | control tarbz2 required control.tar.bz2 /
2 | dom0 ext3gz required dom0-rootfs.ext3.gz /
3 | uivm vhdgz required uivm-rootfs.ext3.vhd.gz /storage/uivm
4 | ndvm vhdgz required ndvm-rootfs.ext3.disk.vhd.gz /storage/ndvm
5 | syncvm vhdgz optional syncvm-rootfs.ext3.vhd.gz /storage/syncvm
6 | file iso optional xc-tools.iso /storage/isos/xc-tools.iso
7 |
--------------------------------------------------------------------------------
/merge_src_info.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 |
3 | import json
4 | import os
5 | import sys
6 |
7 | if len(sys.argv) != 3:
8 | sys.stderr.write("Usage: %s INPUT_DIR OUTPUT_FILE\n" %
9 | os.path.basename(sys.argv[0]))
10 | exit(1)
11 |
12 | input_dir, output_file = sys.argv[1:]
13 |
14 | data = {}
15 |
16 | for arch in os.listdir(input_dir):
17 | for pkg in os.listdir(os.path.join(input_dir, arch)):
18 | with open(os.path.join(input_dir, arch, pkg)) as f:
19 | data.setdefault(pkg, {})[arch] = json.load(f)
20 |
21 | with open(output_file, "w") as f:
22 | json.dump(data, f, indent=4, sort_keys=True)
23 |
--------------------------------------------------------------------------------
/pkg-xctools/README:
--------------------------------------------------------------------------------
1 | To install the XenClient tools for Linux, open a terminal window, change
2 | to this directory and execute:
3 |
4 | $ sudo ./install.sh
5 |
6 | The various PV drivers can be excluded from the install using the following:
7 |
8 | $ sudo XC_TOOLS_EXCLUDE=vusb,v4v ./install.sh
9 |
10 | This would prevent both the vusb and v4v PV drivers from being insalled.
11 |
12 | Possible values for XC_TOOLS_EXCLUDE: v4v xenmou vusb
13 |
--------------------------------------------------------------------------------
/pkg-xctools/build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash -ex
2 |
3 | source ${BUILD_SCRIPTS}/build_helpers.sh
4 | source ${BUILD_SCRIPTS}/version
5 |
6 | export AWK=/usr/bin/awk
7 |
8 | make_bundle_pv_drivers()
9 | {
10 | local PDST_DIR="${3}/usr/src/openxt-${1}-1.0"
11 | local PSRC_DIR="${2}/openxt-${1}"
12 | local PDOC_DIR="${3}/usr/share/doc/openxt-${1}"
13 | local PLIN_DIR="${3}/usr/share/lintian/overrides/openxt-${1}"
14 | pushd $PSRC_DIR
15 | install -m 0644 -D dkms/lintian ${PLIN_DIR}
16 | install -m 0755 -d ${PDOC_DIR}
17 | cp ../COPYING ${PDOC_DIR}/copyright
18 | rm -rf dkms
19 | mkdir -p $PDST_DIR
20 | cp -a . $PDST_DIR
21 | popd
22 | }
23 |
24 | # Usage: make_bundle_xctools
25 | # 2011-07-14: TODO: This should be considered as a temporary solution.
26 | # 2012-11-27: it definitely should have.
27 | # 2015-06-24: I would like to echo that last sentiment also.
28 | make_bundle_xctools()
29 | {
30 | local path=`cd "$1"; pwd`
31 | local out_dir="$2"
32 | local deb="${out_dir}/xenclient-linuxtools.deb"
33 | local deb_tmp="${path}/xctools/deb-tmp"
34 | local deb_data="${deb_tmp}/data"
35 | local deb_control="${deb_tmp}/control"
36 | local rpm_tmp="${path}/xctools/rpm-tmp"
37 |
38 | rm -rf ${deb_tmp} ${rpm_tmp} git-tmp
39 | mkdir -p ${rpm_tmp}/{,RPMS,SOURCES,SPECS,SRPMS}
40 | mkdir -p ${deb_control} ${deb_data}/usr/src
41 | # Default control files for the bundle.
42 | cp -rTf ${BUILD_SCRIPTS}/pkg-xctools/control ${deb_control}
43 | cp -rTf ${BUILD_SCRIPTS}/pkg-xctools/data ${deb_data}
44 |
45 | # libv4v
46 | mkdir -p git-tmp
47 | git_clone "git-tmp" "${OPENXT_GIT_PROTOCOL}://${OPENXT_GIT_MIRROR}/v4v.git" "${BRANCH}" "$ALLOW_SWITCH_BRANCH_FAIL"
48 | cp -rT git-tmp/libv4v ${deb_data}/usr/src/libv4v-1.0
49 | mkdir -p ${deb_data}/usr/src/libv4v-1.0/src/linux/ && cp git-tmp/v4v/linux/v4v_dev.h ${deb_data}/usr/src/libv4v-1.0/src/linux/
50 | rm -rf git-tmp
51 |
52 | # pv-linux-drivers
53 | local PTMP_DIR="pv-linux-drivers"
54 | rm -rf $PTMP_DIR
55 | mkdir -p $PTMP_DIR
56 | git_clone $PTMP_DIR "${OPENXT_GIT_PROTOCOL}://${OPENXT_GIT_MIRROR}/pv-linux-drivers.git" "${BRANCH}" "$ALLOW_SWITCH_BRANCH_FAIL"
57 | for pvd in "v4v" "xenmou" "vusb"
58 | do
59 | make_bundle_pv_drivers $pvd $PTMP_DIR $deb_data
60 | done
61 | rm -rf $PTMP_DIR
62 | mkdir -p ${deb_data}/lib/udev/rules.d
63 | ( cd ${BUILD_SCRIPTS}/pkg-xctools/udev-rules/ && cp *.rules ${deb_data}/lib/udev/rules.d/ )
64 |
65 | # xenstore-agent
66 | mkdir -p git-tmp
67 | git_clone "git-tmp" "${OPENXT_GIT_PROTOCOL}://${OPENXT_GIT_MIRROR}/manager.git" "${BRANCH}" "$ALLOW_SWITCH_BRANCH_FAIL"
68 | cp -rT git-tmp/linuxtools/xenstore-agent ${deb_data}/usr/src/xenstore-agent-1.0
69 | rm -rf git-tmp
70 |
71 | # xblanker
72 | rm -rf "${deb_data}/usr/src/xblanker-1.0"
73 | mkdir -p "${deb_data}/usr/src/xblanker-1.0"
74 | git_clone "${deb_data}/usr/src/xblanker-1.0" "${OPENXT_GIT_PROTOCOL}://${OPENXT_GIT_MIRROR}/xblanker.git" "${BRANCH}" "$ALLOW_SWITCH_BRANCH_FAIL"
75 | rm -rf "${deb_data}/usr/src/xblanker-1.0/.git"
76 |
77 | # xf86-video-vesa
78 | rm -rf "${deb_data}/usr/src/xf86-video-vesa-1.0"
79 | mkdir -p git-tmp
80 | git_clone "git-tmp" "${OPENXT_GIT_PROTOCOL}://${OPENXT_GIT_MIRROR}/xctools.git" "${BRANCH}" "$ALLOW_SWITCH_BRANCH_FAIL"
81 | cp -rT git-tmp/xf86-video-vesa-2.3.2 ${deb_data}/usr/src/xf86-video-vesa-1.0
82 | rm -rf git-tmp
83 |
84 | # Deal with control stuff
85 | pushd ${deb_tmp}
86 | local size=`du -s ${deb_data} | cut -f1`
87 | sed -e "s/@SIZE@/${size}/" -i ${deb_control}/control
88 |
89 | mkdir -p ${deb_data}/usr/share/lintian/overrides
90 | cat - > ${deb_data}/usr/share/lintian/overrides/xc-tools < ${deb_control}/conffiles
102 | find * -type f -exec md5sum {} \; > ${deb_control}/md5sums
103 | tar cz --owner=root --group=root -f ${deb_tmp}/data.tar.gz * --exclude=.#* --exclude=*~ --exclude=#*# --exclude-vcs
104 | cp ${deb_tmp}/data.tar.gz ${rpm_tmp}/SOURCES/xc-tools.tar.gz
105 | popd
106 | pushd ${deb_control}
107 | sed -e "s/@XENCLIENT_TOOLS@/${XENCLIENT_TOOLS}/" -i postinst
108 | chmod 755 post* pre*
109 | tar -cz --owner=root --group=root -f ${deb_tmp}/control.tar.gz * --exclude=.#* --exclude=*~ --exclude=#*# --exclude-vcs
110 | popd
111 | popd
112 | echo "2.0" > ${deb_tmp}/debian-binary
113 | ar rcD ${deb} ${deb_tmp}/debian-binary ${deb_tmp}/control.tar.gz ${deb_tmp}/data.tar.gz
114 |
115 | if which lintian 2>/dev/null && ! lintian ${deb}; then
116 | echo Xenclient Linux tools package fails sanity check
117 | rm ${deb}
118 | fi
119 | rm -rf ${deb_tmp}
120 |
121 | # I'm so sorry :(
122 | pushd ${rpm_tmp}/SPECS
123 | cp ${BUILD_SCRIPTS}/sync-xt/*.inc .
124 | cp ${BUILD_SCRIPTS}/pkg-xctools/xc-tools.spec .
125 | (cd ${BUILD_SCRIPTS}/pkg-xctools && tar cz centos) > ../SOURCES/xc-tools-centos.tar.gz
126 |
127 | for i in postinst prerm postrm ; do
128 | sed "s/@XENCLIENT_TOOLS@/${XENCLIENT_TOOLS}/" \
129 | ${BUILD_SCRIPTS}/pkg-xctools/control/${i} > xc-tools-${i}.inc
130 | done
131 |
132 | rpmbuild --define "_topdir ${rpm_tmp}" \
133 | --define "xc_build ${BRANCH}" \
134 | --define "xc_release ${RELEASE}" -bb xc-tools.spec
135 |
136 | popd
137 |
138 | cp ${rpm_tmp}/RPMS/noarch/*.rpm ${out_dir}
139 | rm -rf ${rpm_tmp}
140 | }
141 |
142 | make_bundle_xctools "$1" xc-tools-tmp/linux
143 |
144 |
--------------------------------------------------------------------------------
/pkg-xctools/centos/xblanker:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | #
3 | # xblanker
4 | #
5 | # chkconfig: 2345 76 24
6 | # description: xblanker
7 |
8 | ### BEGIN INIT INFO
9 | # Provides: xblanker
10 | # Required-Start: $remote_fs $syslog
11 | # Required-Stop: $remote_fs $syslog
12 | # Should-Start:
13 | # Should-Stop:
14 | # Default-Start: 2 3 4 5
15 | # Default-Stop: 0 1 6
16 | # Short-Description: xblanker
17 | # Description: xblanker
18 | ### END INIT INFO
19 |
20 | # Source function library.
21 | . /etc/rc.d/init.d/functions
22 |
23 | daemon=/usr/local/bin/xblanker
24 | prog=`basename $daemon`
25 |
26 | lockfile=/var/lock/subsys/$prog
27 |
28 | load_modules() {
29 | echo -n $"Loading kernel modules for $prog: "
30 |
31 | if ! modprobe xenfs ; then
32 | failure
33 | echo
34 | exit 1
35 | fi
36 |
37 | success
38 | echo
39 | }
40 |
41 | mount_xenfs() {
42 | echo -n $"Mounting /proc/xen: "
43 | mount -t xenfs nodev /proc/xen 2>/dev/null
44 |
45 | success
46 | echo
47 | }
48 |
49 | start_xblanker() {
50 | # TODO: update xblanker to run as a daemon
51 | echo -n $"Starting $prog: "
52 |
53 | if ! daemon $daemon "&0" "2>&1" "&" ; then
54 | failure
55 | echo
56 | exit 1
57 | fi
58 |
59 | success
60 | echo
61 | }
62 |
63 | stop_xblanker() {
64 | echo -n $"Stopping $prog: "
65 | if ! killproc $prog ; then
66 | failure
67 | echo
68 | exit 1
69 | fi
70 |
71 | success
72 | echo
73 | }
74 |
75 | start() {
76 | load_modules
77 | mount_xenfs
78 | start_xblanker
79 |
80 | touch $lockfile
81 | }
82 |
83 | stop() {
84 | stop_xblanker
85 |
86 | rm -f $lockfile
87 | }
88 |
89 | restart() {
90 | stop
91 | start
92 | }
93 |
94 | reload() {
95 | restart
96 | }
97 |
98 | force_reload() {
99 | restart
100 | }
101 |
102 | status_q() {
103 | status $prog >/dev/null 2>&1
104 | }
105 |
106 |
107 | case "$1" in
108 | start)
109 | status_q && exit 0
110 | $1
111 | ;;
112 | stop)
113 | status_q || exit 0
114 | $1
115 | ;;
116 | restart)
117 | $1
118 | ;;
119 | reload)
120 | status_q || exit 7
121 | $1
122 | ;;
123 | force-reload)
124 | force_reload
125 | ;;
126 | status)
127 | status $prog
128 | ;;
129 | condrestart|try-restart)
130 | status_q || exit 0
131 | restart
132 | ;;
133 | *)
134 | echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
135 | exit 2
136 | esac
137 | exit 0
138 |
--------------------------------------------------------------------------------
/pkg-xctools/centos/xenstore-agent:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | #
3 | # xenstore-agent
4 | #
5 | # chkconfig: 2345 75 25
6 | # description: xenstore-agent
7 |
8 | ### BEGIN INIT INFO
9 | # Provides: xenstore-agent
10 | # Required-Start: $remote_fs $syslog
11 | # Required-Stop: $remote_fs $syslog
12 | # Should-Start:
13 | # Should-Stop:
14 | # Default-Start: 2 3 4 5
15 | # Default-Stop: 0 1 6
16 | # Short-Description: xenstore-agent
17 | # Description: xenstore-agent
18 | ### END INIT INFO
19 |
20 | # Source function library.
21 | . /etc/rc.d/init.d/functions
22 |
23 | daemon=/usr/bin/xs-agent
24 | prog=`basename $daemon`
25 | run_once_sh=/usr/src/xenstore-agent-1.0/run-one-time.sh
26 |
27 | lockfile=/var/lock/subsys/$prog
28 |
29 | load_modules() {
30 | echo -n $"Loading kernel modules for $prog: "
31 |
32 | for module in xenfs openxt-v4v ; do
33 | if ! modprobe $module ; then
34 | failure
35 | echo
36 | exit 1
37 | fi
38 | done
39 |
40 | success
41 | echo
42 | }
43 |
44 | mount_xenfs() {
45 | echo -n $"Mounting /proc/xen: "
46 | mount -t xenfs nodev /proc/xen 2>/dev/null
47 |
48 | success
49 | echo
50 | }
51 |
52 | run_once() {
53 | if [ -x $run_once_sh ] ; then
54 | echo -n $"Running one-time script for $prog: "
55 |
56 | if ! $run_once_sh ; then
57 | failure
58 | echo
59 | exit 1
60 | fi
61 |
62 | rm -f $run_once_sh
63 | echo
64 | success
65 | fi
66 | }
67 |
68 | start_agent() {
69 | vm_path=`xenstore-read vm`
70 | agent_opts="xen_vm_path:$vm_path:"
71 |
72 | # TODO: update xs-agent to run as a daemon
73 | echo -n $"Starting $prog: "
74 | if ! daemon $daemon $agent_opts "&0" "2>&1" "&" ; then
75 | failure
76 | echo
77 | exit 1
78 | fi
79 |
80 | success
81 | echo
82 | }
83 |
84 | stop_agent() {
85 | echo -n $"Stopping $prog: "
86 | if ! killproc $prog ; then
87 | failure
88 | echo
89 | exit 1
90 | fi
91 |
92 | success
93 | echo
94 | }
95 |
96 | start() {
97 | load_modules
98 | mount_xenfs
99 | run_once
100 | start_agent
101 |
102 | touch $lockfile
103 | }
104 |
105 | stop() {
106 | stop_agent
107 |
108 | rm -f $lockfile
109 | }
110 |
111 | restart() {
112 | stop
113 | start
114 | }
115 |
116 | reload() {
117 | restart
118 | }
119 |
120 | force_reload() {
121 | restart
122 | }
123 |
124 | status_q() {
125 | status $prog >/dev/null 2>&1
126 | }
127 |
128 |
129 | case "$1" in
130 | start)
131 | status_q && exit 0
132 | $1
133 | ;;
134 | stop)
135 | status_q || exit 0
136 | $1
137 | ;;
138 | restart)
139 | $1
140 | ;;
141 | reload)
142 | status_q || exit 7
143 | $1
144 | ;;
145 | force-reload)
146 | force_reload
147 | ;;
148 | status)
149 | status $prog
150 | ;;
151 | condrestart|try-restart)
152 | status_q || exit 0
153 | restart
154 | ;;
155 | *)
156 | echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
157 | exit 2
158 | esac
159 | exit 0
160 |
--------------------------------------------------------------------------------
/pkg-xctools/control/control:
--------------------------------------------------------------------------------
1 | Package: xc-tools
2 | Version: 1-2
3 | Maintainer: OpenXT Community
4 | Section: OpenXT
5 | License: GPLv2
6 | Installed-Size: @SIZE@
7 | Architecture: all
8 | Depends: dkms, make, linux-headers-generic | linux-headers-586 | linux-headers-686-pae | linux-headers-amd64, libc6 (>= 2.9), autoconf, pkg-config, gcc, libtool, zlib1g-dev, libx11-dev, libpciaccess-dev, pm-utils, xenstore-utils
9 | Priority: optional
10 | Description: OpenXT in-guest tools.
11 | OpenXT Linux in-guest software.
12 |
--------------------------------------------------------------------------------
/pkg-xctools/control/postinst:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | set -e
4 |
5 | XENCLIENT_TOOLS="@XENCLIENT_TOOLS@"
6 | HAS_V4V=""
7 |
8 | if [ -r /etc/redhat-release ] ; then
9 | DISTRO=rhel
10 | else
11 | DISTRO=debian
12 | fi
13 |
14 | if [ "${DISTRO}" = rhel -a "$(uname -m)" = x86_64 ] ; then
15 | LIBDIR=/usr/lib64
16 | LOCALLIBDIR=/usr/local/lib64
17 | else
18 | LIBDIR=/usr/lib
19 | LOCALLIBDIR=/usr/local/lib
20 | fi
21 |
22 | #
23 | # Deals with pv-drivers
24 | #
25 |
26 | # Usage: do_dkms_stage stage name version [kernel]
27 | do_dkms_stage()
28 | {
29 | local stage="$1"
30 | local pkg="$2"
31 | local ver="$3"
32 | local kernel="${4:+-k} $4"
33 | local rpm_safe=
34 |
35 | if [ "${DISTRO}" = rhel ] ; then
36 | rpm_safe="--rpm_safe_upgrade"
37 | fi
38 |
39 | dkms $stage -m $pkg -v $ver $kernel $rpm_safe
40 | }
41 |
42 | # Loop over all the pv driver packages and install them
43 | for PVD in "v4v" "xenmou" "vusb"
44 | do
45 | # Figure out what pv drivers are getting installed
46 | if [[ "x$XC_TOOLS_EXCLUDE" != "x" ]] && [[ "$XC_TOOLS_EXCLUDE" =~ "$PVD" ]]; then
47 | continue
48 | fi
49 |
50 | NAME=openxt-${PVD}
51 | PACKAGE=${NAME}
52 | VERSION=1.0
53 | SRCS=/usr/src/${PACKAGE}-${VERSION}
54 |
55 | pushd ${SRCS}
56 | echo "${PACKAGE}-${VERSION} installing ..."
57 |
58 | # Check if the initramfs/initrd needs updating for V4V
59 | # RHEL/CentOS: equivalent is /etc/dracut.conf.d/xc-tools in the RPM.
60 | if [ "${PVD}" == v4v ] && [ "${DISTRO}" = debian ]; then
61 | initrd_mod_file=/etc/initramfs-tools/modules
62 | if [ -f $initrd_mod_file ]; then
63 | for md in openxt-v4v; do
64 | egrep -q "${md}\$" $initrd_mod_file || sed -i "1i${md}" $initrd_mod_file
65 | done
66 | fi
67 | fi
68 |
69 | do_dkms_stage add ${PACKAGE} ${VERSION}
70 | do_dkms_stage build ${PACKAGE} ${VERSION}
71 | do_dkms_stage install ${PACKAGE} ${VERSION}
72 |
73 | echo "${PACKAGE}-${VERSION} installed."
74 |
75 | # Update initramfs/initrd and install header for v4v
76 | if [ "${PVD}" == v4v ]; then
77 | if [ "${DISTRO}" = debian ]; then
78 | update-initramfs -u -k all
79 | fi
80 |
81 | # FIXME: Run dracut? dkms does this already - but not for all kernels?
82 | # if [ "${UPDATERD}" == yes ]; then ...
83 |
84 | echo "${PACKAGE}-${VERSION} headers installing ..."
85 | make headers_install
86 | echo "${PACKAGE}-${VERSION} headers installed."
87 |
88 | modprobe openxt-v4v
89 | HAS_V4V="yes"
90 | fi
91 | popd
92 | done
93 |
94 | # Load the real xenfs and then the OpenXT custom modules
95 | modprobe xenfs
96 |
97 | #
98 | # Deals with libv4v
99 | #
100 | if [ -n "$HAS_V4V" ]; then
101 | NAME=libv4v
102 | PACKAGE=${NAME}
103 | VERSION=1.0
104 | SRCS=/usr/src/${PACKAGE}-${VERSION}
105 | pushd ${SRCS}
106 | echo "${PACKAGE}-${VERSION} building ..."
107 | ./autogen.sh
108 | ./configure --prefix=/usr --libdir=${LIBDIR}
109 |
110 | make install
111 |
112 | if [ "${DISTRO}" = rhel ] ; then
113 | /sbin/ldconfig
114 | fi
115 |
116 | echo "${PACKAGE}-${VERSION} installed."
117 | popd
118 | fi
119 |
120 | #
121 | # Deals with xblanker
122 | #
123 | NAME=xblanker
124 | PACKAGE=${NAME}
125 | VERSION=1.0
126 | SRCS=/usr/src/${PACKAGE}-${VERSION}
127 | pushd ${SRCS}
128 | echo "xblanker building ..."
129 | ./autogen.sh
130 | ./configure
131 | make install
132 | echo "xblanker installed."
133 | if [ "${DISTRO}" = rhel ] ; then
134 | # FIXME: Check priority on RHEL/CentOS. Needs to be after
135 | # xenstore-agent?
136 | /sbin/chkconfig --add xblanker
137 | else
138 | update-rc.d xblanker start 76 S .
139 | fi
140 | popd
141 |
142 |
143 | #
144 | # Deals with xenstore-agent
145 | #
146 | NAME=xenstore-agent
147 | PACKAGE=${NAME}
148 | VERSION=1.0
149 | SRCS=/usr/src/${PACKAGE}-${VERSION}
150 | pushd ${SRCS}
151 | echo "${PACKAGE}-${VERSION} building ..."
152 | make all
153 |
154 | echo "${PACKAGE}-${VERSION} installing ..."
155 | make install
156 | echo "${PACKAGE}-${VERSION} installed."
157 | if [ "${DISTRO}" = rhel ] ; then
158 | # FIXME: Check priority on RHEL/CentOS.
159 | /sbin/chkconfig --add xenstore-agent
160 | else
161 | update-rc.d xenstore-agent start 75 S .
162 | fi
163 | popd
164 |
165 | #
166 | # Deals with xf86-video-vesa
167 | #
168 | NAME=xf86-video-vesa
169 | PACKAGE=${NAME}
170 | VERSION=1.0
171 | SRCS=/usr/src/${PACKAGE}-${VERSION}
172 | if [ "${DISTRO}" = rhel ] ; then
173 | pushd ${SRCS}
174 | echo "${PACKAGE}-${VERSION} building ..."
175 | ./configure --libdir=${LOCALLIBDIR}
176 | make
177 |
178 | echo "${PACKAGE}-${VERSION} installing ..."
179 | make install
180 | mkdir -p /etc/X11/xorg.conf.d/
181 | cp 13-xorg-modules-path.conf /etc/X11/xorg.conf.d/
182 | echo "${PACKAGE}-${VERSION} installed."
183 | popd
184 | fi
185 |
186 | #
187 | # Fix text mode (remove bochs from the grub video list)
188 | #
189 | if [ -f /boot/grub/video.lst ]; then
190 | sed -i'' -re 's/video_bochs//' '/boot/grub/video.lst'
191 | update-grub
192 | fi
193 | (
194 | set +e;
195 | modprobe xenfs; modprobe openxt-v4v;
196 | chmod 0666 /dev/v4v_*;
197 | exit 0
198 | )
199 | ( set +e; mount -t xenfs nodev /proc/xen; exit 0 )
200 |
201 | ## do it at next reboot
202 | ##( set +e; /etc/init.d/xenstore-agent start; exit 0 )
203 |
204 | ( set +e; /etc/init.d/xblanker start; exit 0 )
205 |
206 | XCT_MAJORVERSION=$(echo "${XENCLIENT_TOOLS}" | cut -d. -f1)
207 | XCT_MINORVERSION=$(echo "${XENCLIENT_TOOLS}" | cut -d. -f2)
208 | XCT_MICROVERSION=$(echo "${XENCLIENT_TOOLS}" | cut -d. -f3)
209 | XCT_BUILDVERSION=$(echo "${XENCLIENT_TOOLS}" | cut -d. -f4)
210 |
211 | cat < "/usr/src/xenstore-agent-1.0/run-one-time.sh"
212 | #!/bin/sh
213 |
214 | export PATH="/bin:/usr/bin:/usr/sbin:/sbin:/usr/local/bin"
215 | xenstore-exists attr || xenstore-write "attr"
216 | xenstore-exists "attr/PVAddons" || xenstore-write "attr/PVAddons" ""
217 | xenstore-write "attr/PVAddons/Installed" "1"
218 | xenstore-write "attr/PVAddons/MajorVersion" "${XCT_MAJORVERSION}"
219 | xenstore-write "attr/PVAddons/MinorVersion" "${XCT_MINORVERSION}"
220 | xenstore-write "attr/PVAddons/MicroVersion" "${XCT_MICROVERSION}"
221 | xenstore-write "attr/PVAddons/BuildVersion" "${XCT_BUILDVERSION}"
222 |
223 | exit 0
224 | EOF
225 |
226 | chmod 755 "/usr/src/xenstore-agent-1.0/run-one-time.sh"
227 |
228 | exit 0
229 |
--------------------------------------------------------------------------------
/pkg-xctools/control/postrm:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | set +e
4 |
5 | if [ -r /etc/redhat-release ] ; then
6 | DISTRO=rhel
7 | else
8 | DISTRO=debian
9 | fi
10 |
11 | inc=/usr/include
12 | src=/usr/src
13 | bin=/usr/bin
14 |
15 | if [ "${DISTRO}" = rhel -a "$(uname -m)" = x86_64 ] ; then
16 | lib=/usr/lib64
17 | locallib=/usr/local/lib64
18 | else
19 | lib=/usr/lib
20 | locallib=/usr/local/lib
21 | fi
22 |
23 | if [ -f ${inc}/linux/v4v_dev.h ]; then
24 | # dkms cleans v4v-dkms, except postinst (make install)
25 | rm -rf ${inc}/linux/v4v_dev.h ${inc}/xen/v4v.h ${src}/v4v-dkms-1.0
26 |
27 | # libv4v is post-installed. Which means ...
28 | rm -rf ${src}/libv4v-1.0 ${lib}/libv4v{,_nointerposer}.{la,so,a} \
29 | ${lib}/libv4v{,_nointerposer}-1.0* ${lib}/pkgconfig/libv4v.pc \
30 | ${bin}/libv4v-config ${bin}/ttcp-v4v ${bin}/v4v-proxy ${bin}/viptables \
31 | ${inc}/libv4v.h
32 | fi
33 |
34 |
35 | # xenstore-agent post-installed binary
36 | rm -f ${bin}/xs-agent
37 | rm -rf ${src}/xenstore-agent-1.0
38 | if [ "${DISTRO}" = debian ] ; then
39 | update-rc.d -f xenstore-agent remove
40 | fi
41 |
42 | # xblanker post-installed binary
43 | rm -f /usr/local/bin/xblanker
44 | rm -rf ${src}/xblanker-1.0
45 | if [ "${DISTRO}" = debian ] ; then
46 | update-rc.d -f xblanker remove
47 | fi
48 |
49 | # xf86-video-vesa post-installed binary
50 | if [ "${DISTRO}" = rhel ] ; then
51 | rm -f ${locallib}/xorg/modules/drivers/vesa_drv.*
52 | rm -rf ${src}/xf86-video-vesa-1.0
53 | rm -r /etc/X11/xorg.conf.d/13-xorg-modules-path.conf
54 | fi
55 |
56 | # xenstore-tools-4.1 post-installed stuff
57 | rm -rf ${src}/xenstore-tools-xc ${inc}/xenstore_lib.h ${inc}/xenstore.h ${lib}/libxenstore*
58 | ( cd ${bin} && rm -f xenstore xenstore-chmod xenstore-control xenstore-exists xenstore-list xenstore-ls xenstore-read xenstore-rm xenstore-watch xenstore-write )
59 |
60 |
61 | exit 0
62 |
--------------------------------------------------------------------------------
/pkg-xctools/control/prerm:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | set +e
4 |
5 | if [ -r /etc/redhat-release ] ; then
6 | DISTRO=rhel
7 | else
8 | DISTRO=debian
9 | fi
10 |
11 | xenstore-exists attr || xenstore-write "attr"
12 | xenstore-exists "attr/PVAddons" || xenstore-write "attr/PVAddons" ""
13 | xenstore-write "attr/PVAddons/Installed" "0"
14 | xenstore-write "attr/PVAddonsUninstalled" "1"
15 |
16 | RUN_ONCE_SH="/usr/src/xenstore-agent-1.0/run-one-time.sh"
17 | [ -f "${RUN_ONCE_SH}" ] && rm -f ${RUN_ONCE_SH}
18 |
19 | if [ "$DISTRO" = rhel ] ; then
20 | DKMS_RPM_SAFE="--rpm_safe_upgrade"
21 | else
22 | DKMS_RPM_SAFE=
23 | fi
24 |
25 | for PVD in "v4v" "xenmou" "vusb"
26 | do
27 | NAME=openxt-${PVD}
28 | PACKAGE=${NAME}-dkms
29 | VERSION=1.0
30 | SRCS=/usr/src/${PACKAGE}-${VERSION}
31 |
32 | if [ ! -d "$SRCS" ]; then
33 | continue
34 | fi
35 |
36 | dkms remove -m ${PACKAGE} -v ${VERSION} --all ${DKMS_RPM_SAFE}
37 |
38 | done
39 |
40 |
41 | if [ "${DISTRO}" = rhel ] ; then
42 | chkconfig --del xenstore-agent
43 | chkconfig --del xblanker
44 | fi
45 |
46 | exit 0
47 |
48 |
--------------------------------------------------------------------------------
/pkg-xctools/copy.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash -ex
2 |
3 | destdir="$1"
4 |
5 | cp -p ${BUILD_SCRIPTS}/pkg-xctools/utilities.sh ${destdir}
6 | cp -p ${BUILD_SCRIPTS}/pkg-xctools/install.sh ${destdir}
7 | cp -p ${BUILD_SCRIPTS}/pkg-xctools/README ${destdir}
8 | cp -p ${BUILD_SCRIPTS}/pkg-xctools/dkms-*.rpm ${destdir}
9 |
--------------------------------------------------------------------------------
/pkg-xctools/data/etc/X11/Xsession.d/95root_access:
--------------------------------------------------------------------------------
1 | # Allowing root to contact the X server, for xblanker to get the display resolution
2 | xhost +si:localuser:root
3 |
--------------------------------------------------------------------------------
/pkg-xctools/data/etc/init.d/xblanker:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | DAEMON=/usr/local/bin/xblanker
4 | prog=`basename ${DAEMON}`
5 | XBLANKER_OPTS=
6 |
7 | ### BEGIN INIT INFO
8 | # Provides: xblanker
9 | # Required-Start: $remote_fs $syslog
10 | # Required-Stop: $remote_fs $syslog
11 | # Default-Start: 2 3 4 5
12 | # Default-Stop:
13 | # Short-Description: xblanker
14 | ### END INIT INFO
15 |
16 | . /lib/lsb/init-functions
17 |
18 | test -e ${DAEMON} || exit 0
19 |
20 | case "$1" in
21 | start)
22 | log_daemon_msg "Loading xenfs module" "xenfs module"
23 | if ! ( modprobe xenfs ); then
24 | log_end_msg 1
25 | else
26 | log_end_msg 0
27 | fi
28 | ( mount -t xenfs nodev /proc/xen ; exit 0 )
29 | log_daemon_msg "Starting xblanker daemon for XenClient" "xblanker"
30 | if start-stop-daemon --start --quiet --oknodo --name ${prog} -b --exec ${DAEMON} -- ${XBLANKER_OPTS}; then
31 | log_end_msg 0
32 | else
33 | log_end_msg 1
34 | fi
35 | ;;
36 | stop)
37 | log_daemon_msg "Stopping xblanker daemon for XenClient" "xblanker"
38 | if start-stop-daemon --stop --quiet --oknodo --name ${prog} --exec ${DAEMON}; then
39 | log_end_msg 0
40 | else
41 | log_end_msg 1
42 | fi
43 | ;;
44 | restart|reload|force-reload)
45 | log_daemon_msg "Restarting xblanker daemon for XenClient" "xblanker"
46 | start-stop-daemon --stop --quiet --oknodo --name ${prog} --exec ${DAEMON} || log_end_msg 1
47 | if start-stop-daemon --start --quiet --oknodo --name ${prog} -b --exec ${DAEMON} -- ${RPC_AGENT_OPTS}; then
48 | log_end_msg 1
49 | else
50 | log_end_msg 0
51 | fi
52 | ;;
53 | *)
54 | log_action_msg "Usage: $0: {start|stop|restart|reload}"
55 | exit 1
56 | ;;
57 | esac
58 |
59 | exit 0
60 |
61 |
--------------------------------------------------------------------------------
/pkg-xctools/data/etc/init.d/xenstore-agent:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | DAEMON=/usr/bin/xs-agent
4 | prog=`basename ${DAEMON}`
5 | AGENT_OPTS=
6 |
7 | ### BEGIN INIT INFO
8 | # Provides: xenstore-agent
9 | # Required-Start: $remote_fs $syslog
10 | # Required-Stop: $remote_fs $syslog
11 | # Default-Start: 2 3 4 5
12 | # Default-Stop:
13 | # Short-Description: xenstore-agent
14 | ### END INIT INFO
15 |
16 | . /lib/lsb/init-functions
17 |
18 | RUN_ONCE_SH="/usr/src/xenstore-agent-1.0/run-one-time.sh"
19 |
20 | test -e ${DAEMON} || exit 0
21 |
22 | case "$1" in
23 | start)
24 | log_daemon_msg "Loading xc modules" "xc modules"
25 | if ! ( modprobe xenfs; modprobe openxt-v4v; ); then
26 | log_end_msg 1
27 | else
28 | log_end_msg 0
29 | fi
30 | ( mount -t xenfs nodev /proc/xen ; exit 0 )
31 | vm_path=$(xenstore-read vm)
32 | AGENT_OPTS="xen_vm_path:${vm_path}:"
33 |
34 | if [[ -x "${RUN_ONCE_SH}" ]]; then
35 | ${RUN_ONCE_SH}
36 | rm -f ${RUN_ONCE_SH}
37 | fi
38 |
39 | log_daemon_msg "Starting xenstoreagent daemon for XenClient" "xenstore-agent"
40 | if start-stop-daemon --start --quiet --oknodo --name ${prog} -b --exec ${DAEMON} -- ${AGENT_OPTS}; then
41 | log_end_msg 0
42 | else
43 | log_end_msg 1
44 | fi
45 | ;;
46 | stop)
47 | log_daemon_msg "Stopping xenstore agent daemon for XenClient" "xenstore-agent"
48 | if start-stop-daemon --stop --quiet --oknodo --name ${prog} --exec ${DAEMON}; then
49 | log_end_msg 0
50 | else
51 | log_end_msg 1
52 | fi
53 | ;;
54 | restart|reload|force-reload)
55 | log_daemon_msg "Restarting xenstore agent daemon for XenClient" "xenstore-agent"
56 | start-stop-daemon --stop --quiet --oknodo --name ${prog} -b --exec ${DAEMON} || log_end_msg 1
57 | if start-stop-daemon --start --quiet --oknodo --name ${prog} --exec ${DAEMON} -- ${AGENT_OPTS}; then
58 | log_end_msg 1
59 | else
60 | log_end_msg 0
61 | fi
62 | ;;
63 | *)
64 | log_action_msg "Usage: $0: {start|stop|restart|reload}"
65 | exit 1
66 | ;;
67 | esac
68 |
69 | exit 0
70 |
--------------------------------------------------------------------------------
/pkg-xctools/dkms-2.2.0.3-20.el6.noarch.rpm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OpenXT/openxt/ccfca92bdec9c19108d9892b1ca7cb19d2bcfbfc/pkg-xctools/dkms-2.2.0.3-20.el6.noarch.rpm
--------------------------------------------------------------------------------
/pkg-xctools/install.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # Script for installing/upgrading XenClient Linux guest tools
3 |
4 | INSTALLER_PATH=`dirname $0`
5 |
6 | # Include utils
7 | . "${INSTALLER_PATH}/utilities.sh"
8 |
9 | # Detect Linux distro
10 | detect_distro
11 |
12 | # Check for prerequisites
13 | prerequisite_check
14 |
15 | # Installer
16 | (
17 | set -e
18 |
19 | if [ "$DISTRO" = rhel ] ; then
20 | # Remove the packages first. This shouldn't be necessary,
21 | # but is done for consistency with Debian/Ubuntu.
22 | yum -y erase xc-tools
23 |
24 | # For dkms, we need to make sure that every installed kernel
25 | # RPM has a matching installed kernel-devel RPM.
26 | #
27 | # Unfortunately, we can't rely on the fact that the dkms RPM
28 | # depends on kernel-devel: yum will only check that some
29 | # kernel-devel RPM is installed, and if none is installed, it
30 | # picks the latest available.
31 | #
32 | # This would fail when the installed kernel RPM is not the
33 | # latest available (e.g. before installing updates) or if more
34 | # than one kernel RPM is installed (e.g. after installing
35 | # updates).
36 | KERNEL_DEVEL_RPMS=`\
37 | rpm --queryformat \
38 | "kernel-devel-%{VERSION}-%{RELEASE}.%{ARCH} " \
39 | -q kernel`
40 | yum -y install "${INSTALLER_PATH}"/xc-tools-*.rpm \
41 | "${INSTALLER_PATH}"/dkms-*.rpm \
42 | ${KERNEL_DEVEL_RPMS}
43 | else
44 | # FIXME: see the debian package to know why we can't reinstall the package
45 | # gdebi must do it, but it fails. It can't find xenstore source
46 |
47 | # Install tools
48 | install_deb "xc-tools" "${INSTALLER_PATH}/xenclient-linuxtools.deb"
49 |
50 | # libappindicator was added in debian with Wheezy
51 | distrib=`lsb_release -is`
52 | codename=`lsb_release -rs`
53 | fi
54 | )
55 | exit_code=$?
56 |
57 | if [ $exit_code -ne 0 ]; then
58 | pretty_print "XenClient Linux tools install failed.
59 | Re-running the install may fix the problem."
60 | else
61 | pretty_print "XenClient Linux tools successfully installed."
62 | fi
63 |
64 | exit $exit_code
65 |
--------------------------------------------------------------------------------
/pkg-xctools/udev-rules/44-v4v.rules:
--------------------------------------------------------------------------------
1 | KERNEL=="v4v_*", MODE="0666"
2 |
3 |
--------------------------------------------------------------------------------
/pkg-xctools/utilities.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # Utility functions for XenClient linux install scripts
3 |
4 | # Prettify a message
5 | pretty_print()
6 | {
7 | local message="$1"
8 | local h_border='='
9 | local v_border='|'
10 | local min_width=20
11 | local lines=''
12 | set -f
13 | IFS='
14 | '
15 | for line in $message; do
16 | if [ ${#line} -gt $min_width ]; then
17 | min_width=${#line};
18 | fi
19 | done
20 |
21 | for line in $message; do
22 | pad_line=$(printf "%-$((min_width))s" "${line}")
23 | lines="${lines}
24 | ${v_border} ${pad_line} ${v_border}"
25 | done
26 |
27 | h_border=$(printf '%*s' "$((min_width+4))" '' | sed "s/ /${h_border}/g")
28 | echo "
29 | ${h_border}${lines}
30 | ${h_border}" 1>&2
31 | }
32 |
33 | # Print warning and exit
34 | warning()
35 | {
36 | pretty_print "$1"
37 | exit "${2:-1}"
38 | }
39 |
40 | # Detect Linux distro: rhel (for RHEL, CentOS) or debian (for Debian, Ubuntu)
41 | detect_distro()
42 | {
43 | if [ -r /etc/redhat-release ] ; then
44 | DISTRO=rhel
45 | else
46 | DISTRO=debian
47 | fi
48 | }
49 |
50 | # Check for prerequisites
51 | prerequisite_check()
52 | {
53 | # Check for root user
54 | if [ "x$(id -u)" != "x0" ]; then
55 | warning "This script must be run as root."
56 | fi
57 |
58 | # On Debian/Ubuntu, check if we have gdebi
59 | if [ "$DISTRO" = debian ] ; then
60 | if ! command -v gdebi >/dev/null 2>&1; then
61 | warning "\
62 | gdebi tools are required for this installation.
63 | Please install them using:
64 |
65 | $ sudo apt-get install gdebi-core"
66 | fi
67 | fi
68 | }
69 |
70 | # Install a package
71 | install_deb()
72 | {
73 | local package="${1}"
74 | local deb_path="${2}"
75 |
76 | set -e
77 |
78 | echo "removing previous ${package}"
79 | dpkg --purge "${package}"
80 |
81 | echo "installing ${package}"
82 | gdebi --non-interactive $deb_path
83 |
84 | # check install succeeded, gdebi can exit 0 on failure
85 | if ! dpkg -s "${package}" > /dev/null 2>&1; then
86 | exit 1
87 | fi
88 | }
89 |
--------------------------------------------------------------------------------
/pkg-xctools/xc-tools.spec:
--------------------------------------------------------------------------------
1 | # FIXME:
2 | # - eth0 dhcp doesn't recover from xc-netfront being inserted?
3 | # - sort out use of chkconfig (beware of rpm upgrade case)
4 | # - check calls to init scripts work in rpm upgrade case
5 | # - install GPLv2 COPYING in /usr/share/doc/*
6 | # - add dkms suffix to package release?
7 | # - check Requires list is complete
8 | # - add Requires dependency on kernel version or distro version?
9 | # - sort out use of dracut in postinst and test combinations below
10 | # - sort out excessive calls to dracut
11 | # - check that uninstalling package cleans up all files
12 | # - install.sh: yum install exits 0 even if post scriptlet fails; get
13 | # postinst to create a file and check it exists in install.sh?
14 | # - dkms depends on kernel-devel/-headers but may not be version we need
15 | #
16 | # TEST:
17 | # - running install.sh or "yum erase xc-tools" with:
18 | # - one kernel installed
19 | # - two kernels installed, older running
20 | # - two kernels installed, newer running
21 | # and with kernel-devel and kernel-headers:
22 | # - not installed
23 | # - matching running kernel
24 | # - matching other kernel (where applicable)
25 | # - kernel install/upgrade/erase with xc-tools installed
26 |
27 | %include common.inc
28 |
29 | Name: xc-tools
30 | Summary: XenClient XT tools
31 | Source0: %{name}.tar.gz
32 | Source1: %{name}-centos.tar.gz
33 | BuildArch: noarch
34 | # TODO: Add BuildRequires when switching to building on CentOS
35 | Requires: autoconf automake dkms gcc libtool libpciaccess libpciaccess-devel
36 | Requires: libX11 libX11-devel make perl pm-utils
37 | Requires: xorg-x11-server-devel
38 |
39 | %define desc RHEL/CentOS in-guest tools for Citrix XenClient XT.
40 |
41 | %include description.inc
42 |
43 | %prep
44 | %setup -q -c
45 | %setup -q -T -D -a 1
46 |
47 | %build
48 | rm -rf etc/init.d
49 | mkdir -p etc/rc.d/init.d
50 | mkdir -p etc/X11/xinit/xinitrc.d
51 | mv etc/X11/Xsession.d/95root_access etc/X11/xinit/xinitrc.d
52 | mv centos/xenstore-agent centos/xblanker etc/rc.d/init.d
53 | rmdir centos
54 |
55 | rm -r usr/share
56 |
57 | mkdir -p etc/dracut.conf.d
58 | cat < etc/dracut.conf.d/xc-tools
59 | add_drivers+="openxt-v4v"
60 | EOF
61 |
62 | %install
63 | mkdir -p %{buildroot}
64 | cp -r * %{buildroot}
65 |
66 | %clean
67 | rm -rf %{buildroot}
68 |
69 | %files
70 | /etc/dracut.conf.d/xc-tools
71 | /etc/X11/xinit/xinitrc.d/95root_access
72 | /lib/udev/rules.d
73 | /usr/src
74 | %config %attr(755, -, -) /etc/rc.d/init.d/xblanker
75 | %config %attr(755, -, -) /etc/rc.d/init.d/xenstore-agent
76 |
77 |
78 | %post
79 | %include xc-tools-postinst.inc
80 |
81 | %preun
82 | %include xc-tools-prerm.inc
83 |
84 | %postun
85 | %include xc-tools-postrm.inc
86 |
--------------------------------------------------------------------------------
/setup_build:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # OpenXT git repo setup file.
3 |
4 | die() {
5 | echo "$1" 1>&2
6 | exit 1
7 | }
8 |
9 | #######################################################################
10 | # checkout_git_branch #
11 | # param1: Path to the git repo #
12 | # param2: Preferred branch to checkout. Fallback will be to master. #
13 | # #
14 | # Checks out the branch specified in param2 for the repo located at #
15 | # the file path in param1. If the branch is not part of the git repo #
16 | # the master branch is checked out instead. #
17 | #######################################################################
18 | checkout_git_branch() {
19 | local path="$1"
20 | local branch="$2"
21 |
22 | cd $path
23 | git checkout "$branch" 2>/dev/null|| git checkout -b "$branch" origin/$branch 2>/dev/null || { echo "The value $branch does not exist as a branch or HEAD position. Falling back to the master branch."; git checkout master 2>/dev/null; }
24 | cd $OLDPWD
25 | }
26 |
27 | #######################################################################
28 | # fetch_git_repo #
29 | # param1: Path (absolute) to place the repo #
30 | # param2: Git url to fetch #
31 | # #
32 | # Fetches the repo specified by param2 into the directory specified #
33 | # by param1. #
34 | #######################################################################
35 | fetch_git_repo() {
36 | local path="$1"
37 | local repo="$2"
38 |
39 | echo "Fetching $repo..."
40 | set +e
41 | git clone -q -n $repo "$path" || die "Clone of git repo failed: $repo"
42 | set -e
43 | }
44 |
45 | process_git_repo() {
46 | local path="$1"
47 | local repo="$2"
48 | local branch="$3"
49 |
50 | # Remove the directory if it's empty
51 | [ -d $path ] && [ -z "`ls -A1 $path | head -1`" ] && rmdir $path
52 |
53 | if [ ! -d $path ]; then
54 | # The path does not exist. Proceed.
55 | fetch_git_repo $path $repo $branch
56 | checkout_git_branch $path $branch
57 | fi
58 | }
59 |
60 | setup_git_repo() {
61 | local repo="$1"
62 | local default_tag="$2"
63 |
64 | local repo_var=`echo $repo | sed -e 's/openembedded/oe/' -e 's/-/_/g' | tr '[a-z]' '[A-Z]'`
65 | local git_var="${repo_var}_REPO"
66 | local git=${!git_var}
67 | local tag_var="${repo_var}_TAG"
68 | local tag=${!tag_var}
69 |
70 | if [ -n "${git}" ]; then
71 | [ -z ${tag} ] && tag=$default_tag
72 | process_git_repo $REPOS/$repo $git $tag
73 | else
74 | echo Clone submodule $repo, using saved HEAD
75 | git submodule update --checkout $REPOS/$repo
76 | if [ -n "$tag" ]; then
77 | echo "Checking out $repo at $tag"
78 | checkout_git_branch $REPOS/$repo $tag
79 | else
80 | echo "Update submodule $repo that follow a branch (update != none)"
81 | git submodule update --remote $REPOS/$repo
82 | fi
83 | fi
84 | }
85 |
86 | OE_XENCLIENT_DIR=`pwd`
87 | REPOS=$OE_XENCLIENT_DIR/repos
88 | OE_PARENT_DIR=$(dirname $OE_XENCLIENT_DIR)
89 |
90 | # Load our config
91 | [ -f "$OE_PARENT_DIR/.config" ] && . "$OE_PARENT_DIR/.config"
92 |
93 | mkdir -p $REPOS || die "Could not create local build dir"
94 |
95 | # Pull down the OpenXT repos
96 | process_git_repo $REPOS/xenclient-oe $XENCLIENT_REPO $XENCLIENT_TAG
97 | process_git_repo $REPOS/meta-openxt-ocaml-platform \
98 | $META_OPENXT_OCAML_PLATFORM_REPO $META_OPENXT_OCAML_PLATFORM_TAG
99 | process_git_repo $REPOS/meta-openxt-haskell-platform \
100 | $META_OPENXT_HASKELL_PLATFORM_REPO $META_OPENXT_HASKELL_PLATFORM_TAG
101 |
102 | # Initialise the submodules using .gitmodules
103 | git submodule init
104 |
105 | # Pull down Bitbake
106 | setup_git_repo bitbake $BB_BRANCH
107 |
108 | # Pull down OE repos
109 | for repo in openembedded-core meta-openembedded meta-java meta-selinux \
110 | meta-intel meta-virtualization; do
111 | setup_git_repo $repo $OE_BRANCH
112 | done
113 |
114 | if [ ! -e $OE_XENCLIENT_DIR/conf/local.conf ]; then
115 | ln -s $OE_XENCLIENT_DIR/conf/local.conf-dist \
116 | $OE_XENCLIENT_DIR/conf/local.conf
117 | fi
118 |
119 | BBPATH=$OE_XENCLIENT_DIR/oe/xenclient:$REPOS/openembedded:$OE_XENCLIENT_DIR/oe-addons
120 | if [ ! -z "$EXTRA_DIR" ]; then
121 | BBPATH=$REPOS/$EXTRA_DIR:$BBPATH
122 | fi
123 |
124 | cat > oeenv <&2
52 | exit 1
53 | }
54 |
55 | parse_args "$@"
56 |
57 | generate_signature
58 |
--------------------------------------------------------------------------------
/sync-xt/common.inc:
--------------------------------------------------------------------------------
1 | # Common RPM tags/macros which can be overridden in the spec file if needed.
2 |
3 | Version: %{xc_release}
4 | Release: 1%{?dist}
5 | Group: Applications/System
6 | Vendor: OpenXT
7 | License: GPLv2
8 | URL: http://github.com/OpenXT
9 | BuildRoot: %{name}-%{version}-%{release}
10 |
11 | %define desc %{summary}.
12 |
--------------------------------------------------------------------------------
/sync-xt/description.inc:
--------------------------------------------------------------------------------
1 | # Common section of RPM spec file for package description.
2 |
3 | %description
4 | %{desc}
5 |
6 | Build: %{xc_build}
7 |
--------------------------------------------------------------------------------
/sync-xt/python.inc:
--------------------------------------------------------------------------------
1 | # Common section of RPM spec file for building python code.
2 |
3 | BuildRequires: python
4 |
5 | %define source0_name %(basename %{SOURCE0} .tar.gz)
6 |
7 | %prep
8 | %setup -q -n %{source0_name}
9 | %{?SOURCE1:%setup -q -n %(basename %{SOURCE1} .tar.gz) -T -D -b 1}
10 |
11 | %build
12 | cd ../%{source0_name}
13 | VERSION=%{version} python setup.py build
14 |
15 | %install
16 | # If PYTHONDONTWRITEBYTECODE is set in the environment, setup.py won't compile
17 | # the source files. The --optimize 1 flag ensures that .pyo files are generated
18 | # and included in INSTALLED_FILES.
19 | unset PYTHONDONTWRITEBYTECODE
20 | cd ../%{source0_name}
21 | VERSION=%{version} python setup.py install --optimize 1 \
22 | --root=%{buildroot} \
23 | --record=INSTALLED_FILES
24 |
25 | %clean
26 | rm -rf %{buildroot}
27 |
28 | %files -f ../%{source0_name}/INSTALLED_FILES
29 |
--------------------------------------------------------------------------------
/version:
--------------------------------------------------------------------------------
1 | # Identifier for this version of OpenXT
2 | RELEASE="10.0.0"
3 |
4 | # Marketing-friendly name for this version of OpenXT
5 | VERSION="10.0.0"
6 |
7 | ##########
8 | # NOTE: IMPORTANT - XenClient tools versioning
9 | # This should match the release version with the exception of the Major field
10 | # This field is to be incremented by ten due to historic reasons introduced by xensetup.exe
11 | # i.e. v4 = v14, v5 = v15 and so on...
12 | ##########
13 |
14 | # Seriously now, the bit above was very important...
15 | XC_TOOLS_MAJOR="20"
16 | XC_TOOLS_MINOR="0"
17 | XC_TOOLS_MICRO="0"
18 |
19 | # Space-separated list of previous releases that can be upgraded from
20 | UPGRADEABLE_RELEASES="9.0.1"
21 |
--------------------------------------------------------------------------------
/version.README:
--------------------------------------------------------------------------------
1 | You don't need to read this.
2 |
3 | Prior to XT 4.0.0, updates to the 'version' file in this repository required
4 | similar changes to be made in other repositories. This is no longer necessary,
5 | as everything now uses the information from the 'version' file.
6 |
--------------------------------------------------------------------------------
/windows/BuildDaemon/callit.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | curl -H "Content-Type: text/xml" --data @xmlsample http://192.168.150.104:6288
4 |
--------------------------------------------------------------------------------
/windows/BuildDaemon/start.ps1:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2016 Assured Information Security, Inc.
2 | #
3 | # Permission is hereby granted, free of charge, to any person obtaining a copy
4 | # of this software and associated documentation files (the "Software"), to deal
5 | # in the Software without restriction, including without limitation the rights
6 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | # copies of the Software, and to permit persons to whom the Software is
8 | # furnished to do so, subject to the following conditions:
9 | #
10 | # The above copyright notice and this permission notice shall be included in
11 | # all copies or substantial portions of the Software.
12 | #
13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | # THE SOFTWARE.
20 |
21 | Start-Process "C:\python27\python.exe" "winbuildd.py -c winbuild.cfg -s BOSTON" -Verb runAs
22 |
--------------------------------------------------------------------------------
/windows/BuildDaemon/winbuild.cfg:
--------------------------------------------------------------------------------
1 | [BOSTON]
2 | port: 6288
3 | builddir: C:\\build\\
4 |
5 | [OTHER]
6 | port: 6288
7 | builddir: C:\\build\\
8 |
--------------------------------------------------------------------------------
/windows/BuildDaemon/winbuildd.bat:
--------------------------------------------------------------------------------
1 | cd C:\winbuildd
2 | powershell .\start.ps1
3 |
--------------------------------------------------------------------------------
/windows/BuildDaemon/winbuildd.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 | # Copyright (c) 2016 Assured Information Security, Inc.
4 | #
5 | # Permission is hereby granted, free of charge, to any person obtaining a copy
6 | # of this software and associated documentation files (the "Software"), to deal
7 | # in the Software without restriction, including without limitation the rights
8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | # copies of the Software, and to permit persons to whom the Software is
10 | # furnished to do so, subject to the following conditions:
11 | #
12 | # The above copyright notice and this permission notice shall be included in
13 | # all copies or substantial portions of the Software.
14 | #
15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | # THE SOFTWARE.
22 |
23 | import SimpleXMLRPCServer
24 | import os
25 | import subprocess
26 | import socket
27 | import sys
28 | import getopt
29 | import shutil
30 | import ConfigParser
31 | import tempfile
32 | import logging
33 | import sys
34 |
35 | linesep = '\n'
36 | SCRIPTDIR = os.path.dirname(os.path.realpath(sys.argv[0]))
37 |
38 | def onerror(func, path, exc_info):
39 | """
40 | Error handler for ``shutil.rmtree``.
41 |
42 | If the error is due to an access error (read only file)
43 | it attempts to add write permission and then retries.
44 |
45 | If the error is for another reason it re-raises the error.
46 |
47 | Usage : ``shutil.rmtree(path, onerror=onerror)``
48 | """
49 | import stat
50 | print "Retrying " + path + " after chmod"
51 | os.chmod(path, stat.S_IWRITE)
52 | func(path)
53 |
54 | def runCommand(command):
55 | s = subprocess.Popen(command, shell = True,
56 | stdout = subprocess.PIPE, stderr = subprocess.STDOUT,
57 | universal_newlines=True)
58 | while True:
59 | output = s.stdout.readline()
60 | if output == '' and s.poll() is not None:
61 | break
62 | if output:
63 | logging.info(output.strip())
64 | ret = s.poll()
65 | return ret
66 |
67 | class RPCInterface(object):
68 | def make(self,build='',branch='master',certname='',developer='false',rsyncdest='',giturl='',config='sample-config.xml'):
69 | """make(build,branch,certname,developer,rsyncdest,giturl,config)
70 | Ex: make("123456","master","developer","false","builds@192.168.0.10:/home/builds/win/","git://github.com/OpenXT","sample-config.xml")
71 | Call powershell scripts to do the real work
72 | """
73 |
74 | result = 'SUCCESS'
75 |
76 | if not os.path.exists(BUILDDIR):
77 | os.mkdir(BUILDDIR)
78 | os.chdir(BUILDDIR)
79 |
80 | if os.path.exists('output.log'):
81 | os.remove('output.log')
82 | logging.basicConfig(filename='output.log', level=logging.DEBUG)
83 | log = logging.getLogger()
84 | print "Log file created @ " + socket.gethostname() + " file: " + os.path.join(BUILDDIR, "output.log")
85 |
86 | # Create log directory/file
87 | try:
88 | logging.info("Start build, RPC input:")
89 | logging.info('make(build='+repr(build)+',branch='+repr(branch)+\
90 | ',certname='+repr(certname)+'developer='+repr(developer)+\
91 | 'rsyncdest='+repr(rsyncdest)+'giturl='+repr(giturl)+'config='+repr(config)+')')
92 | logging.info('Running in dir: ' + os.getcwd())
93 |
94 | # Nuke existing build(s)
95 | if not os.path.exists('garbage'):
96 | os.mkdir('garbage')
97 | if os.path.exists('openxt'):
98 | grave = tempfile.mkdtemp(dir='garbage')
99 | os.rename('openxt', os.path.join(grave, 'openxt'))
100 | try:
101 | shutil.rmtree('garbage', onerror=onerror)
102 | except:
103 | pass
104 |
105 | # Clone the main OpenXT repo and checkout branch
106 | runCommand('git clone -b ' + branch + ' ' + giturl + '/openxt.git')
107 | logging.info("Completed cloning " + giturl + "/openxt.git")
108 | os.chdir(os.path.join("openxt", "windows"))
109 |
110 | command = 'sed -i "s/Put Your Company Name Here/OpenXT/g" config\\sample-config.xml'
111 | runCommand(command)
112 |
113 | logging.info("Building Windows bits...")
114 | command = 'powershell .\winbuild-prepare.ps1 config=' + config + ' build=' + build + ' giturl=' + giturl + ' branch=' + branch + ' certname=' + certname + ' developer=' + developer
115 | runCommand(command)
116 | command = 'powershell .\winbuild-all.ps1'
117 | runCommand(command)
118 |
119 | # rsync the output unless something went wrong
120 | os.chdir(os.path.join(BUILDDIR, "openxt", "windows", "output"))
121 | if os.path.exists('xctools-iso.zip') and os.path.exists('xc-wintools.iso'):
122 | # Save build ID
123 | build_id_file = open('BUILD_ID', 'w')
124 | build_id_file.write(str(build))
125 | build_id_file.write('\n')
126 | build_id_file.close()
127 | # Rsync the build output to the builder
128 | command = "rsync --rsh='ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i " \
129 | + os.path.join(SCRIPTDIR, "id_rsa") \
130 | + "' --chmod=Du=rwx,Dgo=rx,Fu=rw,Fgo=r -a * " \
131 | + rsyncdest
132 | child_error = runCommand(command)
133 | if child_error != 0:
134 | # Misery
135 | logging.error("ERROR: OpenXT Tools failed to rsync!")
136 | result = 'FAILURE'
137 | else:
138 | # Misery
139 | logging.error("ERROR: OpenXT Tools failed to build!")
140 | result = 'FAILURE'
141 | finally:
142 | if log is not None:
143 | handlers = log.handlers[:]
144 | for handler in handlers:
145 | handler.close()
146 | log.removeHandler(handler)
147 |
148 | return result
149 |
150 | def hello(self):
151 | return "hello back"
152 |
153 | def get_ssh_public_key(self):
154 | certfile = open(os.path.join(SCRIPTDIR, "id_rsa.pub"))
155 | cert = certfile.readline()
156 | certfile.close()
157 | return cert.strip()
158 |
159 | def main(argv):
160 |
161 | config = ""
162 | site = ""
163 | try:
164 | opts, args = getopt.getopt(argv, "hc:s:", ["help", "config=", "site="])
165 | for opt, arg in opts:
166 | if opt in ("-h", "--help"):
167 | usage()
168 | sys.exit()
169 | elif opt in ("-c", "--config"):
170 | config = arg
171 | elif opt in ("-s", "--site"):
172 | site = arg
173 | except getopt.GetoptError:
174 | usage()
175 | sys.exit(2)
176 |
177 | loadConfig(config,site)
178 | s = SimpleXMLRPCServer.SimpleXMLRPCServer(('', PORT))
179 | s.register_introspection_functions()
180 | s.register_instance(RPCInterface())
181 |
182 | try:
183 | print """
184 | OpenXT Windows Build XMLRPC Server
185 |
186 | Use Control-C to exit
187 | """
188 | s.serve_forever()
189 | except KeyboardInterrupt:
190 | print 'Exiting'
191 |
192 | def loadConfig(cfg,site):
193 | try:
194 | config = ConfigParser.ConfigParser()
195 | config.read(cfg)
196 | except:
197 | print "Configuration file cannot be read."
198 | sys.exit()
199 |
200 | if not (config.has_section(site)):
201 | print "Invalid site specified. Available sites are:"
202 | print config.sections()
203 | sys.exit()
204 | else:
205 | try:
206 | global PORT, BUILDDIR
207 | PORT = config.getint(site,'port')
208 | BUILDDIR = config.get(site,'builddir')
209 | except:
210 | print "Exception getting configuration option. Corrupt .cfg file? Missing option?"
211 | sys.exit()
212 |
213 | def usage():
214 | print """
215 | Usage:
216 | > python builddaemon.py -c "config file" -s "site"
217 | """
218 |
219 | if __name__ == '__main__':
220 | main(sys.argv[1:])
221 |
--------------------------------------------------------------------------------
/windows/BuildDaemon/xmlhello:
--------------------------------------------------------------------------------
1 |
2 |
3 | hello
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/windows/BuildDaemon/xmlsample:
--------------------------------------------------------------------------------
1 |
2 |
3 | make
4 |
5 |
6 | 667766
7 |
8 |
9 | master
10 |
11 |
12 | developer
13 |
14 |
15 | true
16 |
17 |
18 | builds@192.168.150.1:/home/builds/win
19 |
20 |
21 | git://github.com/OpenXT
22 |
23 |
24 | sample-config.xml
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/windows/BuildSupport/checked-copy.psm1:
--------------------------------------------------------------------------------
1 | function Checked-Copy($src, $dest) {
2 | copy $src -destination $dest -Force -V
3 | if (-Not $?) {
4 | throw "Unable to copy $src to $dest"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/windows/BuildSupport/invoke.psm1:
--------------------------------------------------------------------------------
1 | # TODO: this is pasted from xc-windows.git/do_build.ps1 but I would like to find a way
2 | # to share code. For now if you fix a bug here please fix it in that version
3 | # as well.
4 |
5 | # run a command with output redirection so that we wait
6 | # and check the error code and fail if non-zero
7 | function Invoke-CommandChecked {
8 | Write-Host ("Invoke "+([string]$args))
9 | $description = $args[0]
10 | $command = $args[1]
11 | # doing "& *args" now would be good if it didn't take all the arguments and turn
12 | # it into a string and try and run that. We need to specify the command name separately.
13 | # we cannot remove items from arrays
14 | # see http://technet.microsoft.com/en-us/library/ee692802.aspx
15 | # so we turn the args into an arraylist instead
16 | $arglist = New-Object System.Collections.ArrayList
17 | $arglist.AddRange($args)
18 | # ... then remove the first two argument
19 | $arglist.RemoveRange(0,2)
20 | Write-Host ("+$command "+[string]$arglist)
21 | & $command $arglist | Out-Host
22 | Write-Host "$command exited with code $LastExitCode"
23 | if ($LastExitCode -ne 0) {
24 | throw "failed $description; $command exited with code $LastExitCode"
25 | }
26 | }
27 |
28 |
--------------------------------------------------------------------------------
/windows/BuildSupport/winbuild-installer.ps1:
--------------------------------------------------------------------------------
1 | . ((Split-Path -Parent $MyInvocation.MyCommand.Path) + "\winbuild-utils.ps1")
2 |
3 | # Split each key-value pair into hash table entires
4 | $args | Foreach-Object {$argtable = @{}} {if ($_ -Match "(.*)=(.*)") {$argtable[$matches[1]] = $matches[2];}}
5 |
6 | $setupFile = ".\xc-windows\install\xensetup.exe"
7 | if (!(Test-Path -Path $setupFile)) {
8 | throw "$setupFile not found"
9 | }
10 |
11 | #Set up web client to download stuff
12 | [System.Net.WebClient] $wclient = New-Object System.Net.WebClient
13 |
14 | # Create directory to store bootstrapper packages
15 | new-item -ItemType directory -Path ".\msi-installer\bootstrapper\packages" -Force
16 |
17 | # Move the newly compiled xensetup package to the packages directory
18 | Copy-Item $setupFile .\msi-installer\bootstrapper\packages -Force -V
19 | if (-Not ($?)) {
20 | throw "Unable to copy xensetup.exe"
21 | }
22 |
23 | # Create directory to store the necessary merge modules
24 | new-item -ItemType directory -Path ".\msi-installer\installer\Modules" -Force
25 |
26 | ExitWithCode -exitcode $global:success
27 |
--------------------------------------------------------------------------------
/windows/BuildSupport/winbuild-stage.ps1:
--------------------------------------------------------------------------------
1 | . ((Split-Path -Parent $MyInvocation.MyCommand.Path) + "\winbuild-utils.ps1")
2 |
3 | # God Check - If there's no installer something has gone wrong & error checking needs tightening up!
4 | if (!(Test-Path -Path ".\msi-installer\iso\windows\setup.exe"))
5 | {
6 | Write-Host ("Error: Failed to create the installer")
7 | ExitWithCode -exitcode $global:failure
8 | }
9 |
10 | $args | Foreach-Object {$argtable = @{}} {if ($_ -Match "(.*)=(.*)") {$argtable[$matches[1]] = $matches[2];}}
11 | $OutDir = $argtable["OutDir"]
12 | $zip = "${env:programfiles}\7-zip\7z.exe"
13 | if (!(Test-Path -Path ("$zip") -PathType Leaf))
14 | {
15 | Write-Host "7-zip not found at $zip, assuming 32-bit install on 64-bit Windows"
16 | $zip = "${env:programfiles(x86)}\7-zip\7z.exe"
17 | }
18 |
19 | #Create output directory
20 | New-Item -Path $outdir -Type Directory -Force > $null
21 | Write-Host ("Created output directory: " + $outdir)
22 |
23 | # Zip some bad boys up
24 | Write-Host "Zipping up xc-windows build."
25 | & "$zip" a -bd "$OutDir\xc-windows.zip" xc-windows 2>&1
26 | if (!(Test-Path -Path ($outdir + "\xc-windows.zip") -PathType Leaf))
27 | {
28 | Write-Host "Warning: Check for xc-windows.zip failed. But it's not build vital so carry on..."
29 | }
30 |
31 | Push-Location -Path "msi-installer\iso"
32 | Write-Host "Zipping up xctools-iso directory."
33 | & "$zip" a -bd "..\..\$OutDir\xctools-iso.zip" . 2>&1
34 | Pop-Location
35 | if (!(Test-Path -Path ($outdir + "\xctools-iso.zip") -PathType Leaf))
36 | {
37 | Write-Host "Error: Check for xctools-iso.zip failed. Build unsuccessful."
38 | ExitWithCode -exitcode $global:failure
39 | }
40 |
41 | # Create an ISO if genisoimage is available
42 | if (Get-Command "genisoimage.exe" -ErrorAction SilentlyContinue)
43 | {
44 | Write-Host "Creating Windows tools ISO."
45 | Push-Location -Path "msi-installer\iso"
46 | & genisoimage -quiet -R -J -joliet-long -input-charset utf-8 -o "..\..\$Outdir\xc-wintools.iso" -V "OpenXT-wintools" . 2>&1
47 | Pop-Location
48 | if (!(Test-Path -Path ($outdir + "\xc-wintools.iso") -PathType Leaf))
49 | {
50 | Write-Host "Error: Check for xc-wintools.iso failed. Build unsuccessful."
51 | ExitWithCode -exitcode $global:failure
52 | }
53 | }
54 |
55 | Write-Host ("Completed " + $cmdinv)
56 | ExitWithCode -exitcode $global:success
57 |
--------------------------------------------------------------------------------
/windows/BuildSupport/winbuild-utils.ps1:
--------------------------------------------------------------------------------
1 | ############################################################################
2 | ### Windows build utility functions ###
3 | ### No arguments ###
4 | ### ###
5 | ### To work properly with Buildbot, the following return code conventions###
6 | ### should be used: ###
7 | ### Value: 0; color: green; a successful run ###
8 | ### Value: 1; color: orange; a successful run, with some warnings ###
9 | ### Value: 2; color: red; a failed run, due to problems in the build step###
10 | ### Either return these values or use the globals ###
11 | ############################################################################
12 |
13 | $global:builddir
14 | $global:logddir
15 | $global:cfgfile
16 | $global:logfile
17 |
18 | function IsNumeric([string]$s)
19 | {
20 | Trap [Exception] {
21 | return $false
22 | }
23 | $tmp = 0
24 | $isnum = [System.Int32]::TryParse($s, [ref]$tmp)
25 | return $isnum
26 | }
27 |
28 | function ExitWithCode([int32]$exitcode)
29 | {
30 | $host.SetShouldExit($exitcode)
31 | Exit
32 | }
33 |
34 | function read-config-value([string]$config, [string]$name)
35 | {
36 | [System.Xml.XmlDocument] $xd = New-Object System.Xml.XmlDocument
37 |
38 | $xd.Load($config)
39 |
40 | $node = $xd.SelectSingleNode("/WinbuildConfig/{0}" -f $name)
41 |
42 | if (!$node)
43 | {
44 | return
45 | }
46 | return $node.get_InnerXml()
47 | }
48 |
49 | function write-config-value([string]$config, [string]$name, [string]$value)
50 | {
51 | [System.Xml.XmlDocument] $xd = New-Object System.Xml.XmlDocument
52 |
53 | $xd.Load($config)
54 |
55 | $node = $xd.SelectSingleNode("/WinbuildConfig/{0}" -f $name)
56 |
57 | if (!$node)
58 | {
59 | return $false
60 | }
61 | $node.set_InnerXml($value)
62 |
63 | $xd.Save($config)
64 | return $true
65 | }
66 |
67 | function enable-read-execute([string]$file)
68 | {
69 | $acl = Get-Acl $file
70 | $ar = New-Object System.Security.Accesscontrol.FileSystemAccessRule("Everyone", "ReadAndExecute", "Allow")
71 | $acl.SetAccessRule($ar)
72 | Set-Acl $file $acl
73 | }
74 |
75 | function get-version-string()
76 | {
77 | return ((read-config-value -config $global:cfgfile -name "VerMajor") + "." +
78 | (read-config-value -config $global:cfgfile -name "VerMinor") + "." +
79 | (read-config-value -config $global:cfgfile -name "VerMicro") + "." +
80 | (read-config-value -config $global:cfgfile -name "BuildNumber"))
81 | }
82 |
83 | function parse-version-string([string]$strver)
84 | {
85 | $regex = [regex]"^(?:(\d+)\.)?(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)"
86 | $result = $regex.Matches($strver)
87 | return @($result[0].Groups[1].Value,
88 | $result[0].Groups[2].Value,
89 | $result[0].Groups[3].Value,
90 | $result[0].Groups[4].Value)
91 | }
92 |
93 | # Now we use Start-Transcript for logging we don't need this but keep it
94 | # for now until all the calls have been replaced with Write-Host commands
95 | function log-info([string]$info)
96 | {
97 | Write-Host $info
98 | }
99 |
100 | function log-script-end()
101 | {
102 | log-info -info "--------------------------------------------------------"
103 | log-info -info (" Script End")
104 | log-info -info "--------------------------------------------------------"
105 | }
106 |
107 | function log-info-wrap([string]$info)
108 | {
109 | log-info -info "--------------------------------------------------------"
110 | log-info -info $info
111 | log-info -info "--------------------------------------------------------"
112 | }
113 |
114 | # Now we use Start-Transcript for logging we don't need this but keep it
115 | # for now until all the calls have been replaced with Write-Host commands
116 | function log-error([string]$err)
117 | {
118 | Write-Host $err
119 | }
120 |
121 | function execute-log-and-out([string]$command)
122 | {
123 | $out = Invoke-Expression $command #Do the command
124 | #Write-Host $out #To stdout
125 | $out | Foreach-Object {$_.ToString()} | Write-Host
126 |
127 | }
128 |
129 | function common-init([string]$cmdinv)
130 | {
131 | # The PWD is always assumed to be the build dir
132 | $global:builddir = [System.IO.Directory]::GetCurrentDirectory()
133 |
134 | # Make sure the config file is present. Running winbuild-prepare.ps1 would have copied
135 | # the config file to the build dir and updated it.
136 | $global:cfgfile = ($global:builddir + "\config.xml")
137 | if (!(Test-Path -Path $global:cfgfile -PathType Leaf))
138 | {
139 | Write-Host "ERROR: Config file not present - config:" $global:cfgfile
140 | return $false
141 | }
142 |
143 | # Setup the log file, create the logging dir if not present
144 | # Note the syntax when calling functions. If you supply a comma separated list (w/ or w/o
145 | # parens), ps turns it into an array assigned to the first arg.
146 | $global:logdir = read-config-value -config $global:cfgfile -name "LogDir"
147 | if ($global:logdir.Length -lt 1)
148 | {
149 | Write-Host "ERROR: No LogDir in the config file"
150 | return $false
151 | }
152 | $global:logdir = $global:builddir + "\" + $global:logdir
153 | if (!(Test-Path -Path $global:logdir -PathType Container))
154 | {
155 | New-Item -Path $global:logdir -Type Directory -Force
156 | }
157 | $ts = get-date -uformat "%Y-%m-%d-%H%M%S"
158 | $global:logfile = $global:logdir + "\" + $cmdinv + "_"+ $ts +".log"
159 | Write-Host "Logging to [$global:logfile]"
160 | Start-Transcript $global:logfile
161 | Write-Host "Logging started to [$global:logfile]"
162 | # Trace out a basic log header
163 | log-info -info "--------------------------------------------------------"
164 | log-info -info ("Windows Build Log - " + (Get-Date))
165 | log-info -info ("Command: " + $cmdinv)
166 | log-info -info ("Working Dir: " + $global:builddir)
167 | log-info -info ("Logging To: " + $global:logfile)
168 | log-info -info "--------------------------------------------------------"
169 |
170 | return $true
171 | }
172 |
173 | # Get the "Software" key path for a 32bit app, on a 64bit OS this will include "Wow6432Node".
174 | #
175 | function get-software-key-path32([string]$key)
176 | {
177 | $path = "Registry::HKEY_LOCAL_MACHINE\Software"
178 |
179 | $arch = ([System.Environment]::GetEnvironmentVariable("PROCESSOR_ARCHITECTURE"))
180 | if ($arch -eq "AMD64")
181 | {
182 | $path += "\Wow6432Node"
183 | }
184 |
185 | if ($key.Length -gt 0)
186 | {
187 | $path += "\" + $key
188 | }
189 | return $path
190 | }
191 |
192 | # Get the "Program Files" path for a 32bit app, on a 64bit OS this will be "C:\Program Files (x86)"
193 | #
194 | function get-program-files-path32([string]$file)
195 | {
196 | $programFiles = "ProgramFiles"
197 |
198 | $arch = ([System.Environment]::GetEnvironmentVariable("PROCESSOR_ARCHITECTURE"))
199 | if ($arch -eq "AMD64")
200 | {
201 | $programFiles += "(x86)"
202 | }
203 |
204 | $path = ([System.Environment]::GetEnvironmentVariable($programFiles))
205 |
206 | if ($file.Length -gt 0)
207 | {
208 | $path += "\" + $file
209 | }
210 | return $path
211 | }
212 |
--------------------------------------------------------------------------------
/windows/PerformDownload.psm1:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2016 Assured Information Security, Inc.
2 | #
3 | # Permission is hereby granted, free of charge, to any person obtaining a copy
4 | # of this software and associated documentation files (the "Software"), to deal
5 | # in the Software without restriction, including without limitation the rights
6 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | # copies of the Software, and to permit persons to whom the Software is
8 | # furnished to do so, subject to the following conditions:
9 | #
10 | # The above copyright notice and this permission notice shall be included in
11 | # all copies or substantial portions of the Software.
12 | #
13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | # THE SOFTWARE.
20 |
21 | param (
22 | [string]$mirror = "",
23 | [int]$timeout = 3600000
24 | )
25 |
26 | function Get-FileHash($targetFile) {
27 | $size = (Get-Item $targetFile).length / 1000000
28 | Write-Host "Hashing $size MB $targetFile"
29 | $readStream = [system.io.file]::openread($targetFile)
30 | $hasher = [System.Security.Cryptography.HashAlgorithm]::create('sha256')
31 | $hash = $hasher.ComputeHash($readStream)
32 | $readStream.Close()
33 | return [system.bitconverter]::toString($hash)
34 | }
35 |
36 | function Check-GpgSig ($targetfile, $cert, $sig) {
37 | gpg --import $targetCert
38 | gpg --verify $targetSig $targetFile
39 | return $LastExitCode
40 | }
41 |
42 | Function PerformDownloadGeneric ($url, $targetFile) {
43 | Write-Host "Input URL: [$url] downloading to [$targetFile]"
44 |
45 | # Create the request and do our best to avoid any local caching or socket reusing (causes backend caching)
46 | # Core of this code is by Jason Niver's blog.
47 | # http://blogs.msdn.com/b/jasonn/archive/2008/06/13/downloading-files-from-the-internet-in-powershell-with-progress.aspx
48 | $uri = New-Object "System.Uri" "$url"
49 | $request = [System.Net.HttpWebRequest]::Create($uri)
50 | $request.CachePolicy = New-Object System.Net.Cache.HttpRequestCachePolicy([System.Net.Cache.HttpRequestCacheLevel]::NoCacheNoStore)
51 | $request.Headers.Add("Cache-Control", "no-cache")
52 | $request.KeepAlive = 0
53 | $request.set_Timeout($timeout)
54 | $tmp1 = $request.RequestUri
55 | $tmp2 = $request.Timeout
56 |
57 | # Make the actual request
58 | try {
59 | $response = $request.GetResponse()
60 | # Get the file size, allowing the pretty progress bar
61 | $totalLength = [System.Math]::Floor($response.get_ContentLength()/1024)
62 | Write-Host "Total length is $totalLength KiB."
63 |
64 | # Set up the buffer for reading the file and writing it to disk
65 | $responseStream = $response.GetResponseStream()
66 | $targetStream = New-Object -TypeName System.IO.FileStream -ArgumentList $targetFile, Create
67 | $buffer = new-object byte[] 10KB
68 | $count = $responseStream.Read($buffer,0,$buffer.length)
69 | $downloadedBytes = $count
70 |
71 | # Download the file and write to disk
72 | while ($count -gt 0)
73 | {
74 | $targetStream.Write($buffer, 0, $count)
75 | $count = $responseStream.Read($buffer,0,$buffer.length)
76 | $downloadedBytes = $downloadedBytes + $count
77 | Write-Progress -activity "Downloading file '$($url.split('/') | Select -Last 1)'" -status "Downloaded ($([System.Math]::Floor($downloadedBytes/1024))K of $($totalLength)K): " -PercentComplete ((([System.Math]::Floor($downloadedBytes/1024)) / $totalLength) * 100)
78 | }
79 | # Clean up after ourselves
80 | $targetStream.Flush()
81 | $targetStream.Close()
82 | $targetStream.Dispose()
83 | $responseStream.Dispose()
84 | } catch {
85 | Write-Host "Unable to download $url error " $_.Exception.Message
86 | return $False
87 | }
88 |
89 | return $True
90 | }
91 |
92 | Function PerformDownload ($url, $target, $expectedHash) {
93 | $targetFile = $env:temp + "\" + $target
94 |
95 | # Check if the file is already downloaded
96 | if (($expectedHash) -and (Test-Path $targetFile)) {
97 | $hash = Get-FileHash($targetFile)
98 | if ($hash -eq $expectedHash) {
99 | Write-Host "[Already have $targetFile with hash $hash so skipping download]"
100 | return
101 | } else {
102 | Write-Host "[Already have $targetFile but its hash $hash is not $expectedHash so downloading again]"
103 | }
104 | }
105 |
106 | # Download the file
107 | if ($mirror) {
108 | if (-Not (PerformDownloadGeneric "$($mirror)/$($target)" $targetFile)) {
109 | Write-Host "Downloading $target from the mirror $mirror failed, falling back to the upstream URL: $url"
110 | if (-Not (PerformDownloadGeneric "$url" $targetFile)) {
111 | Exit 1
112 | }
113 | }
114 | } else {
115 | if (-Not (PerformDownloadGeneric "$url" $targetFile)) {
116 | Exit 1
117 | }
118 | }
119 |
120 | # Check the hash of the downloaded file
121 | $hash = Get-FileHash($targetFile)
122 | Write-Host "$hash calculated for $targetFile"
123 | if ($expectedHash -and ($hash -ne $expectedHash)) {
124 | Write-Host "ERROR: $targetFile does not contain the expected content (found hash $hash rather than $expectedHash)"
125 | Exit 2
126 | }
127 | }
128 |
129 | Function PerformDownloadGpg ($url, $target, $cert, $sig) {
130 | Import-Module BitsTransfer
131 |
132 | $targetFile = $env:temp + "\" + $target
133 |
134 | # Download cert and sig
135 | $targetCert = $targetFile + ".cert"
136 | Start-BitsTransfer -Source $cert -Destination $targetCert
137 | $targetSig = $targetFile + ".sig"
138 | Start-BitsTransfer -Source $sig -Destination $targetSig
139 |
140 | # Check if the target file is already downloaded
141 | Check-GpgSig $targetFile $targetCert $targetSig
142 | $gpg_valid = $LastExitCode
143 | if ($gpg_valid -ne 0) {
144 | Write-Host "[Already have $targetFile but its signature is bad so downloading again]"
145 | } else {
146 | Write-Host "[Already have $targetFile with a correct signature so skipping download]"
147 | return
148 | }
149 |
150 | # Download the file
151 | if ($mirror) {
152 | if (-Not (PerformDownloadGeneric "$($mirror)/$($target)" $targetFile)) {
153 | Write-Host "Downloading $target from the mirror $mirror failed, falling back to the upstream URL: $url"
154 | if (-Not (PerformDownloadGeneric "$url" $targetFile)) {
155 | Exit 1
156 | }
157 | }
158 | } else {
159 | if (-Not (PerformDownloadGeneric "$url" $targetFile)) {
160 | Exit 1
161 | }
162 | }
163 |
164 | # Check the signature of the downloaded file
165 | Check-GpgSig $targetFile $targetCert $targetSig
166 | $gpg_valid = $LastExitCode
167 | if ($gpg_valid -ne 0) {
168 | Write-Host "ERROR: $targetFile does not contain the expected content"
169 | Exit 2
170 | }
171 | }
172 |
--------------------------------------------------------------------------------
/windows/config/sample-config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | logs
5 | output
6 | C:\WinDDK\7600.16385.1
7 | "C:\Program Files\Microsoft Visual Studio 11.0"
8 | C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe
9 | C:\Program Files\Git\bin\git.exe
10 | git://github.com/OpenXT
11 | True
12 | Put Your Cert Name Here
13 |
14 | Put Your Company Name Here
15 | "C:\Program Files\Windows Kits\8.0\bin\x86"
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 | Release
26 | false
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 | DdkDir
35 | License
36 | BuildType
37 | Developer
38 | CertName
39 | SignTool
40 | DefaultEula
41 | VSDir
42 | VerString
43 | VerMajor
44 | VerMinor
45 | VerMicro
46 | BuildNumber
47 | BuildTag
48 | BuildBranch
49 | MSBuild
50 | GitUrl
51 | GitBin
52 | CrossSign
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 | BuildTag
66 | VerString
67 | CertName
68 | CompanyName
69 | SignTool
70 |
71 |
72 |
73 |
74 |
75 |
76 | BuildType
77 | CertName
78 | VerString
79 | SignTool
80 |
81 |
82 |
83 |
84 |
85 |
86 | OutDir
87 |
88 |
89 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/windows/inspectbuildmachine.ps1:
--------------------------------------------------------------------------------
1 | # Permission is hereby granted, free of charge, to any person obtaining a copy
2 | # of this software and associated documentation files (the "Software"), to deal
3 | # in the Software without restriction, including without limitation the rights
4 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
5 | # copies of the Software, and to permit persons to whom the Software is
6 | # furnished to do so, subject to the following conditions:
7 | #
8 | # The above copyright notice and this permission notice shall be included in
9 | # all copies or substantial portions of the Software.
10 | #
11 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
17 | # THE SOFTWARE.
18 |
19 | $ScriptDir = Split-Path -parent $MyInvocation.MyCommand.Path
20 | Import-Module $ScriptDir\PackageLibrary.psm1
21 |
22 | foreach ($p in (Get-Packages)) {
23 | if (&('Test-'+$p)) {
24 | Write-Host "$p no action needed"
25 | } else {
26 | Write-Host "$p needs installing"
27 | }
28 | }
29 |
30 |
--------------------------------------------------------------------------------
/windows/makecert.bat:
--------------------------------------------------------------------------------
1 | @ECHO OFF
2 | if [%1]==[] goto usage
3 |
4 | if exist %1.pfx goto exists
5 |
6 | if exist %1.pvk del %1.pvk
7 | if exist %1.cer del %1.cer
8 |
9 | if defined ProgramFiles(x86) (
10 | set PROGRAMPATH="%ProgramFiles(x86)%"
11 | ) else (
12 | set PROGRAMPATH="%ProgramFiles%"
13 | )
14 |
15 | set Day=%date:~7,2%
16 | set Month=%date:~4,2%
17 | set Year=%date:~10,4%
18 | set /a Expires=%Year%+1
19 | set cn="cn=\"%~1\""
20 |
21 | %PROGRAMPATH%"\Windows Kits\8.0\bin\x86\makecert" -sv %1.pvk -n %cn% %1.cer -b %Month%/%Day%/%Year% -e %Month%/%Day%/%Expires% -r
22 | if %errorlevel% NEQ 0 goto :eof
23 | %PROGRAMPATH%"\Windows Kits\8.0\bin\x86\PVK2PFX" -pvk %1.pvk -spc %1.cer -pfx %1.pfx
24 | if %errorlevel% NEQ 0 goto :eof
25 | certutil -f -user -importpfx %1.pfx
26 |
27 | goto :eof
28 | :usage
29 | echo Must set certificate name
30 | goto :eof
31 | :exists
32 | echo %1.pfx already exists
33 |
--------------------------------------------------------------------------------
/windows/mkbuildmachine.ps1:
--------------------------------------------------------------------------------
1 | # Permission is hereby granted, free of charge, to any person obtaining a copy
2 | # of this software and associated documentation files (the "Software"), to deal
3 | # in the Software without restriction, including without limitation the rights
4 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
5 | # copies of the Software, and to permit persons to whom the Software is
6 | # furnished to do so, subject to the following conditions:
7 | #
8 | # The above copyright notice and this permission notice shall be included in
9 | # all copies or substantial portions of the Software.
10 | #
11 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
17 | # THE SOFTWARE.
18 |
19 | param
20 | (
21 | [string]$mirror = "",
22 | [string]$workdir = $env:temp,
23 | [string]$package
24 | )
25 |
26 | function Handle($p) {
27 | if (&('Test-'+$p)) {
28 | Write-Host "$p no action needed"
29 | } else {
30 | Write-Host "$p missing"
31 | &('Install-'+$p)
32 | }
33 | }
34 |
35 | $ErrorActionPreference = "Stop"
36 |
37 | if ($workdir -ne $env:temp) {
38 | if (-Not (Test-Path $workdir)) {
39 | mkdir $workdir
40 | }
41 | $env:temp = $workdir
42 | }
43 |
44 | Start-Transcript -Append -Path ($env:temp+'\mkbuildmachine.log')
45 |
46 | $ScriptDir = Split-Path -parent $MyInvocation.MyCommand.Path
47 | Import-Module $ScriptDir\PackageLibrary.psm1 -ArgumentList $mirror
48 |
49 | if ($package) {
50 | Handle($package)
51 | Write-Host "$package package successfully installed"
52 | Stop-Transcript
53 | } else {
54 | foreach ($p in (Get-Packages)) {
55 | Handle($p)
56 | }
57 | Write-Host "Default packages successfully installed"
58 | Stop-Transcript
59 | exit 0
60 | }
61 |
62 |
--------------------------------------------------------------------------------
/windows/mkbuildserver.ps1:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2016 Assured Information Security, Inc.
2 | #
3 | # Permission is hereby granted, free of charge, to any person obtaining a copy
4 | # of this software and associated documentation files (the "Software"), to deal
5 | # in the Software without restriction, including without limitation the rights
6 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | # copies of the Software, and to permit persons to whom the Software is
8 | # furnished to do so, subject to the following conditions:
9 | #
10 | # The above copyright notice and this permission notice shall be included in
11 | # all copies or substantial portions of the Software.
12 | #
13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | # THE SOFTWARE.
20 |
21 | param
22 | (
23 | [string]$mirror = ""
24 | )
25 |
26 | # Install all the default mkbuildmachine packages
27 | if ($mirror) {
28 | & .\mkbuildmachine.ps1 -mirror $mirror
29 | } else {
30 | & .\mkbuildmachine.ps1
31 | }
32 | if ($LastExitCode -ne 0) {
33 | exit 1
34 | }
35 |
36 | # Install specific packages required by the build daemon
37 | if ($mirror) {
38 | & .\mkbuildmachine.ps1 -mirror $mirror -package python
39 | } else {
40 | & .\mkbuildmachine.ps1 -package python
41 | }
42 | if ($LastExitCode -ne 0) {
43 | exit 1
44 | }
45 |
46 | # Create the certificate
47 | & .\makecert.bat developer
48 |
49 | # Install the build daemon
50 | $winbuildd_exists = Test-Path("C:\winbuildd")
51 | if ($winbuildd_exists -ne $True) {
52 | mkdir C:\winbuildd
53 | }
54 | copy BuildDaemon\winbuild.cfg C:\winbuildd\winbuild.cfg
55 | copy BuildDaemon\winbuildd.py C:\winbuildd\winbuildd.py
56 | copy BuildDaemon\start.ps1 C:\winbuildd\start.ps1
57 |
58 | # Auto-start the build daemon
59 | $startmenu = [Environment]::GetFolderPath("StartMenu")
60 | $startup = "$($startmenu)\Programs\Startup"
61 | $startupExists = Test-Path $($startup)
62 | if ($startupExists -ne $True) {
63 | mkdir $startup
64 | }
65 | copy BuildDaemon\winbuildd.bat "$($startup)\winbuildd.bat"
66 |
67 | # Create ssh key
68 | $env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine")
69 | cd C:\winbuildd
70 | ssh-keygen -t rsa -N '""' -f id_rsa
71 |
72 | # Done
73 | Write-Host "Done. Please reboot one last time."
74 | Write-Host "Make sure winbuildd starts and continue the host setup script."
75 |
--------------------------------------------------------------------------------
/windows/winbuild-all.ps1:
--------------------------------------------------------------------------------
1 | # Permission is hereby granted, free of charge, to any person obtaining a copy
2 | # of this software and associated documentation files (the "Software"), to deal
3 | # in the Software without restriction, including without limitation the rights
4 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
5 | # copies of the Software, and to permit persons to whom the Software is
6 | # furnished to do so, subject to the following conditions:
7 | #
8 | # The above copyright notice and this permission notice shall be included in
9 | # all copies or substantial portions of the Software.
10 | #
11 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
17 | # THE SOFTWARE.
18 |
19 | ############################################################################
20 | ### Script to download and build necessary repos ###
21 | ### No arguments expected ###
22 | ############################################################################
23 |
24 | #Calling a script does not change the working directory, instead use the invocation command to create paths relative to this script
25 | $mywd = Split-Path -Parent $MyInvocation.MyCommand.Path
26 | $root = ([System.IO.Directory]::GetCurrentDirectory())
27 | . ($mywd + "\BuildSupport\winbuild-utils.ps1")
28 | Import-Module $mywd\BuildSupport\invoke.psm1
29 |
30 | $cmdinv = $MyInvocation.MyCommand.Name
31 |
32 | # Do the common initialization of the global vars and setup a log file
33 | if (!(common-init -cmdinv $cmdinv))
34 | {
35 | ExitWithCode -exitcode $global:failure
36 | }
37 |
38 | #Need the config file to know which repos to get
39 | $cfgfile = ($root + "\config.xml")
40 | if (!(Test-Path -Path $cfgfile -PathType Leaf))
41 | {
42 | Write-Host "ERROR: Config file not present - config:" $cfgfile
43 | return $false
44 | }
45 |
46 | $gitbin = read-config-value -config $global:cfgfile -name "GitBin"
47 | if ($gitbin.Length -lt 1) {
48 | log-error -err "Failed to read GitBin value from config"
49 | ExitWithCode -exitcode $global:failure
50 | }
51 | if (-Not (Test-Path $gitbin)) {
52 | log-error -err "Git binary at $gitbin not found"
53 | ExitWithCode -exitcode $global:failure
54 | }
55 |
56 | #Get the git URL from config & BuildTag
57 | $giturl = read-config-value -config $global:cfgfile -name "GitUrl"
58 | if ($giturl.Length -lt 1)
59 | {
60 | log-error -err "Failed to read GitUrl value from config"
61 | ExitWithCode -exitcode $global:failure
62 | }
63 | $tag = read-config-value -config $global:cfgfile -name "BuildTag"
64 | $branch = read-config-value -config $global:cfgfile -name "BuildBranch"
65 |
66 | #Setup for xml parsing
67 | [xml]$xmlContent = [xml](Get-Content -Path $cfgfile)
68 | [System.Xml.XmlElement]$xmlroot = $xmlContent.get_DocumentElement()
69 | [System.Xml.XmlElement]$step = $null
70 |
71 | # Parse the config to determine how to run the build
72 | foreach($step in $xmlroot.Steps.ChildNodes)
73 | {
74 |
75 | # Filter out comment nodes
76 | if ($step.name.CompareTo('#comment') -eq 0) {
77 | Write-Host "skipping comment node"
78 | continue
79 | }
80 |
81 | # Treat this step as one that needs a git clone if the config specifies it
82 | if ($step.clone.CompareTo('false') -ne 0) {
83 | $doclone = $true
84 | $gitdst = $global:builddir + "\" + $step.name
85 | # skip the clone if it has already been done
86 | if (Test-Path ($step.name+"\.git")) {
87 | $nfiles = (Get-ChildItem $gitdst).Count
88 | # it is possible a failure during an earlier clone resulted in a directory,
89 | # possibly with a .git subdirectory, so if we see that we still need to clone
90 | if ([int]$nfiles -gt 1) {
91 | $doclone = $false
92 | }
93 | }
94 | } else {
95 | $doclone = $false
96 | Write-Host "Clone disabled for $step.name"
97 | }
98 |
99 | if ($doclone) {
100 | $gitsrc = $giturl + "/" + $step.name + ".git"
101 | Invoke-CommandChecked "git clone $gitsrc" $gitbin clone -n $gitsrc
102 |
103 | # If a branch has been specified in the config, checkout HEAD of that branch over tag info
104 | if ($branch.Length -gt 0)
105 | {
106 | Push-Location -Path $step.name
107 | log-info -info ("Checking out: " + $branch + " For: " + $step.name)
108 | Invoke-CommandChecked "git fetch origin" $gitbin fetch origin
109 | & $gitbin checkout $branch | Out-Host
110 | if ($LastExitCode -ne 0) {
111 | Write-Host "git checkout $branch failed; using master"
112 | Invoke-CommandChecked "git checkout master" $gitbin checkout master
113 | }
114 | Pop-Location
115 | }elseif ($tag.Length -gt 0)
116 | {
117 | Push-Location -Path $step.name
118 | Write-Host ("Checking out: " + $tag + " For: " + $step.name)
119 | Invoke-CommandChecked "git checkout tag" $gitbin checkout $tag
120 | Pop-Location
121 | } else {
122 | throw "Need either tag or branch"
123 | }
124 |
125 | if (!(Test-Path $gitdst)) {
126 | throw "$gitdst missing after clone"
127 | } else {
128 | Write-Host "$gitdst exists"
129 | }
130 | }
131 |
132 | # Check that we want to run the command for this step (Helps reduce build tests during development)
133 | if($step.Run.execute -eq $null) {
134 | Write-Host ("Execute not specified in "+([string]$step.Name))
135 | continue
136 | }
137 | if ($step.Run.execute.CompareTo("false") -eq 0)
138 | {
139 | Write-Host ("Execute set to false in "+([string]$step.Name))
140 | continue
141 | }
142 | # Make certain there is a command to run
143 | if ($step.Run.Command.Length -eq 0) {
144 | Write-Host ("No command in "+[string]($step.Name))
145 | continue
146 | }
147 | # Create parameters array
148 | $parameters = @($root + "\"+$step.Run.Path)
149 | if($step.Run.Parameters -ne $null) {
150 | foreach($param in $step.Run.Parameters.ChildNodes) {
151 | $parameter = $param.'#text'
152 | $value = read-config-value -config $cfgfile -name $parameter
153 | #Check parameter value is not empty
154 | if($value.Length -ne 0){
155 | $parameters += ("'"+$parameter + "=" + $value+"'")
156 | }
157 | }
158 | }
159 |
160 | # Now we're all done parsing this step, execute the associated command and wait for it to return
161 | $command = [string] ($step.Run.command)
162 | $stepName = [string] ($step.Name)
163 | Write-Host ""
164 | Write-Host "-----------------------------------------------------------------"
165 | Write-Host ("Executing $stepName command $command with parameters $parameters at "+(Get-Date))
166 | Invoke-CommandChecked "Executing step $stepName" $command $parameters
167 | Write-Host ""
168 | Write-Host "================================================================="
169 | Write-Host ("Execution of $stepName command $command with parameters $parameters finished at "+(Get-Date)+" code $LastExitCode")
170 | if($LastExitCode -ne 0) {
171 | throw "Failed trying to execute $stepName command " + $command + " " + ($root + "\" + $step.Run.Path) + " code $LastExitCode"
172 | }
173 | }
174 |
175 | log-info -info ("Completed " + $cmdinv)
176 | ExitWithCode -exitcode $global:success
177 |
--------------------------------------------------------------------------------