├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── live-fat-stick ├── live-grub-stick ├── live-usb-gui └── live-usb-gui.desktop /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ============ 2 | Contributing 3 | ============ 4 | 5 | See https://gist.github.com/Chaser324/ce0505fbed06b947d962 for the GitHub Standard Fork & Pull Request Workflow. 6 | 7 | If you have a feature request or a bug report, it has better chance of being integrated/fixed if it comes with a patch. 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | live-fat-stick 2 | ============== 3 | Create multi boot USB stick/hard disk with whole iso/s on vfat/fat32 partition 4 | keeping existing data untouched. 5 | 6 | Note: File size greater than 4G is not usable on vfat/fat32 partition so the 7 | live CD/DVD iso file should not exceed this limit. 8 | 9 | Note2: Install 32bit/x86 iso on the stick first if creating multiboot with both 10 | x86 and x86_64 arch images. 11 | 12 | Note3: Requires: syslinux, qemu-img and dd_rescue/ddrescue installed on the system running this. 13 | 14 | Copy live-fat-stick to /usr/bin/ and chmod +x /usr/bin/live-fat-stick 15 | 16 | Run this command as root (su -, not sudo) 17 | live-fat-stick isopath stickpartition 18 | e.g.: 19 | live-fat-stick /home/geeko/openSUSE-Edu-li-f-e-12.2-1-i686.iso /dev/sdXY 20 | 21 | To add various distribution iso to the stick, run the following: 22 | ``` 23 | For openSUSE: live-fat-stick --suse /path/to/openSUSE-filename.iso /dev/sdXY 24 | For openSUSE with persistence : live-fat-stick --suse-persistent /path/to/openSUSE-filename.iso /dev/sdXY 25 | For Ubuntu clones : live-fat-stick --ubuntu /path/to/ubuntu-filename.iso /dev/sdXY 26 | For Ubuntu clones with persistence : live-fat-stick --ubuntu-persistent /path/to/ubuntu-filename.iso /dev/sdXY 27 | For Mint: live-fat-stick --mint /path/to/mint-filename.iso /dev/sdXY 28 | For Fedora: live-fat-stick --fedora /path/to/fedora-filename.iso /dev/sdXY 29 | For iPXE: live-fat-stick --ipxe /path/to/ipxe.iso /dev/sdXY 30 | 31 | For isohybrid: live-fat-stick --isohybrid /path/to/isohybridimage.iso /dev/sdX 32 | ``` 33 | 34 | isopath should be full absolute path of iso image and the device should be 35 | actual partition on the stick like /dev/sdb1, /dev/sdc1,/dev/sdc2... 36 | 37 | The stick partition has to be vfat/fat32 format if the image is not isohybrid. 38 | 39 | Persistent option requires minimum 500M free space on the USB device apart from the spare needed by iso image. 40 | To allocate more space for cow file use cowfile variable like this example: "export cowsize=1000M" before running the script 41 | 42 | Please note that using isohybrid option will remove all existing data on the USB device 43 | and create new partitions. Also note that /dev/sdX is used 44 | 45 | Run live-fat-stick -l(or --list) to list the possible usb storage devices available. 46 | 47 | openSUSE users can install it via 1-click from here: 48 | http://software.opensuse.org/package/live-fat-stick 49 | 50 | live-grub-stick 51 | ============== 52 | Create multi boot USB stick/hard disk with whole iso/s on any partition supported by grub2 53 | keeping existing data untouched. This tool uses grub2 instead of syslinux to 54 | achieve the same goal as live-fat-stick. 55 | 56 | Note: File size greater than 4G is not usable on vfat/fat32 partition so the 57 | live CD/DVD iso file should not exceed this limit. Use any other grub2 supported filesystem 58 | if the iso file exceeds this limit. 59 | 60 | Note2: Install 32bit/x86 iso on the stick first if creating multiboot with both 61 | x86 and x86_64 arch images. 62 | 63 | Note3: Requires: grub2, qemu-img and dd_rescue/ddrescue installed on the system running this. On Ubuntu grub-pc-bin package is also needed. 64 | 65 | Run this command as root (su -, not sudo) 66 | live-grub-stick isopath stickpartition 67 | e.g.: 68 | live-grub-stick /home/geeko/openSUSE-Edu-li-f-e-12.2-1-i686.iso /dev/sdXY 69 | 70 | To add various distribution iso to the stick, run the following: 71 | ``` 72 | For openSUSE : live-grub-stick --suse /path/to/openSUSE-filename.iso /dev/sdXY 73 | For openSUSE with persistence : live-grub-stick --suse-persistent /path/to/openSUSE-filename.iso /dev/sdXY 74 | For Ubuntu clones : live-grub-stick --ubuntu /path/to/ubuntu-filename.iso /dev/sdXY 75 | For Ubuntu clones with persistence : live-grub-stick --ubuntu-persistent /path/to/ubuntu-filename.iso /dev/sdXY 76 | For Mint: live-grub-stick --mint /path/to/mint-filename.iso /dev/sdXY 77 | For Fedora : live-grub-stick --fedora /path/to/fedora-filename.iso /dev/sdXY 78 | For iPXE: live-grub-stick --ipxe /path/to/ipxe.iso /dev/sdXY 79 | 80 | For isohybrid : live-grub-stick --isohybrid /path/to/isohybridimage.iso /dev/sdX 81 | ``` 82 | 83 | Standard openSUSE DVD or NET installation iso can also be written with --suse option when used 84 | with live-grub-stick, openSUSE DVD on non-vfat partition and NET installation on vfat parition. 85 | 86 | isopath should be full absolute path of iso image and the device should be 87 | actual partition on the stick like /dev/sdb1, /dev/sdc1,/dev/sdc2... 88 | 89 | The stick partition has to be in a format supported by grub2 and the OS image if the image 90 | is not isohybrid. 91 | 92 | Persistent option requires minimum 500M free space on the USB device apart from the spare needed by iso image. 93 | To allocate more space for cow file use cowfile variable like this example: "export cowsize=1000M" before running the script 94 | 95 | Please note that using isohybrid option will remove all existing data on the USB device 96 | and create new partitions. 97 | 98 | Run live-grub-stick -l(or --list) to list the possible usb storage devices available. 99 | 100 | openSUSE users can install it via 1-click from here: 101 | http://software.opensuse.org/package/live-grub-stick 102 | 103 | 104 | live-usb-gui 105 | ============== 106 | Simple zenity/kdialog based GUI that runs live-fat-stick or live-grub-stick script 107 | 108 | Copy live-usb-gui to /usr/bin/ and chmod +x /usr/bin/live-usb-gui 109 | Copy live-usb-gui.desktop to /usr/share/applications/ and update-desktop-database -q 110 | this should make Live USB GUI show up in desktop menu. 111 | 112 | On Ubuntu or distributions that do not have xdg-su, change Exec=xdg-su -c "live-usb-gui" 113 | to Exec=gksudo "live-usb-gui" in live-usb-gui.desktop. Use any xdg-su equivalent command 114 | available. 115 | 116 | Run this command without any options as root from terminal (su -, not sudo) or 117 | Alt+F2 and xdg-su -c "xterm -e live-usb-gui" 118 | 119 | For iso images processed with isohybrid such as openSUSE installation DVD and UEFI boot support 120 | and any other Linux distributions select "isohybrid" from distribution selection dialog. This 121 | will erase all the data from the USB stick. 122 | 123 | Standard openSUSE DVD or NET installation iso can also be written with --suse option when used 124 | with live-grub-stick, openSUSE DVD on non-vfat partition and NET installation on vfat parition. 125 | 126 | Please note that USB created using isohybrid mode will be wiped out completely and 127 | will not be usable from Windows OS, so back up the data from the USB stick before hand. 128 | 129 | openSUSE users can install it via 1-click from here: 130 | http://software.opensuse.org/package/live-usb-gui 131 | 132 | Note: Requires: live-fat-stick or live-grub-stick, zenity/kdialog, syslinux and dd_rescue installed 133 | on the system running this. 134 | 135 | 136 | It is possible to boot multiple distributions and iso images from same device, 137 | should work with all recent distributions' live iso images. Fedora iso is 138 | not copied when live-fat-stick is used but is extracted, when live-grub-stick is used all isos are copied. 139 | 140 | You are welcome to fork and submit patches for your distro if it is not supported by 141 | this script :) 142 | 143 | Cross platform alternative with GUI to these tools: https://github.com/mbusb/multibootusb 144 | 145 | Have a lot of fun... 146 | -------------------------------------------------------------------------------- /live-fat-stick: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # live-fat-stick 3 | # 4 | # Copyright (c) 2012 CyberOrg Info 5 | # Copyright (c) 2014 Mindaugas Baranauskas 6 | 7 | # This program is free software; you can redistribute it and/or modify it under 8 | # the terms of the GNU General Public License as published by the Free Software 9 | # Foundation; either version 2 of the License, or (at your option) any later 10 | # version. 11 | # 12 | # This program is distributed in the hope that it will be useful, but WITHOUT 13 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 14 | # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 15 | # details. 16 | # 17 | # You should have received a copy of the GNU General Public License along with 18 | # this program; if not, write to the Free Software Foundation, Inc., 19 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | # 21 | # Original authors: Jigish Gohil 22 | # Contributors: Mindaugas Baranauskas 23 | # 24 | # This script creates bootable openSUSE, Fedora or Ubuntu(or clones) 25 | # live usb stick on fat partition 26 | # 27 | # To get POT file for localization, execute: 28 | # bash --dump-po-strings live-fat-stick > live-fat-stick.pot 29 | 30 | PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin 31 | ionice -c3 -p$$ 32 | umount_everything () { 33 | sync 34 | if [[ $distroname != isohybrid ]]; then 35 | umount $isomount &>/dev/null 36 | umount $stickdevpart &>/dev/null 37 | rmdir $isomount &>/dev/null || echo "unable to remove $isomount, please remove manually" 38 | umount $stickmount &>/dev/null 39 | while $(mount | grep $stickmount &>/dev/null); do 40 | umount $stickdevpart &>/dev/null 41 | sleep 2 42 | done 43 | rmdir $stickmount &>/dev/null || echo "unable to remove $stickmount, please remove manually" 44 | if [[ -f $liveusbgui ]]; then 45 | rm $liveusbgui &>/dev/null 46 | fi 47 | if [[ -h $iso_symlink ]]; then 48 | rm "$iso_symlink" &>/dev/null 49 | fi 50 | fi 51 | } 52 | clean_up () { 53 | if [[ $1 == user_killed ]] ; then 54 | echo "aborting and cleaning up" 55 | umount_everything 56 | exit 1 57 | else 58 | echo "cleaning up" 59 | umount_everything 60 | echo "Your bootable usb stick is now ready" 61 | echo "have a lot of fun..." 62 | fi 63 | } 64 | trap "clean_up user_killed" SIGINT SIGTERM 65 | need_help() { 66 | cat </dev/null 255 | echo "copying kernel and initrd from iso image to $stickdevpart" 256 | if [[ $distroname == suse ]]; then 257 | if [[ $PERSISTENT_IMAGE == true ]]; then 258 | echo "Creating image file for persistent data" 259 | if ! qemu-img create $stickmount/boot/$isonameshort-cowfile $cowsize &>/dev/null;then 260 | echo "Can't create cow file" 261 | else 262 | persistopts="kiwi_cowdevice=/dev/disk/by-uuid/$stickuuid kiwi_cowsystem=/boot/$isonameshort-cowfile" 263 | fi 264 | fi 265 | rm $stickmount/syslinux.cfg &>/dev/null 266 | if [[ ! -f $stickmount/fatstick ]]; then 267 | cp -r $isomount/boot $stickmount/ 268 | mv $stickmount/boot/*/loader $syslinuxpath 269 | mv $syslinuxpath/linux $syslinuxpath/linux-$isonameshort 270 | mv $syslinuxpath/initrd $syslinuxpath/initrd-$isonameshort 271 | fi 272 | cp $isomount/boot/*/loader/linux $syslinuxpath/linux-$isonameshort 273 | cp $isomount/boot/*/loader/initrd $syslinuxpath/initrd-$isonameshort 274 | if [[ -e $isomount/boot/x86_64/loader/linux ]]; then 275 | isoarch=x86_64 276 | else 277 | isoarch=ix86 278 | fi 279 | if [[ -e $isomount/LiveOS/squashfs.img ]]; then 280 | appendsection="append initrd=initrd-$isonameshort iso-scan/filename=/$isoname root=live:CDLABEL=$isolabel loader=syslinux splash=silent $persistopts quiet showopts" 281 | else 282 | appendsection="append initrd=initrd-$isonameshort isofrom=/dev/disk/by-uuid/$stickuuid:/$isoname isofrom_device=/dev/disk/by-uuid/$stickuuid isofrom_system=/$isoname loader=syslinux splash=silent $persistopts quiet showopts" 283 | fi 284 | isolinux_msg="display isolinux.msg" 285 | ui="ui gfxboot bootlogo isolinux.msg" 286 | fi 287 | if [[ $distroname == ubuntu ]]; then 288 | if [[ $PERSISTENT_IMAGE == true ]]; then 289 | cowfolder=$isonameshort-cow 290 | mkdir -p $stickmount/$cowfolder 291 | echo "Creating image file for persistent data" 292 | if ! qemu-img create $stickmount/$cowfolder/casper-rw $cowsize &>/dev/null;then 293 | echo "Can't create cow file" 294 | else 295 | echo "Creating filesystem for persistent data" 296 | mkfs.ext4 -F -O^has_journal -L casper-rw $stickmount/$cowfolder/casper-rw 297 | persistopts="persistent persistent-path=/$cowfolder/" 298 | fi 299 | fi 300 | mkdir -p $syslinuxpath 301 | if [[ -e $isomount/casper/vmlinuz ]]; then 302 | cp $isomount/casper/vmlinuz $syslinuxpath/linux-$isonameshort 303 | else 304 | cp $isomount/casper/vmlinuz.efi $syslinuxpath/linux-$isonameshort 305 | fi 306 | cp $isomount/casper/initrd.lz $syslinuxpath/initrd-$isonameshort 307 | appendsection="append initrd=initrd-$isonameshort boot=casper iso-scan/filename=/$isoname $persistopts quiet splash" 308 | fi 309 | if [[ $distroname == fedora ]]; then 310 | mkdir -p "$syslinuxpath" 311 | mkdir -p "$stickmount/$isonameshort" 312 | echo "copying the content of iso image, this may take a while" 313 | $benice cp -r "$isomount"/* "/$stickmount/$isonameshort/" 314 | mv "$stickmount/$isonameshort"/isolinux/initrd0.img $syslinuxpath/initrd-$isonameshort 315 | mv "$stickmount/$isonameshort"/isolinux/vmlinuz0 $syslinuxpath/linux-$isonameshort 316 | appendsection="append initrd=initrd-$isonameshort root=UUID=$stickuuid rootfstype=vfat rd.live.dir=/$isonameshort/LiveOS/ ro rd.live.image rd.luks=0 rd.md=0 rd.dm=0 quiet rhgb" 317 | fi 318 | if [[ $distroname == ipxe ]]; then 319 | mkdir -p $syslinuxpath 320 | cp $isomount/ipxe.krn $syslinuxpath/linux-$isonameshort 321 | fi 322 | umount $isomount &>/dev/null 323 | } 324 | syslinux_stuff () { 325 | echo "installing syslinux on $stickdevpart" 326 | syslinux -i $stickdevpart 327 | echo "replacing mbr of $stickdevice with syslinux mbr.bin" 328 | if [[ -e /usr/share/syslinux/mbr.bin ]]; then 329 | dd if=/usr/share/syslinux/mbr.bin of=$stickdevice &>/dev/null 330 | elif [[ -e /usr/lib/syslinux/mbr/mbr.bin ]]; then 331 | dd if=/usr/lib/syslinux/mbr/mbr.bin of=$stickdevice &>/dev/null 332 | else 333 | dd if=/usr/lib/syslinux/mbr.bin of=$stickdevice &>/dev/null 334 | fi 335 | echo "setting $stickdevice partition $stickpart active" 336 | parted $stickdevice set $stickpart boot on &>/dev/null 337 | copy_kernel_initrd 338 | } 339 | add_harddisk_section () { 340 | if ! grep -q localboot $syslinuxpath/syslinux.cfg; then 341 | cat <>$syslinuxpath/syslinux.cfg 342 | 343 | label harddisk 344 | localboot 0x80 345 | EOF 346 | fi 347 | } 348 | add_menu_section_suse () { 349 | if echo $isoname | grep -qi "Li-f-e"; then 350 | cat <>$syslinuxpath/syslinux.cfg 351 | label install 352 | kernel linux-$isonameshort 353 | $appendsection liveinstall 354 | 355 | label Gnome 356 | kernel linux-$isonameshort 357 | $appendsection gnome 358 | 359 | label memtest 360 | kernel memtest 361 | 362 | EOF 363 | fi 364 | add_harddisk_section 365 | 366 | } 367 | create_syslinux_cfg() { 368 | if [[ $distroname == suse ]]; then 369 | cat <$syslinuxpath/syslinux.cfg 370 | implicit 1 371 | prompt 1 372 | timeout 100 373 | $isolinux_msg 374 | $ui 375 | default $isonameshort 376 | 377 | EOF 378 | else 379 | if [[ -e /usr/share/syslinux/vesamenu.c32 ]]; then 380 | cp /usr/share/syslinux/vesamenu.c32 $syslinuxpath/ || echo "vesamenu.c32 cannot be copied" 381 | elif [[ -e /usr/lib/syslinux/modules/bios/vesamenu.c32 ]]; then 382 | cp /usr/lib/syslinux/modules/bios/* $syslinuxpath/ || echo "vesamenu.c32 cannot be copied" 383 | else 384 | cp -r /usr/lib/syslinux/* $syslinuxpath/ || echo "vesamenu.c32 is missing or cannot be copied" 385 | fi 386 | cat <$syslinuxpath/syslinux.cfg 387 | default vesamenu.c32 388 | ONTIMEOUT $isonameshort 389 | ALLOWOPTIONS 0 390 | PROMPT 0 391 | IMPLICIT 1 392 | OPTIONS 1 393 | TIMEOUT 100 394 | 395 | EOF 396 | 397 | fi 398 | } 399 | add_menu_section () { 400 | cat <>$syslinuxpath/syslinux.cfg 401 | 402 | LABEL $isonameshort 403 | kernel linux-$isonameshort 404 | $appendsection 405 | 406 | EOF 407 | if [[ $distroname == suse ]]; then 408 | add_menu_section_suse 409 | fi 410 | } 411 | 412 | echo "Please make sure the following information is correct:" 413 | echo "iso name: $isoname distro: $distroname stick device: $stickdevice" 414 | echo "stick uuid: /dev/disk/by-uuid/$stickuuid stick partition: $stickpart" 415 | if [[ ! -f $liveusbgui ]]; then 416 | are_you_sure "continue ?" "y" "n" 417 | fi 418 | if [[ $distroname == isohybrid ]];then 419 | try_cp_with_progress "$1" "$2" 420 | else 421 | mkdir $isomount $stickmount &>/dev/null 422 | if mount | grep $stickdevpart &>/dev/null; then 423 | if ! umount $stickdevpart &>/dev/null; then 424 | echo "$stickdevpart in use, please umount it before continuing" 425 | exit 1 426 | fi 427 | fi 428 | if ! mount $2 $stickmount &>/dev/null; then 429 | echo "unable to mount the usb stick partition" 430 | exit 1 431 | fi 432 | if [[ -e $stickmount/$isoname ]];then 433 | isopath=$stickmount/$isoname 434 | echo "using existing $isoname on the stick" 435 | else 436 | isopath=$iso_symlink 437 | if [[ $distroname != fedora ]]; then 438 | echo "copying $isoname to usb stick" 439 | try_cp_with_progress "$1" "$stickmount/$isoname" 440 | if [[ $isosize != $(stat -c%s "$stickmount/$isoname") ]]; then 441 | echo "Source and destination image does not match" 442 | exit 1 443 | fi 444 | fi 445 | fi 446 | if [[ -f $stickmount/fatstick ]]; then 447 | echo "the stick is already bootable stick" 448 | if ! grep -q $isonameshort $syslinuxpath/syslinux.cfg; then 449 | copy_kernel_initrd 450 | echo "adding new image to boot menu" 451 | add_menu_section 452 | fi 453 | else 454 | syslinux_stuff 455 | echo "creating menu entries" 456 | create_syslinux_cfg 457 | add_menu_section 458 | fi 459 | touch $stickmount/fatstick 460 | thisscript=$(readlink -f $0) 461 | cp $thisscript $stickmount/ &>/dev/null || true 462 | fi 463 | clean_up 464 | 465 | -------------------------------------------------------------------------------- /live-grub-stick: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # live-grub-stick 3 | # 4 | # Copyright (c) 2015 CyberOrg Info 5 | # Copyright (c) 2014 Mindaugas Baranauskas 6 | 7 | # This program is free software; you can redistribute it and/or modify it under 8 | # the terms of the GNU General Public License as published by the Free Software 9 | # Foundation; either version 2 of the License, or (at your option) any later 10 | # version. 11 | # 12 | # This program is distributed in the hope that it will be useful, but WITHOUT 13 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 14 | # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 15 | # details. 16 | # 17 | # You should have received a copy of the GNU General Public License along with 18 | # this program; if not, write to the Free Software Foundation, Inc., 19 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | # 21 | # Original authors: Jigish Gohil 22 | # Contributors: Mindaugas Baranauskas 23 | # 24 | # This script creates bootable openSUSE, Fedora or Ubuntu(or clones) 25 | # live usb stick on fat partition 26 | # 27 | # To get POT file for localization, execute: 28 | # bash --dump-po-strings live-grub-stick > live-grub-stick.pot 29 | 30 | PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin 31 | ionice -c3 -p$$ 32 | umount_everything () { 33 | sync 34 | if [[ $distroname != isohybrid ]]; then 35 | umount $isomount &>/dev/null 36 | umount $stickdevpart &>/dev/null 37 | rmdir $isomount &>/dev/null || echo "unable to remove $isomount, please remove manually" 38 | umount $stickmount &>/dev/null 39 | while $(mount | grep $stickmount &>/dev/null); do 40 | umount $stickdevpart &>/dev/null 41 | sleep 2 42 | done 43 | rmdir $stickmount &>/dev/null || echo "unable to remove $stickmount, please remove manually" 44 | if [[ -f $liveusbgui ]]; then 45 | rm $liveusbgui &>/dev/null 46 | fi 47 | if [[ -h $iso_symlink ]]; then 48 | rm "$iso_symlink" &>/dev/null 49 | fi 50 | fi 51 | } 52 | clean_up () { 53 | if [[ $1 == user_killed ]] ; then 54 | echo "aborting and cleaning up" 55 | umount_everything 56 | exit 1 57 | else 58 | echo "cleaning up" 59 | umount_everything 60 | echo "Your bootable usb stick is now ready" 61 | echo "have a lot of fun..." 62 | fi 63 | } 64 | trap "clean_up user_killed" SIGINT SIGTERM 65 | need_help() { 66 | cat </dev/null 261 | if [[ -d $stickmount/boot/grub2 ]]; then 262 | grub2path=$stickmount/boot/grub2 263 | grub2pathrealusb=/boot/grub2 264 | else 265 | grub2path=$stickmount/boot/grub 266 | grub2pathrealusb=/boot/grub 267 | fi 268 | grubcfgpath=$grub2path/grub.cfg 269 | if [[ ! -f $stickmount/grubstick ]]; then 270 | echo "copying grub files to $stickmount/boot/" 271 | if [[ -d "$isomount/boot/grub2" ]];then 272 | cp -r $isomount/boot/grub2/* $grub2path/ 273 | elif [[ -d "$isomount/boot/grub" ]];then 274 | cp -r $isomount/boot/grub/* $grub2path/ 275 | else 276 | cp -r $grub2pathreal/* $grub2path/ 277 | fi 278 | fi 279 | if [[ $distroname == suse ]]; then 280 | if [[ $PERSISTENT_IMAGE == true ]]; then 281 | echo "Creating image file for persistent data" 282 | if ! qemu-img create $stickmount/boot/$isonameshort-cowfile $cowsize &>/dev/null;then 283 | echo "Can't create cow file" 284 | else 285 | persistopts="kiwi_cowdevice=/dev/disk/by-uuid/$stickuuid kiwi_cowsystem=/boot/$isonameshort-cowfile" 286 | fi 287 | fi 288 | if [[ -e $isomount/boot/x86_64/loader/linux ]]; then 289 | isoarch=x86_64 290 | else 291 | isoarch=ix86 292 | fi 293 | if [[ -e $isomount/LiveOS/squashfs.img ]]; then 294 | appendsection="\$linux (loop)/boot/$isoarch/loader/linux iso-scan/filename=/$isoname root=live:CDLABEL=$isolabel $persistopts install=hd:/$isoname loader=syslinux splash=silent quiet showopts" 295 | else 296 | appendsection="\$linux (loop)/boot/$isoarch/loader/linux isofrom=/dev/disk/by-uuid/$stickuuid:/$isoname isofrom_device=/dev/disk/by-uuid/$stickuuid isofrom_system=/$isoname $persistopts install=hd:/$isoname loader=syslinux splash=silent quiet showopts" 297 | fi 298 | appendsection2="\$initrd (loop)/boot/$isoarch/loader/initrd" 299 | fi 300 | if [[ $distroname == ubuntu ]]; then 301 | if [[ $PERSISTENT_IMAGE == true ]]; then 302 | cowfolder=$isonameshort-cow 303 | mkdir -p $stickmount/$cowfolder 304 | echo "Creating image file for persistent data" 305 | if ! qemu-img create $stickmount/$cowfolder/casper-rw $cowsize &>/dev/null;then 306 | echo "Can't create cow file" 307 | else 308 | echo "Creating filesystem for persistent data" 309 | mkfs.ext4 -F -O^has_journal -L casper-rw $stickmount/$cowfolder/casper-rw 310 | persistopts="persistent persistent-path=/$cowfolder/" 311 | fi 312 | fi 313 | if [[ -e $isomount/casper/vmlinuz ]]; then 314 | vmlinuzfile=/casper/vmlinuz 315 | else 316 | vmlinuzfile=/casper/vmlinuz.efi 317 | fi 318 | if [[ -e $isomount/casper/initrd.lz ]]; then 319 | initrdfile=/casper/initrd.lz 320 | else 321 | initrdfile=/casper/initrd 322 | fi 323 | appendsection="linux (loop)/$vmlinuzfile boot=casper iso-scan/filename=/$isoname $persistopts quiet splash" 324 | appendsection2="initrd (loop)/$initrdfile" 325 | 326 | fi 327 | if [[ $distroname == fedora ]]; then 328 | appendsection="linux (loop)/isolinux/vmlinuz0 iso-scan/filename=/$isoname root=LABEL=$isolabel rootfstype=auto ro rd.live.image rd.luks=0 rd.md=0 rd.dm=0 quiet rhgb" 329 | appendsection2="initrd (loop)/isolinux/initrd0.img" 330 | fi 331 | if [[ $distroname == ipxe ]]; then 332 | appendsection="linux16 (loop)/ipxe.krn" 333 | fi 334 | if ! grep -q $isonameshort $grubcfgpath | grep -qi menuentry; then 335 | echo "adding new image to boot menu" 336 | add_menu_section 337 | fi 338 | umount $isomount &>/dev/null 339 | } 340 | grub2_stuff () { 341 | echo "installing grub2 on $stickdevice" 342 | mkdir -p $stickmount/boot 343 | $grubinstall --force --target=i386-pc --boot-directory=$stickmount/boot $stickdevice 344 | echo "setting $stickdevice partition $stickpart active" 345 | parted $stickdevice set $stickpart boot on &>/dev/null 346 | cfg_setup 347 | } 348 | add_harddisk_section () { 349 | if ! grep -q harddisk $grubcfgpath; then 350 | cat <>$grubcfgpath 351 | 352 | menuentry 'Boot from harddisk' { 353 | set root=(hd1) 354 | chainloader +1 355 | } 356 | 357 | menuentry 'Reboot' { 358 | reboot 359 | } 360 | 361 | EOF 362 | fi 363 | } 364 | create_grub_cfg() { 365 | cp /usr/share/grub*/unicode.pf2 $grub2path/ 2>/dev/null 366 | export themename=$(echo /$grub2path/themes/*|rev | cut -d / -f1|rev) 367 | cat <$grubcfgpath 368 | insmod fat 369 | insmod ext2 370 | insmod part_gpt 371 | insmod efi_gop 372 | insmod iso9660 373 | insmod chain 374 | insmod linux 375 | insmod echo 376 | insmod configfile 377 | insmod boot 378 | insmod search_label 379 | insmod search_fs_file 380 | insmod search 381 | insmod search_fs_uuid 382 | insmod ls 383 | insmod video 384 | insmod video_fb 385 | insmod normal 386 | insmod test 387 | insmod sleep 388 | insmod png 389 | insmod gettext 390 | insmod gzio 391 | insmod efi_uga 392 | 393 | if [ \$grub_platform = "efi" ]; then 394 | set linux=linuxefi 395 | set initrd=initrdefi 396 | else 397 | set linux=linux 398 | set initrd=initrd 399 | fi 400 | set default=0 401 | set font=$grub2pathrealusb/unicode.pf2 402 | set gfxmode=auto 403 | insmod gfxterm 404 | insmod gfxmenu 405 | terminal_input gfxterm 406 | if terminal_output gfxterm; then true; else 407 | terminal gfxterm 408 | fi 409 | set theme=$grub2pathrealusb/themes/$themename/theme.txt 410 | export theme 411 | set timeout=10 412 | 413 | EOF 414 | 415 | } 416 | add_menu_section () { 417 | cat <>$grubcfgpath 418 | 419 | menuentry "$isonameshort" --class $distroname --class os { 420 | loopback loop /$isoname 421 | echo Loading linux... 422 | set gfxpayload=keep 423 | $appendsection 424 | echo Loading initrd... 425 | $appendsection2 426 | } 427 | 428 | EOF 429 | add_harddisk_section 430 | } 431 | 432 | echo "Please make sure the following information is correct:" 433 | echo "iso name: $isoname distro: $distroname stick device: $stickdevice" 434 | echo "stick uuid: /dev/disk/by-uuid/$stickuuid stick partition: $stickpart" 435 | if [[ ! -f $liveusbgui ]]; then 436 | are_you_sure "continue ?" "y" "n" 437 | fi 438 | if [[ $distroname == isohybrid ]];then 439 | try_cp_with_progress "$1" "$2" 440 | else 441 | mkdir $isomount $stickmount &>/dev/null 442 | if mount | grep $stickdevpart &>/dev/null; then 443 | if ! umount $stickdevpart &>/dev/null; then 444 | echo "$stickdevpart in use, please umount it before continuing" 445 | exit 1 446 | fi 447 | fi 448 | if ! mount $2 $stickmount &>/dev/null; then 449 | echo "unable to mount the usb stick partition" 450 | exit 1 451 | fi 452 | if [[ -e $stickmount/$isoname ]];then 453 | isopath=$stickmount/$isoname 454 | echo "using existing $isoname on the stick" 455 | else 456 | isopath=$iso_symlink 457 | echo "copying $isoname to usb stick" 458 | try_cp_with_progress "$1" "$stickmount/$isoname" 459 | if [[ $isosize != $(stat -c%s "$stickmount/$isoname") ]]; then 460 | echo "Source and destination image does not match" 461 | exit 1 462 | fi 463 | fi 464 | if [[ -d /boot/grub2 ]]; then 465 | grub2pathreal=/boot/grub2 466 | else 467 | grub2pathreal=/boot/grub 468 | fi 469 | if [[ -f $stickmount/grubstick ]]; then 470 | echo "the stick is already bootable stick" 471 | cfg_setup 472 | else 473 | grub2_stuff 474 | echo "creating menu entries" 475 | create_grub_cfg 476 | add_menu_section 477 | fi 478 | touch $stickmount/grubstick 479 | thisscript=$(readlink -f $0) 480 | cp $thisscript $stickmount/ &>/dev/null || true 481 | fi 482 | clean_up 483 | 484 | -------------------------------------------------------------------------------- /live-usb-gui: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # live-usb-gui : Simple GUI to create bootable usb stick from iso images 3 | # Copyright (c) 2012 CyberOrg Info 4 | # This program is free software; you can redistribute it and/or modify it under 5 | # the terms of the GNU General Public License as published by the Free Software 6 | # Foundation; either version 2 of the License, or (at your option) any later 7 | # version. 8 | # 9 | # This program is distributed in the hope that it will be useful, but WITHOUT 10 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 12 | # details. 13 | # 14 | # You should have received a copy of the GNU General Public License along with 15 | # this program; if not, write to the Free Software Foundation, Inc., 16 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | # 18 | # Authors: Jigish Gohil 19 | # This script creates bootable openSUSE, Fedora or Ubuntu(or clones) live usb stick on fat partition 20 | # 21 | if [[ $(id -u) != 0 ]]; then 22 | echo "run this command as root" 23 | exit 1 24 | fi 25 | PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin 26 | ionice -c3 -p$$ 27 | if [ x"$WINDOWMANAGER" = x"/usr/bin/startkde" ]; then 28 | which kdialog &>/dev/null && popup=kdialog 29 | else 30 | which zenity &>/dev/null && popup=zenity 31 | fi 32 | popup=${popup:-zenity} 33 | scriptorun=${scriptorun:-live-fat-stick} 34 | which $popup &>/dev/null || echo "$popup not found, please install to use this tool" 35 | 36 | export liveusbgui=/tmp/liveusbgui 37 | touch /tmp/liveusbgui 38 | clean_up () { 39 | if [[ -f $liveusbgui ]]; then 40 | rm $liveusbgui &>/dev/null 41 | fi 42 | if [[ -f $statusfile ]]; then 43 | rm $statusfile 44 | fi 45 | } 46 | 47 | fileselecttitle="Select distribution iso file" 48 | fileselectpath="/" 49 | fileselectfilter="*iso" 50 | usbselecttitle="Select the target USB device" 51 | usbselecttext="Select the correct device, usually the one with a number at the end;\n\ 52 | usually device without a number at the end is for isohybrid." 53 | nousbmedia="No USB media found. Please insert USB stick and try again." 54 | distributionlist="suse suse-persistent fedora mint ubuntu ubuntu-persistent ipxe isohybrid" 55 | distributionlisttext="isohybrid should work for most distribution iso images and EFI booting,\n\ 56 | persistent preserve changes in live system after reboots." 57 | distrotitle="Select the distribution of the iso" 58 | scriptstitle="Select script to run" 59 | scriptstext="Select live-fat-stick for vfat/fat32 partition,\n\ 60 | live-grub-stick for vfat/fat32/ntfs/ext3/ext4\n\ 61 | and any other partition supported by grub2" 62 | supportedscripts="live-grub-stick live-fat-stick" 63 | for i in $(echo "$supportedscripts"); do 64 | if which $i > /dev/null 2>&1; then 65 | scriptlist="$scriptlist $i" 66 | else 67 | scriptlist="$scriptlist" 68 | fi 69 | done 70 | usbdevicelist=$(for i in `echo $(for i in $(find /dev/disk/by-path/ |grep usb); do readlink -f $i;done)` 71 | do 72 | # if [[ $(blkid -s TYPE -o value $i) == vfat ]];then 73 | echo $i 74 | # fi 75 | done) 76 | if [ -z "$usbdevicelist" ] ; then 77 | if [[ $popup == zenity ]]; then 78 | zenity --error --text="$nousbmedia" 79 | else 80 | kdialog --error "$nousbmedia" 81 | fi 82 | clean_up 83 | exit 1 84 | fi 85 | usbdevicelistkd=$(for device in $usbdevicelist; do 86 | printf "%s %s %s" ${device} ${device} off 87 | printf "\n" 88 | done) 89 | 90 | distributionlistkd=$(for distro in $distributionlist; do 91 | printf "%s %s %s" $distro $distro off 92 | printf "\n" 93 | done) 94 | scriptlistkd=$(for script in $scriptlist; do 95 | printf "%s %s %s" $script $script off 96 | printf "\n" 97 | done) 98 | check_variable () { 99 | if [ ! "$1" ]; then 100 | clean_up 101 | exit 1 102 | fi 103 | } 104 | if [[ $popup == zenity ]]; then 105 | sourceiso=$(zenity --file-selection --title="$fileselecttitle" --file-filter="$fileselectfilter") 106 | check_variable $sourceiso 107 | distroname=$(zenity --list --title="$distrotitle" --text "$distributionlisttext" --column="Distribution:" $distributionlist) 108 | check_variable $distroname 109 | usbdevice=$(zenity --list --title="$usbselecttitle" --text "$usbselecttext" --column="USB device" $usbdevicelist) 110 | check_variable $usbdevice 111 | scriptorun=$(zenity --list --title="Select script to run" --text "$scriptstext" --column="Scripts:" $scriptlist) 112 | check_variable $scriptorun 113 | else 114 | sourceiso=$(kdialog --title "$fileselecttitle" --getopenfilename "$fileselectpath" "$fileselectfilter") 115 | check_variable $sourceiso 116 | distroname=$(kdialog --separate-output --title "$distrotitle" --radiolist "$distributionlisttext" $distributionlistkd) 117 | check_variable $distroname 118 | usbdevice=$(kdialog --separate-output --title "$usbselecttitle" --radiolist "$usbselecttext" $usbdevicelistkd) 119 | check_variable $usbdevice 120 | scriptorun=$(kdialog --separate-output --title "$scriptstitle" --radiolist "$scriptstext" $scriptlistkd) 121 | check_variable $scriptorun 122 | fi 123 | 124 | case $distroname in 125 | fedora) 126 | option="--fedora" 127 | ;; 128 | suse) 129 | option="--suse" 130 | ;; 131 | ubuntu) 132 | option="--ubuntu" 133 | ;; 134 | suse-persistent) 135 | option="--suse-persistent" 136 | ;; 137 | ubuntu-persistent) 138 | option="--ubuntu-persistent" 139 | ;; 140 | mint) 141 | option="--ubuntu" 142 | ;; 143 | isohybrid) 144 | option="isohybrid" 145 | ;; 146 | ipxe) 147 | option="--ipxe" 148 | ;; 149 | esac 150 | 151 | if [ ! "$option" ]; then 152 | clean_up 153 | exit 1 154 | fi 155 | questiontitle="Is the information below correct?" 156 | questiontext="Distribution: $distroname \nISO image: $sourceiso \nUSB device: $usbdevice" 157 | errortext="oops, something went wrong, try live-fat-stick or live-grub-stick from terminal" 158 | successtext="Your bootable usb device is now ready" 159 | if [[ $popup == zenity ]]; then 160 | if ! zenity --question --title="$questiontitle" --text "$questiontext"; then 161 | clean_up 162 | exit 1 163 | fi 164 | else 165 | if ! kdialog --title "$questiontitle" --warningcontinuecancel "$questiontext"; then 166 | clean_up 167 | exit 1 168 | fi 169 | fi 170 | statusfile=$(mktemp) 171 | if [[ $option == isohybrid ]]; then 172 | usbdev=$(echo $usbdevice | sed 's/[0-9]*//g') 173 | xterm -e "($scriptorun --isohybrid $sourceiso $usbdev || echo 1 > $statusfile)" 174 | else 175 | xterm -e "($scriptorun $option $sourceiso $usbdevice || echo 1 > $statusfile)" 176 | fi 177 | 178 | if [[ $(cat $statusfile) == 1 ]]; then 179 | if [[ $popup == zenity ]]; then 180 | zenity --error --text="$errortext" 181 | else 182 | kdialog --error "$errortext" 183 | fi 184 | else 185 | if [[ $popup == zenity ]]; then 186 | zenity --info --text="$successtext" 187 | else 188 | kdialog --msgbox "$successtext" 189 | fi 190 | fi 191 | clean_up 192 | 193 | -------------------------------------------------------------------------------- /live-usb-gui.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Type=Application 3 | Categories=System;Utility;Archiving; 4 | X-KDE-RootOnly=true 5 | Exec=xdg-su -c "live-usb-gui" 6 | Icon=drive-removable-media 7 | Name=Live USB GUI 8 | GenericName=Live USB GUI 9 | X-KDE-SubstituteUID=true 10 | Version=1.0 11 | 12 | --------------------------------------------------------------------------------