Initial commit. In a broken state, do not use.

This commit is contained in:
Storm Dragon
2019-12-11 14:39:33 -05:00
parent 5dea87f44a
commit 1237ab3fd9
1039 changed files with 187732 additions and 0 deletions
+683
View File
@@ -0,0 +1,683 @@
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.
<<<<<<< HEAD
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
=======
{one line to give the program's name and a brief idea of what it does.}
Copyright (C) {year} {name of author}
>>>>>>> 1e9bc6968bd083cca14b3e8852067fdb56296a0b
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:
<<<<<<< HEAD
<program> Copyright (C) <year> <name of author>
=======
{project} Copyright (C) {year} {fullname}
>>>>>>> 1e9bc6968bd083cca14b3e8852067fdb56296a0b
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>.
+88
View File
@@ -0,0 +1,88 @@
# F123Light
## Build system for F123 on Raspberry Pi 2 and 3 computers
# Introduction
The F123Light build system is a collection of scripts and custom files used to build F123Light images that can be written to a MicroSD card for use on a [Raspberry Pi](https://www.raspberrypi.org/) computer, either model 2 or 3. F123Light on a Raspberry Pi 3 runs in 32-bit mode, because it includes the vendor supplied kernel and boot code, which are said to be more stable than the 64-bit mainline kernel and U-boot at this time. However, with modifications to the package list file used, it is also possible to configure the build system for 64-bit mode if desired.
# Compatibility
This build system started as an adaptation of the [f123pi](https://github.com/f123/f123pi) build system, but it is largely rewritten for better compatibility and functionality on a wider variety of configurations. The f123pi build system required images to be built using a working Raspberry Pi. This version is capable of building working images on any ARMv7 or later computer running [ArchLinuxARM](https://archlinuxarm.org/). Experimental development builds using this system are currently being performed on a Raspberry Pi 3 and an Odroid C2, but any 32-bit ARM machine using the armv7h architecture or any 64-bit machine using the aarch64 architecture may be used to build F123Light images, as long as the machine is running an ArchLinuxARM compatible OS with the needed packages. On the other hand, images built using this system will only run on the Raspberry Pi 2 and 3, though this build system can certainly be adapted to build images for other devices with little difficulty.
# Dependencies
In order to build images using this system, you will need the following Arch packages:
* util-linux: for partition and loop device support, (installed on most systems)
* parted: for writing and manipulating partitions, installed on most systems
* arch-install-scripts: to bootstrapp the OS into a mounted image, (most likely not preinstalled)
* dbus: to set gsettings keys if a graphical desktop is being configured, (a dependency of systemd, installed on most systems)
The build script will automatically install any dependencies it finds missing.
# Installation
No installation beyond the dependencies listed above is required in order to use this build system. Just clone the git repository, cd into the build directory, usually F123Light/build and run the build script as described below.
# The Build Directory
The build directory consists of the following components:
* build.sh: the primary automated build script
* *.conf: contains options used when building images
* package_lists: A directory containing lists of packages that can be installed into an image
* files: A repository of modified files to be copied to an image during the build
* scripts: build stage scripts that take options passed into them by build.sh, but can also run separately
* utils: utility scripts used for localization of the build system
# Using Build.sh
The build.sh script builds an image automatically, based on values in the configuration file specified on its command line. It must run as root.
Usage:
sudo ./build.sh <configuration-file>
Only one argument needs to be supplied on the build.sh command line. This is the single configuration file needed to build an image. The script will take all the options in the configuration file and automatically create an empty image, mount it, download and install officially available packages, optionally build and install AUR packages, set any needed gsettings keys, copy in modified files, configure the new system, enable systemd services, unmount the image and cleanup the work directory based on those options.
The configuration file argument must always be supplied. If not, a usage message is displayed and all available configuration files are listed for convenience. If more than one configuration is specified, a usage message is displayed and the script exits.
# The Configuration File
The automated build.sh script takes a configuration file on its command line. At least one configuration file is included in this repository.
This is a basic example of a configuration file. It is well commented to allow for easy editing and to give an understanding of the available options.
# F123Light configuration
# The lines below, in key=value format, will set options to be passed to various stages of the image building process.
# This file will be sourced by build.sh in the same directory, and can contain anything that a shell can execute.
# The version count - the first of the day should be 1, increment this manually for the imagename and rootlabel counters
count=1
# The working directory where the new image is to be mounted - must be an absolute path
workdir=${PWD}/F123Light
#The full path and filename of the Raspberry Pi image file
imagename="${PWD}/F123Light-MATE-en_US-$(date +%y.%m.%d)-${count}.img"
# The size of the image file in MB, for example 8192 will create an 8GB zero-filled image file
imagesize=7168
# The volume label of the FAT32 filesystem on the boot partition - must be <= 11 bytes
bootlabel=F123-boot
# The volume label of the ext4 filesystem on the root partition - must be <= 16 bytes
rootlabel="F123Light$(date +%y%m%d)${count}"
# Set this on a graphical desktop that uses gsettings: MATE, GNOME, etc.
# Remove or comment the line below if the image is to run in text mode with no desktop or window manager, or one that is not compatible with gsettings.
gsettings=1
# The full path to the file listing official packages to be installed to the new system
packagelist="${PWD}/package_lists/F123Light/MATE.list"
# The full path to the file listing AUR packages to be installed to the new system.
aurlist="${PWD}/package_lists/F123Light/fenrir.aur.list"
# The hostname of the new system
hostname=f123light
# The root password
rootpass=root
# The name of the regular user
username=f123
# The regular user's password
userpass=f123
# The system locale/language
locale=en_US.UTF-8
# A list of services to be enabled once the OS is installed
services="dhcpcd ntpd sshd NetworkManager lxdm"
# Package Caching
During the automated build process, all officially available packages are cached under the working directory where the image is mounted. This optimizes both for image size and speed of any build after the first build, which must download all packages that are to be installed. First, the package cache is stored outside the image, which saves space when transferring the image, especially over the internet, because even if the cache is deleted from the image itself, the data is still present, making its total space usage on disk larger. Storing the cache outside of the image eliminates this problem, because package files are never stored inside of the mounted image at all, thereby making its total space usage on disk smaller. Secondly, storing the cache outside of the image makes the package cache persistent, even if an image is deleted. For example, an image is built with the MATE desktop on Tuesday, and a text only image is built on Thursday. The MATE image was deleted on Wednesday, but will be built again with small modifications on Friday. The MATE image contains all the packages used on the base system. Because a persistent cache is used, even though the MATE image has been deleted, no packages will be downloaded either on Thursday or Friday, unless a new package has been added to the list or a package has been updated in the repository, because they already exist in the cache. On the other hand, cache size can eventually become unwieldy, because multiple versions of packages may be stored in the cache. If the cache is taking too much disk space, root may delete it at any time, either by removing the pacman-cache directory under the work directory or by recursively removing the work directory. This of course will delete the entire cache, so all packages will need to be downloaded again the next time an image is built.
+55
View File
@@ -0,0 +1,55 @@
# F123Light configuration
# The lines below, in key=value format, will set options to be passed to various stages of the image building process.
# This file will be sourced by build.sh in the same directory, and can contain anything that a shell can execute.
# The working directory where the new image is to be mounted - must be an absolute path
workdir=${PWD}/F123Light
# The version number to be used with image names and filesystem labels
version=$(date +%y.%m.%d)
#The full path and filename of the Raspberry Pi image file
imagename="${PWD}/F123Light-${version}.img"
# The size of the image file in MB, for example 8192 will create an 8GB zero-filled image file
imagesize=7168
# The volume label of the FAT32 filesystem on the boot partition - must be <= 11 bytes
bootlabel=F123-boot
# The volume label of the ext4 filesystem on the root partition - must be <= 16 bytes
rootlabel="F123Light${version//./}"
# Set this on a graphical desktop that uses gsettings: MATE, GNOME, etc.
# Remove or comment the line below if the image is to run in text mode with no desktop or window manager, or one that is not compatible with gsettings.
#gsettings=1
# The full path to the file listing official packages to be installed to the new system
packagelist="${PWD}/package_lists/packages.list"
# The hostname of the new system
hostname=f123light
# The root password
rootpass=root
# The name of the regular user
username=f123
# The regular user's password
userpass=f123
# All supported languages for this system
locales=('ar_EG.UTF-8' 'es_ES.UTF-8' 'en_US.UTF-8' 'pt_BR.UTF-8')
# The default system language, must be in the above list of available languages
defaultlocale=en_US.UTF-8
# Wireless network configuration
# Optionally, network name and password can be configured here.
# Only the name is required, but the network will be configured as open if no password is specified.
networkname=
wifipass=
# A list of services to be enabled once the OS is installed
services="atd cronie dbus-broker dhcpcd@eth0 growpartfs loginsound logoutsound NetworkManager nodm ntpd sshd fake-hwclock fake-hwclock-save.timer fstrim.timer bluetooth brcm43438 pulseaudio zramswap"
+24
View File
@@ -0,0 +1,24 @@
PREFIX = /usr/local
po :
$(MAKE) -C i18n
install : sh mo
sh :
touch sh.token
mo : en
en :
install -m0755 -d $(PREFIX)/share/locale/$@/LC_MESSAGES
install -m0644 -t $(PREFIX)/share/locale/$@/LC_MESSAGES ./locale/$@/LC_MESSAGES/pacstrap-f123pi.mo
uninstall :
find $(PREFIX) -name "pacstrap-f123pi*" -exec rm {} \;
find $(PREFIX) -name "bootstrap-f123pi*" -exec rm {} \;
+274
View File
@@ -0,0 +1,274 @@
#!/bin/bash
# build.sh
# Automate Raspberry Pi image builds
# Take a config file on the command line and pass its options to the various stages of the build process
#
# Copyright 2018, F123 Consulting, <information@f123.org>
# Copyright 2018, Kyle, <kyle@free2.ml>
# Copyright 2018, Storm Dragon, <storm_dragon@linux-a11y.org>
#
# This 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, or (at your option) any later
# version.
#
# This software 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 package; see the file COPYING. If not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#
#--code--
export TEXTDOMAIN=build.sh
export TEXTDOMAINDIR=./locale
. gettext.sh
# Log writing function
log() {
# Usage: command | log for just stdout.
# Or command |& log for stderr and stdout.
while read -r line ; do
echo "$line" | sudo tee -a "$logFile"
done
}
# Log file name is /var/log/build.f123
logFile="/var/log/build.f123"
set -e
# Load the common functions
. scripts/functions
# Die if not running as root
if ! check_root ; then
PROGNAME=$0
echo $(eval_gettext "Script must be run as root, try: sudo \$PROGNAME")
echo
exit 1
fi
# Clear previous logs
echo -n | sudo tee "$logFile" &> /dev/null
declare -A argList=(
[d:]="work-directory:,"
[H:]="hostname:,"
[h]="help,"
[n:]="network-name:,"
[o:]="output-file:,"
[p:]="password:,"
[r:]="root-password:,"
[s:]="size:,"
[u:]="user:,"
[w:]="wifi-password:"
)
short="${!argList[*]}"
short="${short// /}"
long="${argList[*]}"
long="${long// /}"
# Get command line options
if ! options=$(getopt -o $short -l $long -n "build.sh" -- "$@"); then
echo "Unknown options passed to $0" | log
exit 1
fi
eval set -- "$options"
# Declare the overrides that will replace configuration file variables with command line options
declare -A overrides=()
while test $# -gt 0; do
case $1 in
-d|--work-directory) overrides[workdir]="$2"; shift 2 ;;
-H|--hostname) overrides[hostname]="$2"; shift 2 ;;
-h|--help) cat <<-HELP
$(gettext "Usage")
$(eval_gettext "\$name [options...]")
$(gettext "Options")
-d, --work-directory: $(gettext "The work directory for caching packages and mounting filesystems")
-H, --hostname: $(gettext "The hostname of the installed system")
-h, --help: $(gettext "Print this help and exit")
-n, --network-name: $(gettext "The name of the wifi network. If specified, a wifi password is also required.")
-o, --output-file: $(gettext "The name of the image file to write")
-p, --password: $(gettext "The password of the regular non-root user")
-r, --root-password: $(gettext "The password of the root user")
-s --size: $(gettext "The initial size of the image file in MB")
-u, --user: $(gettext "The name of the regular non-root user")
-w, --wifi-password: $(gettext "the password used to login to the specified wifi network, requires network name")
HELP
exit 0 ;;
-n|--network-name) overrides[networkname]="$2"; shift 2 ;;
-o|--output-file) overrides[imagename]="$2"; shift 2 ;;
-p|--password) overrides[userpass]="$2"; shift 2 ;;
-r|--root-password) overrides[rootpass]="$2"; shift 2 ;;
-s|--size) overrides[imagesize]="$2"; shift 2 ;;
-u|--user) overrides[username]="$2"; shift 2 ;;
-w|--wifi-password) overrides[wifipass]="$2"; shift 2 ;;
(--) shift ;;
(*)
if test -f "$1"; then
source "$1"
else
echo "Invalid configuration file specified." | log
exit 1
fi
shift
;;
esac
done
# Replace configuration variables using the overrides gathered from command line options
test "${overrides[workdir]}" && workdir="${overrides[workdir]}"
test "${overrides[hostname]}" && hostname="${overrides[hostname]}"
test "${overrides[networkname]}" && networkname="${overrides[networkname]}"
test "${overrides[imagename]}" && imagename="${PWD}/${overrides[imagename]}"
test "${overrides[userpass]}" && userpass="${overrides[userpass]}"
test "${overrides[rootpass]}" && rootpass="${overrides[rootpass]}"
test "${overrides[imagesize]}" && imagesize="${overrides[imagesize]}"
test "${overrides[username]}" && username="${overrides[username]}"
test "${overrides[wifipass]}" && wifipass="${overrides[wifipass]}"
# export workdir so it is available in subshells.
export workdir
# All build stage scripts run from the scripts directory underneath the directory where this build script resides.
# todo: Call the loaded functions as needed rather than calling the stage scripts.
# First, the current directory must be saved.
current=$PWD
# Now we enter the directory where the stage scripts live.
cd scripts && echo "cd $PWD" | log
# Check for dependencies and install any that are missing.
check_deps
# Before building an image, we must be sure that the work directory is clean except for a package cache.
# There is not yet a facility to complete a half-built failed image, but we can cache software packages.
if [ -d "$workdir" ]; then
clean_up "$workdir" || true
# Don't remove an otherwise empty work directory if a pacman cache is present
[ -d "${workdir}/pacman-cache" ] || rm -Rv "$workdir" |& log
fi
# Start by creating an empty image and mounting it.
new_image $workdir $imagename $bootlabel $rootlabel boot root $imagesize 1M 64M |& log
# Install packages available from the official ALARM repositories.
./pacstrap -l "$packagelist" -c "${workdir}/pacman-cache" "$workdir/root" |& log
# Set the system hostname
echo $hostname > $workdir/root/etc/hostname
# The root partition is automatically mounted by systemd. Add only the boot partition information to fstab.
echo -e "\n/dev/mmcblk0p1 /boot vfat defaults 0 0" >> $workdir/root/etc/fstab
# Set the root password
set_password "${workdir}/root" root "${rootpass}"
# Install locale specific packages. The file name looks like the configured package list file, but includes an @ sign followed by the locale followed by .list, e.g. packages@sw_KE.list.
# This file will be ignored if it doesn't exist.
test -f "${packagelist%%.list}@${locale}.list" && ./pacstrap -l "${packagelist%%.list}@${locale}.list" -c "${workdir}/pacman-cache" "$workdir/root"
# Add pulseaudio stuff and other groups
add_groups "${workdir}/root" |& log
# Add the regular user and set its password
add_user "${workdir}/root" "${username}" |& log
set_password "${workdir}/root" "${username}" "${userpass}" |& log
# Install packages from the AUR
# This is optional, and will only run if an AUR package list is set in the config file passed to this script.
test $aurlist && ./aur-install -l "$aurlist" "${workdir}/root" |& log
# Copy any override files into the new system. This overrides any system and user configuration files or scripts installed with packages.
# Remove any stale temporary files related to the file and content repositories
rm -Rfv /tmp/files-F123Light /tmp/content-F123Light |& log
# Start by cloning the files-F123Light and content-F123Light repositories.
git clone -b $(git branch | grep \* | cut -f2 -d \ ) --recurse-submodules https://gitlab.com/F123/files-F123Light.git /tmp/files-F123Light |& log
git clone https://gitlab.com/F123/content-F123Light.git /tmp/content-F123Light |& log
# Copy in the files.
cp -Rv /tmp/files-F123Light/files/* "${workdir}/root/" |& log
# Generate translations:
find /tmp/files-F123Light/locales -type f -iname '*.po' -exec bash -c '
for i ; do
# i is in file, o is outfile.
language="$(grep "^\"Language: .*\\n" "${i}" | cut -d " " -f2 | cut -d "\\" -f1)"
# Handle exceptions for languages.
case "$language" in
*) language="${language::2}";;
esac
o="${i##*/}"
o="${o%.po}.mo"
msgfmt "$i" -o "${workdir}/root/usr/share/locale/${language}/LC_MESSAGES/${o}"
done' _ {} +
mkdir -p "${workdir}/root/usr/share/doc/F123" |& log
cp -Rv /tmp/content-F123Light/F123/* "${workdir}/root/usr/share/doc/F123/" |& log
# remove the temporary files again.
rm -Rv /tmp/files-F123Light /tmp/content-F123Light |& log
# Now copy any override files from this repository.
cp -Rv ../files/* "${workdir}/root/" || true |& log
# Set the system locale and generate all other locales specified in the configuration file.
# The default system locale must be set before we can copy user files to $HOME.
setup_locales $workdir/root $defaultlocale ${locales[@]} |& log
# Always copy the contents of /etc/skel to the home directory of the user that was created earlier
systemd-nspawn -a -q -D $workdir/root\
sudo -u \#1000\
bash -c "shopt -s dotglob && cp -R /etc/skel/* \"\$HOME\"" |& log
# Enable system services
for service in $services; do
manage_service "${workdir}/root" enable "${service}" |& log
done
# Globally enable dbus-broker
systemd-nspawn -a -q -D $workdir/root\
systemctl --global enable dbus-broker.service |& log
# Download package databases
download_package_databases $workdir/root |& log
set_fake_hwclock $workdir/root |& log
# Set gsettings keys to enable Orca
# This is optional, and cannot run on a text only system.
[ $gsettings ] && ./gsettings "${workdir}/root" |& log
# Configure wifi if network information is present in the configuration file.
test $networkname && setup_wifi $workdir/root wlan0 $networkname $wifipass |& log
# Touch the firstboot file. It will be deleted by the firstboot script that looks for it.
systemd-nspawn -a -q -D $workdir/root\
sudo -u \#1000\
bash -c "touch \$HOME/.firstboot"
# Write a system timestamp.
# This timestamp will determine which incremental updates apply to this image
echo "$(date +%y%m%d%H%M)" > $workdir/root/etc/timestamp-f123light
# Unmount the image file
clean_up "$workdir" |& log
# Keep the work directory if a pacman cache exists, otherwise remove it
[ -d "${workdir}/pacman-cache" ] || rm -Rv "$workdir" |& log
# Once all scripts have completed, come back to the directory from which this script was launched.
cd $current && echo "cd $current" |& log
newrootsize=$(ls -hs "${imagename}" | cut -f1 -d' ')
relativeimage=$(realpath --relative-to="$PWD" "$imagename")
echo "$relativeimage was built successfully" | log
echo "Size of $relativeimage is ${newrootsize}" | log
exit 0
+68
View File
@@ -0,0 +1,68 @@
# F123 pacstrap-f123pi - Bootstrap an Arch image for the Raspberry Pi
# Copyright (C) 2017 THE Mike Ray
# This file is distributed under the same license as the f123pi package.
# Mike Ray <mike.ray@btinternet.com>, 2017.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: 1.0.0\n"
"POT-Creation-Date: 2017-10-19 03:55+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: English\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../bootstrap-f123pi:12
msgid "Usage: $scriptname"
msgstr ""
"Usage: $scriptname [ options ... ] { directory | mount-point }\\n\\n"
"Options:\\n\\n"
" -h\\n\\n"
" Show usage and exit.\\n\\n"
" -d\\n\\n"
" Installation directory is not a mount-point, but an ordinary directory.\\n\\n"
" -l <package-list>\\n\\n"
" Package list. A file containing one line with each package or meta-package to install.\\n\\n"
" -o <hostname>\\n\\n"
" Host name to write to /etc/hostname.\\n\\n"
" Default is f123pi.\\n\\n"
" -p <password>\\n\\n"
" User password. The password for the one ordinary user being created.\\n\\n"
" Default is raspberry.\\n\\n"
" -r <root-password>\\n\\n"
" Root password.\\n\\n"
" Default is root.\\n\\n"
" -u <user-name>\\n\\n"
" Name of ordinary user to create.\\n\\n"
" Default is f123.\\n\\n"
"In all cases arguments to options are mandatory.\\n\\n"
"User name and passwords must comply with valid values according to Linux standards."
#: ../bootstrap-f123pi:50
msgid "Option requires an argument"
msgstr ""
#: ../bootstrap-f123pi:54
msgid "Invalid option"
msgstr ""
#: ../pacstrap-f123pi.lib:28
#, sh-format
msgid "Add user ${username}"
msgstr ""
#: ../pacstrap-f123pi.lib:39
#, sh-format
msgid "Setting password for user ${username}"
msgstr ""
#: ../pacstrap-f123pi.lib:51
#, sh-format
msgid "Calling systemctl to ${operation} ${service} service"
msgstr ""
+94
View File
@@ -0,0 +1,94 @@
# F123 pacstrap-f123pi - Bootstrap an Arch image for the Raspberry Pi
# Copyright (C) 2017 THE Mike Ray
# This file is distributed under the same license as the f123pi package.
# Mike Ray <mike.ray@btinternet.com>, 2017.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: 1.0.0\n"
"POT-Creation-Date: 2017-10-19 03:55+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: Spanish\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#
# Fernando:
#
# The hardest string in this template will be the usage message.
# Try to keep it to a similar format. Option lines and their
explanations are indented by one tab.
# Other lines are not indented.
#
# Shorter strings like "Invalid option should be easy.
#
# There will be a lot more than this but this is a small one to get
started with.
#
# Where you see a variable that starts with a dollar sign, it's very
important not to change the name of it or the format.
#
# The values in the 'msgid' strings should not be changed since it is
these which the scripts use
# to look up the translations.
#
# Don't be confused by the empty string "" in some msgid entries where
there multiple lines such as in the usage message.
#
#: ../bootstrap-f123pi:12
msgid "Usage: $scriptname"
msgstr ""
"Usage: $scriptname [ options ... ] { directory | mount-point }\\n\\n"
"Options:\\n\\n"
" -h\\n\\n"
" Show usage and exit.\\n\\n"
" -d\\n\\n"
" Installation directory is not a mount-point, but an ordinary directory.\\n\\n"
" -l <package-list>\\n\\n"
" Package list. A file containing one line with each package or meta-package to install.\\n\\n"
" -o <hostname>\\n\\n"
" Host name to write to /etc/hostname.\\n\\n"
" Default is f123pi.\\n\\n"
" -p <password>\\n\\n"
" User password. The password for the one ordinary user being created.\\n\\n"
" Default is raspberry.\\n\\n"
" -r <root-password>\\n\\n"
" Root password.\\n\\n"
" Default is root.\\n\\n"
" -u <user-name>\\n\\n"
" Name of ordinary user to create.\\n\\n"
" Default is f123.\\n\\n"
"In all cases arguments to options are mandatory.\\n\\n"
"User name and passwords must comply with valid values according to Linux standards."
#: ../bootstrap-f123pi:50
msgid "Option requires an argument"
msgstr ""
#: ../bootstrap-f123pi:54
msgid "Invalid option"
msgstr ""
#: ../pacstrap-f123pi.lib:28
#, sh-format
msgid "Add user ${username}"
msgstr ""
#: ../pacstrap-f123pi.lib:39
#, sh-format
msgid "Setting password for user ${username}"
msgstr ""
#: ../pacstrap-f123pi.lib:51
#, sh-format
msgid "Calling systemctl to ${operation} ${service} service"
msgstr ""
+94
View File
@@ -0,0 +1,94 @@
# F123 pacstrap-f123pi - Bootstrap an Arch image for the Raspberry Pi
# Copyright (C) 2017 THE Mike Ray
# This file is distributed under the same license as the f123pi package.
# Mike Ray <mike.ray@btinternet.com>, 2017.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: 1.0.0\n"
"POT-Creation-Date: 2017-10-19 03:55+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: Brazilian Portuguese\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#
# Fernando:
#
# The hardest string in this template will be the usage message.
# Try to keep it to a similar format. Option lines and their
explanations are indented by one tab.
# Other lines are not indented.
#
# Shorter strings like "Invalid option should be easy.
#
# There will be a lot more than this but this is a small one to get
started with.
#
# Where you see a variable that starts with a dollar sign, it's very
important not to change the name of it or the format.
#
# The values in the 'msgid' strings should not be changed since it is
these which the scripts use
# to look up the translations.
#
# Don't be confused by the empty string "" in some msgid entries where
there multiple lines such as in the usage message.
#
#: ../bootstrap-f123pi:12
msgid "Usage: $scriptname"
msgstr ""
"Usage: $scriptname [ options ... ] { directory | mount-point }\\n\\n"
"Options:\\n\\n"
" -h\\n\\n"
" Show usage and exit.\\n\\n"
" -d\\n\\n"
" Installation directory is not a mount-point, but an ordinary directory.\\n\\n"
" -l <package-list>\\n\\n"
" Package list. A file containing one line with each package or meta-package to install.\\n\\n"
" -o <hostname>\\n\\n"
" Host name to write to /etc/hostname.\\n\\n"
" Default is f123pi.\\n\\n"
" -p <password>\\n\\n"
" User password. The password for the one ordinary user being created.\\n\\n"
" Default is raspberry.\\n\\n"
" -r <root-password>\\n\\n"
" Root password.\\n\\n"
" Default is root.\\n\\n"
" -u <user-name>\\n\\n"
" Name of ordinary user to create.\\n\\n"
" Default is f123.\\n\\n"
"In all cases arguments to options are mandatory.\\n\\n"
"User name and passwords must comply with valid values according to Linux standards."
#: ../bootstrap-f123pi:50
msgid "Option requires an argument"
msgstr ""
#: ../bootstrap-f123pi:54
msgid "Invalid option"
msgstr ""
#: ../pacstrap-f123pi.lib:28
#, sh-format
msgid "Add user ${username}"
msgstr ""
#: ../pacstrap-f123pi.lib:39
#, sh-format
msgid "Setting password for user ${username}"
msgstr ""
#: ../pacstrap-f123pi.lib:51
#, sh-format
msgid "Calling systemctl to ${operation} ${service} service"
msgstr ""
+148
View File
@@ -0,0 +1,148 @@
# rpi-image-tools.
# Copyright (C) 2017 Mike Ray
# This file is distributed under the same license as the PACKAGE package.
# Mike Ray <mike.ray@btinternet.com>, 2017.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: 0.1.0alpha\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-09-21 17:22+0100\n"
"PO-Revision-Date: 2017-MO-DA HO:MI+ZONE\n"
"Last-Translator: Mike Ray <mike.ray@btinternet.com>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: English (en)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: rpi-image-tool:13
msgid "tool_usage"
msgstr ""
"Usage: rpi-image-tool {options ...}\\n"
"\\n"
"Options:\\n"
"\\n"
" -C <work_dir>\\n"
"\\n"
" Clean-up a previous run, unmounting partitions, removing\\n"
" working files (not the image file or the working directory.\\n"
"\\n"
" -D <device>\\n"
"\\n"
" Mount the partitions on the SD card or other device.\\n"
"\\n"
" -M <image_file>\\n"
"\\n"
" Mount the partitions of an existing image file.\\n"
"\\n"
" -N <image_file>\\n"
"\\n"
" Create, partition and mount a new (empty) image file.\\n"
"\\n"
" Only one of the above uppercase options is permitted in any single run.\\n"
"\\n"
" -h\\n"
"\\n"
" Display this help text and exit.\\n"
"\\n"
" -c <integer_block_count>\\n"
"\\n"
" The number of blocks to write to a new image file. See -z below.\\n"
" Only relevant when using the -N option to generate a new image.\\n"
"\\n"
" -s <integer_split>\\n"
"\\n"
" The size of the FAT16) boot partition in blocks. See -z below for block size.\\n"
" Only relevant when using the -N option to create a new image.\\n"
" Default = 64\\n"
"\\n"
" -w <working_directory>\\n"
"\\n"
" The working directory which will contain the mount-point and other working files\\n"
" (not including the .img file unless the working directory is prefixed in the -N option.\\n"
"\\n"
" -z <block_size>\\n"
"\\n"
" The block size.\\n"
" Only relevant when using the -N option to create a new image.\\n"
" Permitted values are '1M' or '1MB'\\n"
" Default = 1M\\n"
"\\n"
"Notes:\\n"
"\\n"
"The script assumes that:\\n"
"\\n"
" 1. The first partition is the boot partition.\\n"
" 2. The second partition is the root partition.\\n"
"\\n"
"If the supplied working directory is 'work', the mounts will be as follows:\\n"
"\\n"
" work/root (where the root partition is mounted)\\n"
" work/root/boot (where the boot partition is mounted)\\n"
"\\n"
"**IMPORTANT**\\n"
"\\n"
"There is *NO* paranoia checking to check the 2 partition rule is obeyed in any\\n"
"image file or device being created or mounted.\\n"
"\\n"
"Be very careful when specifying the device name to a -N run of this script.\\n"
"It uses 'dd' to generate the .img file and\\n"
"'dd' is silent and deadly if you pick the wrong device, for example your main\\n"
"hard-disk.\\n"
"\\n"
"You have been warned!\\n"
"\\n"
#: rpi-image-tool:24
#, sh-format
msgid "Script must be run as root, try: sudo $PROGNAME"
msgstr ""
#: rpi-image-tool:77
msgid "Invalid option"
msgstr ""
#: rpi-image-tool:83
#, sh-format
msgid "Option - $OPTARG requires an argument."
msgstr ""
#: rpi-image-tool:91
msgid "Work directory not set"
msgstr ""
#: rpi-image-tool:94
msgid "Image file name not set"
msgstr ""
#: rpi-image-tool:95 rpi-image-tool:100
msgid "Root mount-point not set"
msgstr ""
#: rpi-image-tool:99
msgid "Device name not set"
msgstr ""
#: rpi-image-tool:104
msgid "Block count not set"
msgstr ""
#: rpi-image-tool:105
msgid "Block size not set"
msgstr ""
#: rpi-image-tool:106
msgid "Split size not set"
msgstr ""
#: rpi-image-sync:11
msgid "sync_usage"
msgstr ""
#: backuppi:12
msgid "backup_usage"
msgstr ""
+302
View File
@@ -0,0 +1,302 @@
base
ne
nodm
notify-osd
ntp
openssh
opus-tools
raspberrypi-bootloader
raspberrypi-firmware
barnard-git
base-devel
bicon-git
alsa-utils
arch-install-scripts
aspell
at
audacious
audacity
audiofile
bash-completion
bashtuner
bluez
bluez-tools
bluez-utils
brltty
bsd-games
calc
catdoc
cfh-client
configure-wifi-git
chromium
cronie
cryptsetup
cuneiform
dbus-broker
dhcpcd
device-mapper
diffutils
dragonfm-git
discount
dialog
dos2unix
dotconf
e2fsprogs
ethtool
espeak-ng-extended-git
epub2txt
fake-hwclock
fenrir
firefox
fleacollar-git
fribidi
galculator
git
glipper
growpart
gst-plugins-bad
gst-plugins-ugly
gvfs
horseshoes-git
hunspell
imagemagick
inetutils
intltool
irssi
jfsutils
jshon
json-c
libao
libksane
liblouis
libltdl
libnewt
libpulse
libsonic-git
liburcu
linux-raspberrypi
lios-git
logrotate
lvm2
lxterminal
man-db
man-pages
mate-panel
mbrola-git
mbrola-voices-af1
mbrola-voices-ar1
mbrola-voices-ar2
mbrola-voices-br1
mbrola-voices-br2
mbrola-voices-br3
mbrola-voices-br4
mbrola-voices-de1
mbrola-voices-de2
mbrola-voices-de3
mbrola-voices-de4
mbrola-voices-de5
mbrola-voices-de6
mbrola-voices-de7
mbrola-voices-de8
mbrola-voices-es1
mbrola-voices-es2
mbrola-voices-es3
mbrola-voices-es4
mbrola-voices-fr1
mbrola-voices-fr2
mbrola-voices-fr3
mbrola-voices-fr4
mbrola-voices-fr5
mbrola-voices-fr6
mbrola-voices-fr7
mbrola-voices-hu1
mbrola-voices-id1
mbrola-voices-in1
mbrola-voices-in2
mbrola-voices-pl1
mbrola-voices-tr1
mbrola-voices-tr2
mbrola-voices-us1
mbrola-voices-us2
mbrola-voices-us3
mhwaveedit
mlterm
mpv
mutt
mygtkmenu
nano
network-manager-applet
parted
pcaudiolib
pcmanfm
pdmenu-git
perl
perl-json-xs
perl-text-charwidth
perl-term-readline-gnu
pi-bluetooth
pianobar
pidgin
pidgin-otr
pluma
portaudio
pulseaudio
pulseaudio-alsa
pulseaudio-bluetooth
python
python-cairo
python-daemonize
python-dbus
python-evdev
magic-wormhole
python2-pip
python-pip
python-pyalsaaudio
python-pyenchant
python-pyinsane
python-pyte
python-pyudev
python-setuptools
python-xlsx2csv
ratpoison
rclone-browser
reiserfsprogs
rhvoice-git
ripit
rpi-clone-git
rsync
rxvt-unicode
sbc
sc-im-git
screen
sdl_image
sdl_mixer
sdl_net
sdl_pango
sdl_ttf
simpleorcapluginsystem-git
socat
sox
speech-dispatcher
storebackup
sudo
surfraw
sysfsutils
t4kcommon-git
telegram-cli-git
telegram-purple
tesseract-data-ara
tesseract-data-eng
tesseract-data-fra
tesseract-data-por
tesseract-data-spa
tesseract
texinfo
thunderbird
tintin
ttf-dejavu
tuxmath-git
tuxtype-git
units
update-f123light
unzip
usbutils
vi
w3m
wget
which
wireless_tools
wpa_supplicant
xarchiver
xclip
xdg-user-dirs
xf86-video-vesa
xfsprogs
xorg-bdftopcf
xorg-docs
xorg-font-util
xorg-fonts-100dpi
xorg-fonts-75dpi
xorg-fonts-encodings
xorg-iceauth
xorg-luit
xorg-mkfontdir
xorg-mkfontscale
xorg-server
xorg-server-common
xorg-server-devel
xorg-server-xdmx
xorg-server-xephyr
xorg-server-xnest
xorg-server-xvfb
xorg-server-xwayland
xorg-sessreg
xorg-setxkbmap
xorg-smproxy
xorg-x11perf
xorg-xauth
xorg-xbacklight
xorg-xcmsdb
xorg-xcursorgen
xorg-xdpyinfo
xorg-xdriinfo
xorg-xgamma
xorg-xev
xorg-xhost
xorg-xinit
xorg-xinput
xorg-xkbcomp
xorg-xkbevd
xorg-xkbutils
xorg-xkill
xorg-xlsatoms
xorg-xlsclients
xorg-xmodmap
xorg-xpr
xorg-xprop
xorg-xrandr
xorg-xrdb
xorg-xrefresh
xorg-xset
xorg-xsetroot
xorg-xvinfo
xorg-xwd
xorg-xwininfo
xorg-xwud
yad
yajl
yay
youtube-dl
youtube-viewer
zip
zramswap
blueman
libreoffice-still
orca
recoll
hunspell-en_US
# Arabic language packages
aspell-ar
firefox-i18n-ar
hunspell-ar
libreoffice-still-ar
thunderbird-i18n-ar
ttf-arabeyes-fonts
# Portuguese language packages
firefox-i18n-pt-br
libreoffice-still-pt-br
aspell-pt
hunspell-pt-br
thunderbird-i18n-pt-br
# Spanish language packages
aspell-es
firefox-i18n-es-es
hunspell-es_any
hunspell-es_es
hyphen-es
libreoffice-still-es
mythes-es
thunderbird-i18n-es-es
+6
View File
@@ -0,0 +1,6 @@
[f123pi]
SigLevel = Optional TrustAll
Server = file:///opt/f123pi
+101
View File
@@ -0,0 +1,101 @@
#
# /etc/pacman.conf
#
# See the pacman.conf(5) manpage for option and repository directives
#
# GENERAL OPTIONS
#
[options]
# The following paths are commented out with their default values listed.
# If you wish to use different paths, uncomment and update the paths.
#RootDir = /
#DBPath = /var/lib/pacman/
#CacheDir = /var/cache/pacman/pkg/
#LogFile = /var/log/pacman.log
#GPGDir = /etc/pacman.d/gnupg/
#HookDir = /etc/pacman.d/hooks/
HoldPkg = pacman glibc
#XferCommand = /usr/bin/curl -C - -f %u > %o
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
#CleanMethod = KeepInstalled
#UseDelta = 0.7
Architecture = armv7h
# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
#IgnorePkg =
#IgnoreGroup =
#NoUpgrade =
#NoExtract =
# Misc options
#UseSyslog
#Color
#TotalDownload
CheckSpace
#VerbosePkgLists
# PGP signature checking
# NOTE: None of this will work without running `pacman-key --init` first.
# The compiled in default is equivalent to the following line. This requires
# you to locally sign and trust packager keys using `pacman-key` for them to be
# considered valid.
#SigLevel = Required DatabaseOptional
#LocalFileSigLevel = Optional
#RemoteFileSigLevel = Required
# If you wish to check signatures but avoid local sign and trust issues, use
# the following line. This will treat any key imported into pacman's keyring as
# trusted.
#SigLevel = Optional TrustAll
# For now, off by default unless you read the above.
SigLevel = Never
#
# REPOSITORIES
# - can be defined here or included from another file
# - pacman will search repositories in the order defined here
# - local/custom mirrors can be added here or in separate files
# - repositories listed first will take precedence when packages
# have identical names, regardless of version number
# - URLs will have $repo replaced by the name of the current repo
# - URLs will have $arch replaced by the name of the architecture
#
# Repository entries are of the format:
# [repo-name]
# Server = ServerName
# Include = IncludePath
#
# The header [repo-name] is crucial - it must be present and
# uncommented to enable the repo.
#
# The testing repositories are disabled by default. To enable, uncomment the
# repo name header and Include lines. You can add preferred servers immediately
# after the header, and they will be used before the default mirrors.
[f123light]
Server = https://packages.f123.org/$arch
[core]
Include = /etc/pacman.d/mirrorlist
[extra]
Include = /etc/pacman.d/mirrorlist
[community]
Include = /etc/pacman.d/mirrorlist
[alarm]
Include = /etc/pacman.d/mirrorlist
[aur]
Include = /etc/pacman.d/mirrorlist
# An example of a custom package repository. See the pacman manpage for
# tips on creating your own repositories.
#[custom]
#SigLevel = Optional TrustAll
#Server = file:///home/custompkgs
+105
View File
@@ -0,0 +1,105 @@
#!/bin/bash
#
# aur-install
#
# Copyright 2018 F123 Consulting, <information@f123.org>
# Copyright 2018, Kyle, <kyle@free2.ml>
#
# This 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, or (at your option) any later
# version.
#
# This software 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 package; see the file COPYING. If not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#
#--code--
export TEXTDOMAIN=aur-install
export TEXTDOMAINDIR=../locale
#export TEXTDOMAINDIR=/usr/local/share/locale
. gettext.sh
. ./functions
set -e
if ! check_root ; then
PROGNAME=$0
echo $(eval_gettext "Script must be run as root, try: sudo \$PROGNAME") ; echo
exit 1
fi
packagelist=
while getopts ':hl:' flag
do
case $flag in
h)
usage
exit 0
;;
l)
packagelist=$OPTARG
;;
:)
msg=$(gettext "Option requires an argument")
die '%s: %s -- '\''%s'\' "${0##*/}" "${msg}" "$OPTARG"
;;
?)
msg=$(gettext "Invalid option")
die '%s: %s -- '\''%s'\' "${0##*/}" "${msg}" "$OPTARG"
;;
esac
done
shift $(( OPTIND - 1 ))
(( $# )) || die "No root directory specified"
newroot=$1; shift
[[ -z "${packagelist}" ]] && die "No package list supplied"
[[ -f "${packagelist}" ]] || die "Package list ${packagelist} does not exist"
[[ -r "${packagelist}" ]] || die "Package list ${packagelist} is not readable"
# A temporary directory holding all build files should be created on the mounted image file.
# It must be owned by the regular user, which will be given the uid 1000.
# This whole directory will be removed once the AUR packages are installed.
mkdir -p "${newroot}/aur"
chown 1000 "${newroot}/aur"
# From the image chroot, Clone the package build information from the AUR, then build and install each package.
for package in $(cat "$packagelist"); do
systemd-nspawn -a -q -D "${newroot}" sudo -u \#1000 /bin/bash -c \
"{
cd /aur;
git clone https://aur.archlinux.org/${package}.git;
cd $package;
MAKEFLAGS=-j$(nproc) makepkg -d -A;
}"
systemd-nspawn -a -q -D "${newroot}" /bin/bash -c \
"{
# It is assumed that someone building an image knows what he/she is doing, and won't install AUR packages that make forced installations or dependency skips dangerous.
# That said, some packages have been found not to build properly unless forceably installed to overwrite conflicting files or certain dependencies are skipped.
cd /aur/$package;
yes | pacman -Udd *pkg.tar.xz --noprogressbar --force;
}"
done
# cleanup the working package build directory
rm -R "${newroot}/aur"
echo done
exit 0
+113
View File
@@ -0,0 +1,113 @@
#!/bin/bash
#
# config-base
#
# Copyright 2018, F123 Consulting, <information@f123.org>
# Copyright 2017, Mike Ray, <mike.ray@btinternet.com>
# Copyright 2018, Kyle, <kyle@free2.ml>
#
# This 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, or (at your option) any later
# version.
#
# This software 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 package; see the file COPYING. If not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#
#--code--
export TEXTDOMAIN=config-base
export TEXTDOMAINDIR=../locale
#export TEXTDOMAINDIR=/usr/local/share/locale
. gettext.sh
. ./functions
set -e
if ! check_root ; then
PROGNAME=$0
echo $(eval_gettext "Script must be run as root, try: sudo \$PROGNAME") ; echo
exit 1
fi
[ -z "${HOSTNAME_}" ] && HOSTNAME_=alarmpi
[ -z "${ROOTPWD}" ] && ROOTPWD=root
[ -z "${USERNAME}" ] && USERNAME=alarm
[ -z "${USERPWD}" ] && USERPWD=alarm
directory=0
while getopts ':adhl:o:p:r:u:' flag
do
case $flag in
d)
directory=1
;;
h)
usage
exit 0
;;
l)
locale=${OPTARG}
;;
o)
HOSTNAME_=${OPTARG}
;;
p)
USERPWD=${OPTARG}
;;
r)
ROOTPWD=${OPTARG}
;;
u)
USERNAME=${OPTARG}
;;
:)
msg=$(gettext "Option requires an argument")
die '%s: %s -- '\''%s'\' "${0##*/}" "${msg}" "$OPTARG"
;;
?)
msg=$(gettext "Invalid option")
die '%s: %s -- '\''%s'\' "${0##*/}" "${msg}" "$OPTARG"
;;
esac
done
shift $(( OPTIND - 1 ))
(( $# )) || die "No root directory specified"
newroot=$1; shift
[[ -d $newroot ]] || die "%s is not a directory" "$newroot"
# set the host name
input="echo \"${HOSTNAME_}\" > /etc/hostname"
echo "${input}"
chroot "${newroot}" /bin/bash -c "${input}"
# add root partition mount info to /etc/fstab
chroot "${newroot}" /bin/bash -c 'echo -e "\n\n/dev/mmcblk0p1 /boot vfat defaults 0 0\n\n" >> /etc/fstab'
set_password "${newroot}" root "${ROOTPWD}"
# Copy all modified files into the new system
cp -R ../files/* "${newroot}"
# Set the system locale
test -z $locale || set_locale "${newroot}" "${locale}"
# Add the regular user
add_user "${newroot}" "${USERNAME}"
set_password "${newroot}" "${USERNAME}" "${USERPWD}"
+418
View File
@@ -0,0 +1,418 @@
#
# functions
#
# Copyright 2018, F123 Consulting, <information@f123.org>
# Copyright 2017, Mike Ray, <mike.ray@btinternet.com>
# Copyright 2018, Kyle, <kyle@free2.ml>
# Copyright 2018, StormDragon, <storm_dragon@linux-a11y.org>
#
# This 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, or (at your option) any later
# version.
#
# This software 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 package; see the file COPYING. If not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#
#--code--
usage() {
scriptname=$0
echo $(gettext "Usage:")
echo "sudo $scriptname "
} >&2 # usage
out() {
printf "$1 $2\n" "${@:3}"
} # out
error() {
out "ERROR:" "$@"
} >&2 # error
die() {
error "$@"
usage
exit 1
} # die
check_deps () {
[ -f /usr/bin/parted ] || install_dep parted
[ -f /usr/bin/pacstrap ] || install_dep arch-install-scripts
[ -f /usr/bin/partx ] || pacman install_dep util-linux
[ -f /usr/bin/dbus-launch ] || install_dep dbus
} # check_deps
install_dep () {
local package=$1
echo $(eval_gettext "Installing ${package}...")
pacman -S $package --noconfirm --noprogressbar >/dev/null
} # install_dep
add_groups() {
local chroot_=$1
# input array holds commands to be ran inside chroot.
input=(
"groupadd --system input;"
"groupadd --system uinput;"
"groupadd --system pulse;"
"groupadd --system pulse-access;"
"useradd --system -g pulse -G audio -d /var/run/pulse -m -s /bin/nologin pulse;"
"gpasswd -a pulse lp;"
"gpasswd -a root pulse-access;"
"echo 'KERNEL==\"event*\", NAME=\"input/%k\", MODE=\"660\", GROUP=\"input\"' >> /etc/udev/rules.d/99-input.rules;"
"echo 'KERNEL==\"uinput\", SUBSYSTEM==\"misc\", OPTIONS+=\"static_node=uinput\", TAG+=\"uaccess\", GROUP=\"uinput\"' >> /etc/udev/rules.d/99-fenrirscreenreader.rules;"
"mkdir -p /var/log/fenrirscreenreader/;"
"chmod 755 /var/log/fenrirscreenreader/;"
"touch /var/log/fenrirscreenreader/fenrir.log;"
"chmod 662 /var/log/fenrirscreenreader/fenrir.log;"
)
chroot "${chroot_}" /bin/bash -c "${input[*]}" |& log
} # Add pulseaudio users and groups.
add_user() {
local chroot_=$1
local username=$2
echo $(eval_gettext "Add user \${username}")
input="useradd -m -g users -G wheel,storage,power,uucp,audio,games,pulse-access,lp,scanner,input,uinput -s /bin/bash ${username}"
chroot "${chroot_}" /bin/bash -c "${input}" |& log
} # add_user
set_password() {
local chroot_=$1
local username=$2
local userpwd=$3
echo $(eval_gettext "Setting password for user \${username}")
input="echo -e \"${userpwd}\n${userpwd}\n\" | passwd ${username}"
chroot "${chroot_}" /bin/bash -c "${input}"
} # set_password
setup_locales() {
local chroot=$1
shift
local defaultlocale=$1
shift
local locales=$@
for l in $locales; do
chroot $chroot /bin/sed -e "s/#${l}/${l}/" -i /etc/locale.gen
done
chroot $chroot /bin/bash -c locale-gen
echo LANG=$defaultlocale > ${chroot}/etc/locale.conf
echo LC_COLLATE=C >> ${chroot}/etc/locale.conf
} # setup_locales
setup_wifi() {
local root=$1
local iface=$2
local ap=$3
local pass=$4
# Create the systemd network file
mkdir -p $root/etc/systemd/network
cat > $root/etc/systemd/network/$iface.network <<-endOfFile
[Match]
Name=$iface
[Network]
DHCP=yes
endOfFile
# Configure wpa_supplicant
mkdir -p $root/etc/wpa_supplicant
cat > $root/etc/wpa_supplicant/wpa_supplicant-$iface.conf <<-endOfFile
ctrl_interface=/var/run/wpa_supplicant
eapol_version=1
ap_scan=1
fast_reauth=1
network={
ssid="$ap"
psk="$pass"
priority=1
}
endOfFile
# Enable networking and wifi related services
manage_service $root enable systemd-networkd
manage_service $root enable wpa_supplicant@$iface
manage_service $root enable systemd-resolved
# Remove any legacy version of resolv.conf and link the version from systemd-resolved
rm -f $root/etc/resolv.conf
chroot $root /bin/bash -c "ln -sf /var/run/systemd/resolve/resolv.conf /etc/resolv.conf"
} #setup_wifi
download_package_databases () {
local chroot=$1
# Be sure the full package database for all repositories has been downloaded
systemd-nspawn -a -q -D $1 pacman -Syy
} # download_package_databases
set_fake_hwclock () {
local chroot=$1
# Set an initial system time.
systemd-nspawn -a -q -D $1 /usr/lib/systemd/scripts/fake-hwclock.sh save
# Enable time sync
systemd-nspawn -a -q -D $1 timedatectl set-ntp true
}
manage_service() {
local chroot_=$1
local operation=$2
local service=$3
echo $(eval_gettext "Calling systemctl to \${operation} \${service} service")
systemd-nspawn -a -q -D "${chroot_}" systemctl "${operation}" "${service}"
} # manage_service
check_root() {
(( EUID == 0 )) || return 1
return 0
} # check_root
clean_up() {
local WORKDIR=${1}
if [ -f "${WORKDIR}/rpi-image-tool-mount-points" ]; then
unmount_partitions ${WORKDIR}
remove_mount_points ${WORKDIR}
if cat ${WORKDIR}/rpi-image-tool-mount-points | grep loop >/dev/null; then
remove_loop_devices ${WORKDIR}
fi
fi
rm ${WORKDIR}/rpi-image-tool-mount-points
} # clean_up
delete_partitions() {
local DEVICE=${1}
for PART in `parted -ms /dev/sda -- print | perl -ne "if (m/^\d/) {print;}" | cut -f1 -d':' | sort -r`
do
parted ${DEVICE} -- rm ${PART} >/dev/null
done
} # delete_partitions
loop_devices() {
local WORKDIR=${1}
local IMAGEFILE=${2}
local __BOOTP=${3}
local __ROOTP=${4}
echo $(gettext "Setting up the loop device") ; echo
LOOPDEVICE=$(losetup -P -f --show ${IMAGEFILE})
BOOTP=${LOOPDEVICE}p1
ROOTP=${LOOPDEVICE}p2
eval $__BOOTP="'$BOOTP'"
eval $__ROOTP="'$ROOTP'"
} # loop_devices
mount_device() {
local WORKDIR=${1}
local DEVICE=${2}
local ROOTMP=${3}
[ -b "${DEVICE}" ] || { echo "Supplied device name ${DEVICE} does not exist or is not a block device"; exit 1; }
echo $(gettext "Making the work directory if it doesn't exist") ; echo
[ -d "${WORKDIR}" ] || mkdir -p "${WORKDIR}"
BOOTP=${DEVICE}1
ROOTP=${DEVICE}2
mount_partitions ${WORKDIR} ${BOOTP} ${ROOTP} ${BOOTMP} ${ROOTMP}
} # mount_device
mount_image() {
local WORKDIR=${1}
local IMAGEFILE=${2}
local BOOTMP=${3}
local ROOTMP=${4}
[ -f "${IMAGEFILE}" ] || { echo "Supplied image file does not exist"; exit 1; }
echo $(gettext "Making the work directory if it doesn't exist") ; echo
[ -d "${WORKDIR}" ] || mkdir -p "${WORKDIR}"
loop_devices ${WORKDIR} ${IMAGEFILE} BOOTP ROOTP
mount_partitions ${WORKDIR} ${BOOTP} ${ROOTP} ${BOOTMP} ${ROOTMP}
} # mount_image
mount_partitions() {
local WORKDIR=${1}
local BOOTP=${2}
local ROOTP=${3}
local BOOTMP=${4}
local ROOTMP=${5}
echo $(gettext "Making the root mount point if it doesn't exist") ; echo
[ -d "${WORKDIR}/${ROOTMP}" ] || mkdir -p "${WORKDIR}/${ROOTMP}"
mount ${ROOTP} ${WORKDIR}/${ROOTMP}
echo $(gettext "Making the boot mount point if it doesn't exist") ; echo
[ -d "${WORKDIR}/${ROOTMP}/${BOOTMP}" ] || mkdir -p "${WORKDIR}/${ROOTMP}/${BOOTMP}"
mount ${BOOTP} ${WORKDIR}/${ROOTMP}/${BOOTMP}
echo $(eval_gettext "Writing mount-points to \$WORKDIR/rpi-image-tool-mount-points") ; echo
REALROOTMOUNTPOINT=$(realpath ${WORKDIR}/${ROOTMP})
REALBOOTMOUNTPOINT=$(realpath ${WORKDIR}/${ROOTMP}/${BOOTMP})
echo -e "1:${BOOTP}:${REALBOOTMOUNTPOINT}\n2:${ROOTP}:${REALROOTMOUNTPOINT}" > ${WORKDIR}/rpi-image-tool-mount-points
} # mount_partitions
new_image() {
local WORKDIR=${1}
local IMAGEFILE=${2}
local BOOTLABEL=${3}
local ROOTLABEL=${4}
local BOOTMP=${5}
local ROOTMP=${6}
local BLOCKCOUNT=${7}
local BLOCKSIZE=${8}
local SPLIT=${9}
echo $(gettext "Making the work directory if it doesn't exist") ; echo
[ -d ${WORKDIR} ] || mkdir -p "${WORKDIR}"
echo $(gettext "Running dd to make a raw (zero-filled) image") ; echo
dd if=/dev/zero of=${IMAGEFILE} bs=${BLOCKSIZE} count=${BLOCKCOUNT}
echo $(gettext "Partitioning the raw image file") ; echo
parted "${IMAGEFILE}" --script -- mklabel msdos
echo $(gettext "Making the boot partition") ; echo
parted "${IMAGEFILE}" --script -- mkpart primary fat32 1 ${SPLIT}
echo $(gettext "Setting the boot partition bootable") ; echo
parted "${IMAGEFILE}" --script set 1 boot on
echo $(gettext "Making the root partition") ; echo
parted "${IMAGEFILE}" --script -- mkpart primary ext4 ${SPLIT} -1
local BOOTP
local ROOTP
loop_devices ${WORKDIR} ${IMAGEFILE} BOOTP ROOTP
echo $(eval_gettext "Boot partition is \$BOOTP") ; echo
echo $(eval_gettext "Root partition is \$ROOTP}") ; echo
echo $(gettext "Making file systems") ; echo
mkfs.vfat -n ${BOOTLABEL} ${BOOTP}
mkfs.ext4 -L ${ROOTLABEL} ${ROOTP}
mount_partitions ${WORKDIR} ${BOOTP} ${ROOTP} ${BOOTMP} ${ROOTMP}
} # new_image
prepare_device() {
local WORKDIR=${1}
local DEVICE=${2}
local BOOTMP=${3}
local ROOTMP=${4}
local BLOCKCOUNT=${5}
local BLOCKSIZE=${6}
local SPLIT=${7}
echo $(gettext "Making the work directory if it doesn't exist") ; echo
[ -d ${WORKDIR} ] || mkdir -p "${WORKDIR}"
echo $("Partitioning the device") ; echo
parted "${DEVICE}" --script -- mklabel msdos
echo $(gettext "Making the boot partition...") ; echo
parted "${DEVICE}" --script -- mkpart primary fat32 1 ${SPLIT}
echo $(gettext "Setting the boot partition bootable") ; echo
parted "${DEVICE}" --script set 1 boot on
echo $(gettext "Making the root partition") ; echo
parted "${DEVICE}" --script -- mkpart primary ext4 ${SPLIT} -1
echo $(eval_gettext "Boot partition is \${DEVICE}1") ; echo
echo $(eval_gettext "Root partition is \${DEVICE}2") ; echo
echo $(gettext "Making file systems") ; echo
mkfs.vfat ${DEVICE}1
mkfs.ext4 ${DEVICE}2
mount_partitions ${WORKDIR} ${DEVICE}1 ${DEVICE}2 ${BOOTMP} ${ROOTMP}
} # prepare_device
remove_loop_devices() {
local WORKDIR=${1}
echo $(gettext "Removing loop devices") ; echo
FIRSTPART=$(head -1 ${WORKDIR}/rpi-image-tool-mount-points | cut -f2 -d:)
LOOP=${FIRSTPART%%p1}
echo $(eval_gettext "Removing loop device \${LOOP}") ; echo
losetup -d "${LOOP}"
} # remove_loop_devices
remove_mount_points() {
local WORKDIR=${1}
[ -f ${WORKDIR}/rpi-image-tool-mount-points ] || { echo "${WORKDIR}/rpi-image-tool-mount-points does not exist" ; exit 1 ; }
cat ${WORKDIR}/rpi-image-tool-mount-points | cut -f3 -d: | \
while read MOUNTPOINT
do
echo $(eval_gettext "Removing \$MOUNTPOINT") ; echo
[ -d "${MOUNTPOINT}" ] && rmdir "${MOUNTPOINT}"
done
} # remove_mount_points
unmount_partitions() {
local WORKDIR=${1}
if [ ! -f "${WORKDIR}/rpi-image-tool-mount-points" ]; then
echo $(gettext "Could not find the file rpi-image-tool-mount-points in the work directory") ; echo
exit 1
fi
echo $(gettext "umount partitions") ; echo
cat ${WORKDIR}/rpi-image-tool-mount-points | cut -f3 -d: | \
while read MOUNTPOINT
do
echo $(eval_gettext "umount \$MOUNTPOINT") ; echo
umount "${MOUNTPOINT}"
done
} # unmount partitions
validate_blockcount() {
echo "$BLOCKCOUNT" | grep "^[0-9][0-9]*$" >/dev/null
if [ $? -eq 1 ]; then
echo $(gettext "Bad block count") ; echo
usage
fi
} # validate_blockcount
validate_blocksize() {
declare -r BLOCKSIZE=${1}
case "$BLOCKSIZE" in
'1M'|'1MB')
;;
*)
echo $(gettext "Invalid block-size") ; echo
usage
exit 1
;;
esac
} # validate_blocksize
validate_mountpoint() {
declare -r MOUNTPOINT=${1}
echo $MOUNTPOINT | grep "^[\./A-Za-z0-9\-][\.A-Za-z0-9\-]*" >/dev/null
if [ $? -eq 1 ]; then
echo $(gettext "Bad mount-point") ; echo
exit 1
fi
} # validate_mountpoint
validate_split() {
local SPLIT=${1}
echo "${SPLIT}" | grep "^[0-9][0-9]*$" >/dev/null
if [ $? -eq 1 ]; then
echo $(gettext "Bad split") ; echo
usage
fi
} # validate_split
+68
View File
@@ -0,0 +1,68 @@
#!/bin/bash
# Gsettings commands to enable desktop accessibility and the Orca screen reader
#
# gsettings
#
# Copyright 2018, F123 Consulting, <information@f123.org>
# Copyright 2018, Kyle, <kyle@free2.ml>
#
# This is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free
# Software Foundation; either version 3, or (at your option) any later
# version.
#
# This software 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 package; see the file COPYING. If not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#
#--code--
export TEXTDOMAIN=gsettings
export TEXTDOMAINDIR=../locale
. gettext.sh
set -e
# Load the common functions
. ./functions
# Die if not running with root privileges
if ! check_root ; then
PROGNAME=$0
echo $(eval_gettext "Script must be run as root, try: sudo \$PROGNAME") ; echo
exit 1
fi
# die if this script is called with no argument.
if [ -z $1 ]; then
echo No root specified
exit 1
fi
# Die if called with more than one argument
if [ $2 ]; then
echo Too many arguments
exit 1
fi
newroot=$1
# turn on MATE accessibility
systemd-nspawn -a -q -D "${newroot}" sudo -u \#1000 /bin/bash -c "dbus-launch gsettings set org.mate.interface accessibility true"
#pkill -n dbus-daemon
# Make Orca start automatically
systemd-nspawn -a -q -D "${newroot}" sudo -u \#1000 /bin/bash -c "dbus-launch gsettings set org.gnome.desktop.a11y.applications screen-reader-enabled true"
#pkill -n dbus-daemon
# Disable screen locking by default
systemd-nspawn -a -q -D "$newroot" sudo -u \#1000 /bin/bash -c "dbus-launch gsettings set org.mate.screensaver lock-enabled false"
#pkill -n dbus-daemon
+105
View File
@@ -0,0 +1,105 @@
#!/bin/bash
#
# pacstrap
#
# Copyright 2018, F123 Consulting, <information@f123.org>
# Copyright 2017, Mike Ray, <mike.ray@btinternet.com>
# Copyright 2018, Kyle, <kyle@free2.ml>
#
# This 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, or (at your option) any later
# version.
#
# This software 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 package; see the file COPYING. If not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#
#--code--
export TEXTDOMAIN=pacstrap
export TEXTDOMAINDIR=../locale
#export TEXTDOMAINDIR=/usr/local/share/locale
. gettext.sh
. ./functions
set -e
if ! check_root ; then
PROGNAME=$0
echo $(eval_gettext "Script must be run as root, try: sudo \$PROGNAME") ; echo
exit 1
fi
cache=
directory=0
packagelist=
while getopts ':c:dhl:' flag
do
case $flag in
c)
cache="--cachedir=$OPTARG"
;;
d)
directory=1
;;
h)
usage
exit 0
;;
l)
packagelist=$OPTARG
;;
:)
msg=$(gettext "Option requires an argument")
die '%s: %s -- '\''%s'\' "${0##*/}" "${msg}" "$OPTARG"
;;
?)
msg=$(gettext "Invalid option")
die '%s: %s -- '\''%s'\' "${0##*/}" "${msg}" "$OPTARG"
;;
esac
done
shift $(( OPTIND - 1 ))
(( $# )) || die "No root directory specified"
newroot=$1; shift
[[ -z "${packagelist}" ]] && die "No package list supplied"
[[ -f "${packagelist}" ]] || die "Package list ${packagelist} does not exist"
[[ -r "${packagelist}" ]] || die "Package list ${packagelist} is not readable"
mapfile -t softwareList < <(sed -e 's/\([[:space:]a-zA-Z0-9_.\+-]*\).*/\1/g' -e 's/^ *//' -e 's/ .*//' -e '/\(^\s*[[:punct:]]\|^$\)/d' "$packagelist")
[[ -d $newroot ]] || die "%s is not a directory" "$newroot"
if ! mountpoint -q "${newroot}" && (( ! directory )); then
die '%s is not a mountpoint!' "$newroot"
fi
if (( directory )) ; then
echo "Pacstrapping in ${newroot} directory"
optiond='-d'
else
echo "Pacstrapping in ${newroot} mount-point"
fi
pacstrap -C ../pacman/pacman.rpi.conf ${optiond} "${newroot}" $cache --needed --noprogressbar "${softwareList[@]}"
echo done
exit 0
+156
View File
@@ -0,0 +1,156 @@
#!/bin/bash
#
# rpi-image-tool
#
# Copyright 2017, Mike Ray, <mike.ray@btinternet.com>
# Copyright 2018, F123 Consulting, <information@f123.org>
#
# This 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, or (at your option) any later
# version.
#
# This software 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 package; see the file COPYING. If not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#
#--code--
export TEXTDOMAIN=rpi-image-tool
#export TEXTDOMAINDIR=$PWD/locale
export TEXTDOMAINDIR=./locale
. gettext.sh
. ./functions
usage() {
USAGE=$(gettext "tool_usage")
echo -e "${USAGE}"
}
#-- Main code
if ! check_root ; then
PROGNAME=$0
echo $(eval_gettext "Script must be run as root, try: sudo \$PROGNAME") ; echo
exit 1
fi
WORKDIR=
IMAGEFILE=
FUNCTION=
SPLIT=64
BLOCKSIZE=1M
BLOCKCOUNT=
BOOTLABEL=RPi-Boot
ROOTLABEL=RPi-Root
BOOTMOUNTPOINT=boot
ROOTMOUNTPOINT=root
while getopts ':C:D:M:N:b:c:hr:s:w:z:' flag ; do
case $flag in
h)
usage
exit 0
;;
C)
FUNCTION=cleanup
WORKDIR=${OPTARG}
break 2
;;
D)
FUNCTION=mountdevice
DEVICE=${OPTARG}
;;
M)
FUNCTION=mountimage
IMAGEFILE=${OPTARG}
;;
N)
FUNCTION=new
IMAGEFILE=${OPTARG}
;;
c)
BLOCKCOUNT=${OPTARG}
validate_blockcount ${BLOCKCOUNT}
;;
s)
SPLIT=${OPTARG}
validate_split ${SPLIT}
;;
b)
BOOTLABEL="${OPTARG}"
;;
r)
ROOTLABEL="${OPTARG}"
;;
w)
WORKDIR=${OPTARG}
;;
z)
BLOCKSIZE=${OPTARG}
validate_blocksize ${BLOCKSIZE}
;;
(?)
echo $(gettext "Invalid option") >&2
echo >&2
usage
exit 1
;;
:)
echo $(eval_gettext "Option - \$OPTARG requires an argument.") >&2
echo >&2
usage
exit 1
;;
esac
done
[ -z ${WORKDIR} ] && { echo $(gettext "Work directory not set") ; echo ; usage; exit 1 ; }
if [ ${FUNCTION} = 'mountimage' ] || [ $FUNCTION = 'new' ]; then
[ -z "${IMAGEFILE}" ] && { echo $(gettext "Image file name not set") ; echo ; usage; exit 1 ; }
fi
if [ ${FUNCTION} = 'mountdevice' ]; then
[ -z "${DEVICE}" ] && { echo $(gettext "Device name not set") ; echo ; usage ; exit 1 ; }
fi
if [ ${FUNCTION} = 'new' ]; then
[ -z ${BLOCKCOUNT} ] && { echo $(gettext "Block count not set") ; echo ; usage ; exit 1 ; }
[ -z ${BLOCKSIZE} ] && { echo $(gettext "Block size not set") ; echo ; usage ; exit 1 ; }
[ -z ${SPLIT} ] && { echo $(gettext "Split size not set") ; echo ; usage ; exit 1 ; }
fi
case ${FUNCTION} in
cleanup)
clean_up ${WORKDIR}
# ${BOOTMP} ${ROOTMP}
;;
mountimage)
mount_image ${WORKDIR} ${IMAGEFILE} ${BOOTMOUNTPOINT} ${ROOTMOUNTPOINT}
;;
mountdevice)
mount_device ${WORKDIR} ${DEVICE} ${BOOTMOUNTPOINT} ${ROOTMOUNTPOINT}
;;
new)
new_image ${WORKDIR} ${IMAGEFILE} ${BOOTLABEL} ${ROOTLABEL} ${BOOTMOUNTPOINT} ${ROOTMOUNTPOINT} ${BLOCKCOUNT} ${BLOCKSIZE} ${SPLIT}
;;
esac
exit 0
+48
View File
@@ -0,0 +1,48 @@
#!/bin/bash
#
# config-base
#
# Copyright 2018, F123 Consulting, <information@f123.org>
# Copyright 2018, Kyle, <kyle@free2.ml>
#
# This 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, or (at your option) any later
# version.
#
# This software 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 package; see the file COPYING. If not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#
#--code--
export TEXTDOMAIN=services-enable
export TEXTDOMAINDIR=../locale
#export TEXTDOMAINDIR=/usr/local/share/locale
. gettext.sh
. ./functions
set -e
if ! check_root ; then
PROGNAME=$0
echo $(eval_gettext "Script must be run as root, try: sudo \$PROGNAME") ; echo
exit 1
fi
# Take the system root as the first argument and then chuck it. All the rest of the command line arguments will be treated as services to be enabled.
newroot=$1
shift
# Take each service and enable it.
for SERVICE in $@; do
manage_service "${newroot}" enable "${SERVICE}"
done
+19
View File
@@ -0,0 +1,19 @@
#!/bin/bash
xgettext -L Shell -o - \
bootstrap-f123pi \
pacstrap-f123pi \
pacstrap-f123pi.lib \
config-base-f123pi | \
sed -e 's|YEAR|2017|' \
-e 's|=CHARSET|=UTF-8|' \
-e 's|SOME DESCRIPTIVE TITLE|bootstrap-f123pi|' \
-e "s|THE PACKAGE'S COPYRIGHT HOLDER|Mike Ray|" \
-e 's|FIRST AUTHOR|Mike Ray|' \
-e 's|EMAIL@ADDRESS|mike.ray@btinternet.com|' \
-e 's|PACKAGE VERSION|0.1.0alpha|' \
-e 's|FULL NAME|Mike Ray|' \
> bootstrap-f123pi.pot
+19
View File
@@ -0,0 +1,19 @@
#!/bin/bash
xgettext -L Shell -o - \
bootstrap-f123pi \
pacstrap-f123pi \
pacstrap-f123pi.lib \
config-base-f123pi | \
sed -e 's|YEAR|2017|' \
-e 's|=CHARSET|=UTF-8|' \
-e 's|SOME DESCRIPTIVE TITLE|bootstrap-f123pi|' \
-e "s|THE PACKAGE'S COPYRIGHT HOLDER|Mike Ray|" \
-e 's|FIRST AUTHOR|Mike Ray|' \
-e 's|EMAIL@ADDRESS|mike.ray@btinternet.com|' \
-e 's|PACKAGE VERSION|0.1.0alpha|' \
-e 's|FULL NAME|Mike Ray|' \
> bootstrap-f123pi.pot
+197
View File
@@ -0,0 +1,197 @@
# Shell Internationalization Workflow
To provide translations for shell scripts we use the gettext package.
## Preparing a Shell Script for Translation
Shell scripts contain `echo` commands to provide user feedback.
We need for the strings displayed by an `echo` command to be displayed in the language the user of
the machine is using.
In the top of the script we put these lines:
export TEXTDOMAIN=myscript
export TEXTDOMAINDIR=/usr/share/locale
. gettext.sh
In the above example `myscript` is an example script name.
The `TEXTDOMAINDIR` above contains the usual path to localization for a typical Linux installation.
It may be raplaced with:
export TEXTDOMAINDIR=$PWD/locale
For testing a script's translation.
The script author changes typical `cho` of this syntax:
echo 'Press any key to continue'
With:
echo $(gettext "Press any key to continue") ; echo
We place an extra `echo` with no arguments at the end because the `gettext` function does not add a line-feed.
The `gettext` function is contained in the `gettext.sh` script included at the top of the script.
If an echoed string contains any shell variables they must be replaced.
For example:
echo "Program name: $0"
Becomes:
PROGNAME=$0
echo $(eval_gettext "Prog name: \$PROGNAME") ; echo
The `eval_gettext` function is used instead of `gettext` and the dolla-sign is `escaped` with a
back-slash.
Again an extra `echo` is put in after the command to echo a translated string.
## Extracting Strings into a Portable Object Template (.pot)
Now we run `xgettext` against our script to create a file of strings to translate.
We do this in this fashion:
xgettext -L Shell -o myscript.pot myscript
This reads all the `echo` commands which contain references to the `gettext` and `eval_gettext` functions and writes them to a `.pot` (portable object template) file.
Here is a simple example of the contents of a `.pot` file for a script which contains only one `echo` command:
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-19 22:52+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#
#: myscript:10
#, sh-format
msgid "Hello world: $PROGNAME"
msgstr ""
In the above example there are values in upper-case at the top in the comments which should be filled out with the details of the package-name, and the author details etc.
And this line:
"Content-Type: text/plain; charset=CHARSET\n"
Should be changed to read:
"Content-Type: text/plain; charset=UTF-8\n"
Or whichever character-set we are using.
## The Translation Process
The first-cut `.pot` file should be passed to a translator with the name changed to drop the ending `t`:
cp myscript.pot myscript.po
Now give the `.po` (portable object) file to a translator.
After the line which reads:
"Content-Transfer-Encoding: 8bit\n"
There will be entries of the form:
msgid "Some string in the original language"
msgstr ""
A translator places the translation of the string in the `msgid` entry in the `msgstr` entry between the quotes.
The translator _MUST_ preserve any shell variable reference that is in the original string. For example:
msgid "Attention! $ERRORCODE"
msgstr "Achtung! $ERRORCODE"
In this way a translator goes right through the file and translates the strings, leaving the `msgid` entries as-is, and placing their translations in the corresponding `msgstr` entries.
## Creating `Machine Object` Files
The files which will actually be used when a script runs, to provide translated strings is a `.mo` file.
We create this from a `.po` file like this:
msgfmt -o myscript.mo myscript.po
Which will create `myscript.mo` from `myscript.po`.
## Merging New Strings
Of course the development of a complex script is never static and it may be necessary to add new strings, or to remove old ones. We can use another utility to `merge` strings from a new `.pot` file into our `.po` file and re-create our `.mo` file.
For this we use `msgmerge`, like this:
msgmerge -U myscript.po myscript.pot
This will search the `.pot` file for new or deleted strings and merge them into the `.po` file. In this way previous translation work is not lost when things change.
And again we then create a new `.mo` file from the update `.po` file.
## Installing a Translation
Using our `myscript` example from above, the `.mo` file is installed in:
/usr/share/locale/<LANG>/LC_MESSAGES/myscript.mo
Where <ALANG> is the language into which the script has been translated.
For example, for Brazilian Portuguese:
/usr/share/locale/pt_BR/LC_MESSAGES/myscript.mo
## The Worklow in Short
1. Script is written and tested, including gettext support.
2. Run `xgettext` to extract all `echo` strings into a `.pot` file.
3. Rename the `.pot` file to `.po` and pass to translator.
4. When step 3 is done, run `msgfmt` to create the `.mo` file.
5. Install the `.mo` file (after testing).
6. If something new is written in the script, go to step 2 and repeat to step 5.
## Notes/Suggestions
The `.po` files to be translated should probably either be contained in a directory structure which clearly defines the language, or should contain the language in the file-name, although the completed `.mo` file cannot.
So, for `myscript`, perhaps:
myscript/
en/myscript.en.po (English)
fr/myscript.fr.po (French)
pt_BR/myscript.pt_BR.po (Brazilian Portuguese)
## License
This document is licensed under the creativecommons.org, 'Attribution-NonCommercial-ShareAlike 4.0
International' license:
https://creativecommons.org/licenses/by-nc-sa/4.0/
2017 Mike Ray, <mike.ray@btinternet.com>
+112
View File
@@ -0,0 +1,112 @@
# Building an Image in Stages #
This document describes how to use the build stage scripts to perform a more manual build.
# Introduction #
Normally, in order to build an F123Light image for a Raspberry Pi computer, the script at build/build.sh is used, along with the configuration file that has the desired options configured. *See README.md at the top level of this repository for full documentation of the automated build process.* This document describes a more manual build that offers better control of the build process by using the stage scripts in build/scripts individually, using command line options rather than a configuration file. It is assumed that each script will be called from the build/scripts directory in this repository. Each script must be run as root, either as the logged in user or via sudo. Script calls in this document are written for sudo users; if not using sudo, just remove sudo from the beginning of the command line. It is also recommended that these scripts be called in the order listed below, but the build system is tolerant of some deviations from this order, as well as multiple calls in some cases. For example, it is possible to run gsettings either before or after aur-install, but the non-root user is required in order to build AUR packages or set gsettings keys, so config-base must run before either aur-install or gsettings. On the other hand, pacstrap may run any number of times using the same mount point, at any point in the build process, as long as its first run comes before config-base, as config-base requires at least a minimal system to be installed.
# rpi-image-tool #
This script creates, mounts, unmounts and manipulates two-partition Raspberry Pi image files.
## usage ##
./rpi-image-tool -h
sudo ./rpi-image-tool <operation> <argument> [options]
## Operations, arguments and options ##
**-N <imagefile> -w <workdirectory> -c <blockcount> [-z blocksize] [-s <split>] [-b <bootlabel>] [-r <rootlabel>]**
Create a new image with the given filename and parameters, then mount it.
*-w <workdirectory>*
The work directory where the image is mounted. Package caches are also stored under this directory.
*-z <blocksize>*
The block size used when writing the empty image file. May be a number of bytes or a number with a K, M or G suffix, representing kilobytes, megabytes or gigabytes. Default is 1MB.
*-c <count>*
The number of blocks to be written to the empty image file.
*-s <split>*
Determines the size of the boot partition. May be a number of bytes or a number of kilobytes, megabytes or gigabytes, suffixed by K, M or G. Default is 64MB.
*-b <bootlabel>*
Specify the volume label of the boot partition. Default is rpi-boot.
*-r <rootlabel>*
Specify the volume label of the root partition. Default is rpi-root.
**-M <imagefile> -w <workdirectory>**
Mount the specified image file under the specified work directory.
**-D <device> -w <workdirectory>**
Mount the specified device under the specified work directory. Device must be a two-partition Raspberry Pi image.
**-C <workdirectory>**
Unmount a mounted image and cleanup the specified work directory, with the exception of package caches, which are always preserved.
**-h**
Currently not fully implemented: display usage message.
# pacstrap #
This script installs packages to a mounted image or to the directory of your choice.
## Usage ##
./pacstrap -h
sudo ./pacstrap [-d] [-c <cachedirectory>] -l <packagelist> <systemroot>
## Options and Arguments ##
*-d*
Install packages to a directory rather than a mount point.
*-c <cachedirectory>*
Use <cachedirectory> to store the persistent package cache.
*-l <packagelist>*
Install all packages listed in <packagelist.
*<systemroot>*
The top level root of the installed system. Must be a mount point, unless *-d* is specified.
*-h*
Currently not fully implemented: display usage message.
# config-base #
Configures the base system, including the hostname, root password, non-root username/password and system services.
## Usage ##
./config-base -h
sudo ./config-base [-o <hostname] [-r <rootpassword>] [-l <locale>] [-u <username>] [-p <userpassword>] <systemroot>
## Options and Arguments ##
*-o <hostname>*
The hostname of the installed system. Default is alarmpi.
*-r <rootpassword>*
The password of the root user. Default is root.
*-l <locale>*
The system locale (must exist in /etc/locale.gen)
*-u <username>*
The username of the non-root user. Default is alarm.
*-p <userpassword>*
The password of the non-root user. Default is alarm.
*systemroot>*
The top level root of the installed system.
*-h*
Currently not fully implemented: display usage message.
# aur-install #
Builds and installs packages from the Arch User Repository (AUR), using the specified package list.
## Usage ##
./aur-install -h
sudo ./aur-install -l <packagelist> <systemroot>
## Options and arguments ##
*-l <packagelist>*
The file containing the list of packages to be built and installed.
*<systemroot>*
The top level root directory of the installed system.
*-h*
Currently not fully implemented: display usage message.
# services-enable #
Enables the specified systemd services in the specified system root.
## Usage ##
sudo ./services-enable <systemroot> <service> [service ...]
## Arguments ##
*<systemroot>*
The top level root directory of the installed system.
*<service> [service ...]*
One or more services to be enabled at boot time. All services must exist on the system image, as systemd is used to enable each service inside of a chroot.
# gsettings #
Sets various gsettings keys. This script must only be run if a gsettings compatible desktop has been installed.
## usage ##
sudo ./gsettings <systemroot>
## Options and Arguments ##
*<systemroot>*
The top level root directory of the installed system.
View File
View File
View File