forked from mirrored-repos/manjaro-tools
Compare commits
109 commits
Author | SHA1 | Date | |
---|---|---|---|
|
b8bcf4a718 | ||
|
aad17cb42d | ||
|
128d05c818 | ||
|
54f55bbc8c | ||
|
9d4bd376dc | ||
|
2ec2daaf59 | ||
|
9f87dee9c0 | ||
|
6281ded2a0 | ||
|
d06e1a636f | ||
|
bc00b792dd | ||
|
e0ebb5ca34 | ||
|
0e6882ad5e | ||
|
0f4672a63f | ||
|
a1371dbd8a | ||
|
be1b965c94 | ||
|
43cb466d53 | ||
|
43c2590700 | ||
|
eaec1f493a | ||
|
45769a70c4 | ||
|
dad36a9f92 | ||
|
5fee94db78 | ||
|
e3cd02acb0 | ||
|
9c8cca5997 | ||
|
9573ffe982 | ||
|
c6772538b7 | ||
|
41265d1744 | ||
|
817720d798 | ||
|
a3e686473d | ||
|
332c7815db | ||
|
7c1c9f4520 | ||
|
8b5c1bc3ff | ||
|
ea0df5a966 | ||
|
c3495083c9 | ||
|
21dbbb3ff9 | ||
|
a9625a7193 | ||
|
7beb4f54e2 | ||
|
0c868a1ec6 | ||
|
7b7f235473 | ||
|
40f621a741 | ||
|
f1d8bb4f26 | ||
|
feab13d1b5 | ||
|
8a7d47b181 | ||
|
19cece4d0e | ||
|
436eafaddf | ||
|
95cef43bc7 | ||
|
49ed39be2a | ||
|
faee115b2e | ||
|
f0cb781d71 | ||
|
33d311cee6 | ||
|
0d994ae7b9 | ||
|
ebdcecf9d1 | ||
|
e47b445eed | ||
|
22a3c4221b | ||
|
e1b82cec3a | ||
|
913b9d874c | ||
|
1702ed7aea | ||
|
5f06a4dd5d | ||
|
bb34a7f6d0 | ||
|
8046b1f4b1 | ||
|
984d5adde4 | ||
|
3278c1df91 | ||
|
ab5d0deb47 | ||
|
d734e5457c | ||
|
1648288c9f | ||
|
94fcd520c5 | ||
|
aef651518a | ||
|
15cfc351e8 | ||
|
59294cf2a7 | ||
|
95f296acde | ||
|
aa84e639a3 | ||
|
1b50455b51 | ||
|
254bcfd10f | ||
|
0b5482f7f0 | ||
|
6f00ee26bb | ||
|
21d5a1a0d6 | ||
|
1d3003ecd9 | ||
|
a8c3d88d8c | ||
|
333d307a44 | ||
|
ad7715c3b6 | ||
|
7fdcb0fcb3 | ||
|
7aa3c071eb | ||
|
711397a74c | ||
|
952f516389 | ||
|
28c6d649aa | ||
|
d84f30aa08 | ||
|
69445b01f5 | ||
|
3828892808 | ||
|
17b8b418ab | ||
|
ecf8a998dc | ||
|
470e64b563 | ||
|
ad13419fbe | ||
|
c225d41f87 | ||
|
ed8de0f88d | ||
|
bf2ddc1e1d | ||
|
d455564eb6 | ||
|
a4fc8325df | ||
|
b121fe7490 | ||
|
518992d723 | ||
|
a1492e8d1e | ||
|
25ddeb1593 | ||
|
37b9feb061 | ||
|
93626731c7 | ||
|
9533b8ce93 | ||
|
ed95e249a2 | ||
|
8a5fc4e0b0 | ||
|
734ea24b57 | ||
|
d477c42ecb | ||
|
92aaea7694 | ||
|
187aac2a35 |
48 changed files with 2113 additions and 2049 deletions
339
LICENSE
Normal file
339
LICENSE
Normal file
|
@ -0,0 +1,339 @@
|
||||||
|
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.
|
11
Makefile
11
Makefile
|
@ -1,4 +1,4 @@
|
||||||
Version=0.15.0
|
Version=0.16.0
|
||||||
|
|
||||||
PREFIX = /usr/local
|
PREFIX = /usr/local
|
||||||
SYSCONFDIR = /etc
|
SYSCONFDIR = /etc
|
||||||
|
@ -16,14 +16,14 @@ BIN_BASE = \
|
||||||
|
|
||||||
LIBS_BASE = \
|
LIBS_BASE = \
|
||||||
lib/util.sh \
|
lib/util.sh \
|
||||||
lib/util-mount.sh \
|
|
||||||
lib/util-msg.sh \
|
lib/util-msg.sh \
|
||||||
|
lib/util-mount.sh \
|
||||||
|
lib/util-chroot.sh \
|
||||||
lib/util-fstab.sh
|
lib/util-fstab.sh
|
||||||
|
|
||||||
SHARED_BASE = \
|
SHARED_BASE = \
|
||||||
data/pacman-default.conf \
|
data/pacman-default.conf \
|
||||||
data/pacman-multilib.conf \
|
data/pacman-multilib.conf
|
||||||
data/pacman-mirrors.conf
|
|
||||||
|
|
||||||
LIST_PKG = \
|
LIST_PKG = \
|
||||||
$(wildcard data/pkg.list.d/*.list)
|
$(wildcard data/pkg.list.d/*.list)
|
||||||
|
@ -87,7 +87,8 @@ BIN_YAML = \
|
||||||
bin/check-yaml
|
bin/check-yaml
|
||||||
|
|
||||||
LIBS_YAML = \
|
LIBS_YAML = \
|
||||||
lib/util-yaml.sh
|
$(wildcard lib/util-yaml*.sh) \
|
||||||
|
lib/util-profile.sh
|
||||||
|
|
||||||
SHARED_YAML = \
|
SHARED_YAML = \
|
||||||
data/linux.preset
|
data/linux.preset
|
||||||
|
|
82
README.md
82
README.md
|
@ -1,11 +1,9 @@
|
||||||
manjaro-tools
|
manjaro-tools
|
||||||
=============
|
=============
|
||||||
|
|
||||||
Manjaro-tools-0.14
|
|
||||||
|
|
||||||
User manual
|
User manual
|
||||||
|
|
||||||
###1. manjaro-tools.conf
|
### 1. manjaro-tools.conf
|
||||||
|
|
||||||
manjaro-tools.conf is the central configuration file for manjaro-tools.
|
manjaro-tools.conf is the central configuration file for manjaro-tools.
|
||||||
By default, the config is installed in
|
By default, the config is installed in
|
||||||
|
@ -65,9 +63,6 @@ overriding
|
||||||
# build dir where buildpkg or buildiso chroots are created
|
# build dir where buildpkg or buildiso chroots are created
|
||||||
# chroots_dir=/var/lib/manjaro-tools
|
# chroots_dir=/var/lib/manjaro-tools
|
||||||
|
|
||||||
# log dir where log files are created
|
|
||||||
# log_dir='/var/log/manjaro-tools'
|
|
||||||
|
|
||||||
# custom build mirror server
|
# custom build mirror server
|
||||||
# build_mirror=http://mirror.netzspielplatz.de/manjaro/packages
|
# build_mirror=http://mirror.netzspielplatz.de/manjaro/packages
|
||||||
|
|
||||||
|
@ -124,34 +119,37 @@ overriding
|
||||||
# iso_mirrors=('heanet' 'jaist' 'netcologne' 'iweb' 'kent')
|
# iso_mirrors=('heanet' 'jaist' 'netcologne' 'iweb' 'kent')
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
###2. buildpkg
|
### 2. buildpkg
|
||||||
|
|
||||||
buildpkg is the chroot build script of manjaro-tools.
|
buildpkg is the chroot build script of manjaro-tools.
|
||||||
It it run in a abs/pkgbuilds directory which contains directories with PKGBUILD.
|
It it run in a abs/pkgbuilds directory which contains directories with PKGBUILD.
|
||||||
|
|
||||||
######manjaro-tools.conf supports the makepkg.conf variables
|
###### manjaro-tools.conf supports the makepkg.conf variables
|
||||||
|
|
||||||
####Arguments
|
#### Arguments
|
||||||
|
|
||||||
~~~
|
~~~
|
||||||
$ buildpkg -h
|
$ buildpkg -h
|
||||||
Usage: buildpkg [options]
|
Usage: buildpkg [options]
|
||||||
-p <pkg> Buildset or pkg [default: default]
|
-p <pkg> Build list or pkg [default: default]
|
||||||
-a <arch> Arch [default: auto]
|
-a <arch> Arch [default: auto]
|
||||||
-b <branch> Branch [default: stable]
|
-b <branch> Branch [default: stable]
|
||||||
-r <dir> Chroots directory
|
-r <dir> Chroots directory
|
||||||
[default: /var/lib/manjaro-tools/buildpkg]
|
[default: /var/lib/manjaro-tools/buildpkg]
|
||||||
-i <pkg> Install a package into the working copy of the chroot
|
-i <pkgs> Install packages into the working copy of the chroot
|
||||||
-c Recreate chroot
|
-o Create chroot
|
||||||
|
-d Delete chroot
|
||||||
|
-c Clean chroot copy
|
||||||
|
-u Update chroot copy
|
||||||
-w Clean up cache and sources
|
-w Clean up cache and sources
|
||||||
-n Install and run namcap check
|
-n Install and run namcap check
|
||||||
-s Sign packages
|
-s Sign packages
|
||||||
-u udev base-devel group (no systemd)
|
-x Udev base-devel group (no systemd)
|
||||||
-q Query settings and pretend build
|
-q Query settings and pretend build
|
||||||
-h This help
|
-h This help
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
######* build sysvinit package for both arches and branch testing:
|
###### * build sysvinit package for both arches and branch testing:
|
||||||
|
|
||||||
* i686(buildsystem is x86_64)
|
* i686(buildsystem is x86_64)
|
||||||
|
|
||||||
|
@ -168,32 +166,32 @@ buildpkg -p sysvinit -b testing -cswn
|
||||||
You can drop the branch arg if you set the branch in manjaro-tools.conf
|
You can drop the branch arg if you set the branch in manjaro-tools.conf
|
||||||
The arch can also be set in manjaro-tools.conf, but under normal conditions, it is better to specify the non native arch by -a parameter.
|
The arch can also be set in manjaro-tools.conf, but under normal conditions, it is better to specify the non native arch by -a parameter.
|
||||||
|
|
||||||
######* -c
|
###### * -c
|
||||||
* Removes the chroot dir
|
* Removes the chroot dir
|
||||||
* If the -c parameter is not used, buildpkg will update the existing chroot or create a new one if none is present.
|
* If the -c parameter is not used, buildpkg will update the existing chroot or create a new one if none is present.
|
||||||
|
|
||||||
######* -w
|
###### * -w
|
||||||
* Cleans pkgcache, and logfiles
|
* Cleans pkgcache, and logfiles
|
||||||
|
|
||||||
######* -s
|
###### * -s
|
||||||
* Signs the package when built
|
* Signs the package when built
|
||||||
|
|
||||||
######* -n
|
###### * -n
|
||||||
* Installs the built package in the chroot and runs a namcap check
|
* Installs the built package in the chroot and runs a namcap check
|
||||||
|
|
||||||
######* -u
|
###### * -u
|
||||||
* Create udev build root (for eudev builds)
|
* Create udev build root (for eudev builds)
|
||||||
|
|
||||||
###3. buildiso
|
### 3. buildiso
|
||||||
|
|
||||||
buildiso is used to build manjaro-iso-profiles. It is run insde the profiles folder.
|
buildiso is used to build manjaro-iso-profiles. It is run insde the profiles folder.
|
||||||
|
|
||||||
#####Packages for livecd only:
|
##### Packages for livecd only:
|
||||||
|
|
||||||
* manjaro-livecd-openrc
|
* manjaro-livecd-openrc
|
||||||
* manjaro-livecd-systemd
|
* manjaro-livecd-systemd
|
||||||
|
|
||||||
####Arguments
|
#### Arguments
|
||||||
|
|
||||||
~~~
|
~~~
|
||||||
$ buildiso -h
|
$ buildiso -h
|
||||||
|
@ -221,7 +219,7 @@ Usage: buildiso [options]
|
||||||
-h This help
|
-h This help
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
######* build xfce iso profile for both arches and branch testing on x86_64 build system
|
###### * build xfce iso profile for both arches and branch testing on x86_64 build system
|
||||||
|
|
||||||
* i686 (buildsystem is x86_64)
|
* i686 (buildsystem is x86_64)
|
||||||
|
|
||||||
|
@ -237,16 +235,16 @@ buildiso -p xfce -b testing
|
||||||
|
|
||||||
The branch can be defined also in manjaro-tools.conf, but a manual parameter will always override conf settings.
|
The branch can be defined also in manjaro-tools.conf, but a manual parameter will always override conf settings.
|
||||||
|
|
||||||
####Special parameters
|
#### Special parameters
|
||||||
|
|
||||||
######* -x
|
###### * -x
|
||||||
* Build images only
|
* Build images only
|
||||||
* will stop after all packages have been installed. No iso sqfs compression will be executed
|
* will stop after all packages have been installed. No iso sqfs compression will be executed
|
||||||
|
|
||||||
######* -z
|
###### * -z
|
||||||
* Use this to sqfs compress the chroots if you previously used -x.
|
* Use this to sqfs compress the chroots if you previously used -x.
|
||||||
|
|
||||||
###4. check-yaml
|
### 4. check-yaml
|
||||||
|
|
||||||
check-yaml can be used to write profile package lists to yaml.
|
check-yaml can be used to write profile package lists to yaml.
|
||||||
It is also possible to generate calamares conf file as buildiso would do.
|
It is also possible to generate calamares conf file as buildiso would do.
|
||||||
|
@ -265,7 +263,7 @@ Usage: check-yaml [options]
|
||||||
-q Query settings
|
-q Query settings
|
||||||
-h This help
|
-h This help
|
||||||
~~~
|
~~~
|
||||||
######* build xfce iso profile for both arches and branch testing on x86_64 build system
|
###### * build xfce iso profile for both arches and branch testing on x86_64 build system
|
||||||
|
|
||||||
* i686 (buildsystem is x86_64)
|
* i686 (buildsystem is x86_64)
|
||||||
|
|
||||||
|
@ -285,19 +283,19 @@ check-yaml -p xfce -c
|
||||||
check-yaml -p kdebase -gv
|
check-yaml -p kdebase -gv
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
####Special parameters
|
#### Special parameters
|
||||||
|
|
||||||
######* -c
|
###### * -c
|
||||||
* generate calamares module and settings conf files per profile
|
* generate calamares module and settings conf files per profile
|
||||||
|
|
||||||
######* -g
|
###### * -g
|
||||||
* generate a netgroup for specified pacman group
|
* generate a netgroup for specified pacman group
|
||||||
|
|
||||||
###5. buildtree
|
### 5. buildtree
|
||||||
|
|
||||||
buildtree is a little tools to sync arch abs and manjaro PKGBUILD git repos.
|
buildtree is a little tools to sync arch abs and manjaro PKGBUILD git repos.
|
||||||
|
|
||||||
####Arguments
|
#### Arguments
|
||||||
|
|
||||||
~~~
|
~~~
|
||||||
$ buildtree -h
|
$ buildtree -h
|
||||||
|
@ -309,19 +307,19 @@ Usage: buildtree [options]
|
||||||
-h This help
|
-h This help
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
######* sync arch and manjaro trees
|
###### * sync arch and manjaro trees
|
||||||
|
|
||||||
~~~
|
~~~
|
||||||
buildtree -as
|
buildtree -as
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
###6. manjaro-chroot
|
### 6. manjaro-chroot
|
||||||
|
|
||||||
manjaro-chroot is a little tool to quickly chroot into a second system installed on the host.
|
manjaro-chroot is a little tool to quickly chroot into a second system installed on the host.
|
||||||
If the automount option is enabled, manjaro-chroot will detect installed systems with os-prober, and pops up a list with linux systems to select from.
|
If the automount option is enabled, manjaro-chroot will detect installed systems with os-prober, and pops up a list with linux systems to select from.
|
||||||
If there is only 1 system installed besides the host system, no list will pop up and it will automatically mount the second system.
|
If there is only 1 system installed besides the host system, no list will pop up and it will automatically mount the second system.
|
||||||
|
|
||||||
####Arguments
|
#### Arguments
|
||||||
|
|
||||||
~~~
|
~~~
|
||||||
$ manjaro-chroot -h
|
$ manjaro-chroot -h
|
||||||
|
@ -336,26 +334,26 @@ usage: manjaro-chroot -a [or] manjaro-chroot chroot-dir [command]
|
||||||
and /build/manjaro-tools/manjaro-chroot.
|
and /build/manjaro-tools/manjaro-chroot.
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
######* automount
|
###### * automount
|
||||||
|
|
||||||
~~~
|
~~~
|
||||||
manjaro-chroot -a
|
manjaro-chroot -a
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
######* mount manually
|
###### * mount manually
|
||||||
|
|
||||||
~~~
|
~~~
|
||||||
manjaro-chroot /mnt /bin/bash
|
manjaro-chroot /mnt /bin/bash
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
###7. deployiso
|
### 7. deployiso
|
||||||
|
|
||||||
deployiso is a script to upload a specific iso or a buiildset to SF.
|
deployiso is a script to upload a specific iso or a buiildset to SF.
|
||||||
It needs to be run inside the iso-profiles directory.
|
It needs to be run inside the iso-profiles directory.
|
||||||
|
|
||||||
Ideally, you have a running ssh agent on the host, and your key added, and your public key provided to your SF account. You can then upload without being asked for ssh password.
|
Ideally, you have a running ssh agent on the host, and your key added, and your public key provided to your SF account. You can then upload without being asked for ssh password.
|
||||||
|
|
||||||
####Arguments
|
#### Arguments
|
||||||
|
|
||||||
~~~
|
~~~
|
||||||
$ deployiso -h
|
$ deployiso -h
|
||||||
|
@ -370,13 +368,13 @@ Usage: deployiso [options]
|
||||||
-h This help
|
-h This help
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
######* upload official build list, ie all built iso defined in a build list
|
###### * upload official build list, ie all built iso defined in a build list
|
||||||
|
|
||||||
~~~
|
~~~
|
||||||
deployiso -p official -c
|
deployiso -p official -c
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
######* upload xfce
|
###### * upload xfce
|
||||||
|
|
||||||
~~~
|
~~~
|
||||||
deployiso -p xfce -c
|
deployiso -p xfce -c
|
||||||
|
|
|
@ -16,25 +16,28 @@ DATADIR='@datadir@'
|
||||||
LIBDIR='@libdir@'
|
LIBDIR='@libdir@'
|
||||||
|
|
||||||
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
|
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
|
||||||
|
|
||||||
import ${LIBDIR}/util.sh
|
import ${LIBDIR}/util.sh
|
||||||
import ${LIBDIR}/util-mount.sh
|
import ${LIBDIR}/util-mount.sh
|
||||||
|
import ${LIBDIR}/util-chroot.sh
|
||||||
|
|
||||||
newroot=/mnt
|
newroot=/mnt
|
||||||
|
|
||||||
hostcache=false
|
hostcache=false
|
||||||
copykeyring=true
|
copykeyring=true
|
||||||
copymirrorlist=true
|
copymirrorlist=true
|
||||||
|
branch=stable
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "usage: ${0##*/} [options] root [packages...]"
|
echo "usage: ${0##*/} [options] root [packages...]"
|
||||||
echo " -C config Use an alternate config file for pacman"
|
echo " -C <config> Use an alternate config file for pacman"
|
||||||
echo " -c Use the package cache on the host, rather than the target"
|
echo " -B <branch> Use an alternate branch"
|
||||||
echo " -d Allow installation to a non-mountpoint directory"
|
echo ' -U <url> Use a specific mirror'
|
||||||
echo " -G Avoid copying the host's pacman keyring to the target"
|
echo " -c Use the package cache on the host, rather than the target"
|
||||||
echo " -i Avoid auto-confirmation of package selections"
|
echo " -d Allow installation to a non-mountpoint directory"
|
||||||
echo " -M Avoid copying the host's mirrorlist to the target"
|
echo " -G Avoid copying the host's pacman keyring to the target"
|
||||||
echo " -h Print this help message"
|
echo " -i Avoid auto-confirmation of package selections"
|
||||||
|
echo " -M Avoid copying the host's mirrorlist to the target"
|
||||||
|
echo " -h Print this help message"
|
||||||
echo ''
|
echo ''
|
||||||
echo ' basestrap installs packages to the specified new root directory.'
|
echo ' basestrap installs packages to the specified new root directory.'
|
||||||
echo ' If no packages are given, basestrap defaults to the "base" group.'
|
echo ' If no packages are given, basestrap defaults to the "base" group.'
|
||||||
|
@ -43,19 +46,15 @@ usage() {
|
||||||
exit $1
|
exit $1
|
||||||
}
|
}
|
||||||
|
|
||||||
# if [[ -z $1 || $1 = @(-h|--help) ]]; then
|
orig_argv=("$0" "$@")
|
||||||
# usage
|
|
||||||
# exit $(( $# ? 0 : 1 ))
|
|
||||||
# fi
|
|
||||||
#
|
|
||||||
|
|
||||||
orig_argv=("$@")
|
opts=':C:B:U:cdGiM'
|
||||||
|
|
||||||
opts=':C:cdGiM'
|
|
||||||
|
|
||||||
while getopts ${opts} arg; do
|
while getopts ${opts} arg; do
|
||||||
case "${arg}" in
|
case "${arg}" in
|
||||||
C) pacman_config=$OPTARG ;;
|
C) pacman_conf=$OPTARG ;;
|
||||||
|
B) branch="$OPTARG" ;;
|
||||||
|
U) mirror="$OPTARG" ;;
|
||||||
d) directory=true ;;
|
d) directory=true ;;
|
||||||
c) hostcache=true ;;
|
c) hostcache=true ;;
|
||||||
i) interactive=true ;;
|
i) interactive=true ;;
|
||||||
|
@ -67,27 +66,34 @@ while getopts ${opts} arg; do
|
||||||
done
|
done
|
||||||
shift $(( OPTIND - 1 ))
|
shift $(( OPTIND - 1 ))
|
||||||
|
|
||||||
check_root "$0" "${orig_argv[@]}"
|
check_root
|
||||||
|
|
||||||
(( $# )) || die "No root directory specified"
|
(( $# )) || die "No root directory specified"
|
||||||
newroot=$1; shift
|
newroot=$1; shift
|
||||||
pacman_args=("${@:-base}")
|
pacman_args=("${@:-base}")
|
||||||
|
pm_args=(-a -p "$newroot" -S "${branch}")
|
||||||
|
|
||||||
${hostcache} && pacman_args+=(--cachedir="$newroot/var/cache/pacman/pkg")
|
${hostcache} && pacman_args+=(--cachedir="$newroot/var/cache/pacman/pkg")
|
||||||
|
|
||||||
${interactive} && pacman_args+=(--noconfirm)
|
${interactive} && pacman_args+=(--noconfirm)
|
||||||
|
|
||||||
[[ -n $pacman_config ]] && pacman_args+=(--config="$pacman_config")
|
[[ -n $pacman_conf ]] && pacman_args+=(--config="$pacman_conf")
|
||||||
|
|
||||||
|
[[ -n ${mirror} ]] && pm_args+=(-U "${mirror}")
|
||||||
|
|
||||||
[[ -d $newroot ]] || die "%s is not a directory" "$newroot"
|
[[ -d $newroot ]] || die "%s is not a directory" "$newroot"
|
||||||
|
|
||||||
if ! mountpoint -q "$newroot" && ! ${directory}; then
|
if ! mountpoint -q "$newroot" && ! ${directory}; then
|
||||||
die '%s is not a mountpoint!' "$newroot"
|
die '%s is not a mountpoint!' "$newroot"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# create obligatory directories
|
# create obligatory directories
|
||||||
create_min_fs "$newroot"
|
create_min_fs "$newroot"
|
||||||
|
|
||||||
|
if [[ ! -f $newroot/etc/pacman-mirrors.conf ]]; then
|
||||||
|
pacman-mirrors "${pm_args[@]}"
|
||||||
|
fi
|
||||||
|
|
||||||
# mount API filesystems
|
# mount API filesystems
|
||||||
chroot_api_mount "$newroot" || die "failed to setup API filesystems in new root"
|
chroot_api_mount "$newroot" || die "failed to setup API filesystems in new root"
|
||||||
|
|
||||||
|
@ -96,9 +102,6 @@ if ! pacman -r "$newroot" -Sy "${pacman_args[@]}"; then
|
||||||
die 'Failed to install packages to new root'
|
die 'Failed to install packages to new root'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# kill chroot process if needed (TODO: check if needed at all)
|
|
||||||
kill_chroot_process "$newroot"
|
|
||||||
|
|
||||||
if ${copykeyring};then
|
if ${copykeyring};then
|
||||||
copy_keyring "$newroot"
|
copy_keyring "$newroot"
|
||||||
fi
|
fi
|
||||||
|
@ -106,4 +109,3 @@ fi
|
||||||
if ${copymirrorlist};then
|
if ${copymirrorlist};then
|
||||||
copy_mirrorlist "$newroot"
|
copy_mirrorlist "$newroot"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -16,11 +16,46 @@ DATADIR='@datadir@'
|
||||||
SYSCONFDIR='@sysconfdir@'
|
SYSCONFDIR='@sysconfdir@'
|
||||||
|
|
||||||
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
|
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
|
||||||
|
|
||||||
import ${LIBDIR}/util.sh
|
import ${LIBDIR}/util.sh
|
||||||
|
import ${LIBDIR}/util-iso.sh
|
||||||
|
|
||||||
|
prepare_build(){
|
||||||
|
timer_start=$(get_timer)
|
||||||
|
profile=$1
|
||||||
|
edition=$(get_edition "${profile}")
|
||||||
|
local profile_dir=${run_dir}/${edition}/${profile}
|
||||||
|
|
||||||
|
load_profile "${profile_dir}"
|
||||||
|
|
||||||
|
local user_conf=${profile_dir}/user-repos.conf pac_arch='default' pacman_conf
|
||||||
|
[[ "${target_arch}" == 'x86_64' ]] && pac_arch='multilib'
|
||||||
|
if [[ -f ${user_conf} ]];then
|
||||||
|
info "detected: %s" "user-repos.conf"
|
||||||
|
check_user_repos_conf "${user_conf}"
|
||||||
|
pacman_conf=${tmp_dir}/custom-pacman.conf
|
||||||
|
cat ${DATADIR}/pacman-$pac_arch.conf ${user_conf} > "$pacman_conf"
|
||||||
|
else
|
||||||
|
pacman_conf="${DATADIR}/pacman-$pac_arch.conf"
|
||||||
|
fi
|
||||||
|
|
||||||
|
iso_file=$(gen_iso_fn).iso
|
||||||
|
|
||||||
|
mkchroot_args+=(-C ${pacman_conf} -U "${build_mirror}/" -B "${target_branch}")
|
||||||
|
work_dir=${chroots_iso}/${profile}/${target_arch}
|
||||||
|
|
||||||
|
iso_dir="${cache_dir_iso}/${edition}/${profile}/${dist_release}"
|
||||||
|
|
||||||
|
iso_root=${chroots_iso}/${profile}/iso
|
||||||
|
mnt_dir=${chroots_iso}/${profile}/mnt
|
||||||
|
prepare_dir "${mnt_dir}"
|
||||||
|
|
||||||
|
prepare_dir "${iso_dir}"
|
||||||
|
user_own "${iso_dir}"
|
||||||
|
}
|
||||||
|
|
||||||
show_profile(){
|
show_profile(){
|
||||||
prepare_profile "$1"
|
local prof="$1"
|
||||||
|
prepare_build "$prof"
|
||||||
msg2 "iso_file: %s" "${iso_file}"
|
msg2 "iso_file: %s" "${iso_file}"
|
||||||
if ${verbose};then
|
if ${verbose};then
|
||||||
msg2 "autologin: %s" "${autologin}"
|
msg2 "autologin: %s" "${autologin}"
|
||||||
|
@ -33,25 +68,18 @@ show_profile(){
|
||||||
msg2 "netinstall: %s" "${netinstall}"
|
msg2 "netinstall: %s" "${netinstall}"
|
||||||
msg2 "chrootcfg: %s" "${chrootcfg}"
|
msg2 "chrootcfg: %s" "${chrootcfg}"
|
||||||
${netinstall} && msg2 "netgroups: %s" "$(get_yaml)"
|
${netinstall} && msg2 "netgroups: %s" "$(get_yaml)"
|
||||||
msg2 "geoip: %s" "${geoip}"
|
|
||||||
|
|
||||||
msg2 "efi_boot_loader: %s" "${efi_boot_loader}"
|
|
||||||
|
|
||||||
msg2 "hostname: %s" "${hostname}"
|
msg2 "hostname: %s" "${hostname}"
|
||||||
msg2 "username: %s" "${username}"
|
msg2 "username: %s" "${username}"
|
||||||
msg2 "password: %s" "${password}"
|
msg2 "password: %s" "${password}"
|
||||||
msg2 "login_shell: %s" "${login_shell}"
|
msg2 "login_shell: %s" "${login_shell}"
|
||||||
msg2 "addgroups: %s" "${addgroups}"
|
msg2 "addgroups: %s" "${addgroups}"
|
||||||
[[ -n ${smb_workgroup} ]] && msg2 "smb_workgroup: %s" "${smb_workgroup}"
|
|
||||||
|
|
||||||
|
msg2 "enable_live: %s" "${enable_live[*]}"
|
||||||
if [[ ${initsys} == 'systemd' ]];then
|
if [[ ${initsys} == 'systemd' ]];then
|
||||||
msg2 "enable_systemd: %s" "${enable_systemd[*]}"
|
msg2 "enable_systemd: %s" "${enable_systemd[*]}"
|
||||||
msg2 "enable_systemd_live: %s" "${enable_systemd_live[*]}"
|
|
||||||
[[ -n ${disable_systemd[*]} ]] && msg2 "disable_systemd: %s" "${disable_systemd[*]}"
|
|
||||||
else
|
else
|
||||||
msg2 "enable_openrc: %s" "${enable_openrc[*]}"
|
msg2 "enable_openrc: %s" "${enable_openrc[*]}"
|
||||||
msg2 "enable_openrc_live: %s" "${enable_openrc_live[*]}"
|
|
||||||
[[ -n ${disable_openrc[*]} ]] && msg2 "disable_openrc: %s" "${disable_openrc[*]}"
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
reset_profile
|
reset_profile
|
||||||
|
@ -61,9 +89,9 @@ display_settings(){
|
||||||
show_version
|
show_version
|
||||||
show_config
|
show_config
|
||||||
|
|
||||||
msg "PROFILE:"
|
# msg "PROFILE:"
|
||||||
msg2 "build_lists: %s" "$(show_build_lists ${list_dir_iso})"
|
# msg2 "build_lists: %s" "$(show_build_lists ${list_dir_iso})"
|
||||||
msg2 "build_list_iso: %s" "${build_list_iso}"
|
# msg2 "build_list_iso: %s" "${build_list_iso}"
|
||||||
msg2 "is_build_list: %s" "${is_build_list}"
|
msg2 "is_build_list: %s" "${is_build_list}"
|
||||||
|
|
||||||
msg "OPTIONS:"
|
msg "OPTIONS:"
|
||||||
|
@ -93,12 +121,9 @@ display_settings(){
|
||||||
|
|
||||||
load_user_info
|
load_user_info
|
||||||
|
|
||||||
load_config "${USERCONFDIR}/manjaro-tools.conf" || load_config "${SYSCONFDIR}/manjaro-tools.conf"
|
load_config "${MT_USERCONFDIR}/manjaro-tools.conf" || load_config "${SYSCONFDIR}/manjaro-tools.conf"
|
||||||
|
|
||||||
# to force old way to have buildiso run in iso-profiles dir
|
load_run_dir
|
||||||
# run_dir=$(pwd)
|
|
||||||
|
|
||||||
load_run_dir "${profile_repo}"
|
|
||||||
|
|
||||||
clean_first=true
|
clean_first=true
|
||||||
pretend=false
|
pretend=false
|
||||||
|
@ -107,6 +132,8 @@ iso_only=false
|
||||||
verbose=false
|
verbose=false
|
||||||
persist=false
|
persist=false
|
||||||
|
|
||||||
|
mkchroot_args=()
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "Usage: ${0##*/} [options]"
|
echo "Usage: ${0##*/} [options]"
|
||||||
echo " -p <profile> Buildset or profile [default: ${build_list_iso}]"
|
echo " -p <profile> Buildset or profile [default: ${build_list_iso}]"
|
||||||
|
@ -135,7 +162,7 @@ usage() {
|
||||||
exit $1
|
exit $1
|
||||||
}
|
}
|
||||||
|
|
||||||
orig_argv=("$@")
|
orig_argv=("$0" "$@")
|
||||||
|
|
||||||
opts='p:a:b:r:t:k:i:g:czxmvqh'
|
opts='p:a:b:r:t:k:i:g:czxmvqh'
|
||||||
|
|
||||||
|
@ -162,27 +189,10 @@ done
|
||||||
|
|
||||||
shift $(($OPTIND - 1))
|
shift $(($OPTIND - 1))
|
||||||
|
|
||||||
timer_start=$(get_timer)
|
check_root
|
||||||
|
|
||||||
check_root "$0" "${orig_argv[@]}"
|
|
||||||
|
|
||||||
prepare_dir "${log_dir}"
|
|
||||||
|
|
||||||
prepare_dir "${tmp_dir}"
|
|
||||||
|
|
||||||
eval_build_list "${list_dir_iso}" "${build_list_iso}"
|
|
||||||
|
|
||||||
import ${LIBDIR}/util-iso.sh
|
|
||||||
import ${LIBDIR}/util-iso-mount.sh
|
|
||||||
|
|
||||||
check_requirements
|
check_requirements
|
||||||
|
|
||||||
for sig in TERM HUP QUIT; do
|
|
||||||
trap "trap_exit $sig \"$(gettext "%s signal caught. Exiting...")\" \"$sig\"" "$sig"
|
|
||||||
done
|
|
||||||
trap 'trap_exit INT "$(gettext "Aborted by user! Exiting...")"' INT
|
|
||||||
trap 'trap_exit USR1 "$(gettext "An unknown error has occurred. Exiting...")"' ERR
|
|
||||||
|
|
||||||
${pretend} && display_settings && exit 1
|
${pretend} && display_settings && exit 1
|
||||||
|
|
||||||
run build "${build_list_iso}"
|
run build "${build_list_iso}"
|
||||||
|
|
116
bin/buildpkg.in
116
bin/buildpkg.in
|
@ -18,8 +18,8 @@ DATADIR='@datadir@'
|
||||||
SYSCONFDIR='@sysconfdir@'
|
SYSCONFDIR='@sysconfdir@'
|
||||||
|
|
||||||
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
|
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
|
||||||
|
|
||||||
import ${LIBDIR}/util.sh
|
import ${LIBDIR}/util.sh
|
||||||
|
import ${LIBDIR}/util-chroot.sh
|
||||||
import ${LIBDIR}/util-pkg.sh
|
import ${LIBDIR}/util-pkg.sh
|
||||||
import ${LIBDIR}/util-pkg-chroot.sh
|
import ${LIBDIR}/util-pkg-chroot.sh
|
||||||
|
|
||||||
|
@ -37,9 +37,9 @@ display_settings(){
|
||||||
show_version
|
show_version
|
||||||
show_config
|
show_config
|
||||||
|
|
||||||
msg "PROFILE:"
|
# msg "PROFILE:"
|
||||||
msg2 "build_lists: %s" "$(show_build_lists ${list_dir_pkg})"
|
# msg2 "build_lists: %s" "$(show_build_lists ${list_dir_pkg})"
|
||||||
msg2 "build_list_pkg: %s" "${build_list_pkg}"
|
# msg2 "build_list_pkg: %s" "${build_list_pkg}"
|
||||||
msg2 "is_build_list: %s" "${is_build_list}"
|
msg2 "is_build_list: %s" "${is_build_list}"
|
||||||
|
|
||||||
msg "OPTIONS:"
|
msg "OPTIONS:"
|
||||||
|
@ -49,8 +49,11 @@ display_settings(){
|
||||||
|
|
||||||
|
|
||||||
msg "ARGS:"
|
msg "ARGS:"
|
||||||
|
msg2 "create_first: %s" "${create_first}"
|
||||||
|
msg2 "delete_first: %s" "${delete_first}"
|
||||||
msg2 "clean_first: %s" "${clean_first}"
|
msg2 "clean_first: %s" "${clean_first}"
|
||||||
msg2 "wipe_clean: %s" "${wipe_clean}"
|
msg2 "update_first: %s" "${update_first}"
|
||||||
|
msg2 "purge: %s" "${purge}"
|
||||||
msg2 "namcap: %s" "${namcap}"
|
msg2 "namcap: %s" "${namcap}"
|
||||||
msg2 "sign: %s" "${sign}"
|
msg2 "sign: %s" "${sign}"
|
||||||
msg2 "udev_root: %s" "${udev_root}"
|
msg2 "udev_root: %s" "${udev_root}"
|
||||||
|
@ -58,9 +61,9 @@ display_settings(){
|
||||||
msg "PATHS:"
|
msg "PATHS:"
|
||||||
msg2 "pkg_dir: %s" "${pkg_dir}"
|
msg2 "pkg_dir: %s" "${pkg_dir}"
|
||||||
|
|
||||||
if ${clean_first};then
|
if ${create_first};then
|
||||||
msg "PKG:"
|
msg "PKG:"
|
||||||
msg2 "base_packages: %s" "${base_packages[*]}"
|
msg2 "packages: %s" "${packages[*]}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
msg "BUILD QUEUE:"
|
msg "BUILD QUEUE:"
|
||||||
|
@ -69,13 +72,15 @@ display_settings(){
|
||||||
|
|
||||||
load_user_info
|
load_user_info
|
||||||
|
|
||||||
load_config "${USERCONFDIR}/manjaro-tools.conf" || load_config "${SYSCONFDIR}/manjaro-tools.conf"
|
load_config "${MT_USERCONFDIR}/manjaro-tools.conf" || load_config "${SYSCONFDIR}/manjaro-tools.conf"
|
||||||
load_vars "$USER_HOME/.makepkg.conf" || load_vars /etc/makepkg.conf
|
load_vars "${PAC_USERCONFDIR}/makepkg.conf" || load_vars "$USER_HOME/.makepkg.conf"
|
||||||
|
load_vars /etc/makepkg.conf
|
||||||
install_pkgs=()
|
|
||||||
|
|
||||||
|
create_first=false
|
||||||
|
delete_first=false
|
||||||
clean_first=false
|
clean_first=false
|
||||||
wipe_clean=false
|
update_first=false
|
||||||
|
purge=false
|
||||||
namcap=false
|
namcap=false
|
||||||
pretend=false
|
pretend=false
|
||||||
is_build_list=false
|
is_build_list=false
|
||||||
|
@ -83,6 +88,41 @@ sign=false
|
||||||
udev_root=false
|
udev_root=false
|
||||||
is_multilib=false
|
is_multilib=false
|
||||||
|
|
||||||
|
mkchroot_args=()
|
||||||
|
mkchrootpkg_args=()
|
||||||
|
|
||||||
|
install_pkgs=()
|
||||||
|
|
||||||
|
prepare_build(){
|
||||||
|
local pac_arch='default'
|
||||||
|
|
||||||
|
if [[ "${target_arch}" == 'multilib' ]];then
|
||||||
|
pac_arch='multilib'
|
||||||
|
is_multilib=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
local pacman_conf="${DATADIR}/pacman-$pac_arch.conf"
|
||||||
|
|
||||||
|
work_dir="${chroots_pkg}/${target_branch}/${target_arch}"
|
||||||
|
pkg_dir="${cache_dir_pkg}/${target_branch}/${target_arch}"
|
||||||
|
|
||||||
|
local makepkg_conf=$(get_makepkg_conf "${target_arch}")
|
||||||
|
|
||||||
|
[[ "$pac_arch" == 'multilib' ]] && target_arch='x86_64'
|
||||||
|
|
||||||
|
mkchroot_args+=(-C ${pacman_conf} -M ${makepkg_conf} -U "${build_mirror}/" -B "${target_branch}")
|
||||||
|
|
||||||
|
mkchrootpkg_args+=(-r ${work_dir})
|
||||||
|
|
||||||
|
prepare_dir "${work_dir}"
|
||||||
|
|
||||||
|
eval_build_list "${list_dir_pkg}" "${build_list_pkg}"
|
||||||
|
|
||||||
|
init_base_devel
|
||||||
|
|
||||||
|
timer_start=$(get_timer)
|
||||||
|
}
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "Usage: ${0##*/} [options]"
|
echo "Usage: ${0##*/} [options]"
|
||||||
echo " -p <pkg> Build list or pkg [default: ${build_list_pkg}]"
|
echo " -p <pkg> Build list or pkg [default: ${build_list_pkg}]"
|
||||||
|
@ -91,11 +131,14 @@ usage() {
|
||||||
echo ' -r <dir> Chroots directory'
|
echo ' -r <dir> Chroots directory'
|
||||||
echo " [default: ${chroots_pkg}]"
|
echo " [default: ${chroots_pkg}]"
|
||||||
echo ' -i <pkgs> Install packages into the working copy of the chroot'
|
echo ' -i <pkgs> Install packages into the working copy of the chroot'
|
||||||
echo ' -c Recreate chroot'
|
echo ' -o Create chroot'
|
||||||
|
echo ' -d Delete chroot'
|
||||||
|
echo ' -c Clean chroot copy'
|
||||||
|
echo ' -u Update chroot copy'
|
||||||
echo ' -w Clean up cache and sources'
|
echo ' -w Clean up cache and sources'
|
||||||
echo ' -n Install and run namcap check'
|
echo ' -n Install and run namcap check'
|
||||||
echo ' -s Sign packages'
|
echo ' -s Sign packages'
|
||||||
echo ' -u Udev base-devel group (no systemd)'
|
echo ' -x Udev base-devel group (no systemd)'
|
||||||
echo ' -q Query settings and pretend build'
|
echo ' -q Query settings and pretend build'
|
||||||
echo ' -h This help'
|
echo ' -h This help'
|
||||||
echo ''
|
echo ''
|
||||||
|
@ -103,9 +146,9 @@ usage() {
|
||||||
exit $1
|
exit $1
|
||||||
}
|
}
|
||||||
|
|
||||||
orig_argv=("$@")
|
orig_argv=("$0" "$@")
|
||||||
|
|
||||||
opts='p:a:b:r:i:cwnsuqh'
|
opts='p:a:b:r:i:odcuwnsxqh'
|
||||||
|
|
||||||
while getopts "${opts}" arg; do
|
while getopts "${opts}" arg; do
|
||||||
case "${arg}" in
|
case "${arg}" in
|
||||||
|
@ -113,48 +156,31 @@ while getopts "${opts}" arg; do
|
||||||
a) target_arch="$OPTARG" ;;
|
a) target_arch="$OPTARG" ;;
|
||||||
b) target_branch="$OPTARG" ;;
|
b) target_branch="$OPTARG" ;;
|
||||||
r) chroots_pkg="$OPTARG" ;;
|
r) chroots_pkg="$OPTARG" ;;
|
||||||
i) install_pkgs+=("$OPTARG"); mkchrootpkg_args+=(-I ${install_pkgs[*]}) ;;
|
i) install_pkgs+=("$OPTARG"); mkchrootpkg_args+=(-I "${install_pkgs[*]}") ;;
|
||||||
c) clean_first=true ;;
|
o) create_first=true ;;
|
||||||
w) wipe_clean=true ;;
|
d) delete_first=true ;;
|
||||||
|
c) clean_first=true ; mkchrootpkg_args+=(-c) ;;
|
||||||
|
u) update_first=true ; mkchrootpkg_args+=(-u) ;;
|
||||||
|
w) purge=true ;;
|
||||||
n) namcap=true; mkchrootpkg_args+=(-n) ;;
|
n) namcap=true; mkchrootpkg_args+=(-n) ;;
|
||||||
s) sign=true ;;
|
s) sign=true ;;
|
||||||
u) udev_root=true ;;
|
x) udev_root=true ;;
|
||||||
q) pretend=true ;;
|
q) pretend=true ;;
|
||||||
h|?) usage 0 ;;
|
h|?) usage 0 ;;
|
||||||
*) echo "invalid argument '${arg}'"; usage 1 ;;
|
*) echo "invalid argument '%s'" "${arg}"; usage 1 ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
shift $(($OPTIND - 1))
|
shift $(($OPTIND - 1))
|
||||||
|
|
||||||
check_root "$0" "${orig_argv[@]}"
|
check_root
|
||||||
|
|
||||||
prepare_dir "${log_dir}"
|
prepare_build
|
||||||
|
|
||||||
prepare_dir "${tmp_dir}"
|
|
||||||
|
|
||||||
prepare_conf "${target_arch}"
|
|
||||||
|
|
||||||
mirrors_conf=$(get_pac_mirrors_conf "${target_branch}")
|
|
||||||
|
|
||||||
mkchroot_args+=(-C ${pacman_conf} -M ${makepkg_conf} -S ${mirrors_conf} -B "${build_mirror}/${target_branch}")
|
|
||||||
|
|
||||||
mkchrootpkg_args+=(-r ${work_dir})
|
|
||||||
|
|
||||||
timer_start=$(get_timer)
|
|
||||||
|
|
||||||
eval_build_list "${list_dir_pkg}" "${build_list_pkg}"
|
|
||||||
|
|
||||||
prepare_dir "${pkg_dir}"
|
|
||||||
|
|
||||||
user_own "${pkg_dir}"
|
|
||||||
|
|
||||||
init_base_devel
|
|
||||||
|
|
||||||
${pretend} && display_settings && exit
|
${pretend} && display_settings && exit
|
||||||
|
|
||||||
${wipe_clean} && clean_up
|
${delete_first} && delete_chroot "${work_dir}/root" "${work_dir}"
|
||||||
|
|
||||||
chroot_init
|
${create_first} && create_chroot "${mkchroot_args[@]}" "${work_dir}/root" "${packages[@]}"
|
||||||
|
|
||||||
run make_pkg "${build_list_pkg}"
|
run make_pkg "${build_list_pkg}"
|
||||||
|
|
|
@ -16,7 +16,7 @@ SYSCONFDIR='@sysconfdir@'
|
||||||
|
|
||||||
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
|
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
|
||||||
import ${LIBDIR}/util.sh
|
import ${LIBDIR}/util.sh
|
||||||
import ${LIBDIR}/util-pkgtree.sh
|
import ${LIBDIR}/util-pkg-tree.sh
|
||||||
|
|
||||||
display_settings(){
|
display_settings(){
|
||||||
show_version
|
show_version
|
||||||
|
@ -36,7 +36,7 @@ display_settings(){
|
||||||
|
|
||||||
load_user_info
|
load_user_info
|
||||||
|
|
||||||
load_config "${USERCONFDIR}/manjaro-tools.conf" || load_config "${SYSCONFDIR}/manjaro-tools.conf"
|
load_config "${MT_USERCONFDIR}/manjaro-tools.conf" || load_config "${SYSCONFDIR}/manjaro-tools.conf"
|
||||||
|
|
||||||
sync=false
|
sync=false
|
||||||
pretend=false
|
pretend=false
|
||||||
|
@ -55,7 +55,7 @@ usage() {
|
||||||
exit $1
|
exit $1
|
||||||
}
|
}
|
||||||
|
|
||||||
orig_argv=("$@")
|
orig_argv=("$0" "$@")
|
||||||
|
|
||||||
opts='sacqh'
|
opts='sacqh'
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ done
|
||||||
|
|
||||||
shift $(($OPTIND - 1))
|
shift $(($OPTIND - 1))
|
||||||
|
|
||||||
check_root "$0" "${orig_argv[@]}"
|
check_root
|
||||||
|
|
||||||
prepare_dir "${tree_dir_abs}"
|
prepare_dir "${tree_dir_abs}"
|
||||||
|
|
||||||
|
|
|
@ -16,9 +16,22 @@ DATADIR='@datadir@'
|
||||||
SYSCONFDIR='@sysconfdir@'
|
SYSCONFDIR='@sysconfdir@'
|
||||||
|
|
||||||
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
|
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
|
||||||
|
|
||||||
import ${LIBDIR}/util.sh
|
import ${LIBDIR}/util.sh
|
||||||
import ${LIBDIR}/util-yaml.sh
|
import ${LIBDIR}/util-yaml-check.sh
|
||||||
|
import ${LIBDIR}/util-profile.sh
|
||||||
|
|
||||||
|
prepare_check(){
|
||||||
|
local profile="$1"
|
||||||
|
edition=$(get_edition ${profile})
|
||||||
|
local profile_dir=${run_dir}/${edition}/${profile}
|
||||||
|
|
||||||
|
load_profile "${profile_dir}"
|
||||||
|
|
||||||
|
yaml_dir=${cache_dir_netinstall}/${profile}/${target_arch}
|
||||||
|
|
||||||
|
prepare_dir "${yaml_dir}"
|
||||||
|
user_own "${yaml_dir}"
|
||||||
|
}
|
||||||
|
|
||||||
show_profile(){
|
show_profile(){
|
||||||
prepare_check "$1"
|
prepare_check "$1"
|
||||||
|
@ -34,9 +47,6 @@ show_profile(){
|
||||||
msg2 "netinstall: %s" "${netinstall}"
|
msg2 "netinstall: %s" "${netinstall}"
|
||||||
msg2 "chrootcfg: %s" "${chrootcfg}"
|
msg2 "chrootcfg: %s" "${chrootcfg}"
|
||||||
${netinstall} && msg2 "netgroups: %s" "$(get_yaml)"
|
${netinstall} && msg2 "netgroups: %s" "$(get_yaml)"
|
||||||
msg2 "geoip: %s" "${geoip}"
|
|
||||||
|
|
||||||
msg2 "efi_boot_loader: %s" "${efi_boot_loader}"
|
|
||||||
|
|
||||||
msg2 "hostname: %s" "${hostname}"
|
msg2 "hostname: %s" "${hostname}"
|
||||||
msg2 "username: %s" "${username}"
|
msg2 "username: %s" "${username}"
|
||||||
|
@ -44,14 +54,11 @@ show_profile(){
|
||||||
msg2 "login_shell: %s" "${login_shell}"
|
msg2 "login_shell: %s" "${login_shell}"
|
||||||
msg2 "addgroups: %s" "${addgroups}"
|
msg2 "addgroups: %s" "${addgroups}"
|
||||||
|
|
||||||
|
msg2 "enable_live: %s" "${enable_live[*]}"
|
||||||
if [[ ${initsys} == 'systemd' ]];then
|
if [[ ${initsys} == 'systemd' ]];then
|
||||||
msg2 "enable_systemd: %s" "${enable_systemd[*]}"
|
msg2 "enable_systemd: %s" "${enable_systemd[*]}"
|
||||||
msg2 "enable_systemd_live: %s" "${enable_systemd_live[*]}"
|
|
||||||
[[ -n ${disable_systemd[*]} ]] && msg2 "disable_systemd: %s" "${disable_systemd[*]}"
|
|
||||||
else
|
else
|
||||||
msg2 "enable_openrc: %s" "${enable_openrc[*]}"
|
msg2 "enable_openrc: %s" "${enable_openrc[*]}"
|
||||||
msg2 "enable_openrc_live: %s" "${enable_openrc_live[*]}"
|
|
||||||
[[ -n ${disable_openrc[*]} ]] && msg2 "disable_openrc: %s" "${disable_openrc[*]}"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
reset_profile
|
reset_profile
|
||||||
|
@ -62,9 +69,9 @@ display_settings(){
|
||||||
show_version
|
show_version
|
||||||
show_config
|
show_config
|
||||||
|
|
||||||
msg "PROFILE:"
|
# msg "PROFILE:"
|
||||||
msg2 "build_lists: %s" "$(show_build_lists ${list_dir_iso})"
|
# msg2 "build_lists: %s" "$(show_build_lists ${list_dir_iso})"
|
||||||
msg2 "build_list_iso: %s" "${build_list_iso}"
|
# msg2 "build_list_iso: %s" "${build_list_iso}"
|
||||||
msg2 "is_build_list: %s" "${is_build_list}"
|
msg2 "is_build_list: %s" "${is_build_list}"
|
||||||
|
|
||||||
msg "OPTIONS:"
|
msg "OPTIONS:"
|
||||||
|
@ -83,12 +90,12 @@ display_settings(){
|
||||||
|
|
||||||
load_user_info
|
load_user_info
|
||||||
|
|
||||||
load_config "${USERCONFDIR}/manjaro-tools.conf" || load_config "${SYSCONFDIR}/manjaro-tools.conf"
|
load_config "${MT_USERCONFDIR}/manjaro-tools.conf" || load_config "${SYSCONFDIR}/manjaro-tools.conf"
|
||||||
|
|
||||||
# to force old way to have buildiso run in iso-profiles dir
|
# to force old way to have buildiso run in iso-profiles dir
|
||||||
# run_dir=$(pwd)
|
# run_dir=$(pwd)
|
||||||
|
|
||||||
load_run_dir "${profile_repo}"
|
load_run_dir
|
||||||
|
|
||||||
calamares=false
|
calamares=false
|
||||||
pretend=false
|
pretend=false
|
||||||
|
@ -112,7 +119,7 @@ usage() {
|
||||||
exit $1
|
exit $1
|
||||||
}
|
}
|
||||||
|
|
||||||
orig_argv=("$@")
|
orig_argv=("$0" "$@")
|
||||||
|
|
||||||
opts='p:a:i:k:gcvqh'
|
opts='p:a:i:k:gcvqh'
|
||||||
|
|
||||||
|
@ -133,9 +140,7 @@ done
|
||||||
|
|
||||||
shift $(($OPTIND - 1))
|
shift $(($OPTIND - 1))
|
||||||
|
|
||||||
check_root "$0" "${orig_argv[@]}"
|
check_root
|
||||||
|
|
||||||
prepare_dir "${tmp_dir}"
|
|
||||||
|
|
||||||
eval_build_list "${list_dir_iso}" "${build_list_iso}"
|
eval_build_list "${list_dir_iso}" "${build_list_iso}"
|
||||||
|
|
||||||
|
|
|
@ -14,12 +14,13 @@ version=@version@
|
||||||
LIBDIR='@libdir@'
|
LIBDIR='@libdir@'
|
||||||
|
|
||||||
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
|
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
|
||||||
|
|
||||||
import ${LIBDIR}/util-pkg.sh
|
import ${LIBDIR}/util-pkg.sh
|
||||||
|
|
||||||
shopt -s extglob
|
shopt -s extglob
|
||||||
|
|
||||||
load_vars "$HOME/.makepkg.conf"
|
load_user_info
|
||||||
|
|
||||||
|
load_vars "${PAC_USERCONFDIR}/makepkg.conf" || load_vars "$USER_HOME/.makepkg.conf"
|
||||||
load_vars /etc/makepkg.conf
|
load_vars /etc/makepkg.conf
|
||||||
|
|
||||||
if [[ ! -f PKGBUILD ]]; then
|
if [[ ! -f PKGBUILD ]]; then
|
||||||
|
|
|
@ -14,12 +14,13 @@ version=@version@
|
||||||
LIBDIR='@libdir@'
|
LIBDIR='@libdir@'
|
||||||
|
|
||||||
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
|
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
|
||||||
|
|
||||||
import ${LIBDIR}/util.sh
|
import ${LIBDIR}/util.sh
|
||||||
import ${LIBDIR}/util-mount.sh
|
import ${LIBDIR}/util-mount.sh
|
||||||
|
|
||||||
working_dir=''
|
working_dir=''
|
||||||
|
files=()
|
||||||
keep_mirrors=false
|
keep_mirrors=false
|
||||||
|
nosetarch=false
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "Usage: ${0##*/} [options] working-dir [run arguments]"
|
echo "Usage: ${0##*/} [options] working-dir [run arguments]"
|
||||||
|
@ -28,31 +29,29 @@ usage() {
|
||||||
echo ' options:'
|
echo ' options:'
|
||||||
echo ' -C <file> Location of a pacman config file'
|
echo ' -C <file> Location of a pacman config file'
|
||||||
echo ' -M <file> Location of a makepkg config file'
|
echo ' -M <file> Location of a makepkg config file'
|
||||||
echo ' -S <file> Location of a pacman-mirrors config file'
|
|
||||||
echo ' -c <dir> Set pacman cache'
|
echo ' -c <dir> Set pacman cache'
|
||||||
|
echo ' -f <file> Copy file from the host to the chroot'
|
||||||
|
echo ' -s Do not run setarch'
|
||||||
echo ' -r <list> Bind mountargs ro'
|
echo ' -r <list> Bind mountargs ro'
|
||||||
echo ' -w <list> Bind mountargs rw'
|
echo ' -w <list> Bind mountargs rw'
|
||||||
echo ' List format [src1:target1,...,srcN:targetN]'
|
echo ' List format [src1:target1 ... srcN:targetN]'
|
||||||
echo ' -B Use custom build mirror'
|
|
||||||
echo ' -K Keep mirrorlist (-B)'
|
|
||||||
echo ' -h This message'
|
echo ' -h This message'
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
orig_argv=("$@")
|
orig_argv=("$0" "$@")
|
||||||
|
|
||||||
opts='hKC:M:S:c:r:w:B:'
|
opts='hC:M:c:r:w:f:s'
|
||||||
|
|
||||||
while getopts ${opts} arg; do
|
while getopts ${opts} arg; do
|
||||||
case "${arg}" in
|
case "${arg}" in
|
||||||
C) pac_conf="$OPTARG" ;;
|
C) pacman_conf="$OPTARG" ;;
|
||||||
M) makepkg_conf="$OPTARG" ;;
|
M) makepkg_conf="$OPTARG" ;;
|
||||||
S) mirrors_conf="$OPTARG" ;;
|
|
||||||
c) cache_dir="$OPTARG" ;;
|
c) cache_dir="$OPTARG" ;;
|
||||||
r) mountargs_ro="$OPTARG" ;;
|
f) files+=("$OPTARG") ;;
|
||||||
w) mountargs_rw="$OPTARG" ;;
|
s) nosetarch=true ;;
|
||||||
B) build_mirror="$OPTARG" ;;
|
r) bindmounts_ro=("$OPTARG") ;;
|
||||||
K) keep_mirrors=true ;;
|
w) bindmounts_rw=("$OPTARG") ;;
|
||||||
h|?) usage ;;
|
h|?) usage ;;
|
||||||
*) error "invalid argument '$arg'"; usage ;;
|
*) error "invalid argument '$arg'"; usage ;;
|
||||||
esac
|
esac
|
||||||
|
@ -60,7 +59,8 @@ done
|
||||||
shift $(($OPTIND - 1))
|
shift $(($OPTIND - 1))
|
||||||
|
|
||||||
(( $# < 1 )) && die 'You must specify a directory.'
|
(( $# < 1 )) && die 'You must specify a directory.'
|
||||||
check_root "$0" "${orig_argv[@]}"
|
|
||||||
|
check_root
|
||||||
|
|
||||||
working_dir=$(readlink -f "$1")
|
working_dir=$(readlink -f "$1")
|
||||||
shift 1
|
shift 1
|
||||||
|
@ -76,26 +76,20 @@ fi
|
||||||
copy_hostconf () {
|
copy_hostconf () {
|
||||||
cp -a /etc/pacman.d/gnupg "$1/etc/pacman.d"
|
cp -a /etc/pacman.d/gnupg "$1/etc/pacman.d"
|
||||||
|
|
||||||
[[ -n $pac_conf ]] && cp $pac_conf "$1/etc/pacman.conf"
|
[[ -n $pacman_conf ]] && cp $pacman_conf "$1/etc/pacman.conf"
|
||||||
|
|
||||||
[[ -n $makepkg_conf ]] && cp $makepkg_conf "$1/etc/makepkg.conf"
|
[[ -n $makepkg_conf ]] && cp $makepkg_conf "$1/etc/makepkg.conf"
|
||||||
[[ -n $mirrors_conf ]] && cp ${mirrors_conf} "$1/etc/pacman-mirrors.conf"
|
|
||||||
|
|
||||||
if [[ -n ${build_mirror} ]];then
|
local file
|
||||||
build_mirror=${build_mirror}'/$repo/$arch'
|
for file in "${files[@]}"; do
|
||||||
if ${keep_mirrors}; then
|
mkdir -p "$(dirname "$working_dir$file")"
|
||||||
set_branch "$1" "$(get_branch $1)"
|
cp -T "$file" "$working_dir$file"
|
||||||
else
|
done
|
||||||
echo "Server = ${build_mirror}" > "$1/etc/pacman.d/mirrorlist"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
set_branch "$1" "$(get_branch $1)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
sed -r "s|^#?\\s*CacheDir.+|CacheDir = $(echo -n ${cache_dirs[@]})|g" -i "$1/etc/pacman.conf"
|
sed -r "s|^#?\\s*CacheDir.+|CacheDir = $(echo -n ${cache_dirs[@]})|g" -i "$1/etc/pacman.conf"
|
||||||
}
|
}
|
||||||
|
|
||||||
chroot_extra_umount() {
|
chroot_extra_mount() {
|
||||||
chroot_mount "/etc/resolv.conf" "$1/etc/resolv.conf" -B
|
chroot_mount "/etc/resolv.conf" "$1/etc/resolv.conf" -B
|
||||||
chroot_mount "${cache_dirs[0]}" "$1${cache_dirs[0]}" -B
|
chroot_mount "${cache_dirs[0]}" "$1${cache_dirs[0]}" -B
|
||||||
|
|
||||||
|
@ -103,21 +97,13 @@ chroot_extra_umount() {
|
||||||
chroot_mount "$cache_dir" "$1${cache_dir}" -Br
|
chroot_mount "$cache_dir" "$1${cache_dir}" -Br
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ -n ${mountargs_ro[@]} ]];then
|
for m in ${bindmounts_ro[@]}; do
|
||||||
local IFS=','
|
chroot_mount "${m%%:*}" "$1${m##*:}" -Br
|
||||||
for m in ${mountargs_ro[@]}; do
|
done
|
||||||
chroot_mount "${m%%:*}" "$1${m##*:}" -Br
|
|
||||||
done
|
|
||||||
unset IFS
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -n ${mountargs_rw[@]} ]];then
|
for m in ${bindmounts_rw[@]}; do
|
||||||
local IFS=','
|
chroot_mount "${m%%:*}" "$1${m##*:}" -B
|
||||||
for m in ${mountargs_rw[@]}; do
|
done
|
||||||
chroot_mount "${m%%:*}" "$1${m##*:}" -B
|
|
||||||
done
|
|
||||||
unset IFS
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
umask 0022
|
umask 0022
|
||||||
|
@ -131,12 +117,12 @@ fi
|
||||||
|
|
||||||
chroot_api_mount "${working_dir}" || die "failed to setup API filesystems in chroot %s" "${working_dir}"
|
chroot_api_mount "${working_dir}" || die "failed to setup API filesystems in chroot %s" "${working_dir}"
|
||||||
|
|
||||||
chroot_extra_umount "${working_dir}"
|
chroot_extra_mount "${working_dir}"
|
||||||
|
|
||||||
copy_hostconf "${working_dir}"
|
copy_hostconf "${working_dir}"
|
||||||
|
|
||||||
eval $(grep '^CARCH=' "$working_dir/etc/makepkg.conf")
|
eval $(grep '^CARCH=' "$working_dir/etc/makepkg.conf")
|
||||||
|
|
||||||
${CARCH:+setarch "$CARCH"} chroot "${working_dir}" "$@"
|
${nosetarch} && unset CARCH
|
||||||
|
|
||||||
kill_chroot_process "${working_dir}"
|
${CARCH:+setarch "$CARCH"} chroot "${working_dir}" "$@"
|
||||||
|
|
|
@ -15,7 +15,6 @@ LIBDIR='@libdir@'
|
||||||
SYSCONFDIR='@sysconfdir@'
|
SYSCONFDIR='@sysconfdir@'
|
||||||
|
|
||||||
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
|
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
|
||||||
|
|
||||||
import ${LIBDIR}/util.sh
|
import ${LIBDIR}/util.sh
|
||||||
import ${LIBDIR}/util-publish.sh
|
import ${LIBDIR}/util-publish.sh
|
||||||
|
|
||||||
|
@ -30,9 +29,9 @@ display_settings(){
|
||||||
show_version
|
show_version
|
||||||
show_config
|
show_config
|
||||||
|
|
||||||
msg "PROFILE:"
|
# msg "PROFILE:"
|
||||||
msg2 "build_lists: %s" "$(show_build_lists ${list_dir_iso})"
|
# msg2 "build_lists: %s" "$(show_build_lists ${list_dir_iso})"
|
||||||
msg2 "build_list_iso: %s" "${build_list_iso}"
|
# msg2 "build_list_iso: %s" "${build_list_iso}"
|
||||||
msg2 "is_build_list: %s" "${is_build_list}"
|
msg2 "is_build_list: %s" "${is_build_list}"
|
||||||
|
|
||||||
msg "OPTIONS:"
|
msg "OPTIONS:"
|
||||||
|
@ -62,7 +61,7 @@ display_settings(){
|
||||||
|
|
||||||
load_user_info
|
load_user_info
|
||||||
|
|
||||||
load_config "${USERCONFDIR}/manjaro-tools.conf" || load_config "${SYSCONFDIR}/manjaro-tools.conf"
|
load_config "${MT_USERCONFDIR}/manjaro-tools.conf" || load_config "${SYSCONFDIR}/manjaro-tools.conf"
|
||||||
|
|
||||||
run_dir=${cache_dir_iso}
|
run_dir=${cache_dir_iso}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,6 @@ version=@version@
|
||||||
LIBDIR='@libdir@'
|
LIBDIR='@libdir@'
|
||||||
|
|
||||||
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
|
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
|
||||||
|
|
||||||
import ${LIBDIR}/util-pkg.sh
|
import ${LIBDIR}/util-pkg.sh
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
|
@ -11,8 +11,9 @@
|
||||||
|
|
||||||
version=@version@
|
version=@version@
|
||||||
|
|
||||||
[[ -r @libdir@/util-msg.sh ]] && source @libdir@/util-msg.sh
|
LIBDIR='@libdir@'
|
||||||
|
|
||||||
|
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
|
||||||
match=$1
|
match=$1
|
||||||
|
|
||||||
if [[ -z $match ]]; then
|
if [[ -z $match ]]; then
|
||||||
|
|
297
bin/fstabgen.in
297
bin/fstabgen.in
|
@ -16,77 +16,76 @@ shopt -s extglob
|
||||||
LIBDIR='@libdir@'
|
LIBDIR='@libdir@'
|
||||||
|
|
||||||
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
|
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
|
||||||
|
|
||||||
import ${LIBDIR}/util-fstab.sh
|
import ${LIBDIR}/util-fstab.sh
|
||||||
|
|
||||||
write_source() {
|
write_source() {
|
||||||
local src=$1 spec= label= uuid= comment=()
|
local src=$1 spec= label= uuid= comment=()
|
||||||
|
|
||||||
label=$(lsblk -rno LABEL "$1" 2>/dev/null)
|
label=$(lsblk -rno LABEL "$1" 2>/dev/null)
|
||||||
uuid=$(lsblk -rno UUID "$1" 2>/dev/null)
|
uuid=$(lsblk -rno UUID "$1" 2>/dev/null)
|
||||||
|
|
||||||
# bind mounts do not have a UUID!
|
# bind mounts do not have a UUID!
|
||||||
|
|
||||||
case $bytag in
|
case $bytag in
|
||||||
'')
|
'')
|
||||||
[[ $uuid ]] && comment=("UUID=$uuid")
|
[[ $uuid ]] && comment=("UUID=$uuid")
|
||||||
[[ $label ]] && comment+=("LABEL=$(mangle "$label")")
|
[[ $label ]] && comment+=("LABEL=$(mangle "$label")")
|
||||||
;;
|
;;
|
||||||
LABEL)
|
LABEL)
|
||||||
spec=$label
|
spec=$label
|
||||||
[[ $uuid ]] && comment=("$src" "UUID=$uuid")
|
[[ $uuid ]] && comment=("$src" "UUID=$uuid")
|
||||||
;;
|
;;
|
||||||
UUID)
|
UUID)
|
||||||
spec=$uuid
|
spec=$uuid
|
||||||
comment=("$src")
|
comment=("$src")
|
||||||
[[ $label ]] && comment+=("LABEL=$(mangle "$label")")
|
[[ $label ]] && comment+=("LABEL=$(mangle "$label")")
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
[[ $uuid ]] && comment=("$1" "UUID=$uuid")
|
[[ $uuid ]] && comment=("$1" "UUID=$uuid")
|
||||||
[[ $label ]] && comment+=("LABEL=$(mangle "$label")")
|
[[ $label ]] && comment+=("LABEL=$(mangle "$label")")
|
||||||
[[ $bytag ]] && spec=$(lsblk -rno "$bytag" "$1" 2>/dev/null)
|
[[ $bytag ]] && spec=$(lsblk -rno "$bytag" "$1" 2>/dev/null)
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
[[ $comment ]] && printf '# %s\n' "${comment[*]}"
|
[[ $comment ]] && printf '# %s\n' "${comment[*]}"
|
||||||
|
|
||||||
if [[ $spec ]]; then
|
if [[ $spec ]]; then
|
||||||
printf '%-20s' "$bytag=$(mangle "$spec")"
|
printf '%-20s' "$bytag=$(mangle "$spec")"
|
||||||
else
|
else
|
||||||
printf '%-20s' "$(mangle "$src")"
|
printf '%-20s' "$(mangle "$src")"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
optstring_apply_quirks() {
|
optstring_apply_quirks() {
|
||||||
local varname=$1 fstype=$2
|
local varname=$1 fstype=$2
|
||||||
|
|
||||||
# SELinux displays a 'seclabel' option in /proc/self/mountinfo. We can't know
|
# SELinux displays a 'seclabel' option in /proc/self/mountinfo. We can't know
|
||||||
# if the system we're generating the fstab for has any support for SELinux (as
|
# if the system we're generating the fstab for has any support for SELinux (as
|
||||||
# one might install Arch from a Fedora environment), so let's remove it.
|
# one might install Arch from a Fedora environment), so let's remove it.
|
||||||
optstring_remove_option "$varname" seclabel
|
optstring_remove_option "$varname" seclabel
|
||||||
|
|
||||||
case $fstype in
|
case $fstype in
|
||||||
f2fs)
|
f2fs)
|
||||||
# These are Kconfig options for f2fs. Kernels supporting the options will
|
# These are Kconfig options for f2fs. Kernels supporting the options will
|
||||||
# only provide the negative versions of these (e.g. noacl), and vice versa
|
# only provide the negative versions of these (e.g. noacl), and vice versa
|
||||||
# for kernels without support.
|
# for kernels without support.
|
||||||
optstring_remove_option "$varname" noacl,acl,nouser_xattr,user_xattr
|
optstring_remove_option "$varname" noacl,acl,nouser_xattr,user_xattr
|
||||||
;;
|
;;
|
||||||
vfat)
|
vfat)
|
||||||
# Before Linux v3.8, "cp" is prepended to the value of the codepage.
|
# Before Linux v3.8, "cp" is prepended to the value of the codepage.
|
||||||
if optstring_get_option "$varname" codepage && [[ $codepage = cp* ]]; then
|
if optstring_get_option "$varname" codepage && [[ $codepage = cp* ]]; then
|
||||||
optstring_remove_option "$varname" codepage
|
optstring_remove_option "$varname" codepage
|
||||||
optstring_append_option "$varname" "codepage=${codepage#cp}"
|
optstring_append_option "$varname" "codepage=${codepage#cp}"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
usage: ${0##*/} [options] root
|
usage: ${0##*/} [options] root
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
-L Use labels for source identifiers (shortcut for -t LABEL)
|
-L Use labels for source identifiers (shortcut for -t LABEL)
|
||||||
-p Exclude pseudofs mounts (default behavior)
|
-p Exclude pseudofs mounts (default behavior)
|
||||||
-P Include printing mounts
|
-P Include printing mounts
|
||||||
|
@ -102,135 +101,121 @@ EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ -z $1 || $1 = @(-h|--help) ]]; then
|
if [[ -z $1 || $1 = @(-h|--help) ]]; then
|
||||||
usage
|
usage
|
||||||
exit $(( $# ? 0 : 1 ))
|
exit $(( $# ? 0 : 1 ))
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while getopts ':LPpt:U' flag; do
|
while getopts ':LPpt:U' flag; do
|
||||||
case $flag in
|
case $flag in
|
||||||
L)
|
L) bytag=LABEL ;;
|
||||||
bytag=LABEL
|
U) bytag=UUID ;;
|
||||||
;;
|
P) pseudofs=1 ;;
|
||||||
U)
|
p) pseudofs=0 ;;
|
||||||
bytag=UUID
|
t) bytag=${OPTARG^^} ;;
|
||||||
;;
|
:) die '%s: option requires an argument -- '\''%s'\' "${0##*/}" "$OPTARG" ;;
|
||||||
P)
|
?) die '%s: invalid option -- '\''%s'\' "${0##*/}" "$OPTARG" ;;
|
||||||
pseudofs=1
|
esac
|
||||||
;;
|
|
||||||
p)
|
|
||||||
pseudofs=0
|
|
||||||
;;
|
|
||||||
t)
|
|
||||||
bytag=${OPTARG^^}
|
|
||||||
;;
|
|
||||||
:)
|
|
||||||
die '%s: option requires an argument -- '\''%s'\' "${0##*/}" "$OPTARG"
|
|
||||||
;;
|
|
||||||
?)
|
|
||||||
die '%s: invalid option -- '\''%s'\' "${0##*/}" "$OPTARG"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
done
|
||||||
shift $(( OPTIND - 1 ))
|
shift $(( OPTIND - 1 ))
|
||||||
|
|
||||||
(( $# )) || die "No root directory specified"
|
(( $# )) || die "No root directory specified"
|
||||||
root=$1; shift
|
root=$(realpath -mL "$1"); shift
|
||||||
|
|
||||||
if ! mountpoint -q "$root"; then
|
if ! mountpoint -q "$root"; then
|
||||||
die "$root is not a mountpoint"
|
die "$root is not a mountpoint"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# handle block devices
|
# handle block devices
|
||||||
findmnt -Recvruno SOURCE,TARGET,FSTYPE,OPTIONS,FSROOT "$root" |
|
findmnt -Recvruno SOURCE,TARGET,FSTYPE,OPTIONS,FSROOT "$root" |
|
||||||
while read -r src target fstype opts fsroot; do
|
while read -r src target fstype opts fsroot; do
|
||||||
if (( !pseudofs )) && fstype_is_pseudofs "$fstype"; then
|
if (( !pseudofs )) && fstype_is_pseudofs "$fstype"; then
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
# default 5th and 6th columns
|
|
||||||
dump=0 pass=2
|
|
||||||
|
|
||||||
src=$(unmangle "$src")
|
|
||||||
target=$(unmangle "$target")
|
|
||||||
target=${target#$root}
|
|
||||||
|
|
||||||
if (( !foundroot )) && findmnt "$src" "$root" >/dev/null; then
|
|
||||||
# this is root. we can't possibly have more than one...
|
|
||||||
pass=1 foundroot=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# if there's no fsck tool available, then only pass=0 makes sense.
|
|
||||||
if ! fstype_has_fsck "$fstype"; then
|
|
||||||
pass=0
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ $fsroot != / ]]; then
|
|
||||||
if [[ $fstype = btrfs ]]; then
|
|
||||||
opts+=,subvol=${fsroot#/}
|
|
||||||
else
|
|
||||||
# it's a bind mount
|
|
||||||
src=$(findmnt -funcevo TARGET "$src")$fsroot
|
|
||||||
if [[ $src -ef $target ]]; then
|
|
||||||
# hrmm, this is weird. we're probably looking at a file or directory
|
|
||||||
# that was bound into a chroot from the host machine. Ignore it,
|
|
||||||
# because this won't actually be a valid mount. Worst case, the user
|
|
||||||
# just re-adds it.
|
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
fstype=none
|
|
||||||
opts+=,bind
|
# default 5th and 6th columns
|
||||||
pass=0
|
dump=0 pass=2
|
||||||
|
|
||||||
|
src=$(unmangle "$src")
|
||||||
|
target=$(unmangle "$target")
|
||||||
|
target=${target#$root}
|
||||||
|
|
||||||
|
if (( !foundroot )) && findmnt "$src" "$root" >/dev/null; then
|
||||||
|
# this is root. we can't possibly have more than one...
|
||||||
|
pass=1 foundroot=1
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
# filesystem quirks
|
# if there's no fsck tool available, then only pass=0 makes sense.
|
||||||
case $fstype in
|
if ! fstype_has_fsck "$fstype"; then
|
||||||
fuseblk)
|
pass=0
|
||||||
# well-behaved FUSE filesystems will report themselves as fuse.$fstype.
|
|
||||||
# this is probably NTFS-3g, but let's just make sure.
|
|
||||||
if ! newtype=$(lsblk -no FSTYPE "$src") || [[ -z $newtype ]]; then
|
|
||||||
# avoid blanking out fstype, leading to an invalid fstab
|
|
||||||
error 'Failed to derive real filesystem type for FUSE device on %s' "$target"
|
|
||||||
else
|
|
||||||
fstype=$newtype
|
|
||||||
fi
|
fi
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
optstring_apply_quirks "opts" "$fstype"
|
if [[ $fsroot != / ]]; then
|
||||||
|
if [[ $fstype = btrfs ]]; then
|
||||||
|
opts+=,subvol=${fsroot#/}
|
||||||
|
else
|
||||||
|
# it's a bind mount
|
||||||
|
src=$(findmnt -funcevo TARGET "$src")$fsroot
|
||||||
|
if [[ $src -ef $target ]]; then
|
||||||
|
# hrmm, this is weird. we're probably looking at a file or directory
|
||||||
|
# that was bound into a chroot from the host machine. Ignore it,
|
||||||
|
# because this won't actually be a valid mount. Worst case, the user
|
||||||
|
# just re-adds it.
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
fstype=none
|
||||||
|
opts+=,bind
|
||||||
|
pass=0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# write one line
|
# filesystem quirks
|
||||||
write_source "$src"
|
case $fstype in
|
||||||
printf '\t%-10s' "/$(mangle "${target#/}")" "$fstype" "$opts"
|
fuseblk)
|
||||||
printf '\t%s %s' "$dump" "$pass"
|
# well-behaved FUSE filesystems will report themselves as fuse.$fstype.
|
||||||
printf '\n\n'
|
# this is probably NTFS-3g, but let's just make sure.
|
||||||
|
if ! newtype=$(lsblk -no FSTYPE "$src") || [[ -z $newtype ]]; then
|
||||||
|
# avoid blanking out fstype, leading to an invalid fstab
|
||||||
|
error 'Failed to derive real filesystem type for FUSE device on %s' "$target"
|
||||||
|
else
|
||||||
|
fstype=$newtype
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
optstring_apply_quirks "opts" "$fstype"
|
||||||
|
|
||||||
|
# write one line
|
||||||
|
write_source "$src"
|
||||||
|
printf '\t%-10s' "/$(mangle "${target#/}")" "$fstype" "$opts"
|
||||||
|
printf '\t%s %s' "$dump" "$pass"
|
||||||
|
printf '\n\n'
|
||||||
done
|
done
|
||||||
|
|
||||||
# handle swaps devices
|
# handle swaps devices
|
||||||
{
|
{
|
||||||
# ignore header
|
# ignore header
|
||||||
read
|
read
|
||||||
|
|
||||||
while read -r device type _ _ prio; do
|
while read -r device type _ _ prio; do
|
||||||
options=defaults
|
options=defaults
|
||||||
if [[ $prio != -1 ]]; then
|
if [[ $prio != -1 ]]; then
|
||||||
options+=,pri=$prio
|
options+=,pri=$prio
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# skip files marked deleted by the kernel
|
# skip files marked deleted by the kernel
|
||||||
[[ $device = *'\040(deleted)' ]] && continue
|
[[ $device = *'\040(deleted)' ]] && continue
|
||||||
|
|
||||||
if [[ $type = file ]]; then
|
if [[ $type = file ]]; then
|
||||||
printf '%-20s' "$device"
|
printf '%-20s' "$device"
|
||||||
elif [[ $device = /dev/dm-+([0-9]) ]]; then
|
elif [[ $device = /dev/dm-+([0-9]) ]]; then
|
||||||
# device mapper doesn't allow characters we need to worry
|
# device mapper doesn't allow characters we need to worry
|
||||||
# about being mangled, and it does the escaping of dashes
|
# about being mangled, and it does the escaping of dashes
|
||||||
# for us in sysfs.
|
# for us in sysfs.
|
||||||
write_source "$(dm_name_for_devnode "$device")"
|
write_source "$(dm_name_for_devnode "$device")"
|
||||||
else
|
else
|
||||||
write_source "$(unmangle "$device")"
|
write_source "$(unmangle "$device")"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf '\t%-10s\t%-10s\t%-10s\t0 0\n\n' 'none' 'swap' "$options"
|
printf '\t%-10s\t%-10s\t%-10s\t0 0\n\n' 'none' 'swap' "$options"
|
||||||
done
|
done
|
||||||
} </proc/swaps
|
} </proc/swaps
|
||||||
|
|
|
@ -11,7 +11,9 @@
|
||||||
|
|
||||||
version=@version@
|
version=@version@
|
||||||
|
|
||||||
[[ -r @libdir@/util-msg.sh ]] && source @libdir@/util-msg.sh
|
LIBDIR='@libdir@'
|
||||||
|
|
||||||
|
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
|
||||||
|
|
||||||
ifs=$IFS
|
ifs=$IFS
|
||||||
IFS="${IFS}:"
|
IFS="${IFS}:"
|
||||||
|
|
|
@ -17,7 +17,6 @@ LIBDIR='@libdir@'
|
||||||
SYSCONFDIR='@sysconfdir@'
|
SYSCONFDIR='@sysconfdir@'
|
||||||
|
|
||||||
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
|
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
|
||||||
|
|
||||||
import ${LIBDIR}/util.sh
|
import ${LIBDIR}/util.sh
|
||||||
import ${LIBDIR}/util-mount.sh
|
import ${LIBDIR}/util-mount.sh
|
||||||
|
|
||||||
|
@ -35,7 +34,7 @@ display_settings(){
|
||||||
|
|
||||||
load_user_info
|
load_user_info
|
||||||
|
|
||||||
load_config "${USERCONFDIR}/manjaro-tools.conf" || load_config "${SYSCONFDIR}/manjaro-tools.conf"
|
load_config "${MT_USERCONFDIR}/manjaro-tools.conf" || load_config "${SYSCONFDIR}/manjaro-tools.conf"
|
||||||
|
|
||||||
automount=false
|
automount=false
|
||||||
pretend=false
|
pretend=false
|
||||||
|
@ -55,7 +54,7 @@ usage() {
|
||||||
exit $1
|
exit $1
|
||||||
}
|
}
|
||||||
|
|
||||||
orig_argv=("$@")
|
orig_argv=("$0" "$@")
|
||||||
|
|
||||||
opts=':haq'
|
opts=':haq'
|
||||||
|
|
||||||
|
@ -69,7 +68,7 @@ while getopts ${opts} arg; do
|
||||||
done
|
done
|
||||||
shift $(( OPTIND - 1 ))
|
shift $(( OPTIND - 1 ))
|
||||||
|
|
||||||
check_root "$0" "${orig_argv[@]}"
|
check_root
|
||||||
|
|
||||||
if ${automount};then
|
if ${automount};then
|
||||||
chrootdir=/mnt
|
chrootdir=/mnt
|
||||||
|
|
|
@ -14,51 +14,54 @@ version=@version@
|
||||||
LIBDIR='@libdir@'
|
LIBDIR='@libdir@'
|
||||||
|
|
||||||
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
|
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
|
||||||
|
|
||||||
import ${LIBDIR}/util.sh
|
import ${LIBDIR}/util.sh
|
||||||
|
import ${LIBDIR}/util-chroot.sh
|
||||||
|
|
||||||
working_dir=''
|
working_dir=''
|
||||||
|
files=()
|
||||||
|
|
||||||
build_locales=false
|
build_locales=false
|
||||||
keep_mirrors=false
|
keep_mirrors=false
|
||||||
keep_flag=''
|
keep_flag=''
|
||||||
|
nosetarch=false
|
||||||
|
branch=stable
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "Usage: ${0##*/} [options] working-dir package-list..."
|
echo "Usage: ${0##*/} [options] working-dir package-list..."
|
||||||
echo ' options:'
|
echo ' options:'
|
||||||
echo ' -C <file> Location of a pacman config file'
|
echo ' -C <file> Location of a pacman config file'
|
||||||
echo ' -M <file> Location of a makepkg config file'
|
echo ' -M <file> Location of a makepkg config file'
|
||||||
echo ' -S <file> Location of a pacman-mirrors config file'
|
echo ' -B <branch> Set branch'
|
||||||
|
echo ' -U <url> Set a specific mirror'
|
||||||
echo ' -c <dir> Set pacman cache'
|
echo ' -c <dir> Set pacman cache'
|
||||||
echo ' -L Use build locale.gen en/de'
|
echo ' -f <file> Copy file from the host to the chroot'
|
||||||
echo ' -B Use custom build mirror'
|
echo ' -s Do not run setarch'
|
||||||
echo ' -K Keep mirrorlist (-B)'
|
|
||||||
echo ' -x copy pacman.conf'
|
|
||||||
echo ' -h This message'
|
echo ' -h This message'
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
orig_argv=("$@")
|
orig_argv=("$0" "$@")
|
||||||
|
|
||||||
opts='hLKC:M:S:c:B:'
|
opts='hC:M:U:B:c:f:s'
|
||||||
|
|
||||||
while getopts ${opts} arg; do
|
while getopts ${opts} arg; do
|
||||||
case "${arg}" in
|
case "${arg}" in
|
||||||
C) pac_conf="$OPTARG" ;;
|
C) pacman_conf="$OPTARG" ;;
|
||||||
M) makepkg_conf="$OPTARG" ;;
|
M) makepkg_conf="$OPTARG" ;;
|
||||||
S) mirrors_conf="$OPTARG" ;;
|
B) branch="$OPTARG" ;;
|
||||||
|
U) mirror="$OPTARG" ;;
|
||||||
c) cache_dir="$OPTARG" ;;
|
c) cache_dir="$OPTARG" ;;
|
||||||
L) build_locales=true ;;
|
f) files+=("$OPTARG") ;;
|
||||||
B) build_mirror="$OPTARG" ;;
|
s) nosetarch=true ;;
|
||||||
K) keep_mirrors=true; keep_flag='-K' ;;
|
|
||||||
h|?) usage ;;
|
h|?) usage ;;
|
||||||
*) error "invalid argument '$arg'"; usage ;;
|
*) error "invalid argument '%s'" "$arg"; usage ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
shift $(($OPTIND - 1))
|
shift $(($OPTIND - 1))
|
||||||
|
|
||||||
(( $# < 2 )) && die 'You must specify a directory and one or more packages.'
|
(( $# < 2 )) && die 'You must specify a directory and one or more packages.'
|
||||||
|
|
||||||
check_root "$0" "${orig_argv[@]}"
|
check_root
|
||||||
|
|
||||||
working_dir="$(readlink -f $1)"
|
working_dir="$(readlink -f $1)"
|
||||||
shift 1
|
shift 1
|
||||||
|
@ -71,6 +74,9 @@ else
|
||||||
cache_dirs=(${cache_dir})
|
cache_dirs=(${cache_dir})
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
basestrap_args=(-GMcd ${pacman_conf:+-C "$pacman_conf"} -B "${branch}")
|
||||||
|
[[ -n ${mirror} ]] && basestrap_args+=(-U "${mirror}")
|
||||||
|
|
||||||
umask 0022
|
umask 0022
|
||||||
|
|
||||||
#[[ -e $working_dir ]] && die "Working directory '%s' already exists" "$working_dir"
|
#[[ -e $working_dir ]] && die "Working directory '%s' already exists" "$working_dir"
|
||||||
|
@ -82,43 +88,32 @@ umask 0022
|
||||||
lock 9 "${working_dir}.lock" "Locking chroot"
|
lock 9 "${working_dir}.lock" "Locking chroot"
|
||||||
|
|
||||||
if is_btrfs "$working_dir"; then
|
if is_btrfs "$working_dir"; then
|
||||||
rmdir "$working_dir"
|
rmdir "$working_dir"
|
||||||
if ! btrfs subvolume create "$working_dir"; then
|
if ! btrfs subvolume create "$working_dir"; then
|
||||||
die "Couldn't create subvolume for '%s'" "$working_dir"
|
die "Couldn't create subvolume for '%s'" "$working_dir"
|
||||||
fi
|
fi
|
||||||
chmod 0755 "$working_dir"
|
chmod 0755 "$working_dir"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Workaround when creating a chroot in a branch different of the host
|
for f in "${files[@]}"; do
|
||||||
if [[ -n $pac_conf ]] && [[ -n $mirrors_conf ]] && [[ -n ${build_mirror} ]]; then
|
mkdir -p "$(dirname "$working_dir$f")"
|
||||||
url=${build_mirror}'/$repo/$arch'
|
cp "$f" "$working_dir$f"
|
||||||
info "mirror: %s" "$url"
|
done
|
||||||
pac_base="$working_dir/pacman-basestrap.conf"
|
|
||||||
sed "s#Include = /etc/pacman.d/mirrorlist#Server = ${url}#g" $pac_conf > $pac_base
|
|
||||||
|
|
||||||
basestrap -GMcd ${pac_base:+-C "$pac_base"} "$working_dir" \
|
_env=()
|
||||||
"${cache_dirs[@]/#/--cachedir=}" "$@" || die 'Failed to install all packages'
|
while read -r varname; do
|
||||||
|
_env+=("$varname=${!varname}")
|
||||||
[[ -f "$pac_base" ]] && rm "$pac_base"
|
done < <(declare -x | sed -r 's/^declare -x ([^=]*)=.*/\1/' | grep -i '_proxy$')
|
||||||
else
|
env -i "${_env[@]}" \
|
||||||
basestrap -GMcd ${pac_conf:+-C "$pac_conf"} "$working_dir" \
|
basestrap "${basestrap_args[@]}" "$working_dir" ${cache_dirs[@]/#/--cachedir=} "$@" || die 'Failed to install all packages'
|
||||||
"${cache_dirs[@]/#/--cachedir=}" "$@" || die 'Failed to install all packages'
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "$version" > "$working_dir/.manjaro-tools"
|
echo "$version" > "$working_dir/.manjaro-tools"
|
||||||
|
|
||||||
if ${build_locales};then
|
default_locale "set" "$working_dir"
|
||||||
info "Using build locales ..."
|
|
||||||
mv "$working_dir/etc/locale.gen" "$working_dir/etc/locale.gen.bak"
|
|
||||||
mv "$working_dir/etc/locale.conf" "$working_dir/etc/locale.conf.bak"
|
|
||||||
printf '%s.UTF-8 UTF-8\n' en_US > "$working_dir/etc/locale.gen"
|
|
||||||
printf 'LANG=%s.UTF-8\n' en_US > "$working_dir/etc/locale.conf"
|
|
||||||
printf 'LC_MESSAGES=C\n' >> "$working_dir/etc/locale.conf"
|
|
||||||
fi
|
|
||||||
|
|
||||||
chroot_args=(${pac_conf:+-C "$pac_conf"} ${makepkg_conf:+-M "$makepkg_conf"} ${mirrors_conf:+-S "$mirrors_conf"} ${build_mirror:+-B "$build_mirror"} ${cache_dir:+-c "$cache_dir"} ${keep_flag})
|
chroot_args=(${pacman_conf:+-C "$pacman_conf"} ${makepkg_conf:+-M "$makepkg_conf"} ${cache_dir:+-c "$cache_dir"})
|
||||||
|
${nosetarch} && chroot_args+=(${nosetarch:+-s})
|
||||||
|
|
||||||
exec chroot-run \
|
exec chroot-run \
|
||||||
${chroot_args[*]} \
|
${chroot_args[*]} \
|
||||||
"$working_dir" locale-gen
|
"$working_dir" locale-gen
|
||||||
|
|
||||||
|
|
|
@ -14,173 +14,161 @@ version=@version@
|
||||||
LIBDIR='@libdir@'
|
LIBDIR='@libdir@'
|
||||||
|
|
||||||
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
|
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
|
||||||
|
|
||||||
import ${LIBDIR}/util.sh
|
import ${LIBDIR}/util.sh
|
||||||
|
import ${LIBDIR}/util-chroot.sh
|
||||||
|
|
||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
|
|
||||||
makepkg_args=(-s --noconfirm -L)
|
init_variables() {
|
||||||
repack=false
|
default_makepkg_args=(-s --noconfirm -L --holdver)
|
||||||
update_first=false
|
makepkg_args=("${default_makepkg_args[@]}")
|
||||||
clean_first=false
|
repack=false
|
||||||
install_pkg=
|
update_first=false
|
||||||
run_namcap=false
|
clean_first=false
|
||||||
temp_chroot=false
|
run_namcap=false
|
||||||
chrootdir=
|
temp_chroot=false
|
||||||
passeddir=
|
chrootdir=
|
||||||
declare -a install_pkgs
|
passeddir=
|
||||||
declare -i ret=0
|
makepkg_user=
|
||||||
|
declare -ga install_pkgs
|
||||||
|
declare -gi ret=0
|
||||||
|
|
||||||
copy=$USER
|
bindmounts_ro=()
|
||||||
[[ -n $SUDO_USER ]] && copy=$SUDO_USER
|
bindmounts_rw=()
|
||||||
[[ -z "$copy" || $copy = root ]] && copy=copy
|
|
||||||
src_owner=${SUDO_USER:-$USER}
|
copy=$USER
|
||||||
|
[[ -n ${SUDO_USER:-} ]] && copy=$SUDO_USER
|
||||||
|
[[ -z "$copy" || $copy = root ]] && copy=copy
|
||||||
|
src_owner=${SUDO_USER:-$USER}
|
||||||
|
}
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "Usage: ${0##*/} [options] -r <chrootdir> [--] [makepkg args]"
|
echo "Usage: ${0##*/} [options] -r <chrootdir> [--] [makepkg args]"
|
||||||
echo ' Run this script in a PKGBUILD dir to build a package inside a'
|
echo ' Run this script in a PKGBUILD dir to build a package inside a'
|
||||||
echo ' clean chroot. Arguments passed to this script after the'
|
echo ' clean chroot. Arguments passed to this script after the'
|
||||||
echo ' end-of-options marker (--) will be passed to makepkg.'
|
echo ' end-of-options marker (--) will be passed to makepkg.'
|
||||||
echo ''
|
echo ''
|
||||||
echo ' The chroot dir consists of the following directories:'
|
echo ' The chroot dir consists of the following directories:'
|
||||||
echo ' <chrootdir>/{root, copy} but only "root" is required'
|
echo ' <chrootdir>/{root, copy} but only "root" is required'
|
||||||
echo ' by default. The working copy will be created as needed'
|
echo ' by default. The working copy will be created as needed'
|
||||||
echo ''
|
echo ''
|
||||||
echo ' The chroot "root" directory must be created via the following'
|
echo 'The chroot "root" directory must be created via the following'
|
||||||
echo ' command:'
|
echo 'command:'
|
||||||
echo ' mkchroot <chrootdir>/root base-devel'
|
echo ' mkchroot <chrootdir>/root base-devel'
|
||||||
echo ''
|
echo ''
|
||||||
echo " Default makepkg args: ${makepkg_args[*]}"
|
echo 'This script reads {SRC,SRCPKG,PKG,LOG}DEST, MAKEFLAGS and PACKAGER'
|
||||||
|
echo 'from makepkg.conf(5), if those variables are not part of the'
|
||||||
|
echo 'environment.'
|
||||||
echo ''
|
echo ''
|
||||||
echo ' Flags:'
|
echo "Default makepkg args: ${default_makepkg_args[*]}"
|
||||||
echo ' -h This help'
|
echo ''
|
||||||
echo ' -c Clean the chroot before building'
|
echo 'Flags:'
|
||||||
echo ' -u Update the working copy of the chroot before building'
|
echo '-h This help'
|
||||||
echo ' This is useful for rebuilds without dirtying the pristine'
|
echo '-c Clean the chroot before building'
|
||||||
echo ' chroot'
|
echo '-d <dir> Bind directory into build chroot as read-write'
|
||||||
echo ' -r <dir> The chroot dir to use'
|
echo '-D <dir> Bind directory into build chroot as read-only'
|
||||||
echo ' -I <pkg> Install a package into the working copy of the chroot'
|
echo '-u Update the working copy of the chroot before building'
|
||||||
echo ' -l <copy> The directory to use as the working copy of the chroot'
|
echo ' This is useful for rebuilds without dirtying the pristine'
|
||||||
echo ' Useful for maintaining multiple copies'
|
echo ' chroot'
|
||||||
echo " Default: $copy"
|
echo '-r <dir> The chroot dir to use'
|
||||||
echo ' -n Run namcap on the package'
|
echo '-I <pkg> Install a package into the working copy of the chroot'
|
||||||
echo ' -T Build in a temporary directory'
|
echo '-l <copy> The directory to use as the working copy of the chroot'
|
||||||
|
echo ' Useful for maintaining multiple copies'
|
||||||
|
echo " Default: $copy"
|
||||||
|
echo '-n Run namcap on the package'
|
||||||
|
echo '-T Build in a temporary directory'
|
||||||
|
echo '-U Run makepkg as a specified user'
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
orig_argv=("$@")
|
sync_chroot() {
|
||||||
|
local chrootdir=$1
|
||||||
while getopts 'hcur:I:l:nT' arg; do
|
local copy=$2
|
||||||
case "$arg" in
|
local copydir=''
|
||||||
c) clean_first=true ;;
|
if [[ ${copy:0:1} = / ]]; then
|
||||||
u) update_first=true ;;
|
copydir=$copy
|
||||||
r) passeddir="$OPTARG" ;;
|
else
|
||||||
I) install_pkgs+=("$OPTARG") ;;
|
copydir="$chrootdir/$copy"
|
||||||
l) copy="$OPTARG" ;;
|
|
||||||
n) run_namcap=true; makepkg_args+=(-i) ;;
|
|
||||||
T) temp_chroot=true; copy+="-$$" ;;
|
|
||||||
h|*) usage ;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
[[ ! -f PKGBUILD && -z "${install_pkgs[*]}" ]] && die 'This must be run in a directory containing a PKGBUILD.'
|
|
||||||
|
|
||||||
check_root "$0" "${orig_argv[@]}"
|
|
||||||
|
|
||||||
# Canonicalize chrootdir, getting rid of trailing /
|
|
||||||
chrootdir=$(readlink -e "$passeddir")
|
|
||||||
[[ ! -d $chrootdir ]] && die "No chroot dir defined, or invalid path '%s'" "$passeddir"
|
|
||||||
[[ ! -d $chrootdir/root ]] && die "Missing chroot dir root directory. Try using: mkchroot %s/root base-devel" "$chrootdir"
|
|
||||||
|
|
||||||
# Detect chrootdir filesystem type
|
|
||||||
chroottype=$(stat -f -c %T "$chrootdir")
|
|
||||||
|
|
||||||
if [[ ${copy:0:1} = / ]]; then
|
|
||||||
copydir=$copy
|
|
||||||
else
|
|
||||||
copydir="$chrootdir/$copy"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Pass all arguments after -- right to makepkg
|
|
||||||
makepkg_args+=("${@:$OPTIND}")
|
|
||||||
|
|
||||||
# See if -R was passed to makepkg
|
|
||||||
for arg in "${@:OPTIND}"; do
|
|
||||||
case ${arg%%=*} in
|
|
||||||
-*R*|--repackage)
|
|
||||||
repack=true
|
|
||||||
break 2
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
load_user_info
|
|
||||||
|
|
||||||
# {{{ functions
|
|
||||||
|
|
||||||
create_chroot() {
|
|
||||||
# Lock the chroot we want to use. We'll keep this lock until we exit.
|
|
||||||
lock 9 "$copydir.lock" "Locking chroot copy [$copy]"
|
|
||||||
|
|
||||||
if [[ ! -d $copydir ]] || $clean_first; then
|
|
||||||
# Get a read lock on the root chroot to make
|
|
||||||
# sure we don't clone a half-updated chroot
|
|
||||||
slock 8 "$chrootdir/root.lock" "Locking clean chroot"
|
|
||||||
|
|
||||||
stat_busy "Creating clean working copy [$copy]"
|
|
||||||
if is_btrfs "$chrootdir" && ! mountpoint -q "$copydir"; then
|
|
||||||
subvolume_delete_recursive "$copydir" ||
|
|
||||||
die "Unable to delete subvolume %s" "$copydir"
|
|
||||||
btrfs subvolume snapshot "$chrootdir/root" "$copydir" >/dev/null ||
|
|
||||||
die "Unable to create subvolume %s" "$copydir"
|
|
||||||
else
|
|
||||||
mkdir -p "$copydir"
|
|
||||||
rsync -a --delete -q -W -x "$chrootdir/root/" "$copydir"
|
|
||||||
fi
|
|
||||||
stat_done
|
|
||||||
|
|
||||||
# Drop the read lock again
|
|
||||||
exec 8>&-
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ "$chrootdir/root" -ef "$copydir" ]]; then
|
||||||
|
error 'Cannot sync copy with itself: %s' "$copydir"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Get a read lock on the root chroot to make
|
||||||
|
# sure we don't clone a half-updated chroot
|
||||||
|
slock 8 "$chrootdir/root.lock" \
|
||||||
|
"Locking clean chroot [%s]" "$chrootdir/root"
|
||||||
|
|
||||||
|
stat_busy "Synchronizing chroot copy [%s] -> [%s]" "$chrootdir/root" "$copydir"
|
||||||
|
if is_btrfs "$chrootdir" && ! mountpoint -q "$copydir"; then
|
||||||
|
subvolume_delete_recursive "$copydir" ||
|
||||||
|
die "Unable to delete subvolume %s" "$copydir"
|
||||||
|
btrfs subvolume snapshot "$chrootdir/root" "$copydir" >/dev/null ||
|
||||||
|
die "Unable to create subvolume %s" "$copydir"
|
||||||
|
else
|
||||||
|
mkdir -p "$copydir"
|
||||||
|
rsync -a --delete -q -W -x "$chrootdir/root/" "$copydir"
|
||||||
|
fi
|
||||||
|
stat_done
|
||||||
|
|
||||||
|
# Drop the read lock again
|
||||||
|
lock_close 8
|
||||||
|
|
||||||
# Update mtime
|
# Update mtime
|
||||||
touch "$copydir"
|
touch "$copydir"
|
||||||
}
|
}
|
||||||
|
|
||||||
clean_temporary() {
|
# Usage: delete_chroot $copydir [$copy]
|
||||||
stat_busy "Removing temporary copy [$copy]"
|
# delete_chroot() {
|
||||||
if is_btrfs "$chrootdir" && ! mountpoint -q "$copydir"; then
|
# local copydir=$1
|
||||||
btrfs subvolume delete "$copydir" >/dev/null ||
|
# local copy=${1:-$2}
|
||||||
die "Unable to delete subvolume %s" "$copydir"
|
#
|
||||||
else
|
# stat_busy "Removing chroot copy [%s]" "$copy"
|
||||||
# avoid change of filesystem in case of an umount failure
|
# if is_btrfs "$chrootdir" && ! mountpoint -q "$copydir"; then
|
||||||
rm --recursive --force --one-file-system "$copydir" ||
|
# subvolume_delete_recursive "$copydir" ||
|
||||||
die "Unable to delete %s" "$copydir"
|
# die "Unable to delete subvolume %s" "$copydir"
|
||||||
fi
|
# else
|
||||||
|
# # avoid change of filesystem in case of an umount failure
|
||||||
# remove lock file
|
# rm --recursive --force --one-file-system "$copydir" ||
|
||||||
rm -f "$copydir.lock"
|
# die "Unable to delete %s" "$copydir"
|
||||||
stat_done
|
# fi
|
||||||
}
|
#
|
||||||
|
# # remove lock file
|
||||||
|
# rm -f "$copydir.lock"
|
||||||
|
# stat_done
|
||||||
|
# }
|
||||||
|
|
||||||
|
# Usage: install_packages $copydir $pkgs...
|
||||||
install_packages() {
|
install_packages() {
|
||||||
|
local copydir=$1
|
||||||
|
local install_pkgs=("${@:2}")
|
||||||
|
|
||||||
local -a pkgnames
|
local -a pkgnames
|
||||||
local ret
|
local ret
|
||||||
|
|
||||||
pkgnames=("${install_pkgs[@]##*/}")
|
pkgnames=("${install_pkgs[@]##*/}")
|
||||||
|
|
||||||
cp -- "${install_pkgs[@]}" "$copydir/root/"
|
cp -- "${install_pkgs[@]}" "$copydir/root/"
|
||||||
|
chroot-run -r "${bindmounts_ro[*]}" -w "${bindmounts_rw[*]}" "$copydir" \
|
||||||
chroot-run "$copydir" \
|
pacman -U --noconfirm -- "${pkgnames[@]/#//root/}"
|
||||||
pacman -U --noconfirm -- "${pkgnames[@]/#//root/}"
|
|
||||||
ret=$?
|
ret=$?
|
||||||
rm -- "${pkgnames[@]/#/$copydir/root/}"
|
rm -- "${pkgnames[@]/#/$copydir/root/}"
|
||||||
|
|
||||||
# If there is no PKGBUILD we are done
|
return $ret
|
||||||
[[ -f PKGBUILD ]] || exit $ret
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Usage: prepare_chroot $copydir $HOME $repack $run_namcap
|
||||||
|
# Globals:
|
||||||
|
# - MAKEFLAGS
|
||||||
|
# - PACKAGER
|
||||||
prepare_chroot() {
|
prepare_chroot() {
|
||||||
|
local copydir=$1
|
||||||
|
local USER_HOME=$2
|
||||||
|
local repack=$3
|
||||||
|
local run_namcap=$4
|
||||||
|
|
||||||
$repack || rm -rf "$copydir/build"
|
$repack || rm -rf "$copydir/build"
|
||||||
|
|
||||||
local builduser_uid="${SUDO_UID:-$UID}"
|
local builduser_uid="${SUDO_UID:-$UID}"
|
||||||
|
@ -204,7 +192,7 @@ prepare_chroot() {
|
||||||
|
|
||||||
sed -e '/^MAKEFLAGS=/d' -e '/^PACKAGER=/d' -i "$copydir/etc/makepkg.conf"
|
sed -e '/^MAKEFLAGS=/d' -e '/^PACKAGER=/d' -i "$copydir/etc/makepkg.conf"
|
||||||
for x in BUILDDIR=/build PKGDEST=/pkgdest SRCPKGDEST=/srcpkgdest SRCDEST=/srcdest LOGDEST=/logdest \
|
for x in BUILDDIR=/build PKGDEST=/pkgdest SRCPKGDEST=/srcpkgdest SRCDEST=/srcdest LOGDEST=/logdest \
|
||||||
"MAKEFLAGS='$MAKEFLAGS'" "PACKAGER='$PACKAGER'"
|
"MAKEFLAGS='${MAKEFLAGS:-}'" "PACKAGER='${PACKAGER:-}'"
|
||||||
do
|
do
|
||||||
grep -q "^$x" "$copydir/etc/makepkg.conf" && continue
|
grep -q "^$x" "$copydir/etc/makepkg.conf" && continue
|
||||||
echo "$x" >>"$copydir/etc/makepkg.conf"
|
echo "$x" >>"$copydir/etc/makepkg.conf"
|
||||||
|
@ -220,9 +208,7 @@ EOF
|
||||||
{
|
{
|
||||||
printf '#!/bin/bash\n'
|
printf '#!/bin/bash\n'
|
||||||
declare -f _chrootbuild
|
declare -f _chrootbuild
|
||||||
printf '_chrootbuild'
|
printf '_chrootbuild "$@" || exit\n'
|
||||||
printf ' %q' "${makepkg_args[@]}"
|
|
||||||
printf ' || exit\n'
|
|
||||||
|
|
||||||
if $run_namcap; then
|
if $run_namcap; then
|
||||||
declare -f _chrootnamcap
|
declare -f _chrootnamcap
|
||||||
|
@ -236,9 +222,6 @@ EOF
|
||||||
# so no global variables
|
# so no global variables
|
||||||
_chrootbuild() {
|
_chrootbuild() {
|
||||||
. /etc/profile
|
. /etc/profile
|
||||||
# export HOME=/build
|
|
||||||
# cd /startdir
|
|
||||||
# sudo -u builduser makepkg "$@"
|
|
||||||
sudo -iu builduser bash -c 'cd /startdir; makepkg "$@"' -bash "$@"
|
sudo -iu builduser bash -c 'cd /startdir; makepkg "$@"' -bash "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,37 +233,52 @@ _chrootnamcap() {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Usage: download_sources $copydir $src_owner
|
||||||
|
# Globals:
|
||||||
|
# - SRCDEST
|
||||||
|
# - USER
|
||||||
download_sources() {
|
download_sources() {
|
||||||
|
local copydir=$1
|
||||||
|
local src_owner=$2
|
||||||
|
|
||||||
local builddir="$(mktemp -d)"
|
local builddir="$(mktemp -d)"
|
||||||
chmod 1777 "$builddir"
|
chmod 1777 "$builddir"
|
||||||
|
|
||||||
# Ensure sources are downloaded
|
# Ensure sources are downloaded
|
||||||
if [[ -n $SUDO_USER ]]; then
|
makepkg_user=${makepkg_user:-$SUDO_USER}
|
||||||
sudo -u $SUDO_USER env SRCDEST="$SRCDEST" BUILDDIR="$builddir" \
|
if [[ -n $makepkg_user ]]; then
|
||||||
|
sudo -u "$makepkg_user" env SRCDEST="$SRCDEST" BUILDDIR="$builddir" \
|
||||||
makepkg --config="$copydir/etc/makepkg.conf" --verifysource -o
|
makepkg --config="$copydir/etc/makepkg.conf" --verifysource -o
|
||||||
else
|
else
|
||||||
( export SRCDEST BUILDDIR="$builddir"
|
error "Running makepkg as root is not allowed."
|
||||||
makepkg --asroot --config="$copydir/etc/makepkg.conf" --verifysource -o
|
exit 1
|
||||||
)
|
|
||||||
fi
|
fi
|
||||||
(( $? != 0 )) && die "Could not download sources."
|
(( $? != 0 )) && die "Could not download sources."
|
||||||
|
|
||||||
# Clean up garbage from verifysource
|
# Clean up garbage from verifysource
|
||||||
rm -rf $builddir
|
rm -rf "$builddir"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Usage: move_products $copydir $owner
|
||||||
|
# Globals:
|
||||||
|
# - PKGDEST
|
||||||
|
# - LOGDEST
|
||||||
move_products() {
|
move_products() {
|
||||||
|
local copydir=$1
|
||||||
|
local src_owner=$2
|
||||||
|
|
||||||
|
local pkgfile
|
||||||
for pkgfile in "$copydir"/pkgdest/*; do
|
for pkgfile in "$copydir"/pkgdest/*; do
|
||||||
chown "$src_owner" "$pkgfile"
|
chown "$src_owner" "$pkgfile"
|
||||||
mv "$pkgfile" "$PKGDEST"
|
mv "$pkgfile" "$PKGDEST"
|
||||||
|
|
||||||
# Fix broken symlink because of temporary chroot PKGDEST /pkgdest
|
# Fix broken symlink because of temporary chroot PKGDEST /pkgdest
|
||||||
if [[ "$PWD" != "$PKGDEST" && -L "$PWD/${pkgfile##*/}" ]]; then
|
if [[ "$PWD" != "$PKGDEST" && -L "$PWD/${pkgfile##*/}" ]]; then
|
||||||
rm "$PWD/${pkgfile##*/}"
|
|
||||||
ln -sf "$PKGDEST/${pkgfile##*/}"
|
ln -sf "$PKGDEST/${pkgfile##*/}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
local l
|
||||||
for l in "$copydir"/logdest/*; do
|
for l in "$copydir"/logdest/*; do
|
||||||
[[ $l == */logpipe.* ]] && continue
|
[[ $l == */logpipe.* ]] && continue
|
||||||
chown "$src_owner" "$l"
|
chown "$src_owner" "$l"
|
||||||
|
@ -294,49 +292,112 @@ move_products() {
|
||||||
}
|
}
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
umask 0022
|
orig_argv=("$0" "$@")
|
||||||
|
|
||||||
load_vars "$USER_HOME/.makepkg.conf" || load_vars /etc/makepkg.conf
|
main() {
|
||||||
|
init_variables
|
||||||
|
|
||||||
# Use PKGBUILD directory if these don't exist
|
local opts='hcur:I:l:nTD:d:U:'
|
||||||
[[ -d $PKGDEST ]] || PKGDEST=$PWD
|
|
||||||
[[ -d $SRCDEST ]] || SRCDEST=$PWD
|
|
||||||
[[ -d $SRCPKGDEST ]] || SRCPKGDEST=$PWD
|
|
||||||
[[ -d $LOGDEST ]] || LOGDEST=$PWD
|
|
||||||
|
|
||||||
create_chroot
|
while getopts ${opts} arg; do
|
||||||
|
case "$arg" in
|
||||||
|
c) clean_first=true ;;
|
||||||
|
D) bindmounts_ro+=("$OPTARG") ;;
|
||||||
|
d) bindmounts_rw+=("$OPTARG") ;;
|
||||||
|
u) update_first=true ;;
|
||||||
|
r) passeddir="$OPTARG" ;;
|
||||||
|
I) install_pkgs+=("$OPTARG") ;;
|
||||||
|
l) copy="$OPTARG" ;;
|
||||||
|
n) run_namcap=true; makepkg_args+=(-i) ;;
|
||||||
|
T) temp_chroot=true; copy+="-$$" ;;
|
||||||
|
U) makepkg_user="$OPTARG" ;;
|
||||||
|
h|*) usage ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
$update_first && chroot-run \
|
[[ ! -f PKGBUILD && -z "${install_pkgs[*]}" ]] && die 'This must be run in a directory containing a PKGBUILD.'
|
||||||
-r "${mountargs_ro}" \
|
[[ -n $makepkg_user && -z $(id -u "$makepkg_user") ]] && die 'Invalid makepkg user.'
|
||||||
-w "${mountargs_rw}" \
|
|
||||||
"$copydir" \
|
check_root
|
||||||
|
|
||||||
|
# Canonicalize chrootdir, getting rid of trailing /
|
||||||
|
chrootdir=$(readlink -e "$passeddir")
|
||||||
|
[[ ! -d $chrootdir ]] && die "No chroot dir defined, or invalid path '%s'" "$passeddir"
|
||||||
|
[[ ! -d $chrootdir/root ]] && die "Missing chroot dir root directory. Try using: mkchroot %s/root base-devel" "$chrootdir"
|
||||||
|
|
||||||
|
if [[ ${copy:0:1} = / ]]; then
|
||||||
|
copydir=$copy
|
||||||
|
else
|
||||||
|
copydir="$chrootdir/$copy"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Pass all arguments after -- right to makepkg
|
||||||
|
makepkg_args+=("${@:$OPTIND}")
|
||||||
|
|
||||||
|
# See if -R was passed to makepkg
|
||||||
|
for arg in "${@:OPTIND}"; do
|
||||||
|
case ${arg%%=*} in
|
||||||
|
-*R*|--repackage)
|
||||||
|
repack=true
|
||||||
|
break 2
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
load_user_info
|
||||||
|
|
||||||
|
umask 0022
|
||||||
|
|
||||||
|
load_vars "${PAC_USERCONFDIR}/makepkg.conf" || load_vars "$USER_HOME/.makepkg.conf"
|
||||||
|
load_vars /etc/makepkg.conf
|
||||||
|
|
||||||
|
# Use PKGBUILD directory if these don't exist
|
||||||
|
[[ -d $PKGDEST ]] || PKGDEST=$PWD
|
||||||
|
[[ -d $SRCDEST ]] || SRCDEST=$PWD
|
||||||
|
[[ -d $SRCPKGDEST ]] || SRCPKGDEST=$PWD
|
||||||
|
[[ -d $LOGDEST ]] || LOGDEST=$PWD
|
||||||
|
|
||||||
|
# Lock the chroot we want to use. We'll keep this lock until we exit.
|
||||||
|
lock 9 "$copydir.lock" "Locking chroot copy [%s]" "$copy"
|
||||||
|
|
||||||
|
if [[ ! -d $copydir ]] || $clean_first; then
|
||||||
|
sync_chroot "$chrootdir" "$copy"
|
||||||
|
fi
|
||||||
|
|
||||||
|
$update_first && chroot-run -r "${bindmounts_ro[*]}" -w "${bindmounts_rw[*]}" "$copydir" \
|
||||||
pacman -Syu --noconfirm
|
pacman -Syu --noconfirm
|
||||||
|
|
||||||
[[ -n ${install_pkgs[*]} ]] && install_packages
|
if [[ -n ${install_pkgs[*]:-} ]]; then
|
||||||
|
install_packages "$copydir" "${install_pkgs[@]}"
|
||||||
download_sources
|
ret=$?
|
||||||
|
# If there is no PKGBUILD we have done
|
||||||
prepare_chroot
|
[[ -f PKGBUILD ]] || return $ret
|
||||||
|
|
||||||
mountargs_rw="${PWD}:/startdir,${SRCDEST}:/srcdest"
|
|
||||||
|
|
||||||
if chroot-run -r "${mountargs_ro}" \
|
|
||||||
-w "${mountargs_rw}" \
|
|
||||||
"$copydir" \
|
|
||||||
/chrootbuild; then
|
|
||||||
move_products
|
|
||||||
else
|
|
||||||
(( ret += 1 ))
|
|
||||||
fi
|
|
||||||
|
|
||||||
$temp_chroot && clean_temporary
|
|
||||||
|
|
||||||
if (( ret != 0 )); then
|
|
||||||
if $temp_chroot; then
|
|
||||||
die "Build failed"
|
|
||||||
else
|
|
||||||
die "Build failed, check %s/build" "$copydir"
|
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
true
|
download_sources "$copydir" "$src_owner"
|
||||||
fi
|
|
||||||
|
prepare_chroot "$copydir" "$USER_HOME" "$repack" "$run_namcap"
|
||||||
|
|
||||||
|
bindmounts_rw+=("${PWD}:/startdir" "${SRCDEST}:/srcdest")
|
||||||
|
|
||||||
|
if chroot-run -r "${bindmounts_ro[*]}" -w "${bindmounts_rw[*]}" "$copydir" \
|
||||||
|
/chrootbuild "${makepkg_args[@]}"; then
|
||||||
|
move_products "$copydir" "$src_owner"
|
||||||
|
else
|
||||||
|
(( ret += 1 ))
|
||||||
|
fi
|
||||||
|
|
||||||
|
$temp_chroot && delete_chroot "$copydir" "$copy"
|
||||||
|
|
||||||
|
if (( ret != 0 )); then
|
||||||
|
if $temp_chroot; then
|
||||||
|
die "Build failed"
|
||||||
|
else
|
||||||
|
die "Build failed, check %s/build" "$copydir"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
true
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
|
|
|
@ -14,10 +14,11 @@ version=@version@
|
||||||
LIBDIR='@libdir@'
|
LIBDIR='@libdir@'
|
||||||
|
|
||||||
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
|
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
|
||||||
|
|
||||||
import ${LIBDIR}/util.sh
|
import ${LIBDIR}/util.sh
|
||||||
|
|
||||||
load_vars "$HOME/.makepkg.conf"
|
load_user_info
|
||||||
|
|
||||||
|
load_vars "${PAC_USERCONFDIR}/makepkg.conf" || load_vars "$USER_HOME/.makepkg.conf"
|
||||||
load_vars /etc/makepkg.conf
|
load_vars /etc/makepkg.conf
|
||||||
|
|
||||||
if [ ! -e "$1" ]; then
|
if [ ! -e "$1" ]; then
|
||||||
|
|
|
@ -22,6 +22,7 @@ pkg-config
|
||||||
sed
|
sed
|
||||||
sudo
|
sudo
|
||||||
texinfo
|
texinfo
|
||||||
|
libutil-linux-nosystemd
|
||||||
util-linux-nosystemd
|
util-linux-nosystemd
|
||||||
which
|
which
|
||||||
>multilib gcc-multilib
|
>multilib gcc-multilib
|
||||||
|
|
|
@ -4,3 +4,5 @@ cinnamon
|
||||||
deepin
|
deepin
|
||||||
i3
|
i3
|
||||||
mate
|
mate
|
||||||
|
lxde
|
||||||
|
netinstall
|
||||||
|
|
|
@ -2,4 +2,3 @@ kde
|
||||||
xfce
|
xfce
|
||||||
gnome
|
gnome
|
||||||
lxqt
|
lxqt
|
||||||
netinstall
|
|
||||||
|
|
|
@ -14,9 +14,6 @@
|
||||||
# build dir where buildpkg or buildiso chroots are created
|
# build dir where buildpkg or buildiso chroots are created
|
||||||
# chroots_dir=/var/lib/manjaro-tools
|
# chroots_dir=/var/lib/manjaro-tools
|
||||||
|
|
||||||
# log dir where log files are created
|
|
||||||
# log_dir='/var/log/manjaro-tools'
|
|
||||||
|
|
||||||
# custom build mirror server
|
# custom build mirror server
|
||||||
# build_mirror=http://mirror.netzspielplatz.de/manjaro/packages
|
# build_mirror=http://mirror.netzspielplatz.de/manjaro/packages
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,6 @@
|
||||||
#GPGDir = /etc/pacman.d/gnupg/
|
#GPGDir = /etc/pacman.d/gnupg/
|
||||||
#HookDir = /etc/pacman.d/hooks/
|
#HookDir = /etc/pacman.d/hooks/
|
||||||
HoldPkg = pacman glibc
|
HoldPkg = pacman glibc
|
||||||
# If upgrades are available for these packages they will be asked for first
|
|
||||||
SyncFirst = manjaro-system archlinux-keyring manjaro-keyring
|
|
||||||
#XferCommand = /usr/bin/curl -C - -f %u > %o
|
#XferCommand = /usr/bin/curl -C - -f %u > %o
|
||||||
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
|
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
|
||||||
#CleanMethod = KeepInstalled
|
#CleanMethod = KeepInstalled
|
||||||
|
@ -35,8 +33,7 @@ Architecture = auto
|
||||||
#UseSyslog
|
#UseSyslog
|
||||||
#Color
|
#Color
|
||||||
#TotalDownload
|
#TotalDownload
|
||||||
# We cannot check disk space from within a chroot environment
|
CheckSpace
|
||||||
#CheckSpace
|
|
||||||
#VerbosePkgLists
|
#VerbosePkgLists
|
||||||
|
|
||||||
# By default, pacman accepts packages signed by keys that its local keyring
|
# By default, pacman accepts packages signed by keys that its local keyring
|
||||||
|
@ -68,20 +65,13 @@ LocalFileSigLevel = Optional
|
||||||
# uncommented to enable the repo.
|
# 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.
|
|
||||||
|
|
||||||
[core]
|
[core]
|
||||||
SigLevel = PackageRequired
|
|
||||||
Include = /etc/pacman.d/mirrorlist
|
Include = /etc/pacman.d/mirrorlist
|
||||||
|
|
||||||
[extra]
|
[extra]
|
||||||
SigLevel = PackageRequired
|
|
||||||
Include = /etc/pacman.d/mirrorlist
|
Include = /etc/pacman.d/mirrorlist
|
||||||
|
|
||||||
[community]
|
[community]
|
||||||
SigLevel = PackageRequired
|
|
||||||
Include = /etc/pacman.d/mirrorlist
|
Include = /etc/pacman.d/mirrorlist
|
||||||
|
|
||||||
# An example of a custom package repository. See the pacman manpage for
|
# An example of a custom package repository. See the pacman manpage for
|
||||||
|
@ -89,4 +79,3 @@ Include = /etc/pacman.d/mirrorlist
|
||||||
#[custom]
|
#[custom]
|
||||||
#SigLevel = Optional TrustAll
|
#SigLevel = Optional TrustAll
|
||||||
#Server = file:///home/custompkgs
|
#Server = file:///home/custompkgs
|
||||||
|
|
||||||
|
|
|
@ -14,10 +14,12 @@
|
||||||
#CacheDir = /var/cache/pacman/pkg/
|
#CacheDir = /var/cache/pacman/pkg/
|
||||||
#LogFile = /var/log/pacman.log
|
#LogFile = /var/log/pacman.log
|
||||||
#GPGDir = /etc/pacman.d/gnupg/
|
#GPGDir = /etc/pacman.d/gnupg/
|
||||||
|
#HookDir = /etc/pacman.d/hooks/
|
||||||
HoldPkg = pacman glibc
|
HoldPkg = pacman glibc
|
||||||
#XferCommand = /usr/bin/curl -C - -f %u > %o
|
#XferCommand = /usr/bin/curl -C - -f %u > %o
|
||||||
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
|
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
|
||||||
#CleanMethod = KeepInstalled
|
#CleanMethod = KeepInstalled
|
||||||
|
#UseDelta = 0.7
|
||||||
Architecture = auto
|
Architecture = auto
|
||||||
|
|
||||||
# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
|
# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
|
||||||
|
@ -29,23 +31,20 @@ Architecture = auto
|
||||||
|
|
||||||
# Misc options
|
# Misc options
|
||||||
#UseSyslog
|
#UseSyslog
|
||||||
#UseDelta
|
#Color
|
||||||
#TotalDownload
|
#TotalDownload
|
||||||
CheckSpace
|
CheckSpace
|
||||||
#VerbosePkgLists
|
#VerbosePkgLists
|
||||||
|
|
||||||
# PGP signature checking
|
# By default, pacman accepts packages signed by keys that its local keyring
|
||||||
# NOTE: None of this will work without running `pacman-key --init` first.
|
# trusts (see pacman-key and its man page), as well as unsigned packages.
|
||||||
# The compiled in default is equivalent to the following line. This requires
|
SigLevel = Required DatabaseOptional
|
||||||
# you to locally sign and trust packager keys using `pacman-key` for them to be
|
LocalFileSigLevel = Optional
|
||||||
# considered valid.
|
#RemoteFileSigLevel = Required
|
||||||
#SigLevel = Optional TrustedOnly
|
|
||||||
# If you wish to check signatures but avoid local sign and trust issues, use
|
# NOTE: You must run `pacman-key --init` before first using pacman; the local
|
||||||
# the following line. This will treat any key imported into pacman's keyring as
|
# keyring can then be populated with the keys of all official Manjaro Linux
|
||||||
# trusted.
|
# packagers with `pacman-key --populate archlinux manjaro`.
|
||||||
#SigLevel = Optional TrustAll
|
|
||||||
# For now, off by default unless you read the above.
|
|
||||||
SigLevel = Never
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# REPOSITORIES
|
# REPOSITORIES
|
||||||
|
@ -67,5 +66,4 @@ SigLevel = Never
|
||||||
#
|
#
|
||||||
|
|
||||||
[mhwd]
|
[mhwd]
|
||||||
#SigLevel = Optional TrustAll
|
|
||||||
Server = file:///opt/pkg
|
Server = file:///opt/pkg
|
||||||
|
|
|
@ -1,28 +0,0 @@
|
||||||
##
|
|
||||||
## /etc/pacman-mirrors.conf
|
|
||||||
##
|
|
||||||
|
|
||||||
## Branch Pacman should use (stable, testing, unstable)
|
|
||||||
Branch = stable
|
|
||||||
|
|
||||||
## Generation method
|
|
||||||
## 1) rank - rank mirrors depending on their access time
|
|
||||||
## 2) random - randomly generate the output mirrorlist
|
|
||||||
# Method = rank
|
|
||||||
|
|
||||||
## Specify to use only mirrors from specific a country.
|
|
||||||
## Can add multiple countries separated by a comma (ex: Germany,France)
|
|
||||||
## Empty means all
|
|
||||||
# OnlyCountry =
|
|
||||||
|
|
||||||
## Mirrors directory
|
|
||||||
# MirrorlistsDir = /etc/pacman.d/mirrors
|
|
||||||
|
|
||||||
## Output file
|
|
||||||
# OutputMirrorlist = /etc/pacman.d/mirrorlist
|
|
||||||
|
|
||||||
## When set to True prevents the regeneration of the mirrorlist if
|
|
||||||
## pacman-mirrors is invoked with the --no-update argument.
|
|
||||||
## Useful if you don't want the mirrorlist regenerated after a
|
|
||||||
## pacman-mirrors package upgrade.
|
|
||||||
# NoUpdate = False
|
|
|
@ -16,8 +16,6 @@
|
||||||
#GPGDir = /etc/pacman.d/gnupg/
|
#GPGDir = /etc/pacman.d/gnupg/
|
||||||
#HookDir = /etc/pacman.d/hooks/
|
#HookDir = /etc/pacman.d/hooks/
|
||||||
HoldPkg = pacman glibc
|
HoldPkg = pacman glibc
|
||||||
# If upgrades are available for these packages they will be asked for first
|
|
||||||
SyncFirst = manjaro-system archlinux-keyring manjaro-keyring
|
|
||||||
#XferCommand = /usr/bin/curl -C - -f %u > %o
|
#XferCommand = /usr/bin/curl -C - -f %u > %o
|
||||||
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
|
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
|
||||||
#CleanMethod = KeepInstalled
|
#CleanMethod = KeepInstalled
|
||||||
|
@ -35,8 +33,7 @@ Architecture = auto
|
||||||
#UseSyslog
|
#UseSyslog
|
||||||
#Color
|
#Color
|
||||||
#TotalDownload
|
#TotalDownload
|
||||||
# We cannot check disk space from within a chroot environment
|
CheckSpace
|
||||||
#CheckSpace
|
|
||||||
#VerbosePkgLists
|
#VerbosePkgLists
|
||||||
|
|
||||||
# By default, pacman accepts packages signed by keys that its local keyring
|
# By default, pacman accepts packages signed by keys that its local keyring
|
||||||
|
@ -68,27 +65,19 @@ LocalFileSigLevel = Optional
|
||||||
# uncommented to enable the repo.
|
# 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.
|
|
||||||
|
|
||||||
[core]
|
[core]
|
||||||
SigLevel = PackageRequired
|
|
||||||
Include = /etc/pacman.d/mirrorlist
|
Include = /etc/pacman.d/mirrorlist
|
||||||
|
|
||||||
[extra]
|
[extra]
|
||||||
SigLevel = PackageRequired
|
|
||||||
Include = /etc/pacman.d/mirrorlist
|
Include = /etc/pacman.d/mirrorlist
|
||||||
|
|
||||||
[community]
|
[community]
|
||||||
SigLevel = PackageRequired
|
|
||||||
Include = /etc/pacman.d/mirrorlist
|
Include = /etc/pacman.d/mirrorlist
|
||||||
|
|
||||||
# If you want to run 32 bit applications on your x86_64 system,
|
# If you want to run 32 bit applications on your x86_64 system,
|
||||||
# enable the multilib repositories as required here.
|
# enable the multilib repositories as required here.
|
||||||
|
|
||||||
[multilib]
|
[multilib]
|
||||||
SigLevel = PackageRequired
|
|
||||||
Include = /etc/pacman.d/mirrorlist
|
Include = /etc/pacman.d/mirrorlist
|
||||||
|
|
||||||
# An example of a custom package repository. See the pacman manpage for
|
# An example of a custom package repository. See the pacman manpage for
|
||||||
|
@ -96,4 +85,3 @@ Include = /etc/pacman.d/mirrorlist
|
||||||
#[custom]
|
#[custom]
|
||||||
#SigLevel = Optional TrustAll
|
#SigLevel = Optional TrustAll
|
||||||
#Server = file:///home/custompkgs
|
#Server = file:///home/custompkgs
|
||||||
|
|
||||||
|
|
|
@ -20,34 +20,23 @@
|
||||||
# nonfree xorg drivers
|
# nonfree xorg drivers
|
||||||
# nonfree_mhwd="true"
|
# nonfree_mhwd="true"
|
||||||
|
|
||||||
# possible values: grub;systemd-boot
|
|
||||||
# efi_boot_loader="grub"
|
|
||||||
|
|
||||||
# configure calamares for netinstall
|
# configure calamares for netinstall
|
||||||
# netinstall="false"
|
# netinstall="false"
|
||||||
|
|
||||||
# configure calamares to use chrootcfg instead of unpackfs; default: unpackfs
|
# configure calamares to use chrootcfg instead of unpackfs; default: unpackfs
|
||||||
# chrootcfg="false"
|
# chrootcfg="false"
|
||||||
|
|
||||||
# use geoip
|
|
||||||
# geoip="true"
|
|
||||||
|
|
||||||
# unset defaults to given values
|
# unset defaults to given values
|
||||||
# names must match systemd service names
|
# names must match systemd service names
|
||||||
# enable_systemd=('bluetooth' 'cronie' 'ModemManager' 'NetworkManager' 'org.cups.cupsd' 'tlp' 'tlp-sleep')
|
# enable_systemd=('bluetooth' 'cronie' 'ModemManager' 'NetworkManager' 'org.cups.cupsd' 'tlp' 'tlp-sleep')
|
||||||
# disable_systemd=()
|
|
||||||
|
|
||||||
# unset defaults to given values,
|
# unset defaults to given values,
|
||||||
# names must match openrc service names
|
# names must match openrc service names
|
||||||
# enable_openrc=('acpid' 'bluetooth' 'consolekit' 'cronie' 'cupsd' 'dbus' 'syslog-ng' 'NetworkManager')
|
# enable_openrc=('acpid' 'bluetooth' 'elogind' 'cronie' 'cupsd' 'dbus' 'syslog-ng' 'NetworkManager')
|
||||||
# disable_openrc=()
|
|
||||||
|
|
||||||
# unset defaults to given values
|
# unset defaults to given values
|
||||||
# addgroups="video,power,disk,storage,optical,network,lp,scanner,wheel"
|
# addgroups="video,power,disk,storage,optical,network,lp,scanner,wheel"
|
||||||
|
|
||||||
# the same workgroup name if samba is used
|
|
||||||
# smb_workgroup="Manjaro"
|
|
||||||
|
|
||||||
################# live-session #################
|
################# live-session #################
|
||||||
|
|
||||||
# unset defaults to given value
|
# unset defaults to given value
|
||||||
|
@ -58,13 +47,3 @@
|
||||||
|
|
||||||
# unset defaults to given value
|
# unset defaults to given value
|
||||||
# password="manjaro"
|
# password="manjaro"
|
||||||
|
|
||||||
# unset defaults to given values
|
|
||||||
# names must match systemd service names
|
|
||||||
# services in enable_systemd array don't need to be listed here
|
|
||||||
# enable_systemd_live=('manjaro-live' 'mhwd-live' 'pacman-init' 'mirrors-live')
|
|
||||||
|
|
||||||
# unset defaults to given values,
|
|
||||||
# names must match openrc service names
|
|
||||||
# services in enable_openrc array don't need to be listed here
|
|
||||||
# enable_openrc_live=('manjaro-live' 'mhwd-live' 'pacman-init' 'mirrors-live')
|
|
||||||
|
|
|
@ -96,13 +96,31 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><option>-i PKG</option></term>
|
<term><option>-i PKG</option></term>
|
||||||
|
|
||||||
<listitem><para>Install a package into the working copy of the chroot.</para></listitem>
|
<listitem><para>Install packages into the working copy of the chroot.</para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term><option>-o</option></term>
|
||||||
|
|
||||||
|
<listitem><para>Create chroot.</para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term><option>-d</option></term>
|
||||||
|
|
||||||
|
<listitem><para>Delete chroot.</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><option>-c</option></term>
|
<term><option>-c</option></term>
|
||||||
|
|
||||||
<listitem><para>Recreate chroot.</para></listitem>
|
<listitem><para>Clean chroot copy.</para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term><option>-u</option></term>
|
||||||
|
|
||||||
|
<listitem><para>Update chroot copy.</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
|
@ -123,6 +141,12 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||||
<listitem><para>Sign package.</para></listitem>
|
<listitem><para>Sign package.</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term><option>-x</option></term>
|
||||||
|
|
||||||
|
<listitem><para>Udev base-devel group (no systemd).</para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><option>-q</option></term>
|
<term><option>-q</option></term>
|
||||||
|
|
||||||
|
|
|
@ -76,12 +76,6 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||||
you will upload.</para></listitem>
|
you will upload.</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><option>-c</option></term>
|
|
||||||
|
|
||||||
<listitem><para>Create new remote release.</para></listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><option>-l</option></term>
|
<term><option>-l</option></term>
|
||||||
|
|
||||||
|
|
|
@ -126,23 +126,6 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><varname>geoip=</varname></term>
|
|
||||||
|
|
||||||
<listitem><para>Accepts
|
|
||||||
<option>true</option> (the default)
|
|
||||||
<option>false</option>.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><varname>efi_boot_loader=</varname></term>
|
|
||||||
|
|
||||||
<listitem><para>Takes grub or gummibot. Configures
|
|
||||||
calamares to use that bootloader.
|
|
||||||
</para></listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><varname>enable_systemd=</varname></term>
|
<term><varname>enable_systemd=</varname></term>
|
||||||
|
|
||||||
|
@ -200,23 +183,6 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||||
</para></listitem>
|
</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><varname>enable_systemd_live=</varname></term>
|
|
||||||
|
|
||||||
<listitem><para>Array of services that will be
|
|
||||||
enabled in the systemd live-cd. It has to match
|
|
||||||
the names of .service systemd files.
|
|
||||||
</para></listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><varname>enable_openrc_live=</varname></term>
|
|
||||||
|
|
||||||
<listitem><para>Array of services that will be
|
|
||||||
enabled in the openrc live-cd.
|
|
||||||
</para></listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
</variablelist>
|
</variablelist>
|
||||||
|
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
|
|
@ -55,10 +55,11 @@ _mnt_sfs() {
|
||||||
local mnt="${2}"
|
local mnt="${2}"
|
||||||
local img_fullname="${img##*/}"
|
local img_fullname="${img##*/}"
|
||||||
local sfs_dev
|
local sfs_dev
|
||||||
|
local oper=$( [[ -n "${ip}" && -n "${miso_http_srv}" ]] && echo "mv" || echo "cp" )
|
||||||
|
|
||||||
if [[ "${copytoram}" == "y" ]]; then
|
if [[ "${copytoram}" == "y" ]]; then
|
||||||
msg -n ":: Copying squashfs image to RAM..."
|
msg -n ":: Copying squashfs image to RAM..."
|
||||||
if ! cp "${img}" "/run/miso/copytoram/${img_fullname}" ; then
|
if ! "${oper}" "${img}" "/run/miso/copytoram/${img_fullname}" ; then
|
||||||
echo "ERROR: while copy '${img}' to '/run/miso/copytoram/${img_fullname}'"
|
echo "ERROR: while copy '${img}' to '/run/miso/copytoram/${img_fullname}'"
|
||||||
launch_interactive_shell
|
launch_interactive_shell
|
||||||
fi
|
fi
|
||||||
|
@ -237,6 +238,8 @@ miso_mount_handler() {
|
||||||
|
|
||||||
if [[ "${copytoram}" == "y" ]]; then
|
if [[ "${copytoram}" == "y" ]]; then
|
||||||
umount -d /run/miso/bootmnt
|
umount -d /run/miso/bootmnt
|
||||||
|
mkdir -p /run/miso/bootmnt/${misobasedir}/${arch}
|
||||||
|
mount -o bind /run/miso/copytoram /run/miso/bootmnt/${misobasedir}/${arch}
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ miso_pxe_http_mount_handler () {
|
||||||
local _src=${miso_http_srv}${misobasedir}/${arch}
|
local _src=${miso_http_srv}${misobasedir}/${arch}
|
||||||
|
|
||||||
for sfs in livefs mhwdfs desktopfs rootfs;do
|
for sfs in livefs mhwdfs desktopfs rootfs;do
|
||||||
if [[ -f "${_src}/${sfs}.sfs" ]]; then
|
if [[ ! -z "$( curl -s --head "${_src}/${sfs}.sfs" | grep "OK" )" ]]; then
|
||||||
_curl_get "${_src}/${sfs}.sfs" "/${arch}"
|
_curl_get "${_src}/${sfs}.sfs" "/${arch}"
|
||||||
|
|
||||||
if [[ "${checksum}" == "y" ]]; then
|
if [[ "${checksum}" == "y" ]]; then
|
||||||
|
|
|
@ -4,6 +4,8 @@ build() {
|
||||||
add_runscript
|
add_runscript
|
||||||
|
|
||||||
add_binary curl
|
add_binary curl
|
||||||
|
|
||||||
|
add_file $(readlink -f /etc/ssl/certs/ca-certificates.crt) /etc/ssl/certs/ca-certificates.crt
|
||||||
}
|
}
|
||||||
|
|
||||||
help() {
|
help() {
|
||||||
|
|
114
lib/util-chroot.sh
Normal file
114
lib/util-chroot.sh
Normal file
|
@ -0,0 +1,114 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# 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; version 2 of the License.
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
copy_mirrorlist(){
|
||||||
|
cp -a /etc/pacman.d/mirrorlist "$1/etc/pacman.d/"
|
||||||
|
}
|
||||||
|
|
||||||
|
copy_keyring(){
|
||||||
|
if [[ -d /etc/pacman.d/gnupg ]] && [[ ! -d $1/etc/pacman.d/gnupg ]]; then
|
||||||
|
cp -a /etc/pacman.d/gnupg "$1/etc/pacman.d/"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
create_min_fs(){
|
||||||
|
msg "Creating install root at %s" "$1"
|
||||||
|
mkdir -m 0755 -p $1/var/{cache/pacman/pkg,lib/pacman,log} $1/{dev,run,etc}
|
||||||
|
mkdir -m 1777 -p $1/tmp
|
||||||
|
mkdir -m 0555 -p $1/{sys,proc}
|
||||||
|
}
|
||||||
|
|
||||||
|
is_btrfs() {
|
||||||
|
[[ -e "$1" && "$(stat -f -c %T "$1")" == btrfs ]]
|
||||||
|
}
|
||||||
|
|
||||||
|
subvolume_delete_recursive() {
|
||||||
|
local subvol
|
||||||
|
|
||||||
|
is_btrfs "$1" || return 0
|
||||||
|
|
||||||
|
while IFS= read -d $'\0' -r subvol; do
|
||||||
|
if ! btrfs subvolume delete "$subvol" &>/dev/null; then
|
||||||
|
error "Unable to delete subvolume %s" "$subvol"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
done < <(find "$1" -xdev -depth -inum 256 -print0)
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
default_locale(){
|
||||||
|
local action="$1" mnt="$2"
|
||||||
|
if [[ $action == "set" ]];then
|
||||||
|
if [[ ! -f "$mnt/etc/locale.gen.bak" ]] && [[ ! -f "$mnt/etc/locale.conf.bak" ]];then
|
||||||
|
info "Setting locale ..."
|
||||||
|
mv "$mnt/etc/locale.gen" "$mnt/etc/locale.gen.bak"
|
||||||
|
mv "$mnt/etc/locale.conf" "$mnt/etc/locale.conf.bak"
|
||||||
|
printf '%s.UTF-8 UTF-8\n' en_US > "$mnt/etc/locale.gen"
|
||||||
|
printf 'LANG=%s.UTF-8\n' en_US > "$mnt/etc/locale.conf"
|
||||||
|
printf 'LC_MESSAGES=C\n' >> "$mnt/etc/locale.conf"
|
||||||
|
fi
|
||||||
|
elif [[ $action == "reset" ]];then
|
||||||
|
if [[ -f "$mnt/etc/locale.gen.bak" ]] && [[ -f "$mnt/etc/locale.conf.bak" ]];then
|
||||||
|
info "Resetting locale ..."
|
||||||
|
mv "$mnt/etc/locale.gen.bak" "$mnt/etc/locale.gen"
|
||||||
|
mv "$mnt/etc/locale.conf.bak" "$mnt/etc/locale.conf"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
create_chroot(){
|
||||||
|
local timer=$(get_timer)
|
||||||
|
setarch "${target_arch}" \
|
||||||
|
mkchroot "$@"
|
||||||
|
show_elapsed_time "${FUNCNAME}" "${timer}"
|
||||||
|
}
|
||||||
|
|
||||||
|
delete_chroot() {
|
||||||
|
local copydir=$1
|
||||||
|
local copy=${1:-$2}
|
||||||
|
|
||||||
|
stat_busy "Removing chroot copy [%s]" "$copy"
|
||||||
|
if is_btrfs "$chrootdir" && ! mountpoint -q "$copydir"; then
|
||||||
|
subvolume_delete_recursive "$copydir" ||
|
||||||
|
die "Unable to delete subvolume %s" "$copydir"
|
||||||
|
else
|
||||||
|
# avoid change of filesystem in case of an umount failure
|
||||||
|
rm --recursive --force --one-file-system "$copydir" ||
|
||||||
|
die "Unable to delete %s" "$copydir"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# remove lock file
|
||||||
|
rm -f "$copydir.lock"
|
||||||
|
stat_done
|
||||||
|
}
|
||||||
|
|
||||||
|
# $1: chroot
|
||||||
|
# kill_chroot_process(){
|
||||||
|
# # enable to have more debug info
|
||||||
|
# #msg "machine-id (etc): $(cat $1/etc/machine-id)"
|
||||||
|
# #[[ -e $1/var/lib/dbus/machine-id ]] && msg "machine-id (lib): $(cat $1/var/lib/dbus/machine-id)"
|
||||||
|
# #msg "running processes: "
|
||||||
|
# #lsof | grep $1
|
||||||
|
#
|
||||||
|
# local prefix="$1" flink pid name
|
||||||
|
# for root_dir in /proc/*/root; do
|
||||||
|
# flink=$(readlink $root_dir)
|
||||||
|
# if [ "x$flink" != "x" ]; then
|
||||||
|
# if [ "x${flink:0:${#prefix}}" = "x$prefix" ]; then
|
||||||
|
# # this process is in the chroot...
|
||||||
|
# pid=$(basename $(dirname "$root_dir"))
|
||||||
|
# name=$(ps -p $pid -o comm=)
|
||||||
|
# info "Killing chroot process: %s (%s)" "$name" "$pid"
|
||||||
|
# kill -9 "$pid"
|
||||||
|
# fi
|
||||||
|
# fi
|
||||||
|
# done
|
||||||
|
# }
|
233
lib/util-iso-chroot.sh
Normal file
233
lib/util-iso-chroot.sh
Normal file
|
@ -0,0 +1,233 @@
|
||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# 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; version 2 of the License.
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
add_svc_rc(){
|
||||||
|
local mnt="$1" name="$2"
|
||||||
|
if [[ -f $mnt/etc/init.d/$name ]];then
|
||||||
|
msg2 "Setting %s ..." "$name"
|
||||||
|
chroot $mnt rc-update add $name default &>/dev/null
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
add_svc_sd(){
|
||||||
|
local mnt="$1" name="$2"
|
||||||
|
if [[ -f $mnt/etc/systemd/system/$name.service ]] || \
|
||||||
|
[[ -f $mnt/usr/lib/systemd/system/$name.service ]];then
|
||||||
|
msg2 "Setting %s ..." "$name"
|
||||||
|
chroot $mnt systemctl enable $name &>/dev/null
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
set_xdm(){
|
||||||
|
if [[ -f $1/etc/conf.d/xdm ]];then
|
||||||
|
local conf='DISPLAYMANAGER="'${displaymanager}'"'
|
||||||
|
sed -i -e "s|^.*DISPLAYMANAGER=.*|${conf}|" $1/etc/conf.d/xdm
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
configure_mhwd_drivers(){
|
||||||
|
local path=$1$2/ \
|
||||||
|
drv_path=$1/var/lib/mhwd/db/pci/graphic_drivers
|
||||||
|
info "Configuring mwwd db ..."
|
||||||
|
if [ -z "$(ls $path | grep catalyst-utils 2> /dev/null)" ]; then
|
||||||
|
msg2 "Disabling Catalyst driver"
|
||||||
|
mkdir -p $drv_path/catalyst/
|
||||||
|
touch $drv_path/catalyst/MHWDCONFIG
|
||||||
|
fi
|
||||||
|
if [ -z "$(ls $path | grep nvidia-utils 2> /dev/null)" ]; then
|
||||||
|
msg2 "Disabling Nvidia driver"
|
||||||
|
mkdir -p $drv_path/nvidia/
|
||||||
|
touch $drv_path/nvidia/MHWDCONFIG
|
||||||
|
msg2 "Disabling Nvidia Bumblebee driver"
|
||||||
|
mkdir -p $drv_path/hybrid-intel-nvidia-bumblebee/
|
||||||
|
touch $drv_path/hybrid-intel-nvidia-bumblebee/MHWDCONFIG
|
||||||
|
fi
|
||||||
|
if [ -z "$(ls $path | grep nvidia-304xx-utils 2> /dev/null)" ]; then
|
||||||
|
msg2 "Disabling Nvidia 304xx driver"
|
||||||
|
mkdir -p $drv_path/nvidia-304xx/
|
||||||
|
touch $drv_path/nvidia-304xx/MHWDCONFIG
|
||||||
|
fi
|
||||||
|
if [ -z "$(ls $path | grep nvidia-340xx-utils 2> /dev/null)" ]; then
|
||||||
|
msg2 "Disabling Nvidia 340xx driver"
|
||||||
|
mkdir -p $drv_path/nvidia-340xx/
|
||||||
|
touch $drv_path/nvidia-340xx/MHWDCONFIG
|
||||||
|
fi
|
||||||
|
if [ -z "$(ls $path | grep xf86-video-amdgpu 2> /dev/null)" ]; then
|
||||||
|
msg2 "Disabling AMD gpu driver"
|
||||||
|
mkdir -p $drv_path/xf86-video-amdgpu/
|
||||||
|
touch $drv_path/xf86-video-amdgpu/MHWDCONFIG
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
configure_hosts(){
|
||||||
|
sed -e "s|localhost.localdomain|localhost.localdomain ${hostname}|" -i $1/etc/hosts
|
||||||
|
}
|
||||||
|
|
||||||
|
configure_lsb(){
|
||||||
|
local conf=$1/etc/lsb-release
|
||||||
|
if [[ -e $conf ]] ; then
|
||||||
|
msg2 "Configuring lsb-release"
|
||||||
|
sed -i -e "s/^.*DISTRIB_RELEASE.*/DISTRIB_RELEASE=${dist_release}/" $conf
|
||||||
|
sed -i -e "s/^.*DISTRIB_CODENAME.*/DISTRIB_CODENAME=${dist_codename}/" $conf
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
configure_logind(){
|
||||||
|
local conf=$1/etc/$2/logind.conf
|
||||||
|
if [[ -e $conf ]];then
|
||||||
|
msg2 "Configuring logind ..."
|
||||||
|
sed -i 's/#\(HandleSuspendKey=\)suspend/\1ignore/' "$conf"
|
||||||
|
sed -i 's/#\(HandleLidSwitch=\)suspend/\1ignore/' "$conf"
|
||||||
|
sed -i 's/#\(HandleHibernateKey=\)hibernate/\1ignore/' "$conf"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
configure_journald(){
|
||||||
|
local conf=$1/etc/systemd/journald.conf
|
||||||
|
if [[ -e $conf ]];then
|
||||||
|
msg2 "Configuring journald ..."
|
||||||
|
sed -i 's/#\(Storage=\)auto/\1volatile/' "$conf"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
configure_services(){
|
||||||
|
local mnt="$1"
|
||||||
|
info "Configuring [%s]" "${initsys}"
|
||||||
|
case ${initsys} in
|
||||||
|
'openrc')
|
||||||
|
for svc in ${enable_openrc[@]}; do
|
||||||
|
[[ $svc == "xdm" ]] && set_xdm "$mnt"
|
||||||
|
add_svc_rc "$mnt" "$svc"
|
||||||
|
done
|
||||||
|
for svc in ${enable_live[@]}; do
|
||||||
|
add_svc_rc "$mnt" "$svc"
|
||||||
|
done
|
||||||
|
;;
|
||||||
|
'systemd')
|
||||||
|
for svc in ${enable_systemd[@]}; do
|
||||||
|
add_svc_sd "$mnt" "$svc"
|
||||||
|
done
|
||||||
|
for svc in ${enable_live[@]}; do
|
||||||
|
add_svc_sd "$mnt" "$svc"
|
||||||
|
done
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
info "Done configuring [%s]" "${initsys}"
|
||||||
|
}
|
||||||
|
|
||||||
|
configure_system(){
|
||||||
|
local mnt="$1"
|
||||||
|
case ${initsys} in
|
||||||
|
'systemd')
|
||||||
|
configure_logind "$mnt" "systemd"
|
||||||
|
configure_journald "$mnt"
|
||||||
|
|
||||||
|
# Prevent some services to be started in the livecd
|
||||||
|
echo 'File created by manjaro-tools. See systemd-update-done.service(8).' \
|
||||||
|
| tee "${mnt}/etc/.updated" >"${mnt}/var/.updated"
|
||||||
|
|
||||||
|
msg2 "Disable systemd-gpt-auto-generator"
|
||||||
|
ln -sf /dev/null "${mnt}/usr/lib/systemd/system-generators/systemd-gpt-auto-generator"
|
||||||
|
;;
|
||||||
|
'openrc')
|
||||||
|
configure_logind "$mnt" "elogind"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
echo ${hostname} > $mnt/etc/hostname
|
||||||
|
}
|
||||||
|
|
||||||
|
make_repo(){
|
||||||
|
local dest="$1" repo="$2"
|
||||||
|
cp ${DATADIR}/pacman-mhwd.conf $dest/opt
|
||||||
|
repo-add $dest$repo/mhwd.db.tar.gz $dest$repo/*pkg*z
|
||||||
|
}
|
||||||
|
|
||||||
|
clean_iso_root(){
|
||||||
|
local dest="$1"
|
||||||
|
msg "Deleting isoroot [%s] ..." "${dest##*/}"
|
||||||
|
rm -rf --one-file-system "$dest"
|
||||||
|
}
|
||||||
|
|
||||||
|
clean_up_image(){
|
||||||
|
local path mnt="$1"
|
||||||
|
msg2 "Cleaning [%s]" "${mnt##*/}"
|
||||||
|
if [[ ${mnt##*/} == 'mhwdfs' ]];then
|
||||||
|
path=$mnt/var
|
||||||
|
if [[ -d $path ]];then
|
||||||
|
find "$path" -mindepth 0 -delete &> /dev/null
|
||||||
|
fi
|
||||||
|
path=$mnt/etc
|
||||||
|
if [[ -d $path ]];then
|
||||||
|
find "$path" -mindepth 0 -delete &> /dev/null
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
default_locale "reset" "$mnt"
|
||||||
|
path=$mnt/boot
|
||||||
|
if [[ -d "$path" ]]; then
|
||||||
|
find "$path" -name 'initramfs*.img' -delete &> /dev/null
|
||||||
|
fi
|
||||||
|
path=$mnt/var/lib/pacman/sync
|
||||||
|
if [[ -d $path ]];then
|
||||||
|
find "$path" -type f -delete &> /dev/null
|
||||||
|
fi
|
||||||
|
path=$mnt/var/cache/pacman/pkg
|
||||||
|
if [[ -d $path ]]; then
|
||||||
|
find "$path" -type f -delete &> /dev/null
|
||||||
|
fi
|
||||||
|
path=$mnt/var/log
|
||||||
|
if [[ -d $path ]]; then
|
||||||
|
find "$path" -type f -delete &> /dev/null
|
||||||
|
fi
|
||||||
|
path=$mnt/var/tmp
|
||||||
|
if [[ -d $path ]];then
|
||||||
|
find "$path" -mindepth 1 -delete &> /dev/null
|
||||||
|
fi
|
||||||
|
path=$mnt/tmp
|
||||||
|
if [[ -d $path ]];then
|
||||||
|
find "$path" -mindepth 1 -delete &> /dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ${mnt##*/} == 'livefs' ]];then
|
||||||
|
rm -rf "$mnt/etc/pacman.d/gnupg"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
find "$mnt" -name *.pacnew -name *.pacsave -name *.pacorig -delete
|
||||||
|
file=$mnt/boot/grub/grub.cfg
|
||||||
|
if [[ -f "$file" ]]; then
|
||||||
|
rm $file
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
copy_from_cache(){
|
||||||
|
local list="${tmp_dir}"/mhwd-cache.list
|
||||||
|
local mnt="$1" repo="$2"
|
||||||
|
shift 2
|
||||||
|
chroot-run "$mnt" pacman -v -Syw --noconfirm "$@" || return 1
|
||||||
|
chroot-run "$mnt" pacman -v -Sp --noconfirm "$@" > "$list"
|
||||||
|
sed -ni '/.pkg.tar.xz/p' "$list"
|
||||||
|
sed -i "s/.*\///" "$list"
|
||||||
|
msg2 "Copying mhwd package cache ..."
|
||||||
|
rsync -v --files-from="$list" /var/cache/pacman/pkg "$mnt$repo"
|
||||||
|
}
|
||||||
|
|
||||||
|
chroot_clean(){
|
||||||
|
local dest="$1"
|
||||||
|
for root in "$dest"/*; do
|
||||||
|
[[ -d ${root} ]] || continue
|
||||||
|
local name=${root##*/}
|
||||||
|
if [[ $name != "mhwdfs" ]];then
|
||||||
|
delete_chroot "${root}" "$dest"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
rm -rf --one-file-system "$dest"
|
||||||
|
}
|
||||||
|
|
|
@ -6,50 +6,53 @@
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
prepare_initcpio(){
|
prepare_initcpio(){
|
||||||
msg2 "Copying initcpio ..."
|
msg2 "Copying initcpio ..."
|
||||||
cp /etc/initcpio/hooks/miso* $1/etc/initcpio/hooks
|
local dest="$1"
|
||||||
cp /etc/initcpio/install/miso* $1/etc/initcpio/install
|
cp /etc/initcpio/hooks/miso* $dest/etc/initcpio/hooks
|
||||||
cp /etc/initcpio/miso_shutdown $1/etc/initcpio
|
cp /etc/initcpio/install/miso* $dest/etc/initcpio/install
|
||||||
|
cp /etc/initcpio/miso_shutdown $dest/etc/initcpio
|
||||||
}
|
}
|
||||||
|
|
||||||
prepare_initramfs(){
|
prepare_initramfs(){
|
||||||
cp ${DATADIR}/mkinitcpio.conf $1/etc/mkinitcpio-${iso_name}.conf
|
local mnt="$1"
|
||||||
local _kernver=$(cat $1/usr/lib/modules/*/version)
|
cp ${DATADIR}/mkinitcpio.conf $mnt/etc/mkinitcpio-${os_id}.conf
|
||||||
|
local _kernver=$(cat $mnt/usr/lib/modules/*/version)
|
||||||
if [[ -n ${gpgkey} ]]; then
|
if [[ -n ${gpgkey} ]]; then
|
||||||
su ${OWNER} -c "gpg --export ${gpgkey} >${USERCONFDIR}/gpgkey"
|
su ${OWNER} -c "gpg --export ${gpgkey} >${MT_USERCONFDIR}/gpgkey"
|
||||||
exec 17<>${USERCONFDIR}/gpgkey
|
exec 17<>${MT_USERCONFDIR}/gpgkey
|
||||||
fi
|
fi
|
||||||
MISO_GNUPG_FD=${gpgkey:+17} chroot-run $1 \
|
MISO_GNUPG_FD=${gpgkey:+17} chroot-run $mnt \
|
||||||
/usr/bin/mkinitcpio -k ${_kernver} \
|
/usr/bin/mkinitcpio -k ${_kernver} \
|
||||||
-c /etc/mkinitcpio-${iso_name}.conf \
|
-c /etc/mkinitcpio-${os_id}.conf \
|
||||||
-g /boot/initramfs.img
|
-g /boot/initramfs.img
|
||||||
|
|
||||||
if [[ -n ${gpgkey} ]]; then
|
if [[ -n ${gpgkey} ]]; then
|
||||||
exec 17<&-
|
exec 17<&-
|
||||||
fi
|
fi
|
||||||
if [[ -f ${USERCONFDIR}/gpgkey ]]; then
|
if [[ -f ${MT_USERCONFDIR}/gpgkey ]]; then
|
||||||
rm ${USERCONFDIR}/gpgkey
|
rm ${MT_USERCONFDIR}/gpgkey
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
prepare_boot_extras(){
|
prepare_boot_extras(){
|
||||||
cp $1/boot/intel-ucode.img $2/intel_ucode.img
|
local src="$1" dest="$2"
|
||||||
cp $1/usr/share/licenses/intel-ucode/LICENSE $2/intel_ucode.LICENSE
|
cp $src/boot/intel-ucode.img $dest/intel_ucode.img
|
||||||
cp $1/boot/memtest86+/memtest.bin $2/memtest
|
cp $src/usr/share/licenses/intel-ucode/LICENSE $dest/intel_ucode.LICENSE
|
||||||
cp $1/usr/share/licenses/common/GPL2/license.txt $2/memtest.COPYING
|
cp $src/boot/memtest86+/memtest.bin $dest/memtest
|
||||||
|
cp $src/usr/share/licenses/common/GPL2/license.txt $dest/memtest.COPYING
|
||||||
}
|
}
|
||||||
|
|
||||||
prepare_grub(){
|
prepare_grub(){
|
||||||
local platform=i386-pc img='core.img' grub=$2/boot/grub efi=$2/efi/boot \
|
local platform=i386-pc img='core.img' grub=$3/boot/grub efi=$3/efi/boot \
|
||||||
data=$1/usr/share/grub lib=$1/usr/lib/grub prefix=/boot/grub
|
lib=$1/usr/lib/grub prefix=/boot/grub theme=$2/usr/share/grub data=$1/usr/share/grub
|
||||||
|
|
||||||
prepare_dir ${grub}/${platform}
|
prepare_dir ${grub}/${platform}
|
||||||
|
|
||||||
cp ${data}/cfg/*.cfg ${grub}
|
cp ${theme}/cfg/*.cfg ${grub}
|
||||||
|
|
||||||
cp ${lib}/${platform}/* ${grub}/${platform}
|
cp ${lib}/${platform}/* ${grub}/${platform}
|
||||||
|
|
||||||
|
@ -80,11 +83,11 @@ prepare_grub(){
|
||||||
grub-mkimage -d ${grub}/${platform} -o ${efi}/${img} -O ${platform} -p ${prefix} iso9660
|
grub-mkimage -d ${grub}/${platform} -o ${efi}/${img} -O ${platform} -p ${prefix} iso9660
|
||||||
|
|
||||||
prepare_dir ${grub}/themes
|
prepare_dir ${grub}/themes
|
||||||
cp -r ${data}/themes/${iso_name}-live ${grub}/themes/
|
cp -r ${theme}/themes/${os_id}-live ${grub}/themes/
|
||||||
cp ${data}/unicode.pf2 ${grub}
|
cp ${data}/unicode.pf2 ${grub}
|
||||||
cp -r ${data}/{locales,tz,video} ${grub}
|
cp -r ${theme}/{locales,tz} ${grub}
|
||||||
|
|
||||||
local size=8M mnt="${mnt_dir}/efiboot" efi_img="$2/efi.img"
|
local size=4M mnt="${mnt_dir}/efiboot" efi_img="$3/efi.img"
|
||||||
msg2 "Creating fat image of %s ..." "${size}"
|
msg2 "Creating fat image of %s ..." "${size}"
|
||||||
truncate -s ${size} "${efi_img}"
|
truncate -s ${size} "${efi_img}"
|
||||||
mkfs.fat -n MISO_EFI "${efi_img}" &>/dev/null
|
mkfs.fat -n MISO_EFI "${efi_img}" &>/dev/null
|
|
@ -1,313 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# 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; version 2 of the License.
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
copy_overlay(){
|
|
||||||
if [[ -e $1 ]];then
|
|
||||||
msg2 "Copying [%s] ..." "${1##*/}"
|
|
||||||
if [[ -L $1 ]];then
|
|
||||||
cp -a --no-preserve=ownership $1/* $2
|
|
||||||
else
|
|
||||||
cp -LR $1/* $2
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
add_svc_rc(){
|
|
||||||
if [[ -f $1/etc/init.d/$2 ]];then
|
|
||||||
msg2 "Setting %s ..." "$2"
|
|
||||||
chroot $1 rc-update add $2 default &>/dev/null
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
add_svc_sd(){
|
|
||||||
if [[ -f $1/etc/systemd/system/$2.service ]] || \
|
|
||||||
[[ -f $1/usr/lib/systemd/system/$2.service ]];then
|
|
||||||
msg2 "Setting %s ..." "$2"
|
|
||||||
chroot $1 systemctl enable $2 &>/dev/null
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
set_xdm(){
|
|
||||||
if [[ -f $1/etc/conf.d/xdm ]];then
|
|
||||||
local conf='DISPLAYMANAGER="'${displaymanager}'"'
|
|
||||||
sed -i -e "s|^.*DISPLAYMANAGER=.*|${conf}|" $1/etc/conf.d/xdm
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
configure_mhwd_drivers(){
|
|
||||||
local path=$1${mhwd_repo}/ \
|
|
||||||
drv_path=$1/var/lib/mhwd/db/pci/graphic_drivers
|
|
||||||
info "Configuring mwwd db ..."
|
|
||||||
if [ -z "$(ls $path | grep catalyst-utils 2> /dev/null)" ]; then
|
|
||||||
msg2 "Disabling Catalyst driver"
|
|
||||||
mkdir -p $drv_path/catalyst/
|
|
||||||
touch $drv_path/catalyst/MHWDCONFIG
|
|
||||||
fi
|
|
||||||
if [ -z "$(ls $path | grep nvidia-utils 2> /dev/null)" ]; then
|
|
||||||
msg2 "Disabling Nvidia driver"
|
|
||||||
mkdir -p $drv_path/nvidia/
|
|
||||||
touch $drv_path/nvidia/MHWDCONFIG
|
|
||||||
msg2 "Disabling Nvidia Bumblebee driver"
|
|
||||||
mkdir -p $drv_path/hybrid-intel-nvidia-bumblebee/
|
|
||||||
touch $drv_path/hybrid-intel-nvidia-bumblebee/MHWDCONFIG
|
|
||||||
fi
|
|
||||||
if [ -z "$(ls $path | grep nvidia-304xx-utils 2> /dev/null)" ]; then
|
|
||||||
msg2 "Disabling Nvidia 304xx driver"
|
|
||||||
mkdir -p $drv_path/nvidia-304xx/
|
|
||||||
touch $drv_path/nvidia-304xx/MHWDCONFIG
|
|
||||||
fi
|
|
||||||
if [ -z "$(ls $path | grep nvidia-340xx-utils 2> /dev/null)" ]; then
|
|
||||||
msg2 "Disabling Nvidia 340xx driver"
|
|
||||||
mkdir -p $drv_path/nvidia-340xx/
|
|
||||||
touch $drv_path/nvidia-340xx/MHWDCONFIG
|
|
||||||
fi
|
|
||||||
if [ -z "$(ls $path | grep xf86-video-amdgpu 2> /dev/null)" ]; then
|
|
||||||
msg2 "Disabling AMD gpu driver"
|
|
||||||
mkdir -p $drv_path/xf86-video-amdgpu/
|
|
||||||
touch $drv_path/xf86-video-amdgpu/MHWDCONFIG
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
configure_lsb(){
|
|
||||||
if [ -e $1/etc/lsb-release ] ; then
|
|
||||||
msg2 "Configuring lsb-release"
|
|
||||||
sed -i -e "s/^.*DISTRIB_RELEASE.*/DISTRIB_RELEASE=${dist_release}/" $1/etc/lsb-release
|
|
||||||
sed -i -e "s/^.*DISTRIB_CODENAME.*/DISTRIB_CODENAME=${dist_codename}/" $1/etc/lsb-release
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
configure_logind(){
|
|
||||||
msg2 "Configuring logind ..."
|
|
||||||
local conf=$1/etc/$2/logind.conf
|
|
||||||
sed -i 's/#\(HandleSuspendKey=\)suspend/\1ignore/' "$conf"
|
|
||||||
sed -i 's/#\(HandleLidSwitch=\)suspend/\1ignore/' "$conf"
|
|
||||||
sed -i 's/#\(HandleHibernateKey=\)hibernate/\1ignore/' "$conf"
|
|
||||||
}
|
|
||||||
|
|
||||||
configure_journald(){
|
|
||||||
msg2 "Configuring journald ..."
|
|
||||||
local conf=$1/etc/systemd/journald.conf
|
|
||||||
sed -i 's/#\(Storage=\)auto/\1volatile/' "$conf"
|
|
||||||
}
|
|
||||||
|
|
||||||
configure_services(){
|
|
||||||
info "Configuring [%s]" "${initsys}"
|
|
||||||
case ${initsys} in
|
|
||||||
'openrc')
|
|
||||||
for svc in ${enable_openrc[@]}; do
|
|
||||||
[[ $svc == "xdm" ]] && set_xdm "$1"
|
|
||||||
add_svc_rc "$1" "$svc"
|
|
||||||
done
|
|
||||||
for svc in ${enable_openrc_live[@]}; do
|
|
||||||
add_svc_rc "$1" "$svc"
|
|
||||||
done
|
|
||||||
;;
|
|
||||||
'systemd')
|
|
||||||
for svc in ${enable_systemd[@]}; do
|
|
||||||
add_svc_sd "$1" "$svc"
|
|
||||||
done
|
|
||||||
for svc in ${enable_systemd_live[@]}; do
|
|
||||||
add_svc_sd "$1" "$svc"
|
|
||||||
done
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
info "Done configuring [%s]" "${initsys}"
|
|
||||||
}
|
|
||||||
|
|
||||||
write_live_session_conf(){
|
|
||||||
local path=$1${SYSCONFDIR}
|
|
||||||
[[ ! -d $path ]] && mkdir -p $path
|
|
||||||
local conf=$path/live.conf
|
|
||||||
msg2 "Writing %s" "${conf##*/}"
|
|
||||||
echo '# live session configuration' > ${conf}
|
|
||||||
echo '' >> ${conf}
|
|
||||||
echo '# autologin' >> ${conf}
|
|
||||||
echo "autologin=${autologin}" >> ${conf}
|
|
||||||
echo '' >> ${conf}
|
|
||||||
echo '# login shell' >> ${conf}
|
|
||||||
echo "login_shell=${login_shell}" >> ${conf}
|
|
||||||
echo '' >> ${conf}
|
|
||||||
echo '# live username' >> ${conf}
|
|
||||||
echo "username=${username}" >> ${conf}
|
|
||||||
echo '' >> ${conf}
|
|
||||||
echo '# live password' >> ${conf}
|
|
||||||
echo "password=${password}" >> ${conf}
|
|
||||||
echo '' >> ${conf}
|
|
||||||
echo '# live group membership' >> ${conf}
|
|
||||||
echo "addgroups='${addgroups}'" >> ${conf}
|
|
||||||
if [[ -n ${smb_workgroup} ]];then
|
|
||||||
echo '' >> ${conf}
|
|
||||||
echo '# samba workgroup' >> ${conf}
|
|
||||||
echo "smb_workgroup=${smb_workgroup}" >> ${conf}
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
configure_hosts(){
|
|
||||||
sed -e "s|localhost.localdomain|localhost.localdomain ${hostname}|" -i $1/etc/hosts
|
|
||||||
}
|
|
||||||
|
|
||||||
configure_system(){
|
|
||||||
case ${initsys} in
|
|
||||||
'systemd')
|
|
||||||
configure_logind "$1" "systemd"
|
|
||||||
configure_journald "$1"
|
|
||||||
|
|
||||||
# Prevent some services to be started in the livecd
|
|
||||||
echo 'File created by manjaro-tools. See systemd-update-done.service(8).' \
|
|
||||||
| tee "${path}/etc/.updated" >"${path}/var/.updated"
|
|
||||||
|
|
||||||
msg2 "Disable systemd-gpt-auto-generator"
|
|
||||||
ln -sf /dev/null "${path}/usr/lib/systemd/system-generators/systemd-gpt-auto-generator"
|
|
||||||
;;
|
|
||||||
'openrc')
|
|
||||||
configure_logind "$1" "elogind"
|
|
||||||
# local hn='hostname="'${hostname}'"'
|
|
||||||
# sed -i -e "s|^.*hostname=.*|${hn}|" $1/etc/conf.d/hostname
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
echo ${hostname} > $1/etc/hostname
|
|
||||||
}
|
|
||||||
|
|
||||||
configure_thus(){
|
|
||||||
msg2 "Configuring Thus ..."
|
|
||||||
source "$1/etc/mkinitcpio.d/${kernel}.preset"
|
|
||||||
local conf="$1/etc/thus.conf"
|
|
||||||
echo "[distribution]" > "$conf"
|
|
||||||
echo "DISTRIBUTION_NAME = \"${dist_name} Linux\"" >> "$conf"
|
|
||||||
echo "DISTRIBUTION_VERSION = \"${dist_release}\"" >> "$conf"
|
|
||||||
echo "SHORT_NAME = \"${dist_name}\"" >> "$conf"
|
|
||||||
echo "[install]" >> "$conf"
|
|
||||||
echo "LIVE_MEDIA_SOURCE = \"/run/miso/bootmnt/${iso_name}/${target_arch}/rootfs.sfs\"" >> "$conf"
|
|
||||||
echo "LIVE_MEDIA_DESKTOP = \"/run/miso/bootmnt/${iso_name}/${target_arch}/desktopfs.sfs\"" >> "$conf"
|
|
||||||
echo "LIVE_MEDIA_TYPE = \"squashfs\"" >> "$conf"
|
|
||||||
echo "LIVE_USER_NAME = \"${username}\"" >> "$conf"
|
|
||||||
echo "KERNEL = \"${kernel}\"" >> "$conf"
|
|
||||||
echo "VMLINUZ = \"$(echo ${ALL_kver} | sed s'|/boot/||')\"" >> "$conf"
|
|
||||||
echo "INITRAMFS = \"$(echo ${default_image} | sed s'|/boot/||')\"" >> "$conf"
|
|
||||||
echo "FALLBACK = \"$(echo ${fallback_image} | sed s'|/boot/||')\"" >> "$conf"
|
|
||||||
|
|
||||||
if [[ -f $1/usr/share/applications/thus.desktop && -f $1/usr/bin/kdesu ]];then
|
|
||||||
sed -i -e 's|sudo|kdesu|g' $1/usr/share/applications/thus.desktop
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
configure_live_image(){
|
|
||||||
msg "Configuring [livefs]"
|
|
||||||
configure_hosts "$1"
|
|
||||||
configure_system "$1"
|
|
||||||
configure_services "$1"
|
|
||||||
configure_calamares "$1"
|
|
||||||
[[ ${edition} == "sonar" ]] && configure_thus "$1"
|
|
||||||
write_live_session_conf "$1"
|
|
||||||
msg "Done configuring [livefs]"
|
|
||||||
}
|
|
||||||
|
|
||||||
make_repo(){
|
|
||||||
repo-add $1${mhwd_repo}/mhwd.db.tar.gz $1${mhwd_repo}/*pkg*z
|
|
||||||
}
|
|
||||||
|
|
||||||
copy_from_cache(){
|
|
||||||
local list="${tmp_dir}"/mhwd-cache.list
|
|
||||||
chroot-run \
|
|
||||||
-r "${mountargs_ro}" \
|
|
||||||
-w "${mountargs_rw}" \
|
|
||||||
-B "${build_mirror}/${target_branch}" \
|
|
||||||
"$1" \
|
|
||||||
pacman -v -Syw $2 --noconfirm || return 1
|
|
||||||
chroot-run \
|
|
||||||
-r "${mountargs_ro}" \
|
|
||||||
-w "${mountargs_rw}" \
|
|
||||||
-B "${build_mirror}/${target_branch}" \
|
|
||||||
"$1" \
|
|
||||||
pacman -v -Sp $2 --noconfirm > "$list"
|
|
||||||
sed -ni '/.pkg.tar.xz/p' "$list"
|
|
||||||
sed -i "s/.*\///" "$list"
|
|
||||||
|
|
||||||
msg2 "Copying mhwd package cache ..."
|
|
||||||
rsync -v --files-from="$list" /var/cache/pacman/pkg "$1${mhwd_repo}"
|
|
||||||
}
|
|
||||||
|
|
||||||
chroot_create(){
|
|
||||||
[[ "${1##*/}" == "rootfs" ]] && local flag="-L"
|
|
||||||
setarch "${target_arch}" \
|
|
||||||
mkchroot ${mkchroot_args[*]} ${flag} $@
|
|
||||||
}
|
|
||||||
|
|
||||||
clean_iso_root(){
|
|
||||||
msg2 "Deleting isoroot [%s] ..." "${1##*/}"
|
|
||||||
rm -rf --one-file-system "$1"
|
|
||||||
}
|
|
||||||
|
|
||||||
chroot_clean(){
|
|
||||||
msg "Cleaning up ..."
|
|
||||||
for image in "$1"/*fs; do
|
|
||||||
[[ -d ${image} ]] || continue
|
|
||||||
local name=${image##*/}
|
|
||||||
if [[ $name != "mhwdfs" ]];then
|
|
||||||
msg2 "Deleting chroot [%s] (%s) ..." "$name" "${1##*/}"
|
|
||||||
lock 9 "${image}.lock" "Locking chroot '${image}'"
|
|
||||||
if [[ "$(stat -f -c %T "${image}")" == btrfs ]]; then
|
|
||||||
{ type -P btrfs && btrfs subvolume delete "${image}"; } #&> /dev/null
|
|
||||||
fi
|
|
||||||
rm -rf --one-file-system "${image}"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
exec 9>&-
|
|
||||||
rm -rf --one-file-system "$1"
|
|
||||||
}
|
|
||||||
|
|
||||||
clean_up_image(){
|
|
||||||
msg2 "Cleaning [%s]" "${1##*/}"
|
|
||||||
|
|
||||||
local path
|
|
||||||
if [[ ${1##*/} == 'mhwdfs' ]];then
|
|
||||||
path=$1/var
|
|
||||||
if [[ -d $path ]];then
|
|
||||||
find "$path" -mindepth 0 -delete &> /dev/null
|
|
||||||
fi
|
|
||||||
path=$1/etc
|
|
||||||
if [[ -d $path ]];then
|
|
||||||
find "$path" -mindepth 0 -delete &> /dev/null
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
[[ -f "$1/etc/locale.gen.bak" ]] && mv "$1/etc/locale.gen.bak" "$1/etc/locale.gen"
|
|
||||||
[[ -f "$1/etc/locale.conf.bak" ]] && mv "$1/etc/locale.conf.bak" "$1/etc/locale.conf"
|
|
||||||
path=$1/boot
|
|
||||||
if [[ -d "$path" ]]; then
|
|
||||||
find "$path" -name 'initramfs*.img' -delete &> /dev/null
|
|
||||||
fi
|
|
||||||
path=$1/var/lib/pacman/sync
|
|
||||||
if [[ -d $path ]];then
|
|
||||||
find "$path" -type f -delete &> /dev/null
|
|
||||||
fi
|
|
||||||
path=$1/var/cache/pacman/pkg
|
|
||||||
if [[ -d $path ]]; then
|
|
||||||
find "$path" -type f -delete &> /dev/null
|
|
||||||
fi
|
|
||||||
path=$1/var/log
|
|
||||||
if [[ -d $path ]]; then
|
|
||||||
find "$path" -type f -delete &> /dev/null
|
|
||||||
fi
|
|
||||||
path=$1/var/tmp
|
|
||||||
if [[ -d $path ]];then
|
|
||||||
find "$path" -mindepth 1 -delete &> /dev/null
|
|
||||||
fi
|
|
||||||
path=$1/tmp
|
|
||||||
if [[ -d $path ]];then
|
|
||||||
find "$path" -mindepth 1 -delete &> /dev/null
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
find "$1" -name *.pacnew -name *.pacsave -name *.pacorig -delete
|
|
||||||
file=$1/boot/grub/grub.cfg
|
|
||||||
if [[ -f "$file" ]]; then
|
|
||||||
rm $file
|
|
||||||
fi
|
|
||||||
}
|
|
|
@ -34,29 +34,25 @@ track_fs() {
|
||||||
mount "$@" && FS_ACTIVE_MOUNTS=("$5" "${FS_ACTIVE_MOUNTS[@]}")
|
mount "$@" && FS_ACTIVE_MOUNTS=("$5" "${FS_ACTIVE_MOUNTS[@]}")
|
||||||
}
|
}
|
||||||
|
|
||||||
# $1: new branch
|
mount_fs(){
|
||||||
mount_fs_root(){
|
|
||||||
FS_ACTIVE_MOUNTS=()
|
FS_ACTIVE_MOUNTS=()
|
||||||
|
local lower= upper="$1" work="$2" pkglist="$3"
|
||||||
|
local fs=${upper##*/}
|
||||||
|
local rootfs="$work/rootfs" desktopfs="$work/desktopfs" livefs="$work/livefs"
|
||||||
mkdir -p "${mnt_dir}/work"
|
mkdir -p "${mnt_dir}/work"
|
||||||
track_fs -t overlay overlay -olowerdir="${work_dir}/rootfs",upperdir="$1",workdir="${mnt_dir}/work" "$1"
|
mkdir -p "$upper"
|
||||||
}
|
case $fs in
|
||||||
|
desktopfs) lower="$rootfs" ;;
|
||||||
mount_fs_desktop(){
|
livefs|mhwdfs)
|
||||||
FS_ACTIVE_MOUNTS=()
|
lower="$rootfs"
|
||||||
mkdir -p "${mnt_dir}/work"
|
[[ -f $pkglist ]] && lower="$desktopfs":"$rootfs"
|
||||||
track_fs -t overlay overlay -olowerdir="${work_dir}/desktopfs":"${work_dir}/rootfs",upperdir="$1",workdir="${mnt_dir}/work" "$1"
|
;;
|
||||||
}
|
bootfs)
|
||||||
|
lower="$livefs":"$rootfs"
|
||||||
mount_fs_live(){
|
[[ -f $pkglist ]] && lower="$livefs":"$desktopfs":"$rootfs"
|
||||||
FS_ACTIVE_MOUNTS=()
|
;;
|
||||||
mkdir -p "${mnt_dir}/work"
|
esac
|
||||||
track_fs -t overlay overlay -olowerdir="${work_dir}/livefs":"${work_dir}/desktopfs":"${work_dir}/rootfs",upperdir="$1",workdir="${mnt_dir}/work" "$1"
|
track_fs -t overlay overlay -olowerdir="$lower",upperdir="$upper",workdir="${mnt_dir}/work" "$upper"
|
||||||
}
|
|
||||||
|
|
||||||
mount_fs_net(){
|
|
||||||
FS_ACTIVE_MOUNTS=()
|
|
||||||
mkdir -p "${mnt_dir}/work"
|
|
||||||
track_fs -t overlay overlay -olowerdir="${work_dir}/livefs":"${work_dir}/rootfs",upperdir="$1",workdir="${mnt_dir}/work" "$1"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
umount_fs(){
|
umount_fs(){
|
||||||
|
|
359
lib/util-iso.sh
359
lib/util-iso.sh
|
@ -9,17 +9,21 @@
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
import ${LIBDIR}/util-iso-image.sh
|
import ${LIBDIR}/util-chroot.sh
|
||||||
import ${LIBDIR}/util-iso-boot.sh
|
import ${LIBDIR}/util-iso-chroot.sh
|
||||||
|
import ${LIBDIR}/util-iso-grub.sh
|
||||||
import ${LIBDIR}/util-yaml.sh
|
import ${LIBDIR}/util-yaml.sh
|
||||||
|
import ${LIBDIR}/util-iso-mount.sh
|
||||||
|
import ${LIBDIR}/util-profile.sh
|
||||||
|
|
||||||
error_function() {
|
error_function() {
|
||||||
if [[ -p $logpipe ]]; then
|
if [[ -p $logpipe ]]; then
|
||||||
rm "$logpipe"
|
rm "$logpipe"
|
||||||
fi
|
fi
|
||||||
|
local func="$1"
|
||||||
# first exit all subshells, then print the error
|
# first exit all subshells, then print the error
|
||||||
if (( ! BASH_SUBSHELL )); then
|
if (( ! BASH_SUBSHELL )); then
|
||||||
error "A failure occurred in %s()." "$1"
|
error "A failure occurred in %s()." "$func"
|
||||||
plain "Aborting..."
|
plain "Aborting..."
|
||||||
fi
|
fi
|
||||||
umount_fs
|
umount_fs
|
||||||
|
@ -68,20 +72,32 @@ trap_exit() {
|
||||||
kill "-$sig" "$$"
|
kill "-$sig" "$$"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
configure_live_image(){
|
||||||
|
local fs="$1"
|
||||||
|
msg "Configuring [livefs]"
|
||||||
|
configure_hosts "$fs"
|
||||||
|
configure_system "$fs"
|
||||||
|
configure_services "$fs"
|
||||||
|
configure_calamares "$fs"
|
||||||
|
write_live_session_conf "$fs"
|
||||||
|
msg "Done configuring [livefs]"
|
||||||
|
}
|
||||||
|
|
||||||
make_sig () {
|
make_sig () {
|
||||||
|
local idir="$1" file="$2"
|
||||||
msg2 "Creating signature file..."
|
msg2 "Creating signature file..."
|
||||||
cd "$1"
|
cd "$idir"
|
||||||
user_own "$1"
|
user_own "$idir"
|
||||||
su ${OWNER} -c "gpg --detach-sign --default-key ${gpgkey} $2.sfs"
|
su ${OWNER} -c "gpg --detach-sign --default-key ${gpgkey} $file.sfs"
|
||||||
chown -R root "$1"
|
chown -R root "$idir"
|
||||||
cd ${OLDPWD}
|
cd ${OLDPWD}
|
||||||
}
|
}
|
||||||
|
|
||||||
# $1: file
|
|
||||||
make_checksum(){
|
make_checksum(){
|
||||||
|
local idir="$1" file="$2"
|
||||||
msg2 "Creating md5sum ..."
|
msg2 "Creating md5sum ..."
|
||||||
cd $1
|
cd $idir
|
||||||
md5sum $2.sfs > $2.md5
|
md5sum $file.sfs > $file.md5
|
||||||
cd ${OLDPWD}
|
cd ${OLDPWD}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,7 +108,7 @@ make_sfs() {
|
||||||
error "The path %s does not exist" "${src}"
|
error "The path %s does not exist" "${src}"
|
||||||
retrun 1
|
retrun 1
|
||||||
fi
|
fi
|
||||||
local timer=$(get_timer) dest=${iso_root}/${iso_name}/${target_arch}
|
local timer=$(get_timer) dest=${iso_root}/${os_id}/${target_arch}
|
||||||
local name=${1##*/}
|
local name=${1##*/}
|
||||||
local sfs="${dest}/${name}.sfs"
|
local sfs="${dest}/${name}.sfs"
|
||||||
mkdir -p ${dest}
|
mkdir -p ${dest}
|
||||||
|
@ -161,55 +177,33 @@ make_sfs() {
|
||||||
|
|
||||||
assemble_iso(){
|
assemble_iso(){
|
||||||
msg "Creating ISO image..."
|
msg "Creating ISO image..."
|
||||||
local iso_publisher iso_app_id
|
local mod_date=$(date -u +%Y-%m-%d-%H-%M-%S-00 | sed -e s/-//g)
|
||||||
|
|
||||||
iso_publisher="$(get_osname) <$(get_disturl)>"
|
|
||||||
|
|
||||||
iso_app_id="$(get_osname) Live/Rescue CD"
|
|
||||||
|
|
||||||
# xorriso -as mkisofs \
|
|
||||||
# --protective-msdos-label \
|
|
||||||
# -volid "${iso_label}" \
|
|
||||||
# -appid "${iso_app_id}" \
|
|
||||||
# -publisher "${iso_publisher}" \
|
|
||||||
# -preparer "Prepared by manjaro-tools/${0##*/}" \
|
|
||||||
# -e /efi.img \
|
|
||||||
# -b boot/grub/i386-pc/eltorito.img \
|
|
||||||
# -c boot.catalog \
|
|
||||||
# -no-emul-boot \
|
|
||||||
# -boot-load-size 4 \
|
|
||||||
# -boot-info-table \
|
|
||||||
# -graft-points \
|
|
||||||
# --grub2-boot-info \
|
|
||||||
# --grub2-mbr ${iso_root}/boot/grub/i386-pc/boot_hybrid.img \
|
|
||||||
# --sort-weight 0 / --sort-weight 1 /boot \
|
|
||||||
# -isohybrid-gpt-basdat \
|
|
||||||
# -eltorito-alt-boot \
|
|
||||||
# -output "${iso_dir}/${iso_file}" \
|
|
||||||
# "${iso_root}/"
|
|
||||||
|
|
||||||
xorriso -as mkisofs \
|
xorriso -as mkisofs \
|
||||||
--protective-msdos-label \
|
--modification-date=${mod_date} \
|
||||||
-volid "${iso_label}" \
|
--protective-msdos-label \
|
||||||
-appid "${iso_app_id}" \
|
-volid "${iso_label}" \
|
||||||
-publisher "${iso_publisher}" \
|
-appid "$(get_osname) Live/Rescue CD" \
|
||||||
-preparer "Prepared by manjaro-tools/${0##*/}" \
|
-publisher "$(get_osname) <$(get_disturl)>" \
|
||||||
-b boot/grub/i386-pc/eltorito.img \
|
-preparer "Prepared by manjaro-tools/${0##*/}" \
|
||||||
-c boot.catalog \
|
-r -graft-points -no-pad \
|
||||||
-no-emul-boot \
|
--sort-weight 0 / \
|
||||||
-boot-load-size 4 \
|
--sort-weight 1 /boot \
|
||||||
-boot-info-table \
|
--grub2-mbr ${iso_root}/boot/grub/i386-pc/boot_hybrid.img \
|
||||||
-graft-points \
|
-partition_offset 16 \
|
||||||
--grub2-boot-info \
|
-b boot/grub/i386-pc/eltorito.img \
|
||||||
--grub2-mbr ${iso_root}/boot/grub/i386-pc/boot_hybrid.img \
|
-c boot.catalog \
|
||||||
--sort-weight 0 / --sort-weight 1 /boot \
|
-no-emul-boot -boot-load-size 4 -boot-info-table --grub2-boot-info \
|
||||||
-eltorito-alt-boot \
|
-eltorito-alt-boot \
|
||||||
-efi-boot-part --efi-boot-image \
|
-append_partition 2 0xef ${iso_root}/efi.img \
|
||||||
-e efi.img \
|
-e --interval:appended_partition_2:all:: \
|
||||||
-no-emul-boot \
|
-no-emul-boot \
|
||||||
-isohybrid-gpt-basdat \
|
-iso-level 3 \
|
||||||
-output "${iso_dir}/${iso_file}" \
|
-o ${iso_dir}/${iso_file} \
|
||||||
"${iso_root}/"
|
${iso_root}/
|
||||||
|
|
||||||
|
# arg to add with xorriso-1.4.7
|
||||||
|
# -iso_mbr_part_type 0x00
|
||||||
}
|
}
|
||||||
|
|
||||||
# Build ISO
|
# Build ISO
|
||||||
|
@ -235,7 +229,7 @@ make_iso() {
|
||||||
|
|
||||||
gen_iso_fn(){
|
gen_iso_fn(){
|
||||||
local vars=() name
|
local vars=() name
|
||||||
vars+=("${iso_name}")
|
vars+=("${os_id}")
|
||||||
if ! ${chrootcfg};then
|
if ! ${chrootcfg};then
|
||||||
[[ -n ${profile} ]] && vars+=("${profile}")
|
[[ -n ${profile} ]] && vars+=("${profile}")
|
||||||
fi
|
fi
|
||||||
|
@ -249,155 +243,136 @@ gen_iso_fn(){
|
||||||
echo $name
|
echo $name
|
||||||
}
|
}
|
||||||
|
|
||||||
reset_pac_conf(){
|
copy_overlay(){
|
||||||
info "Restoring [%s/etc/pacman.conf] ..." "$1"
|
local src="$1" dest="$2"
|
||||||
sed -e 's|^.*HoldPkg.*|HoldPkg = pacman glibc manjaro-system|' \
|
if [[ -e "$src" ]];then
|
||||||
-e "s|^.*#CheckSpace|CheckSpace|" \
|
msg2 "Copying [%s] ..." "${src##*/}"
|
||||||
-i "$1/etc/pacman.conf"
|
cp -LR "$src"/* "$dest"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Base installation (rootfs)
|
# Base installation (rootfs)
|
||||||
make_image_root() {
|
make_image_root() {
|
||||||
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
|
if [[ ! -e ${work_dir}/rootfs.lock ]]; then
|
||||||
msg "Prepare [Base installation] (rootfs)"
|
msg "Prepare [Base installation] (rootfs)"
|
||||||
local path="${work_dir}/rootfs"
|
local rootfs="${work_dir}/rootfs"
|
||||||
mkdir -p ${path}
|
|
||||||
|
|
||||||
chroot_create "${path}" "${packages}" || die
|
prepare_dir "${rootfs}"
|
||||||
|
|
||||||
pacman -Qr "${path}" > "${path}/rootfs-pkgs.txt"
|
create_chroot "${mkchroot_args[@]}" "${rootfs}" "${packages[@]}"
|
||||||
copy_overlay "${profile_dir}/root-overlay" "${path}"
|
|
||||||
|
|
||||||
reset_pac_conf "${path}"
|
copy_overlay "${root_overlay}" "${rootfs}"
|
||||||
|
|
||||||
configure_lsb "${path}"
|
configure_lsb "${rootfs}"
|
||||||
|
|
||||||
|
clean_up_image "${rootfs}"
|
||||||
|
|
||||||
clean_up_image "${path}"
|
|
||||||
: > ${work_dir}/build.${FUNCNAME}
|
|
||||||
msg "Done [Base installation] (rootfs)"
|
msg "Done [Base installation] (rootfs)"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
make_image_desktop() {
|
make_image_desktop() {
|
||||||
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
|
if [[ ! -e ${work_dir}/desktopfs.lock ]]; then
|
||||||
msg "Prepare [Desktop installation] (desktopfs)"
|
msg "Prepare [Desktop installation] (desktopfs)"
|
||||||
local path="${work_dir}/desktopfs"
|
local desktopfs="${work_dir}/desktopfs"
|
||||||
mkdir -p ${path}
|
|
||||||
|
|
||||||
mount_fs_root "${path}"
|
prepare_dir "${desktopfs}"
|
||||||
|
|
||||||
chroot_create "${path}" "${packages}"
|
mount_fs "${desktopfs}" "${work_dir}"
|
||||||
|
|
||||||
pacman -Qr "${path}" > "${path}/desktopfs-pkgs.txt"
|
create_chroot "${mkchroot_args[@]}" "${desktopfs}" "${packages[@]}"
|
||||||
cp "${path}/desktopfs-pkgs.txt" ${iso_dir}/$(gen_iso_fn)-pkgs.txt
|
|
||||||
[[ -e ${profile_dir}/desktop-overlay ]] && copy_overlay "${profile_dir}/desktop-overlay" "${path}"
|
|
||||||
|
|
||||||
reset_pac_conf "${path}"
|
copy_overlay "${desktop_overlay}" "${desktopfs}"
|
||||||
|
|
||||||
umount_fs
|
umount_fs
|
||||||
clean_up_image "${path}"
|
clean_up_image "${desktopfs}"
|
||||||
: > ${work_dir}/build.${FUNCNAME}
|
|
||||||
msg "Done [Desktop installation] (desktopfs)"
|
msg "Done [Desktop installation] (desktopfs)"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
mount_fs_select(){
|
|
||||||
if [[ -f "${packages_desktop}" ]]; then
|
|
||||||
mount_fs_desktop "$1"
|
|
||||||
else
|
|
||||||
mount_fs_root "$1"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
make_image_live() {
|
make_image_live() {
|
||||||
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
|
if [[ ! -e ${work_dir}/livefs.lock ]]; then
|
||||||
msg "Prepare [Live installation] (livefs)"
|
msg "Prepare [Live installation] (livefs)"
|
||||||
local path="${work_dir}/livefs"
|
local livefs="${work_dir}/livefs"
|
||||||
mkdir -p ${path}
|
|
||||||
|
|
||||||
mount_fs_select "${path}"
|
prepare_dir "${livefs}"
|
||||||
|
|
||||||
chroot_create "${path}" "${packages}"
|
mount_fs "${livefs}" "${work_dir}" "${desktop_list}"
|
||||||
|
|
||||||
pacman -Qr "${path}" > "${path}/livefs-pkgs.txt"
|
create_chroot "${mkchroot_args[@]}" "${livefs}" "${packages[@]}"
|
||||||
copy_overlay "${profile_dir}/live-overlay" "${path}"
|
|
||||||
configure_live_image "${path}"
|
|
||||||
|
|
||||||
reset_pac_conf "${path}"
|
copy_overlay "${live_overlay}" "${livefs}"
|
||||||
|
|
||||||
|
configure_live_image "${livefs}"
|
||||||
|
|
||||||
|
pacman -Qr "${livefs}" > ${iso_dir}/$(gen_iso_fn)-pkgs.txt
|
||||||
|
|
||||||
umount_fs
|
umount_fs
|
||||||
|
|
||||||
# Clean up GnuPG keys
|
clean_up_image "${livefs}"
|
||||||
rm -rf "${path}/etc/pacman.d/gnupg"
|
|
||||||
clean_up_image "${path}"
|
|
||||||
: > ${work_dir}/build.${FUNCNAME}
|
|
||||||
msg "Done [Live installation] (livefs)"
|
msg "Done [Live installation] (livefs)"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
make_image_mhwd() {
|
make_image_mhwd() {
|
||||||
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
|
if [[ ! -e ${work_dir}/mhwdfs.lock ]]; then
|
||||||
msg "Prepare [drivers repository] (mhwdfs)"
|
msg "Prepare [drivers repository] (mhwdfs)"
|
||||||
local path="${work_dir}/mhwdfs"
|
local mhwdfs="${work_dir}/mhwdfs" repo="/opt/pkg"
|
||||||
mkdir -p ${path}${mhwd_repo}
|
|
||||||
|
|
||||||
mount_fs_select "${path}"
|
prepare_dir "${mhwdfs}${repo}"
|
||||||
|
|
||||||
reset_pac_conf "${path}"
|
mount_fs "${mhwdfs}" "${work_dir}" "${desktop_list}"
|
||||||
|
|
||||||
copy_from_cache "${path}" "${packages}"
|
copy_from_cache "${mhwdfs}" "${repo}" "${packages[@]}"
|
||||||
|
|
||||||
if [[ -n "${packages_cleanup}" ]]; then
|
if [[ -n "${packages_cleanup[@]}" ]]; then
|
||||||
for mhwd_clean in ${packages_cleanup}; do
|
for pkg in ${packages_cleanup[@]}; do
|
||||||
rm ${path}${mhwd_repo}/${mhwd_clean}
|
rm ${mhwdfs}${repo}/${pkg}
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
cp ${DATADIR}/pacman-mhwd.conf ${path}/opt
|
|
||||||
make_repo "${path}"
|
make_repo "${mhwdfs}" "${repo}"
|
||||||
configure_mhwd_drivers "${path}"
|
configure_mhwd_drivers "${mhwdfs}" "${repo}"
|
||||||
|
|
||||||
umount_fs
|
umount_fs
|
||||||
clean_up_image "${path}"
|
clean_up_image "${mhwdfs}"
|
||||||
: > ${work_dir}/build.${FUNCNAME}
|
: > ${work_dir}/mhwdfs.lock
|
||||||
msg "Done [drivers repository] (mhwdfs)"
|
msg "Done [drivers repository] (mhwdfs)"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
make_image_boot() {
|
make_image_boot() {
|
||||||
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
|
if [[ ! -e ${work_dir}/bootfs.lock ]]; then
|
||||||
msg "Prepare [/iso/boot]"
|
msg "Prepare [/iso/boot]"
|
||||||
local boot="${iso_root}/boot"
|
local boot="${iso_root}/boot"
|
||||||
|
|
||||||
mkdir -p ${boot}
|
prepare_dir "${boot}"
|
||||||
|
|
||||||
cp ${work_dir}/rootfs/boot/vmlinuz* ${boot}/vmlinuz-${target_arch}
|
cp ${work_dir}/rootfs/boot/vmlinuz* ${boot}/vmlinuz-${target_arch}
|
||||||
|
|
||||||
local path="${work_dir}/bootfs"
|
local bootfs="${work_dir}/bootfs"
|
||||||
mkdir -p ${path}
|
|
||||||
|
|
||||||
if [[ -f "${packages_desktop}" ]]; then
|
mount_fs "${bootfs}" "${work_dir}" "${desktop_list}"
|
||||||
mount_fs_live "${path}"
|
|
||||||
else
|
|
||||||
mount_fs_net "${path}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
prepare_initcpio "${path}"
|
prepare_initcpio "${bootfs}"
|
||||||
prepare_initramfs "${path}"
|
prepare_initramfs "${bootfs}"
|
||||||
|
|
||||||
cp ${path}/boot/initramfs.img ${boot}/initramfs-${target_arch}.img
|
cp ${bootfs}/boot/initramfs.img ${boot}/initramfs-${target_arch}.img
|
||||||
prepare_boot_extras "${path}" "${boot}"
|
prepare_boot_extras "${bootfs}" "${boot}"
|
||||||
|
|
||||||
umount_fs
|
umount_fs
|
||||||
|
|
||||||
rm -R ${path}
|
rm -R ${bootfs}
|
||||||
: > ${work_dir}/build.${FUNCNAME}
|
: > ${work_dir}/bootfs.lock
|
||||||
msg "Done [/iso/boot]"
|
msg "Done [/iso/boot]"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
configure_grub(){
|
configure_grub(){
|
||||||
local default_args="misobasedir=${iso_name} misolabel=${iso_label}" \
|
local conf="$1"
|
||||||
boot_args=('quiet')
|
local default_args="misobasedir=${os_id} misolabel=${iso_label}" boot_args=('quiet')
|
||||||
[[ ${initsys} == 'systemd' ]] && boot_args+=('systemd.show_status=1')
|
[[ ${initsys} == 'systemd' ]] && boot_args+=('systemd.show_status=1')
|
||||||
|
|
||||||
sed -e "s|@DIST_NAME@|${dist_name}|g" \
|
sed -e "s|@DIST_NAME@|${dist_name}|g" \
|
||||||
|
@ -405,42 +380,46 @@ configure_grub(){
|
||||||
-e "s|@DEFAULT_ARGS@|${default_args}|g" \
|
-e "s|@DEFAULT_ARGS@|${default_args}|g" \
|
||||||
-e "s|@BOOT_ARGS@|${boot_args[*]}|g" \
|
-e "s|@BOOT_ARGS@|${boot_args[*]}|g" \
|
||||||
-e "s|@PROFILE@|${profile}|g" \
|
-e "s|@PROFILE@|${profile}|g" \
|
||||||
-i $1
|
-i $conf
|
||||||
|
}
|
||||||
|
|
||||||
|
configure_grub_theme(){
|
||||||
|
local conf="$1"
|
||||||
|
sed -e "s|@ISO_NAME@|${os_id}|" -i "$conf"
|
||||||
}
|
}
|
||||||
|
|
||||||
make_grub(){
|
make_grub(){
|
||||||
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
|
if [[ ! -e ${work_dir}/grub.lock ]]; then
|
||||||
msg "Prepare [/iso/boot/grub]"
|
msg "Prepare [/iso/boot/grub]"
|
||||||
|
|
||||||
local path="${work_dir}/rootfs"
|
prepare_grub "${work_dir}/rootfs" "${work_dir}/livefs" "${iso_root}"
|
||||||
|
|
||||||
prepare_grub "${path}" "${iso_root}"
|
|
||||||
|
|
||||||
configure_grub "${iso_root}/boot/grub/kernels.cfg"
|
configure_grub "${iso_root}/boot/grub/kernels.cfg"
|
||||||
|
configure_grub_theme "${iso_root}/boot/grub/variable.cfg"
|
||||||
|
|
||||||
: > ${work_dir}/build.${FUNCNAME}
|
: > ${work_dir}/grub.lock
|
||||||
msg "Done [/iso/boot/grub]"
|
msg "Done [/iso/boot/grub]"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
check_requirements(){
|
check_requirements(){
|
||||||
[[ -f ${run_dir}/repo_info ]] || die "%s is not a valid iso profiles directory!" "${run_dir}"
|
prepare_dir "${log_dir}"
|
||||||
if ! $(is_valid_arch_iso ${target_arch});then
|
|
||||||
die "%s is not a valid arch!" "${target_arch}"
|
|
||||||
fi
|
|
||||||
if ! $(is_valid_branch ${target_branch});then
|
|
||||||
die "%s is not a valid branch!" "${target_branch}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! is_valid_init "${initsys}";then
|
eval_build_list "${list_dir_iso}" "${build_list_iso}"
|
||||||
die "%s is not a valid init system!" "${initsys}"
|
|
||||||
fi
|
[[ -f ${run_dir}/repo_info ]] || die "%s is not a valid iso profiles directory!" "${run_dir}"
|
||||||
|
|
||||||
local iso_kernel=${kernel:5:1} host_kernel=$(uname -r)
|
local iso_kernel=${kernel:5:1} host_kernel=$(uname -r)
|
||||||
if [[ ${iso_kernel} < "4" ]] \
|
if [[ ${iso_kernel} < "4" ]] \
|
||||||
|| [[ ${host_kernel%%*.} < "4" ]];then
|
|| [[ ${host_kernel%%*.} < "4" ]];then
|
||||||
die "The host and iso kernels must be version>=4.0!"
|
die "The host and iso kernels must be version>=4.0!"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
for sig in TERM HUP QUIT; do
|
||||||
|
trap "trap_exit $sig \"$(gettext "%s signal caught. Exiting...")\" \"$sig\"" "$sig"
|
||||||
|
done
|
||||||
|
trap 'trap_exit INT "$(gettext "Aborted by user! Exiting...")"' INT
|
||||||
|
trap 'trap_exit USR1 "$(gettext "An unknown error has occurred. Exiting...")"' ERR
|
||||||
}
|
}
|
||||||
|
|
||||||
compress_images(){
|
compress_images(){
|
||||||
|
@ -452,18 +431,18 @@ compress_images(){
|
||||||
|
|
||||||
prepare_images(){
|
prepare_images(){
|
||||||
local timer=$(get_timer)
|
local timer=$(get_timer)
|
||||||
load_pkgs "${profile_dir}/Packages-Root"
|
load_pkgs "${root_list}" "${target_arch}" "${edition}" "${initsys}" "${kernel}"
|
||||||
run_safe "make_image_root"
|
run_safe "make_image_root"
|
||||||
if [[ -f "${packages_desktop}" ]] ; then
|
if [[ -f "${desktop_list}" ]] ; then
|
||||||
load_pkgs "${packages_desktop}"
|
load_pkgs "${desktop_list}" "${target_arch}" "${edition}" "${initsys}" "${kernel}"
|
||||||
run_safe "make_image_desktop"
|
run_safe "make_image_desktop"
|
||||||
fi
|
fi
|
||||||
if [[ -f ${profile_dir}/Packages-Live ]]; then
|
if [[ -f ${live_list} ]]; then
|
||||||
load_pkgs "${profile_dir}/Packages-Live"
|
load_pkgs "${live_list}" "${target_arch}" "${edition}" "${initsys}" "${kernel}"
|
||||||
run_safe "make_image_live"
|
run_safe "make_image_live"
|
||||||
fi
|
fi
|
||||||
if [[ -f ${packages_mhwd} ]] ; then
|
if ! ${netinstall} ; then
|
||||||
load_pkgs "${packages_mhwd}"
|
load_pkgs "${mhwd_list}" "${target_arch}" "${edition}" "${initsys}" "${kernel}"
|
||||||
run_safe "make_image_mhwd"
|
run_safe "make_image_mhwd"
|
||||||
fi
|
fi
|
||||||
run_safe "make_image_boot"
|
run_safe "make_image_boot"
|
||||||
|
@ -486,11 +465,10 @@ make_profile(){
|
||||||
if ${clean_first};then
|
if ${clean_first};then
|
||||||
chroot_clean "${chroots_iso}/${profile}/${target_arch}"
|
chroot_clean "${chroots_iso}/${profile}/${target_arch}"
|
||||||
|
|
||||||
local unused_arch=''
|
local unused_arch='i686'
|
||||||
case ${target_arch} in
|
if [[ ${target_arch} == 'i686' ]];then
|
||||||
i686) unused_arch='x86_64' ;;
|
unused_arch='x86_64'
|
||||||
x86_64) unused_arch='i686' ;;
|
fi
|
||||||
esac
|
|
||||||
if [[ -d "${chroots_iso}/${profile}/${unused_arch}" ]];then
|
if [[ -d "${chroots_iso}/${profile}/${unused_arch}" ]];then
|
||||||
chroot_clean "${chroots_iso}/${profile}/${unused_arch}"
|
chroot_clean "${chroots_iso}/${profile}/${unused_arch}"
|
||||||
fi
|
fi
|
||||||
|
@ -518,55 +496,8 @@ make_profile(){
|
||||||
show_elapsed_time "${FUNCNAME}" "${timer_start}"
|
show_elapsed_time "${FUNCNAME}" "${timer_start}"
|
||||||
}
|
}
|
||||||
|
|
||||||
get_pacman_conf(){
|
|
||||||
local user_conf=${profile_dir}/user-repos.conf pac_arch='default' conf
|
|
||||||
[[ "${target_arch}" == 'x86_64' ]] && pac_arch='multilib'
|
|
||||||
if [[ -f ${user_conf} ]];then
|
|
||||||
info "detected: %s" "user-repos.conf"
|
|
||||||
check_user_repos_conf "${user_conf}"
|
|
||||||
conf=${tmp_dir}/custom-pacman.conf
|
|
||||||
cat ${DATADIR}/pacman-$pac_arch.conf ${user_conf} > "$conf"
|
|
||||||
else
|
|
||||||
conf="${DATADIR}/pacman-$pac_arch.conf"
|
|
||||||
fi
|
|
||||||
echo "$conf"
|
|
||||||
}
|
|
||||||
|
|
||||||
load_profile(){
|
|
||||||
conf="$1/profile.conf"
|
|
||||||
|
|
||||||
info "Profile: [%s]" "${profile}"
|
|
||||||
|
|
||||||
load_profile_config "$conf"
|
|
||||||
|
|
||||||
pacman_conf=$(get_pacman_conf)
|
|
||||||
|
|
||||||
mirrors_conf=$(get_pac_mirrors_conf "${target_branch}")
|
|
||||||
|
|
||||||
iso_file=$(gen_iso_fn).iso
|
|
||||||
|
|
||||||
mkchroot_args+=(-C ${pacman_conf} -S ${mirrors_conf} -B "${build_mirror}/${target_branch}" -K)
|
|
||||||
work_dir=${chroots_iso}/${profile}/${target_arch}
|
|
||||||
|
|
||||||
iso_dir="${cache_dir_iso}/${edition}/${profile}/${dist_release}"
|
|
||||||
|
|
||||||
iso_root=${chroots_iso}/${profile}/iso
|
|
||||||
mnt_dir=${chroots_iso}/${profile}/mnt
|
|
||||||
prepare_dir "${mnt_dir}"
|
|
||||||
|
|
||||||
prepare_dir "${iso_dir}"
|
|
||||||
user_own "${iso_dir}"
|
|
||||||
}
|
|
||||||
|
|
||||||
prepare_profile(){
|
|
||||||
profile=$1
|
|
||||||
edition=$(get_edition ${profile})
|
|
||||||
profile_dir=${run_dir}/${edition}/${profile}
|
|
||||||
check_profile "${profile_dir}"
|
|
||||||
load_profile "${profile_dir}"
|
|
||||||
}
|
|
||||||
|
|
||||||
build(){
|
build(){
|
||||||
prepare_profile "$1"
|
local prof="$1"
|
||||||
|
prepare_build "$prof"
|
||||||
make_profile
|
make_profile
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,11 +11,9 @@
|
||||||
export LC_MESSAGES=C
|
export LC_MESSAGES=C
|
||||||
export LANG=C
|
export LANG=C
|
||||||
|
|
||||||
disable_colors(){
|
declare ALL_OFF='' BOLD='' BLUE='' GREEN='' RED='' YELLOW=''
|
||||||
unset ALL_OFF BOLD BLUE GREEN RED YELLOW
|
|
||||||
}
|
|
||||||
|
|
||||||
enable_colors(){
|
if [[ -t 2 ]]; then
|
||||||
# prefer terminal safe colored and bold text when tput is supported
|
# prefer terminal safe colored and bold text when tput is supported
|
||||||
if tput setaf 0 &>/dev/null; then
|
if tput setaf 0 &>/dev/null; then
|
||||||
ALL_OFF="$(tput sgr0)"
|
ALL_OFF="$(tput sgr0)"
|
||||||
|
@ -32,14 +30,8 @@ enable_colors(){
|
||||||
YELLOW="${BOLD}\e[33m"
|
YELLOW="${BOLD}\e[33m"
|
||||||
BLUE="${BOLD}\e[34m"
|
BLUE="${BOLD}\e[34m"
|
||||||
fi
|
fi
|
||||||
readonly ALL_OFF BOLD BLUE GREEN RED YELLOW
|
|
||||||
}
|
|
||||||
|
|
||||||
if [[ -t 2 ]]; then
|
|
||||||
enable_colors
|
|
||||||
else
|
|
||||||
disable_colors
|
|
||||||
fi
|
fi
|
||||||
|
readonly ALL_OFF BOLD BLUE GREEN RED YELLOW
|
||||||
|
|
||||||
plain() {
|
plain() {
|
||||||
local mesg=$1; shift
|
local mesg=$1; shift
|
||||||
|
@ -73,13 +65,42 @@ error() {
|
||||||
|
|
||||||
stat_busy() {
|
stat_busy() {
|
||||||
local mesg=$1; shift
|
local mesg=$1; shift
|
||||||
printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}...${ALL_OFF}" >&2
|
printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}...${ALL_OFF}" "$@" >&2
|
||||||
}
|
}
|
||||||
|
|
||||||
stat_done() {
|
stat_done() {
|
||||||
printf "${BOLD}done${ALL_OFF}\n" >&2
|
printf "${BOLD}done${ALL_OFF}\n" >&2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lock_close() {
|
||||||
|
local fd=$1
|
||||||
|
exec {fd}>&-
|
||||||
|
}
|
||||||
|
|
||||||
|
lock() {
|
||||||
|
if ! [[ "/dev/fd/$1" -ef "$2" ]]; then
|
||||||
|
mkdir -p -- "$(dirname -- "$2")"
|
||||||
|
eval "exec $1>"'"$2"'
|
||||||
|
fi
|
||||||
|
if ! flock -n $1; then
|
||||||
|
stat_busy "$3"
|
||||||
|
flock $1
|
||||||
|
stat_done
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
slock() {
|
||||||
|
if ! [[ "/dev/fd/$1" -ef "$2" ]]; then
|
||||||
|
mkdir -p -- "$(dirname -- "$2")"
|
||||||
|
eval "exec $1>"'"$2"'
|
||||||
|
fi
|
||||||
|
if ! flock -sn $1; then
|
||||||
|
stat_busy "$3"
|
||||||
|
flock -s $1
|
||||||
|
stat_done
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
cleanup() {
|
cleanup() {
|
||||||
exit ${1:-0}
|
exit ${1:-0}
|
||||||
}
|
}
|
||||||
|
@ -95,9 +116,9 @@ die() {
|
||||||
}
|
}
|
||||||
|
|
||||||
import(){
|
import(){
|
||||||
if [[ -r $1 ]];then
|
if [[ -r "$1" ]];then
|
||||||
source $1
|
source "$1"
|
||||||
else
|
else
|
||||||
die "Could not import $1"
|
die 'Could not import %s' "$1"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,23 +10,25 @@
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
load_compiler_settings(){
|
load_compiler_settings(){
|
||||||
local tarch="$1" conf
|
local arch="$1" conf
|
||||||
conf=${make_conf_dir}/$tarch.conf
|
conf=${make_conf_dir}/$arch.conf
|
||||||
|
|
||||||
[[ -f $conf ]] || return 1
|
[[ -f $conf ]] || return 1
|
||||||
|
|
||||||
info "Loading compiler settings: %s" "$tarch"
|
info "Loading compiler settings: %s" "$arch"
|
||||||
source $conf
|
source $conf
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
get_makepkg_conf(){
|
get_makepkg_conf(){
|
||||||
local conf="${tmp_dir}/makepkg-$1.conf"
|
|
||||||
|
local arch="$1"
|
||||||
|
local conf="${tmp_dir}/makepkg-${arch}.conf"
|
||||||
|
|
||||||
cp "${DATADIR}/makepkg.conf" "$conf"
|
cp "${DATADIR}/makepkg.conf" "$conf"
|
||||||
|
|
||||||
load_compiler_settings "$1"
|
load_compiler_settings "${arch}"
|
||||||
|
|
||||||
sed -i "$conf" \
|
sed -i "$conf" \
|
||||||
-e "s|@CARCH[@]|$carch|g" \
|
-e "s|@CARCH[@]|$carch|g" \
|
||||||
|
@ -36,111 +38,39 @@ get_makepkg_conf(){
|
||||||
echo "$conf"
|
echo "$conf"
|
||||||
}
|
}
|
||||||
|
|
||||||
# $1: target_arch
|
|
||||||
prepare_conf(){
|
|
||||||
if ! is_valid_arch_pkg "$1";then
|
|
||||||
die "%s is not a valid arch!" "$1"
|
|
||||||
fi
|
|
||||||
|
|
||||||
local pac_arch='default'
|
|
||||||
|
|
||||||
if [[ "$1" == 'multilib' ]];then
|
|
||||||
pac_arch='multilib'
|
|
||||||
is_multilib=true
|
|
||||||
fi
|
|
||||||
|
|
||||||
pacman_conf="${DATADIR}/pacman-$pac_arch.conf"
|
|
||||||
|
|
||||||
work_dir="${chroots_pkg}/${target_branch}/$1"
|
|
||||||
pkg_dir="${cache_dir_pkg}/${target_branch}/$1"
|
|
||||||
|
|
||||||
makepkg_conf=$(get_makepkg_conf "$1")
|
|
||||||
|
|
||||||
[[ "$pac_arch" == 'multilib' ]] && target_arch='x86_64'
|
|
||||||
}
|
|
||||||
|
|
||||||
check_build(){
|
check_build(){
|
||||||
find_pkg $1
|
local bdir="$1"
|
||||||
[[ ! -f $1/PKGBUILD ]] && die "Directory must contain a PKGBUILD!"
|
find_pkg "${bdir}"
|
||||||
|
[[ ! -f ${bdir}/PKGBUILD ]] && die "Directory must contain a PKGBUILD!"
|
||||||
}
|
}
|
||||||
|
|
||||||
find_pkg(){
|
find_pkg(){
|
||||||
local result=$(find . -type d -name "$1")
|
local bdir="$1"
|
||||||
[[ -z $result ]] && die "%s is not a valid package or build list!" "$1"
|
local result=$(find . -type d -name "${bdir}")
|
||||||
}
|
[[ -z $result ]] && die "%s is not a valid package or build list!" "${bdir}"
|
||||||
|
|
||||||
load_group(){
|
|
||||||
local _multi \
|
|
||||||
_space="s| ||g" \
|
|
||||||
_clean=':a;N;$!ba;s/\n/ /g' \
|
|
||||||
_com_rm="s|#.*||g" \
|
|
||||||
devel_group='' \
|
|
||||||
file=${DATADIR}/base-devel-udev
|
|
||||||
|
|
||||||
info "Loading custom group: %s" "$file"
|
|
||||||
|
|
||||||
if ${is_multilib}; then
|
|
||||||
_multi="s|>multilib||g"
|
|
||||||
else
|
|
||||||
_multi="s|>multilib.*||g"
|
|
||||||
fi
|
|
||||||
|
|
||||||
devel_group=$(sed "$_com_rm" "$file" \
|
|
||||||
| sed "$_space" \
|
|
||||||
| sed "$_multi" \
|
|
||||||
| sed "$_clean")
|
|
||||||
|
|
||||||
echo ${devel_group}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
init_base_devel(){
|
init_base_devel(){
|
||||||
if ${udev_root};then
|
if ${udev_root};then
|
||||||
base_packages=( "$(load_group)" )
|
local _multi _space="s| ||g" _clean=':a;N;$!ba;s/\n/ /g' _com_rm="s|#.*||g"
|
||||||
|
local file=${DATADIR}/base-devel-udev
|
||||||
|
|
||||||
|
# info "Loading custom group: %s" "$file"
|
||||||
|
_multi="s|>multilib.*||g"
|
||||||
|
${is_multilib} && _multi="s|>multilib||g"
|
||||||
|
|
||||||
|
packages=($(sed "$_com_rm" "$file" \
|
||||||
|
| sed "$_space" \
|
||||||
|
| sed "$_multi" \
|
||||||
|
| sed "$_clean"))
|
||||||
else
|
else
|
||||||
if ${is_multilib};then
|
packages=('base-devel')
|
||||||
base_packages=('base-devel' 'multilib-devel')
|
${is_multilib} && packages+=('multilib-devel')
|
||||||
else
|
|
||||||
base_packages=('base-devel')
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
chroot_create(){
|
|
||||||
msg "Creating chroot for [%s] (%s)..." "${target_branch}" "${target_arch}"
|
|
||||||
mkdir -p "${work_dir}"
|
|
||||||
mkchroot_args+=(-L)
|
|
||||||
setarch "${target_arch}" \
|
|
||||||
mkchroot ${mkchroot_args[*]} \
|
|
||||||
"${work_dir}/root" \
|
|
||||||
${base_packages[*]} || abort
|
|
||||||
}
|
|
||||||
|
|
||||||
chroot_clean(){
|
|
||||||
msg "Cleaning chroot for [%s] (%s)..." "${target_branch}" "${target_arch}"
|
|
||||||
for copy in "${work_dir}"/*; do
|
|
||||||
[[ -d ${copy} ]] || continue
|
|
||||||
msg2 "Deleting chroot copy %s ..." "$(basename "${copy}")"
|
|
||||||
|
|
||||||
lock 9 "${copy}.lock" "Locking chroot copy '${copy}'"
|
|
||||||
|
|
||||||
subvolume_delete_recursive "${copy}"
|
|
||||||
rm -rf --one-file-system "${copy}"
|
|
||||||
done
|
|
||||||
exec 9>&-
|
|
||||||
|
|
||||||
rm -rf --one-file-system "${work_dir}"
|
|
||||||
}
|
|
||||||
|
|
||||||
chroot_update(){
|
|
||||||
msg "Updating chroot for [%s] (%s)..." "${target_branch}" "${target_arch}"
|
|
||||||
chroot-run ${mkchroot_args[*]} \
|
|
||||||
"${work_dir}/${OWNER}" \
|
|
||||||
pacman -Syu --noconfirm || abort
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
clean_up(){
|
clean_up(){
|
||||||
msg "Cleaning up ..."
|
# msg "Cleaning up ..."
|
||||||
msg2 "Cleaning [%s]" "${pkg_dir}"
|
msg2 "Cleaning [%s]" "${pkg_dir}"
|
||||||
find ${pkg_dir} -maxdepth 1 -name "*.*" -delete #&> /dev/null
|
find ${pkg_dir} -maxdepth 1 -name "*.*" -delete #&> /dev/null
|
||||||
if [[ -z $SRCDEST ]];then
|
if [[ -z $SRCDEST ]];then
|
||||||
|
@ -150,35 +80,38 @@ clean_up(){
|
||||||
}
|
}
|
||||||
|
|
||||||
sign_pkg(){
|
sign_pkg(){
|
||||||
su ${OWNER} -c "signfile ${pkg_dir}/$1"
|
local pkg="$1"
|
||||||
|
su ${OWNER} -c "signfile ${pkg_dir}/${pkg}"
|
||||||
}
|
}
|
||||||
|
|
||||||
move_to_cache(){
|
move_to_cache(){
|
||||||
|
prepare_dir "${log_dir}"
|
||||||
|
|
||||||
local src="$1"
|
local src="$1"
|
||||||
[[ -n $PKGDEST ]] && src="$PKGDEST/$1"
|
[[ -n $PKGDEST ]] && src="$PKGDEST/$src"
|
||||||
[[ ! -f $src ]] && die
|
[[ ! -f $src ]] && die
|
||||||
msg2 "Moving [%s] -> [%s]" "${src##*/}" "${pkg_dir}"
|
msg2 "Moving [%s] -> [%s]" "${src##*/}" "${pkg_dir}"
|
||||||
mv $src ${pkg_dir}/
|
mv $src ${pkg_dir}/
|
||||||
${sign} && sign_pkg "${src##*/}"
|
${sign} && sign_pkg "${src##*/}"
|
||||||
[[ -n $PKGDEST ]] && rm "$1"
|
# [[ -n $PKGDEST ]] && rm "$src"
|
||||||
user_own "${pkg_dir}" "-R"
|
user_own "${pkg_dir}" "-R"
|
||||||
}
|
}
|
||||||
|
|
||||||
archive_logs(){
|
archive_logs(){
|
||||||
local archive name="$1" ext=log.tar.xz ver src=${tmp_dir}/archives.list target='.'
|
local archive name="$1" ext=log.tar.xz ver src=${tmp_dir}/archives.list dest='.'
|
||||||
ver=$(get_full_version "$name")
|
ver=$(get_full_version "$name")
|
||||||
archive="${name}-${ver}-${target_arch}"
|
archive="${name}-${ver}-${target_arch}"
|
||||||
if [[ -n $LOGDEST ]];then
|
if [[ -n $LOGDEST ]];then
|
||||||
target=$LOGDEST
|
dest=$LOGDEST
|
||||||
find $target -maxdepth 1 -name "$archive*.log" -printf "%f\n" > $src
|
find ${dest} -maxdepth 1 -name "$archive*.log" -printf "%f\n" > $src
|
||||||
else
|
else
|
||||||
find $target -maxdepth 1 -name "$archive*.log" > $src
|
find ${dest} -maxdepth 1 -name "$archive*.log" > $src
|
||||||
fi
|
fi
|
||||||
msg2 "Archiving log files [%s] ..." "$archive.$ext"
|
msg2 "Archiving log files [%s] ..." "$archive.$ext"
|
||||||
tar -cJf ${log_dir}/$archive.$ext -C "$target" -T $src
|
tar -cJf ${log_dir}/$archive.$ext -C "${dest}" -T $src
|
||||||
msg2 "Cleaning log files ..."
|
msg2 "Cleaning log files ..."
|
||||||
|
|
||||||
find $target -maxdepth 1 -name "$archive*.log" -delete
|
find ${dest} -maxdepth 1 -name "$archive*.log" -delete
|
||||||
}
|
}
|
||||||
|
|
||||||
post_build(){
|
post_build(){
|
||||||
|
@ -197,30 +130,23 @@ post_build(){
|
||||||
archive_logs "$name"
|
archive_logs "$name"
|
||||||
}
|
}
|
||||||
|
|
||||||
chroot_init(){
|
|
||||||
local timer=$(get_timer)
|
|
||||||
if ${clean_first} || [[ ! -d "${work_dir}" ]]; then
|
|
||||||
chroot_clean
|
|
||||||
chroot_create
|
|
||||||
else
|
|
||||||
chroot_update
|
|
||||||
fi
|
|
||||||
show_elapsed_time "${FUNCNAME}" "${timer}"
|
|
||||||
}
|
|
||||||
|
|
||||||
build_pkg(){
|
build_pkg(){
|
||||||
|
prepare_dir "${pkg_dir}"
|
||||||
|
user_own "${pkg_dir}"
|
||||||
|
${purge} && clean_up
|
||||||
setarch "${target_arch}" \
|
setarch "${target_arch}" \
|
||||||
mkchrootpkg ${mkchrootpkg_args[*]}
|
mkchrootpkg "${mkchrootpkg_args[@]}"
|
||||||
post_build
|
post_build
|
||||||
}
|
}
|
||||||
|
|
||||||
make_pkg(){
|
make_pkg(){
|
||||||
check_build "$1"
|
local pkg="$1"
|
||||||
msg "Start building [%s]" "$1"
|
check_build "${pkg}"
|
||||||
cd $1
|
msg "Start building [%s]" "${pkg}"
|
||||||
|
cd ${pkg}
|
||||||
build_pkg
|
build_pkg
|
||||||
cd ..
|
cd ..
|
||||||
msg "Finished building [%s]" "$1"
|
msg "Finished building [%s]" "${pkg}"
|
||||||
show_elapsed_time "${FUNCNAME}" "${timer_start}"
|
show_elapsed_time "${FUNCNAME}" "${timer_start}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,15 @@
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
|
in_array() {
|
||||||
|
local needle=$1; shift
|
||||||
|
local item
|
||||||
|
for item in "$@"; do
|
||||||
|
[[ $item = $needle ]] && return 0 # Found
|
||||||
|
done
|
||||||
|
return 1 # Not Found
|
||||||
|
}
|
||||||
|
|
||||||
# $1: sofile
|
# $1: sofile
|
||||||
# $2: soarch
|
# $2: soarch
|
||||||
process_sofile() {
|
process_sofile() {
|
||||||
|
|
277
lib/util-profile.sh
Normal file
277
lib/util-profile.sh
Normal file
|
@ -0,0 +1,277 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# 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; version 2 of the License.
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
write_repo_conf(){
|
||||||
|
local repos=$(find $USER_HOME -type f -name "repo_info")
|
||||||
|
local path name
|
||||||
|
[[ -z ${repos[@]} ]] && run_dir=${DATADIR}/iso-profiles && return 1
|
||||||
|
for r in ${repos[@]}; do
|
||||||
|
path=${r%/repo_info}
|
||||||
|
name=${path##*/}
|
||||||
|
echo "run_dir=$path" > ${MT_USERCONFDIR}/$name.conf
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
load_run_dir(){
|
||||||
|
local gitrepo='iso-profiles'
|
||||||
|
[[ -f ${MT_USERCONFDIR}/$gitrepo.conf ]] || write_repo_conf
|
||||||
|
[[ -r ${MT_USERCONFDIR}/$gitrepo.conf ]] && source ${MT_USERCONFDIR}/$gitrepo.conf
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
load_profile(){
|
||||||
|
local profdir="$1"
|
||||||
|
local profile_conf="$profdir/profile.conf"
|
||||||
|
|
||||||
|
[[ -f ${profile_conf} ]] || return 1
|
||||||
|
|
||||||
|
[[ -r ${profile_conf} ]] && source ${profile_conf}
|
||||||
|
|
||||||
|
[[ -z ${displaymanager} ]] && displaymanager="none"
|
||||||
|
|
||||||
|
[[ -z ${autologin} ]] && autologin="true"
|
||||||
|
[[ ${displaymanager} == 'none' ]] && autologin="false"
|
||||||
|
|
||||||
|
[[ -z ${multilib} ]] && multilib="true"
|
||||||
|
|
||||||
|
[[ -z ${nonfree_mhwd} ]] && nonfree_mhwd="true"
|
||||||
|
|
||||||
|
[[ -z ${hostname} ]] && hostname="manjaro"
|
||||||
|
|
||||||
|
[[ -z ${username} ]] && username="manjaro"
|
||||||
|
|
||||||
|
[[ -z ${password} ]] && password="manjaro"
|
||||||
|
|
||||||
|
[[ -z ${login_shell} ]] && login_shell='/bin/bash'
|
||||||
|
|
||||||
|
if [[ -z ${addgroups} ]];then
|
||||||
|
addgroups="video,power,storage,optical,network,lp,scanner,wheel,sys"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z ${enable_systemd[@]} ]];then
|
||||||
|
enable_systemd=('bluetooth' 'cronie' 'ModemManager' 'NetworkManager' 'org.cups.cupsd' 'tlp' 'tlp-sleep')
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z ${enable_openrc[@]} ]];then
|
||||||
|
enable_openrc=('acpid' 'bluetooth' 'elogind' 'cronie' 'cupsd' 'dbus' 'syslog-ng' 'NetworkManager')
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ${displaymanager} != "none" ]]; then
|
||||||
|
enable_openrc+=('xdm')
|
||||||
|
enable_systemd+=("${displaymanager}")
|
||||||
|
fi
|
||||||
|
|
||||||
|
[[ -z ${netinstall} ]] && netinstall='false'
|
||||||
|
|
||||||
|
[[ -z ${chrootcfg} ]] && chrootcfg='false'
|
||||||
|
|
||||||
|
enable_live=('manjaro-live' 'pacman-init')
|
||||||
|
if ${netinstall};then
|
||||||
|
enable_live+=('mhwd-live-net' 'mirrors-live-net')
|
||||||
|
else
|
||||||
|
enable_live+=('mhwd-live' 'mirrors-live')
|
||||||
|
fi
|
||||||
|
|
||||||
|
netgroups="https://raw.githubusercontent.com/manjaro/calamares-netgroups/master"
|
||||||
|
|
||||||
|
basic='true'
|
||||||
|
[[ -z ${extra} ]] && extra='false'
|
||||||
|
|
||||||
|
${extra} && basic='false'
|
||||||
|
|
||||||
|
root_list=${run_dir}/shared/Packages-Root
|
||||||
|
[[ -f "$profdir/Packages-Root" ]] && root_list="$profdir/Packages-Root"
|
||||||
|
|
||||||
|
root_overlay="${run_dir}/shared/${os_id}/root-overlay"
|
||||||
|
[[ -d "$profdir/root-overlay" ]] && root_overlay="$profdir/root-overlay"
|
||||||
|
|
||||||
|
mhwd_list=${run_dir}/shared/Packages-Mhwd
|
||||||
|
[[ -f "$profdir/Packages-Mhwd" ]] && mhwd_list="$profdir/Packages-Mhwd"
|
||||||
|
|
||||||
|
[[ -f "$profdir/Packages-Desktop" ]] && desktop_list=$profdir/Packages-Desktop
|
||||||
|
[[ -d "$profdir/desktop-overlay" ]] && desktop_overlay="$profdir/desktop-overlay"
|
||||||
|
|
||||||
|
live_list="${run_dir}/shared/Packages-Live"
|
||||||
|
[[ -f "$profdir/Packages-Live" ]] && live_list="$profdir/Packages-Live"
|
||||||
|
|
||||||
|
live_overlay="${run_dir}/shared/${os_id}/live-overlay"
|
||||||
|
[[ -d "$profdir/live-overlay" ]] && live_overlay="$profdir/live-overlay"
|
||||||
|
|
||||||
|
if ${netinstall};then
|
||||||
|
sort -u ${run_dir}/shared/Packages-Net ${live_list} > ${tmp_dir}/packages-live-net.list
|
||||||
|
live_list=${tmp_dir}/packages-live-net.list
|
||||||
|
else
|
||||||
|
chrootcfg="false"
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
reset_profile(){
|
||||||
|
unset displaymanager
|
||||||
|
unset autologin
|
||||||
|
unset multilib
|
||||||
|
unset nonfree_mhwd
|
||||||
|
unset hostname
|
||||||
|
unset username
|
||||||
|
unset password
|
||||||
|
unset addgroups
|
||||||
|
unset enable_systemd
|
||||||
|
unset enable_openrc
|
||||||
|
unset enable_live
|
||||||
|
unset login_shell
|
||||||
|
unset netinstall
|
||||||
|
unset chrootcfg
|
||||||
|
unset extra
|
||||||
|
unset root_list
|
||||||
|
unset desktop_list
|
||||||
|
unset mhwd_list
|
||||||
|
unset live_list
|
||||||
|
unset root_overlay
|
||||||
|
unset desktop_overlay
|
||||||
|
unset live_overlay
|
||||||
|
}
|
||||||
|
|
||||||
|
write_live_session_conf(){
|
||||||
|
local path=$1${SYSCONFDIR}
|
||||||
|
[[ ! -d $path ]] && mkdir -p "$path"
|
||||||
|
local conf=$path/live.conf
|
||||||
|
msg2 "Writing %s" "${conf##*/}"
|
||||||
|
echo '# live session configuration' > ${conf}
|
||||||
|
echo '' >> ${conf}
|
||||||
|
echo '# autologin' >> ${conf}
|
||||||
|
echo "autologin=${autologin}" >> ${conf}
|
||||||
|
echo '' >> ${conf}
|
||||||
|
echo '# login shell' >> ${conf}
|
||||||
|
echo "login_shell=${login_shell}" >> ${conf}
|
||||||
|
echo '' >> ${conf}
|
||||||
|
echo '# live username' >> ${conf}
|
||||||
|
echo "username=${username}" >> ${conf}
|
||||||
|
echo '' >> ${conf}
|
||||||
|
echo '# live password' >> ${conf}
|
||||||
|
echo "password=${password}" >> ${conf}
|
||||||
|
echo '' >> ${conf}
|
||||||
|
echo '# live group membership' >> ${conf}
|
||||||
|
echo "addgroups='${addgroups}'" >> ${conf}
|
||||||
|
}
|
||||||
|
|
||||||
|
# $1: file name
|
||||||
|
load_pkgs(){
|
||||||
|
local pkglist="$1" arch="$2" ed="$3" init="$4" _kv="$5"
|
||||||
|
info "Loading Packages: [%s] ..." "${pkglist##*/}"
|
||||||
|
|
||||||
|
local _init="s|>systemd||g" _init_rm="s|>openrc.*||g"
|
||||||
|
if [[ $init == "openrc" ]];then
|
||||||
|
_init="s|>openrc||g"
|
||||||
|
_init_rm="s|>systemd.*||g"
|
||||||
|
fi
|
||||||
|
|
||||||
|
local _basic="s|>basic.*||g"
|
||||||
|
if ${basic};then
|
||||||
|
_basic="s|>basic||g"
|
||||||
|
fi
|
||||||
|
|
||||||
|
local _extra="s|>extra.*||g"
|
||||||
|
if ${extra};then
|
||||||
|
_extra="s|>extra||g"
|
||||||
|
fi
|
||||||
|
|
||||||
|
local _edition="s|>manjaro||g" _edition_rm="s|>sonar.*||g"
|
||||||
|
if [[ "$ed" == 'sonar' ]];then
|
||||||
|
_edition="s|>sonar||g"
|
||||||
|
_edition_rm="s|>manjaro.*||g"
|
||||||
|
fi
|
||||||
|
|
||||||
|
local _multi _nonfree_default _nonfree_multi _arch _arch_rm _nonfree_i686 _nonfree_x86_64
|
||||||
|
|
||||||
|
if [[ "$arch" == 'i686' ]];then
|
||||||
|
_arch="s|>i686||g"
|
||||||
|
_arch_rm="s|>x86_64.*||g"
|
||||||
|
_multi="s|>multilib.*||g"
|
||||||
|
_nonfree_multi="s|>nonfree_multilib.*||g"
|
||||||
|
_nonfree_x86_64="s|>nonfree_x86_64.*||g"
|
||||||
|
if ${nonfree_mhwd};then
|
||||||
|
_nonfree_default="s|>nonfree_default||g"
|
||||||
|
_nonfree_i686="s|>nonfree_i686||g"
|
||||||
|
|
||||||
|
else
|
||||||
|
_nonfree_default="s|>nonfree_default.*||g"
|
||||||
|
_nonfree_i686="s|>nonfree_i686.*||g"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
_arch="s|>x86_64||g"
|
||||||
|
_arch_rm="s|>i686.*||g"
|
||||||
|
_nonfree_i686="s|>nonfree_i686.*||g"
|
||||||
|
if ${multilib};then
|
||||||
|
_multi="s|>multilib||g"
|
||||||
|
if ${nonfree_mhwd};then
|
||||||
|
_nonfree_default="s|>nonfree_default||g"
|
||||||
|
_nonfree_x86_64="s|>nonfree_x86_64||g"
|
||||||
|
_nonfree_multi="s|>nonfree_multilib||g"
|
||||||
|
else
|
||||||
|
_nonfree_default="s|>nonfree_default.*||g"
|
||||||
|
_nonfree_multi="s|>nonfree_multilib.*||g"
|
||||||
|
_nonfree_x86_64="s|>nonfree_x86_64.*||g"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
_multi="s|>multilib.*||g"
|
||||||
|
if ${nonfree_mhwd};then
|
||||||
|
_nonfree_default="s|>nonfree_default||g"
|
||||||
|
_nonfree_x86_64="s|>nonfree_x86_64||g"
|
||||||
|
_nonfree_multi="s|>nonfree_multilib.*||g"
|
||||||
|
else
|
||||||
|
_nonfree_default="s|>nonfree_default.*||g"
|
||||||
|
_nonfree_x86_64="s|>nonfree_x86_64.*||g"
|
||||||
|
_nonfree_multi="s|>nonfree_multilib.*||g"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
local _blacklist="s|>blacklist.*||g" \
|
||||||
|
_kernel="s|KERNEL|$_kv|g" \
|
||||||
|
_used_kernel=${_kv:5:2} \
|
||||||
|
_space="s| ||g" \
|
||||||
|
_clean=':a;N;$!ba;s/\n/ /g' \
|
||||||
|
_com_rm="s|#.*||g" \
|
||||||
|
_purge="s|>cleanup.*||g" \
|
||||||
|
_purge_rm="s|>cleanup||g"
|
||||||
|
|
||||||
|
packages=($(sed "$_com_rm" "$pkglist" \
|
||||||
|
| sed "$_space" \
|
||||||
|
| sed "$_blacklist" \
|
||||||
|
| sed "$_purge" \
|
||||||
|
| sed "$_init" \
|
||||||
|
| sed "$_init_rm" \
|
||||||
|
| sed "$_arch" \
|
||||||
|
| sed "$_arch_rm" \
|
||||||
|
| sed "$_nonfree_default" \
|
||||||
|
| sed "$_multi" \
|
||||||
|
| sed "$_nonfree_i686" \
|
||||||
|
| sed "$_nonfree_x86_64" \
|
||||||
|
| sed "$_nonfree_multi" \
|
||||||
|
| sed "$_kernel" \
|
||||||
|
| sed "$_edition" \
|
||||||
|
| sed "$_edition_rm" \
|
||||||
|
| sed "$_basic" \
|
||||||
|
| sed "$_extra" \
|
||||||
|
| sed "$_clean"))
|
||||||
|
|
||||||
|
if [[ $pkglist == "${mhwd_list}" ]]; then
|
||||||
|
|
||||||
|
[[ ${_used_kernel} < "42" ]] && local _amd="s|xf86-video-amdgpu||g"
|
||||||
|
|
||||||
|
packages_cleanup=($(sed "$_com_rm" "$pkglist" \
|
||||||
|
| grep cleanup \
|
||||||
|
| sed "$_purge_rm" \
|
||||||
|
| sed "$_kernel" \
|
||||||
|
| sed "$_clean" \
|
||||||
|
| sed "$_amd"))
|
||||||
|
fi
|
||||||
|
}
|
82
lib/util-yaml-check.sh
Normal file
82
lib/util-yaml-check.sh
Normal file
|
@ -0,0 +1,82 @@
|
||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# 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; version 2 of the License.
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
import ${LIBDIR}/util-yaml.sh
|
||||||
|
|
||||||
|
check_yaml(){
|
||||||
|
msg2 "Checking validity [%s] ..." "${1##*/}"
|
||||||
|
local name=${1##*/} data=$1 schema
|
||||||
|
case ${name##*.} in
|
||||||
|
yaml)
|
||||||
|
name=netgroups
|
||||||
|
# data=$1
|
||||||
|
;;
|
||||||
|
conf)
|
||||||
|
name=${name%.conf}
|
||||||
|
# data=${tmp_dir}/$name.yaml
|
||||||
|
# cp $1 $data
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
local schemas_dir=/usr/share/calamares/schemas
|
||||||
|
schema=${schemas_dir}/$name.schema.yaml
|
||||||
|
# pykwalify -d $data -s $schema
|
||||||
|
kwalify -lf $schema $data
|
||||||
|
}
|
||||||
|
|
||||||
|
write_calamares_yaml(){
|
||||||
|
configure_calamares "${yaml_dir}"
|
||||||
|
if ${validate}; then
|
||||||
|
for conf in "${yaml_dir}"/etc/calamares/modules/*.conf "${yaml_dir}"/etc/calamares/settings.conf; do
|
||||||
|
check_yaml "$conf"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
write_netgroup_yaml(){
|
||||||
|
msg2 "Writing %s ..." "${2##*/}"
|
||||||
|
echo "---" > "$2"
|
||||||
|
echo "- name: '$1'" >> "$2"
|
||||||
|
echo " description: '$1'" >> "$2"
|
||||||
|
echo " selected: false" >> "$2"
|
||||||
|
echo " hidden: false" >> "$2"
|
||||||
|
echo " critical: false" >> "$2"
|
||||||
|
echo " packages:" >> "$2"
|
||||||
|
for p in ${packages[@]};do
|
||||||
|
echo " - $p" >> "$2"
|
||||||
|
done
|
||||||
|
${validate} && check_yaml "$2"
|
||||||
|
}
|
||||||
|
|
||||||
|
write_pacman_group_yaml(){
|
||||||
|
packages=$(pacman -Sgq "$1")
|
||||||
|
prepare_dir "${cache_dir_netinstall}/pacman"
|
||||||
|
write_netgroup_yaml "$1" "${cache_dir_netinstall}/pacman/$1.yaml"
|
||||||
|
${validate} && check_yaml "${cache_dir_netinstall}/pacman/$1.yaml"
|
||||||
|
user_own "${cache_dir_netinstall}/pacman" "-R"
|
||||||
|
}
|
||||||
|
|
||||||
|
gen_fn(){
|
||||||
|
echo "${yaml_dir}/$1-${target_arch}-${initsys}.yaml"
|
||||||
|
}
|
||||||
|
|
||||||
|
make_profile_yaml(){
|
||||||
|
prepare_check "$1"
|
||||||
|
load_pkgs "${root_list}" "${target_arch}" "${edition}" "${initsys}" "${kernel}"
|
||||||
|
write_netgroup_yaml "$1" "$(gen_fn "Packages-Root")"
|
||||||
|
if [[ -f "${desktop_list}" ]]; then
|
||||||
|
load_pkgs "${desktop_list}" "${target_arch}" "${edition}" "${initsys}" "${kernel}"
|
||||||
|
write_netgroup_yaml "$1" "$(gen_fn "Packages-Desktop")"
|
||||||
|
fi
|
||||||
|
${calamares} && write_calamares_yaml "$1"
|
||||||
|
user_own "${cache_dir_netinstall}/$1" "-R"
|
||||||
|
reset_profile
|
||||||
|
unset yaml_dir
|
||||||
|
}
|
133
lib/util-yaml.sh
133
lib/util-yaml.sh
|
@ -44,7 +44,7 @@ get_preset(){
|
||||||
}
|
}
|
||||||
|
|
||||||
write_bootloader_conf(){
|
write_bootloader_conf(){
|
||||||
local conf="${modules_dir}/bootloader.conf"
|
local conf="${modules_dir}/bootloader.conf" efi_boot_loader='grub'
|
||||||
msg2 "Writing %s ..." "${conf##*/}"
|
msg2 "Writing %s ..." "${conf##*/}"
|
||||||
source "$(get_preset)"
|
source "$(get_preset)"
|
||||||
echo '---' > "$conf"
|
echo '---' > "$conf"
|
||||||
|
@ -72,14 +72,6 @@ write_servicescfg_conf(){
|
||||||
echo " - name: $s" >> "$conf"
|
echo " - name: $s" >> "$conf"
|
||||||
echo ' runlevel: default' >> "$conf"
|
echo ' runlevel: default' >> "$conf"
|
||||||
done
|
done
|
||||||
if [[ -n ${disable_openrc[@]} ]];then
|
|
||||||
echo ' disabled:' >> "$conf"
|
|
||||||
for s in ${disable_openrc[@]};do
|
|
||||||
echo " - name: $s" >> "$conf"
|
|
||||||
echo ' runlevel: default' >> "$conf"
|
|
||||||
echo '' >> "$conf"
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
write_services_conf(){
|
write_services_conf(){
|
||||||
|
@ -97,12 +89,6 @@ write_services_conf(){
|
||||||
echo ' - name: "graphical"' >> "$conf"
|
echo ' - name: "graphical"' >> "$conf"
|
||||||
echo ' mandatory: true' >> "$conf"
|
echo ' mandatory: true' >> "$conf"
|
||||||
echo '' >> "$conf"
|
echo '' >> "$conf"
|
||||||
echo 'disable:' >> "$conf"
|
|
||||||
for s in ${disable_systemd[@]};do
|
|
||||||
echo " - name: $s" >> "$conf"
|
|
||||||
echo ' mandatory: false' >> "$conf"
|
|
||||||
echo '' >> "$conf"
|
|
||||||
done
|
|
||||||
}
|
}
|
||||||
|
|
||||||
write_displaymanager_conf(){
|
write_displaymanager_conf(){
|
||||||
|
@ -132,11 +118,11 @@ write_unpack_conf(){
|
||||||
msg2 "Writing %s ..." "${conf##*/}"
|
msg2 "Writing %s ..." "${conf##*/}"
|
||||||
echo "---" > "$conf"
|
echo "---" > "$conf"
|
||||||
echo "unpack:" >> "$conf"
|
echo "unpack:" >> "$conf"
|
||||||
echo " - source: \"/run/miso/bootmnt/${iso_name}/${target_arch}/rootfs.sfs\"" >> "$conf"
|
echo " - source: \"/run/miso/bootmnt/${os_id}/${target_arch}/rootfs.sfs\"" >> "$conf"
|
||||||
echo " sourcefs: \"squashfs\"" >> "$conf"
|
echo " sourcefs: \"squashfs\"" >> "$conf"
|
||||||
echo " destination: \"\"" >> "$conf"
|
echo " destination: \"\"" >> "$conf"
|
||||||
if [[ -f "${packages_desktop}" ]] ; then
|
if [[ -f "${desktop_list}" ]] ; then
|
||||||
echo " - source: \"/run/miso/bootmnt/${iso_name}/${target_arch}/desktopfs.sfs\"" >> "$conf"
|
echo " - source: \"/run/miso/bootmnt/${os_id}/${target_arch}/desktopfs.sfs\"" >> "$conf"
|
||||||
echo " sourcefs: \"squashfs\"" >> "$conf"
|
echo " sourcefs: \"squashfs\"" >> "$conf"
|
||||||
echo " destination: \"\"" >> "$conf"
|
echo " destination: \"\"" >> "$conf"
|
||||||
fi
|
fi
|
||||||
|
@ -217,9 +203,7 @@ write_mhwdcfg_conf(){
|
||||||
${nonfree_mhwd} && drv="nonfree"
|
${nonfree_mhwd} && drv="nonfree"
|
||||||
echo "driver: ${drv}" >> "$conf"
|
echo "driver: ${drv}" >> "$conf"
|
||||||
echo '' >> "$conf"
|
echo '' >> "$conf"
|
||||||
local switch='true'
|
echo "local: ${netinstall}" >> "$conf"
|
||||||
${netinstall} && switch='false'
|
|
||||||
echo "local: ${switch}" >> "$conf"
|
|
||||||
echo '' >> "$conf"
|
echo '' >> "$conf"
|
||||||
echo 'repo: /opt/pacman-mhwd.conf' >> "$conf"
|
echo 'repo: /opt/pacman-mhwd.conf' >> "$conf"
|
||||||
}
|
}
|
||||||
|
@ -231,11 +215,14 @@ write_postcfg_conf(){
|
||||||
echo "keyrings:" >> "$conf"
|
echo "keyrings:" >> "$conf"
|
||||||
echo " - archlinux" >> "$conf"
|
echo " - archlinux" >> "$conf"
|
||||||
echo " - manjaro" >> "$conf"
|
echo " - manjaro" >> "$conf"
|
||||||
if [[ -n ${smb_workgroup} ]];then
|
}
|
||||||
echo "" >> "$conf"
|
|
||||||
echo "samba:" >> "$conf"
|
write_umount_conf(){
|
||||||
echo " - workgroup: ${smb_workgroup}" >> "$conf"
|
local conf="${modules_dir}/umount.conf"
|
||||||
fi
|
msg2 "Writing %s ..." "${conf##*/}"
|
||||||
|
echo "---" > "$conf"
|
||||||
|
echo 'srcLog: "/root/.cache/Calamares/Calamares/Calamares.log"' >> "$conf"
|
||||||
|
echo 'destLog: "/var/log/Calamares.log"' >> "$conf"
|
||||||
}
|
}
|
||||||
|
|
||||||
get_yaml(){
|
get_yaml(){
|
||||||
|
@ -264,12 +251,7 @@ write_locale_conf(){
|
||||||
msg2 "Writing %s ..." "${conf##*/}"
|
msg2 "Writing %s ..." "${conf##*/}"
|
||||||
echo "---" > "$conf"
|
echo "---" > "$conf"
|
||||||
echo "localeGenPath: /etc/locale.gen" >> "$conf"
|
echo "localeGenPath: /etc/locale.gen" >> "$conf"
|
||||||
if ${geoip};then
|
echo "geoipUrl: freegeoip.net" >> "$conf"
|
||||||
echo "geoipUrl: freegeoip.net" >> "$conf"
|
|
||||||
else
|
|
||||||
echo "region: Europe" >> "$conf"
|
|
||||||
echo "zone: London" >> "$conf"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
write_settings_conf(){
|
write_settings_conf(){
|
||||||
|
@ -325,11 +307,11 @@ write_settings_conf(){
|
||||||
echo " - grubcfg" >> "$conf"
|
echo " - grubcfg" >> "$conf"
|
||||||
echo " - bootloader" >> "$conf" && write_bootloader_conf
|
echo " - bootloader" >> "$conf" && write_bootloader_conf
|
||||||
echo " - postcfg" >> "$conf" && write_postcfg_conf
|
echo " - postcfg" >> "$conf" && write_postcfg_conf
|
||||||
echo " - umount" >> "$conf"
|
echo " - umount" >> "$conf" && write_umount_conf
|
||||||
echo " - show:" >> "$conf"
|
echo " - show:" >> "$conf"
|
||||||
echo " - finished" >> "$conf" && write_finished_conf
|
echo " - finished" >> "$conf" && write_finished_conf
|
||||||
echo '' >> "$conf"
|
echo '' >> "$conf"
|
||||||
echo "branding: ${iso_name}" >> "$conf"
|
echo "branding: ${os_id}" >> "$conf"
|
||||||
echo '' >> "$conf"
|
echo '' >> "$conf"
|
||||||
echo "prompt-install: false" >> "$conf"
|
echo "prompt-install: false" >> "$conf"
|
||||||
echo '' >> "$conf"
|
echo '' >> "$conf"
|
||||||
|
@ -343,86 +325,3 @@ configure_calamares(){
|
||||||
write_settings_conf "$1"
|
write_settings_conf "$1"
|
||||||
info "Done configuring [Calamares]"
|
info "Done configuring [Calamares]"
|
||||||
}
|
}
|
||||||
|
|
||||||
check_yaml(){
|
|
||||||
msg2 "Checking validity [%s] ..." "${1##*/}"
|
|
||||||
local name=${1##*/} data=$1 schema
|
|
||||||
case ${name##*.} in
|
|
||||||
yaml)
|
|
||||||
name=netgroups
|
|
||||||
# data=$1
|
|
||||||
;;
|
|
||||||
conf)
|
|
||||||
name=${name%.conf}
|
|
||||||
# data=${tmp_dir}/$name.yaml
|
|
||||||
# cp $1 $data
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
local schemas_dir=/usr/share/calamares/schemas
|
|
||||||
schema=${schemas_dir}/$name.schema.yaml
|
|
||||||
# pykwalify -d $data -s $schema
|
|
||||||
kwalify -lf $schema $data
|
|
||||||
}
|
|
||||||
|
|
||||||
write_calamares_yaml(){
|
|
||||||
configure_calamares "${yaml_dir}"
|
|
||||||
if ${validate}; then
|
|
||||||
for conf in "${yaml_dir}"/etc/calamares/modules/*.conf "${yaml_dir}"/etc/calamares/settings.conf; do
|
|
||||||
check_yaml "$conf"
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
write_netgroup_yaml(){
|
|
||||||
msg2 "Writing %s ..." "${2##*/}"
|
|
||||||
echo "---" > "$2"
|
|
||||||
echo "- name: '$1'" >> "$2"
|
|
||||||
echo " description: '$1'" >> "$2"
|
|
||||||
echo " selected: false" >> "$2"
|
|
||||||
echo " hidden: false" >> "$2"
|
|
||||||
echo " critical: false" >> "$2"
|
|
||||||
echo " packages:" >> "$2"
|
|
||||||
for p in ${packages[@]};do
|
|
||||||
echo " - $p" >> "$2"
|
|
||||||
done
|
|
||||||
${validate} && check_yaml "$2"
|
|
||||||
}
|
|
||||||
|
|
||||||
write_pacman_group_yaml(){
|
|
||||||
packages=$(pacman -Sgq "$1")
|
|
||||||
prepare_dir "${cache_dir_netinstall}/pacman"
|
|
||||||
write_netgroup_yaml "$1" "${cache_dir_netinstall}/pacman/$1.yaml"
|
|
||||||
${validate} && check_yaml "${cache_dir_netinstall}/pacman/$1.yaml"
|
|
||||||
user_own "${cache_dir_netinstall}/pacman" "-R"
|
|
||||||
}
|
|
||||||
|
|
||||||
prepare_check(){
|
|
||||||
profile=$1
|
|
||||||
local edition=$(get_edition ${profile})
|
|
||||||
profile_dir=${run_dir}/${edition}/${profile}
|
|
||||||
check_profile "${profile_dir}"
|
|
||||||
load_profile_config "${profile_dir}/profile.conf"
|
|
||||||
|
|
||||||
yaml_dir=${cache_dir_netinstall}/${profile}/${target_arch}
|
|
||||||
|
|
||||||
prepare_dir "${yaml_dir}"
|
|
||||||
user_own "${yaml_dir}"
|
|
||||||
}
|
|
||||||
|
|
||||||
gen_fn(){
|
|
||||||
echo "${yaml_dir}/$1-${target_arch}-${initsys}.yaml"
|
|
||||||
}
|
|
||||||
|
|
||||||
make_profile_yaml(){
|
|
||||||
prepare_check "$1"
|
|
||||||
load_pkgs "${profile_dir}/Packages-Root"
|
|
||||||
write_netgroup_yaml "$1" "$(gen_fn "Packages-Root")"
|
|
||||||
if [[ -f "${packages_desktop}" ]]; then
|
|
||||||
load_pkgs "${packages_desktop}"
|
|
||||||
write_netgroup_yaml "$1" "$(gen_fn "Packages-Desktop")"
|
|
||||||
fi
|
|
||||||
${calamares} && write_calamares_yaml "$1"
|
|
||||||
user_own "${cache_dir_netinstall}/$1" "-R"
|
|
||||||
reset_profile
|
|
||||||
unset yaml_dir
|
|
||||||
}
|
|
||||||
|
|
498
lib/util.sh
498
lib/util.sh
|
@ -62,25 +62,6 @@ check_user_repos_conf(){
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
get_pac_mirrors_conf(){
|
|
||||||
local conf="$tmp_dir/pacman-mirrors-$1.conf"
|
|
||||||
cp "${DATADIR}/pacman-mirrors.conf" "$conf"
|
|
||||||
sed -i "$conf" \
|
|
||||||
-e "s|Branch = stable|Branch = $1|"
|
|
||||||
|
|
||||||
echo "$conf"
|
|
||||||
}
|
|
||||||
|
|
||||||
read_build_list(){
|
|
||||||
local _space="s| ||g" \
|
|
||||||
_clean=':a;N;$!ba;s/\n/ /g' \
|
|
||||||
_com_rm="s|#.*||g"
|
|
||||||
|
|
||||||
build_list=$(sed "$_com_rm" "$1.list" \
|
|
||||||
| sed "$_space" \
|
|
||||||
| sed "$_clean")
|
|
||||||
}
|
|
||||||
|
|
||||||
# $1: list_dir
|
# $1: list_dir
|
||||||
show_build_lists(){
|
show_build_lists(){
|
||||||
local list temp
|
local list temp
|
||||||
|
@ -101,29 +82,10 @@ show_build_profiles(){
|
||||||
echo $cpuarch
|
echo $cpuarch
|
||||||
}
|
}
|
||||||
|
|
||||||
# $1: list_dir
|
|
||||||
# $2: build list
|
|
||||||
eval_build_list(){
|
|
||||||
eval "case $2 in
|
|
||||||
$(show_build_lists $1)) is_build_list=true; read_build_list $1/$2 ;;
|
|
||||||
*) is_build_list=false ;;
|
|
||||||
esac"
|
|
||||||
}
|
|
||||||
|
|
||||||
in_array() {
|
|
||||||
local needle=$1; shift
|
|
||||||
local item
|
|
||||||
for item in "$@"; do
|
|
||||||
[[ $item = $needle ]] && return 0 # Found
|
|
||||||
done
|
|
||||||
return 1 # Not Found
|
|
||||||
}
|
|
||||||
|
|
||||||
get_timer(){
|
get_timer(){
|
||||||
echo $(date +%s)
|
echo $(date +%s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# $1: start timer
|
# $1: start timer
|
||||||
elapsed_time(){
|
elapsed_time(){
|
||||||
echo $(echo $1 $(get_timer) | awk '{ printf "%0.2f",($2-$1)/60 }')
|
echo $(echo $1 $(get_timer) | awk '{ printf "%0.2f",($2-$1)/60 }')
|
||||||
|
@ -133,43 +95,6 @@ show_elapsed_time(){
|
||||||
info "Time %s: %s minutes" "$1" "$(elapsed_time $2)"
|
info "Time %s: %s minutes" "$1" "$(elapsed_time $2)"
|
||||||
}
|
}
|
||||||
|
|
||||||
lock() {
|
|
||||||
eval "exec $1>"'"$2"'
|
|
||||||
if ! flock -n $1; then
|
|
||||||
stat_busy "$3"
|
|
||||||
flock $1
|
|
||||||
stat_done
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
slock() {
|
|
||||||
eval "exec $1>"'"$2"'
|
|
||||||
if ! flock -sn $1; then
|
|
||||||
stat_busy "$3"
|
|
||||||
flock -s $1
|
|
||||||
stat_done
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
check_root() {
|
|
||||||
(( EUID == 0 )) && return
|
|
||||||
if type -P sudo >/dev/null; then
|
|
||||||
exec sudo -- "$@"
|
|
||||||
else
|
|
||||||
exec su root -c "$(printf ' %q' "$@")"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
copy_mirrorlist(){
|
|
||||||
cp -a /etc/pacman.d/mirrorlist "$1/etc/pacman.d/"
|
|
||||||
}
|
|
||||||
|
|
||||||
copy_keyring(){
|
|
||||||
if [[ -d /etc/pacman.d/gnupg ]] && [[ ! -d $1/etc/pacman.d/gnupg ]]; then
|
|
||||||
cp -a /etc/pacman.d/gnupg "$1/etc/pacman.d/"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
load_vars() {
|
load_vars() {
|
||||||
local var
|
local var
|
||||||
|
|
||||||
|
@ -186,18 +111,6 @@ prepare_dir(){
|
||||||
[[ ! -d $1 ]] && mkdir -p $1
|
[[ ! -d $1 ]] && mkdir -p $1
|
||||||
}
|
}
|
||||||
|
|
||||||
# $1: chroot
|
|
||||||
get_branch(){
|
|
||||||
echo $(cat "$1/etc/pacman-mirrors.conf" | grep '^Branch = ' | sed 's/Branch = \s*//g')
|
|
||||||
}
|
|
||||||
|
|
||||||
# $1: chroot
|
|
||||||
# $2: branch
|
|
||||||
set_branch(){
|
|
||||||
info "Setting mirrorlist branch: %s" "$2"
|
|
||||||
sed -e "s|/stable|/$2|g" -i "$1/etc/pacman.d/mirrorlist"
|
|
||||||
}
|
|
||||||
|
|
||||||
init_common(){
|
init_common(){
|
||||||
[[ -z ${target_branch} ]] && target_branch='stable'
|
[[ -z ${target_branch} ]] && target_branch='stable'
|
||||||
|
|
||||||
|
@ -207,11 +120,11 @@ init_common(){
|
||||||
|
|
||||||
[[ -z ${chroots_dir} ]] && chroots_dir='/var/lib/manjaro-tools'
|
[[ -z ${chroots_dir} ]] && chroots_dir='/var/lib/manjaro-tools'
|
||||||
|
|
||||||
[[ -z ${log_dir} ]] && log_dir='/var/log/manjaro-tools'
|
|
||||||
|
|
||||||
[[ -z ${build_mirror} ]] && build_mirror='http://mirror.netzspielplatz.de/manjaro/packages'
|
[[ -z ${build_mirror} ]] && build_mirror='http://mirror.netzspielplatz.de/manjaro/packages'
|
||||||
|
|
||||||
[[ -z ${tmp_dir} ]] && tmp_dir='/tmp/manjaro-tools'
|
log_dir='/var/log/manjaro-tools'
|
||||||
|
|
||||||
|
tmp_dir='/tmp'
|
||||||
}
|
}
|
||||||
|
|
||||||
init_buildtree(){
|
init_buildtree(){
|
||||||
|
@ -233,22 +146,13 @@ init_buildpkg(){
|
||||||
|
|
||||||
make_conf_dir="${SYSCONFDIR}/make.conf.d"
|
make_conf_dir="${SYSCONFDIR}/make.conf.d"
|
||||||
|
|
||||||
[[ -d ${USERCONFDIR}/pkg.list.d ]] && list_dir_pkg=${USERCONFDIR}/pkg.list.d
|
[[ -d ${MT_USERCONFDIR}/pkg.list.d ]] && list_dir_pkg=${MT_USERCONFDIR}/pkg.list.d
|
||||||
|
|
||||||
[[ -z ${build_list_pkg} ]] && build_list_pkg='default'
|
[[ -z ${build_list_pkg} ]] && build_list_pkg='default'
|
||||||
|
|
||||||
cache_dir_pkg=${cache_dir}/pkg
|
cache_dir_pkg=${cache_dir}/pkg
|
||||||
}
|
}
|
||||||
|
|
||||||
get_iso_label(){
|
|
||||||
local label="$1"
|
|
||||||
label="${label//_}" # relace all _
|
|
||||||
label="${label//-}" # relace all -
|
|
||||||
label="${label^^}" # all uppercase
|
|
||||||
label="${label::8}" # limit to 8 characters
|
|
||||||
echo ${label}
|
|
||||||
}
|
|
||||||
|
|
||||||
get_codename(){
|
get_codename(){
|
||||||
source /etc/lsb-release
|
source /etc/lsb-release
|
||||||
echo "${DISTRIB_CODENAME}"
|
echo "${DISTRIB_CODENAME}"
|
||||||
|
@ -270,17 +174,17 @@ get_distid(){
|
||||||
}
|
}
|
||||||
|
|
||||||
get_disturl(){
|
get_disturl(){
|
||||||
source /etc/os-release
|
source /usr/lib/os-release
|
||||||
echo "${HOME_URL}"
|
echo "${HOME_URL}"
|
||||||
}
|
}
|
||||||
|
|
||||||
get_osname(){
|
get_osname(){
|
||||||
source /etc/os-release
|
source /usr/lib/os-release
|
||||||
echo "${NAME}"
|
echo "${NAME}"
|
||||||
}
|
}
|
||||||
|
|
||||||
get_osid(){
|
get_osid(){
|
||||||
source /etc/os-release
|
source /usr/lib/os-release
|
||||||
echo "${ID}"
|
echo "${ID}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -289,14 +193,12 @@ init_buildiso(){
|
||||||
|
|
||||||
list_dir_iso="${SYSCONFDIR}/iso.list.d"
|
list_dir_iso="${SYSCONFDIR}/iso.list.d"
|
||||||
|
|
||||||
[[ -d ${USERCONFDIR}/iso.list.d ]] && list_dir_iso=${USERCONFDIR}/iso.list.d
|
[[ -d ${MT_USERCONFDIR}/iso.list.d ]] && list_dir_iso=${MT_USERCONFDIR}/iso.list.d
|
||||||
|
|
||||||
[[ -z ${build_list_iso} ]] && build_list_iso='default'
|
[[ -z ${build_list_iso} ]] && build_list_iso='default'
|
||||||
|
|
||||||
cache_dir_iso="${cache_dir}/iso"
|
cache_dir_iso="${cache_dir}/iso"
|
||||||
|
|
||||||
profile_repo='iso-profiles'
|
|
||||||
|
|
||||||
##### iso settings #####
|
##### iso settings #####
|
||||||
|
|
||||||
[[ -z ${dist_release} ]] && dist_release=$(get_release)
|
[[ -z ${dist_release} ]] && dist_release=$(get_release)
|
||||||
|
@ -305,19 +207,17 @@ init_buildiso(){
|
||||||
|
|
||||||
dist_name=$(get_distname)
|
dist_name=$(get_distname)
|
||||||
|
|
||||||
iso_name=$(get_osid)
|
os_id=$(get_osid)
|
||||||
|
|
||||||
[[ -z ${dist_branding} ]] && dist_branding="MJRO"
|
[[ -z ${dist_branding} ]] && dist_branding="MJRO"
|
||||||
|
|
||||||
iso_label=$(get_iso_label "${dist_branding}${dist_release//.}")
|
iso_label="${dist_branding}${dist_release//.}"
|
||||||
|
|
||||||
[[ -z ${initsys} ]] && initsys="systemd"
|
[[ -z ${initsys} ]] && initsys="systemd"
|
||||||
|
|
||||||
[[ -z ${kernel} ]] && kernel="linux49"
|
[[ -z ${kernel} ]] && kernel="linux49"
|
||||||
|
|
||||||
[[ -z ${gpgkey} ]] && gpgkey=''
|
[[ -z ${gpgkey} ]] && gpgkey=''
|
||||||
|
|
||||||
mhwd_repo="/opt/pkg"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
init_deployiso(){
|
init_deployiso(){
|
||||||
|
@ -360,80 +260,6 @@ load_config(){
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
load_profile_config(){
|
|
||||||
|
|
||||||
[[ -f $1 ]] || return 1
|
|
||||||
|
|
||||||
profile_conf="$1"
|
|
||||||
|
|
||||||
[[ -r ${profile_conf} ]] && source ${profile_conf}
|
|
||||||
|
|
||||||
[[ -z ${displaymanager} ]] && displaymanager="none"
|
|
||||||
|
|
||||||
[[ -z ${autologin} ]] && autologin="true"
|
|
||||||
[[ ${displaymanager} == 'none' ]] && autologin="false"
|
|
||||||
|
|
||||||
[[ -z ${multilib} ]] && multilib="true"
|
|
||||||
|
|
||||||
[[ -z ${nonfree_mhwd} ]] && nonfree_mhwd="true"
|
|
||||||
|
|
||||||
[[ -z ${efi_boot_loader} ]] && efi_boot_loader="grub"
|
|
||||||
|
|
||||||
[[ -z ${hostname} ]] && hostname="manjaro"
|
|
||||||
|
|
||||||
[[ -z ${username} ]] && username="manjaro"
|
|
||||||
|
|
||||||
[[ -z ${password} ]] && password="manjaro"
|
|
||||||
|
|
||||||
[[ -z ${login_shell} ]] && login_shell='/bin/bash'
|
|
||||||
|
|
||||||
if [[ -z ${addgroups} ]];then
|
|
||||||
addgroups="video,power,storage,optical,network,lp,scanner,wheel,sys"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -z ${enable_systemd[@]} ]];then
|
|
||||||
enable_systemd=('bluetooth' 'cronie' 'ModemManager' 'NetworkManager' 'org.cups.cupsd' 'tlp' 'tlp-sleep')
|
|
||||||
fi
|
|
||||||
|
|
||||||
[[ -z ${disable_systemd[@]} ]] && disable_systemd=('pacman-init')
|
|
||||||
|
|
||||||
if [[ -z ${enable_openrc[@]} ]];then
|
|
||||||
enable_openrc=('acpid' 'bluetooth' 'elogind' 'cronie' 'cupsd' 'dbus' 'syslog-ng' 'NetworkManager')
|
|
||||||
fi
|
|
||||||
|
|
||||||
[[ -z ${disable_openrc[@]} ]] && disable_openrc=()
|
|
||||||
|
|
||||||
if [[ -z ${enable_systemd_live[@]} ]];then
|
|
||||||
enable_systemd_live=('manjaro-live' 'mhwd-live' 'pacman-init' 'mirrors-live')
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -z ${enable_openrc_live[@]} ]];then
|
|
||||||
enable_openrc_live=('manjaro-live' 'mhwd-live' 'pacman-init' 'mirrors-live')
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ${displaymanager} != "none" ]]; then
|
|
||||||
enable_openrc+=('xdm')
|
|
||||||
enable_systemd+=("${displaymanager}")
|
|
||||||
fi
|
|
||||||
|
|
||||||
[[ -z ${netinstall} ]] && netinstall='false'
|
|
||||||
|
|
||||||
[[ -z ${chrootcfg} ]] && chrootcfg='false'
|
|
||||||
|
|
||||||
netgroups="https://raw.githubusercontent.com/manjaro/calamares-netgroups/master"
|
|
||||||
|
|
||||||
[[ -z ${geoip} ]] && geoip='true'
|
|
||||||
|
|
||||||
[[ -z ${smb_workgroup} ]] && smb_workgroup=''
|
|
||||||
|
|
||||||
basic='true'
|
|
||||||
[[ -z ${extra} ]] && extra='false'
|
|
||||||
|
|
||||||
${extra} && basic='false'
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
get_edition(){
|
get_edition(){
|
||||||
local result=$(find ${run_dir} -maxdepth 2 -name "$1") path
|
local result=$(find ${run_dir} -maxdepth 2 -name "$1") path
|
||||||
[[ -z $result ]] && die "%s is not a valid profile or build list!" "$1"
|
[[ -z $result ]] && die "%s is not a valid profile or build list!" "$1"
|
||||||
|
@ -441,200 +267,6 @@ get_edition(){
|
||||||
echo ${path##*/}
|
echo ${path##*/}
|
||||||
}
|
}
|
||||||
|
|
||||||
reset_profile(){
|
|
||||||
unset displaymanager
|
|
||||||
unset autologin
|
|
||||||
unset multilib
|
|
||||||
unset nonfree_mhwd
|
|
||||||
unset efi_boot_loader
|
|
||||||
unset hostname
|
|
||||||
unset username
|
|
||||||
unset password
|
|
||||||
unset addgroups
|
|
||||||
unset enable_systemd
|
|
||||||
unset disable_systemd
|
|
||||||
unset enable_openrc
|
|
||||||
unset disable_openrc
|
|
||||||
unset enable_systemd_live
|
|
||||||
unset enable_openrc_live
|
|
||||||
unset packages_desktop
|
|
||||||
unset packages_mhwd
|
|
||||||
unset login_shell
|
|
||||||
unset netinstall
|
|
||||||
unset chrootcfg
|
|
||||||
unset geoip
|
|
||||||
unset extra
|
|
||||||
}
|
|
||||||
|
|
||||||
check_profile(){
|
|
||||||
local keyfiles=("$1/Packages-Root"
|
|
||||||
"$1/Packages-Live")
|
|
||||||
|
|
||||||
local keydirs=("$1/root-overlay"
|
|
||||||
"$1/live-overlay")
|
|
||||||
|
|
||||||
local has_keyfiles=false has_keydirs=false
|
|
||||||
for f in ${keyfiles[@]}; do
|
|
||||||
if [[ -f $f ]];then
|
|
||||||
has_keyfiles=true
|
|
||||||
else
|
|
||||||
has_keyfiles=false
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
for d in ${keydirs[@]}; do
|
|
||||||
if [[ -d $d ]];then
|
|
||||||
has_keydirs=true
|
|
||||||
else
|
|
||||||
has_keydirs=false
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
if ! ${has_keyfiles} && ! ${has_keydirs};then
|
|
||||||
die "Profile [%s] sanity check failed!" "$1"
|
|
||||||
fi
|
|
||||||
|
|
||||||
[[ -f "$1/Packages-Desktop" ]] && packages_desktop=$1/Packages-Desktop
|
|
||||||
|
|
||||||
[[ -f "$1/Packages-Mhwd" ]] && packages_mhwd=$1/Packages-Mhwd
|
|
||||||
|
|
||||||
if ! ${netinstall}; then
|
|
||||||
chrootcfg="false"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# $1: file name
|
|
||||||
load_pkgs(){
|
|
||||||
info "Loading Packages: [%s] ..." "${1##*/}"
|
|
||||||
|
|
||||||
local _init _init_rm
|
|
||||||
case "${initsys}" in
|
|
||||||
'openrc')
|
|
||||||
_init="s|>openrc||g"
|
|
||||||
_init_rm="s|>systemd.*||g"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
_init="s|>systemd||g"
|
|
||||||
_init_rm="s|>openrc.*||g"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
local _multi _nonfree_default _nonfree_multi _arch _arch_rm _nonfree_i686 _nonfree_x86_64 _basic _basic_rm _extra _extra_rm
|
|
||||||
|
|
||||||
if ${basic};then
|
|
||||||
_basic="s|>basic||g"
|
|
||||||
else
|
|
||||||
_basic_rm="s|>basic.*||g"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ${extra};then
|
|
||||||
_extra="s|>extra||g"
|
|
||||||
else
|
|
||||||
_extra_rm="s|>extra.*||g"
|
|
||||||
fi
|
|
||||||
|
|
||||||
case "${target_arch}" in
|
|
||||||
"i686")
|
|
||||||
_arch="s|>i686||g"
|
|
||||||
_arch_rm="s|>x86_64.*||g"
|
|
||||||
_multi="s|>multilib.*||g"
|
|
||||||
_nonfree_multi="s|>nonfree_multilib.*||g"
|
|
||||||
_nonfree_x86_64="s|>nonfree_x86_64.*||g"
|
|
||||||
if ${nonfree_mhwd};then
|
|
||||||
_nonfree_default="s|>nonfree_default||g"
|
|
||||||
_nonfree_i686="s|>nonfree_i686||g"
|
|
||||||
|
|
||||||
else
|
|
||||||
_nonfree_default="s|>nonfree_default.*||g"
|
|
||||||
_nonfree_i686="s|>nonfree_i686.*||g"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
_arch="s|>x86_64||g"
|
|
||||||
_arch_rm="s|>i686.*||g"
|
|
||||||
_nonfree_i686="s|>nonfree_i686.*||g"
|
|
||||||
if ${multilib};then
|
|
||||||
_multi="s|>multilib||g"
|
|
||||||
if ${nonfree_mhwd};then
|
|
||||||
_nonfree_default="s|>nonfree_default||g"
|
|
||||||
_nonfree_x86_64="s|>nonfree_x86_64||g"
|
|
||||||
_nonfree_multi="s|>nonfree_multilib||g"
|
|
||||||
else
|
|
||||||
_nonfree_default="s|>nonfree_default.*||g"
|
|
||||||
_nonfree_multi="s|>nonfree_multilib.*||g"
|
|
||||||
_nonfree_x86_64="s|>nonfree_x86_64.*||g"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
_multi="s|>multilib.*||g"
|
|
||||||
if ${nonfree_mhwd};then
|
|
||||||
_nonfree_default="s|>nonfree_default||g"
|
|
||||||
_nonfree_x86_64="s|>nonfree_x86_64||g"
|
|
||||||
_nonfree_multi="s|>nonfree_multilib.*||g"
|
|
||||||
else
|
|
||||||
_nonfree_default="s|>nonfree_default.*||g"
|
|
||||||
_nonfree_x86_64="s|>nonfree_x86_64.*||g"
|
|
||||||
_nonfree_multi="s|>nonfree_multilib.*||g"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
local _edition _edition_rm
|
|
||||||
case "${edition}" in
|
|
||||||
'sonar')
|
|
||||||
_edition="s|>sonar||g"
|
|
||||||
_edition_rm="s|>manjaro.*||g"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
_edition="s|>manjaro||g"
|
|
||||||
_edition_rm="s|>sonar.*||g"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
local _blacklist="s|>blacklist.*||g" \
|
|
||||||
_kernel="s|KERNEL|$kernel|g" \
|
|
||||||
_used_kernel=${kernel:5:2} \
|
|
||||||
_space="s| ||g" \
|
|
||||||
_clean=':a;N;$!ba;s/\n/ /g' \
|
|
||||||
_com_rm="s|#.*||g" \
|
|
||||||
_purge="s|>cleanup.*||g" \
|
|
||||||
_purge_rm="s|>cleanup||g"
|
|
||||||
|
|
||||||
packages=$(sed "$_com_rm" "$1" \
|
|
||||||
| sed "$_space" \
|
|
||||||
| sed "$_blacklist" \
|
|
||||||
| sed "$_purge" \
|
|
||||||
| sed "$_init" \
|
|
||||||
| sed "$_init_rm" \
|
|
||||||
| sed "$_arch" \
|
|
||||||
| sed "$_arch_rm" \
|
|
||||||
| sed "$_nonfree_default" \
|
|
||||||
| sed "$_multi" \
|
|
||||||
| sed "$_nonfree_i686" \
|
|
||||||
| sed "$_nonfree_x86_64" \
|
|
||||||
| sed "$_nonfree_multi" \
|
|
||||||
| sed "$_kernel" \
|
|
||||||
| sed "$_edition" \
|
|
||||||
| sed "$_edition_rm" \
|
|
||||||
| sed "$_basic" \
|
|
||||||
| sed "$_basic_rm" \
|
|
||||||
| sed "$_extra" \
|
|
||||||
| sed "$_extra_rm" \
|
|
||||||
| sed "$_clean")
|
|
||||||
|
|
||||||
if [[ $1 == "${packages_mhwd}" ]]; then
|
|
||||||
|
|
||||||
[[ ${_used_kernel} < "42" ]] && local _amd="s|xf86-video-amdgpu||g"
|
|
||||||
|
|
||||||
packages_cleanup=$(sed "$_com_rm" "$1" \
|
|
||||||
| grep cleanup \
|
|
||||||
| sed "$_purge_rm" \
|
|
||||||
| sed "$_kernel" \
|
|
||||||
| sed "$_clean" \
|
|
||||||
| sed "$_amd")
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
user_own(){
|
user_own(){
|
||||||
local flag=$2
|
local flag=$2
|
||||||
chown ${flag} "${OWNER}:$(id --group ${OWNER})" "$1"
|
chown ${flag} "${OWNER}:$(id --group ${OWNER})" "$1"
|
||||||
|
@ -647,17 +279,6 @@ clean_dir(){
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
write_repo_conf(){
|
|
||||||
local repos=$(find $USER_HOME -type f -name "repo_info")
|
|
||||||
local path name
|
|
||||||
[[ -z ${repos[@]} ]] && run_dir=${DATADIR}/iso-profiles && return 1
|
|
||||||
for r in ${repos[@]}; do
|
|
||||||
path=${r%/repo_info}
|
|
||||||
name=${path##*/}
|
|
||||||
echo "run_dir=$path" > ${USERCONFDIR}/$name.conf
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
load_user_info(){
|
load_user_info(){
|
||||||
OWNER=${SUDO_USER:-$USER}
|
OWNER=${SUDO_USER:-$USER}
|
||||||
|
|
||||||
|
@ -667,14 +288,9 @@ load_user_info(){
|
||||||
USER_HOME=$HOME
|
USER_HOME=$HOME
|
||||||
fi
|
fi
|
||||||
|
|
||||||
USERCONFDIR="$USER_HOME/.config/manjaro-tools"
|
MT_USERCONFDIR="${XDG_CONFIG_HOME:-$USER_HOME/.config}/manjaro-tools"
|
||||||
prepare_dir "${USERCONFDIR}"
|
PAC_USERCONFDIR="${XDG_CONFIG_HOME:-$USER_HOME/.config}/pacman"
|
||||||
}
|
prepare_dir "${MT_USERCONFDIR}"
|
||||||
|
|
||||||
load_run_dir(){
|
|
||||||
[[ -f ${USERCONFDIR}/$1.conf ]] || write_repo_conf
|
|
||||||
[[ -r ${USERCONFDIR}/$1.conf ]] && source ${USERCONFDIR}/$1.conf
|
|
||||||
return 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
show_version(){
|
show_version(){
|
||||||
|
@ -683,71 +299,27 @@ show_version(){
|
||||||
}
|
}
|
||||||
|
|
||||||
show_config(){
|
show_config(){
|
||||||
if [[ -f ${USERCONFDIR}/manjaro-tools.conf ]]; then
|
if [[ -f ${MT_USERCONFDIR}/manjaro-tools.conf ]]; then
|
||||||
msg2 "config: %s" "~/.config/manjaro-tools/manjaro-tools.conf"
|
msg2 "config: %s" "~/.config/manjaro-tools/manjaro-tools.conf"
|
||||||
else
|
else
|
||||||
msg2 "config: %s" "${manjaro_tools_conf}"
|
msg2 "config: %s" "${manjaro_tools_conf}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# $1: chroot
|
read_build_list(){
|
||||||
kill_chroot_process(){
|
local _space="s| ||g" _clean=':a;N;$!ba;s/\n/ /g' _com_rm="s|#.*||g"
|
||||||
# enable to have more debug info
|
build_list=$(sed "$_com_rm" "$1.list" | sed "$_space" | sed "$_clean")
|
||||||
#msg "machine-id (etc): $(cat $1/etc/machine-id)"
|
|
||||||
#[[ -e $1/var/lib/dbus/machine-id ]] && msg "machine-id (lib): $(cat $1/var/lib/dbus/machine-id)"
|
|
||||||
#msg "running processes: "
|
|
||||||
#lsof | grep $1
|
|
||||||
|
|
||||||
local prefix="$1" flink pid name
|
|
||||||
for root_dir in /proc/*/root; do
|
|
||||||
flink=$(readlink $root_dir)
|
|
||||||
if [ "x$flink" != "x" ]; then
|
|
||||||
if [ "x${flink:0:${#prefix}}" = "x$prefix" ]; then
|
|
||||||
# this process is in the chroot...
|
|
||||||
pid=$(basename $(dirname "$root_dir"))
|
|
||||||
name=$(ps -p $pid -o comm=)
|
|
||||||
info "Killing chroot process: %s (%s)" "$name" "$pid"
|
|
||||||
kill -9 "$pid"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
}
|
||||||
|
|
||||||
create_min_fs(){
|
# $1: list_dir
|
||||||
msg "Creating install root at %s" "$1"
|
# $2: build list
|
||||||
mkdir -m 0755 -p $1/var/{cache/pacman/pkg,lib/pacman,log} $1/{dev,run,etc}
|
eval_build_list(){
|
||||||
mkdir -m 1777 -p $1/tmp
|
eval "case $2 in
|
||||||
mkdir -m 0555 -p $1/{sys,proc}
|
$(show_build_lists $1)) is_build_list=true; read_build_list $1/$2 ;;
|
||||||
}
|
*) is_build_list=false ;;
|
||||||
|
|
||||||
is_valid_init(){
|
|
||||||
case $1 in
|
|
||||||
'openrc'|'systemd') return 0 ;;
|
|
||||||
*) return 1 ;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
is_valid_arch_pkg(){
|
|
||||||
eval "case $1 in
|
|
||||||
$(show_build_profiles "${make_conf_dir}")) return 0 ;;
|
|
||||||
*) return 1 ;;
|
|
||||||
esac"
|
esac"
|
||||||
}
|
}
|
||||||
|
|
||||||
is_valid_arch_iso(){
|
|
||||||
case $1 in
|
|
||||||
'i686'|'x86_64') return 0 ;;
|
|
||||||
*) return 1 ;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
is_valid_branch(){
|
|
||||||
case $1 in
|
|
||||||
'stable'|'testing'|'unstable') return 0 ;;
|
|
||||||
*) return 1 ;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
run(){
|
run(){
|
||||||
if ${is_build_list};then
|
if ${is_build_list};then
|
||||||
for item in ${build_list[@]};do
|
for item in ${build_list[@]};do
|
||||||
|
@ -758,21 +330,11 @@ run(){
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
is_btrfs() {
|
check_root() {
|
||||||
[[ -e "$1" && "$(stat -f -c %T "$1")" == btrfs ]]
|
(( EUID == 0 )) && return
|
||||||
}
|
if type -P sudo >/dev/null; then
|
||||||
|
exec sudo -- "${orig_argv[@]}"
|
||||||
subvolume_delete_recursive() {
|
else
|
||||||
local subvol
|
exec su root -c "$(printf ' %q' "${orig_argv[@]}")"
|
||||||
|
fi
|
||||||
is_btrfs "$1" || return 0
|
|
||||||
|
|
||||||
while IFS= read -d $'\0' -r subvol; do
|
|
||||||
if ! btrfs subvolume delete "$subvol" &>/dev/null; then
|
|
||||||
error "Unable to delete subvolume %s" "$subvol"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
done < <(find "$1" -xdev -depth -inum 256 -print0)
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue