├── .gitignore
├── LICENSE
├── README.md
├── files
├── grub.cfg
├── isolinux.cfg
├── liveiso.hook
└── unicode.pf2
├── live-chroot
├── liverootfs
├── etc
│ └── issue
├── root
│ ├── live_script.sh
│ ├── post-extract.sh
│ ├── post-install.sh
│ └── splash.png
└── usr
│ └── bin
│ ├── live-chroot
│ └── live-installer
├── mkiso.sh
├── mkrootfs-archlinux.sh
├── mkrootfs-voidlinux.sh
├── mkrootfs-voidlinux_musl.sh
└── run_qemu
/.gitignore:
--------------------------------------------------------------------------------
1 | iso/
2 | work/
3 | liverootfs-*/etc/
4 | rootfs-*/
5 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## Turn your linux desktop rice into installable live iso!
2 |
3 | Yeah as the title says, if your are a linux desktop ricer, why not make it an installable iso so you can share it to anyone who wanna test it or install it on their machines. With this scripts, make a custom iso with your own customization and linux distro of your choice is just easy. So far this script is tested myself with some distros like Archlinux, Void Linux, CRUX and Venom Linux.
4 |
5 | ## How to do it?
6 |
7 | Basically you just need your rootfs somewhere then run `./mkiso.sh `, then the iso is ready in `iso/` directory. But if you want include some customization and installable, theres a few extra step.
8 |
9 | 1. Prepare your rootfs of distro of your choice, i recommend write a script to do it, so you can just run it anytime when you want to make an iso. I've provide scripts for some distros `mkrootfs-.sh`, just modify it to suit your need. And i recommend your rootfs directory named `rootfs-`, because `mkiso.sh` script use that 'distro name' for customization dir & output iso. I suggest make it clean, less modified as possible, any modification put it in `liverootfs-`, `live_script.sh` or `post-install.sh` instead.
10 | 2. Prepare your customization files inside `liverootfs-` dir. You can copy over from `liverootfs` (global customization files) directory then modify it to suit your need. For config files like '.Xdefaults', '.bash_profile', '.bashrc' and etc. that should be in user's HOME, place it in `liverootfs-/etc/skel/` directory, this skel files will automatically copied over when user is created.
11 | 3. Modify `liverootfs-/root/live_script.sh` for your live session like, make temporary live user, set its password, enable systemd services and etc. This `live_script.sh` is executed inside initramfs just before live system is loaded, so whatever change you made to live session in this script only affect live session.
12 | 4. Modify `liverootfs-/root/post-install.sh` if you want your live distro installable, whatever value got from installer is passed to this script to configure final installed system, so this `post-install.sh` depends on your distro how to configure it. (see provided `post-install.sh`).
13 | 5. Run `./mkiso.sh rootfs-` to generate live iso. The iso output is `iso/` directory.
14 | 6. Test your created iso using `run_qemu` script by running `./run_qemu `. (make sure qemu is installed).
15 |
16 | *Note: use `live-installer` in live session to install the distro to disk.
17 |
18 | ## Requirements
19 |
20 | ### for host
21 | - xorriso - to create iso
22 | - squashfs-tools - to compress rootfs
23 | - curl - to fetch necessary files
24 | - gimp - to create custom grub/syslinux splash (optional)
25 |
26 | ### for target rootfs
27 | - grub-efi - to support both bios and uefi boot
28 | - squashfs-tools - to extract compressed rootfs to disk (optional, required if want to install to disk)
29 | - generic kernel - required for necessary kernel modules to make bootable liveiso possible (non-sourcebased distro like gentoo or LFS dont worry :))
30 |
31 | ## Directory structure
32 |
33 | Heres i'm provide directory structure and quick explanation for each dirs and files:
34 | ```
35 | livelinuxiso/
36 | |- files/ - contains files required for the iso
37 | | |- grub.cfg - grub config when booting using UEFI, you can modify it as you want
38 | | |- isolinux.cfg - syslinux config when booting bios mode, you can modify it as you want
39 | | \- liveiso.hook - hook file for mkinitramfs script, to generate and execute stuffs in initramfs
40 | |- iso/ - output directory for created isos
41 | |- liverootfs/ - global customization directory, copied over into iso (dont modify this, use liverootfs- instead)
42 | | |- etc/
43 | | | \- issue - default /etc/issue for live iso
44 | | |- root/
45 | | | |- live_scripts.sh - executed right before live session started, to temporarily modify live session
46 | | | |- post-extract.sh - executed right after uncompressed rootfs to disk, to copy over customization files (executed by live-installer)
47 | | | |- post-install.sh - executed by live-installer to configure final installed system
48 | | | \- splash.png - default splash image for grub and syslinux
49 | | \- usr/
50 | | \- bin/
51 | | |- live-chroot - live-chroot script for live-installer configure final installed system
52 | | \- live-installer - the installer
53 | |- liverootfs-/ - your distro customization directory, replacing global 'liverootfs' files
54 | |- rootfs-/ - your distro's rootfs directory
55 | |- work/ - working directory
56 | |- live-chroot - chroot script helper to modify your rootfs
57 | |- mkiso.sh - main script to generate iso
58 | |- mkrootfs-.sh - your custom script to prepare distro's rootfs (optional, not required at all)
59 | \- run_qemu - script to test iso using qemu
60 | ```
61 |
62 | ## Tested on
63 |
64 | - Arch Linux
65 | - Void Linux
66 | - Venom Linux
67 | - CRUX
68 | - (you tell me, i will add it)
69 |
70 | btw you can test my created iso of some distros [here](https://sourceforge.net/projects/linuxliveiso/).
71 |
72 | if you created your distro using this script, you can share it here, so everyone can use it :)
--------------------------------------------------------------------------------
/files/grub.cfg:
--------------------------------------------------------------------------------
1 | set default=0
2 | set timeout=10
3 |
4 | insmod all_video
5 | insmod gfxterm
6 | terminal_output gfxterm
7 | loadfont /boot/grub/fonts/unicode.pf2
8 | insmod gfxterm_background
9 | insmod png
10 | background_image /isolinux/splash.png
11 |
12 | set color_normal=light-gray/black
13 | set color_highlight=white/black
14 |
15 | menuentry '@DISTRONAME@ (UEFI mode)' {
16 | linux /boot/vmlinuz ro quiet
17 | initrd /boot/initrd
18 | }
19 | menuentry '@DISTRONAME@ (UEFI mode) debug' {
20 | linux /boot/vmlinuz ro verbose
21 | initrd /boot/initrd
22 | }
23 | menuentry '@DISTRONAME@ (UEFI mode) [Ram]' {
24 | linux /boot/vmlinuz ro quiet ram
25 | initrd /boot/initrd
26 | }
27 | menuentry '@DISTRONAME@ (UEFI mode) [Ram] debug' {
28 | linux /boot/vmlinuz ro verbose ram
29 | initrd /boot/initrd
30 | }
31 | menuentry "Reboot" {
32 | reboot
33 | }
34 | menuentry "Poweroff" {
35 | halt
36 | }
37 |
--------------------------------------------------------------------------------
/files/isolinux.cfg:
--------------------------------------------------------------------------------
1 | UI /isolinux/vesamenu.c32
2 | DEFAULT silent
3 | TIMEOUT 100
4 | #MENU RESOLUTION 1024 768
5 |
6 | MENU VSHIFT 2
7 | MENU ROWS 7
8 |
9 | # Refer to http://syslinux.zytor.com/wiki/index.php/Doc/menu
10 | MENU BACKGROUND splash.png
11 | MENU COLOR border * #00000000 #00000000 none
12 | MENU COLOR title * #90ffffff #00000000 std
13 | MENU COLOR sel * #e0ffffff #20ffffff all
14 | MENU COLOR unsel * #50ffffff #00000000 std
15 | MENU color timeout * #c0ffffff #00000000 std
16 | MENU color help * #c0ffffff #00000000 std
17 | MENU color msg07 * #c0ffffff #00000000 std
18 |
19 | MENU TABMSG Press ENTER to boot or TAB to edit a menu entry
20 | MENU AUTOBOOT BIOS default device boot in # second{,s}...
21 |
22 | MENU TIMEOUTROW -4
23 | MENU TABMSGROW -1
24 | MENU CMDLINEROW -1
25 |
26 | LABEL silent
27 | MENU LABEL @DISTRONAME@
28 | KERNEL /boot/vmlinuz
29 | APPEND initrd=/boot/initrd quiet
30 |
31 | LABEL debug
32 | MENU LABEL @DISTRONAME@ (Debug)
33 | KERNEL /boot/vmlinuz
34 | APPEND initrd=/boot/initrd verbose
35 |
36 | LABEL silentram
37 | MENU LABEL @DISTRONAME@ [Ram]
38 | KERNEL /boot/vmlinuz
39 | APPEND initrd=/boot/initrd quiet ram
40 |
41 | LABEL debugram
42 | MENU LABEL @DISTRONAME@ [Ram] (Debug)
43 | KERNEL /boot/vmlinuz
44 | APPEND initrd=/boot/initrd verbose ram
45 |
46 | LABEL existing
47 | MENU LABEL Boot existing OS
48 | COM32 chain.c32
49 | APPEND hd0 0
50 |
51 | LABEL reboot
52 | MENU LABEL Reboot
53 | COM32 reboot.c32
54 |
55 | LABEL poweroff
56 | MENU LABEL Poweroff
57 | COM32 poweroff.c32
58 |
--------------------------------------------------------------------------------
/files/liveiso.hook:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | _unmount() {
4 | while true; do
5 | mountpoint -q $1 || break
6 | umount $1 2>/dev/null
7 | done
8 | }
9 |
10 | _chroot() {
11 | mount --bind /dev $newroot/dev
12 | mount -t proc proc $newroot/proc
13 | mount -t sysfs sysfs $newroot/sys
14 | chroot $newroot $@
15 | _unmount $newroot/sys
16 | _unmount $newroot/proc
17 | _unmount $newroot/dev
18 | }
19 |
20 | build_hook() {
21 | _base_hook
22 | _udev_hook
23 | _kmod_hook
24 | _liveiso_hook
25 | }
26 |
27 | _base_hook() {
28 | for dir in bin dev lib/firmware run sys proc usr \
29 | etc/modprobe.d etc/udev/rules.d; do
30 | add_dir /$dir
31 | done
32 |
33 | add_symlink /sbin bin
34 | add_symlink /usr/bin ../bin
35 | add_symlink /usr/sbin ../bin
36 | add_symlink /lib64 lib
37 | add_symlink /usr/lib ../lib
38 | add_symlink /usr/lib64 ../lib
39 |
40 | for bin in bash sh cat mv cp killall ls mkdir mount find xargs grep fgrep \
41 | umount sed sleep ln rm uname chroot chmod \
42 | readlink basename modprobe blkid switch_root \
43 | kmod lsmod insmod setsid awk mountpoint; do
44 | add_binary $bin
45 | done
46 |
47 | add_file /usr/share/terminfo/l/linux
48 | add_file /lib/ld-linux-x86-64.so.2
49 | add_file /lib64/ld-linux-x86-64.so.2
50 | }
51 |
52 | _udev_hook() {
53 | add_file /etc/udev/udev.conf
54 | add_file /lib/udev/rules.d/50-udev-default.rules
55 | add_file /lib/udev/rules.d/60-persistent-storage.rules
56 | add_file /lib/udev/rules.d/64-btrfs.rules
57 | add_file /lib/udev/rules.d/80-drivers.rules
58 |
59 | if [ -f /usr/lib/systemd/systemd-udevd ]; then
60 | add_binary /usr/lib/systemd/systemd-udevd
61 | elif [ -f /lib/systemd/systemd-udevd ]; then
62 | add_binary /lib/systemd/systemd-udevd
63 | else
64 | add_binary udevd
65 | fi
66 | add_binary udevadm
67 | add_binary /lib/udev/ata_id
68 | add_binary /lib/udev/scsi_id
69 | }
70 |
71 | _kmod_hook() {
72 | REQMODULES="kernel/crypto
73 | kernel/fs
74 | kernel/lib
75 | kernel/drivers/block
76 | kernel/drivers/ata
77 | kernel/drivers/md
78 | kernel/drivers/firewire
79 | kernel/drivers/input
80 | kernel/drivers/scsi
81 | kernel/drivers/message
82 | kernel/drivers/pcmcia
83 | kernel/drivers/virtio
84 | kernel/drivers/hid
85 | kernel/drivers/usb/host
86 | kernel/drivers/usb/storage"
87 |
88 | for mod in $REQMODULES; do
89 | FTGT="$FTGT /lib/modules/$KERNEL/$mod"
90 | done
91 | for modules in $(find $FTGT -type f -name "*.ko*" 2> /dev/null); do
92 | modules=$(echo ${modules%*.ko*})
93 | add_module ${modules##*/}
94 | done
95 | }
96 |
97 | _liveiso_hook() {
98 | add_module cdrom
99 | add_module loop
100 | add_module overlay
101 |
102 | add_file /lib/udev/rules.d/60-cdrom_id.rules
103 |
104 | add_binary /lib/udev/cdrom_id
105 | add_binary blockdev
106 | add_binary losetup
107 | }
108 |
109 | run_earlyhook() {
110 | _udev_earlyhook
111 | _liveiso_earlyhook
112 | }
113 |
114 | _udev_earlyhook() {
115 | if [ -x /usr/lib/systemd/systemd-udevd ]; then
116 | [ "$quiet" = y ] && {
117 | /usr/lib/systemd/systemd-udevd --daemon --resolve-names=never >/dev/null 2>&1
118 | } || {
119 | /usr/lib/systemd/systemd-udevd --daemon --resolve-names=never
120 | }
121 |
122 | elif [ -x /lib/systemd/systemd-udevd ]; then
123 | [ "$quiet" = y ] && {
124 | /lib/systemd/systemd-udevd --daemon --resolve-names=never >/dev/null 2>&1
125 | } || {
126 | /lib/systemd/systemd-udevd --daemon --resolve-names=never
127 | }
128 | else
129 | udevd --daemon --resolve-names=never
130 | fi
131 | udevadm trigger --action=add --type=subsystems
132 | udevadm trigger --action=add --type=devices
133 | udevadm trigger --action=change --type=devices
134 | udevadm settle
135 | }
136 |
137 | _liveiso_earlyhook() {
138 | for mod in cdrom loop overlay; do
139 | modprobe $mod 2>/dev/null
140 | done
141 |
142 | if [ -z "$root" ]; then
143 | mount_handler=mount_venomiso
144 | fi
145 | }
146 |
147 | mount_venomiso() {
148 | newroot=$1
149 |
150 | MEDIA=/dev/disk/by-label/LIVEISO
151 | MEDIUM=/run/initramfs/medium
152 | SYSTEM=/run/initramfs/system
153 | WRITEDIR=/run/initramfs/overlayfs/write
154 | WORKDIR=/run/initramfs/overlayfs/work
155 | sfsimg=/run/initramfs/medium/boot/rootfs.sfs
156 | delay=${delay:-5}
157 |
158 | mkdir -p $MEDIUM $SYSTEM $WRITEDIR $WORKDIR
159 |
160 | if [ ! -e $MEDIA ]; then
161 | msg "wait $delay seconds..."
162 | sleep $delay
163 | if [ ! -e $MEDIA ]; then
164 | msg "media is not appeared even after wait $delay seconds..."
165 | msg "try increase delay by append 'delay=' to boot cmdline"
166 | problem
167 | msg "nothing further..."
168 | sleep 9999
169 | fi
170 | fi
171 |
172 | msg "mounting media to $MEDIUM..."
173 | mount -o ro $MEDIA $MEDIUM || problem
174 |
175 | if [ "$ram" = y ]; then
176 | msg "mounting /run/initramfs/ram to ram..."
177 | mkdir -p /run/initramfs/ram
178 | mount -t tmpfs -o "size=75%",mode=0755 ram /run/initramfs/ram || problem
179 | msg "copying stuffs to /run/initramfs/ram..."
180 | cp -r $MEDIUM/rootfs /run/initramfs/ram/ || problem
181 | cp $sfsimg /run/initramfs/ram/ || problem
182 | sfsimg=/run/initramfs/ram/rootfs.sfs
183 | fi
184 | sfs_dev=$(losetup --find --show --read-only $sfsimg)
185 | msg "mounting squashfs img to $SYSTEM..."
186 | mount -o defaults -r $sfs_dev $SYSTEM || problem
187 |
188 | # overlayfs mount
189 | msg "mounting overlays to $newroot..."
190 | mount -t overlay overlay -o upperdir=$WRITEDIR,lowerdir=$SYSTEM,workdir=$WORKDIR $newroot || problem
191 |
192 | if [ -d $MEDIUM/rootfs/ ]; then
193 | msg "copying customization files to $newroot..."
194 | cp -Ra $MEDIUM/rootfs/* $newroot || problem
195 | fi
196 |
197 | # Tell system to skip fsck during startup
198 | > $newroot/fastboot
199 |
200 | # Execute custom script before switch root
201 | if [ -f $newroot/root/live_script.sh ]; then
202 | msg "execute live_script.sh script..."
203 | chmod +x $newroot/root/live_script.sh
204 | if [ "$quiet" = y ]; then
205 | _chroot /root/live_script.sh >/dev/null 2>&1
206 | else
207 | _chroot /root/live_script.sh
208 | fi
209 | fi
210 |
211 | if [ "$ram" = y ]; then
212 | umount $MEDIUM
213 | fi
214 | }
215 |
216 | run_cleanuphook() {
217 | udevadm control --exit
218 | udevadm info --cleanup-db
219 | }
220 |
--------------------------------------------------------------------------------
/files/unicode.pf2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emmett1/linuxliveiso/6a8e18d5a15e2cf8fab19ca537104cd9ee057180/files/unicode.pf2
--------------------------------------------------------------------------------
/live-chroot:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | #
3 | # script to enter chroot
4 | #
5 |
6 | printhelp() {
7 | cat << EOF
8 |
9 | Usage:
10 | $(basename $0) [command]
11 |
12 | If 'command' is unspecified, ${0##*/} will launch /bin/sh.
13 |
14 | EOF
15 | }
16 |
17 | msgerr() {
18 | echo "ERROR: $*"
19 | }
20 |
21 | unmount() {
22 | while true; do
23 | mountpoint -q $1 || break
24 | umount $1 2>/dev/null
25 | done
26 | }
27 |
28 | [ "$(id -u)" = "0" ] || {
29 | msgerr "$(basename $0) need root access!"
30 | printhelp
31 | exit 1
32 | }
33 |
34 | TARGET=$1
35 |
36 | [ "$1" ] || {
37 | msgerr "Please set directory for chroot!"
38 | printhelp
39 | exit 1
40 | }
41 |
42 | [ -d "$TARGET" ] || {
43 | msgerr "Directory '$TARGET' not exist!"
44 | printhelp
45 | exit 1
46 | }
47 |
48 | shift
49 |
50 | if [ ! "$1" ]; then
51 | CMD="/bin/sh"
52 | else
53 | CMD=$*
54 | fi
55 |
56 | if [ -e /sys/firmware/efi/systab ]; then
57 | EFI_SYSTEM=1
58 | fi
59 |
60 | mount --bind /dev $TARGET/dev
61 | mount -t devpts devpts $TARGET/dev/pts -o gid=5,mode=620
62 | mount -t proc proc $TARGET/proc
63 | mount -t sysfs sysfs $TARGET/sys
64 | if [ -n "$EFI_SYSTEM" ]; then
65 | mount --bind /sys/firmware/efi/efivars $TARGET/sys/firmware/efi/efivars
66 | fi
67 | mount -t tmpfs tmpfs $TARGET/run
68 |
69 | if [ -h $TARGET/dev/shm ]; then
70 | mkdir -p $TARGET/$(readlink $TARGET/dev/shm)
71 | fi
72 |
73 | [ -f $TARGET/etc/resolv.conf ] && {
74 | backupresolvconf=1
75 | mv $TARGET/etc/resolv.conf $TARGET/etc/resolv.conf.tmp
76 | }
77 | cp -L /etc/resolv.conf $TARGET/etc
78 |
79 | chroot "$TARGET" /usr/bin/env -i \
80 | HOME=/root \
81 | TERM="$TERM" \
82 | PS1='\u:\w\$ ' \
83 | PATH=/bin:/usr/bin:/sbin:/usr/sbin $CMD
84 |
85 | retval=$?
86 |
87 | [ "$backupresolvconf" = 1 ] && {
88 | mv $TARGET/etc/resolv.conf.tmp $TARGET/etc/resolv.conf
89 | }
90 |
91 | unmount $TARGET/dev/pts
92 | unmount $TARGET/dev
93 | unmount $TARGET/run
94 | unmount $TARGET/proc
95 | if [ -n "$EFI_SYSTEM" ]; then
96 | unmount $TARGET/sys/firmware/efi/efivars
97 | fi
98 | unmount $TARGET/sys
99 |
100 | exit $retval
101 |
--------------------------------------------------------------------------------
/liverootfs/etc/issue:
--------------------------------------------------------------------------------
1 | Hey, this distro's live iso is created using 'linuxliveiso' scripts.
2 |
3 | github: https://github.com/emmett1/linuxliveiso
4 | issue : https://github.com/emmett1/linuxliveiso/issues
5 |
6 | Heres the default login:
7 |
8 | login: live login: root
9 | password: live password: root
10 |
11 | Run 'live-installer' as root or using sudo to install this distro to disk.
12 |
--------------------------------------------------------------------------------
/liverootfs/root/live_script.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # get distro's info
4 | if [ -f /etc/os-release ]; then
5 | . /etc/os-release
6 | fi
7 |
8 | LIVEUSER=live
9 | PASSWORD=live
10 |
11 | useradd -m -G users,wheel,audio,video -s /bin/bash $LIVEUSER
12 | passwd -d $LIVEUSER &>/dev/null
13 | passwd -d root &>/dev/null
14 |
15 | echo "root:root" | chpasswd -c SHA512
16 | echo "$LIVEUSER:$PASSWORD" | chpasswd -c SHA512
17 |
18 | # hostname for live
19 | case $NAME in
20 | Slackware) echo linuxliveiso > /etc/HOSTNAME;;
21 | *) echo linuxliveiso > /etc/hostname;;
22 | esac
23 |
24 | # timezone
25 | case $NAME in
26 | Gentoo) echo UTC > $ROOT/etc/timezone
27 | emerge --config sys-libs/timezone-data;;
28 | *) ln -sf /usr/share/zoneinfo/UTC /etc/localtime;;
29 | esac
30 |
31 | # a little patch to avoid these pseudofs mount again, its already handled by initramfs
32 | if [ "$NAME" = Slackware ]; then
33 | sed -i 's,/sbin/mount -v proc /proc.*,true,' /etc/rc.d/rc.S
34 | sed -i 's,/sbin/mount -v sysfs /sys.*,true,' /etc/rc.d/rc.S
35 | sed -i 's,/sbin/mount -v -n -t tmpfs tmpfs.*,true,' /etc/rc.d/rc.S
36 | fi
37 |
38 | # voidlinux's specific stuffs
39 | if [ "$NAME" = Void ]; then
40 | [ -d /etc/sv/wpa ] && network=wpa
41 | [ -d /etc/sv/NetworkManager ] && network=NetworkManager
42 | [ -d /etc/sv/lxdm ] && dm=lxdm
43 | [ -d /etc/sv/lightdm ] && dm=lightdm
44 | [ -d /etc/sv/sddm ] && dm=sddm
45 | [ -d /etc/sv/slim ] && dm=slim
46 | services="elogind dbus $dm alsa bluetooth gpm $network"
47 | # enable services
48 | for d in $services; do
49 | [ -d /etc/sv/$d ] && ln -s /etc/sv/$d /etc/runit/runsvdir/default
50 | done
51 | # use void theme
52 | if [ -d /usr/share/slim/themes/slim-void-theme ] && [ -f /etc/slim.conf ]; then
53 | sed 's/current_theme.*/current_theme slim-void-theme/' -i /etc/slim.conf
54 | fi
55 | # use en_US as default locale
56 | echo "en_US.UTF-8 UTF-8" >> /etc/default/libc-locales
57 | echo "en_US ISO-8859-1" >> /etc/default/libc-locales
58 | xbps-reconfigure -f glibc-locales
59 | fi
60 |
61 | if [ "$NAME" = Gentoo ]; then
62 | [ -f /etc/init.d/elogind ] && rc-update add elogind boot
63 | [ -f /etc/init.d/dbus ] && rc-update add elogind boot
64 | [ -f /etc/init.d/display-manager ] && {
65 | sed 's,DISPLAYMANAGER=.*,DISPLAYMANAGER=\"slim\",' -i /etc/conf.d/display-manager
66 | rc-update add display-manager default
67 | }
68 | fi
69 |
70 | # slim autologin
71 | if [ -f /etc/slim.conf ]; then
72 | echo "default_user $LIVEUSER" >> /etc/slim.conf
73 | echo "auto_login yes" >> /etc/slim.conf
74 | fi
75 |
76 | # enable sudo permission for all user in live
77 | if [ -f /etc/sudoers ]; then
78 | echo "$LIVEUSER ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
79 | fi
80 |
81 | # allow polkit for wheel group in live
82 | if [ -d /etc/polkit-1 ]; then
83 | cat > /etc/polkit-1/rules.d/live.rules <<_EOF
84 | polkit.addAdminRule(function(action, subject) {
85 | return ["unix-group:wheel"];
86 | });
87 | polkit.addRule(function(action, subject) {
88 | if (subject.isInGroup("wheel")) {
89 | return polkit.Result.YES;
90 | }
91 | });
92 | _EOF
93 | fi
94 |
--------------------------------------------------------------------------------
/liverootfs/root/post-extract.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | #
3 | # this script will be execute by live-installer after system unsquashed
4 | #
5 |
6 | # copy over all customs configs and customization except some unnecessary files
7 | for i in $(find $LIVEROOTFS -type f | sed "s,$LIVEROOTFS,,"); do
8 | case $i in
9 | *live-installer*|*live_script.sh|*fstab|*issue|*live-installer.desktop|*post-install.sh|*post-extract.sh|*live-chroot) continue;;
10 | esac
11 | install -D $LIVEROOTFS/$i $ROOT/$i
12 | done
13 |
14 | exit 0
15 |
--------------------------------------------------------------------------------
/liverootfs/root/post-install.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | #
3 | # this script execute to apply changes to installed system from data from live-installer
4 | #
5 | # list variable:
6 | # $ROOT - directory where system is installed
7 | # $HOSTNAME - hostname
8 | # $TIMEZONE - timezone (xxxx/yyyy)
9 | # $KEYMAP - keymap
10 | # $USERNAME - user's login name
11 | # $USER_PSWD - user's password
12 | # $ROOT_PSWD - root's password
13 | # $LOCALE - locale
14 | # $BOOTLOADER - disk to install grub (either '/dev/sdX or skip)
15 | # $EFI_SYSTEM - 1 if boot in UEFI mode
16 | #
17 |
18 | _run() {
19 | live-chroot $ROOT $@
20 | }
21 |
22 | # get distro's info
23 | if [ -f /etc/os-release ]; then
24 | . /etc/os-release
25 | fi
26 |
27 | # hostname
28 | case $NAME in
29 | Slackware) echo "$HOSTNAME" > $ROOT/etc/HOSTNAME;;
30 | *) echo "$HOSTNAME" > $ROOT/etc/hostname;;
31 | esac
32 |
33 | # hardware clock
34 | case $NAME in
35 | Venom*) sed "s;#HARDWARECLOCK=.*;HARDWARECLOCK=\"localtime\";" -i $ROOT/etc/rc.conf
36 | sed "s;#HARDWARECLOCK=.*;HARDWARECLOCK=\"localtime\";" -i $ROOT/etc/runit/runit.conf;;
37 | Void) sed "s,^#HARDWARECLOCK=.*,HARDWARECLOCK=\"localtime\"," -i $ROOT/etc/rc.conf;;
38 | esac
39 |
40 | # timezone
41 | case $NAME in
42 | Slackware) ln -sf /usr/share/zoneinfo/$TIMEZONE $ROOT/etc/localtime;;
43 | Gentoo) echo "$TIMEZONE" > $ROOT/etc/timezone
44 | emerge --config sys-libs/timezone-data;;
45 | Void) sed "s,^#TIMEZONE=.*,TIMEZONE=\"$TIMEZONE\"," -i $ROOT/etc/rc.conf;;
46 | Venom*) sed "s;#TIMEZONE=.*;TIMEZONE=\"$TIMEZONE\";" -i $ROOT/etc/rc.conf
47 | sed "s;#TIMEZONE=.*;TIMEZONE=\"$TIMEZONE\";" -i $ROOT/etc/runit/runit.conf;;
48 | esac
49 |
50 | # keymap
51 | case $NAME in
52 | Gentoo) echo "keymap=\"$KEYMAP\"" > $ROOT/etc/conf.d/keymaps;;
53 | Void) sed "s,^#KEYMAP=.*,KEYMAP=\"$KEYMAP\"," -i $ROOT/etc/rc.conf;;
54 | Venom*) sed "s;#KEYMAP=.*;KEYMAP=\"$KEYMAP\";" -i $ROOT/etc/rc.conf
55 | sed "s;#KEYMAP=.*;KEYMAP=\"$KEYMAP\";" -i $ROOT/etc/runit/runit.conf;;
56 | esac
57 |
58 | # locale
59 | case $NAME in
60 | Slackware) sed "s,LANG=en_US,LANG=$LOCALE,g" -i $ROOT/etc/profile.d/lang.sh;;
61 | Gentoo) sed "s/#$LOCALE/$LOCALE/g" -i $ROOT/etc/locale.gen
62 | echo "LANG=$LOCALE.UTF-8" > $ROOT/etc/env.d/02locale
63 | _run locale-gen;;
64 | Void) sed "s/#$LOCALE/$LOCALE/" -i $ROOT/etc/default/libc-locales
65 | echo "LANG=$LOCALE.UTF-8" > $ROOT/etc/locale.conf
66 | _run xbps-reconfigure -f glibc-locales;;
67 | Venom*) sed "s/#$LOCALE/$LOCALE/" -i $ROOT/etc/locales
68 | echo "LANG=$LOCALE.UTF-8" > $ROOT/etc/locale.conf
69 | _run genlocales;;
70 | esac
71 |
72 | # fstab
73 | case $NAME in
74 | Slackware) echo "/dev/fd0 /mnt/floppy auto noauto,owner 0 0" >> $ROOT/etc/fstab
75 | echo "devpts /dev/pts devpts gid=5,mode=620 0 0" >> $ROOT/etc/fstab
76 | echo "proc /proc proc defaults 0 0" >> $ROOT/etc/fstab
77 | echo "tmpfs /dev/shm tmpfs nosuid,nodev,noexec 0 0" >> $ROOT/etc/fstab;;
78 | Void) echo "tmpfs /tmp tmpfs defaults,nosuid,nodev 0 0" >> $ROOT/etc/fstab;;
79 | esac
80 |
81 | if [ "$NAME" = Void ]; then
82 | [ -d $ROOT/etc/sv/wpa ] && network=wpa
83 | [ -d $ROOT/etc/sv/NetworkManager ] && network=NetworkManager
84 | [ -d $ROOT/etc/sv/lxdm ] && dm=lxdm
85 | [ -d $ROOT/etc/sv/lightdm ] && dm=lightdm
86 | [ -d $ROOT/etc/sv/sddm ] && dm=sddm
87 | [ -d $ROOT/etc/sv/slim ] && dm=slim
88 | services="elogind dbus $dm alsa bluetooth gpm $network"
89 | # enable services
90 | for d in $services; do
91 | [ -d $ROOT/etc/sv/$d ] && ln -s /etc/sv/$d $ROOT/etc/runit/runsvdir/default
92 | done
93 | # use void theme
94 | if [ -d $ROOT/usr/share/slim/themes/slim-void-theme ] && [ -f $ROOT/etc/slim.conf ]; then
95 | sed 's/current_theme.*/current_theme slim-void-theme/' -i $ROOT/etc/slim.conf
96 | fi
97 | fi
98 |
99 | if [ "$NAME" = "Venom Linux" ]; then
100 | [ -x $ROOT/etc/rc.d/network ] && network=network
101 | [ -x $ROOT/etc/rc.d/networkmanager ] && network=networkmanager
102 | [ -x $ROOT/etc/rc.d/lxdm ] && dm=lxdm
103 | [ -x $ROOT/etc/rc.d/lightdm ] && dm=lightdm
104 | [ -x $ROOT/etc/rc.d/sddm ] && dm=sddm
105 | [ -x $ROOT/etc/rc.d/slim ] && dm=slim
106 | daemons="sysklogd dbus $dm alsa bluetooth gpm $network"
107 | # enable services
108 | for d in $daemons; do
109 | if [ -x $ROOT/etc/rc.d/$d ]; then
110 | if [ "$dd" ]; then
111 | dd="$dd $d"
112 | else
113 | dd="$d"
114 | fi
115 | fi
116 | if [ -d $ROOT/etc/sv/$d ]; then
117 | ln -s /etc/sv/$d $ROOT/etc/runit/runsvdir/default
118 | fi
119 | done
120 | sed "s;#DAEMONS=.*;DAEMONS=\"$dd\";" -i $ROOT/etc/rc.conf
121 | fi
122 |
123 | if [ "$NAME" = Gentoo ]; then
124 | [ -f $ROOT/etc/init.d/elogind ] && _run rc-update add elogind boot
125 | [ -f $ROOT/etc/init.d/dbus ] && _run rc-update add elogind boot
126 | [ -f $ROOT/etc/init.d/display-manager ] && {
127 | sed 's,DISPLAYMANAGER=.*,DISPLAYMANAGER=\"slim\"' -i $ROOT/etc/conf.d/display-manager
128 | _run rc-update add display-manager default
129 | }
130 | fi
131 |
132 | # create user
133 | # 'useradd -R' not copy all skel files, use _run instead
134 | #useradd -R $ROOT -m -G users,wheel,audio,video -s /bin/bash $USERNAME
135 | _run useradd -m -G users,wheel,audio,video -s /bin/bash $USERNAME
136 | echo "$USERNAME:$USER_PSWD" | chpasswd -R $ROOT -c SHA512
137 |
138 | # root pswd
139 | echo "root:$ROOT_PSWD" | chpasswd -R $ROOT -c SHA512
140 |
141 | # initramfs
142 | case $NAME in
143 | Slackware) echo "#!/bin/sh" > $ROOT/tmp/geninitrd.sh
144 | _run /usr/share/mkinitrd/mkinitrd_command_generator.sh | grep ^mkinitrd >> /tmp/geninitrd.sh
145 | _run sh /tmp/geninitrd.sh
146 | rm -f $ROOT/tmp/geninitrd.sh;;
147 | Venom*) _run mkinitramfs;;
148 | Gentoo) _run emerge --config sys-kernel/gentoo-kernel
149 | esac
150 |
151 | # grub
152 | if [ "$BOOTLOADER" != skip ]; then
153 | echo GRUB_DISABLE_OS_PROBER=false >> $ROOT/etc/default/grub
154 | if [ "$EFI_SYSTEM" = 1 ]; then
155 | # EFI
156 | _run grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=live_grub --recheck $BOOTLOADER
157 | else
158 | # mbr
159 | _run grub-install --target=i386-pc $BOOTLOADER
160 | fi
161 | _run grub-mkconfig -o /boot/grub/grub.cfg
162 | fi
163 |
--------------------------------------------------------------------------------
/liverootfs/root/splash.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emmett1/linuxliveiso/6a8e18d5a15e2cf8fab19ca537104cd9ee057180/liverootfs/root/splash.png
--------------------------------------------------------------------------------
/liverootfs/usr/bin/live-chroot:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | #
3 | # script to enter chroot
4 | #
5 |
6 | printhelp() {
7 | cat << EOF
8 |
9 | Usage:
10 | $(basename $0) [command]
11 |
12 | If 'command' is unspecified, ${0##*/} will launch /bin/sh.
13 |
14 | EOF
15 | }
16 |
17 | msgerr() {
18 | echo "ERROR: $*"
19 | }
20 |
21 | unmount() {
22 | while true; do
23 | mountpoint -q $1 || break
24 | umount $1 2>/dev/null
25 | done
26 | }
27 |
28 | [ "$(id -u)" = "0" ] || {
29 | msgerr "$(basename $0) need root access!"
30 | printhelp
31 | exit 1
32 | }
33 |
34 | TARGET=$1
35 |
36 | [ "$1" ] || {
37 | msgerr "Please set directory for chroot!"
38 | printhelp
39 | exit 1
40 | }
41 |
42 | [ -d "$TARGET" ] || {
43 | msgerr "Directory '$TARGET' not exist!"
44 | printhelp
45 | exit 1
46 | }
47 |
48 | shift
49 |
50 | if [ ! "$1" ]; then
51 | CMD="/bin/sh"
52 | else
53 | CMD=$*
54 | fi
55 |
56 | if [ -e /sys/firmware/efi/systab ]; then
57 | EFI_SYSTEM=1
58 | fi
59 |
60 | mount --bind /dev $TARGET/dev
61 | mount -t devpts devpts $TARGET/dev/pts -o gid=5,mode=620
62 | mount -t proc proc $TARGET/proc
63 | mount -t sysfs sysfs $TARGET/sys
64 | if [ -n "$EFI_SYSTEM" ]; then
65 | mount --bind /sys/firmware/efi/efivars $TARGET/sys/firmware/efi/efivars
66 | fi
67 | mount -t tmpfs tmpfs $TARGET/run
68 |
69 | if [ -h $TARGET/dev/shm ]; then
70 | mkdir -p $TARGET/$(readlink $TARGET/dev/shm)
71 | fi
72 |
73 | [ -f $TARGET/etc/resolv.conf ] && {
74 | backupresolvconf=1
75 | mv $TARGET/etc/resolv.conf $TARGET/etc/resolv.conf.tmp
76 | }
77 | cp -L /etc/resolv.conf $TARGET/etc
78 |
79 | chroot "$TARGET" /usr/bin/env -i \
80 | HOME=/root \
81 | TERM="$TERM" \
82 | PS1='\u:\w\$ ' \
83 | PATH=/bin:/usr/bin:/sbin:/usr/sbin $CMD
84 |
85 | retval=$?
86 |
87 | [ "$backupresolvconf" = 1 ] && {
88 | mv $TARGET/etc/resolv.conf.tmp $TARGET/etc/resolv.conf
89 | }
90 |
91 | unmount $TARGET/dev/pts
92 | unmount $TARGET/dev
93 | unmount $TARGET/run
94 | unmount $TARGET/proc
95 | if [ -n "$EFI_SYSTEM" ]; then
96 | unmount $TARGET/sys/firmware/efi/efivars
97 | fi
98 | unmount $TARGET/sys
99 |
100 | exit $retval
101 |
--------------------------------------------------------------------------------
/liverootfs/usr/bin/live-installer:
--------------------------------------------------------------------------------
1 | #!/bin/sh -e
2 |
3 | showdisk() {
4 | lsblk -nrp -o NAME,TYPE | grep -w disk | awk '{print $1}'
5 | }
6 |
7 | showswap() {
8 | fdisk -l | grep ^\/dev | grep swap | awk '{print $1}'
9 | }
10 |
11 | showpartition() {
12 | fdisk -l | grep ^\/dev | grep -Ev '(swap|Extended|EFI|BIOS|Empty)' | awk '{print $1}'
13 | }
14 |
15 | showkeymap() {
16 | [ -d /usr/share/keymaps/ ] && _kmdir=/usr/share/keymaps
17 | [ -d /usr/share/kbd/keymaps/ ] && _kmdir=/usr/share/kbd/keymaps
18 | if [ "$_kmdir" ]; then
19 | find $_kmdir -type f -iname "*.map.gz" -printf "%f\n" | sed 's|.map.gz||g' | sort
20 | else
21 | echo us
22 | fi
23 | }
24 |
25 | showlocale() {
26 | echo "en_US UTF-8" > /tmp/locale && localefile=/tmp/locale # dummy
27 | [ -f /etc/locales ] && localefile=/etc/locales # venom
28 | [ -f /etc/locale.gen ] && localefile=/etc/locale.gen # arch & crux
29 | [ -f /etc/default/libc-locales ] && localefile=/etc/default/libc-locales # void
30 | grep "UTF-8" $localefile | awk '{print $1}' | sed 's/^#//;s/\.UTF-8//;/@/d'
31 | rm -f /tmp/locale
32 | }
33 |
34 | get_partition_info() {
35 | echo -n "$1 - "
36 | lsblk -nrp -o NAME,SIZE,FSTYPE,LABEL | grep -v ventoy | grep -w $1 | cut -d ' ' -f2-
37 | }
38 |
39 | title() {
40 | cprint "LIVE LINUX INSTALLER"
41 | printline
42 | echo
43 | }
44 |
45 | cclear() {
46 | clear
47 | title
48 | }
49 |
50 | prompt_user() {
51 | echo
52 | cols=$(tput cols)
53 | text=$@
54 | length=${#text}
55 | pad=$(( (cols - length) / 2 ))
56 | printf "%*s%s" $pad "" "$text"
57 | }
58 |
59 | cprint() {
60 | cols=$(tput cols)
61 | text=$@
62 | length=${#text}
63 | pad=$(( (cols - length) / 2 ))
64 | printf "%*s%s\n" $pad "" "$text"
65 | }
66 |
67 | printline() {
68 | cols=$(tput cols)
69 | printf "%${cols}s\n" "" | tr " " "*"
70 | }
71 |
72 | choose_part() {
73 | unset part createpart filesystem_var
74 | case $1 in
75 | 1) grep_regex=EFI;;
76 | 2) grep_regex=BIOS;;
77 | 3) grep_regex=swap;;
78 | *) grep_regex="-Ev (swap|Extended|EFI|BIOS|Empty)"
79 | esac
80 | [ "$root_var" ] && exclude_root="grep -v ^${root_var%%:*}" || exclude_root=cat
81 | [ "$home_var" ] && exclude_home="grep -v ^${home_var%%:*}" || exclude_home=cat
82 | while [ ! "$part" ]; do
83 | cclear
84 | count=0
85 | for i in $(fdisk -l | grep ^\/dev | grep -v ventoy | grep $grep_regex | awk '{print $1}' | sort | $exclude_root | $exclude_home); do
86 | count=$((count+1))
87 | ii=$(get_partition_info $i)
88 | cprint "$count. $ii"
89 | done
90 | cprint "0. back"
91 | prompt_user "Choose partition [1-$count]: "
92 | read input
93 | [ "$input" = 0 ] && break
94 | [ "$input" -gt "$count" ] && continue
95 | part=$(fdisk -l | grep ^\/dev | grep -v ventoy | grep $grep_regex | awk '{print $1}' | sort | $exclude_root | $exclude_home | head -n$input | tail -n1)
96 | case $1 in
97 | 1|2);;
98 | 3) if [ "$(lsblk -nrp -o FSTYPE $part)" = swap ]; then
99 | while [ ! "$createpart" ]; do
100 | cclear
101 | cprint "1. create swap"
102 | cprint "0. skip create swap"
103 | prompt_user "Create swap partition for '$part'?: "
104 | read input
105 | [ "$input" = 0 ] && createpart=$input
106 | [ "$input" = 1 ] && createpart=$input
107 | done
108 | else
109 | createpart=1
110 | fi;;
111 | *) if [ "$(lsblk -nrp -o FSTYPE $part)" ]; then
112 | while [ ! "$createpart" ]; do
113 | cclear
114 | cprint "1. create filesystem"
115 | cprint "0. skip create filesystem"
116 | prompt_user "Create filesystem for '$part'?: "
117 | read input
118 | [ "$input" = 0 ] && createpart=$input
119 | [ "$input" = 1 ] && createpart=$input
120 | done
121 | else
122 | createpart=1
123 | fi
124 | if [ "$createpart" -gt 0 ]; then
125 | while [ ! "$filesystem_var" ]; do
126 | fs="ext4 ext3 ext2 btrfs reiserfs xfs"
127 | cclear
128 | count=0
129 | for i in $fs; do
130 | command -v mkfs.$i >/dev/null || continue
131 | count=$((count+1))
132 | cprint "$count. $i"
133 | done
134 | prompt_user "Choose filesystem type for '$part' [1-$count]: "
135 | read input
136 | [ "$input" = 0 ] && continue
137 | [ "$input" -gt "$count" ] && continue
138 | filesystem_var=$(echo $fs | tr ' ' '\n' | head -n$input | tail -n1)
139 | done
140 | else
141 | filesystem_var=skip
142 | fi;;
143 | esac
144 | done
145 | if [ "$part" ]; then
146 | case $1 in
147 | 1) efi_var=$part;;
148 | 2) biosboot_var=$part;;
149 | 3) swap_var=$part:$createpart;;
150 | 4) root_var=$part:$filesystem_var;;
151 | 5) home_var=$part:$filesystem_var;;
152 | esac
153 | fi
154 | }
155 |
156 | modify_disk() {
157 | unset disk disktool
158 | while [ ! "$disk" ]; do
159 | cclear
160 | count=0
161 | for i in $(showdisk); do
162 | count=$((count+1))
163 | ii=$(get_partition_info $i)
164 | cprint "$count. $ii"
165 | done
166 | prompt_user "Enter disk [1-$count]: "
167 | read input
168 | [ "$input" = 0 ] && continue
169 | [ "$input" -gt "$count" ] && continue
170 | disk=$(showdisk | head -n$input | tail -n1)
171 | done
172 | while [ ! "$disktool" ]; do
173 | cclear
174 | cprint "1. cfdisk"
175 | cprint "2. fdisk"
176 | prompt_user "Select tool for partitioning disk $disk: "
177 | read input
178 | case $input in
179 | 1) disktool=cfdisk;;
180 | 2) disktool=fdisk;;
181 | esac
182 | done
183 | $disktool $disk
184 | }
185 |
186 | config_rootpart() {
187 | unset partstatus
188 | print_partitioning_tips
189 | while [ ! "$partstatus" ]; do
190 | cclear
191 | cprint "*** NOTE ***"
192 | cprint "* 'EFI' only required on UEFI boot, atleast 100MB"
193 | cprint "* 'BIOS boot' only required on BIOS boot + gpt disk, atleast 1MB"
194 | cprint "* '/' is required to start installation"
195 | echo
196 | cprint "1. EFI - $efi_var"
197 | cprint "2. BIOS boot - $biosboot_var"
198 | cprint "3. swap - $swap_var"
199 | cprint "4. / - $root_var"
200 | cprint "5. /home - $home_var"
201 | cprint "0. done"
202 | cprint "00. modify disk"
203 | prompt_user "Choose above to configure: "
204 | read input
205 | case $input in
206 | 1|2|3|4|5) choose_part $input;;
207 | 0) partstatus=done;;
208 | 00) modify_disk;;
209 | esac
210 | done
211 | if [ "$root_var" ]; then
212 | if [ "$EFI_SYSTEM" = 1 ]; then
213 | if [ "$(lsblk -nrp -o PTTYPE ${root_var%%:*})" != gpt ]; then
214 | cprint "Disk type for root (${root_var%%:*}) partition not 'gpt'!"
215 | partstatus=error
216 | sleep 2
217 | fi
218 | if [ ! "$efi_var" ]; then
219 | cprint "'EFI' partition not configured!"
220 | partstatus=error
221 | sleep 2
222 | fi
223 | else
224 | if [ "$(lsblk -nrp -o PTTYPE ${root_var%%:*})" = gpt ]; then
225 | if [ ! "$biosboot_var" ]; then
226 | cprint "'BIOS boot' partition not configured!"
227 | partstatus=error
228 | sleep 2
229 | fi
230 | fi
231 | fi
232 | else
233 | cprint "'/' is not set!"
234 | partstatus=error
235 | sleep 2
236 | fi
237 | }
238 |
239 | config_keymap() {
240 | unset KEYMAP keymappart
241 | while [ ! "$keymappart" ]; do
242 | cclear
243 | prompt_user "Enter part of your keymap (Eg: us): "
244 | read input
245 | keymappart=$(showkeymap | grep $input) || true
246 | done
247 | while [ ! "$KEYMAP" ]; do
248 | cclear
249 | count=0
250 | for i in $keymappart; do
251 | count=$((count+1))
252 | cprint "$count. $i"
253 | done
254 | prompt_user "Enter keymap [1-$count]: "
255 | read input
256 | [ "$input" = 0 ] && continue
257 | [ "$input" -gt "$count" ] && continue
258 | KEYMAP=$(echo $keymappart | tr ' ' '\n' | head -n$input | tail -n1)
259 | done
260 | }
261 |
262 | config_locale() {
263 | unset localepart LOCALE
264 | while [ ! "$localepart" ]; do
265 | cclear
266 | prompt_user "Enter part of your locale (Eg: en): "
267 | read input
268 | localepart=$(showlocale | grep -i $input) || true
269 | done
270 | while [ ! "$LOCALE" ]; do
271 | cclear
272 | count=0
273 | for i in $localepart; do
274 | count=$((count+1))
275 | cprint "$count. $i"
276 | done
277 | prompt_user "Enter locale [1-$count]: "
278 | read input
279 | [ "$input" = 0 ] && continue
280 | [ "$input" -gt "$count" ] && continue
281 | LOCALE=$(echo $localepart | tr ' ' '\n' | head -n$input | tail -n1)
282 | done
283 | }
284 |
285 | config_hostname() {
286 | cclear
287 | if [ "$HOSTNAME" ]; then
288 | _preset=$HOSTNAME
289 | else
290 | _preset=linux
291 | fi
292 | prompt_user "Enter hostname [$_preset]: "
293 | read input
294 | if [ "$input" ]; then
295 | HOSTNAME=$input
296 | else
297 | HOSTNAME=$_preset
298 | fi
299 | }
300 |
301 | config_useraccount() {
302 | unset USER_PSWD
303 | while [ ! "$USER_PSWD" ]; do
304 | cclear
305 | if [ "$USERNAME" ]; then
306 | _preset=$USERNAME
307 | else
308 | _preset=user
309 | fi
310 | prompt_user "Enter username [$_preset]: "
311 | read input
312 | if [ "$input" ]; then
313 | USERNAME=$input
314 | else
315 | USERNAME=$_preset
316 | fi
317 | prompt_user "Enter password for user '$USERNAME' (hidden): "
318 | stty -echo
319 | read input
320 | echo
321 | prompt_user "Enter password for user '$USERNAME' again (hidden): "
322 | read input2
323 | stty echo
324 | echo
325 | if [ "$input" = "$input2" ]; then
326 | USER_PSWD=$input
327 | else
328 | cprint "Password does not match!. Try again."
329 | sleep 1
330 | fi
331 | done
332 | }
333 |
334 | config_rootpswd() {
335 | unset ROOT_PSWD
336 | while [ ! "$ROOT_PSWD" ]; do
337 | cclear
338 | prompt_user "Enter password for root (hidden): "
339 | stty -echo
340 | read input
341 | echo
342 | prompt_user "Enter password for root again (hidden): "
343 | read input2
344 | stty echo
345 | echo
346 | if [ "$input" = "$input2" ]; then
347 | ROOT_PSWD=$input
348 | else
349 | cprint "Password does not match!. Try again."
350 | sleep 1
351 | fi
352 | done
353 | }
354 |
355 | config_bootloader() {
356 | unset BOOTLOADER
357 | while [ ! "$BOOTLOADER" ]; do
358 | cclear
359 | count=0
360 | for i in $(showdisk); do
361 | count=$((count+1))
362 | ii=$(get_partition_info $i)
363 | cprint "$count. $ii"
364 | done
365 | cprint "0. skip"
366 | prompt_user "Enter disk [0-$count]: "
367 | read input
368 | [ "$input" -gt "$count" ] && continue
369 | if [ "$input" = 0 ]; then
370 | BOOTLOADER=skip
371 | else
372 | BOOTLOADER=$(showdisk | head -n$input | tail -n1)
373 | fi
374 | done
375 | }
376 |
377 | config_timezone() {
378 | unset TIMEZONE location country listloc listc countrypart
379 | # location
380 | for l in /usr/share/zoneinfo/*; do
381 | [ -d $l ] || continue
382 | l=${l##*/}
383 | case $l in
384 | Etc|posix|right) continue;;
385 | esac
386 | listloc="$listloc $l"
387 | done
388 | while [ ! "$location" ]; do
389 | cclear
390 | count=0
391 | for l in $listloc; do
392 | count=$((count+1))
393 | cprint "$count. $l"
394 | done
395 | prompt_user "Enter location [1-$count]: "
396 | read input
397 | [ "$input" = 0 ] && continue
398 | [ "$input" -gt "$count" ] && continue
399 | location=$(echo $listloc | tr ' ' '\n' | head -n$input | tail -n1)
400 | done
401 | # country
402 | for c in /usr/share/zoneinfo/$location/*; do
403 | c=${c##*/}
404 | listc="$listc $c"
405 | done
406 | while [ ! "$countrypart" ]; do
407 | cclear
408 | prompt_user "Enter part of your country name (Eg: us): "
409 | read input
410 | countrypart=$(echo $listc | tr ' ' '\n' | grep -i $input)
411 | done
412 | while [ ! "$country" ]; do
413 | cclear
414 | count=0
415 | for c in $countrypart; do
416 | count=$((count+1))
417 | cprint "$count. $c"
418 | done
419 | prompt_user "Enter country [1-$count]: "
420 | read input
421 | [ "$input" = 0 ] && continue
422 | [ "$input" -gt "$count" ] && continue
423 | country=$(echo $countrypart | tr ' ' '\n' | head -n$input | tail -n1)
424 | done
425 | TIMEZONE=$location/$country
426 | }
427 |
428 | check_var() {
429 | cclear
430 | unset error
431 | [ "$root_part" ] || { error=1; cprint "partition for / is not set up"; }
432 | [ "$KEYMAP" ] || { error=1; cprint "keymap is not set up"; }
433 | [ "$TIMEZONE" ] || { error=1; cprint "timezone is not set up"; }
434 | [ "$LOCALE" ] || { error=1; cprint "locale is not set up"; }
435 | [ "$HOSTNAME" ] || { error=1; cprint "hostname is not set up"; }
436 | [ "$USERNAME" ] || { error=1; cprint "user is not set up"; }
437 | [ "$ROOT_PSWD" ] || { error=1; cprint "root password is not set up"; }
438 | [ "$BOOTLOADER" ] || { error=1; cprint "bootloader is not set up"; }
439 | if [ "$error" = 1 ]; then
440 | prompt_user "Press ENTER to back to main menu..."
441 | read input
442 | return 1
443 | fi
444 | }
445 |
446 | start_install() {
447 | cclear
448 |
449 | swap_part=${swap_var%:*}
450 | swap_part_create=${swap_var#*:}
451 | root_part=${root_var%:*}
452 | root_part_fs=${root_var#*:}
453 | home_part=${home_var%:*}
454 | home_part_fs=${home_var#*:}
455 |
456 | check_var || return 0
457 |
458 | # overview
459 | cprint "*** Partition Overview ***"
460 | echo
461 | [ "$swap_part_create" != skip ] && cprint "$swap_part will be format into swap"
462 | [ "$root_part_fs" != skip ] && cprint "$root_part will be format into $root_part_fs"
463 | if [ "$home_part_fs" ] || [ "$home_part_fs" != skip ]; then
464 | cprint "$home_part will be format into $home_part_fs"
465 | fi
466 |
467 | prompt_user "Press ENTER to continue installation..."
468 | read input
469 |
470 | mountpoint -q $ROOT && umount -Rf $ROOT
471 |
472 | rm -fr $ROOT
473 | mkdir -p $ROOT
474 |
475 | if [ "$root_part_fs" != skip ]; then
476 | echo "Create filesystem $root_part_fs on $root_part"
477 | case $root_part_fs in
478 | ext4|ext3|ext2) mkfs.$root_part_fs -F $root_part;;
479 | xfs) mkfs.xfs -f -m crc=0 $root_part;;
480 | reiserfs) mkreiserfs -q $root_part;;
481 | btrfs) mkfs.btrfs -f $root_part;;
482 | esac
483 | fi
484 |
485 | echo "Mounting $root_part on $ROOT"
486 | mount $root_part $ROOT
487 |
488 | if [ "$home_part" ]; then
489 | if [ "$home_part_fs" != skip ]; then
490 | echo "Create filesystem $home_part_fs on $home_part"
491 | case $home_part_fs in
492 | ext4|ext3|ext2) mkfs.$home_part_fs -F -L Home $home_part;;
493 | xfs) mkfs.xfs -f -m crc=0 -L Home $home_part;;
494 | reiserfs) mkreiserfs -q -l Home $home_part;;
495 | btrfs) mkfs.btrfs -f -L Home $home_part;;
496 | esac
497 | fi
498 | echo "Mount $home_part to $ROOT/home"
499 | mkdir -p $ROOT/home
500 | mount $home_part $ROOT/home
501 | fi
502 |
503 |
504 | if [ "$swap_part_create" != skip ]; then
505 | echo "Making swap partition on $swap_part"
506 | mkswap $swap_part
507 | fi
508 |
509 | if [ "$EFI_SYSTEM" = 1 ]; then
510 | echo "Formatting partition $efi_var to fat32"
511 | mkfs.vfat -F32 $efi_var
512 | echo "Mounting $efi_var on $ROOT/boot/efi"
513 | mkdir -p $ROOT/boot/efi
514 | mount $efi_var $ROOT/boot/efi
515 | fi
516 |
517 | echo "Installing system to $root_partition_var"
518 | unsquashfs -f -i -d $ROOT $ROOTSFS
519 |
520 | if [ -f /root/post-extract.sh ]; then
521 | echo "running post-extract.sh script"
522 | chmod +x /root/post-extract.sh
523 | LIVEROOTFS=$LIVEROOTFS ROOT=$ROOT /root/post-extract.sh
524 | fi
525 |
526 | # fstab
527 | echo "Setup fstab"
528 | echo "# " > $ROOT/etc/fstab
529 |
530 | # EFI partition
531 | if [ "$EFI_SYSTEM" = 1 ]; then
532 | echo "UUID=$(blkid -o value -s UUID "$efi_var") /boot/efi vfat defaults 0 2" >> $ROOT/etc/fstab
533 | fi
534 |
535 | # swap
536 | if [ "$swap_part" ]; then
537 | echo "UUID=$(blkid -o value -s UUID "$swap_part") swap swap pri=1 0 0" >> $ROOT/etc/fstab
538 | fi
539 |
540 | # root
541 | echo "UUID=$(blkid -o value -s UUID "$root_part") / $(lsblk -nrp -o FSTYPE $root_part) defaults 1 1" >> $ROOT/etc/fstab
542 |
543 | # /home
544 | if [ "$home_part" ]; then
545 | echo "UUID=$(blkid -o value -s UUID "$home_part") /home $(lsblk -nrp -o FSTYPE $home_part) defaults 0 0" >> $ROOT/etc/fstab
546 | fi
547 |
548 | if [ -f /root/post-install.sh ]; then
549 | echo "running post-install.sh script"
550 | chmod +x /root/post-install.sh
551 | ROOT=$ROOT \
552 | HOSTNAME=$HOSTNAME \
553 | TIMEZONE=$TIMEZONE \
554 | KEYMAP=$KEYMAP \
555 | USERNAME=$USERNAME \
556 | USER_PSWD=$USER_PSWD \
557 | ROOT_PSWD=$ROOT_PSWD \
558 | LOCALE=$LOCALE \
559 | BOOTLOADER=$BOOTLOADER \
560 | EFI_SYSTEM=$EFI_SYSTEM \
561 | /root/post-install.sh
562 | fi
563 |
564 | prompt_user "Installation completed, press ENTER to continue..."
565 | read input
566 |
567 | while [ ! "$done" ]; do
568 | cclear
569 | cprint "Installation complete!"
570 | echo
571 | cprint "1. exit installer"
572 | cprint "2. chroot into installed system"
573 | cprint "3. reboot"
574 | cprint "4. poweroff"
575 | prompt_user "choose option: "
576 | read input
577 | case $input in
578 | 1) umount -R $ROOT;;
579 | 2) umount -R $ROOT; reboot;;
580 | 3) umount -R $ROOT; poweroff;;
581 | 4) live-chroot $ROOT /bin/bash; umount -R $ROOT;;
582 | esac
583 | [ "$input" = 0 ] && continue
584 | [ "$input" -gt "3" ] && continue
585 | done=$input
586 | done
587 | exit 0
588 | }
589 |
590 | print_partitioning_tips() {
591 | cclear
592 | cprint "# Partitioning Tips #"
593 | echo
594 | cprint "For BIOS systems, MBR or GPT partition tables are supported. To use GPT"
595 | cprint "partition in BIOS system 1MB partition must be created and set as 'BIOS"
596 | cprint "boot'. For EFI systems, GPT partition is required and a FAT32 partition"
597 | cprint "with at least 100MB set as 'EFI System' must be created. This partition"
598 | cprint "will be used as 'EFI System Partition' with '/boot/efi' as mountpoint."
599 | prompt_user "Press ENTER to continue..."
600 | read input
601 | }
602 |
603 | print_selection() {
604 | cprint "1. partitions: $partstatus"
605 | cprint "2. keymap: $KEYMAP"
606 | cprint "3. timezone: $TIMEZONE"
607 | cprint "4. locale: $LOCALE"
608 | cprint "5. hostname: $HOSTNAME"
609 | cprint "6. user account: $USERNAME $(echo $USER_PSWD | tr '[:alpha:]' '*' | tr '[:alnum:]' '*')"
610 | cprint "7. root account: $(echo $ROOT_PSWD | tr '[:alpha:]' '*' | tr '[:alnum:]' '*')"
611 | cprint "8. bootloader: $BOOTLOADER"
612 | cprint "9. Starts Installation"
613 | cprint "0. exit installer"
614 | }
615 |
616 | main() {
617 | while true; do
618 | cclear
619 | print_selection
620 | prompt_user "Enter choice [1-9]: "
621 | read input
622 | case $input in
623 | 1) config_rootpart;;
624 | 2) config_keymap;;
625 | 3) config_timezone;;
626 | 4) config_locale;;
627 | 5) config_hostname;;
628 | 6) config_useraccount;;
629 | 7) config_rootpswd;;
630 | 8) config_bootloader;;
631 | 9) start_install; exit 0;;
632 | 0) exit;;
633 | esac
634 | done
635 | }
636 |
637 | if [ "$(id -u)" != 0 ]; then
638 | echo "root access required to install!"
639 | exit 1
640 | fi
641 |
642 | ROOT=/mnt/install
643 |
644 | if [ -f "/run/initramfs/ram/rootfs.sfs" ]; then
645 | ROOTSFS="/run/initramfs/ram/rootfs.sfs"
646 | LIVEROOTFS="/run/initramfs/ram/rootfs"
647 | else
648 | ROOTSFS="/run/initramfs/medium/boot/rootfs.sfs"
649 | LIVEROOTFS="/run/initramfs/medium/rootfs"
650 | fi
651 |
652 | if [ -e /sys/firmware/efi/systab ]; then
653 | EFI_SYSTEM=1
654 | fi
655 |
656 | main
657 |
658 | exit 0
659 |
--------------------------------------------------------------------------------
/mkiso.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh -e
2 |
3 | msg() {
4 | echo "-> $@"
5 | }
6 |
7 | run_chroot() {
8 | ./live-chroot $ROOTFS $@
9 | }
10 |
11 | unmount() {
12 | while true; do
13 | mountpoint -q $1 || break
14 | umount $1 2>/dev/null
15 | done
16 | }
17 |
18 | if [ ! $(command -v mksquashfs) ]; then
19 | echo "mksquashfs not found"
20 | exit 1
21 | fi
22 |
23 | if [ ! $(command -v xorriso) ]; then
24 | echo "xorriso not found"
25 | exit 1
26 | fi
27 |
28 | if [ ! "$1" ]; then
29 | echo "usage:
30 | $0 "
31 | exit 1
32 | fi
33 |
34 | if [ ! -d "$1" ]; then
35 | echo "rootfs directory not exist"
36 | exit 1
37 | fi
38 |
39 | ROOTFS=$(realpath $1)
40 |
41 | #case ${ROOTFS##*/} in
42 | #rootfs-*) continue;;
43 | #*) echo "please use name format 'rootfs-' for rootfs directory"
44 | #echo "'' will be use as the output name of your iso"
45 | #echo "eg:"
46 | #echo " rootfs-gentoo-systemd-multilib"
47 | #echo
48 | #echo "your output iso is gentoo-systemd-multilib-.iso"
49 | #exit 1;;
50 | #esac
51 |
52 | distroname=${ROOTFS##*/}; distroname=${distroname#*-}
53 | ISONAME=$distroname-$(date +"%Y%m%d")
54 |
55 | # your exclude dirs here eg: var/cache/somedir/*
56 | #YOUR_EXCLUDE_DIRS=""
57 |
58 | # slackware
59 | EXCLUDE_DIRS="$EXCLUDE_DIRS var/lib/sbopkg/* var/cache/sbopkg/* var/lib/slackpkg/*"
60 |
61 | # gentoo
62 | EXCLUDE_DIRS="$EXCLUDE_DIRS var/cache/distfiles/* var/tmp/*"
63 |
64 | # summerize exclude dirs
65 | for i in $EXCLUDE_DIRS $YOUR_EXCLUDE_DIRS; do
66 | squashfsexclude="$squashfsexclude -e $ROOTFS/$i"
67 | done
68 |
69 | if [ -f $ROOTFS/usr/lib/os-release ]; then
70 | . $ROOTFS/usr/lib/os-release
71 | elif [ -f $ROOTFS/etc/os-release ]; then
72 | . $ROOTFS/etc/os-release
73 | fi
74 | DISTRONAME=${PRETTY_NAME:-LIVEISO LINUX}
75 |
76 | for i in $ROOTFS/boot/*; do
77 | file $i | grep -q bzImage || continue
78 | KERNELFILE=$i
79 | KERNELVER=$(file $i | awk '{print $9}')
80 | done
81 |
82 | if [ ! "$KERNELFILE" ]; then
83 | echo "kernel file does not exist"
84 | exit 1
85 | fi
86 |
87 | if [ ! -d "$ROOTFS/usr/lib/modules/$KERNELVER" ] && [ ! -d "$ROOTFS/lib/modules/$KERNELVER" ]; then
88 | echo "kernel directory does not exist"
89 | exit 1
90 | fi
91 |
92 | if [ -d "$ROOTFS/usr/lib/grub/x86_64-efi" ]; then
93 | GRUBEFIDIR="$ROOTFS/usr/lib/grub/x86_64-efi"
94 | elif [ -d "$ROOTFS/usr/lib64/grub/x86_64-efi" ]; then
95 | GRUBEFIDIR="$ROOTFS/usr/lib64/grub/x86_64-efi"
96 | else
97 | echo "grub-efi files not found on target system"
98 | exit 1
99 | fi
100 |
101 | # overview
102 | echo
103 | echo "distro : $DISTRONAME"
104 | echo "output : iso/$ISONAME.iso"
105 | echo "kernel : $KERNELFILE ($KERNELVER)"
106 | echo
107 |
108 | msg "preparing working dirs..."
109 | rm -fr work/_live
110 | mkdir -p work/_live/boot
111 | mkdir -p work/_live/isolinux
112 | mkdir -p work/_live/rootfs
113 |
114 | msg "copy over liverootfs..."
115 | if [ -d liverootfs ]; then
116 | cp -ra liverootfs/* work/_live/rootfs/
117 | chown -R 0:0 work/_live/rootfs
118 | fi
119 |
120 | if [ -d liverootfs-$distroname ]; then
121 | msg "copy over liverootfs-$distroname..."
122 | cp -ra liverootfs-$distroname/* work/_live/rootfs/
123 | chown -R 0:0 work/_live/rootfs
124 | fi
125 |
126 | [ -f work/_live/rootfs/root/splash.png ] && {
127 | mv work/_live/rootfs/root/splash.png work/_live/isolinux
128 | }
129 |
130 | [ -f work/mkinitramfs ] || {
131 | msg "fetching mkinitramfs script..."
132 | curl -o work/mkinitramfs https://raw.githubusercontent.com/venomlinux/mkinitramfs/master/mkinitramfs
133 | }
134 |
135 | [ -f work/init.in ] || {
136 | msg "fetching init script..."
137 | curl -o work/init.in https://raw.githubusercontent.com/venomlinux/mkinitramfs/master/init.in
138 | }
139 |
140 | [ -f work/syslinux-6.03.tar.xz ] || {
141 | msg "fetching syslinux sources..."
142 | curl -L -o work/syslinux-6.03.tar.xz http://www.kernel.org/pub/linux/utils/boot/syslinux/syslinux-6.03.tar.xz
143 | }
144 |
145 | rm -fr work/syslinux-6.03
146 | tar xf work/syslinux-6.03.tar.xz -C work
147 |
148 | for i in $(findmnt --list | awk '{print $1}' | grep $ROOTFS | sort -r); do
149 | [ "$i" = "$ROOTFS" ] && continue
150 | echo ">> unmounting $i"
151 | unmount $i
152 | done
153 |
154 | msg "copy over needed syslinux files..."
155 | cp work/syslinux-6.03/bios/core/isolinux.bin work/_live/isolinux
156 | cp work/syslinux-6.03/bios/com32/chain/chain.c32 work/_live/isolinux
157 | cp work/syslinux-6.03/bios/com32/elflink/ldlinux/ldlinux.c32 work/_live/isolinux
158 | cp work/syslinux-6.03/bios/com32/libutil/libutil.c32 work/_live/isolinux
159 | cp work/syslinux-6.03/bios/com32/lib/libcom32.c32 work/_live/isolinux
160 | cp work/syslinux-6.03/bios/com32/menu/vesamenu.c32 work/_live/isolinux
161 | cp work/syslinux-6.03/bios/com32/menu/menu.c32 work/_live/isolinux
162 | cp work/syslinux-6.03/bios/com32/modules/reboot.c32 work/_live/isolinux
163 | cp work/syslinux-6.03/bios/com32/modules/poweroff.c32 work/_live/isolinux
164 |
165 | if [ -f rootfs-$distroname.sfs ]; then
166 | msg "use existing 'rootfs-$distroname.sfs'..."
167 | cp rootfs-$distroname.sfs work/_live/boot/rootfs.sfs
168 | else
169 | msg "squashing '$ROOTFS'..."
170 | mksquashfs $ROOTFS work/_live/boot/rootfs.sfs \
171 | -b 1048576 \
172 | -comp xz \
173 | -e $ROOTFS/root/* \
174 | -e $ROOTFS/home/* \
175 | -e $ROOTFS/tools* \
176 | -e $ROOTFS/tmp/* \
177 | -e $ROOTFS/dev/* \
178 | -e $ROOTFS/proc/* \
179 | -e $ROOTFS/sys/* \
180 | -e $ROOTFS/run/* \
181 | $squashfsexclude 2>/dev/null
182 | fi
183 |
184 | install -m755 work/mkinitramfs $ROOTFS/tmp/mkinitramfs
185 | install -m755 work/init.in $ROOTFS/tmp/init
186 | install -m644 files/liveiso.hook $ROOTFS/tmp/liveiso.hook
187 | touch $ROOTFS/tmp/mkinitramfs.conf
188 | msg "generating livecd initramfs..."
189 | run_chroot /tmp/mkinitramfs -c /tmp/mkinitramfs.conf -k $KERNELVER -i /tmp/init -a /tmp/liveiso -o /tmp/initrd
190 | rm $ROOTFS/tmp/mkinitramfs $ROOTFS/tmp/init $ROOTFS/tmp/mkinitramfs.conf $ROOTFS/tmp/liveiso.hook
191 |
192 | cp $KERNELFILE work/_live/boot/vmlinuz
193 | mv $ROOTFS/tmp/initrd work/_live/boot/initrd
194 |
195 | msg "setup UEFI mode..."
196 | mkdir -p work/_live/boot/grub/x86_64-efi work/_live/boot/grub/fonts
197 | echo "set prefix=/boot/grub" > work/_live/boot/grub-early.cfg
198 | cp -a $GRUBEFIDIR/*.mod work/_live/boot/grub/x86_64-efi
199 | cp -a $GRUBEFIDIR/*.lst work/_live/boot/grub/x86_64-efi
200 | #if [ -f $ROOTFS/usr/share/grub/*.pf2 ]; then
201 | #cp $ROOTFS/usr/share/grub/*.pf2 work/_live/boot/grub/fonts/unicode.pf2
202 | #fi
203 | cp files/unicode.pf2 work/_live/boot/grub/fonts/
204 | mkdir -p work/_live/efi/boot
205 | grub-mkimage -c work/_live/boot/grub-early.cfg -o work/_live/efi/boot/bootx64.efi -O x86_64-efi -p "" iso9660 normal search search_fs_file
206 | modprobe loop
207 | dd if=/dev/zero of=work/_live/boot/efiboot.img count=4096
208 | mkdosfs -n LIVE-UEFI work/_live/boot/efiboot.img
209 | mkdir -p work/_live/boot/efiboot
210 | mount -o loop work/_live/boot/efiboot.img work/_live/boot/efiboot
211 | mkdir -p work/_live/boot/efiboot/EFI/boot
212 | cp work/_live/efi/boot/bootx64.efi work/_live/boot/efiboot/EFI/boot
213 | unmount work/_live/boot/efiboot
214 | rm -fr work/_live/boot/efiboot
215 |
216 | sed "s/@DISTRONAME@/$DISTRONAME/g" files/grub.cfg > work/_live/boot/grub/grub.cfg
217 | sed "s/@DISTRONAME@/$DISTRONAME/g" files/isolinux.cfg > work/_live/isolinux/isolinux.cfg
218 |
219 | mkdir -p iso
220 | rm -f iso/$ISONAME.iso
221 | xorriso -as mkisofs \
222 | -isohybrid-mbr work/syslinux-6.03/bios/mbr/isohdpfx.bin \
223 | -c isolinux/boot.cat \
224 | -b isolinux/isolinux.bin \
225 | -no-emul-boot \
226 | -boot-load-size 4 \
227 | -boot-info-table \
228 | -eltorito-alt-boot \
229 | -e boot/efiboot.img \
230 | -no-emul-boot \
231 | -isohybrid-gpt-basdat \
232 | -volid LIVEISO \
233 | -o iso/$ISONAME.iso work/_live
234 |
235 | echo "iso created : iso/$ISONAME.iso"
236 | echo "iso size : $(du -h iso/$ISONAME.iso | awk '{print $1}')"
237 | echo
238 |
239 | #rm -fr work/_live work/syslinux-6.03
240 |
--------------------------------------------------------------------------------
/mkrootfs-archlinux.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh -e
2 | #
3 | # - Running Arch Linux as host is required to run this script
4 | # - modify this script to suit your need for your custom iso, mostly at the pkg part
5 | # - this script is not required, you can do however you want to prepare the rootfs
6 |
7 | if [ "$(id -u)" != 0 ]; then
8 | echo "this script need to run as root."
9 | exit 1
10 | fi
11 |
12 | cd $(dirname $0)
13 |
14 | ROOTFS=$PWD/rootfs-archlinux
15 |
16 | echo "[options]
17 | Architecture = auto
18 |
19 | [core]
20 | Include = /etc/pacman.d/mirrorlist
21 |
22 | [extra]
23 | Include = /etc/pacman.d/mirrorlist
24 |
25 | [community]
26 | Include = /etc/pacman.d/mirrorlist
27 |
28 | [customrepo]
29 | SigLevel = Optional TrustAll
30 | Server = file:///home/emmett/aur/customrepo" > work/pacman.conf
31 |
32 | mkdir -p $ROOTFS
33 |
34 | pacstrap -C work/pacman.conf -KMc $ROOTFS base linux linux-firmware grub \
35 | squashfs-tools xorg xorg-xinit openbox xterm pcmanfm firefox geany xarchiver \
36 | tint2 dfc dunst feh gmrun lxappearance-obconf neofetch picom gparted mtools \
37 | sudo ttf-liberation lxdm-gtk3 ntfs-3g polkit-gnome xdg-user-dirs xdg-utils vim \
38 | networkmanager gvfs leafpad volumeicon network-manager-applet
39 |
40 | # this use my custom repo for aur packages
41 | # setup your own custom repo if you wanna add packages from aur
42 | pacstrap -C work/pacman.conf -KMc $ROOTFS arc-gtk-theme openbox-theme-arcbox clipit obmenu-generator paper-icon-theme
43 |
44 | # uncomment all mirrors
45 | sed -i 's/^#Server/Server/' $ROOTFS/etc/pacman.d/mirrorlist
46 | rm -f work/pacman.conf
47 | rm -f rootfs-archlinux/var/lib/pacman/sync/customrepo.db
48 |
--------------------------------------------------------------------------------
/mkrootfs-voidlinux.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh -e
2 | #
3 | # - Running Void Linux as host is required to run this script
4 | # - modify this script to suit your need for your custom iso, mostly at the pkg part
5 | # - this script is not required, you can do however you want to prepare the rootfs
6 |
7 | if [ "$(id -u)" != 0 ]; then
8 | echo "this script need to run as root."
9 | exit 1
10 | fi
11 |
12 | xbps() {
13 | XBPS_ARCH=$ARCH xbps-install -r $ROOTFS -R $REPO -c $PKGDIR $@
14 | }
15 |
16 | xbpsi() {
17 | xbps -y $@
18 | }
19 |
20 | cd $(dirname $0)
21 |
22 | # uncomment any to use it
23 | #mirror=https://repo-fastly.voidlinux.org
24 | #mirror=https://repo-fi.voidlinux.org
25 | #mirror=https://repo-de.voidlinux.org
26 | #mirror=https://mirrors.servercentral.com/voidlinux
27 |
28 | DISTRONAME=${0#*-} # remove 'mkrootfs-' from name
29 | DISTRONAME=${DISTRONAME%.sh} # remove '.sh' from name
30 |
31 | ROOTFS=$PWD/rootfs-$DISTRONAME
32 | PKGDIR=/var/cache/xbps
33 |
34 | case $DISTRONAME in
35 | *musl) musl="-musl";;
36 | esac
37 |
38 | ARCH=x86_64$musl
39 | REPO=${mirror:-https://repo-default.voidlinux.org}/current/${musl#-}
40 |
41 | mkdir -p $ROOTFS/var/db/xbps/keys
42 | cp /var/db/xbps/keys/* $ROOTFS/var/db/xbps/keys/
43 |
44 | mkdir -p $PKGDIR
45 |
46 | # sync repo, and update
47 | xbps -Suy
48 |
49 | # base
50 | xbpsi base-system linux-firmware
51 |
52 | # must have
53 | xbpsi grub grub-x86_64-efi squashfs-tools xz git xorriso
54 |
55 | # extra
56 | xbpsi xorg openbox xterm pcmanfm firefox geany xarchiver elogind tint2 arc-theme \
57 | dfc dunst feh gmrun liberation-fonts-ttf lxappearance-obconf neofetch \
58 | obmenu-generator paper-icon-theme picom slim slim-void-theme gparted mtools \
59 | ntfs-3g polkit-gnome xdg-user-dirs xdg-utils vim NetworkManager gvfs leafpad \
60 | volumeicon network-manager-applet clipit
61 |
--------------------------------------------------------------------------------
/mkrootfs-voidlinux_musl.sh:
--------------------------------------------------------------------------------
1 | mkrootfs-voidlinux.sh
--------------------------------------------------------------------------------
/run_qemu:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | [ -f "$PWD"/qemu-vm.img ] || {
4 | qemu-img create -f qcow2 "$PWD"/qemu-vm.img 50G
5 | }
6 |
7 | qemu-system-x86_64 -enable-kvm \
8 | -cpu host \
9 | -drive file="$PWD"/qemu-vm.img,if=virtio \
10 | -device virtio-rng-pci \
11 | -m 2G \
12 | -smp 4 \
13 | -monitor stdio \
14 | -name "LIVE LINUX VM" \
15 | -boot d \
16 | -cdrom $@
17 |
18 | rm -f "$PWD"/qemu-vm.img
19 |
20 | exit 0
21 |
--------------------------------------------------------------------------------