Compare commits

..

1 Commits

Author SHA1 Message Date
devrandom 684f6c9427 Use lxcbr0 as bridge 12 years ago

2
.gitignore vendored

@ -9,5 +9,3 @@ inputs
base*
*.qcow2
sigs
target-bin/bootstrap-fixup
.vagrant

@ -1,674 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

@ -1,26 +0,0 @@
Copyright 2009-2013 Gitian Developers
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Exception: for the sake of clarity, an exception is granted to all
outputs from Gitian tools. The license shall not apply to outputs,
and their individual licenses shall apply.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Developers include:
* Miron Cuperman
* Matt Corallo
* Gavin Andresen
* Luke Dashjr
* Pieter Wuille

@ -1,6 +1,6 @@
# Gitian
Read about the project goals at the [project home page](https://gitian.org/).
Read about the project goals at the "project home page":https://gitian.org/ .
This package can do a deterministic build of a package inside a VM.
@ -8,158 +8,31 @@ This package can do a deterministic build of a package inside a VM.
This performs a build inside a VM, with deterministic inputs and outputs. If the build script takes care of all sources of non-determinism (mostly caused by timestamps), the result will always be the same. This allows multiple independent verifiers to sign a binary with the assurance that it really came from the source they reviewed.
## Prerequisites:
## Synopsis:
### Arch:
Install prereqs:
sudo pacman -S python2-cheetah qemu rsync
sudo pacman -S lxc libvirt bridge-utils # for lxc mode
sudo apt-get install apt-cacher-ng python-vm-builder ruby
From AUR:
If you want to use kvm:
sudo apt-get install qemu-kvm
* [apt-cacher-ng](https://aur.archlinux.org/packages/apt-cacher-ng/) (you may have to play with permissions (chown to apt-cacher-ng) on files to get apt-cacher-ng to start)
* [debian-archive-keyring](https://aur.archlinux.org/packages/debian-archive-keyring/) (for making Debian guests)
* [debootstrap](https://aur.archlinux.org/packages/debootstrap/)
* [dpkg](https://aur.archlinux.org/packages/dpkg/)
* [gnupg1](https://aur.archlinux.org/packages/gnupg1/)
* [multipath-tools](https://aur.archlinux.org/packages/multipath-tools/) (for kpartx)
* [ubuntu-keyring](https://aur.archlinux.org/packages/ubuntu-keyring/) (for making Ubuntu guests)
or alternatively, lxc (no need for hardware support):
sudo apt-get install debootstrap lxc
From Launchpad:
* [vmbuilder](https://launchpad.net/vmbuilder)
Also, I had to modify the default /etc/sudoers file to uncomment the `secure_path` line, because vmbuilder isn't found otherwise when the `env -i ... sudo vmbuilder ...` line is executed (because the i flag resets the environment variables including the PATH).
### Gentoo:
layman -a luke-jr # needed for vmbuilder
sudo emerge dev-vcs/git net-misc/apt-cacher-ng app-emulation/vmbuilder dev-lang/ruby
sudo emerge app-emulation/qemu
export KVM=qemu-system-x86_64
### Ubuntu:
This pulls in all pre-requisites for KVM building on Ubuntu:
sudo apt-get install git apache2 apt-cacher-ng python-vm-builder ruby qemu-utils
If you'd like to use LXC mode instead, install it as follows:
sudo apt-get install lxc
### Debian:
See Ubuntu, and also run the following on Debian Jessie or newer:
sudo apt-get install ubuntu-archive-keyring
On Debian Wheezy you run the same command, but you must first add backports to your system, because the package is only available in wheezy-backports.
### OSX with MacPorts:
sudo port install ruby coreutils
export PATH=$PATH:/opt/local/libexec/gnubin # Needed for sha256sum
### OSX with Homebrew:
brew install ruby coreutils
export PATH=$PATH:/opt/local/libexec/gnubin
#### VirtualBox:
Install virtualbox from http://www.virtualbox.org, and make sure `VBoxManage` is in your `$PATH`.
## Debian Guests
Gitian now supports Debian guests in addition to Ubuntu guests. Note that this doesn't mean you can allow the builders to choose to use either Debian or Ubuntu guests. The person creating the Gitian descriptor will need to choose a particular distro and suite for the guest and all builders must use that particular distro and suite, otherwise the software won't reproduce for everyone.
The official vmbuilder only includes support for Ubuntu guests, so you need to install [Joseph Bisch's fork of vmbuilder](https://github.com/josephbisch/vmbuilder), which adds a Debian plugin.
To create a Debian guest:
bin/make-base-vm --distro debian --suite jessie
There is currently no support for LXC Debian guests. There is just KVM support. LXC support for Debian guests is planned to be added soon.
Only Debian Jessie guests have been tested with Gitian. Debian Jessie is the current stable release of Debian at this time. If you have success (or trouble) with other versions of Debian, please let us know.
If you are creating a Gitian descriptor, you can now specify a distro. If no distro is provided, the default is to assume Ubuntu. Since Ubuntu is assumed, older Gitian descriptors that don't specify a distro will still work as they always have.
## Create the base VM for use in further builds
**NOTE:** requires `sudo`, please review the script
### KVM
Create the base VM for use in further builds (requires sudo, please review the script):
bin/make-base-vm
bin/make-base-vm --arch i386
### LXC
or for lxc:
bin/make-base-vm --lxc
bin/make-base-vm --lxc --arch i386
Set the `USE_LXC` environment variable to use `LXC` instead of `KVM`:
export USE_LXC=1
### VirtualBox
Command-line `VBoxManage` must be in your `$PATH`.
#### Setup:
`make-base-vm` cannot yet make VirtualBox virtual machines ( _patches welcome_, it should be possible to use `VBoxManage`, boot-from-network Linux images and PXE booting to do it). So you must either get or manually create VirtualBox machines that:
1. Are named `Gitian-<suite>-<arch>` -- e.g. Gitian-xenial-i386 for a 32-bit, Ubuntu 16 machine.
2. Have a booted-up snapshot named `Gitian-Clean` . The build script resets the VM to that snapshot to get reproducible builds.
3. Has the VM's NAT networking setup to forward port `localhost:2223` on the host machine to port `22` of the VM; e.g.:
```
VBoxManage modifyvm Gitian-xenial-i386 --natpf1 "guestssh,tcp,,2223,,22"
```
The final setup needed is to create an `ssh` key that will be used to login to the virtual machine:
ssh-keygen -t rsa -f var/id_rsa -N ""
ssh -p 2223 ubuntu@localhost 'mkdir -p .ssh && chmod 700 .ssh && cat >> .ssh/authorized_keys' < var/id_rsa.pub
Then log into the vm and copy the `ssh` keys to root's `authorized_keys` file.
ssh -p 2223 ubuntu@localhost
# Now in the vm
sudo bash
mkdir -p .ssh && chmod 700 .ssh && cat ~ubuntu/.ssh/authorized_keys >> .ssh/authorized_keys
Set the `USE_VBOX` environment variable to use `VBOX` instead of `KVM`:
export USE_VBOX=1
## Sanity-testing
If you have everything set-up properly, you should be able to:
PATH=$PATH:$(pwd)/libexec
make-clean-vm --suite xenial --arch i386
# on-target needs $DISTRO to be set to debian if using a Debian guest
# (when running gbuild, $DISTRO is set based on the descriptor, so this line isn't needed)
DiSTRO=debian
# For LXC:
LXC_ARCH=i386 LXC_SUITE=xenial on-target ls -la
# For KVM:
start-target 32 xenial-i386 &
# wait a few seconds for VM to start
on-target ls -la
stop-target
## Building
Copy any additional build inputs into a directory named _inputs_.
Then execute the build using a `YAML` description file (can be run as non-root):
Then execute the build using a YAML description file (can be run as non-root):
export USE_LXC=1 # LXC only
bin/gbuild <package>.yml
@ -168,27 +41,26 @@ or if you need to specify a commit for one of the git remotes:
bin/gbuild --commit <dir>=<hash> <package>.yml
The resulting report will appear in `result/<package>-res.yml`
The resulting report will appear in result/\<package\>-res.yml
To sign the result, perform:
bin/gsign --signer <signer> --release <release-name> <package>.yml
Where `<signer>` is your signing PGP key ID and `<release-name>` is the name for the current release. This will put the result and signature in the `sigs/<package>/<release-name>`. The `sigs/<package>` directory can be managed through git to coordinate multiple signers.
Where <signer> is your signing PGP key ID and <release-name> is the name for the current release. This will put the result and signature in the sigs/<package>/<release-name>. The sigs/<package> directory can be managed through git to coordinate multiple signers.
After you've merged everybody's signatures, verify them:
bin/gverify --release <release-name> <package>.yml
## Poking around
* Log files are captured to the _var_ directory
* You can run the utilities in libexec by running `PATH="libexec:$PATH"`
* To start the target VM run `start-target 32 xenial-i386` or `start-target 64 xenial-amd64`
* To ssh into the target run `on-target` (after setting $DISTRO to debian if using a Debian guest) or `on-target -u root`
* To start the target VM run `start-target 32 lucid-i386` or `start-target 64 lucid-amd64`
* To ssh into the target run `on-target` or `on-target -u root`
* On the target, the _build_ directory contains the code as it is compiled and _install_ contains intermediate libraries
* By convention, the script in `<package>.yml` starts with any environment setup you would need to manually compile things on the target
* By convention, the script in \<package\>.yml starts with any environment setup you would need to manually compile things on the target
TODO:
- disable sudo in target, just in case of a hypervisor exploit
@ -196,23 +68,18 @@ TODO:
## LXC tips
`bin/gbuild` runs `lxc-execute` or `lxc-start`, which may require root. If you are in the admin group, you can add the following sudoers line to prevent asking for the password every time:
`bin/gbuild` runs `lxc-start`, which may require root. If you are in the admin group, you can add the following sudoers line to prevent asking for the password every time:
%admin ALL=NOPASSWD: /usr/bin/lxc-execute
%admin ALL=NOPASSWD: /usr/bin/lxc-start
Right now `lxc-start` is the default, but you can force `lxc-execute` (useful for Ubuntu 14.04) with:
export LXC_EXECUTE=lxc-execute
Recent distributions allow lxc-execute / lxc-start to be run by non-priviledged users, so you might be able to rip-out the `sudo` calls in `libexec/*`.
Recent distributions allow lxc-start to be run by non-priviledged users, so you might be able to rip-out the `sudo` calls in `libexec/*`.
If you have a runaway `lxc-start` command, just use `kill -9` on it.
The machine configuration requires access to br0 and assumes that the host address is `10.0.2.2`:
The machine configuration requires access to lxcbr0 and assumes that the host address is 10.0.3.1 . If lxc does not configure lxcbr0 on boot, you can do so manually:
sudo brctl addbr br0
sudo ifconfig br0 10.0.2.2/24 up
sudo brctl addbr lxcbr0
sudo ifconfig lxcbr0 10.0.3.1/24 up
## Tests

@ -1,35 +0,0 @@
2015-12-12
----------
Since OpenSSH removed support for DSS, Gitian now uses RSA keys instead. Base images should be regenerated.
2015-05-16
----------
LXC support has been revamped:
* debootstrap is now used directly, so that no kernel or grub packages are installed
* an attempt has been made to eliminate cases where an update of a package can fail because the container is missing a real init/upstart process
2015-03-23
----------
Now ensuring that `apt-get dist-upgrade` occurs at least once before package manifest
is computed. This is because distributions usually don't store old versions of packages
in the repos, so we can't download the exact package version we have installed if it's
out of date.
gbuild now has a --upgrade flag that forces an upgrade after the first one.
Other Notes
===========
Important:
We are planning on switching from using lxc-start to using lxc-execute. lxc-execute requires lxc-init (or init.lxc) to be available on the guest at one of the expected places. You might have to manually install lxc on your base VM image or recreate the image.
To enable this now (required for Ubuntu 14.04), do:
export LXC_EXECUTE=lxc-execute
If your guest is more recent than the host, all bets are off, since lxc-execute may not be able to find the lxc init.

46
Vagrantfile vendored

@ -1,46 +0,0 @@
$script = <<SCRIPT
#!/bin/bash
set -eu
sudo apt-get update -y
sudo apt-get upgrade -y
sudo apt-get install -y autoconf2.13 automake build-essential bsdmainutils faketime g++ g++-mingw-w64 git-core libqt4-dev libtool libz-dev mingw-w64 nsis pciutils pkg-config psmisc subversion unzip zip
echo "ok"
SCRIPT
archs = ["amd64", "i386"]
suites = ["precise", "quantal", "raring", "saucy", "trusty"]
if ARGV[0] == "up" and ARGV.length == 1
puts "Specify a name of the form 'suite-architecture'"
puts " suites: " + suites.join(', ')
puts " architectures: " + archs.join(', ')
Process.exit 1
end
Vagrant.configure("2") do |config|
config.vm.provision "shell", inline: $script
config.vm.network :forwarded_port, id: "ssh", guest: 22, host: 2223
suites.each do |suite|
archs.each do |arch|
name = "#{suite}-#{arch}"
config.vm.define name do |config|
config.vm.box = name
config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/#{suite}/current/#{suite}-server-cloudimg-#{arch}-vagrant-disk1.box"
config.vm.provider :virtualbox do |vb|
vb.name = "Gitian-#{name}"
end
end
end
end
config.vm.provider :virtualbox do |vb|
vb.memory = 4096
end
end

@ -12,11 +12,6 @@ require 'pathname'
'amd64' => 64,
}
@arches = {
'i386' => 'i386',
'amd64' => 'x86_64',
}
def system!(cmd)
system(cmd) or raise "failed to run #{cmd}"
end
@ -27,7 +22,7 @@ def sanitize(str, where)
end
def sanitize_path(str, where)
raise "unsanitary string in #{where}" if (str =~ /[^@\w\/.:+-]/)
raise "unsanitary string in #{where}" if (str =~ /[^\w\/.:+-]/)
str
end
@ -35,7 +30,7 @@ def info(str)
puts str unless @options[:quiet]
end
def build_one_configuration(suite, arch, build_desc)
def build_one_configuration(suite, arch, build_desc, reference_datetime)
FileUtils.rm_f("var/build.log")
bits = @bitness[arch] or raise "unknown architecture ${arch}"
@ -62,7 +57,7 @@ def build_one_configuration(suite, arch, build_desc)
$stdout.write "Checking if target is up"
(1..30).each do
(1..10).each do
system "on-target true 2> /dev/null" and break
sleep 2
$stdout.write '.'
@ -72,39 +67,21 @@ def build_one_configuration(suite, arch, build_desc)
system! "on-target true"
system! "on-target -u root tee -a /etc/sudoers.d/#{ENV['DISTRO'] || 'ubuntu'} > /dev/null << EOF
%#{ENV['DISTRO'] || 'ubuntu'} ALL=(ALL) NOPASSWD: ALL
EOF" if build_desc["sudo"] and @options[:allow_sudo]
info "Preparing build environment"
system! "on-target setarch #{@arches[arch]} bash < target-bin/init-build.sh"
system! "on-target bash < target-bin/init-build.sh"
build_desc["files"].each do |filename|
filename = sanitize(filename, "files section")
system! "copy-to-target #{@quiet_flag} inputs/#{filename} build/"
end
if build_desc["enable_cache"]
if File.directory?("cache/#{build_desc["name"]}")
system! "copy-to-target #{@quiet_flag} cache/#{build_desc["name"]}/ cache/"
end
if File.directory?("cache/common")
system! "copy-to-target #{@quiet_flag} cache/common/ cache/"
end
end
info "Updating apt-get repository (log in var/install.log)"
system! "on-target -u root apt-get update > var/install.log 2>&1"
info "Installing additional packages (log in var/install.log)"
system! "on-target -u root -e DEBIAN_FRONTEND=noninteractive apt-get --no-install-recommends -y install #{build_desc["packages"].join(" ")} > var/install.log 2>&1"
system! "on-target -u root apt-get -y install #{build_desc["packages"].join(" ")} > var/install.log 2>&1"
if @options[:upgrade] || system("on-target -u root '[ ! -e /var/cache/gitian/initial-upgrade ]'")
info "Upgrading system, may take a while"
system! "on-target -u root bash < target-bin/upgrade-system.sh > var/install.log 2>&1"
end
info "Creating package manifest"
info "Grabbing package manifest"
system! "on-target -u root bash < target-bin/grab-packages.sh > var/base-#{suitearch}.manifest"
info "Creating build script (var/build-script)"
@ -112,41 +89,25 @@ EOF" if build_desc["sudo"] and @options[:allow_sudo]
File.open("var/build-script", "w") do |script|
script.puts "#!/bin/bash"
script.puts "set -e"
script.puts "export LANG='en_US.UTF-8'"
script.puts "export LC_ALL='en_US.UTF-8'"
script.puts "umask 002"
script.puts "export OUTDIR=$HOME/out"
script.puts "GBUILD_BITS=#{bits}"
if build_desc["enable_cache"]
script.puts "GBUILD_CACHE_ENABLED=1"
script.puts "GBUILD_PACKAGE_CACHE=$HOME/cache/#{build_desc["name"]}"
script.puts "GBUILD_COMMON_CACHE=$HOME/cache/common"
end
script.puts "MAKEOPTS=(-j#{@options[:num_procs]})"
(ref_date, ref_time) = reference_datetime.split
script.puts "REFERENCE_DATETIME='#{reference_datetime}'"
script.puts "REFERENCE_DATE='#{ref_date}'"
script.puts "REFERENCE_TIME='#{ref_time}'"
script.puts
author_date = nil
build_desc["remotes"].each do |remote|
dir = sanitize(remote["dir"], remote["dir"])
author_date = `cd inputs/#{dir} && git log --format=@%at -1 | date +"%F %T" -u -f -`.strip
raise "error looking up author date in #{dir}" unless $?.exitstatus == 0
system! "copy-to-target #{@quiet_flag} inputs/#{dir} build/"
script.puts "(cd build/#{dir} && git reset -q --hard && git clean -q -f -d)"
end
script.puts
ref_datetime = build_desc["reference_datetime"] || author_date
(ref_date, ref_time) = ref_datetime.split
script.puts "REFERENCE_DATETIME='#{ref_datetime}'"
script.puts "REFERENCE_DATE='#{ref_date}'"
script.puts "REFERENCE_TIME='#{ref_time}'"
script.puts
script.puts "cd build"
script.puts build_desc["script"]
end
info "Running build script (log in var/build.log)"
system! "on-target setarch #{@arches[arch]} bash -x < var/build-script > var/build.log 2>&1"
system! "on-target bash -x < var/build-script > var/build.log 2>&1"
end
################################
@ -154,15 +115,9 @@ end
OptionParser.new do |opts|
opts.banner = "Usage: build [options] <build-description>.yml"
opts.on("--allow-sudo", "override SECURITY on the target VM and allow the use of sudo with no password for the default user") do |v|
@options[:allow_sudo] = v
end
opts.on("-i", "--skip-image", "reuse current target image") do |v|
@options[:skip_image] = v
end
opts.on("--upgrade", "upgrade guest with latest packages") do |v|
@options[:upgrade] = v
end
opts.on("-q", "--quiet", "be quiet") do |v|
@options[:quiet] = v
end
@ -175,15 +130,9 @@ OptionParser.new do |opts|
opts.on("-c PAIRS", "--commit PAIRS", "comma separated list of DIRECTORY=COMMIT pairs") do |v|
@options[:commit] = v
end
opts.on("-u PAIRS", "--url PAIRS", "comma separated list of DIRECTORY=URL pairs") do |v|
@options[:url] = v
end
opts.on("-o", "--cache-read-only", "only use existing cache files, do not update them") do |v|
@options[:cache_ro] = v
end
end.parse!
if !ENV["USE_LXC"] and !File.exist?("/dev/kvm")
if !File.exist?("/dev/kvm")
$stderr.puts "\n************* WARNING: kvm not loaded, this will probably not work out\n\n"
end
@ -204,8 +153,6 @@ in_sums = []
build_dir = 'build'
result_dir = 'result'
cache_dir = 'cache'
enable_cache = build_desc["enable_cache"]
FileUtils.rm_rf(build_dir)
FileUtils.mkdir(build_dir)
@ -214,17 +161,9 @@ FileUtils.mkdir_p(result_dir)
package_name = build_desc["name"] or raise "must supply name"
package_name = sanitize(package_name, "package name")
if enable_cache
FileUtils.mkdir_p(File.join(cache_dir, "common"))
FileUtils.mkdir_p(File.join(cache_dir, package_name))
end
distro = build_desc["distro"] || "ubuntu"
suites = build_desc["suites"] or raise "must supply suites"
archs = build_desc["architectures"] or raise "must supply architectures"
build_desc["reference_datetime"] or build_desc["remotes"].size > 0 or raise "must supply `reference_datetime` or `remotes`"
ENV['DISTRO'] = distro
reference_datetime = build_desc["reference_datetime"] or raise "must supply reference_datetime"
desc_sum = `sha256sum #{build_desc_file}`
desc_sum = desc_sum.sub(build_desc_file, "#{package_name}-desc.yml")
@ -244,28 +183,17 @@ if @options[:commit]
end
end
urls = {}
if @options[:url]
@options[:url].split(',').each do |pair|
(dir, url) = pair.split('=')
urls[dir] = url
end
end
build_desc["remotes"].each do |remote|
if !remote["commit"]
remote["commit"] = commits[remote["dir"]]
raise "must specify a commit for directory #{remote["dir"]}" unless remote["commit"]
end
if urls[remote["dir"]]
remote["url"] = urls[remote["dir"]]
end
dir = sanitize(remote["dir"], remote["dir"])
unless File.exist?("inputs/#{dir}")
system!("git init inputs/#{dir}")
system!("cd inputs/#{dir} && git remote add origin #{sanitize_path(remote["url"], remote["url"])}")
end
system!("cd inputs/#{dir} && git fetch --update-head-ok #{sanitize_path(remote["url"], remote["url"])} +refs/tags/*:refs/tags/* +refs/heads/*:refs/heads/*")
system!("cd inputs/#{dir} && git fetch && git fetch --tags")
commit = sanitize(remote["commit"], remote["commit"])
commit = `cd inputs/#{dir} && git log --format=%H -1 #{commit}`.strip
raise "error looking up commit for tag #{remote["commit"]}" unless $?.exitstatus == 0
@ -282,16 +210,11 @@ suites.each do |suite|
arch = sanitize(arch, "architecture")
# Build!
build_one_configuration(suite, arch, build_desc)
build_one_configuration(suite, arch, build_desc, reference_datetime)
info "Grabbing results from target"
info "Grabbing results"
system! "copy-from-target #{@quiet_flag} out #{build_dir}"
if enable_cache && !@options[:cache_ro]
info "Grabbing cache from target"
system! "copy-from-target #{@quiet_flag} cache/#{package_name}/ #{cache_dir}"
system! "copy-from-target #{@quiet_flag} cache/common/ #{cache_dir}"
end
base_manifest = File.read("var/base-#{suite}-#{arch}.manifest")
base_manifests["#{suite}-#{arch}"] = base_manifest
end
@ -299,10 +222,6 @@ end
out_dir = File.join(build_dir, "out")
out_sums = {}
cache_common_dir = File.join(cache_dir, "common")
cache_package_dir = File.join(cache_dir, "#{package_name}")
cache_common_sums = {}
cache_package_sums = {}
info "Generating report"
Dir.glob(File.join(out_dir, '**', '*'), File::FNM_DOTMATCH).sort.each do |file_in_out|
@ -314,38 +233,15 @@ Dir.glob(File.join(out_dir, '**', '*'), File::FNM_DOTMATCH).sort.each do |file_i
puts out_sums[file] unless @options[:quiet]
end
if enable_cache
Dir.glob(File.join(cache_common_dir, '**', '*'), File::FNM_DOTMATCH).sort.each do |file_in_out|
next if File.directory?(file_in_out)
file = file_in_out.sub(cache_common_dir + File::SEPARATOR, '')
file = sanitize_path(file, file_in_out)
cache_common_sums[file] = `cd #{cache_common_dir} && sha256sum #{file}`
raise "failed to sum #{file}" unless $? == 0
end
Dir.glob(File.join(cache_package_dir, '**', '*'), File::FNM_DOTMATCH).sort.each do |file_in_out|
next if File.directory?(file_in_out)
file = file_in_out.sub(cache_package_dir + File::SEPARATOR, '')
file = sanitize_path(file, file_in_out)
cache_package_sums[file] = `cd #{cache_package_dir} && sha256sum #{file}`
raise "failed to sum #{file}" unless $? == 0
end
end
out_manifest = out_sums.keys.sort.map { |key| out_sums[key] }.join('')
in_manifest = in_sums.join('')
cache_common_manifest = cache_common_sums.keys.sort.map { |key| cache_common_sums[key] }.join('')
cache_package_manifest = cache_package_sums.keys.sort.map { |key| cache_package_sums[key] }.join('')
# Use Omap to keep result deterministic
report = YAML::Omap[
'out_manifest', out_manifest,
'in_manifest', in_manifest,
'base_manifests', base_manifests,
'cache_common_manifest', cache_common_manifest,
'cache_package_manifest', cache_package_manifest,
]
result_file = "#{package_name}-res.yml"

@ -17,7 +17,7 @@ def sanitize(str, where)
end
def sanitize_path(str, where)
raise "unsanitary string in #{where}" if (str =~ /[^@\w\/.:+-]/)
raise "unsanitary string in #{where}" if (str =~ /[^\w\/.-]/)
str
end
@ -45,10 +45,6 @@ OptionParser.new do |opts|
opts.on("-d DEST", "--destination DEST", "directory to place signature in") do |v|
@options[:destination] = v
end
opts.on("-p PROG", "--signing_program PROG", "specify signing program to use") do |v|
@options[:program] = v
end
end.parse!
base_dir = Pathname.new(__FILE__).expand_path.dirname.parent
@ -80,7 +76,6 @@ result['type'] = 'build'
result['optionals'] = optionals
signer = @options[:signer] or raise "must supply signer with --signer"
program = @options[:program] || "gpg --detach-sign"
FileUtils.mkdir_p(destination)
@ -90,4 +85,4 @@ assert_path = File.join(release_path, "#{package_name}-build.assert")
File.open(assert_path, "w") do |io|
io.write result.to_yaml
end
system!("#{program} -u \"#{signer}\" \"#{assert_path}\"")
system!("gpg --detach-sign -u \"#{signer}\" \"#{assert_path}\"")

@ -5,8 +5,6 @@ require 'yaml'
require 'fileutils'
require 'pathname'
bold = ["\033[0m", "\033[1m"]
@options = {}
def system!(cmd)
@ -19,7 +17,7 @@ def sanitize(str, where)
end
def sanitize_path(str, where)
raise "unsanitary string in #{where}" if (str =~ /[^@\w\/.:+-]/)
raise "unsanitary string in #{where}" if (str =~ /[^@\w\/. -]/)
str
end
@ -35,11 +33,6 @@ OptionParser.new do |opts|
opts.on("-v", "--verbose", "be more verbose") do |v|
@options[:verbose] = v
end
@options[:markup] = true
opts.on("-m", "--[no-]markup", "markup the output using ANSI escape codes") do |m|
@options[:markup] = m
end
opts.on("-r REL", "--release REL", "release name") do |v|
@options[:release] = v
end
@ -47,9 +40,6 @@ OptionParser.new do |opts|
opts.on("-d DEST", "--destination DEST", "directory to place signature in") do |v|
@options[:destination] = v
end
opts.on("-c SIGNER", "--compare-to SIGNER", "compare other manifests to SIGNER's, if not given pick first") do |v|
@options[:compareto] = v
end
end.parse!
base_dir = Pathname.new(__FILE__).expand_path.dirname.parent
@ -68,8 +58,6 @@ package_name = sanitize(package_name, "package name")
destination = @options[:destination] || File.join(base_dir, "sigs", package_name)
release = @options[:release] || "current"
release = sanitize(release, "release")
verbose = @options[:verbose]
bold = ['', ''] unless @options[:markup]
release_path = File.join(destination, release)
@ -79,13 +67,6 @@ result_file = "#{package_name}-build.assert"
sig_file = "#{result_file}.sig"
current_manifest = nil
if @options[:compareto]
# Load a specific 'golden' manifest to compare to
compareto = @options[:compareto]
result_path = sanitize_path(File.join(release_path, compareto, result_file), "result path")
result = YAML.load_file(result_path)
current_manifest = result['out_manifest']
end
did_fail = false
@ -117,8 +98,7 @@ Dir.foreach(release_path) do |signer_dir|
puts line
end
end
puts "#{bold[1]}#{signer_dir}: BAD SIGNATURE#{bold[0]}"
puts
puts "#{signer_dir}: BAD SIGNATURE"
did_fail = true
elsif current_manifest and (result['out_manifest'] != current_manifest or result['release'] != release or result['name'] != package_name)
out.each_line do |line|
@ -132,18 +112,7 @@ Dir.foreach(release_path) do |signer_dir|
puts line
end
end
puts "#{bold[1]}#{signer_dir}: MISMATCH#{bold[0]}"
puts
if verbose
lines1 = current_manifest.each_line
lines2 = result['out_manifest'].each_line
lines1.zip(lines2) do |line|
if line[0] != line[1]
puts "- "+line[0]
puts "+ "+line[1]
end
end
end
puts "#{signer_dir}: MISMATCH"
did_fail = true
else
out.each_line do |line|
@ -157,13 +126,9 @@ Dir.foreach(release_path) do |signer_dir|
puts line
end
end
puts "#{bold[1]}#{signer_dir}: OK#{bold[0]}"
puts
end
if !current_manifest
# take first manifest as 'current' to compare against
current_manifest = result['out_manifest']
puts "#{signer_dir}: OK"
end
current_manifest = result['out_manifest']
end
exit 1 if did_fail

@ -1,45 +1,21 @@
#!/bin/sh
set -e
DISTRO=ubuntu
SUITE=xenial
SUITE=lucid
ARCH=amd64
MIRROR_BASE=http://${MIRROR_HOST:-127.0.0.1}:3142
MIRROR=http://${MIRROR_HOST:-127.0.0.1}:3142/archive.ubuntu.com/ubuntu
SECURITY_MIRROR=http://${MIRROR_HOST:-127.0.0.1}:3142/security.ubuntu.com/ubuntu
LXC=0
VBOX=0
usage() {
echo "Usage: ${0##*/} [OPTION]..."
echo "Make a base client."
echo
cat << EOF
--help display this help and exit
--distro D build distro D (e.g. debian) instead of ubuntu
--suite U build suite U instead of xenial
--arch A build architecture A (e.g. i386) instead of amd64
--lxc use lxc instead of kvm
--vbox use VirtualBox instead of kvm
The MIRROR_HOST environment variable can be used to change the
apt-cacher host. It should be something that both the host and the
target VM can reach. It may be set to 127.0.0.1, in which case it will be
changed to 10.0.2.2 on the guest (or GITIAN_HOST_IP if it is defined)
10.0.2.2 is the host IP as visible from the guest under qemu networking.
The DEBOOTSTRAP_DIR (but also GITIAN_SUDO_USE_DEBOOTSTRAP_DIR, see below!)
environment variable can be set to select a directory
that will contain data like in "/usr/share/debootstrap/". This allows user to
make a copy of this files to some local dir and modify them locally:
e.g. set env variable "DEBOOTSTRAP_DIR=./mydeboot/", then copy or link
system's version of files there, and modify them there
(e.g. copy your debootstrap-script file "xenial" to "./mydeboot/scripts/").
Set env GITIAN_SUDO_USE_DEBOOTSTRAP_DIR="yes" to allow sudo for debootstrap
to use flags like --preserve-env that are required for DEBOOTSTRAP_DIR to work.
It must be equal string "yes".
This is done as separate variable to make it clear that we modify sudo
behaviour here regarding security (though anyway env is cleared with
whitelist so should be perfectly safe).
--help display this help and exit
--suite U build suite U instead of lucid
--arch A build architecture A (e.g. i386) instead of amd64
--lxc use lxc instead of kvm
EOF
}
@ -50,10 +26,6 @@ if [ $# != 0 ] ; then
usage
exit 0
;;
--distro|-d)
DISTRO="$2"
shift 2
;;
--suite|-s)
SUITE="$2"
shift 2
@ -66,10 +38,6 @@ if [ $# != 0 ] ; then
LXC=1
shift 1
;;
--vbox)
VBOX=1
shift 1
;;
--*)
echo "unrecognized option $1"
exit 1
@ -81,20 +49,10 @@ if [ $# != 0 ] ; then
done
fi
if [ $DISTRO = "ubuntu" ]; then
MIRROR=$MIRROR_BASE/archive.ubuntu.com/ubuntu
SECURITY_MIRROR=$MIRROR_BASE/security.ubuntu.com/ubuntu
components=main,universe
elif [ $DISTRO = "debian" ]; then
MIRROR=$MIRROR_BASE/ftp.debian.org/debian
SECURITY_MIRROR=$MIRROR_BASE/security.debian.org/
components=main,contrib
fi
mkdir -p var
if [ ! -e var/id_rsa ]; then
ssh-keygen -t rsa -f var/id_rsa -N ""
if [ ! -e var/id_dsa ]; then
ssh-keygen -t dsa -f var/id_dsa -N ""
fi
OUT=base-$SUITE-$ARCH
@ -104,128 +62,30 @@ if [ $ARCH = "amd64" -a $SUITE = "hardy" ]; then
FLAVOUR=server
fi
if [ $DISTRO = "debian" -a $ARCH = "amd64" ]; then
FLAVOUR=amd64
elif [ $DISTRO = "debian" -a $ARCH = "i386" -a \($SUITE = "squeeze" -o $SUITE = "lenny" -o $SUITE = "etch" -o $SUITE = "sarge" -o $SUITE = "woody" -o $SUITE = "potato" -o $SUITE = "slink" -o $SUITE = "hamm" -o $SUITE = "bo" -o $SUITE = "rex" -o $SUITE = "buzz"\) ]; then
FLAVOUR=686
elif [ $DISTRO = "debian" ]; then
FLAVOUR=686-pae
fi
LOCALE_PKG=language-pack-en
if [ $DISTRO = "debian" ]; then
LOCALE_PKG=locales
fi
addpkg=pciutils,build-essential,git-core,subversion,$LOCALE_PKG,wget,lsb-release
if [ $DISTRO = "ubuntu" ]; then
# Need comma at end to work around an issue with apt for Debian <= Wheezy regarding empty strings
#
# If we left the comma down below when adding KERNEL_PKG to addpkg, the fact that KERNEL_PKG is undefined
# if DISTRO is debian would result in two commas in a row (,,), which is interpreted by apt-get as the
# package with the name empty string (""). This triggers a bug with apt versions < 1.0.3. So by adding the
# comma to the end of KERNEL_PKG, we are including that comma if the distro is ubuntu (and therefore we do
# have a kernel package that needs to be installed). If KERNEL_PKG is not set (i.e. we have Debian as the
# distro), then we don't add that extra comma and therefore, we don't end up with two commas in a row.
#
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=744940
# http://anonscm.debian.org/cgit/apt/apt.git/commit/?h=1.0.3&id=d99854cac4065bc7b337815fb2116269d58dab73
KERNEL_PKG=linux-image-generic,
fi
GRUB_PKG=grub
if [ $DISTRO = "ubuntu" ]; then
GRUB_PKG=grub-pc
fi
if [ $LXC = "1" ]; then
addpkg=$addpkg,lxc
if [ $DISTRO = "debian" ]; then
addpkg=$addpkg,sudo
fi
else
# Lack of comma after KERNEL_PKG is not a typo
addpkg=$addpkg,${KERNEL_PKG}${GRUB_PKG},openssh-server
fi
addpkg=openssh-server,pciutils,build-essential,git-core,subversion
# Remove cron to work around vmbuilder issue when umounting /dev on target
removepkg=cron
if [ $VBOX = "1" ]; then
NAME="$SUITE-$ARCH"
if ! vagrant status | grep "$NAME" | grep "not created" > /dev/null; then
echo "Vagrant machine "$NAME" already exists, please remove it first (vagrant destroy "$NAME")"
exit 1
fi
vagrant up "$NAME"
vagrant ssh "$NAME" -c "sudo mkdir -p /root/.ssh && sudo chmod 700 /root/.ssh"
vagrant ssh "$NAME" -c "sudo sh -c 'cat >> /root/.ssh/authorized_keys'" < var/id_rsa.pub
vagrant ssh "$NAME" -c "sudo -u $DISTRO mkdir -p /home/$DISTRO/.ssh && sudo -u $DISTRO chmod 700 /home/$DISTRO/.ssh"
vagrant ssh "$NAME" -c "sudo sh -c 'cat >> /home/$DISTRO/.ssh/authorized_keys'" < var/id_rsa.pub
VBoxManage snapshot "Gitian-$NAME" take "Gitian-Clean"
vagrant suspend "$NAME"
exit 0
if [ -e $OUT.qcow2 ]; then
echo $OUT.qcow2 already exists, please remove it first
exit 1
fi
if [ $LXC = "1" ]; then
if [ -e $OUT ]; then
echo $OUT already exists, please remove it first
exit 1
fi
sudo rm -rf $OUT-bootstrap
# Need universe for lxc in lucid
rm -rf $OUT
sudo vmbuilder kvm ubuntu --arch=$ARCH --suite=$SUITE --addpkg=$addpkg --removepkg=$removepkg --ssh-key=var/id_dsa.pub --ssh-user-key=var/id_dsa.pub --mirror=$MIRROR --security-mirror=$SECURITY_MIRROR --dest=$OUT --flavour=$FLAVOUR --firstboot=`pwd`/target-bin/bootstrap-fixup
mv $OUT/*.qcow2 $OUT.qcow2
rm -rf $OUT
unset preserve_env
if [ "$GITIAN_SUDO_USE_DEBOOTSTRAP_DIR" = "yes" ]; then
echo "sudo will preserve (some) env flags"
preserve_env=yes # if you would want to set false then unset this variable
fi
env -i LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 DEBOOTSTRAP_DIR="$DEBOOTSTRAP_DIR" sudo ${preserve_env+--preserve-env} debootstrap --arch=$ARCH --include=$addpkg --exclude=$removepkg --components=$components $SUITE $OUT-bootstrap $MIRROR
# Fix lxc issue
if [ -f $OUT-bootstrap/usr/lib/lxc/lxc-init ]
then
sudo cp $OUT-bootstrap/usr/lib/lxc/lxc-init $OUT-bootstrap/usr/sbin/init.lxc
else
if [ $ARCH = "amd64" ]
then
if [ -f $OUT-bootstrap/usr/lib/x86_64-linux-gnu/lxc/lxc-init ]
then
sudo cp $OUT-bootstrap/usr/lib/x86_64-linux-gnu/lxc/lxc-init $OUT-bootstrap/usr/sbin/init.lxc
fi
else
if [ -f $OUT-bootstrap/usr/lib/i386-linux-gnu/lxc/lxc-init ]
then
sudo cp $OUT-bootstrap/usr/lib/i386-linux-gnu/lxc/lxc-init $OUT-bootstrap/usr/sbin/init.lxc
fi
fi
fi
dd if=/dev/zero of=$OUT-lxc bs=1M count=1 seek=10240
/sbin/mkfs.ext4 -F $OUT-lxc
t=`mktemp -d gitian.XXXXXXXX`
sudo mount $OUT-lxc $t
sudo cp -a $OUT-bootstrap/* $t
sudo umount $t
rmdir $t
sudo rm -rf $OUT-bootstrap
mv $OUT-lxc $OUT
# bootstrap-fixup is done in libexec/make-clean-vm
else
if [ -e $OUT.qcow2 ]; then
echo $OUT.qcow2 already exists, please remove it first
exit 1
fi
libexec/config-bootstrap-fixup
rm -rf $OUT
env -i LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 sudo vmbuilder kvm $DISTRO --rootsize 10240 --arch=$ARCH --suite=$SUITE --addpkg=$addpkg --removepkg=$removepkg --ssh-key=var/id_rsa.pub --ssh-user-key=var/id_rsa.pub --mirror=$MIRROR --security-mirror=$SECURITY_MIRROR --dest=$OUT --flavour=$FLAVOUR --firstboot=`pwd`/target-bin/bootstrap-fixup
mv $OUT/*.qcow2 $OUT.qcow2
rm -rf $OUT
# bootstrap-fixup is done on first boot
if [ $LXC = "1" ]; then
#sudo debootstrap --include=$addpkg --arch=$ARCH $SUITE $OUT-root $MIRROR
echo Extracting partition for lxc
qemu-img convert $OUT.qcow2 $OUT.raw
loop=`sudo kpartx -av $OUT.raw|sed -n '/loop.p1/{s/.*loop\(.\)p1.*/\1/;p}'`
sudo cp --sparse=always /dev/mapper/loop${loop}p1 $OUT
sudo chown $USER $OUT
sudo kpartx -d /dev/loop$loop
rm -f $OUT.raw
# bootstrap-fixup is done in libexec/make-clean-vm
fi

@ -1,9 +0,0 @@
Repository Tools
---------------------
### [Developer tools](/contrib/devtools) ###
Specific tools for developers working on this repository.
Contains the script `github-merge.py` for merging github pull requests securely and signing them using GPG.
### [Verify-Commits](/contrib/verify-commits) ###
Tool to verify that every merge commit was signed by a developer using the above `github-merge.py` script.

@ -1,37 +0,0 @@
Contents
========
This directory contains tools for developers working on this repository.
github-merge.py
===============
A small script to automate merging pull-requests securely and sign them with GPG.
For example:
./github-merge.py 3077
(in any git repository) will help you merge pull request #3077 for the
devrandom/gitian-builder repository.
What it does:
* Fetch master and the pull request.
* Locally construct a merge commit.
* Show the diff that merge results in.
* Ask you to verify the resulting source tree (so you can do a make
check or whatever).
* Ask you whether to GPG sign the merge commit.
* Ask you whether to push the result upstream.
This means that there are no potential race conditions (where a
pullreq gets updated while you're reviewing it, but before you click
merge), and when using GPG signatures, that even a compromised github
couldn't mess with the sources.
Setup
---------
Configuring the github-merge tool for this repository is done in the following way:
git config githubmerge.repository devrandom/gitian-builder
git config githubmerge.testcmd "make -j4 check" (adapt to whatever you want to use for testing)
git config --global user.signingkey mykeyid (if you want to GPG sign)

@ -1,251 +0,0 @@
#!/usr/bin/env python3
# Copyright (c) 2016 Bitcoin Core Developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
# This script will locally construct a merge commit for a pull request on a
# github repository, inspect it, sign it and optionally push it.
# The following temporary branches are created/overwritten and deleted:
# * pull/$PULL/base (the current master we're merging onto)
# * pull/$PULL/head (the current state of the remote pull request)
# * pull/$PULL/merge (github's merge)
# * pull/$PULL/local-merge (our merge)
# In case of a clean merge that is accepted by the user, the local branch with
# name $BRANCH is overwritten with the merged result, and optionally pushed.
from __future__ import division,print_function,unicode_literals
import os,sys
from sys import stdin,stdout,stderr
import argparse
import subprocess
import json,codecs
try:
from urllib.request import Request,urlopen
except:
from urllib2 import Request,urlopen
# External tools (can be overridden using environment)
GIT = os.getenv('GIT','git')
BASH = os.getenv('BASH','bash')
# OS specific configuration for terminal attributes
ATTR_RESET = ''
ATTR_PR = ''
COMMIT_FORMAT = '%h %s (%an)%d'
if os.name == 'posix': # if posix, assume we can use basic terminal escapes
ATTR_RESET = '\033[0m'
ATTR_PR = '\033[1;36m'
COMMIT_FORMAT = '%C(bold blue)%h%Creset %s %C(cyan)(%an)%Creset%C(green)%d%Creset'
def git_config_get(option, default=None):
'''
Get named configuration option from git repository.
'''
try:
return subprocess.check_output([GIT,'config','--get',option]).rstrip().decode('utf-8')
except subprocess.CalledProcessError as e:
return default
def retrieve_pr_info(repo,pull):
'''
Retrieve pull request information from github.
Return None if no title can be found, or an error happens.
'''
try:
req = Request("https://api.github.com/repos/"+repo+"/pulls/"+pull)
result = urlopen(req)
reader = codecs.getreader('utf-8')
obj = json.load(reader(result))
return obj
except Exception as e:
print('Warning: unable to retrieve pull information from github: %s' % e)
return None
def ask_prompt(text):
print(text,end=" ",file=stderr)
stderr.flush()
reply = stdin.readline().rstrip()
print("",file=stderr)
return reply
def parse_arguments():
epilog = '''
In addition, you can set the following git configuration variables:
githubmerge.repository (mandatory),
user.signingkey (mandatory),
githubmerge.host (default: git@github.com),
githubmerge.branch (no default),
githubmerge.testcmd (default: none).
'''
parser = argparse.ArgumentParser(description='Utility to merge, sign and push github pull requests',
epilog=epilog)
parser.add_argument('pull', metavar='PULL', type=int, nargs=1,
help='Pull request ID to merge')
parser.add_argument('branch', metavar='BRANCH', type=str, nargs='?',
default=None, help='Branch to merge against (default: githubmerge.branch setting, or base branch for pull, or \'master\')')
return parser.parse_args()
def main():
# Extract settings from git repo
repo = git_config_get('githubmerge.repository')
host = git_config_get('githubmerge.host','git@github.com')
opt_branch = git_config_get('githubmerge.branch',None)
testcmd = git_config_get('githubmerge.testcmd')
signingkey = git_config_get('user.signingkey')
if repo is None:
print("ERROR: No repository configured. Use this command to set:", file=stderr)
print("git config githubmerge.repository <owner>/<repo>", file=stderr)
exit(1)
if signingkey is None:
print("ERROR: No GPG signing key set. Set one using:",file=stderr)
print("git config --global user.signingkey <key>",file=stderr)
exit(1)
host_repo = host+":"+repo # shortcut for push/pull target
# Extract settings from command line
args = parse_arguments()
pull = str(args.pull[0])
# Receive pull information from github
info = retrieve_pr_info(repo,pull)
if info is None:
exit(1)
title = info['title']
# precedence order for destination branch argument:
# - command line argument
# - githubmerge.branch setting
# - base branch for pull (as retrieved from github)
# - 'master'
branch = args.branch or opt_branch or info['base']['ref'] or 'master'
# Initialize source branches
head_branch = 'pull/'+pull+'/head'
base_branch = 'pull/'+pull+'/base'
merge_branch = 'pull/'+pull+'/merge'
local_merge_branch = 'pull/'+pull+'/local-merge'
devnull = open(os.devnull,'w')
try:
subprocess.check_call([GIT,'checkout','-q',branch])
except subprocess.CalledProcessError as e:
print("ERROR: Cannot check out branch %s." % (branch), file=stderr)
exit(3)
try:
subprocess.check_call([GIT,'fetch','-q',host_repo,'+refs/pull/'+pull+'/*:refs/heads/pull/'+pull+'/*'])
except subprocess.CalledProcessError as e:
print("ERROR: Cannot find pull request #%s on %s." % (pull,host_repo), file=stderr)
exit(3)
try:
subprocess.check_call([GIT,'log','-q','-1','refs/heads/'+head_branch], stdout=devnull, stderr=stdout)
except subprocess.CalledProcessError as e:
print("ERROR: Cannot find head of pull request #%s on %s." % (pull,host_repo), file=stderr)
exit(3)
try:
subprocess.check_call([GIT,'log','-q','-1','refs/heads/'+merge_branch], stdout=devnull, stderr=stdout)
except subprocess.CalledProcessError as e:
print("ERROR: Cannot find merge of pull request #%s on %s." % (pull,host_repo), file=stderr)
exit(3)
try:
subprocess.check_call([GIT,'fetch','-q',host_repo,'+refs/heads/'+branch+':refs/heads/'+base_branch])
except subprocess.CalledProcessError as e:
print("ERROR: Cannot find branch %s on %s." % (branch,host_repo), file=stderr)
exit(3)
subprocess.check_call([GIT,'checkout','-q',base_branch])
subprocess.call([GIT,'branch','-q','-D',local_merge_branch], stderr=devnull)
subprocess.check_call([GIT,'checkout','-q','-b',local_merge_branch])
try:
# Create unsigned merge commit.
if title:
firstline = 'Merge #%s: %s' % (pull,title)
else:
firstline = 'Merge #%s' % (pull,)
message = firstline + '\n\n'
message += subprocess.check_output([GIT,'log','--no-merges','--topo-order','--pretty=format:%h %s (%an)',base_branch+'..'+head_branch]).decode('utf-8')
try:
subprocess.check_call([GIT,'merge','-q','--commit','--no-edit','--no-ff','-m',message.encode('utf-8'),head_branch])
except subprocess.CalledProcessError as e:
print("ERROR: Cannot be merged cleanly.",file=stderr)
subprocess.check_call([GIT,'merge','--abort'])
exit(4)
logmsg = subprocess.check_output([GIT,'log','--pretty=format:%s','-n','1']).decode('utf-8')
if logmsg.rstrip() != firstline.rstrip():
print("ERROR: Creating merge failed (already merged?).",file=stderr)
exit(4)
print('%s#%s%s %s %sinto %s%s' % (ATTR_RESET+ATTR_PR,pull,ATTR_RESET,title,ATTR_RESET+ATTR_PR,branch,ATTR_RESET))
subprocess.check_call([GIT,'log','--graph','--topo-order','--pretty=format:'+COMMIT_FORMAT,base_branch+'..'+head_branch])
print()
# Run test command if configured.
if testcmd:
# Go up to the repository's root.
toplevel = subprocess.check_output([GIT,'rev-parse','--show-toplevel']).strip()
os.chdir(toplevel)
if subprocess.call(testcmd,shell=True):
print("ERROR: Running %s failed." % testcmd,file=stderr)
exit(5)
# Show the created merge.
diff = subprocess.check_output([GIT,'diff',merge_branch+'..'+local_merge_branch])
subprocess.check_call([GIT,'diff',base_branch+'..'+local_merge_branch])
if diff:
print("WARNING: merge differs from github!",file=stderr)
reply = ask_prompt("Type 'ignore' to continue.")
if reply.lower() == 'ignore':
print("Difference with github ignored.",file=stderr)
else:
exit(6)
reply = ask_prompt("Press 'd' to accept the diff.")
if reply.lower() == 'd':
print("Diff accepted.",file=stderr)
else:
print("ERROR: Diff rejected.",file=stderr)
exit(6)
else:
# Verify the result manually.
print("Dropping you on a shell so you can try building/testing the merged source.",file=stderr)
print("Run 'git diff HEAD~' to show the changes being merged.",file=stderr)
print("Type 'exit' when done.",file=stderr)
if os.path.isfile('/etc/debian_version'): # Show pull number on Debian default prompt
os.putenv('debian_chroot',pull)
subprocess.call([BASH,'-i'])
reply = ask_prompt("Type 'm' to accept the merge.")
if reply.lower() == 'm':
print("Merge accepted.",file=stderr)
else:
print("ERROR: Merge rejected.",file=stderr)
exit(7)
# Sign the merge commit.
reply = ask_prompt("Type 's' to sign off on the merge.")
if reply == 's':
try:
subprocess.check_call([GIT,'commit','-q','--gpg-sign','--amend','--no-edit'])
except subprocess.CalledProcessError as e:
print("Error signing, exiting.",file=stderr)
exit(1)
else:
print("Not signing off on merge, exiting.",file=stderr)
exit(1)
# Put the result in branch.
subprocess.check_call([GIT,'checkout','-q',branch])
subprocess.check_call([GIT,'reset','-q','--hard',local_merge_branch])
finally:
# Clean up temporary branches.
subprocess.call([GIT,'checkout','-q',branch])
subprocess.call([GIT,'branch','-q','-D',head_branch],stderr=devnull)
subprocess.call([GIT,'branch','-q','-D',base_branch],stderr=devnull)
subprocess.call([GIT,'branch','-q','-D',merge_branch],stderr=devnull)
subprocess.call([GIT,'branch','-q','-D',local_merge_branch],stderr=devnull)
# Push the result.
reply = ask_prompt("Type 'push' to push the result to %s, branch %s." % (host_repo,branch))
if reply.lower() == 'push':
subprocess.check_call([GIT,'push',host_repo,'refs/heads/'+branch])
if __name__ == '__main__':
main()

@ -1,26 +0,0 @@
Tooling for verification of PGP signed commits
----------------------------------------------
This is an incomplete work in progress, but currently includes a pre-push hook
script (`pre-push-hook.sh`) for maintainers to ensure that their own commits
are PGP signed (nearly always merge commits), as well as a script to verify
commits against a trusted keys list.
Using verify-commits.sh safely
------------------------------
Remember that you can't use an untrusted script to verify itself. This means
that checking out code, then running `verify-commits.sh` against `HEAD` is
_not_ safe, because the version of `verify-commits.sh` that you just ran could
be backdoored. Instead, you need to use a trusted version of verify-commits
prior to checkout to make sure you're checking out only code signed by trusted
keys:
git fetch origin && \
./contrib/verify-commits/verify-commits.sh origin/master && \
git checkout origin/master
Note that the above isn't a good UI/UX yet, and needs significant improvements
to make it more convenient and reduce the chance of errors; pull-reqs
improving this process would be much appreciated.

@ -1,37 +0,0 @@
#!/bin/sh
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
INPUT=$(cat /dev/stdin)
VALID=false
REVSIG=false
IFS='
'
for LINE in $(echo "$INPUT" | gpg --trust-model always "$@" 2>/dev/null); do
case "$LINE" in
"[GNUPG:] VALIDSIG "*)
while read KEY; do
case "$LINE" in "[GNUPG:] VALIDSIG $KEY "*) VALID=true;; esac
done < ./contrib/verify-commits/trusted-keys
;;
"[GNUPG:] REVKEYSIG "*)
[ "$BITCOIN_VERIFY_COMMITS_ALLOW_REVSIG" != 1 ] && exit 1
while read KEY; do
case "$LINE" in "[GNUPG:] REVKEYSIG ${KEY#????????????????????????} "*)
REVSIG=true
GOODREVSIG="[GNUPG:] GOODSIG ${KEY#????????????????????????} "
esac
done < ./contrib/verify-commits/trusted-keys
;;
esac
done
if ! $VALID; then
exit 1
fi
if $VALID && $REVSIG; then
echo "$INPUT" | gpg --trust-model always "$@" | grep "\[GNUPG:\] \(NEWSIG\|SIG_ID\|VALIDSIG\)" 2>/dev/null
echo "$GOODREVSIG"
else
echo "$INPUT" | gpg --trust-model always "$@" 2>/dev/null
fi

@ -1,20 +0,0 @@
#!/bin/bash
# Copyright (c) 2014-2015 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
if ! [[ "$2" =~ ^(git@)?(www.)?github.com(:|/)devrandom/gitian-builder(.git)?$ ]]; then
exit 0
fi
while read LINE; do
set -- A $LINE
if [ "$4" != "refs/heads/master" ]; then
continue
fi
if ! ./contrib/verify-commits/verify-commits.sh $3 > /dev/null 2>&1; then
echo "ERROR: A commit is not signed, can't push"
./contrib/verify-commits/verify-commits.sh
exit 1
fi
done < /dev/stdin

@ -1 +0,0 @@
bb4f92f6cbde6ee78e39ae35b0934da3b55e154d

@ -1 +0,0 @@
498FA3769A88C4AD1B187A7428EB4B0FB7AAF6B0

@ -1,62 +0,0 @@
#!/bin/sh
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
# Not technically POSIX-compliant due to use of "local", but almost every
# shell anyone uses today supports it, so its probably fine
DIR=$(dirname "$0")
[ "/${DIR#/}" != "$DIR" ] && DIR=$(dirname "$(pwd)/$0")
VERIFIED_ROOT=$(cat "${DIR}/trusted-git-root")
REVSIG_ALLOWED=$(cat "${DIR}/allow-revsig-commits")
HAVE_FAILED=false
IS_SIGNED () {
if [ $1 = $VERIFIED_ROOT ]; then
return 0;
fi
if [ "${REVSIG_ALLOWED#*$1}" != "$REVSIG_ALLOWED" ]; then
export BITCOIN_VERIFY_COMMITS_ALLOW_REVSIG=1
else
export BITCOIN_VERIFY_COMMITS_ALLOW_REVSIG=0
fi
if ! git -c "gpg.program=${DIR}/gpg.sh" verify-commit $1 > /dev/null 2>&1; then
return 1;
fi
local PARENTS
PARENTS=$(git show -s --format=format:%P $1)
for PARENT in $PARENTS; do
if IS_SIGNED $PARENT > /dev/null; then
return 0;
fi
done
if ! "$HAVE_FAILED"; then
echo "No parent of $1 was signed with a trusted key!" > /dev/stderr
echo "Parents are:" > /dev/stderr
for PARENT in $PARENTS; do
git show -s $PARENT > /dev/stderr
done
HAVE_FAILED=true
fi
return 1;
}
if [ x"$1" = "x" ]; then
TEST_COMMIT="HEAD"
else
TEST_COMMIT="$1"
fi
IS_SIGNED "$TEST_COMMIT"
RES=$?
if [ "$RES" = 1 ]; then
if ! "$HAVE_FAILED"; then
echo "$TEST_COMMIT was not signed with a trusted key!"
fi
else
echo "There is a valid path from $TEST_COMMIT to $VERIFIED_ROOT where all commits are signed!"
fi
exit $RES

@ -1,27 +0,0 @@
Gitian includes two caches where build-assets may be saved for use with
subsequent builds. These caches are only enabled if the "enable_cache" key
is enabled in the build descriptor.
Common cache:
All descriptors share this cache. It can be useful for storing fetched sources,
sharing build assets between descriptors, etc.
Per-descriptor cache
Files installed to this cache can only be seen by this descriptor. Use this to
store assets created as part of the build process, to avoid having to rebuild
them in future builds.
If caching is enabled, GBUILD_CACHE_ENABLED will be set to 1 in the build
script. In addition, GBUILD_PACKAGE_CACHE and GBUILD_COMMON_CACHE will be set
to their respective paths. GBUILD_PACKAGE_CACHE contains the descriptor's
"name" key as a means of separating caches. To add or update the cached files,
copy them to these paths.
Before each build, all files and folders in the cache directories will be
transferred to the VM. After each successful build, the caches will be
transferred back to the builder (overwriting existing files as necessary).
It is entirely up to the user and the descriptors to verify that cached files
are actually suitable for re-use. Overwriting existing cached files is _highly_
discouraged, as that would likely lead to non-deterministic results. Unique
filenames should always be used.

@ -0,0 +1,39 @@
# The Problem
gcc sometimes generates slightly different code with the same semantics.
## Optimizations
The following optimizer flags reduce non-determinism when compiling wxWidgets:
-fno-tree-loop-optimize
-fno-trapping-math
-fno-tree-reassoc
## Left Over
Even with the above flags, the compiler still generates this difference in one out of 100 builds of wxWidgets:
monolib_property.o: elf64-elf_x86_64
aef7: 00
aef8: 45 31 f6 xor %r14d,%r14d
aefb: 48 8d 84 24 50 06 00 00 lea 0x650(%rsp),%rax
- af03: c6 44 24 67 00 movb $0x0,0x67(%rsp)
- af08: 48 83 c2 10 add $0x10,%rdx
- af0c: 48 83 c1 10 add $0x10,%rcx
- af10: 48 81 7c 24 08 ff ff ff cmpq $0xffffff,0x8(%rsp)
- af18: 00
- af19: c6 44 24 47 00 movb $0x0,0x47(%rsp)
- af1e: c7 44 24 24 00 00 00 00 movl $0x0,0x24(%rsp)
+ af03: c7 44 24 24 00 00 00 00 movl $0x0,0x24(%rsp)
+ af0b: 48 83 c2 10 add $0x10,%rdx
+ af0f: 48 83 c1 10 add $0x10,%rcx
+ af13: 48 81 7c 24 08 ff ff ff cmpq $0xffffff,0x8(%rsp)
+ af1b: 00
+ af1c: c6 44 24 47 00 movb $0x0,0x47(%rsp)
+ af21: c6 44 24 67 00 movb $0x0,0x67(%rsp)
af26: 4c 8d bc 24 28 03 00 00 lea 0x328(%rsp),%r15
af2e: 48 89 44 24 10 mov %rax,0x10(%rsp)
af33: 48 89 54 24 78 mov %rdx,0x78(%rsp)

@ -23,15 +23,11 @@ lxc.cgroup.devices.allow = c 254:0 rwm
lxc.mount.entry=proc ROOTFS/proc proc nodev,noexec,nosuid 0 0
lxc.mount.entry=sysfs ROOTFS/sys sysfs defaults 0 0
# Container with network virtualized using a pre-configured bridge named br0 and
# veth pair virtual network devices
# On the host, run: ifconfig br0 up 10.0.2.2
# Alternatively, you can use another IP range for the bridge interface, in this case set
# the environment variables GITIAN_HOST_IP and LXC_GUEST_IP appropriately.
# Container with network virtualized using a pre-configured bridge named lxcbr0
# and veth pair virtual network devices.
# On the host, run (lxc might already have done this):
# ifconfig lxcbr0 up 10.0.3.1
lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = GUESTLINK
lxc.network.ipv4 = GUESTIP/24
lxc.network.ipv4.gateway = auto
lxc.utsname = gitian
lxc.network.link = lxcbr0
lxc.network.ipv4 = 10.0.3.5/24

@ -1,15 +0,0 @@
#!/bin/bash
wd=`pwd`
# Default host IP is 10.0.2.2
if [ -z "$GITIAN_HOST_IP" ]; then
GITIAN_HOST_IP=10.0.2.2
fi
# Default to host IP if the MIRROR_HOST is not set, or set to 127.0.0.1
if [ -z "$MIRROR_HOST" ] || [ "$MIRROR_HOST" == "127.0.0.1" ]; then
MIRROR_HOST=$GITIAN_HOST_IP
fi
sed "s;HOSTIP;$MIRROR_HOST;g" < target-bin/bootstrap-fixup.in > target-bin/bootstrap-fixup

@ -1,13 +1,13 @@
#!/bin/bash
wd=`pwd`
if [ -z "$LXC_GUEST_IP" ]; then
LXC_GUEST_IP=10.0.2.5
fi
set -e
if [ -z "$LXC_BRIDGE" ]; then
LXC_BRIDGE=br0
if ifconfig lxcbr0 > /dev/null 2>&1; then
true
else
echo "Must configure lxcbr0 - check the README"
exit 1
fi
sed "s;ROOTFS;$wd/target-$LXC_SUITE-$LXC_ARCH;;s;ARCH;$LXC_ARCH;g;;s;GUESTIP;$LXC_GUEST_IP;g;s;GUESTLINK;$LXC_BRIDGE;g" < etc/lxc.config.in > var/lxc.config
wd=`pwd`
sed "s;ROOTFS;$wd/target-$LXC_SUITE-$LXC_ARCH;;s;ARCH;$LXC_ARCH;g" < etc/lxc.config.in > var/lxc.config

@ -2,8 +2,8 @@
. gconfig
TUSER=${DISTRO:-ubuntu}
QUIET_FLAG="-vP"
TUSER=ubuntu
QUIET_FLAG=
usage() {
echo "Usage: ${0##*/} [OPTION]... <command>"
@ -47,9 +47,8 @@ if [ $# = 0 ] ; then
fi
if [ -z "$USE_LXC" ]; then
src="${1%/}" # remove trailing / which triggers special rsync behaviour
rsync --checksum -a $QUIET_FLAG -e "ssh -oConnectTimeout=30 -oNoHostAuthenticationForLocalhost=yes -i ${GITIAN_BASE:-.}/var/id_rsa -p $VM_SSH_PORT" "$TUSER@localhost:${src}" "$2"
scp $QUIET_FLAG -oConnectTimeout=5 -oNoHostAuthenticationForLocalhost=yes -i ${GITIAN_BASE:-.}/var/id_dsa -P $VM_SSH_PORT -r $TUSER@localhost:$1 $2
else
config-lxc
sudo $LXC_EXECUTE -n gitian -f var/lxc.config -- sudo -i -u $TUSER tar -C `dirname "$1"` -cf - `basename "$1"` | tar -C "$2" -xf -
sudo lxc-start -n gitian -f var/lxc.config -- sudo -i -u $TUSER tar -cf - "$1" | tar -C "$2" -xkf -
fi

@ -2,8 +2,8 @@
. gconfig
TUSER=${DISTRO:-ubuntu}
QUIET_FLAG="-vP"
TUSER=ubuntu
QUIET_FLAG=
usage() {
echo "Usage: ${0##*/} [OPTION]... <command>"
@ -47,9 +47,8 @@ if [ $# = 0 ] ; then
fi
if [ -z "$USE_LXC" ]; then
src="${1%/}" # remove trailing / which triggers special rsync behaviour
rsync --checksum -a $QUIET_FLAG -e "ssh -oConnectTimeout=30 -oNoHostAuthenticationForLocalhost=yes -i ${GITIAN_BASE:-.}/var/id_rsa -p $VM_SSH_PORT" "${src}" "$TUSER@localhost:$2"
scp $QUIET_FLAG -r -oConnectTimeout=5 -oNoHostAuthenticationForLocalhost=yes -i ${GITIAN_BASE:-.}/var/id_dsa -P $VM_SSH_PORT $1 $TUSER@localhost:$2
else
config-lxc
tar -C `dirname "$1"` -cf - `basename "$1"` | sudo $LXC_EXECUTE -n gitian -f var/lxc.config -- sudo -i -u $TUSER tar -C "$2" -xf -
tar -C `dirname "$1"` -cf - `basename "$1"` | sudo lxc-start -n gitian -f var/lxc.config -- sudo -i -u $TUSER tar -C "$2" -xf -
fi

@ -1,11 +1 @@
VM_SSH_PORT=2223
if [ -n "$USE_LXC" ]; then
if [ -z "$LXC_EXECUTE" ]; then
ver=`lxc-start --version`
if dpkg --compare-versions $ver ge 1.0.0 ; then
LXC_EXECUTE=lxc-execute
else
LXC_EXECUTE=lxc-start
fi
fi
fi

@ -1,23 +1,16 @@
#!/bin/sh
set -e
SUITE=xenial
SUITE=lucid
ARCH=amd64
VMSW=KVM
if [ -n "$USE_LXC" ]; then
VMSW=LXC
elif [ -n "$USE_VBOX" ]; then
VMSW=VBOX
fi
usage() {
echo "Usage: ${0##*/} [OPTION]..."
echo "Make a clean copy of the base client."
echo
cat << EOF
--help display this help and exit
--suite U build suite U instead of xenial
--suite U build suite U instead of lucid
--arch A build architecture A (e.g. i386) instead of amd64
EOF
}
@ -48,22 +41,12 @@ if [ $# != 0 ] ; then
done
fi
export LXC_SUITE=$SUITE
export LXC_ARCH=$ARCH
BASE=base-$SUITE-$ARCH
OUT=target-$SUITE-$ARCH
case $VMSW in
KVM)
if [ -z "$USE_LXC" ]; then
qemu-img create -f qcow2 -o backing_file="$BASE.qcow2" "$OUT.qcow2"
;;
LXC)
cp -a --sparse=always $BASE $OUT
libexec/config-bootstrap-fixup
on-target -u root bash < target-bin/bootstrap-fixup
;;
VBOX)
VBoxManage snapshot "Gitian-${SUITE}-${ARCH}" restore "Gitian-Clean"
;;
esac
else
cp -a $BASE $OUT
on-target -u root /root/firstboot.sh
fi

@ -1,17 +1,18 @@
#!/bin/sh
set -e
. gconfig
TUSER=${DISTRO:-ubuntu}
TUSER=ubuntu
usage() {
echo "Usage: ${0##*/} [OPTION]... <command>"
echo "Run command on build target."
echo
cat << EOF
--help display this help and exit
--user|-u <username> run as <username> instead of ubuntu
--env|-e "NAME=VALUE ..." modify the environment
--help display this help and exit
--user=U run as U instead of ubuntu
EOF
}
@ -26,10 +27,6 @@ if [ $# != 0 ] ; then
TUSER="$2"
shift 2
;;
--env|-e)
ENV="$2"
shift 2
;;
--*)
echo "unrecognized option $1"
exit 1
@ -47,8 +44,12 @@ fi
#fi
if [ -z "$USE_LXC" ]; then
ssh -oConnectTimeout=30 -oNoHostAuthenticationForLocalhost=yes -i ${GITIAN_BASE:-.}/var/id_rsa -p $VM_SSH_PORT $TUSER@localhost $*
ssh -oConnectTimeout=5 -oNoHostAuthenticationForLocalhost=yes -i ${GITIAN_BASE:-.}/var/id_dsa -p $VM_SSH_PORT $TUSER@localhost $*
else
config-lxc
sudo $LXC_EXECUTE -n gitian -f var/lxc.config -- sudo -u $TUSER $ENV -i -- $*
if [ $TUSER = "root" ]; then
sudo lxc-start -n gitian -f var/lxc.config -- $*
else
sudo lxc-start -n gitian -f var/lxc.config -- sudo -i -u $TUSER $*
fi
fi

@ -5,33 +5,11 @@
ARCH=qemu$1
SUFFIX=$2
VMSW=KVM
if [ -n "$USE_LXC" ]; then
VMSW=LXC
elif [ -n "$USE_VBOX" ]; then
VMSW=VBOX
fi
case $VMSW in
KVM)
case $ARCH in
qemu32)
[ -n "$KVM" ] || KVM=qemu-system-i386
;;
qemu64)
[ -n "$KVM" ] || KVM=qemu-system-x86_64
;;
esac
$KVM -enable-kvm -m ${VMEM:-2000} -smp ${NPROCS:-2} -drive file=target-$SUFFIX.qcow2,cache=writeback,if=virtio -net nic,model=virtio -net user,hostfwd=tcp:127.0.0.1:$VM_SSH_PORT-:22 -vnc 127.0.0.1:16 > var/target.log 2>&1 &
if [ -z "$USE_LXC" ]; then
kvm -cpu $ARCH -m ${VMEM:-2000} -smp ${NPROCS:-2} -drive file=target-$SUFFIX.qcow2,cache=writeback -net nic,model=virtio -net user,hostfwd=tcp:127.0.0.1:$VM_SSH_PORT-:22 -vnc 127.0.0.1:16 > var/target.log 2>&1 &
echo $! > var/target.pid
wait
rm var/target.pid
;;
LXC)
else
true #sudo lxc-start -n gitian -c var/target.log -f lxc.config
;;
VBOX)
VBoxManage startvm "Gitian-${2}" # --type headless
echo "Gitian-${2}" > var/target.vmname
;;
esac
fi

