Merge 5753a3e53d into 7fdcf1bcd2
commit
5085f42570
21
.config
21
.config
|
|
@ -1,6 +1,11 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# The process ID. Do not touch!
|
||||||
|
PID=$$
|
||||||
|
|
||||||
# This is a config file for Linux Live Kit build script.
|
# This is a config file for Linux Live Kit build script.
|
||||||
# You shouldn't need to change anything expect LIVEKITNAME
|
# You shouldn't need to change anything expect LIVEKITNAME
|
||||||
|
# Modified, used by Linux Live Kit Improved.
|
||||||
|
|
||||||
# Live Kit Name. Defaults to 'linux';
|
# Live Kit Name. Defaults to 'linux';
|
||||||
# This will be the name of the directory created on your CD/USB, which
|
# This will be the name of the directory created on your CD/USB, which
|
||||||
|
|
@ -27,16 +32,24 @@ KERNEL=$(uname -r)
|
||||||
# No subdirectories are allowed, no slashes,
|
# No subdirectories are allowed, no slashes,
|
||||||
# so You can't use /var/tmp here for example
|
# so You can't use /var/tmp here for example
|
||||||
# Exclude directories like proc sys tmp
|
# Exclude directories like proc sys tmp
|
||||||
MKMOD="bin etc home lib lib64 opt root sbin srv usr var"
|
MKMOD="bin etc home lib opt root sbin srv usr var"
|
||||||
|
|
||||||
# List of files and directories you'd like to exclude from your Live Kit
|
# List of files and directories you'd like to
|
||||||
|
# exclude from your Live Kit
|
||||||
EXCLUDE="/etc/fstab /etc/mtab"
|
EXCLUDE="/etc/fstab /etc/mtab"
|
||||||
|
|
||||||
# Temporary directory to store livekit filesystem
|
# Temporary directory to store livekit filesystem
|
||||||
LIVEKITDATA=/tmp/$LIVEKITNAME-data-$$
|
LIVEKITDATA=/tmp/$LIVEKITNAME-data-$PID
|
||||||
|
|
||||||
|
# Directory to store all of Live Kit builds
|
||||||
|
BUILD_DIR=/tmp/livekit-build/
|
||||||
|
|
||||||
# Bundle extension, for example 'sb' for .sb extension
|
# Bundle extension, for example 'sb' for .sb extension
|
||||||
BEXT=sb
|
# NOTE: Set to '.bund' extension by default instead of '.sb'
|
||||||
|
BEXT=bund
|
||||||
|
|
||||||
# Directory with kernel .ko modules, can be different in some distros
|
# Directory with kernel .ko modules, can be different in some distros
|
||||||
LMK="lib/modules/$KERNEL"
|
LMK="lib/modules/$KERNEL"
|
||||||
|
|
||||||
|
# Architecture (not needed)
|
||||||
|
ARCH=$(uname -m)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,84 @@
|
||||||
|
About Linux Live Kit Improved
|
||||||
|
===========================================================
|
||||||
|
Linux Live Kit Improved, as the name suggests, is an
|
||||||
|
improved fork of the original Linux Live Kit.
|
||||||
|
Website (the original version): http://linux-live.org/
|
||||||
|
===========================================================
|
||||||
|
This text file combines all documents into one.
|
||||||
|
===========================================================
|
||||||
|
|
||||||
|
1] Boot parameters
|
||||||
|
===========================================================
|
||||||
|
|
||||||
|
These are used by the kernel and the Live Kit
|
||||||
|
system itself.
|
||||||
|
|
||||||
|
You can pass these boot parameters to the bootloader:
|
||||||
|
|
||||||
|
Live Kit parameters:
|
||||||
|
> debug - Start the Live Kit in verbose mode.
|
||||||
|
> dbg_shell - Start the debug shell several times while starting up.
|
||||||
|
> from={n} - Load data from {n}. (will search all devices for the data)
|
||||||
|
> copy2ram - Boot the Live Kit system just as normal, but also copy data to RAM.
|
||||||
|
> perch - Activate persistent changes.
|
||||||
|
|
||||||
|
Kernel parameters:
|
||||||
|
> noapic - Disable APIC (if you want, or maybe if your kernel screams about it!)
|
||||||
|
> acpi=off - Disable ACPI (if you might be still using a legacy system :P)
|
||||||
|
> init={n} - Execute command {n} instead of the init script itself.
|
||||||
|
|
||||||
|
2] Bundles
|
||||||
|
===========================================================
|
||||||
|
|
||||||
|
A bundle is compressed squashfs filesystem, consisting of
|
||||||
|
up-to-the-root directory structure. The older, but still
|
||||||
|
functional predecessor of the bundle is called a 'module'.
|
||||||
|
The bundle is an improved version of the 'module'.
|
||||||
|
|
||||||
|
NOTE:
|
||||||
|
The defaults is 512k, but I opted with 1024k, since
|
||||||
|
my system can handle that load, and I will get a smaller
|
||||||
|
bundule size, which is a !!HUGE!! advantage!
|
||||||
|
And, note: this message is also from the future (2k17!), which means
|
||||||
|
that software has also evolved as the years has passed...
|
||||||
|
'mksquashfs' will go nuts if you supply it with '-bs' instead of '-b'...
|
||||||
|
|
||||||
|
How to make a bundle:
|
||||||
|
# mksquashfs bundle_rootfs wholefs.{bext} -comp xz -b 1024k
|
||||||
|
|
||||||
|
or
|
||||||
|
# mksquashfs /usr /usr.{bext} --keep-as-directory -comp xz -b 1024k
|
||||||
|
|
||||||
|
or use function in livekitlib:
|
||||||
|
# source ./livekitlib; mkbund bundle_rootfs wholefs.{bext}
|
||||||
|
|
||||||
|
3] Supported filesystems
|
||||||
|
===========================================================
|
||||||
|
|
||||||
|
The Live distro created by Linux Live Kit can be installed
|
||||||
|
on the following filesystems:
|
||||||
|
|
||||||
|
+ ISO9660 (CD) - using ISOLinux
|
||||||
|
+ FAT32 (vfat) - using SysLinux or EXTLinux
|
||||||
|
+ NTFS - using SysLinux or EXTLinux
|
||||||
|
+ EXT2/3/4, BTRFS - using EXTLinux
|
||||||
|
+ any other FS - using LILO
|
||||||
|
|
||||||
|
Most users will install on FAT32 for
|
||||||
|
compatibility with any other operating systems.
|
||||||
|
|
||||||
|
4] Terminology
|
||||||
|
=========================================================
|
||||||
|
|
||||||
|
+ This toolkit is based on
|
||||||
|
the original Linux Live Kit. (http://linux-live.org/)
|
||||||
|
|
||||||
|
Extracted from the original terminology.txt:
|
||||||
|
> also known as Linux Live Kit. Formely known as Linux Live CD. Nowadays,
|
||||||
|
> people mostly use USB flash drives, cameras, and other devices to run
|
||||||
|
> such 'Live' linuxes, thus Live CD is no longer ideal name for it.
|
||||||
|
|
||||||
|
> Meaning of Kit is like a tool, toolkit, or such. Which (I believe) corresponds
|
||||||
|
> with the usage of such Live Linux distribution much better.
|
||||||
|
|
||||||
|
|
||||||
342
DOC/LICENSE
342
DOC/LICENSE
|
|
@ -1,13 +1,341 @@
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 2, June 1991
|
||||||
|
|
||||||
License:
|
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||||
|
675 Mass Ave, Cambridge, MA 02139, USA
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
This software is released under GNU GENERAL PUBLIC LICENSE.
|
Preamble
|
||||||
|
|
||||||
Warranty:
|
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 Library General Public License instead.) You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
This software is distributed with NO WARRANTY, use it at your own risk.
|
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.
|
||||||
|
|
||||||
Author:
|
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.
|
||||||
|
|
||||||
This software is written by
|
For example, if you distribute copies of such a program, whether
|
||||||
Tomas M. <http://www.linux-live.org>
|
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) 19yy <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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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) 19yy 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 Library General
|
||||||
|
Public License instead of this License.
|
||||||
|
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
You can pass the following boot parameters:
|
|
||||||
|
|
||||||
debug ... start shell prompt several times during live kit startup
|
|
||||||
|
|
||||||
from=... load data from given directory (search all drives for it)
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
||||||
Bundle
|
|
||||||
------
|
|
||||||
|
|
||||||
A bundle is compressed squashfs filesystem, consisting of up-to-the-root
|
|
||||||
directory structure. Old name for bundle is 'module'. Bundle format
|
|
||||||
brings some new enhancements over the old modules.
|
|
||||||
|
|
||||||
File extension for bundles may vary. Currently Slax uses .sb extension,
|
|
||||||
where 'sb' means 'slax bundle'.
|
|
||||||
|
|
||||||
|
|
||||||
How to create bundle:
|
|
||||||
|
|
||||||
# mksquashfs bundle_rootfs wholefs.sb -comp xz -bs 512k
|
|
||||||
|
|
||||||
or
|
|
||||||
# mksquashfs /usr /usr.sb --keep-as-directory -comp xz -bs 512k
|
|
||||||
|
|
||||||
or use function in livekitlib:
|
|
||||||
# . livekitlib; make_bundle bundle_rootfs wholefs.sb
|
|
||||||
|
|
||||||
|
|
||||||
Special files in bundle filesystem structure:
|
|
||||||
|
|
||||||
|
|
||||||
/run/requires
|
|
||||||
/run/activate.sh
|
|
||||||
/run/deactivate.sh
|
|
||||||
/run/startcmd.sh ?
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
Source code for precompiled binaries (initramfs/static/*) can be found at
|
|
||||||
http://ftp.slax.org/Slax-7.x-development/sources/Slax-7.0-sources/busybox-and-ntfs3g/
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
Supported filesystems
|
|
||||||
---------------------
|
|
||||||
|
|
||||||
The Live distro created by Linux Live Kit can be installed
|
|
||||||
on the following filesystems:
|
|
||||||
|
|
||||||
* iso9660 (CD) ..... using isolinux
|
|
||||||
* FAT32 (vfat) ..... using syslinux or extlinux
|
|
||||||
* ntfs ............. using syslinux or extlinux
|
|
||||||
* ext2/3/4,btrfs ... using extlinux
|
|
||||||
* any other fs ..... using lilo
|
|
||||||
|
|
||||||
Most users will install on FAT32 for compatibility
|
|
||||||
with the other operating systems (I mean Windows).
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
Live Kit
|
|
||||||
--------
|
|
||||||
|
|
||||||
* also known as Linux Live Kit. Formely known as Linux Live CD. Nowadays,
|
|
||||||
people mostly use USB flash drives, cameras, and other devices to run
|
|
||||||
such 'Live' linuxes, thus Live CD is no longer ideal name for it.
|
|
||||||
|
|
||||||
Meaning of Kit is like a tool, toolkit, or such. Which (I believe) corresponds
|
|
||||||
with the usage of such Live Linux distribution much better.
|
|
||||||
|
|
||||||
|
|
||||||
Bundles
|
|
||||||
-------
|
|
||||||
|
|
||||||
* compressed squashfs images with some specialities
|
|
||||||
Read ./bundle.txt for more.
|
|
||||||
|
|
||||||
|
|
||||||
49
README
49
README
|
|
@ -1,49 +0,0 @@
|
||||||
Linux Live Kit
|
|
||||||
==============
|
|
||||||
|
|
||||||
Use this set of scripts to turn your existing preinstalled Linux
|
|
||||||
distribution into a Live Kit (formely known as Live CD).
|
|
||||||
Make sure to extract and use it on a posix-compatible filesystem,
|
|
||||||
since it creates some (sym)links and such.
|
|
||||||
|
|
||||||
* Store Linux Live kit in a directory which is not going to be included
|
|
||||||
in your live distro, else it would be copied to it. Best practice is to
|
|
||||||
make a directory such as /a and put these scripts there.
|
|
||||||
|
|
||||||
* Before you start building your Kit, edit the file ./.config
|
|
||||||
Most importantly change the LIVEKITNAME variable.
|
|
||||||
|
|
||||||
* Make sure your kernel is in /boot/vmlinuz or change the path in ./.config
|
|
||||||
Your kernel must support squashfs and aufs. Debian Jessie's kernel does.
|
|
||||||
|
|
||||||
* You may also wish to replace boot graphics in ./bootfiles/bootlogo.png
|
|
||||||
and reorganize isolinux.cfg to fit your needs (when editing the file,
|
|
||||||
keep all paths in /boot/, it will be rellocated during LiveKit creation)
|
|
||||||
|
|
||||||
* Linux Live Kit comes with precompiled static binaries in ./initramfs
|
|
||||||
directory. Those may be outdated but will work. You may replace them
|
|
||||||
by your own statically linked binaries, if you know how to compile them.
|
|
||||||
|
|
||||||
* If you plan to boot your Live Kit from CD, you need to recompile
|
|
||||||
syslinux.bin else it won't be able to boot your Live Kit from directory
|
|
||||||
LIVEKITNAME. There is a script prepared for you which will handle all
|
|
||||||
of that. Simply go to directory ./tools/ and run isolinux.bin.update ...
|
|
||||||
it will update ./bootfiles/isolinux.bin automatically by downloading
|
|
||||||
isolinux sources, patching them using your actual LIVEKITNAME and
|
|
||||||
recompiling. This step is not needed if you plan to boot from USB only.
|
|
||||||
|
|
||||||
* If you have tmpfs mounted on /tmp, make sure you have enough RAM
|
|
||||||
since LiveKit will store lots of data there. If you are low on RAM,
|
|
||||||
make sure /tmp is a regular on-disk directory.
|
|
||||||
|
|
||||||
* When done, run the ./build script to create your Live Kit
|
|
||||||
- it will create ISO and TAR files for you in /tmp
|
|
||||||
- make sure you have enough free space in /tmp to handle it
|
|
||||||
|
|
||||||
* You will need the following packages to be installed:
|
|
||||||
- squashfs-tools
|
|
||||||
- genisoimage or mkisofs
|
|
||||||
- zip
|
|
||||||
|
|
||||||
|
|
||||||
Author: Tomas M. <http://www.linux-live.org>
|
|
||||||
|
|
@ -0,0 +1,79 @@
|
||||||
|
## Linux Live Kit Improved.
|
||||||
|
This set of scripts will help you to
|
||||||
|
build your own Live Kit distro. This project is based on
|
||||||
|
the original Linux Live Kit. <http://linux-live.org>
|
||||||
|
|
||||||
|
|
||||||
|
## You will need to have the following installed:
|
||||||
|
* squashfs-tools
|
||||||
|
* genisoimage and/or mkisofs (optional)
|
||||||
|
* zip
|
||||||
|
|
||||||
|
## Before you build:
|
||||||
|
|
||||||
|
- Store Linux Live Kit in a directory which is not going to be included
|
||||||
|
in your live distro, else it would be copied to it.
|
||||||
|
The best practice is to make a directory such
|
||||||
|
as for example: '/tmp/a', and put all the files there.
|
||||||
|
|
||||||
|
Make sure to extract and use it on a POSIX-compatible
|
||||||
|
filesystem (for ex: EXT4), since it will create symlinks
|
||||||
|
and such that might not be compatible in for example: FAT
|
||||||
|
and such other filesystems.
|
||||||
|
|
||||||
|
- Before you start building your Live Kit, please consider
|
||||||
|
editing the ./.config file, and tweak it to suit your needs.
|
||||||
|
Most importantly, change the LIVEKITNAME variable.
|
||||||
|
|
||||||
|
- Make sure you are pointing to the right kernel. If in doubt,
|
||||||
|
change the path in ./.config. Your kernel must support both
|
||||||
|
SquashFS and AUFS, or else you will get an error both while
|
||||||
|
building, and when you actually boot your Live Kit.
|
||||||
|
|
||||||
|
On most Linux distro-s, the kernel is in /vmlinuz, a
|
||||||
|
symlink to /boot/vmlinuz-* or even /boot/vmlinux-*
|
||||||
|
|
||||||
|
|
||||||
|
Debian Jessie's kernel supports both AUFS and SquashFS out-of-the-box.
|
||||||
|
It's recommended to use Debian Jessie as the base OS, but the choice is yours.
|
||||||
|
|
||||||
|
- It's recommended to replace boot background in
|
||||||
|
bootfiles/bootpic.png and edit syslinux.cfg to fit your needs.
|
||||||
|
|
||||||
|
When editing the configuration file, make sure to keep all paths
|
||||||
|
pointing to /boot/, since it will be replaced to /LIVEKITNAME/boot/
|
||||||
|
during the build session.
|
||||||
|
|
||||||
|
- Linux Live Kit comes with precompiled static binaries in ./initramfs
|
||||||
|
directory. Those may be outdated but will work. You may replace them
|
||||||
|
by your own statically linked binaries, if you know how to compile them.
|
||||||
|
|
||||||
|
- If you want to boot your Live Kit from a CD, you'll need to recompile
|
||||||
|
syslinux.bin and/or isolinux.bin else it won't be able to boot
|
||||||
|
your Live Kit from directory "/LIVEKITNAME".
|
||||||
|
|
||||||
|
There is a script prepared for you which will do all of the building.
|
||||||
|
Simply go to directory ./tools/ and run isolinux.bin-update, it will rebuild
|
||||||
|
isolinux.bin automatically by downloading SysLinux sources, patching them using
|
||||||
|
your actual LIVEKITNAME and recompiling. This step is not needed if you only need
|
||||||
|
the ZIP archive version.
|
||||||
|
|
||||||
|
- If you have tmpfs mounted on /tmp, make sure you have enough (or maybe even
|
||||||
|
a lot of) RAM, since Live Kit will store lots of data to the target.
|
||||||
|
If you don't have enough (or even went out of) RAM, make sure
|
||||||
|
that /tmp is a regular on-disk directory.
|
||||||
|
|
||||||
|
- If you want to include your own bundules, then the 'include\_bund/' directory
|
||||||
|
might come in handy! Just make sure that the file extension will match
|
||||||
|
with your chosen .BEXT extension.
|
||||||
|
|
||||||
|
When you're ready, run the ./build script to build your Live Kit Distro.
|
||||||
|
The script will:
|
||||||
|
+ Build both ISO and ZIP files for you in /tmp
|
||||||
|
+ Do all the hard work for you.
|
||||||
|
+ Will automatically check for errors.
|
||||||
|
+ Will warn you if you don't have the correct packages.
|
||||||
|
|
||||||
|
NOTE:
|
||||||
|
WHEN YOU DOWNLOAD THIS KIT, MAKE SURE THAT ./build AND ./livekitlib IS
|
||||||
|
EXECUTABLE!
|
||||||
3
TODO
3
TODO
|
|
@ -1,3 +1,4 @@
|
||||||
* copy DOC/* to Live Kit created
|
* copy DOC/* to Live Kit created
|
||||||
* describe meaning of special files in bundles
|
* describe meaning of special files in bundles
|
||||||
* PXE should include all possible .ko dependencies else some of the ethernet modules won't work, like b44.ko
|
* PXE should include all possible .ko dependencies else some of the
|
||||||
|
networking modules won't work, like b44.ko
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
theme: jekyll-theme-modernist
|
||||||
|
|
@ -0,0 +1,59 @@
|
||||||
|
@echo off
|
||||||
|
cls
|
||||||
|
|
||||||
|
set DISK=none
|
||||||
|
set TESTFILE=testfile.tmp
|
||||||
|
|
||||||
|
echo This file is used to determine current drive letter. It should be deleted. >\%TESTFILE%
|
||||||
|
if not exist \%TESTFILE% goto readOnly
|
||||||
|
|
||||||
|
echo Determining drive letter...
|
||||||
|
for %%d in ( C D E F G H I J K L M N O P Q R S T U V W X Y Z ) do if exist %%d:\%TESTFILE% set DISK=%%d
|
||||||
|
del \%TESTFILE%
|
||||||
|
if %DISK% == none goto DiskNotFound
|
||||||
|
|
||||||
|
rem User prompt
|
||||||
|
rem ============ BEGIN USER PROMPT ============
|
||||||
|
cls
|
||||||
|
echo ===========================================================
|
||||||
|
echo Boot setup: MyLinux
|
||||||
|
echo ===========================================================
|
||||||
|
echo Drive letter: %DISK%
|
||||||
|
echo ===========================================================
|
||||||
|
echo Thank you for choosing MyLinux!
|
||||||
|
echo Just make sure this is not your C: drive, or else
|
||||||
|
echo your OS (that is, Windows) will not boot!
|
||||||
|
echo.
|
||||||
|
echo Press any key to continue or press Ctrl-C to cancel...
|
||||||
|
pause >nul
|
||||||
|
rem ============ END USER PROMPT ============
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo Setting up boot record for %DISK%: Please wait...
|
||||||
|
|
||||||
|
if %OS% == Windows_NT goto setupNT
|
||||||
|
goto setup95
|
||||||
|
|
||||||
|
:setupNT
|
||||||
|
\boot\syslinux.exe -maf -d /boot/ %DISK%:
|
||||||
|
goto setupDone
|
||||||
|
|
||||||
|
:setup95
|
||||||
|
\boot\syslinux.com -maf -d /boot/ %DISK%:
|
||||||
|
|
||||||
|
:setupDone
|
||||||
|
echo Bootloader installation finished!
|
||||||
|
goto pauseit
|
||||||
|
|
||||||
|
:readOnly
|
||||||
|
echo Error: BootInstall.bat started from read-only media!
|
||||||
|
goto pauseit
|
||||||
|
|
||||||
|
:DiskNotFound
|
||||||
|
echo Error: Drive letter is non-existant!
|
||||||
|
|
||||||
|
:pauseit
|
||||||
|
echo Press any key to exit...
|
||||||
|
pause > nul
|
||||||
|
|
||||||
|
:end
|
||||||
|
|
@ -0,0 +1,117 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# Setup booting from disk (USB or harddrive)
|
||||||
|
# Requires: fdisk, df, tail, tr, cut, dd, sed
|
||||||
|
|
||||||
|
# Make sure that we are root
|
||||||
|
if [ $(id -u) -ne 0 ]; then
|
||||||
|
echo "> $(basename $0): Must be root to install bootloader!" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# change working directory to dir from which we are started
|
||||||
|
CWD="$(pwd)"
|
||||||
|
BOOT="$(dirname "$0")"
|
||||||
|
cd "$BOOT"
|
||||||
|
|
||||||
|
# Program definitions
|
||||||
|
INST_NAME=`basename $0`
|
||||||
|
INST_PID=$$
|
||||||
|
LOGFILE="/tmp/$INST_NAME-$INST_PID.log"
|
||||||
|
|
||||||
|
# find out device and mountpoint
|
||||||
|
PART="$(df . | tail -n 1 | tr -s " " | cut -d " " -f 1)"
|
||||||
|
DEV="$(echo "$PART" | sed -r "s:[0-9]+\$::" | sed -r "s:([0-9])[a-z]+\$:\\1:i")" #"
|
||||||
|
|
||||||
|
# Try to use installed extlinux binary and
|
||||||
|
# fallback to extlinux.exe only if no installed
|
||||||
|
# extlinux is not found at all.
|
||||||
|
EXTLINUX="$(which extlinux 2>/dev/null)"
|
||||||
|
|
||||||
|
if [ -z "$EXTLINUX" ]; then
|
||||||
|
echo "> Falling back to included EXTLinux program..." >&2
|
||||||
|
EXTLINUX="./extlinux.exe"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Prompt user
|
||||||
|
#
|
||||||
|
clear
|
||||||
|
echo " +-+-+-+-+-+-+-+-+-+-+============+-+-+-+-+-+-+-+-+-+-+-+ "
|
||||||
|
echo " Boot setup: MyLinux"
|
||||||
|
echo " +-+-+-+-+-+-+-+-+-+-+============+-+-+-+-+-+-+-+-+-+-+-+ "
|
||||||
|
echo " Current device: $DEV"
|
||||||
|
echo " Current partition: $PART"
|
||||||
|
echo " +-+-+-+-+-+-+-+-+-=+-+-+-+>--<+-+-+-+=-+-+-+-+-+-+-+-+-+ "
|
||||||
|
echo " Thank you for choosing MyLinux!"
|
||||||
|
echo " Are you sure that you wanna install MyLinux on"
|
||||||
|
echo " this device? Make sure that you are not installing on"
|
||||||
|
echo " your local drive!"
|
||||||
|
echo " +-+-+-+-+-+-+-+-+-=+-+-+-+>--<+-+-+-+=-+-+-+-+-+-+-+-+-+ "
|
||||||
|
echo " Just press 'Enter' to continue or press Ctrl-C"
|
||||||
|
echo " to cancel the installation..."
|
||||||
|
read -p ' What are you waiting for... ' junk
|
||||||
|
|
||||||
|
# If he/she continues, check which disk are we on
|
||||||
|
if [ "$DEV" = "/dev/sda" ] || [ "$DEV" = "/dev/hda" ]; then
|
||||||
|
WARN_DISK=0
|
||||||
|
else
|
||||||
|
WARN_DISK=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $WARN_DISK -eq 0 ]; then
|
||||||
|
# APT-like danger prompt
|
||||||
|
CONFIRM_TEXT="Yes, do as I say!"
|
||||||
|
|
||||||
|
echo "> Current partition: $PART" >&2
|
||||||
|
echo "> You are about to do something " >&2
|
||||||
|
echo "> dangerous to your system!" >&2
|
||||||
|
echo "> Type in to continue: 'Yes, do as I say!'"
|
||||||
|
|
||||||
|
read -p " ?] " CONFIRM
|
||||||
|
|
||||||
|
if test "$CONFIRM" != "$CONFIRM_TEXT"; then
|
||||||
|
echo "> Incorrect phrase!" >&2
|
||||||
|
echo "> No changes were made!" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo
|
||||||
|
|
||||||
|
# notify user
|
||||||
|
echo "> WARNING: Do not interrupt at this stage!" >&2
|
||||||
|
echo "> Installing EXTLinux bootloader: Please wait..." >&2
|
||||||
|
|
||||||
|
# install bootloader
|
||||||
|
"$EXTLINUX" --install "$BOOT" 2>&1 | tee $LOGFILE | cat >&2
|
||||||
|
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "> Failed to install boot loader!" >&2
|
||||||
|
echo "> Please read the errors above (and/or" >&2
|
||||||
|
echo "> consult the logfile at /tmp) and press Enter to exit." >&2
|
||||||
|
read junk
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "> Installation of EXTLinux bootloader was successful!"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "> Initialising new MBR..." >&2
|
||||||
|
|
||||||
|
# MBR
|
||||||
|
if [ "$DEV" != "$PART" ]; then
|
||||||
|
# Setup MBR on the first block
|
||||||
|
dd bs=440 count=1 conv=notrunc if="$BOOT/mbr.bin" of="$DEV" 2>/dev/null
|
||||||
|
|
||||||
|
# Toggle a bootable flag
|
||||||
|
PART="$(echo "$PART" | sed -r "s:.*[^0-9]::")"
|
||||||
|
(
|
||||||
|
fdisk -l "$DEV" | fgrep "*" | fgrep "$DEV" | cut -d " " -f 1 \
|
||||||
|
| sed -r "s:.*[^0-9]::" | xargs -I '{}' echo -ne "a\n{}\n"
|
||||||
|
echo a
|
||||||
|
echo $PART
|
||||||
|
echo w
|
||||||
|
) | fdisk $DEV >/dev/null 2>&1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Bootloader installation finished."
|
||||||
|
cd "$CWD"
|
||||||
|
|
@ -1,47 +0,0 @@
|
||||||
@echo off
|
|
||||||
cls
|
|
||||||
echo ===============================================================================
|
|
||||||
echo Setting your drive to boot
|
|
||||||
echo ===============================================================================
|
|
||||||
echo.
|
|
||||||
|
|
||||||
set DISK=none
|
|
||||||
set BOOTFLAG=boot666s.tmp
|
|
||||||
|
|
||||||
echo This file is used to determine current drive letter. It should be deleted. >\%BOOTFLAG%
|
|
||||||
if not exist \%BOOTFLAG% goto readOnly
|
|
||||||
|
|
||||||
echo wait please ...
|
|
||||||
for %%d in ( C D E F G H I J K L M N O P Q R S T U V W X Y Z ) do if exist %%d:\%BOOTFLAG% set DISK=%%d
|
|
||||||
del \%BOOTFLAG%
|
|
||||||
if %DISK% == none goto DiskNotFound
|
|
||||||
|
|
||||||
echo.
|
|
||||||
echo Setting up boot record for %DISK%:, wait please...
|
|
||||||
|
|
||||||
if %OS% == Windows_NT goto setupNT
|
|
||||||
goto setup95
|
|
||||||
|
|
||||||
:setupNT
|
|
||||||
\boot\syslinux.exe -maf -d /boot/ %DISK%:
|
|
||||||
goto setupDone
|
|
||||||
|
|
||||||
:setup95
|
|
||||||
\boot\syslinux.com -maf -d /boot/ %DISK%:
|
|
||||||
|
|
||||||
:setupDone
|
|
||||||
echo Installation finished.
|
|
||||||
goto pauseit
|
|
||||||
|
|
||||||
:readOnly
|
|
||||||
echo You're starting boot installer from a read-only media, this will not work.
|
|
||||||
goto pauseit
|
|
||||||
|
|
||||||
:DiskNotFound
|
|
||||||
echo Error: can't find out current drive letter
|
|
||||||
|
|
||||||
:pauseit
|
|
||||||
echo Press any key to exit...
|
|
||||||
pause > nul
|
|
||||||
|
|
||||||
:end
|
|
||||||
|
|
@ -1,47 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
# Setup booting from disk (USB or harddrive)
|
|
||||||
# Requires: fdisk, df, tail, tr, cut, dd, sed
|
|
||||||
|
|
||||||
# change working directory to dir from which we are started
|
|
||||||
CWD="$(pwd)"
|
|
||||||
BOOT="$(dirname "$0")"
|
|
||||||
cd "$BOOT"
|
|
||||||
|
|
||||||
# find out device and mountpoint
|
|
||||||
PART="$(df . | tail -n 1 | tr -s " " | cut -d " " -f 1)"
|
|
||||||
DEV="$(echo "$PART" | sed -r "s:[0-9]+\$::" | sed -r "s:([0-9])[a-z]+\$:\\1:i")" #"
|
|
||||||
|
|
||||||
# Try to use installed extlinux binary and fallback to extlinux.exe only
|
|
||||||
# if no installed extlinux is not found at all.
|
|
||||||
EXTLINUX="$(which extlinux 2>/dev/null)"
|
|
||||||
if [ "$EXTLINUX" = "" ]; then
|
|
||||||
EXTLINUX="./extlinux.exe"
|
|
||||||
fi
|
|
||||||
|
|
||||||
"$EXTLINUX" --install "$BOOT"
|
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "Error installing boot loader."
|
|
||||||
echo "Read the errors above and press enter to exit..."
|
|
||||||
read junk
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
if [ "$DEV" != "$PART" ]; then
|
|
||||||
# Setup MBR on the first block
|
|
||||||
dd bs=440 count=1 conv=notrunc if="$BOOT/mbr.bin" of="$DEV" 2>/dev/null
|
|
||||||
|
|
||||||
# Toggle a bootable flag
|
|
||||||
PART="$(echo "$PART" | sed -r "s:.*[^0-9]::")"
|
|
||||||
(
|
|
||||||
fdisk -l "$DEV" | fgrep "*" | fgrep "$DEV" | cut -d " " -f 1 \
|
|
||||||
| sed -r "s:.*[^0-9]::" | xargs -I '{}' echo -ne "a\n{}\n"
|
|
||||||
echo a
|
|
||||||
echo $PART
|
|
||||||
echo w
|
|
||||||
) | fdisk $DEV >/dev/null 2>&1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Boot installation finished."
|
|
||||||
cd "$CWD"
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 7.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 60 KiB |
|
|
@ -1,18 +1,17 @@
|
||||||
UI /boot/vesamenu.c32
|
UI /boot/vesamenu.c32
|
||||||
|
TIMEOUT 100
|
||||||
TIMEOUT 140
|
|
||||||
MENU ROWS 4
|
|
||||||
|
|
||||||
MENU CLEAR
|
MENU CLEAR
|
||||||
MENU BACKGROUND /boot/bootlogo.png
|
MENU ROWS 8
|
||||||
|
MENU BACKGROUND /boot/bootpic.png
|
||||||
|
DEFAULT main
|
||||||
|
|
||||||
LABEL default
|
LABEL main
|
||||||
MENU LABEL Run Linux
|
MENU LABEL Run MyLinux
|
||||||
KERNEL /boot/vmlinuz
|
KERNEL /boot/vmlinuz
|
||||||
APPEND vga=769 initrd=/boot/initrfs.img load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0
|
APPEND vga=normal initrd=/boot/initramfs.img load_ramdisk=1 rw printk.time=0
|
||||||
|
|
||||||
LABEL default
|
LABEL debug
|
||||||
MENU LABEL Run Linux debug
|
MENU LABEL Run MyLinux (debug)
|
||||||
KERNEL /boot/vmlinuz
|
KERNEL /boot/vmlinuz
|
||||||
APPEND vga=769 initrd=/boot/initrfs.img load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 debug
|
APPEND vga=normal initrd=/boot/initramfs.img load_ramdisk=1 rw printk.time=0 debug
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
#
|
#
|
||||||
# Lines containing # are ignored
|
# Lines containing # are ignored
|
||||||
#
|
#
|
||||||
|
|
||||||
Thank you for using mylinux!
|
Thank you for using mylinux!
|
||||||
Steps to make it bootable from your USB device:
|
Steps to make it bootable from your USB device:
|
||||||
|
|
||||||
|
|
|
||||||
244
build
244
build
|
|
@ -1,87 +1,231 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Linux Live Kit version 7
|
|
||||||
|
|
||||||
export PATH=.:./tools:../tools:/usr/sbin:/usr/bin:/sbin:/bin:/
|
# Linux Live Kit Improved v1.0
|
||||||
|
# Original version: Linux Live Kit version 7
|
||||||
|
# Modified/improved by: @johndah4x0r [terencedoesmc12 AT gmail DOT com]
|
||||||
|
|
||||||
CHANGEDIR=$(dirname $(readlink -f $0))
|
# Environment path
|
||||||
echo "Changing current directory to $CHANGEDIR"
|
export PATH="${PATH}:.:./tools:../tools"
|
||||||
CWD="$(pwd)"
|
source ./.config || exit 1
|
||||||
cd $CHANGEDIR
|
source ./livekitlib || exit 1
|
||||||
|
|
||||||
. ./.config || exit 1
|
|
||||||
. ./livekitlib || exit 1
|
|
||||||
|
|
||||||
# only root can continue, because only root can read all files from your system
|
# only root can continue, because only root can read all files from your system
|
||||||
allow_only_root
|
allow_only_root
|
||||||
|
|
||||||
# check for mksquashfs with xz compression
|
# Change directory to build environment
|
||||||
if [ "$(mksquashfs 2>&1 | grep "Xdict-size")" = "" ]; then
|
CHANGEDIR="$(dirname $0)"
|
||||||
echo "mksquashfs not found or doesn't support -comp xz, aborting, no changes made"
|
echo "Changing current directory to $CHANGEDIR"
|
||||||
echo "you may consider installing squashfs-tools package"
|
CWD="$(pwd)"
|
||||||
|
cd "$CHANGEDIR"
|
||||||
|
|
||||||
|
|
||||||
|
# It's building time!
|
||||||
|
clear
|
||||||
|
|
||||||
|
echo_sign "BUILD SCRIPT"
|
||||||
|
echo_livekit_msg "build: Doing a self-check..."
|
||||||
|
|
||||||
|
# Start with 0 errors
|
||||||
|
ERRS=0
|
||||||
|
|
||||||
|
# Check if mksquashfs supports XZ compression
|
||||||
|
if [ -z "$(mksquashfs 2>&1 | grep "Xdict-size")" ]; then
|
||||||
|
echo_err "build: 'mksquashfs': not-avail / not-supported"
|
||||||
|
(( ERRS+=1 ))
|
||||||
|
else
|
||||||
|
echo_livekit_msg "build: 'mksquashfs': avail + supported"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if either 'mkisofs' or 'genisoimage' exists
|
||||||
|
MKISOFS="$(which mkisofs 2>/dev/null || \
|
||||||
|
which genisoimage 2>/dev/null)"
|
||||||
|
if [ -z "$MKISOFS" ]; then
|
||||||
|
echo_err "build: 'mkisofs' / 'genisoimage': not-avail"
|
||||||
|
|
||||||
|
# Hahaha! 'false'?!?!?
|
||||||
|
MKISOFS="false"
|
||||||
|
else
|
||||||
|
echo_livekit_msg "build: '$(basename $MKISOFS)': avail"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if we have 'zip'
|
||||||
|
ZIP_CMD="$(which zip 2>/dev/null)"
|
||||||
|
if [ -z "$ZIP_CMD" ]; then
|
||||||
|
# since a ZIP archive is the core, we have to go to fatal mode!
|
||||||
|
echo_fatal "build: 'zip': not-avail"
|
||||||
|
echo_fatal "build: 'zip': Critically needed!"
|
||||||
|
(( ERRS+= 2 ))
|
||||||
|
else
|
||||||
|
echo_livekit_msg "build: 'zip': avail"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if [ $ERRS -eq 0 ]; then
|
||||||
|
echo_livekit_msg "build: Problems found: $ERRS"
|
||||||
|
echo_livekit_msg "build: Self-check passed."
|
||||||
|
else
|
||||||
|
echo_err "build: Problems found: $ERRS"
|
||||||
|
echo_err "build: Self-check failed!"
|
||||||
|
echo_err "build: Please make sure that you have all needed packages installed!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
MKISOFS=$(which mkisofs)
|
echo_livekit_msg "build: Preparing to build..."
|
||||||
if [ "$MKISOFS" = "" ]; then
|
clear
|
||||||
MKISOFS=$(which genisoimage)
|
|
||||||
fi
|
echo " ==========================================="
|
||||||
if [ "$MKISOFS" = "" ]; then
|
echo " Linux Live Kit version 2.0 (improved)"
|
||||||
echo "Cannot found mkisofs or genisoimage, stop"
|
echo " ==========================================="
|
||||||
exit 3
|
echo " Live Kit information:"
|
||||||
fi
|
echo " > Kernel version: $KERNEL"
|
||||||
|
echo " > Architecture: $ARCH"
|
||||||
|
echo " > Live Kit name: $LIVEKITNAME"
|
||||||
|
echo " > Bundle extension: '.$BEXT'"
|
||||||
|
|
||||||
|
read -p "Press Enter to continue or press Ctrl-C to cancel... " junk
|
||||||
|
|
||||||
|
# It's time to rock 'n roll!
|
||||||
|
clear
|
||||||
|
|
||||||
|
# Generate initramfs image (cpio-xz archive)
|
||||||
|
echo_livekit_msg "build: Generating initramfs CPIO-XZ image..."
|
||||||
|
|
||||||
# build initramfs image
|
|
||||||
echo "Building intramfs image..."
|
|
||||||
cd initramfs
|
cd initramfs
|
||||||
INITRAMFS=$(./initramfs_create "$LIVEKITNAME")
|
INITRAMFS="$(./gen-initramfs "$LIVEKITNAME")"
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
# create live kit filesystem (cpio archive)
|
# Prepare the Live Kit archive
|
||||||
rm -Rf "$LIVEKITDATA"
|
rm -Rf "$LIVEKITDATA"
|
||||||
|
echo_livekit_msg "build: Preparing boot files..."
|
||||||
BOOT="$LIVEKITDATA"/"$LIVEKITNAME"/boot
|
BOOT="$LIVEKITDATA"/"$LIVEKITNAME"/boot
|
||||||
mkdir -p "$BOOT"
|
mkdir -p "$BOOT"
|
||||||
mkdir -p "$BOOT"/../changes
|
mkdir -p "$BOOT"/../changes
|
||||||
mkdir -p "$BOOT"/../modules
|
mkdir -p "$BOOT"/../bundles
|
||||||
mv "$INITRAMFS" $BOOT/initrfs.img
|
mv "$INITRAMFS" $BOOT/initramfs.img
|
||||||
cp bootfiles/* $BOOT
|
cp bootfiles/* $BOOT
|
||||||
cat bootfiles/syslinux.cfg | sed -r "s:/boot/:/$LIVEKITNAME/boot/:" > $BOOT/syslinux.cfg
|
|
||||||
cat bootfiles/bootinst.bat | sed -r "s:/boot/:/$LIVEKITNAME/boot/:" | sed -r "s:\\\\boot\\\\:\\\\$LIVEKITNAME\\\\boot\\\\:" > $BOOT/bootinst.bat
|
# do substitution
|
||||||
|
cat bootfiles/syslinux.cfg | sed -r "s:/boot/:/$LIVEKITNAME/boot/:" | \
|
||||||
|
sed -r "s:MyLinux:$LIVEKITNAME:" > $BOOT/syslinux.cfg
|
||||||
|
|
||||||
|
echo_livekit_msg "build: BootInstall.*: Replacing 'MyLinux' with '$LIVEKITNAME'..."
|
||||||
|
cat bootfiles/BootInstall.bat | sed -r "s:/boot/:/$LIVEKITNAME/boot/:" | \
|
||||||
|
sed -r "s:\\\\boot\\\\:\\\\$LIVEKITNAME\\\\boot\\\\:" | fgrep -iv "rem" | \
|
||||||
|
sed -r "s:MyLinux:$LIVEKITNAME:" > $BOOT/BootInstall.bat
|
||||||
|
cat bootfiles/BootInstall.sh | sed -r "s:MyLinux:$LIVEKITNAME:" > $BOOT/BootInstall.sh
|
||||||
|
|
||||||
|
echo_livekit_msg "build: Copying kernel..."
|
||||||
cp $VMLINUZ $BOOT/
|
cp $VMLINUZ $BOOT/
|
||||||
|
|
||||||
if [ -d sb ]; then
|
# Copy files from include_bund/, but
|
||||||
cp sb/* $LIVEKITDATA/$LIVEKITNAME/
|
# do not skip bundle creation
|
||||||
else
|
#
|
||||||
# create compressed bundles
|
if [ -n "$(ls -A include_bund/ | grep ".$BEXT")" ]; then
|
||||||
for i in $MKMOD; do
|
echo_livekit_msg "build: Copying bundles from include_bund/ ..."
|
||||||
mksquashfs /$i $LIVEKITDATA/$LIVEKITNAME/$i.$BEXT -comp xz -b 512k -keep-as-directory
|
ls -A include_bund/ | grep ".$BEXT" | \
|
||||||
|
while read BUND; do
|
||||||
|
cp $BUND "$LIVEKITDATA"/"$LIVEKITNAME"/bundles/
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# create compressed bundles
|
||||||
|
for i in $MKMOD; do
|
||||||
|
CMDOPT="$(get_exclude "$EXCLUDE" $i)"
|
||||||
|
echolog "CMDOPT = $CMDOPT" >&2
|
||||||
|
mkbund /$i $LIVEKITDATA/$LIVEKITNAME/00-main-$i.$BEXT \
|
||||||
|
-keep-as-directory $CMDOPT
|
||||||
|
done
|
||||||
|
|
||||||
# copy rootcopy folder
|
# copy rootcopy folder
|
||||||
if [ -d rootcopy ]; then
|
if [ -d rootcopy/ ]; then
|
||||||
cp -a rootcopy $LIVEKITDATA/$LIVEKITNAME/
|
echo_livekit_msg "build: Copying contents of rootcopy/..."
|
||||||
|
cp -a rootcopy/ $LIVEKITDATA/$LIVEKITNAME/
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# create ISO for CD image
|
|
||||||
echo "Creating ISO file for CD boot..."
|
|
||||||
cd "$LIVEKITDATA"
|
|
||||||
TARGET=/mnt/z
|
TARGET=/mnt/z
|
||||||
if [ ! -d $TARGET ]; then
|
if [ ! -d $TARGET ]; then
|
||||||
TARGET=/tmp
|
TARGET=/tmp/livekit-build/
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ARCH=$(uname -m)
|
if [ ! -d $TARGET ]; then
|
||||||
|
mkdir -p $TARGET &>/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
$MKISOFS -o "$TARGET/$LIVEKITNAME-$ARCH.iso" -v -J -R -D -A "$LIVEKITNAME" -V "$LIVEKITNAME" \
|
# Output file
|
||||||
|
OUT_FILE="$LIVEKITNAME-$ARCH-$PID"
|
||||||
|
|
||||||
|
# Checksum file
|
||||||
|
SUM_FILE="$TARGET/CHECKSUMS-${OUT_FILE}.TXT"
|
||||||
|
|
||||||
|
# Go to Live Kit build data
|
||||||
|
cd "$LIVEKITDATA"
|
||||||
|
|
||||||
|
# Create ISO image
|
||||||
|
echo_livekit_msg "build: Creating ISO file for CD boot..."
|
||||||
|
|
||||||
|
# How the F@-- can it be more compact than this!?!?
|
||||||
|
"$MKISOFS" -o "$TARGET/$OUT_FILE.iso" -v -J \
|
||||||
|
-R -D -A "$LIVEKITNAME" -V "$LIVEKITNAME" \
|
||||||
-no-emul-boot -boot-info-table -boot-load-size 4 \
|
-no-emul-boot -boot-info-table -boot-load-size 4 \
|
||||||
-b "$LIVEKITNAME"/boot/isolinux.bin -c "$LIVEKITNAME"/boot/isolinux.boot . \
|
-b "$LIVEKITNAME"/boot/isolinux.bin -c \
|
||||||
>/dev/null 2>/dev/null
|
"$LIVEKITNAME"/boot/isolinux.boot . &>/dev/null
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo_warn "build: Failed to generate ISO image!"
|
||||||
|
SCAN=
|
||||||
|
else
|
||||||
|
echo_livekit_msg "build: ISO image: $OUT_FILE.iso"
|
||||||
|
SCAN=1
|
||||||
|
fi
|
||||||
|
|
||||||
cat "$CWD/bootinfo.txt" | fgrep -v "#" | sed -r "s/mylinux/$LIVEKITNAME/" | sed -r "s/\$/
/" > readme.txt
|
# Substitute 'mylinux' with $LIVEKITNAME
|
||||||
echo "Creating ZIP for USB boot..."
|
cat "$CWD/bootinfo.txt" | fgrep -v "#" | \
|
||||||
rm -f "$TARGET/$LIVEKITNAME-$ARCH.zip"
|
sed -r "s/mylinux/$LIVEKITNAME/" | sed -r "s/\$//" > readme.txt
|
||||||
zip -0 -r "$TARGET/$LIVEKITNAME-$ARCH.zip" *
|
|
||||||
|
|
||||||
|
# Create ZIP archive for "universal" use
|
||||||
|
echo_livekit_msg "build: Creating ZIP for USB boot..."
|
||||||
|
rm -f "$TARGET/$OUT_FILE.zip"
|
||||||
|
zip -0 -r "$TARGET/$OUT_FILE.zip" * &>/dev/null
|
||||||
|
echo_livekit_msg "build: Output file: $OUT_FILE.zip"
|
||||||
|
|
||||||
|
echo_livekit_msg "build: Cleaning up..."
|
||||||
cd ..
|
cd ..
|
||||||
rm -Rf "$LIVEKITDATA"
|
rm -Rf "$LIVEKITDATA"
|
||||||
echo "finished. Find your result in $TARGET"
|
|
||||||
|
# just for aesthetics
|
||||||
|
echo_livekit_msg "build: Process ID: $PID - Your results is in $TARGET"
|
||||||
|
|
||||||
|
# Generate checksum(s)
|
||||||
|
echo_livekit_msg "build: Generating MD5 checksums: Please wait..."
|
||||||
|
|
||||||
|
if [ "$SCAN" ]; then
|
||||||
|
MD5_ISO="$(md5sum $TARGET/$OUT_FILE.iso 2>/dev/null | cut -d ' ' -f 1)"
|
||||||
|
else
|
||||||
|
MD5_ISO="< FAILED TO GENERATE ISO IMAGE! >"
|
||||||
|
fi
|
||||||
|
|
||||||
|
MD5_ZIP="$(md5sum $TARGET/$OUT_FILE.zip 2>/dev/null | cut -d ' ' -f 1)"
|
||||||
|
|
||||||
|
cat >"$SUM_FILE" <<EOF
|
||||||
|
Linux Live Kit Improved
|
||||||
|
----------------------------------------
|
||||||
|
Date: `date`
|
||||||
|
Process ID: $PID
|
||||||
|
Live Kit name: $LIVEKITNAME
|
||||||
|
MD5 Checksums for this build:
|
||||||
|
+ $OUT_FILE.iso - $MD5_ISO
|
||||||
|
+ $OUT_FILE.zip - $MD5_ZIP
|
||||||
|
|
||||||
|
Have a nice day!
|
||||||
|
EOF
|
||||||
|
|
||||||
|
echo_livekit_msg "build: $OUT_FILE.iso: $MD5_ISO"
|
||||||
|
echo_livekit_msg "build: $OUT_FILE.zip: $MD5_ZIP"
|
||||||
|
|
||||||
|
# Done!
|
||||||
|
echo_livekit_msg "Build process finished!"
|
||||||
|
echo "Have a nice day!"
|
||||||
|
|
||||||
|
|
||||||
|
read -p "Press Enter to continue..." junk
|
||||||
|
cd "$CWD"
|
||||||
|
clear
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Create initramfs image
|
# Generate initramfs image
|
||||||
# Author: Tomas M <http://www.linux-live.org/>
|
# Original author: Tomas M <http://www.linux-live.org/>
|
||||||
#
|
# Modified by: 'JohnDaH4x0r' [terencedoesmc12 AT gmail DOT com]
|
||||||
|
|
||||||
. ../.config
|
source ../.config
|
||||||
|
|
||||||
INITRAMFS=/tmp/$LIVEKITNAME-initramfs-$$
|
INITRAMFS=/tmp/$LIVEKITNAME-initramfs-$PID
|
||||||
|
|
||||||
# copy file to initramfs tree, including
|
# copy file to initramfs tree, including
|
||||||
# all library dependencies (as shown by ldd)
|
# all library dependencies (as shown by ldd)
|
||||||
|
|
@ -42,7 +42,9 @@ copy_including_deps()
|
||||||
}
|
}
|
||||||
|
|
||||||
rm -Rf $INITRAMFS
|
rm -Rf $INITRAMFS
|
||||||
mkdir -p $INITRAMFS/{bin,dev,etc,lib,lib64,mnt,proc,root,run,sys,tmp,usr,var/log}
|
|
||||||
|
# NEW: lib64 might be unnecessary to include.
|
||||||
|
mkdir -p $INITRAMFS/{bin,dev,etc,lib,mnt,proc,root,run,sys,tmp,usr,var/log}
|
||||||
ln -s bin $INITRAMFS/sbin
|
ln -s bin $INITRAMFS/sbin
|
||||||
|
|
||||||
cd static
|
cd static
|
||||||
|
|
@ -1,55 +1,93 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# Initial script for Linux Live Kit
|
# Initial script for Linux Live Kit / Linux Live Kit Improved
|
||||||
# Author: Tomas M <http://www.linux-live.org/>
|
# Modified by: "JohnDaH4x0r" <terencedoesmc12 AT gmail.com>
|
||||||
|
|
||||||
|
# Modify and export/declare new PATH
|
||||||
export PATH=.:/:/usr/sbin:/usr/bin:/sbin:/bin
|
export PATH=.:/:/usr/sbin:/usr/bin:/sbin:/bin
|
||||||
|
|
||||||
|
# Source Live Kit library script
|
||||||
. /lib/.config
|
. /lib/.config
|
||||||
. /lib/livekitlib
|
. /lib/livekitlib
|
||||||
|
|
||||||
|
# Declare start of 'init' state
|
||||||
|
clear
|
||||||
|
echo_sign "INIT START"
|
||||||
|
|
||||||
|
# Run switch_root: initramfs -> tmpfs
|
||||||
transfer_initramfs
|
transfer_initramfs
|
||||||
|
|
||||||
|
# Directory variables pointing to /memory
|
||||||
MEMORY=/memory
|
MEMORY=/memory
|
||||||
CHANGES=$MEMORY/changes
|
CHANGES=$MEMORY/changes
|
||||||
UNION=$MEMORY/union
|
UNION=$MEMORY/union
|
||||||
DATAMNT=$MEMORY/data
|
DATAMNT=$MEMORY/data
|
||||||
BUNDLES=$MEMORY/bundles
|
BUNDLES=$MEMORY/bundles
|
||||||
|
|
||||||
header "Live Kit init <http://www.linux-live.org/>"
|
# Initliaise /proc, /sys and such
|
||||||
|
|
||||||
init_proc_sysfs
|
init_proc_sysfs
|
||||||
|
|
||||||
|
# Initialise debugging if requested
|
||||||
debug_start
|
debug_start
|
||||||
|
dbg_shell_start
|
||||||
|
|
||||||
|
# 1st debug shell interval
|
||||||
debug_shell
|
debug_shell
|
||||||
# load some modules manually first, then modprobe everything we have
|
|
||||||
|
# Initialise important kernel modules
|
||||||
init_devs
|
init_devs
|
||||||
init_aufs
|
init_aufs
|
||||||
init_zram
|
init_zram
|
||||||
|
|
||||||
|
# Then, modprobe everything
|
||||||
modprobe_everything
|
modprobe_everything
|
||||||
|
|
||||||
# find data dir with filesystem bundles
|
# Find data dir with filesystem bundles
|
||||||
DATA="$(find_data 60 "$DATAMNT")"
|
# NEW:
|
||||||
|
# Only 15 seconds before timeout, to minimize the
|
||||||
|
# pain of waiting a "whole" minute.
|
||||||
|
#
|
||||||
|
DATA="$(find_data 15 "$DATAMNT")"
|
||||||
|
|
||||||
|
# 2nd debug shell interval
|
||||||
debug_shell
|
debug_shell
|
||||||
# setup persistent changes, if possible
|
|
||||||
|
# Setup persistent changes
|
||||||
persistent_changes "$DATA" "$CHANGES"
|
persistent_changes "$DATA" "$CHANGES"
|
||||||
|
|
||||||
|
# 3rd debug shell interval
|
||||||
debug_shell
|
debug_shell
|
||||||
# copy to RAM if needed
|
|
||||||
|
# Copy data to RAM if requested by user
|
||||||
DATA="$(copy_to_ram "$DATA" "$CHANGES")"
|
DATA="$(copy_to_ram "$DATA" "$CHANGES")"
|
||||||
debug_shell
|
|
||||||
# init aufs union
|
# Setup an empty union
|
||||||
init_union "$CHANGES" "$UNION"
|
init_union "$CHANGES" "$UNION"
|
||||||
|
|
||||||
|
# 4th debug shell interval
|
||||||
debug_shell
|
debug_shell
|
||||||
# add data to union
|
|
||||||
|
# Append bundles to union
|
||||||
union_append_bundles "$DATA" "$BUNDLES" "$UNION"
|
union_append_bundles "$DATA" "$BUNDLES" "$UNION"
|
||||||
|
|
||||||
|
# 5th debug shell interval
|
||||||
debug_shell
|
debug_shell
|
||||||
# rootcopy
|
|
||||||
|
# Copy contents of 'rootcopy/'
|
||||||
copy_rootcopy_content "$DATA" "$UNION"
|
copy_rootcopy_content "$DATA" "$UNION"
|
||||||
|
|
||||||
# create empty fstab
|
# Generate a basic 'fstab' with the core filesystems
|
||||||
fstab_create "$UNION"
|
fstab_create "$UNION"
|
||||||
|
|
||||||
|
# 6th and final debug shell interval
|
||||||
debug_shell
|
debug_shell
|
||||||
header "Live Kit done, starting $LIVEKITNAME"
|
|
||||||
|
# Declare the end of first 'init' state
|
||||||
|
clear
|
||||||
|
echo_sign "INIT END"
|
||||||
|
|
||||||
|
# Change root to main OS and let the 'init' in the
|
||||||
|
# main OS do the rest...
|
||||||
change_root "$UNION"
|
change_root "$UNION"
|
||||||
|
|
||||||
header "!!ERROR occured, you shouldn't be here.!!"
|
# < ======== NOTHING SHOULD GO OVER THIS LINE! ======== >
|
||||||
/bin/sh
|
fatal "Unknown error!"
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1,66 +1,131 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# Functions library :: for Linux Live Kit scripts
|
# Functions library :: for Linux Live Kit scripts
|
||||||
# Author: Tomas M. <http://www.linux-live.org>
|
# Original author: Tomas M. <http://www.linux-live.org>
|
||||||
#
|
# Modified by: 'JohnDaH4x0r' <terencedoesmc12 AT gmail DOT com>
|
||||||
|
|
||||||
# =================================================================
|
# related to build script
|
||||||
# debug and output functions
|
# get_exclude: Generate exclude arguments for 'mksquashfs'
|
||||||
# =================================================================
|
# $1: the exclude list ("$EXCLUDE", if you use .config)
|
||||||
|
|
||||||
|
get_exclude()
|
||||||
|
{
|
||||||
|
EXCLUDE_LIST="$1"
|
||||||
|
PARENT_DIR="$(echo "$2" | tr -s "/")"
|
||||||
|
|
||||||
|
if [ -z "$PARENT_DIR" ]; then
|
||||||
|
return 1
|
||||||
|
elif [ "$PARENT_DIR" = "/" ]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$EXCLUDE_LIST" | tr " " "\n" | grep "$PARENT_DIR" \
|
||||||
|
| while read KEY; do
|
||||||
|
echo -n "-e $KEY "
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# NOTE: DO NOT TOUCH THE ESCAPE CHARACTERS!
|
||||||
|
BLUE="[1;34m"
|
||||||
|
YELLOW="[1;33m"
|
||||||
|
ORANGE="[0;33m"
|
||||||
|
GREEN="[1;32m"
|
||||||
|
BOLD="[0;1m"
|
||||||
|
RED="[1;31m"
|
||||||
|
NC="[0m"
|
||||||
|
|
||||||
|
# debug related
|
||||||
debug_start()
|
debug_start()
|
||||||
{
|
{
|
||||||
if grep -q debug /proc/cmdline; then
|
if grep -q 'debug' /proc/cmdline; then
|
||||||
DEBUG_IS_ENABLED=1
|
DEBUG_IS_ENABLED=1
|
||||||
else
|
else
|
||||||
DEBUG_IS_ENABLED=
|
DEBUG_IS_ENABLED=
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
debug_log()
|
dbg_shell_start()
|
||||||
{
|
{
|
||||||
if [ "$DEBUG_IS_ENABLED" ]; then
|
if grep -q 'dbg_shell' /proc/cmdline; then
|
||||||
echo "- debug: $*" >&2
|
DBG_SHELL=1
|
||||||
log "- debug: $*"
|
else
|
||||||
|
DBG_SHELL=
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# header
|
debug_log()
|
||||||
# $1 = text to show
|
|
||||||
#
|
|
||||||
header()
|
|
||||||
{
|
{
|
||||||
echo "[0;1m""$@""[0;0m"
|
if [ "$DEBUG_IS_ENABLED" ]; then
|
||||||
|
echo "[${GREEN}"' debug '"${NC}]: $@" >&2
|
||||||
|
log "debug_log: $*"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# echo related functions
|
||||||
|
|
||||||
# echo green star
|
# echo fatal tag
|
||||||
#
|
# $1 = text to show
|
||||||
echo_green_star()
|
echo_fatal()
|
||||||
{
|
{
|
||||||
echo -ne "[0;32m""* ""[0;39m"
|
echo "[${RED}"' fatal '"${NC}] $@" >&2
|
||||||
|
}
|
||||||
|
|
||||||
|
# echo bold
|
||||||
|
# $1 = text to show
|
||||||
|
#
|
||||||
|
echo_bold()
|
||||||
|
{
|
||||||
|
echo "$BOLD""$@""$NC"
|
||||||
|
}
|
||||||
|
|
||||||
|
# echo livekit tag
|
||||||
|
echo_livekit()
|
||||||
|
{
|
||||||
|
echo "[${BLUE}"'livekit'"${NC}] "
|
||||||
|
}
|
||||||
|
|
||||||
|
echo_livekit_msg()
|
||||||
|
{
|
||||||
|
echo "[${BLUE}"'livekit'"${NC}] $@"
|
||||||
|
}
|
||||||
|
|
||||||
|
# echo error
|
||||||
|
echo_err()
|
||||||
|
{
|
||||||
|
echo "[${RED}"' error '"${NC}] $@" >&2
|
||||||
|
}
|
||||||
|
|
||||||
|
# echo warn
|
||||||
|
echo_warn()
|
||||||
|
{
|
||||||
|
echo "[${YELLOW}"' warn! '"${NC}] $@" >&2
|
||||||
|
}
|
||||||
|
|
||||||
|
# echo signature
|
||||||
|
echo_sign()
|
||||||
|
{
|
||||||
|
echo "${BOLD}"' Linux Live Kit Improved v1.0 - '"$* ${NC}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# log - store given text in /var/log/livedbg
|
# log - store given text in /var/log/livedbg
|
||||||
log()
|
log()
|
||||||
{
|
{
|
||||||
echo "$@" 2>/dev/null >>/var/log/livedbg
|
echo "$@" 2>/dev/null >>/var/log/livekit-log
|
||||||
}
|
}
|
||||||
|
|
||||||
echolog()
|
echolog()
|
||||||
{
|
{
|
||||||
echo "$@"
|
echo "$@"
|
||||||
log "$@"
|
log "echolog: $@"
|
||||||
}
|
}
|
||||||
|
|
||||||
# show information about the debug shell
|
# show information about the debug shell
|
||||||
show_debug_banner()
|
show_debug_banner()
|
||||||
{
|
{
|
||||||
echo
|
echo_sign "DEBUGGING MODE"
|
||||||
echo "====="
|
echo "The root shell is prepared for you!" >&2
|
||||||
echo ": Debugging started. Here is the root shell for you."
|
echo "Type your desired commands or press Ctrl-D to continue booting." >&2
|
||||||
echo ": Type your desired commands or hit Ctrl+D to continue booting."
|
echo >&2
|
||||||
echo
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# debug_shell
|
# debug_shell
|
||||||
|
|
@ -68,7 +133,7 @@ show_debug_banner()
|
||||||
#
|
#
|
||||||
debug_shell()
|
debug_shell()
|
||||||
{
|
{
|
||||||
if [ "$DEBUG_IS_ENABLED" ]; then
|
if [ "$DBG_SHELL" ]; then
|
||||||
show_debug_banner
|
show_debug_banner
|
||||||
setsid sh -c 'exec sh < /dev/tty1 >/dev/tty1 2>&1'
|
setsid sh -c 'exec sh < /dev/tty1 >/dev/tty1 2>&1'
|
||||||
echo
|
echo
|
||||||
|
|
@ -77,43 +142,56 @@ debug_shell()
|
||||||
|
|
||||||
fatal()
|
fatal()
|
||||||
{
|
{
|
||||||
echolog
|
log "FatalError: $@"
|
||||||
header "Fatal error occured - $1"
|
echo_fatal "$@"
|
||||||
echolog "Something went wrong and we can't continue. This should never happen."
|
echo_sign "EMERGENCY MODE" >&2
|
||||||
echolog "Please reboot your computer with Ctrl+Alt+Delete ..."
|
echo_bold "Please consult /var/log/livekit-log for more info." >&2
|
||||||
echolog
|
|
||||||
setsid sh -c 'exec sh < /dev/tty1 >/dev/tty1 2>&1'
|
setsid sh -c 'exec sh < /dev/tty1 >/dev/tty1 2>&1'
|
||||||
}
|
}
|
||||||
|
|
||||||
# get value of commandline parameter $1
|
|
||||||
# $1 = parameter to search for
|
|
||||||
#
|
|
||||||
cmdline_value()
|
|
||||||
{
|
|
||||||
cat /proc/cmdline | egrep -o "(^|[[:space:]])$1=[^[:space:]]+" | tr -d " " | cut -d "=" -f 2- | tail -n 1
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# test if the script is started by root user. If not, exit
|
# test if the script is started by root user. If not, exit
|
||||||
#
|
#
|
||||||
allow_only_root()
|
allow_only_root()
|
||||||
{
|
{
|
||||||
if [ "0$UID" -ne 0 ]; then
|
if [ "0$UID" -ne 0 ]; then
|
||||||
echo "Only root can run $(basename $0)"; exit 1
|
echo_err "Only root can run $(basename $0)"; exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Create bundle
|
# Make bundle
|
||||||
# call mksquashfs with apropriate arguments
|
# call mksquashfs with apropriate arguments
|
||||||
# $1 = directory which will be compressed to squashfs bundle
|
# $1 = directory which will be compressed to squashfs bundle
|
||||||
# $2 = output file
|
# $2 = output file
|
||||||
# $3..$9 = optional arguments like -keep-as-directory or -b 123456789
|
# $3..$9 = optional arguments like -keep-as-directory or -b 123456789
|
||||||
#
|
#
|
||||||
create_bundle()
|
mkbund()
|
||||||
{
|
{
|
||||||
debug_log "create_module" "$*"
|
debug_log "mkbund" "$*"
|
||||||
rm -f "$2" # overwrite, never append to existing file
|
|
||||||
mksquashfs "$1" "$2" -comp xz -b 512K $3 $4 $5 $6 $7 $8 $9>/dev/null
|
if [ -e "$2" ]; then
|
||||||
|
echo_warn "mkbund: $(basename $2): File already exists!"
|
||||||
|
echo_warn "mkbund: $(basename $2): Deleting file..."
|
||||||
|
rm -f "$2"
|
||||||
|
else
|
||||||
|
echo_livekit_msg "mkbund: $(basename $2): Making new bundle..."
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo_livekit_msg "mkbund: SquashFS compression: 1024k - XZ" >&2
|
||||||
|
echo_livekit_msg "mkbund: $(basename $2): Compressing bundle..." >&2
|
||||||
|
mksquashfs "$1" "$2" -comp xz -b 1024k $3 $4 $5 $6 $7 $8 $9 >/dev/null || \
|
||||||
|
(echo_err "mkbund: Failed to make bundle!" && exit 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
# Now, for the Live Kit system-related stuff
|
||||||
|
|
||||||
|
# get value of kernel cmdline parameter $1
|
||||||
|
# $1 = parameter to search for
|
||||||
|
#
|
||||||
|
cmdline_value()
|
||||||
|
{
|
||||||
|
cat /proc/cmdline | egrep -o "(^|[[:space:]])$1=[^[:space:]]+" | \
|
||||||
|
tr -d " " | cut -d "=" -f 2- | tail -n 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -123,24 +201,25 @@ create_bundle()
|
||||||
#
|
#
|
||||||
transfer_initramfs()
|
transfer_initramfs()
|
||||||
{
|
{
|
||||||
if [ ! -r /lib/initramfs_escaped ]; then
|
if [ ! -r /lib/esc_initramfs.sgn ]; then
|
||||||
echo "switch root from initramfs to ramfs"
|
echo_livekit >&2
|
||||||
|
echo "Switching root from initramfs to tmpfs..." >&2
|
||||||
SWITCH=/m # one letter directory
|
SWITCH=/m # one letter directory
|
||||||
mkdir -p $SWITCH
|
mkdir -p $SWITCH
|
||||||
mount -t tmpfs -o size="100%" tmpfs $SWITCH
|
mount -t tmpfs -o size="100%" tmpfs "$SWITCH"
|
||||||
cp -a /??* $SWITCH 2>/dev/null # only copy two-and-more-letter directories
|
cp -a /??* "$SWITCH" 2>/dev/null # only copy two-and-more-letter directories
|
||||||
cd $SWITCH
|
cd $SWITCH
|
||||||
echo "This file indicates that we successfully escaped initramfs" > $SWITCH/lib/initramfs_escaped
|
echo "This file indicates that we successfully escaped initramfs" >"$SWITCH"/lib/esc_initramfs.sgn
|
||||||
exec switch_root -c /dev/console . $0
|
exec switch_root -c /dev/console . "$0"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# mount virtual filesystems like proc etc
|
# mount virtual filesystems like proc, sys and such
|
||||||
#
|
#
|
||||||
init_proc_sysfs()
|
init_proc_sysfs()
|
||||||
{
|
{
|
||||||
debug_log "init_proc_sysfs" "$*"
|
debug_log "init_proc_sysfs" "$*"
|
||||||
mkdir -p /proc /sys /etc $MEMORY
|
mkdir -p /proc /sys /etc "$MEMORY"
|
||||||
mount -n -t proc proc /proc
|
mount -n -t proc proc /proc
|
||||||
echo "0" >/proc/sys/kernel/printk
|
echo "0" >/proc/sys/kernel/printk
|
||||||
mount -n -t sysfs sysfs /sys
|
mount -n -t sysfs sysfs /sys
|
||||||
|
|
@ -154,10 +233,9 @@ modprobe_everything()
|
||||||
{
|
{
|
||||||
debug_log "modprobe_everything" "$*"
|
debug_log "modprobe_everything" "$*"
|
||||||
|
|
||||||
echo_green_star >&2
|
echo_livekit_msg "Probing for hardware..." >&2
|
||||||
echo "Probing for hardware" >&2
|
|
||||||
|
|
||||||
find /lib/modules/ | fgrep .ko | xargs -n 1 modprobe 2>/dev/null
|
find /lib/modules/ | fgrep '.ko' | xargs -n 1 modprobe 2>/dev/null
|
||||||
refresh_devs
|
refresh_devs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -171,7 +249,6 @@ refresh_devs()
|
||||||
mdev -s
|
mdev -s
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# make sure some devices are there
|
# make sure some devices are there
|
||||||
init_devs()
|
init_devs()
|
||||||
{
|
{
|
||||||
|
|
@ -190,8 +267,7 @@ init_devs()
|
||||||
init_zram()
|
init_zram()
|
||||||
{
|
{
|
||||||
debug_log "init_zram" "$*"
|
debug_log "init_zram" "$*"
|
||||||
echo_green_star
|
echo_livekit_msg "Setting up ZRAM as swap if available..."
|
||||||
echo "Setting dynamic RAM compression using ZRAM if available"
|
|
||||||
if [ -r /sys/block/zram0/disksize ]; then
|
if [ -r /sys/block/zram0/disksize ]; then
|
||||||
echo 536870912 > /sys/block/zram0/disksize # 512MB
|
echo 536870912 > /sys/block/zram0/disksize # 512MB
|
||||||
mkswap /dev/zram0 >/dev/null
|
mkswap /dev/zram0 >/dev/null
|
||||||
|
|
@ -205,9 +281,18 @@ init_zram()
|
||||||
init_aufs()
|
init_aufs()
|
||||||
{
|
{
|
||||||
debug_log "init_aufs" "$*"
|
debug_log "init_aufs" "$*"
|
||||||
# TODO maybe check here if aufs support is working at all
|
|
||||||
# and produce useful error message if user has no aufs
|
# Prepare for error messages
|
||||||
modprobe aufs 2>/dev/null
|
echo >>/var/log/livkekit-log
|
||||||
|
|
||||||
|
modprobe aufs 2>/var/log/livekit-log
|
||||||
|
|
||||||
|
# If aufs module failed to load, panic immidiately
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
fatal "Failed to load AUFS module!"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# finally, refresh all devices
|
||||||
refresh_devs
|
refresh_devs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -219,11 +304,19 @@ init_union()
|
||||||
{
|
{
|
||||||
debug_log "init_union" "$*"
|
debug_log "init_union" "$*"
|
||||||
|
|
||||||
echo_green_star
|
echo_livekit_msg "Initialising AUFS union..."
|
||||||
echo "Setting up union using AUFS 3"
|
|
||||||
mkdir -p "$1"
|
mkdir -p "$1"
|
||||||
mkdir -p "$2"
|
mkdir -p "$2"
|
||||||
mount -t aufs -o xino="/.xino",trunc_xino,br="$1" aufs "$2"
|
|
||||||
|
# Prepare for error messages
|
||||||
|
echo >>/var/log/livekit-log
|
||||||
|
|
||||||
|
mount -t aufs -o xino="/.xino",trunc_xino,br="$1" aufs "$2" >/var/log/livekit-log 2>&1
|
||||||
|
|
||||||
|
# If failed to init union, panic
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
fatal "Failed to initialise AUFS union!"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Return device mounted for given directory
|
# Return device mounted for given directory
|
||||||
|
|
@ -272,11 +365,14 @@ device_bestfs()
|
||||||
debug_log "device_bestfs" "$*"
|
debug_log "device_bestfs" "$*"
|
||||||
local FS
|
local FS
|
||||||
|
|
||||||
FS="$(blkid "$1" | sed -r "s/.*TYPE=//" | tr -d '"' | tr [A-Z] [a-z])"
|
FS="$(blkid "$1" | sed -r "s/.*TYPE=//" | tr -d '"' | \
|
||||||
if [ "$FS" = "msdos" -o "$FS" = "fat" -o "$FS" = "vfat" ]; then
|
tr "[A-Z]" "[a-z]" | cut -d ' ' -f 1)"
|
||||||
|
if [ "$FS" = "msdos" -o "$FS" = "fat" ]; then
|
||||||
FS="vfat"
|
FS="vfat"
|
||||||
elif [ "$FS" = "ntfs" ]; then
|
elif [ "$FS" = "ntfs" ]; then
|
||||||
FS="ntfs-3g"
|
FS="ntfs-3g"
|
||||||
|
else
|
||||||
|
FS="$FS"
|
||||||
fi
|
fi
|
||||||
echo "-t $FS"
|
echo "-t $FS"
|
||||||
}
|
}
|
||||||
|
|
@ -306,6 +402,7 @@ fs_options()
|
||||||
init_network_dev()
|
init_network_dev()
|
||||||
{
|
{
|
||||||
debug_log "init_network_dev" "$*"
|
debug_log "init_network_dev" "$*"
|
||||||
|
echo_livekit_msg "Preparing networking device(s)..." >&2
|
||||||
local MODULE ETH
|
local MODULE ETH
|
||||||
|
|
||||||
for MODULE in 3c59x acenic de4x5 e1000 e1000e e100 epic100 hp100 \
|
for MODULE in 3c59x acenic de4x5 e1000 e1000e e100 epic100 hp100 \
|
||||||
|
|
@ -317,7 +414,7 @@ init_network_dev()
|
||||||
modprobe $MODULE 2>/dev/null
|
modprobe $MODULE 2>/dev/null
|
||||||
ETH="$(cat /proc/net/dev | grep : | grep -v lo: | cut -d : -f 1 | tr -d " " | head -n 1)"
|
ETH="$(cat /proc/net/dev | grep : | grep -v lo: | cut -d : -f 1 | tr -d " " | head -n 1)"
|
||||||
if [ "$ETH" != "" ]; then
|
if [ "$ETH" != "" ]; then
|
||||||
echo $ETH
|
echo "$ETH"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
rmmod $MODULE 2>/dev/null
|
rmmod $MODULE 2>/dev/null
|
||||||
|
|
@ -325,8 +422,9 @@ init_network_dev()
|
||||||
|
|
||||||
# If we are here, none of the above specified modules worked.
|
# If we are here, none of the above specified modules worked.
|
||||||
# As a last chance, try to modprobe everything.
|
# As a last chance, try to modprobe everything.
|
||||||
|
echo_warn "No networking kernel module found!"
|
||||||
modprobe_everything
|
modprobe_everything
|
||||||
cat /proc/net/dev | grep : | grep -v lo: | cut -d : -f 1 | tr -d " " | head -n 1
|
cat /proc/net/dev | grep ':' | grep -v 'lo:' | cut -d : -f 1 | tr -d " " | head -n 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -341,14 +439,15 @@ download_data_pxe()
|
||||||
mkdir -p "$1/$LIVEKITNAME"
|
mkdir -p "$1/$LIVEKITNAME"
|
||||||
|
|
||||||
cmdline_value ip | while IFS=":" read CLIENT SERVER GW MASK PORT; do
|
cmdline_value ip | while IFS=":" read CLIENT SERVER GW MASK PORT; do
|
||||||
echo_green_star >&2
|
echo_livekit_msg "Downloading files from ${SERVER}..." >&2
|
||||||
echo "Downloading files from $SERVER ..." >&2
|
|
||||||
|
|
||||||
ETH=$(init_network_dev)
|
ETH=$(init_network_dev)
|
||||||
if [ "$PORT" = "" ]; then PORT="7529"; fi
|
if [ "$PORT" = "" ]; then
|
||||||
|
PORT="7529"
|
||||||
|
fi
|
||||||
|
|
||||||
# set IP address as given by boot paramter
|
# set IP address as given by boot paramter
|
||||||
if [ "$CLIENT" != "" -a "$MASK" != "" ]; then
|
if [ -n "$CLIENT" ] && [ -n "$MASK" ]; then
|
||||||
ifconfig $ETH "$CLIENT" netmask "$MASK"
|
ifconfig $ETH "$CLIENT" netmask "$MASK"
|
||||||
route add default gw "$GW"
|
route add default gw "$GW"
|
||||||
else
|
else
|
||||||
|
|
@ -362,16 +461,18 @@ download_data_pxe()
|
||||||
PROTOCOL=http
|
PROTOCOL=http
|
||||||
wget -q -O "$1/PXEFILELIST" "http://$SERVER:$PORT/PXEFILELIST?$(uname -r):$(uname -m)"
|
wget -q -O "$1/PXEFILELIST" "http://$SERVER:$PORT/PXEFILELIST?$(uname -r):$(uname -m)"
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Error downloading from http://$SERVER:$PORT, trying TFTP" >&2
|
echo_warn "Failed to download from http://${SERVER}:${PORT}!" >&2
|
||||||
|
echo_livekit_msg 'Downloading with TFTP protocol...' >&2
|
||||||
PROTOCOL=tftp
|
PROTOCOL=tftp
|
||||||
tftp -g -r PXEFILELIST -l "$1/PXEFILELIST" $SERVER
|
tftp -g -r PXEFILELIST -l "$1/PXEFILELIST" $SERVER
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cat "$1/PXEFILELIST" | while read FILE; do
|
cat "$1/PXEFILELIST" | while read FILE; do
|
||||||
if [ "$PROTOCOL" = "http" ]; then
|
if [ "$PROTOCOL" = "http" ]; then
|
||||||
|
echo_livekit_msg "PXE-HTTP: Downloading ${FILE}..." >&2
|
||||||
wget -O "$1/$LIVEKITNAME/$FILE" "http://$SERVER:$PORT/$FILE"
|
wget -O "$1/$LIVEKITNAME/$FILE" "http://$SERVER:$PORT/$FILE"
|
||||||
else
|
elif [ "$PROTOCOL" = "tftp" ]; then
|
||||||
echo "* $FILE ..." >&2
|
echo_livekit_msg "PXE-TFTP: Downloading ${FILE}..." >&2
|
||||||
tftp -g -r $FILE -l "$1/$LIVEKITNAME/$FILE" $SERVER
|
tftp -g -r $FILE -l "$1/$LIVEKITNAME/$FILE" $SERVER
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
@ -401,9 +502,9 @@ find_data_try()
|
||||||
# if the FROM parameter is actual file, mount it again as loop (eg. iso)
|
# if the FROM parameter is actual file, mount it again as loop (eg. iso)
|
||||||
if [ -f "$1/$FROM" ]; then
|
if [ -f "$1/$FROM" ]; then
|
||||||
mount -o remount,rw "$DEVICE" "$1" 2>/dev/null
|
mount -o remount,rw "$DEVICE" "$1" 2>/dev/null
|
||||||
mkdir -p "$1/../iso"
|
mkdir -p "$1/../file"
|
||||||
mount -o loop,ro "$1/$FROM" "$1/../iso" 2>/dev/null
|
mount -o loop,ro "$1/$FROM" "$1/../file" 2>/dev/null
|
||||||
FROM="../iso/$LIVEKITNAME"
|
FROM="../file/$LIVEKITNAME"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# search for bundles in the mounted directory
|
# search for bundles in the mounted directory
|
||||||
|
|
@ -438,16 +539,18 @@ find_data()
|
||||||
|
|
||||||
FROM="$(cmdline_value from)"
|
FROM="$(cmdline_value from)"
|
||||||
if [ "$FROM" = "" ]; then FROM="$LIVEKITNAME"; fi
|
if [ "$FROM" = "" ]; then FROM="$LIVEKITNAME"; fi
|
||||||
|
echo_livekit >&2
|
||||||
echo_green_star >&2
|
echo "Looking for $LIVEKITNAME data in /$FROM .." | tr -s "/" >&2
|
||||||
echo -n "Looking for $LIVEKITNAME data in /$FROM .." | tr -s "/" >&2
|
|
||||||
for timeout in $(seq 1 $1); do
|
for timeout in $(seq 1 $1); do
|
||||||
echo -n "." >&2
|
echo -n "." >&2
|
||||||
refresh_devs
|
refresh_devs
|
||||||
DATA="$(find_data_try "$2" "$FROM")"
|
DATA="$(find_data_try "$2" "$FROM")"
|
||||||
if [ "$DATA" != "" ]; then
|
|
||||||
|
# This "was" a bug!
|
||||||
echo "" >&2
|
echo "" >&2
|
||||||
echo "* Found on $(mounted_device "$2")" >&2
|
|
||||||
|
if [ "$DATA" != "" ]; then
|
||||||
|
echo_livekit_msg "$LIVEKITNAME data found on $(mounted_device "$2")" >&2
|
||||||
echo "$DATA"
|
echo "$DATA"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
@ -472,14 +575,14 @@ persistent_changes()
|
||||||
local CHANGES T1 T2
|
local CHANGES T1 T2
|
||||||
|
|
||||||
CHANGES="$1/$(basename "$2")"
|
CHANGES="$1/$(basename "$2")"
|
||||||
T1="$CHANGES/.empty"
|
T1="$CHANGES/.perch-test.dat"
|
||||||
T2="$T1"2
|
T2="${T1}-clone.dat"
|
||||||
|
|
||||||
# Setup the directory anyway, it will be used in all cases
|
# Setup the directory anyway, it will be used in all cases
|
||||||
mkdir -p "$2"
|
mkdir -p "$2"
|
||||||
|
|
||||||
# If persistent changes are not requested, end here
|
# If persistent changes are not requested, end here
|
||||||
if grep -vq perch /proc/cmdline; then
|
if grep -vq 'perch' /proc/cmdline; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -488,19 +591,18 @@ persistent_changes()
|
||||||
|
|
||||||
# if not, simply return back
|
# if not, simply return back
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "* Persistent changes not writable or not used"
|
echo_warn "Persistent changes not writable or not used."
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
echo_livekit_msg "Testing persistent changes for POSIX compatibility..." >&2
|
||||||
echo_green_star
|
|
||||||
echo "Testing persistent changes for posix compatibility"
|
|
||||||
touch "$T1" && ln -sf "$T1" "$T2" 2>/dev/null && \
|
touch "$T1" && ln -sf "$T1" "$T2" 2>/dev/null && \
|
||||||
chmod +x "$T1" 2>/dev/null && test -x "$T1" && \
|
chmod +x "$T1" 2>/dev/null && test -x "$T1" && \
|
||||||
chmod -x "$T1" 2>/dev/null && test ! -x "$T1" && \
|
chmod -x "$T1" 2>/dev/null && test ! -x "$T1" && \
|
||||||
rm "$T1" "$T2" 2>/dev/null
|
rm "$T1" "$T2" 2>/dev/null
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "* Activating dynamic sized storage for persistent changes"
|
echo_warn "File system is not POSIX-compatible!" >&2
|
||||||
|
echo_livekit_msg "Activating DynFileFS persistent changes..." >&2
|
||||||
rm "$T1" "$T2" 2>/dev/null
|
rm "$T1" "$T2" 2>/dev/null
|
||||||
|
|
||||||
mount.dynfilefs "$CHANGES/changes.dat" 4000 "$2"
|
mount.dynfilefs "$CHANGES/changes.dat" 4000 "$2"
|
||||||
|
|
@ -510,7 +612,7 @@ persistent_changes()
|
||||||
mount -o loop,sync "$2/loop.fs" "$2"
|
mount -o loop,sync "$2/loop.fs" "$2"
|
||||||
rmdir "$2/lost+found" 2>/dev/null
|
rmdir "$2/lost+found" 2>/dev/null
|
||||||
else
|
else
|
||||||
echo "* Activating native persistent changes"
|
echo_livekit_msg "Activating native persistent changes..." >&2
|
||||||
mount --bind "$CHANGES" "$2"
|
mount --bind "$CHANGES" "$2"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
@ -523,7 +625,7 @@ copy_rootcopy_content()
|
||||||
debug_log "copy_rootcopy_content" "$*"
|
debug_log "copy_rootcopy_content" "$*"
|
||||||
|
|
||||||
if [ "$(ls -1 "$1/rootcopy/" 2>/dev/null)" != "" ]; then
|
if [ "$(ls -1 "$1/rootcopy/" 2>/dev/null)" != "" ]; then
|
||||||
echo_green_star
|
echo_livekit
|
||||||
echo "Copying content of rootcopy directory..."
|
echo "Copying content of rootcopy directory..."
|
||||||
cp -a "$1"/rootcopy/* "$2"
|
cp -a "$1"/rootcopy/* "$2"
|
||||||
fi
|
fi
|
||||||
|
|
@ -539,13 +641,13 @@ copy_to_ram()
|
||||||
|
|
||||||
local MDIR MDEV RAM CHANGES
|
local MDIR MDEV RAM CHANGES
|
||||||
|
|
||||||
if grep -vq toram /proc/cmdline; then
|
if grep -vq 'copy2ram' /proc/cmdline; then
|
||||||
echo "$1"
|
echo "$1"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "* Copying $LIVEKITNAME data to RAM..." >&2
|
echo_livekit_msg "Copying $LIVEKITNAME data to RAM..." >&2
|
||||||
RAM="$(dirname "$2")"/toram
|
RAM="$(dirname "$2")"/copy_to_ram
|
||||||
mkdir -p "$RAM"
|
mkdir -p "$RAM"
|
||||||
cp -a "$1"/* "$RAM"
|
cp -a "$1"/* "$RAM"
|
||||||
echo "$RAM"
|
echo "$RAM"
|
||||||
|
|
@ -606,12 +708,20 @@ union_append_bundles()
|
||||||
|
|
||||||
local BUN
|
local BUN
|
||||||
|
|
||||||
echo_green_star
|
echo_livekit >&2
|
||||||
echo "Adding bundles to union"
|
echo "Appending bundles to union..." >&2
|
||||||
( ls -1 "$1" | sort -n ; cd "$1" ; find modules/ 2>/dev/null | sortmod | filter_load) | grep '[.]'$BEXT'$' | filter_noload | while read BUNDLE; do
|
|
||||||
echo "* $BUNDLE"
|
# Just tell me why! Why be compact?!?
|
||||||
|
( ls -1 "$1" | sort -n ; cd "$1" ; find modules/ 2>/dev/null | \
|
||||||
|
sortmod | filter_load) | grep '[.]'$BEXT'$' |\
|
||||||
|
filter_noload | \
|
||||||
|
while read BUNDLE; do
|
||||||
|
echo_livekit_msg "Appending: $BUNDLE" >&2
|
||||||
|
|
||||||
BUN="$(basename "$BUNDLE")"
|
BUN="$(basename "$BUNDLE")"
|
||||||
mkdir -p "$2/$BUN"
|
mkdir -p "$2/$BUN"
|
||||||
|
|
||||||
|
# It now depends on your kernel!
|
||||||
mount -o loop -t squashfs "$1/$BUNDLE" "$2/$BUN"
|
mount -o loop -t squashfs "$1/$BUNDLE" "$2/$BUN"
|
||||||
mount -o remount,add:1:"$2/$BUN" aufs "$3"
|
mount -o remount,add:1:"$2/$BUN" aufs "$3"
|
||||||
done
|
done
|
||||||
|
|
@ -640,7 +750,7 @@ fstab_create()
|
||||||
change_root()
|
change_root()
|
||||||
{
|
{
|
||||||
debug_log "change_root" "$*"
|
debug_log "change_root" "$*"
|
||||||
|
echo_livekit_msg "Changing root..." >&2
|
||||||
umount /proc
|
umount /proc
|
||||||
umount /sys
|
umount /sys
|
||||||
|
|
||||||
|
|
@ -661,11 +771,11 @@ change_root()
|
||||||
if [ -x sbin/chroot -o -L sbin/chroot ]; then CHROOT=sbin/chroot; fi
|
if [ -x sbin/chroot -o -L sbin/chroot ]; then CHROOT=sbin/chroot; fi
|
||||||
if [ -x usr/bin/chroot -o -L usr/bin/chroot ]; then CHROOT=usr/bin/chroot; fi
|
if [ -x usr/bin/chroot -o -L usr/bin/chroot ]; then CHROOT=usr/bin/chroot; fi
|
||||||
if [ -x usr/sbin/chroot -o -L usr/sbin/chroot ]; then CHROOT=usr/sbin/chroot; fi
|
if [ -x usr/sbin/chroot -o -L usr/sbin/chroot ]; then CHROOT=usr/sbin/chroot; fi
|
||||||
if [ "$CHROOT" = "" ]; then fatal "Can't find executable chroot command"; fi
|
if [ "$CHROOT" = "" ]; then fatal "chroot: Executable not found!"; fi
|
||||||
|
|
||||||
if [ -x bin/init -o -L bin/init ]; then INIT=bin/init; fi
|
if [ -x bin/init -o -L bin/init ]; then INIT=bin/init; fi
|
||||||
if [ -x sbin/init -o -L sbin/init ]; then INIT=sbin/init; fi
|
if [ -x sbin/init -o -L sbin/init ]; then INIT=sbin/init; fi
|
||||||
if [ "$INIT" = "" ]; then fatal "Can't find executable init command"; fi
|
if [ "$INIT" = "" ]; then fatal "init: Executable not found!"; fi
|
||||||
|
|
||||||
mkdir -p mnt/live
|
mkdir -p mnt/live
|
||||||
mount -n -o remount,ro aufs .
|
mount -n -o remount,ro aufs .
|
||||||
|
|
|
||||||
|
|
@ -31,12 +31,14 @@ sed -i -r "s:/boot/syslinux:/$LIVEKITNAME/boot:" core/fs/lib/loadconfig.c
|
||||||
|
|
||||||
make \
|
make \
|
||||||
${CC:+CC="$CC"}
|
${CC:+CC="$CC"}
|
||||||
|
echo
|
||||||
|
echo "Copying isolinux.bin to $(readlink -f '../../bootfiles/isolinux.bin')"
|
||||||
cp -p core/isolinux.bin ../../bootfiles/isolinux.bin
|
cp -p core/isolinux.bin ../../bootfiles/isolinux.bin
|
||||||
|
|
||||||
echo
|
echo "Cleaning up..."
|
||||||
echo "Copying isolinux.bin to $(realpath ../../bootfiles/isolinux.bin)"
|
|
||||||
|
|
||||||
cd ..
|
cd ..
|
||||||
rm -Rf $PKG
|
rm -Rf $PKG
|
||||||
rm -f $PKGTGZ
|
rm -f $PKGTGZ
|
||||||
|
|
||||||
|
echo "Done!"
|
||||||
Loading…
Reference in New Issue