parent
4d25c4e1ff
commit
22f7f75d8d
@ -0,0 +1,340 @@ |
||||
GNU GENERAL PUBLIC LICENSE |
||||
Version 2, June 1991 |
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc. |
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
||||
Everyone is permitted to copy and distribute verbatim copies |
||||
of this license document, but changing it is not allowed. |
||||
|
||||
Preamble |
||||
|
||||
The licenses for most software are designed to take away your |
||||
freedom to share and change it. By contrast, the GNU General Public |
||||
License is intended to guarantee your freedom to share and change free |
||||
software--to make sure the software is free for all its users. This |
||||
General Public License applies to most of the Free Software |
||||
Foundation's software and to any other program whose authors commit to |
||||
using it. (Some other Free Software Foundation software is covered by |
||||
the GNU Lesser General Public License instead.) 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 |
||||
this service 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 make restrictions that forbid |
||||
anyone to deny you these rights or to ask you to surrender the rights. |
||||
These restrictions translate to certain responsibilities for you if you |
||||
distribute copies of the software, or if you modify it. |
||||
|
||||
For example, if you distribute copies of such a program, whether |
||||
gratis or for a fee, you must give the recipients all the rights that |
||||
you have. 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. |
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and |
||||
(2) offer you this license which gives you legal permission to copy, |
||||
distribute and/or modify the software. |
||||
|
||||
Also, for each author's protection and ours, we want to make certain |
||||
that everyone understands that there is no warranty for this free |
||||
software. If the software is modified by someone else and passed on, we |
||||
want its recipients to know that what they have is not the original, so |
||||
that any problems introduced by others will not reflect on the original |
||||
authors' reputations. |
||||
|
||||
Finally, any free program is threatened constantly by software |
||||
patents. We wish to avoid the danger that redistributors of a free |
||||
program will individually obtain patent licenses, in effect making the |
||||
program proprietary. To prevent this, we have made it clear that any |
||||
patent must be licensed for everyone's free use or not licensed at all. |
||||
|
||||
The precise terms and conditions for copying, distribution and |
||||
modification follow. |
||||
|
||||
GNU GENERAL PUBLIC LICENSE |
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION |
||||
|
||||
0. This License applies to any program or other work which contains |
||||
a notice placed by the copyright holder saying it may be distributed |
||||
under the terms of this General Public License. The "Program", below, |
||||
refers to any such program or work, and a "work based on the Program" |
||||
means either the Program or any derivative work under copyright law: |
||||
that is to say, a work containing the Program or a portion of it, |
||||
either verbatim or with modifications and/or translated into another |
||||
language. (Hereinafter, translation is included without limitation in |
||||
the term "modification".) Each licensee is addressed as "you". |
||||
|
||||
Activities other than copying, distribution and modification are not |
||||
covered by this License; they are outside its scope. The act of |
||||
running the Program is not restricted, and the output from the Program |
||||
is covered only if its contents constitute a work based on the |
||||
Program (independent of having been made by running the Program). |
||||
Whether that is true depends on what the Program does. |
||||
|
||||
1. You may copy and distribute 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 and disclaimer of warranty; keep intact all the |
||||
notices that refer to this License and to the absence of any warranty; |
||||
and give any other recipients of the Program a copy of this License |
||||
along with the Program. |
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and |
||||
you may at your option offer warranty protection in exchange for a fee. |
||||
|
||||
2. You may modify your copy or copies of the Program or any portion |
||||
of it, thus forming a work based on the Program, and copy and |
||||
distribute such modifications or work under the terms of Section 1 |
||||
above, provided that you also meet all of these conditions: |
||||
|
||||
a) You must cause the modified files to carry prominent notices |
||||
stating that you changed the files and the date of any change. |
||||
|
||||
b) You must cause any work that you distribute or publish, that in |
||||
whole or in part contains or is derived from the Program or any |
||||
part thereof, to be licensed as a whole at no charge to all third |
||||
parties under the terms of this License. |
||||
|
||||
c) If the modified program normally reads commands interactively |
||||
when run, you must cause it, when started running for such |
||||
interactive use in the most ordinary way, to print or display an |
||||
announcement including an appropriate copyright notice and a |
||||
notice that there is no warranty (or else, saying that you provide |
||||
a warranty) and that users may redistribute the program under |
||||
these conditions, and telling the user how to view a copy of this |
||||
License. (Exception: if the Program itself is interactive but |
||||
does not normally print such an announcement, your work based on |
||||
the Program is not required to print an announcement.) |
||||
|
||||
These requirements apply to the modified work as a whole. If |
||||
identifiable sections of that work are not derived from the Program, |
||||
and can be reasonably considered independent and separate works in |
||||
themselves, then this License, and its terms, do not apply to those |
||||
sections when you distribute them as separate works. But when you |
||||
distribute the same sections as part of a whole which is a work based |
||||
on the Program, the distribution of the whole must be on the terms of |
||||
this License, whose permissions for other licensees extend to the |
||||
entire whole, and thus to each and every part regardless of who wrote it. |
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest |
||||
your rights to work written entirely by you; rather, the intent is to |
||||
exercise the right to control the distribution of derivative or |
||||
collective works based on the Program. |
||||
|
||||
In addition, mere aggregation of another work not based on the Program |
||||
with the Program (or with a work based on the Program) on a volume of |
||||
a storage or distribution medium does not bring the other work under |
||||
the scope of this License. |
||||
|
||||
3. You may copy and distribute the Program (or a work based on it, |
||||
under Section 2) in object code or executable form under the terms of |
||||
Sections 1 and 2 above provided that you also do one of the following: |
||||
|
||||
a) Accompany it with the complete corresponding machine-readable |
||||
source code, which must be distributed under the terms of Sections |
||||
1 and 2 above on a medium customarily used for software interchange; or, |
||||
|
||||
b) Accompany it with a written offer, valid for at least three |
||||
years, to give any third party, for a charge no more than your |
||||
cost of physically performing source distribution, a complete |
||||
machine-readable copy of the corresponding source code, to be |
||||
distributed under the terms of Sections 1 and 2 above on a medium |
||||
customarily used for software interchange; or, |
||||
|
||||
c) Accompany it with the information you received as to the offer |
||||
to distribute corresponding source code. (This alternative is |
||||
allowed only for noncommercial distribution and only if you |
||||
received the program in object code or executable form with such |
||||
an offer, in accord with Subsection b above.) |
||||
|
||||
The source code for a work means the preferred form of the work for |
||||
making modifications to it. For an executable work, complete source |
||||
code means all the source code for all modules it contains, plus any |
||||
associated interface definition files, plus the scripts used to |
||||
control compilation and installation of the executable. However, as a |
||||
special exception, the source code distributed need not include |
||||
anything that is normally distributed (in either source or binary |
||||
form) with the major components (compiler, kernel, and so on) of the |
||||
operating system on which the executable runs, unless that component |
||||
itself accompanies the executable. |
||||
|
||||
If distribution of executable or object code is made by offering |
||||
access to copy from a designated place, then offering equivalent |
||||
access to copy the source code from the same place counts as |
||||
distribution of the source code, even though third parties are not |
||||
compelled to copy the source along with the object code. |
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program |
||||
except as expressly provided under this License. Any attempt |
||||
otherwise to copy, modify, sublicense or distribute the Program is |
||||
void, and will automatically terminate your rights under this License. |
||||
However, parties who have received copies, or rights, from you under |
||||
this License will not have their licenses terminated so long as such |
||||
parties remain in full compliance. |
||||
|
||||
5. You are not required to accept this License, since you have not |
||||
signed it. However, nothing else grants you permission to modify or |
||||
distribute the Program or its derivative works. These actions are |
||||
prohibited by law if you do not accept this License. Therefore, by |
||||
modifying or distributing the Program (or any work based on the |
||||
Program), you indicate your acceptance of this License to do so, and |
||||
all its terms and conditions for copying, distributing or modifying |
||||
the Program or works based on it. |
||||
|
||||
6. Each time you redistribute the Program (or any work based on the |
||||
Program), the recipient automatically receives a license from the |
||||
original licensor to copy, distribute or modify the Program subject to |
||||
these terms and conditions. You may not impose any further |
||||
restrictions on the recipients' exercise of the rights granted herein. |
||||
You are not responsible for enforcing compliance by third parties to |
||||
this License. |
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent |
||||
infringement or for any other reason (not limited to patent issues), |
||||
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 |
||||
distribute so as to satisfy simultaneously your obligations under this |
||||
License and any other pertinent obligations, then as a consequence you |
||||
may not distribute the Program at all. For example, if a patent |
||||
license would not permit royalty-free redistribution of the Program by |
||||
all those who receive copies directly or indirectly through you, then |
||||
the only way you could satisfy both it and this License would be to |
||||
refrain entirely from distribution of the Program. |
||||
|
||||
If any portion of this section is held invalid or unenforceable under |
||||
any particular circumstance, the balance of the section is intended to |
||||
apply and the section as a whole is intended to apply in other |
||||
circumstances. |
||||
|
||||
It is not the purpose of this section to induce you to infringe any |
||||
patents or other property right claims or to contest validity of any |
||||
such claims; this section has the sole purpose of protecting the |
||||
integrity of the free software distribution system, which is |
||||
implemented by public license practices. Many people have made |
||||
generous contributions to the wide range of software distributed |
||||
through that system in reliance on consistent application of that |
||||
system; it is up to the author/donor to decide if he or she is willing |
||||
to distribute software through any other system and a licensee cannot |
||||
impose that choice. |
||||
|
||||
This section is intended to make thoroughly clear what is believed to |
||||
be a consequence of the rest of this License. |
||||
|
||||
8. If the distribution and/or use of the Program is restricted in |
||||
certain countries either by patents or by copyrighted interfaces, the |
||||
original copyright holder who places the Program under this License |
||||
may add an explicit geographical distribution limitation excluding |
||||
those countries, so that distribution is permitted only in or among |
||||
countries not thus excluded. In such case, this License incorporates |
||||
the limitation as if written in the body of this License. |
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions |
||||
of the 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 a version number of this License which applies to it and "any |
||||
later version", you have the option of following the terms and conditions |
||||
either of that version or of any later version published by the Free |
||||
Software Foundation. If the Program does not specify a version number of |
||||
this License, you may choose any version ever published by the Free Software |
||||
Foundation. |
||||
|
||||
10. If you wish to incorporate parts of the Program into other free |
||||
programs whose distribution conditions are different, write to the author |
||||
to ask for permission. For software which is copyrighted by the Free |
||||
Software Foundation, write to the Free Software Foundation; we sometimes |
||||
make exceptions for this. Our decision will be guided by the two goals |
||||
of preserving the free status of all derivatives of our free software and |
||||
of promoting the sharing and reuse of software generally. |
||||
|
||||
NO WARRANTY |
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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. |
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING |
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR |
||||
REDISTRIBUTE 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. |
||||
|
||||
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 |
||||
convey the exclusion of warranty; and each file should have at least |
||||
the "copyright" line and a pointer to where the full notice is found. |
||||
|
||||
<one line to give the program's name and a brief idea of what it does.> |
||||
Copyright (C) <year> <name of author> |
||||
|
||||
This program is free software; you can redistribute it and/or modify |
||||
it under the terms of the GNU General Public License as published by |
||||
the Free Software Foundation; either version 2 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, write to the Free Software |
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail. |
||||
|
||||
If the program is interactive, make it output a short notice like this |
||||
when it starts in an interactive mode: |
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author |
||||
Gnomovision 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, the commands you use may |
||||
be called something other than `show w' and `show c'; they could even be |
||||
mouse-clicks or menu items--whatever suits your program. |
||||
|
||||
You should also get your employer (if you work as a programmer) or your |
||||
school, if any, to sign a "copyright disclaimer" for the program, if |
||||
necessary. Here is a sample; alter the names: |
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program |
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker. |
||||
|
||||
<signature of Ty Coon>, 1 April 1989 |
||||
Ty Coon, President of Vice |
||||
|
||||
This 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. |
@ -0,0 +1,76 @@ |
||||
# umbrella mkimage-profiles makefile:
|
||||
# iterate over multiple goals/arches,
|
||||
# collect proceedings
|
||||
|
||||
# preferences
|
||||
-include $(HOME)/.mkimage/profiles.mk |
||||
|
||||
# for immediate assignment
|
||||
ifndef ARCH |
||||
ARCH := $(shell arch \
|
||||
| sed 's/i686/i586/; s/armv7.*/armh/; s/armv.*/arm/')
|
||||
endif |
||||
|
||||
ifndef ARCHES |
||||
ARCHES := $(ARCH)
|
||||
endif |
||||
|
||||
export ARCHES ARCH |
||||
|
||||
export PATH := $(CURDIR)/bin:$(PATH)
|
||||
|
||||
# recursive make considered useful for m-p
|
||||
MAKE += -r --no-print-directory
|
||||
|
||||
export DIRECT_TARGETS := help help/distro help/ve help/vm clean distclean check
|
||||
.PHONY: $(DIRECT_TARGETS) |
||||
|
||||
# these build nothing so no use of reports either
|
||||
$(DIRECT_TARGETS): |
||||
@$(MAKE) -f main.mk REPORT= $@
|
||||
|
||||
export NUM_TARGETS := $(words $(MAKECMDGOALS))
|
||||
|
||||
# for pipefail
|
||||
SHELL = /bin/bash
|
||||
|
||||
# don't even consider remaking a configuration file
|
||||
.PHONY: $(HOME)/.mkimage/profiles.mk |
||||
|
||||
# real targets need real work
|
||||
%: |
||||
@n=1; \
|
||||
set -o pipefail; \
|
||||
say() { echo "$$@" >&2; }; \
|
||||
if [ "$(NUM_TARGETS)" -gt 1 ]; then \
|
||||
n="`echo $(MAKECMDGOALS) \
|
||||
| tr '[[:space:]]' '\n' \
|
||||
| grep -nx "$@" \
|
||||
| cut -d: -f1`"; \
|
||||
say "** goal: $@ [$$n/$(NUM_TARGETS)]"; \
|
||||
else \
|
||||
say "** goal: $@"; \
|
||||
fi; \
|
||||
for ARCH in $(ARCHES); do \
|
||||
if [ -z "$(QUIET)" ]; then \
|
||||
if [ "$$ARCH" != "$(firstword $(ARCHES))" ]; then \
|
||||
say; \
|
||||
fi; \
|
||||
say "** ARCH: $$ARCH"; \
|
||||
fi; \
|
||||
if [ -n "$(REPORT)" ]; then \
|
||||
REPORT_PATH=$$(mktemp --tmpdir mkimage-profiles.report.XXXXXXX); \
|
||||
$(MAKE) -f main.mk ARCH=$$ARCH $@ | report-filter > $$REPORT_PATH || exit 1; \
|
||||
$(MAKE) -f reports.mk ARCH=$$ARCH REPORT=$(REPORT) REPORT_PATH=$$REPORT_PATH; \
|
||||
else \
|
||||
$(MAKE) -f main.mk ARCH=$$ARCH $@ || exit 1; \
|
||||
fi; \
|
||||
if [ -n "$(AUTOCLEAN)" ]; then $(MAKE) distclean; fi; \
|
||||
done; \
|
||||
if [ "$$n" -lt "$(NUM_TARGETS)" ]; then say; fi
|
||||
|
||||
docs: |
||||
@$(MAKE) -C doc
|
||||
|
||||
docs-publish: |
||||
@$(MAKE) -C doc publish
|
@ -0,0 +1,54 @@ |
||||
English quickstart: make syslinux.iso (after setting up |
||||
http://en.altlinux.org/Hasher; large tmpfs helps a lot). |
||||
|
||||
ััะตะฑัะตััั |
||||
~~~~~~~~~ |
||||
- ALT 8.0 ะธะปะธ ะฒััะต (ะฒะพะทะผะพะถะฝะฐ ะฐะดะฐะฟัะฐัะธั "ะฒะฝะธะท", ัะผ. ะฒะตัะบะธ) |
||||
- ัััะฐะฝะพะฒะปะตะฝะฝัะน mkimage (ัะฒะตะถะธะน, ะบะฐะบ ะธ hasher) |
||||
- ะฟะพะปัะทะพะฒะฐัะตะปั ั ะฟัะฐะฒะพะผ ะทะฐะฟััะบะฐ hasher ะธ ะฟะพะดะบะปััะตะฝะธั /proc ะบ ะฝะตะผั |
||||
|
||||
ะฟะพะปะตะทะฝะพ |
||||
~~~~~~~ |
||||
- ัะผะพะฝัะธัะพะฒะฐะฝะฝัะน tmpfs ะฝะฐ ะฝะตัะบะพะปัะบะพ ะณะธะณะฐะฑะฐะนั (ะธะปะธ ัะบะฐะถะธัะต BUILDDIR) |
||||
* ะฝะฐะฟัะธะผะตั, ะฒ /tmp ะธะปะธ /home/USER/hasher |
||||
* ะบะฐัะฐะปะพะณ ะธะท prefix ะฒ /etc/hasher-priv/system |
||||
- ัััะฐะฝะพะฒะปะตะฝะฝัะน git-core ะธ ะฝะฐัััะพะตะฝะฝัะน ~/.gitconfig |
||||
|
||||
ะบะพะผะฐะฝะดั |
||||
~~~~~~~ |
||||
ะพั ะธะผะตะฝะธ root:: |
||||
---- |
||||
# apt-get install mkimage mkimage-preinstall hasher git-core |
||||
# hasher-useradd USER |
||||
---- |
||||
|
||||
ะพั ะธะผะตะฝะธ ัะบะฐะทะฐะฝะฝะพะณะพ ะฟะพะปัะทะพะฒะฐัะตะปั (ะฟะพัะปะต ะฟะพะฒัะพัะฝะพะณะพ ะฒั
ะพะดะฐ):: |
||||
---- |
||||
$ git config --global user.email "my@email" |
||||
$ git config --global user.name "My Name" |
||||
$ mkdir -p ~/out ~/tmp |
||||
---- |
||||
|
||||
ัะตััะพะฒะฐั ัะฑะพัะบะฐ (ะฒ ะบะฐัะฐะปะพะณะต mkimage-profiles):: |
||||
---- |
||||
$ make syslinux.iso |
||||
---- |
||||
|
||||
ัะฟะธัะพะบ ะดะพัััะฟะฝัั
ัะตะปะตะน:: |
||||
---- |
||||
$ make help |
||||
---- |
||||
|
||||
ะฟะตัะตะผะตะฝะฝัะต, ะฒะปะธัััะธะต ะฝะฐ ัะตะทัะปััะฐั (ะฟะพะดัะพะฑะฝะตะต ะฒ doc/params.txt):: |
||||
--- |
||||
$ make ARCH=i586 APTCONF=~/apt/apt.conf.i586 REPORT=1 ve/generic.tar |
||||
--- |
||||
|
||||
ัััะปะบะธ |
||||
~~~~~~ |
||||
- http://www.altlinux.org/tmpfs |
||||
- http://www.altlinux.org/hasher |
||||
- http://www.altlinux.org/mkimage |
||||
- http://www.altlinux.org/m-p |
||||
- http://www.altlinux.org/m-p-howto ("ะบะฐะบ ะฟะพะฟัะฐะฒะธัั ะฟะพะด ัะตะฑั") |
||||
- http://www.altlinux.org/starterkits/builder (ัะฑะพัะพัะฝัะน LiveCD) |
@ -0,0 +1,84 @@ |
||||
== Welcome to m-p! == |
||||
|
||||
*Brief summary* |
||||
|
||||
Configurables: ~/.mkimage/profiles.mk; |
||||
see doc/params.txt and conf.d/README |
||||
|
||||
License: GPLv2+, see COPYING |
||||
|
||||
Most docs are in Russian, welcome to learn it or ask for English. |
||||
|
||||
ะะฐะดะฐัะฐ: |
||||
|
||||
* ะบะพะฝัะธะณััะธัะพะฒะฐะฝะธะต ะธ ัะพะทะดะฐะฝะธะต ะพะฑัะฐะทะพะฒ ะฝะฐ ะฑะฐะทะต ALT Linux |
||||
|
||||
ะะพะฝัะตะฟัะธั: |
||||
|
||||
* ะบะพะฝัะธะณััะฐัะธั, ะบะฐะบ ะธ ะพะฑัะฐะท -- ะพะฑัะตะบั ะฟะพััะฐะดะธะนะฝะพะน ัะฑะพัะบะธ |
||||
* ะผะตัะฐะฟัะพัะธะปั ัะปัะถะธั ัะตะฟะพะทะธัะพัะธะตะผ ะดะปั ะฟะพัััะพะตะฝะธั ะธะฝะดะธะฒะธะดัะฐะปัะฝะพะณะพ |
||||
ะฟัะพัะธะปั, ะฟะพ ะบะพัะพัะพะผั ัะพะทะดะฐัััั ะธัะพะณะพะฒัะน ะพะฑัะฐะท |
||||
|
||||
ะัะพะฑะตะฝะฝะพััะธ: |
||||
|
||||
* ะผะตัะฐะฟัะพัะธะปั ะฟัะธ ัะฑะพัะบะต ะผะพะถะตั ะฑััั ะดะพัััะฟะตะฝ ัะพะปัะบะพ ะฝะฐ ััะตะฝะธะต |
||||
* ะดะปั ัะฑะพัะบะธ ะฟะพะดััะบะธะฒะฐะตััั ะฟัะตะดะฟะพััะธัะตะปัะฝะพ tmpfs |
||||
* ะฒ ะฟัะพัะธะปั ะบะพะฟะธัััััั ัะพะปัะบะพ ะฝัะถะฝัะต ะพะฑัะตะบัั; |
||||
ะพะฝ ะฐะฒัะพะฝะพะผะตะฝ ะพัะฝะพัะธัะตะปัะฝะพ ะผะตัะฐะฟัะพัะธะปั |
||||
|
||||
ะกัะฐะดะธะธ ัะฐะฑะพัั: |
||||
|
||||
* ะธะฝะธัะธะฐะปะธะทะฐัะธั ัะฑะพัะพัะฝะพะณะพ ะฟัะพัะธะปั |
||||
* ัะฑะพัะบะฐ ะบะพะฝัะธะณััะฐัะธะธ ะพะฑัะฐะทะฐ |
||||
* ะฝะฐะฟะพะปะฝะตะฝะธะต ัะฑะพัะพัะฝะพะณะพ ะฟัะพัะธะปั |
||||
* ัะฑะพัะบะฐ ะพะฑัะฐะทะฐ |
||||
|
||||
ะะฑัะตะบัั: |
||||
|
||||
* ะดะธัััะธะฑััะธะฒั ะธ ะฒะธัััะฐะปัะฝัะต ััะตะดั/ะผะฐัะธะฝั: |
||||
** ะพะฟะธััะฒะฐัััั ะฒ conf.d/*.mk |
||||
** ะผะพะณัั ะพัะฝะพะฒัะฒะฐัััั ะฝะฐ ะฟัะตะดัะตััะฒะตะฝะฝะธะบะฐั
, ัะฐััะธััั ะธั
|
||||
** ะดะธัััะธะฑััะธะฒั ัะฐะบะถะต ะฒะบะปััะฐัั ะพะดะธะฝ ะธะปะธ ะฑะพะปะตะต ััะฑะฟัะพัะธะปะตะน ะฟะพ ะฝะฐะดะพะฑะฝะพััะธ |
||||
** ะถะตะปะฐัะตะปัะฝะพ ะธะทะฑะตะณะฐัั ะผะฝะพะถะตััะฒะตะฝะฝะพะณะพ ะฝะฐัะปะตะดะพะฒะฐะฝะธั, ัะผ. ัะถ. ัะธัะธ |
||||
|
||||
* ััะฑะฟัะพัะธะปะธ: |
||||
** ัะฟะธัะพะบ ัะพะฑะธัะฐะตััั ะฒ $(SUBPROFILES) |
||||
** ะฑะฐะทะพะฒัะต ะบะพะผะฟะปะตะบัั ะฟะพะผะตัะตะฝั ะฒ ะฟะพะดะบะฐัะฐะปะพะณะฐั
ะฟะพะด sub.in/; |
||||
ะธั
ะฝะฐะฑะพัั ัะบัะธะฟัะพะฒ ะผะพะณัั ัะฐััะธัััััั ัะธัะฐะผะธ |
||||
|
||||
* ัะธัะธ: |
||||
** ะทะฐะบะพะฝัะตะฝะฝัะต ะฑะปะพะบะธ ััะฝะบัะธะพะฝะฐะปัะฝะพััะธ (ะธะปะธ ะฝะฐะฑะพัั ัะฐะบะพะฒัั
) |
||||
** ะพะฟะธััะฒะฐัััั ะฒ ะธะฝะดะธะฒะธะดัะฐะปัะฝัั
features.in/*/config.mk |
||||
** ะผะพะณัั ััะตะฑะพะฒะฐัั ะดััะณะธะต ัะธัะธ, ะฐ ัะฐะบะถะต ััะฑะฟัะพัะธะปะธ |
||||
** ะฝะฐะบะพะฟะธัะตะปัะฝัะน ัะฟะธัะพะบ ัะพะฑะธัะฐะตััั ะฒ $(FEATURES) |
||||
** ะฟัะธ ัะฑะพัะบะต $(BUILDDIR) ัะพะดะตัะถะธะผะพะต ัะธั ะดะพะฑะฐะฒะปัะตััั ะฒ ะฟัะพัะธะปั |
||||
|
||||
* ัะฟะธัะบะธ ะฟะฐะบะตัะพะฒ (*_LISTS): |
||||
** _ะฒะฝะธะผะฐะฝะธะต_: ะฝะต ะฝะฐะดะพ ัะพะทะดะฐะฒะฐัั ัะธัั, ะตัะปะธ ะดะพััะฐัะพัะฝะพ ัะฟะธัะบะฐ ะฟะฐะบะตัะพะฒ! |
||||
** ะฟัะพััะฑะฐ ะฟะพ ะฒะพะทะผะพะถะฝะพััะธ ะธะทะฑะตะณะฐัั ะดัะฑะปะธัะพะฒะฐะฝะธั (ัะผ. bin/pkgdups) |
||||
|
||||
* ะธะฝะดะธะฒะธะดัะฐะปัะฝัะต ะฟะฐะบะตัั (*_PACKAGES): ัะผ. ัะถ. conf.d/README |
||||
|
||||
ะ ะตะทัะปััะฐั: |
||||
|
||||
* ะฟัะธ ััะฟะตัะฝะพะผ ะทะฐะฒะตััะตะฝะธะธ ัะฑะพัะบะธ ะพะฑัะฐะท ะฝะฐะทัะฒะฐะตััั ะฟะพ ะธะผะตะฝะธ ัะตะปะธ |
||||
ะธ ัะบะปะฐะดัะฒะฐะตััั ะฒ $(IMAGEDIR): |
||||
** ัะบะฐะทะฐะฝะฝัะน ัะฒะฝะพ, |
||||
** ะปะธะฑะพ ~/out/ (ะตัะปะธ ะฒะพะทะผะพะถะฝะพ), |
||||
** ะธะปะธ $(BUILDDIR)/out/ ะธะฝะฐัะต |
||||
* ัะพัะผะธัััััั ะพััััั, ะตัะปะธ ะทะฐะฟัะพัะตะฝั (REPORT) |
||||
|
||||
ะกะผ. ัะถ.: |
||||
|
||||
* https://altlinux.org/mkimage-profiles: ะพะฑะทะพัะฝะฐั ะดะพะบัะผะตะฝัะฐัะธั, ะฒ ั.ั. howto |
||||
* doc/: |
||||
** params.txt: ะฟะตัะตะผะตะฝะฝัะต, ัะบะฐะทัะฒะฐะตะผัะต ะฟัะธ ะทะฐะฟััะบะต ัะฑะพัะบะธ |
||||
** pkglists.txt: ัะพัะผะธัะพะฒะฐะฝะธะต ัะพััะฐะฒะฐ ะพะฑัะฐะทะฐ |
||||
** features.txt: ะพะฑะทะพั ะฟะพะดะบะปััะฐะตะผัั
ะพัะพะฑะตะฝะฝะพััะตะน |
||||
|
||||
ะัะธะผะตัะฐะฝะธะต: ะฟััะธ ะฒ ะดะพะบัะผะตะฝัะฐัะธะธ ะทะฐะดะฐัััั ะพั ะบะฐัะฐะปะพะณะฐ ะฒะตัั
ะฝะตะณะพ ััะพะฒะฝั, |
||||
ะตัะปะธ ะฝะต ัะบะฐะทะฐะฝั ะบะฐะบ ะพัะฝะพัะธัะตะปัะฝัะต ะฒ ัะฒะฝะพะผ ะฒะธะดะต (./) ะธะปะธ ะฟะพ ัะผััะปั. |
||||
|
||||
ะฃะดะฐัะธ; ััะพ ะฝะต ัะฐะบ -- ะฟะธัะธัะต. |
||||
|
||||
Michael Shigorin <mike@altlinux.org>, Anton Midyukov <antohami@altlinux.org> |
@ -0,0 +1,8 @@ |
||||
// these must be unset to avoid picking up |
||||
// /etc/apt/{apt.conf.d,sources.list.d,}/ |
||||
Dir::Etc::main "/dev/null"; |
||||
Dir::Etc::parts "/var/empty"; |
||||
Dir::Etc::SourceParts "/var/empty"; |
||||
|
||||
// this is what caused the whole trouble |
||||
Dir::Etc::sourcelist "/home/tema/mkimage-profiles/myp10"; |
@ -0,0 +1,49 @@ |
||||
#!/bin/sh |
||||
# filter stdin or file for words related to |
||||
# the specified target architecture |
||||
# |
||||
# args: -a arch [-i file] |
||||
|
||||
if [ "$1" = "-a" -a -n "$2" ]; then |
||||
a="$2" |
||||
shift 2 |
||||
else |
||||
cat |
||||
exit |
||||
fi |
||||
|
||||
if [ "$1" = "-i" -a -w "$2" ]; then |
||||
f="$2" |
||||
t="`mktemp`" |
||||
fi |
||||
|
||||
# map meta-arches for prefiltering |
||||
# NB: biarch gets special expansion later |
||||
case "$a" in |
||||
i586) |
||||
A="(IA32|X86)";; |
||||
x86_64) |
||||
A="X86";; |
||||
e2k*) |
||||
A="E2K";; |
||||
aarch64|arm*) |
||||
A="ARM";; |
||||
*) |
||||
A=;; |
||||
esac |
||||
|
||||
# NB: pipe runs in parallel => faster than -e -e |
||||
cat ${f:+"$f"} | |
||||
sed -rn "s/\<([^@ ]*)\>|\<([^@ ]*)@$A\>/\1\2/pg" | |
||||
sed -rn "s/\<([^@ ]*)\>|\<[^@ ]*@\!$A\> */\1/pg" | |
||||
sed -r "s/\<([^@ ]*)@IA32\>/\1@i586 i586-\1@x86_64/g" | |
||||
sed -rn "s/\<([^@ ]*)\>|\<([^@ ]*)@$a\>/\1\2/pg" | |
||||
sed -rn "s/\<([^@ ]*)\>|\<[^@ ]*@\!$a\> */\1/pg" | |
||||
sed -r "s/\<([^@ ]*)@\![^@ ]+\>/\1/g" | |
||||
sed -r "s/\<([^@ ]*)@[^@ ]+\> *//g" | |
||||
sed -r "s/^ +//;s/ +$//" | |
||||
if [ -n "$f" ]; then |
||||
cat > "$t" && mv "$t" "$f" |
||||
else |
||||
cat |
||||
fi |
@ -0,0 +1,100 @@ |
||||
#!/bin/sh |
||||
# script based on initial implementation |
||||
# by Vitaly Gusach (http://gusach.org.ua) |
||||
# |
||||
# purpose: warn on those entries in given packagelists(s) |
||||
# which are definitely absent; the build might still bail out |
||||
# but at least 80% of failures can be predicted early now |
||||
# |
||||
# usage: check-pkg-list [-n pkgnames] [--aptbox $PATH/to/aptbox] pkglist ... |
||||
# (pkgnames file should contain `apt-cache pkgnames`) |
||||
# NB: -n pkgnames MUST go first, if given |
||||
|
||||
RET_ERROR= |
||||
|
||||
error() { echo `basename $0`: $* >&2; exit 1; } |
||||
|
||||
exit_handler() { |
||||
local rc=$? |
||||
trap - EXIT |
||||
rm -f -- "$ftemp" "$fpkgnames" "$fpkgwildcards" "$favaillist" "$fpkgerrors" |
||||
exit $rc |
||||
} |
||||
|
||||
# figure out apt.conf from recent aptbox or fallback to system one |
||||
dump_pkgnames() { |
||||
${APTBOX:+$APTBOX/}apt-cache pkgnames | sort -u > "$favaillist" |
||||
} |
||||
|
||||
check_pkglist() { |
||||
fprofilelist="$1" |
||||
[ -f "$fprofilelist" ] || error "invalid packagelist filename: $fprofilelist" |
||||
# cleaning pkg list from comments, empty lines, |
||||
# splitting several pkgnames on the same line |
||||
sed -e '/^#/d' -e '/^[ ]*$/d' -e 's/ \+$//' -e 's/[ ]\+/\n/g' \ |
||||
< "$fprofilelist" \ |
||||
| sed 's/-$//' \ |
||||
| sort -u \ |
||||
> "$ftemp" # got list of pkgnames we need |
||||
|
||||
# split pkgnames without wildcards and with wildcards |
||||
fgrep -v '*' "$ftemp" > "$fpkgnames" |
||||
fgrep '*' "$ftemp" > "$fpkgwildcards" |
||||
|
||||
# return unavailable packages |
||||
comm -23 "$fpkgnames" "$favaillist" > "$fpkgerrors" |
||||
|
||||
# return unavailable wildcards |
||||
while read i; do |
||||
# replacing * with regexp's \.+ |
||||
pattern="^`echo ${i#^} | sed -e 's/\*/.\\\\+/'`$" |
||||
grep -q "$pattern" "$favaillist" || echo "$i" >> "$fpkgerrors" |
||||
done < "$fpkgwildcards" |
||||
if [ -s "$fpkgerrors" ]; then |
||||
echo "Error: Packages are not available in $fprofilelist:" >&2 |
||||
RET_ERROR=1 |
||||
cat $fpkgerrors >&2 |
||||
fi |
||||
} |
||||
|
||||
[ "$#" -gt 0 ] || error "need at least one argument, a packagelist to check" |
||||
|
||||
# reusable temporary files with self-cleanup at exit |
||||
TEMP="${TMP:-/tmp}" |
||||
trap exit_handler HUP INT QUIT TERM EXIT |
||||
favaillist="`mktemp $TEMP/pkgchecker.avail.XXXXX`" |
||||
fpkgnames="`mktemp $TEMP/pkgchecker.names.XXXXX`" |
||||
fpkgwildcards="`mktemp $TEMP/pkgchecker.wildcards.XXXXX`" |
||||
fpkgerrors="`mktemp $TEMP/pkgchecker.error.XXXXX`" |
||||
ftemp="`mktemp $TEMP/pkgchecker.XXXXX`" |
||||
|
||||
# check args |
||||
while :; do |
||||
case "$1" in |
||||
# make sure pkgnames dump is handy |
||||
"-n"|"--pkgnames") |
||||
[ -f "$2" ] && { |
||||
sort "$2" > "$favaillist" |
||||
shift; shift |
||||
} || error "-n needs valid pkgnames filename" |
||||
;; |
||||
# PATH to aptbox |
||||
"--aptbox") |
||||
[ -d "$2" ] && { |
||||
APTBOX="$2" |
||||
shift; shift |
||||
} || error "--aptbox needs valid directory" |
||||
;; |
||||
*) |
||||
break |
||||
;; |
||||
esac |
||||
done |
||||
|
||||
[ -s "$favaillist" ] || dump_pkgnames |
||||
|
||||
for list in "$@"; do |
||||
check_pkglist "$list" |
||||
done |
||||
|
||||
[ -z "$RET_ERROR" ] || error "Some lists contain unavailable packages" |
@ -0,0 +1,14 @@ |
||||
#!/bin/sh |
||||
|
||||
# missing "; @:" for recipeless rules makes SHELL payload useless |
||||
# (see also ../lib/report.mk); this results in broken target graphs |
||||
# (so REPORT=1 gets crippled) |
||||
|
||||
sed 's/^[a-z]\+\/.*:.*$/\n&/' "$@" \ |
||||
| grep -vE '^(#|export|if|else|endif|define|endef)' \ |
||||
| sed ':loop /^[^#].*[^\\]\\$/N; s/\\\n//; t loop' \ |
||||
| grep -vE ':=| = | ?= | += |^\$' \ |
||||
| sed ':loop /^[a-z]\+\/.*:.*$/N; s/\n\t\+@*/\; /; t loop' \ |
||||
| grep -vE ';|^$' && exit 1 ||: |
||||
|
||||
# see also http://unix.stackexchange.com/questions/228547 |
@ -0,0 +1,24 @@ |
||||
#!/bin/sh |
||||
# try making build logs more diffable |
||||
# see also reports.mk |
||||
|
||||
[ -n "$BUILDDIR" ] || exit 1 |
||||
|
||||
sed -r \ |
||||
-e "s,$BUILDDIR,,g" \ |
||||
-e '/\/var\/lib\/apt\/lists/d' \ |
||||
-e 's/... .. ..:..:..//g' \ |
||||
-e 's/\[[0-9]+\]//g' \ |
||||
-e '/^(Reading Package Lists|Building Dependency Tree)/d' \ |
||||
-e '/^(Fetched|Need to get|After unpacking) /d' \ |
||||
-e '/^(Preparing packages for installation|Done\.)/d' \ |
||||
-e '/^hsh(|-(initroot|install|fakedev|(mk|rm)chroot|run)): /d' \ |
||||
-e '/^(hasher-priv|mkaptbox|(mk|rm)dir): /d' \ |
||||
-e '/^mki-((invalidate-|)cache|check-obsolete|prepare): /d' \ |
||||
-e '/^(mode of|changed (group|ownership)|removed) /d' \ |
||||
-e '/^chroot\/.in\//d' \ |
||||
-e '/ has started executing\.$/d' \ |
||||
-e '/\/var\/log\/apt\.log$/d' \ |
||||
-e '/\/usr\/share\/apt\/scripts\/log\.lua/d' \ |
||||
-e '/\.rpm$/d' \ |
||||
-e "/' -> '/d" |
@ -0,0 +1,36 @@ |
||||
#!/bin/bash |
||||
# columnize.sh |
||||
# Take a list of values and output them in a nicely formatted column view. |
||||
# Author: Loรฏc Cattani "Arko" <loic cattani at gmail com> |
||||
# https://github.com/Arko/Columnize |
||||
|
||||
values=($*) |
||||
longest_value=0 |
||||
|
||||
# Find the longest value |
||||
for value in ${values[@]}; do |
||||
if [[ ${#value} -gt $longest_value ]]; then |
||||
longest_value=${#value} |
||||
fi |
||||
done |
||||
|
||||
# Compute column span |
||||
term_width=${COLUMNS:-$(tput cols)} |
||||
(( columns = $term_width / ($longest_value + 2) )) |
||||
|
||||
# Print values with pretty column width |
||||
curr_col=0 |
||||
for value in ${values[@]}; do |
||||
value_len=${#value} |
||||
echo -n $value |
||||
(( spaces_missing = $longest_value - $value_len + 2 )) |
||||
printf "%*s" $spaces_missing |
||||
(( curr_col++ )) |
||||
if [[ $curr_col == $columns ]]; then |
||||
echo |
||||
curr_col=0 |
||||
fi |
||||
done |
||||
|
||||
# Make sure there is a newline at the end |
||||
if [[ $curr_col != 0 ]]; then echo; fi |
@ -0,0 +1,30 @@ |
||||
#!/bin/sh |
||||
# Expand metapackage dependenies |
||||
# |
||||
APT_CACHE=$1 |
||||
f=$2 |
||||
[ -n "$f" ] || exit 0 |
||||
|
||||
metapkgs="$(grep -e @META "$f" | grep -v '^#')" |
||||
[ -n "metapkgs" ] || exit 0 |
||||
|
||||
for metapkg in $metapkgs; do |
||||
metapkg=${metapkg%@META} |
||||
if ! "$APT_CACHE" show "$metapkg" > /dev/null 2>&1; then |
||||
echo "Warning: Metapackage $metapkg not available!!!" >&2 |
||||
continue |
||||
fi |
||||
t="`mktemp`" |
||||
LANG=C "$APT_CACHE" depends "$metapkg"| grep 'Depends:' | |
||||
cut -f4 -d ' ' |grep -v '<' > "$t" |
||||
if [ -s "$t" ]; then |
||||
sed -i -e "/$metapkg@META/r $t" -e "s/$metapkg@META/$metapkg/" "$f" |
||||
fi |
||||
sed -i "s/$metapkg@META/$metapkg/" "$f" |
||||
rm -f "$t" |
||||
done |
||||
|
||||
# Cleanup not available metapackages |
||||
sed -i "/@META/d" "$f" |
||||
|
||||
exit 0 |
@ -0,0 +1,97 @@ |
||||
#!/bin/sh |
||||
# analyze free space, preferring tmpfs over really many gigaz |
||||
# and taking into account configured hasher workdir prefices |
||||
|
||||
# NB: use BUILDDIR to override autodetection (see ../QUICKSTART) |
||||
|
||||
# hope there aren't spaces in RM's $HOME are they? |
||||
DIRS="$TMP $TMPDIR $HOME/hasher /tmp /var/tmp .." |
||||
MINSIZE=262144 # face control criterion |
||||
|
||||
# mkimage needs /proc among those, be clear about that |
||||
check_allowed_mountpoints() |
||||
{ |
||||
grep -wqs "^allowed_mountpoints=[^#]*/proc" \ |
||||
/etc/hasher-priv/system \ |
||||
`/usr/libexec/hasher-priv/getconf.sh` |
||||
} |
||||
|
||||
# poor man's SourceIfExists() |
||||
try_source() { [ -f "$1" ] && . "$1"; } |
||||
|
||||
# hasher accepted ones |
||||
get_prefices() |
||||
{ |
||||
try_source /etc/hasher-priv/system || exit 1 |
||||
try_source `/usr/libexec/hasher-priv/getconf.sh` |
||||
echo "$prefix" | tr ':' '\n' | while read i; do realpath "$i"; done |
||||
} |
||||
|
||||
# drop candidates that hasher won't handle anyways |
||||
# NB: doesn't take --number into account, |
||||
# prefix lists are defined by the primary configuration |
||||
contemplate_dirs() |
||||
{ |
||||
for d in "$@"; do |
||||
D="`realpath "$d"`"; |
||||
for p in `get_prefices`; do |
||||
[ "${D#$p}" = "$D" ] || echo "$D"; |
||||
done; |
||||
done \ |
||||
| uniq # _not_ sort -u |
||||
} |
||||
|
||||
# hasher emits no meaningful errors regarding those, sigh |
||||
check_options() |
||||
{ |
||||
! egrep -q "^$1 $2 .*no(dev|exec)" /proc/mounts |
||||
} |
||||
|
||||
# pick existing, writeable, >256M free space dirs |
||||
# rank them wrt type: tmpfs > realfs > rootfs |
||||
choose_tmpdir() { |
||||
for i in "$@"; do |
||||
[ -d "$i" -a -w "$i" ] || continue |
||||
echo -n "$i " |
||||
df -PT "$i" | tail -1 |
||||
done \ |
||||
| sort -unk5 \ |
||||
| while read dir dev fstype size used free percent mnt; do |
||||
check_options "$dev" "$mnt" || continue |
||||
[ "$free" -gt "$MINSIZE" ] || continue |
||||
[ "$fstype" = "tmpfs" ] && { echo "2 $dir $free"; continue; } |
||||
[ "$mnt" = "/" ] && { echo "0 $dir $free"; continue; } |
||||
echo "1 $dir $free" |
||||
done \ |
||||
| sort -n \ |
||||
| tail -1 \ |
||||
| cut -f2 -d' ' |
||||
} |
||||
|
||||
# bringing it all together |
||||
if ! check_allowed_mountpoints; then |
||||
echo "error: hasher's allowed_mountpoints do not include /proc;" |
||||
echo "please check hasher docs and /etc/hasher-priv/system" |
||||
exit 1 |
||||
fi >&2 |
||||
|
||||
TMPDIRS="`contemplate_dirs $DIRS`" |
||||
if [ -z "$TMPDIRS" ]; then |
||||
echo "error: no suitable directories found;" |
||||
echo "please check QUICKSTART, filesystem and hasher setup" |
||||
echo "(mount enough tmpfs into /tmp or fix hasher-priv prefix?)" |
||||
exit 1 |
||||
fi >&2 |
||||
|
||||
TEMP="`choose_tmpdir $TMPDIRS`" |
||||
if [ -z "$TEMP" ]; then |
||||
echo "error: no suitable directories found;" |
||||
echo "please check hasher docs and filesystem setup" |
||||
echo "(nodev and/or noexec on an otherwise suitable filesystem?)" |
||||
exit 1 |
||||
fi >&2 |
||||
|
||||
DIR="$TEMP/`dirname "$1"`" |
||||
NAME="`basename "${1:-tmpdir}"`" |
||||
mkdir -p "$DIR" # in case $1 contains slash(es) |
||||
mktemp -d "$NAME.XXXXXXX" --tmpdir="${DIR%/.}" |
@ -0,0 +1,27 @@ |
||||
#!/bin/sh |
||||
# commit the directory ($1) with a message ($2) to git |
||||
|
||||
. shell-error |
||||
|
||||
INIT= |
||||
if [ "$1" = "-i" ]; then |
||||
INIT=yes |
||||
shift |
||||
fi |
||||
|
||||
[ -d "$1" ] || fatal "$1 is not an existing directory" |
||||
|
||||
if type -t git >&/dev/null && pushd "$1" >/dev/null; then |
||||
if [ -z "$(git config --global user.name)" ]; then |
||||
exit 0 |
||||
fi |
||||
if [ -n "$INIT" -a ! -d .git ]; then |
||||
git init -q || fatal "git init failed" |
||||
fi |
||||
if [ -n "$(git status -s)" ]; then |
||||
git add . \ |
||||
&& git commit -anq -m "$2" \ |
||||
|| fatal "git add/commit failed" |
||||
fi |
||||
popd >/dev/null |
||||
fi |
@ -0,0 +1,11 @@ |
||||
#!/bin/sh |
||||
# report on git repo in the current directory |
||||
|
||||
if type -t git >&/dev/null; then |
||||
if pushd "$1" >/dev/null && [ -d .git ]; then |
||||
git show-ref --head -ds -- HEAD |
||||
git status -s |
||||
echo |
||||
popd >/dev/null |
||||
fi |
||||
fi |
@ -0,0 +1,20 @@ |
||||
#!/bin/sh |
||||
# a script to help weed out duplicate packages |
||||
# contained in package lists given as arguments |
||||
# |
||||
# Requires: libshell |
||||
|
||||
. /bin/shell-quote |
||||
|
||||
sort "$@" \ |
||||
| grep -v '^ *#' \ |
||||
| sed -s 's,[ ]\+, ,g' \ |
||||
| grep -v '^ *$' \ |
||||
| uniq -cd \ |
||||
| while read num str; do |
||||
echo -n "$str: $num "; |
||||
pattern="`quote_sed_regexp "$str"`" |
||||
grep -l "^$pattern$" "$@" | tr '\n' ' ' |
||||
echo |
||||
done \ |
||||
| sort -rn -t: -k2 |
@ -0,0 +1,4 @@ |
||||
#!/bin/sh |
||||
# filter worker make stdout for report scripts |
||||
|
||||
grep '^trace:building ' | uniq |
@ -0,0 +1,33 @@ |
||||
#!/bin/sh |
||||
|
||||
echo "digraph {" |
||||
echo " { node [fontname=Helvetica,fontsize=20];" |
||||
|
||||
while read first second third rest; do |
||||
FROM=; TO= |
||||
case "$first" in |
||||
"trace:building") |
||||
case "$third" in |
||||
"->") |
||||
FROM="$second"; TO="$rest";; |
||||
*) |
||||
continue;; |
||||
esac |
||||
;; |
||||
*) |
||||
continue;; |
||||
esac |
||||
[ -n "$FROM" -a -n "$TO" ] || continue |
||||
for to in $TO; do |
||||
out=" \"$FROM\" -> \"$to\"" |
||||
case $to in |
||||
*distro/*|*vm/*|*ve/*) |
||||
echo "$out [weight=10];";; |
||||
*) |
||||
echo "$out;";; |
||||
esac |
||||
done |
||||
done |
||||
|
||||
echo " }" |
||||
echo "}" |
@ -0,0 +1,52 @@ |
||||
#!/bin/sh |
||||
|
||||
DISTCFG=build/distcfg.mk |
||||
[ -s "$DISTCFG" ] || exit 1 |
||||
|
||||
VARIABLES= |
||||
|
||||
echo "graph { rankdir=LR;" |
||||
echo " { node [height=.1,width=.3,fontname=Helvetica,fontsize=10];" |
||||
|
||||
feat_vars() |
||||
{ |
||||
FEATURE= |
||||
while read first second rest; do |
||||
case "$first" in |
||||
\#[A-Z]*) |
||||
continue;; # overridden feature |
||||
\#) # feature mark |
||||
case "$second" in |
||||
profile/*) |
||||
FEATURE=;; |
||||
*) |
||||
FEATURE="$second";; |
||||
esac |
||||
;; |
||||
*) |
||||
case "$second" in |
||||
=|+=|?=) |
||||
case "$first" in |
||||
DISTCFG_MK|SUBPROFILES|FEATURES|IMAGE*|MKIMAGE_*) |
||||
continue;; |
||||
*) |
||||
VAR="$first" |
||||
VARIABLES="$VARIABLES; $VAR" |
||||
;; |
||||
esac |
||||
;; |
||||
*) |
||||
continue;; |
||||
esac |
||||
;; |
||||
esac |
||||
[ -n "$FEATURE" -a -n "$VAR" ] || continue |
||||
echo " \"$FEATURE\" -- \"$VAR\";" |
||||
done < "$DISTCFG" |
||||
echo " { node [shape=box]$VARIABLES; }" |
||||
} |
||||
|
||||
feat_vars | LC_COLLATE=C sort -ru |
||||
|
||||
echo " }" |
||||
echo "}" |
@ -0,0 +1,36 @@ |
||||
#!/bin/sh -f |
||||
# a script to transform a tag name, a list of tag names (ANDed then), |
||||
# or a complex boolean expression into a list of package list names. |
||||
# examples of expected stdin: |
||||
# |
||||
# kde |
||||
# live gnome |
||||
# (base && (kernel || apt || alterator)) |
||||
# |
||||
# NB: tags are processed using word boundaries, |
||||
# so avoid using "-" in tag names |
||||
|
||||
DIR="${1:?need base directory}" |
||||
|
||||
warn() { |
||||
echo "$0: WARNING: $*" >&2 |
||||
exit |
||||
} |
||||
|
||||
[ -d "$DIR" ] || warn "$DIR nonexistent" |
||||
cd "$DIR" || warn "cannot change to $DIR" |
||||
|
||||
# NB: care with quoting |
||||
transformed="$(sed \ |
||||
-e "s,\([^&|! ()']\+\),-regex ^.*\\\\<\1\\\\>.*$,g" \ |
||||
-e "s, *&& *, -a ,g" \ |
||||
-e "s, *|| *, -o ,g" \ |
||||
-e "s, *! *, ! ,g" \ |
||||
-e "s, *( *, ( ,g" \ |
||||
-e "s, *) *, ) ,g")" |
||||
|
||||
[ "$DEBUG" = 2 ] && echo "`basename $0`: transformed = \"$transformed\"" >&2 |
||||
[ -z "$transformed" ] || |
||||
find $transformed \ |
||||
| sed 's,^\./,,' \ |
||||
| egrep -v '(\.sw.|~)$' |
@ -0,0 +1,458 @@ |
||||
#!/bin/bash -ex |
||||
# usage: |
||||
# tar2fs chroot.tar image.raw [size_in_bytes [fstype]] |
||||
|
||||
. shell-error |
||||
export LANG=C |
||||
|
||||
if [ $# -lt 2 ]; then |
||||
fatal "error: tar2fs needs at least two arguments" |
||||
fi |
||||
|
||||
# this needs env_keep sudo setup to actually work |
||||
if [ -n "$GLOBAL_BUILDDIR" ]; then |
||||
WORKDIR="$GLOBAL_BUILDDIR/vmroot" |
||||
else |
||||
WORKDIR="$(mktemp --tmpdir -d vmroot-XXXXX)" |
||||
fi |
||||
|
||||
[ -n "$WORKDIR" ] || fatal "couldn't come up with suitable WORKDIR" |
||||
|
||||
[ -n "$GLOBAL_DEBUG" ] || message "WORKDIR: $WORKDIR" |
||||
|
||||
MB=1048576 # a parted's "megabyte" in bytes is *broken* |
||||
|
||||
SIZE_FACTOR=2 # multiply the sizes found by this value |
||||
BOOT_SIZE_FACTOR=2 # multiply /boot size by this value additionally |
||||
BOOTLOADERPARTSIZEM=0 # PReP partition size (ppc*) |
||||
|
||||
CUR_BOUNDARY=0 # align first partition at 1MB for performance (+1) |
||||
|
||||
BOOTFSTYPE= |
||||
BOOTPART= |
||||
EFIPARTFSTYPE= |
||||
EFIPART= |
||||
|
||||
BOOTLOADER="$5" |
||||
|
||||
if [ -n "$6" ]; then |
||||
ARCH="$6" |
||||
else |
||||
ARCH="$(arch)" |
||||
fi |
||||
|
||||
BOOTTYPE="$8" |
||||
|
||||
case "$ARCH" in |
||||
e2k*) |
||||
BOOTFSTYPE="ext2" # firmware knows it |
||||
BLOCKDEV="/dev/sda" # ...hopefully... |
||||
BOOTPART="1" |
||||
ROOTPART="2" |
||||
;; |
||||
ppc*) |
||||
BOOTFSTYPE="ext4" |
||||
BLOCKDEV="/dev/sda" |
||||
BOOTLOADERPART="1" |
||||
BOOTLOADERPARTSIZEM="8" |
||||
ROOTPART="2" |
||||
;; |
||||
arm*|aarch64) |
||||
ROOTPART="1" |
||||
BLOCKDEV="/dev/sda" |
||||
CUR_BOUNDARY=15 # offset 16 MiB for singleboard's |
||||
;; |
||||
*) |
||||
ROOTPART="1" |
||||
BLOCKDEV="/dev/sda" |
||||
;; |
||||
esac |
||||
|
||||
if [ "$BOOTLOADER" == grub-efi -o "$BOOTTYPE" == EFI ]; then |
||||
EFIPART="1" |
||||
EFIPARTSIZEM="256" |
||||
EFIPARTFSTYPE="fat" |
||||
ROOTPART="2" |
||||
fi |
||||
|
||||
PARTTABLE="$7" |
||||
if [ -z "$PARTTABLE" ]; then |
||||
if [ "$BOOTLOADER" == grub-efi ]; then |
||||
PARTTABLE=gpt |
||||
else |
||||
PARTTABLE=msdos |
||||
fi |
||||
fi |
||||
|
||||
# figure out the part taken by /boot in the given tarball |
||||
boot_size() { |
||||
if [ -n "$BOOTPART" ]; then |
||||
tar tvf "$1" \ |
||||
| awk ' \ |
||||
BEGIN { sum=0 } |
||||
/^-.* \.\/boot\// { sum=sum+$3 } |
||||
END { print sum }' |
||||
else |
||||
echo "0" |
||||
fi |
||||
} |
||||
|
||||
# parted wrapper for convenience |
||||
parting() { parted "$LOOPDEV" --align optimal --script -- "$@"; } |
||||
|
||||
# unfortunately parted is insane enough to lump alignment controls |
||||
# into unit controls so creating adjacent partitions sized in MiB |
||||
# is not as straightforward as it might be... thus "+1" padding; |
||||
# see also http://www.gnu.org/software/parted/manual/parted.html#unit |
||||
mkpart() { |
||||
# a bit different start/end semantics to handle end of device too |
||||
local start="$(($CUR_BOUNDARY + 1))" # yes, we lose a megabyte |
||||
if [ -n "$1" ]; then |
||||
CUR_BOUNDARY="$(($start + $1))" |
||||
local end="$CUR_BOUNDARY"MiB |
||||
else |
||||
local end="$OFFSET"MiB |
||||
fi |
||||
if [ -n "$2" ]; then |
||||
CUR_FS="$2" |
||||
else |
||||
CUR_FS=ext2 |
||||
fi |
||||
parting mkpart primary "$CUR_FS" "$start"MiB "$end" |
||||
} |
||||
|
||||
# a tarball containing chroot with a kernel |
||||
TAR="$1" |
||||
[ -s "$TAR" ] || fatal "source tarball doesn't really exist" |
||||
|
||||
# a path to the image to be generated |
||||
IMG="$2" |
||||
[ -d "$(dirname "$IMG")" ] || fatal "target directory doesn't exist" |
||||
|
||||
# 0 means auto; if a value is specified it holds (no /boot subtracted) |
||||
ROOTSIZE="$3" |
||||
[ -n "$ROOTSIZE" -a "$ROOTSIZE" != 0 ] || unset ROOTSIZE |
||||
|
||||
# image size in bytes |
||||
TARSIZE="$(stat -Lc %s "$TAR")" |
||||
# /boot size in that tarball |
||||
BOOTSIZE="$(boot_size "$TAR")" |
||||
DEFSIZE="$(($SIZE_FACTOR * ($TARSIZE - $BOOTSIZE)))" # (exact sizes) |
||||
ROOTSIZE="$((${ROOTSIZE:-$DEFSIZE} + $MB - 1))" # for ceil rounding to MB |
||||
# image and /boot sizes in megabytes |
||||
ROOTSIZEM="$(($ROOTSIZE / $MB))" |
||||
BOOTSIZEM="$((($SIZE_FACTOR * $BOOT_SIZE_FACTOR * $BOOTSIZE + $MB - 1) / $MB))" |
||||
|
||||
# tested to work: ext[234], jfs |
||||
# NB: xfs doesn't have a spare sector for the bootloader |
||||
ROOTFSTYPE="${4:-ext4}" |
||||
|
||||
# single root partition hardwired so far, |
||||
# add another image for home/data/swap if needed |
||||
ROOTDEV="$BLOCKDEV$ROOTPART" |
||||
|
||||
# last preparations... |
||||
MKFS="mkfs.$ROOTFSTYPE ${BOOTFSTYPE:+mkfs.$BOOTFSTYPE} \ |
||||
${EFIPARTFSTYPE:+mkfs.$EFIPARTFSTYPE}" |
||||
for i in losetup sfdisk parted kpartx $MKFS; do |
||||
if ! type -t "$i" >&/dev/null; then |
||||
fatal "$i required but not found in host system" |
||||
fi |
||||
done |
||||
|
||||
LOOPDEV="$(losetup --find)" # would be sad about non-binary megabytes too |
||||
ROOTFS="$WORKDIR/chroot" |
||||
|
||||
BOOTFS= |
||||
EFIPARTFS= |
||||
if [ -n "$BOOTPART" ]; then |
||||
BOOTFS="$ROOTFS/boot" |
||||
fi |
||||
if [ -n "$EFIPART" ]; then |
||||
EFIPARTFS="$ROOTFS/boot/efi" |
||||
fi |
||||
|
||||
exit_handler() { |
||||
rc=$? |
||||
cd / |
||||
if [ -n "$ROOTFS" ]; then |
||||
umount ${EFIPARTFS:+"$EFIPARTFS"} ${BOOTFS:+"$BOOTFS"} \ |
||||
"$ROOTFS"{/dev,/proc,/sys,} |
||||
|
||||
if [ -n "$LOOPDEV" ]; then |
||||
kpartx -d -s "$LOOPDEV" || { |
||||
sleep 10 |
||||
kpartx -d -s -v "$LOOPDEV" |
||||
} |
||||
losetup --detach "$LOOPDEV" |
||||
fi |
||||
rm -r -- "$ROOTFS" |
||||
rmdir -- "$WORKDIR" |
||||
fi |
||||
exit $rc |
||||
} |
||||
|
||||
# handle -e in shebang as well |
||||
trap exit_handler EXIT ERR |
||||
|
||||
# prepare disk image and a filesystem inside it |
||||
rm -f -- "$IMG" |
||||
OFFSET="$(($CUR_BOUNDARY + $EFIPARTSIZEM + $BOOTLOADERPARTSIZEM + $BOOTSIZEM + $ROOTSIZEM - 1))" |
||||
dd if=/dev/zero of="$IMG" conv=notrunc bs=$MB count=1 seek="$OFFSET" |
||||
losetup "$LOOPDEV" "$IMG" |
||||
|
||||
parting mklabel "$PARTTABLE" |
||||
|
||||
if [ -n "$BOOTLOADERPART" ] && [ -n "$BOOTLOADERPARTSIZEM" ]; then |
||||
case "$ARCH" in |
||||
ppc*) |
||||
parting mkpart primary ext2 $((CUR_BOUNDARY+1))MiB $((BOOTLOADERPARTSIZEM + 1))MiB |
||||
CUR_BOUNDARY="$BOOTLOADERPARTSIZEM" |
||||
parting set 1 prep on |
||||
parting set 1 boot on |
||||
;; |
||||
esac |
||||
fi |
||||
|
||||
if [ -n "$EFIPART" ]; then |
||||
EFIDEV="$EFIDEV$EFIPART" |
||||
if [ "$PARTTABLE" == gpt ]; then |
||||
parting mkpart fat32 $((CUR_BOUNDARY+1))MiB $(($EFIPARTSIZEM + 1))MiB |
||||
else |
||||
parting mkpart primary fat32 $((CUR_BOUNDARY+1))MiB $(($EFIPARTSIZEM + 1))MiB |
||||
fi |
||||
CUR_BOUNDARY="$EFIPARTSIZEM" |
||||
parting set 1 boot on |
||||
if [ "$PARTTABLE" == gpt ]; then |
||||
parting set 1 esp on |
||||
fi |
||||
fi |
||||
|
||||
if [ -n "$BOOTPART" ]; then |
||||
BOOTDEV="$BLOCKDEV$BOOTPART" |
||||
mkpart "$BOOTSIZEM" |
||||
fi |
||||
|
||||
# not ROOTSIZEM but "the rest"; somewhat non-trivial arithmetics lurk in parted |
||||
mkpart |
||||
|
||||
kpartx -a -s "$LOOPDEV" |
||||
LOOPROOT="/dev/mapper/$(basename "$LOOPDEV")p$ROOTPART" |
||||
|
||||
mkfs."$ROOTFSTYPE" "$LOOPROOT" |
||||
|
||||
if [ -n "$BOOTPART" ]; then |
||||
LOOPBOOT="/dev/mapper/$(basename "$LOOPDEV")p$BOOTPART" |
||||
mkfs."$BOOTFSTYPE" "$LOOPBOOT" |
||||
fi |
||||
|
||||
if [ -n "$BOOTLOADERPART" ] && [ -n "$BOOTLOADERPARTSIZEM" ]; then |
||||
LOOPBOOTLOADER="/dev/mapper/$(basename "$LOOPDEV")p$BOOTLOADERPART" |
||||
fi |
||||
|
||||
if [ -n "$EFIPART" ]; then |
||||
LOOPEFI="/dev/mapper/$(basename "$LOOPDEV")p$EFIPART" |
||||
mkfs.fat -F32 "$LOOPEFI" |
||||
fi |
||||
|
||||
ROOTUUID="$(blkid -s UUID -o value -c /dev/null "$LOOPROOT")" |
||||
if [ -n "$ROOTUUID" ]; then |
||||
ROOTDEV="UUID=$ROOTUUID" |
||||
else |
||||
ROOTDEV="$LOOPROOT" |
||||
fi |
||||
|
||||
if [ -n "$BOOTPART" ]; then |
||||
BOOTUUID="$(blkid -s UUID -o value -c /dev/null "$LOOPBOOT")" |
||||
if [ -n "$BOOTUUID" ]; then |
||||
BOOTDEV="UUID=$BOOTUUID" |
||||
fi |
||||
fi |
||||
|
||||
if [ -n "$EFIPART" ]; then |
||||
EFIUUID="$(blkid -s UUID -o value -c /dev/null "$LOOPEFI")" |
||||
if [ -n "$EFIUUID" ]; then |
||||
EFIDEV="UUID=$EFIUUID" |
||||
fi |
||||
fi |
||||
|
||||
# mount and populate it |
||||
mkdir -pm755 "$ROOTFS" |
||||
mount "$LOOPROOT" "$ROOTFS" |
||||
|
||||
if [ -n "$BOOTPART" ]; then |
||||
mkdir -pm700 "$BOOTFS" |
||||
mount "$LOOPBOOT" "$BOOTFS" |
||||
fi |
||||
|
||||
if [ -n "$EFIPART" ]; then |
||||
mkdir -pm751 "$EFIPARTFS" |
||||
mount "$LOOPEFI" "$EFIPARTFS" |
||||
fi |
||||
|
||||
tar -C "$ROOTFS" --numeric-owner -xf "$TAR" |
||||
for i in /dev /proc /sys; do mount --bind "$i" "$ROOTFS$i"; done |
||||
|
||||
# loop device so lilo could work... |
||||
if grep -qe "[[:space:]]/[[:space:]]" "$ROOTFS/etc/fstab"; then \ |
||||
sed -i "s/LABEL=ROOT/$ROOTDEV/" "$ROOTFS/etc/fstab" |
||||
else |
||||
echo "$ROOTDEV / $ROOTFSTYPE relatime 1 1" >> "$ROOTFS/etc/fstab" |
||||
fi |
||||
|
||||
# target device at once |
||||
if [ -n "$BOOTPART" ]; then |
||||
echo "$BOOTDEV /boot $BOOTFSTYPE defaults 1 2" >> "$ROOTFS/etc/fstab" |
||||
fi |
||||
if [ -n "$EFIPART" ]; then |
||||
echo "$EFIDEV /boot/efi vfat umask=0,quiet,showexec,iocharset=utf8,codepage=866 1 2" >> "$ROOTFS/etc/fstab" |
||||
fi |
||||
|
||||
# Query ARCH in chroot and redefine arch-dependent variable |
||||
ARCH="$(chroot "$ROOTFS" rpm --eval '%_host_cpu')" |
||||
|
||||
# NB: don't stick BOOTFS here, it has slightly different semantics |
||||
pushd $ROOTFS/boot |
||||
|
||||
# 4.9.76-elbrus-def-alt1.11.1 -> def |
||||
get_label() { echo "${1# *}" | sed -r 's,.*elbrus-([0-9a-z]+)-.*$,\1,'; } |
||||
|
||||
KVERSIONS= |
||||
KVERSIONS="$(chroot "$ROOTFS" rpm -qa 'kernel-image*' \ |
||||
--qf '%{installtime} %{version}-%{name}-%{release}\n' \ |
||||
| sort -n \ |
||||
| cut -f 2 -d ' ' \ |
||||
| sed 's/kernel-image-//')" |
||||
[ -n "$KVERSIONS" ] || fatal "unable to deduce kernel version" |
||||
rm -f .origver |
||||
|
||||
# clean fstab |
||||
sed -i "/LABEL=ROOT/d" "$ROOTFS/etc/fstab" |
||||
# ...target device too |
||||
sed -i "s,$LOOPROOT,$ROOTDEV," "$ROOTFS/etc/fstab" |
||||
|
||||
echo "** KVERSIONS=[$KVERSIONS]" >&2 |
||||
|
||||
if [ "`echo $KVERSIONS | wc -w`" = 1 ]; then # 2+ labels |
||||
echo -e "default=`get_label $KVERSIONS`\n" >> boot.conf |
||||
fi |
||||
|
||||
# FIXME: relies on particular (current) kernel package naming scheme |
||||
for v in $KVERSIONS; do |
||||
l="`get_label "$v"`" |
||||
cat >> boot.conf <<EOF |
||||
label=$l |
||||
partition=0 |
||||
image=/image-$v |
||||
initrd=/initrd-$v.img |
||||
cmdline=console=ttyS0,115200 console=tty0 consoleblank=0 hardreset root=UUID=$ROOTUUID |
||||
|
||||
EOF |
||||
done |
||||
|
||||
echo "** start of boot.conf" |
||||
cat boot.conf |
||||
echo "** end of boot.conf" |
||||
|
||||
popd |
||||
|
||||
# Update cmdline.txt for Raspberry Pi |
||||
[ -f "$ROOTFS/boot/efi/cmdline.txt" ] && |
||||
sed -i "s/LABEL=ROOT/$ROOTDEV/" "$ROOTFS/boot/efi/cmdline.txt" |
||||
|
||||
# Update extlinux.conf |
||||
if [ -f "$ROOTFS/boot/extlinux/extlinux.conf" ]; then |
||||
sed -i "s/LABEL=ROOT/$ROOTDEV/g" "$ROOTFS/boot/extlinux/extlinux.conf" |
||||
if [ "$PARTTABLE" == gpt ]; then |
||||
parting set "$ROOTPART" legacy_boot on |
||||
fi |
||||
if [ "$PARTTABLE" == msdos ]; then |
||||
parting set "$ROOTPART" boot on |
||||
fi |
||||
fi |
||||
|
||||
# Setup bootloader |
||||
case "$BOOTLOADER" in |
||||
lilo) |
||||
# configure and install bootloader |
||||
REGEXP='^.*: ([0-9]+) cylinders, ([0-9]+) heads, ([0-9]+) sectors/track*$' |
||||
set -- $(sfdisk -g "$LOOPDEV" | grep -E "$REGEXP" | sed -r "s@$REGEXP@\1 \2 \3@") |
||||
|
||||
LILO_COMMON="lba32 |
||||
delay=1 |
||||
vga=0 |
||||
image=/boot/vmlinuz |
||||
initrd=/boot/initrd.img |
||||
append=\"root=$ROOTDEV rootdelay=3 console=tty1 console=ttyS0,115200n8\" |
||||
label=linux" |
||||
|
||||
cat > "$ROOTFS"/etc/lilo-loop.conf <<-EOF |
||||
boot=$LOOPDEV |
||||
disk=$LOOPDEV |
||||
bios=0x80 |
||||
cylinders=$1 |
||||
heads=$2 |
||||
sectors=$3 |
||||
partition=$LOOPROOT |
||||
start=63 |
||||
$LILO_COMMON |
||||
EOF |
||||
|
||||
chroot "$ROOTFS" lilo -C /etc/lilo-loop.conf |
||||
|
||||
cat > "$ROOTFS"/etc/lilo.conf <<-EOF |
||||
boot=$BLOCKDEV |
||||
$LILO_COMMON |
||||
EOF |
||||
;; |
||||
grub-efi) |
||||
echo 'GRUB_DISABLE_OS_PROBER=true' >> "$ROOTFS"/etc/sysconfig/grub2 |
||||
chroot "$ROOTFS" grub-mkconfig -o /boot/grub/grub.cfg |
||||
case "$ARCH" in |
||||
x86_64) |
||||
chroot "$ROOTFS" grub-install --target=i386-efi --recheck \ |
||||
--removable --uefi-secure-boot |
||||
chroot "$ROOTFS" grub-install --target=x86_64-efi --recheck \ |
||||
--removable --uefi-secure-boot |
||||
sed -i 's/initrd16/initrdefi/g' "$ROOTFS/boot/grub/grub.cfg" |
||||
sed -i 's/linux16/linuxefi/g' "$ROOTFS/boot/grub/grub.cfg" |
||||
;; |
||||
aarch64) |
||||
chroot "$ROOTFS" grub-install --target=arm64-efi --recheck \ |
||||
--removable --no-uefi-secure-boot |
||||
;; |
||||
armh) |
||||
chroot "$ROOTFS" grub-install --target=arm-efi --recheck \ |
||||
--removable --no-uefi-secure-boot |
||||
;; |
||||
riscv64) |
||||
chroot "$ROOTFS" grub-install --target=riscv64-efi --recheck \ |
||||
--removable --no-uefi-secure-boot |
||||
esac |
||||
sed -i '/GRUB_DISABLE_OS_PROBER=true/d' "$ROOTFS/etc/sysconfig/grub2" |
||||
;; |
||||
grub) |
||||
echo 'GRUB_DISABLE_OS_PROBER=true' >> "$ROOTFS"/etc/sysconfig/grub2 |
||||
chroot "$ROOTFS" grub-mkconfig -o /boot/grub/grub.cfg |
||||
case "$ARCH" in |
||||
*86*) |
||||
chroot "$ROOTFS" grub-install --target=i386-pc "$LOOPDEV" |
||||
sed -i 's/initrdefi/initrd16/g' "$ROOTFS/boot/grub/grub.cfg" |
||||
sed -i 's/linuxefi/linux16/g' "$ROOTFS/boot/grub/grub.cfg" |
||||
;; |
||||
ppc*) |
||||
[ -z "$LOOPBOOTLOADER" ] || |
||||
chroot "$ROOTFS" grub-install --target=powerpc-ieee1275 \ |
||||
--no-nvram "$LOOPBOOTLOADER" |
||||
;; |
||||
esac |
||||
sed -i '/GRUB_DISABLE_OS_PROBER=true/d' "$ROOTFS/etc/sysconfig/grub2" |
||||
;; |
||||
esac |
||||
|
||||
if [ -n "$SUDO_USER" ]; then |
||||
chown "$SUDO_USER:$(id -g "$SUDO_USER")" "$IMG" ||: |
||||