@ -1,14 +1,6 @@
#!/bin/sh
VMSW=KVM
if [ -n "$USE_LXC" ]; then
VMSW=LXC
elif [ -n "$USE_VBOX" ]; then
VMSW=VBOX
fi
case $VMSW in
KVM)
if [ -z "$USE_LXC" ]; then
if [ ! -e var/target.pid ]; then exit; fi
on-target -u root halt
@ -21,13 +13,6 @@ case $VMSW in
echo Killing target since it did not shutdown within 10 seconds
kill `cat var/target.pid`
;;
LXC)
else
true
;;
VBOX)
if [ ! -e var/target.vmname ]; then exit; fi
VBoxManage controlvm `cat var/target.vmname` savestate
rm var/target.vmname
;;
esac
fi

@ -208,7 +208,6 @@ def get_assertions(gpg_path, temp_dir, unpack_dir, file_names):
elif sums[summed_file] != shasum:
print>>sys.stderr, "sha256sum mismatch on %s" %(summed_file)
error = True
else:
del to_check[summed_file]
if len(to_check) > 0 and quiet == 0:
print>>sys.stderr, "Some of the files were not checksummed:"

@ -0,0 +1,16 @@
#!/bin/sh
set -e
ip=`hostname --all-ip-addresses | cut -d ' ' -f1 | cut -d. -f1-3`
if [ $ip = "10.0.3" ]; then
# LXC
MIRROR_HOST_ON_GUEST=${MIRROR_HOST_ON_GUEST:-10.0.3.1}
else
# KVM
MIRROR_HOST_ON_GUEST=${MIRROR_HOST_ON_GUEST:-10.0.2.2}
fi
echo "deb http://$MIRROR_HOST_ON_GUEST:3142/archive.ubuntu.com/ubuntu lucid main universe" > $1/etc/apt/sources.list
echo "deb http://$MIRROR_HOST_ON_GUEST:3142/archive.ubuntu.com/ubuntu lucid-updates main universe" >> $1/etc/apt/sources.list

@ -1,40 +0,0 @@
#!/bin/sh
set -e
DISTRIB_NAME=`lsb_release -is`
DISTRIB_CODENAME=`lsb_release -cs`
if [ $DISTRIB_NAME = "Ubuntu" ]; then
echo "deb http://HOSTIP:3142/archive.ubuntu.com/ubuntu $DISTRIB_CODENAME main universe" > $1/etc/apt/sources.list
echo "deb http://HOSTIP:3142/security.ubuntu.com/ubuntu $DISTRIB_CODENAME-security main universe" >> $1/etc/apt/sources.list
echo "deb http://HOSTIP:3142/archive.ubuntu.com/ubuntu $DISTRIB_CODENAME-updates main universe" >> $1/etc/apt/sources.list
elif [ $DISTRIB_NAME = "Debian" ]; then
echo "deb http://HOSTIP:3142/ftp.debian.org/debian $DISTRIB_CODENAME main" > $1/etc/apt/sources.list
echo "deb http://HOSTIP:3142/security.debian.org/ $DISTRIB_CODENAME/updates main" >> $1/etc/apt/sources.list
echo "deb http://HOSTIP:3142/ftp.debian.org/debian $DISTRIB_CODENAME-updates main" >> $1/etc/apt/sources.list
# grub-legacy conflicts grub-pc dependencies
# No grub-legacy on Ubuntu, just on Debian
# Work around bcron-run conflict due to cron being removed
# Needed for KVM, but apparently errors out for LXC, so the true ignores the error
apt-get purge -y grub-legacy bcron-run &> /dev/null || true
fi
echo '127.0.1.1 gitian' >> /etc/hosts
# If LXC
if grep /lxc/gitian /proc/1/cgroup > /dev/null; then
adduser --disabled-password --gecos ${DISTRIB_NAME,,} --quiet ${DISTRIB_NAME,,} || true
apt-get remove -y rsyslog || true
dpkg-divert --local --rename --add /sbin/initctl
ln -sf /bin/true /sbin/initctl
dpkg-divert --local --rename --add /usr/bin/ischroot
ln -sf /bin/true /usr/bin/ischroot
# Prevent interaction with init during upgrades
dpkg-divert --local --rename --add /usr/sbin/policy-rc.d
echo 'exit 101' > /usr/sbin/policy-rc.d
chmod +x /usr/sbin/policy-rc.d
## These are superceded by the policy-rc.d fix above
# for pkg in lxc cgmanager udev plymouth dmsetup upstart; do
# echo $pkg hold | dpkg --set-selections || true
# done
fi

@ -6,8 +6,7 @@ set -e
cd /var/cache/apt/archives
# make sure all packages with installed versions are downloaded
# (except for held packages, which may not be available for download)
dpkg-query -W -f '${Status}\t${Package}=${Version}\n' | grep -v ^hold | cut -f2- | xargs -n 50 apt-get install -q --reinstall -y -d > /tmp/download.log
grep "cannot be downloaded" /tmp/download.log && { echo Could not download some packages, please run gbuild --upgrade 1>&2 ; exit 1 ; }
#apt-get clean
dpkg-query -W -f '${Package}\n' | xargs -n 50 apt-get install --reinstall -y -d > /dev/null
sha256sum *.deb | sort --key 2

@ -1,7 +1,6 @@
#!/bin/sh
rm -rf install out build cache
rm -rf install out build
mkdir build
mkdir out
mkdir install
mkdir -p cache/common

@ -1,15 +0,0 @@
#!/bin/sh
# Upgrade system
set -e
mkdir -p /var/cache/gitian
# remove obsolete grub, it causes package dependency issues
apt-get -q -y purge grub > /dev/null 2>&1 || true
# upgrade packages
DEBIAN_FRONTEND=noninteractive apt-get -y dist-upgrade > /dev/null > /var/cache/gitian/upgrade.log 2>&1
touch /var/cache/gitian/initial-upgrade
Loading…
Cancel
Save