~sotirisp/bootsh

A POSIX shell script to create bootable USB devices and memory cards
Update dependencies in README.md
Increment version to 1.3.2
Allow hotplug devices with empty transport by default

clone

read-only
https://git.sr.ht/~sotirisp/bootsh
read/write
git@git.sr.ht:~sotirisp/bootsh

You can also use your local clone with git send-email.

#bootsh

A POSIX shell script to create bootable USB devices and memory cards while avoiding accidental formatting of your disks. Its characteristics are:

  • Guided selection of a device to make bootable.
  • Only shows removable devices to avoid formatting your internal disks.
  • Asks to confirm the size of the device to avoid formatting the wrong external USB disk by mistake (e.g. your backup disk).
  • Automatically runs sudo or doas to run dd as the superuser if needed.
  • Images are written using dd.
  • Minimal dependencies.
  • Short and readable code.

I had been using bootiso for a while (thanks bootiso developers!) but found it had too many dependencies and features for my needs so I took inspiration from it and wrote this.

#Dependencies

  • A POSIX system with standard utilities ( awk, dd, grep, printf, read, sh). Tested with both GNU coreutils and busybox.
  • lsblk from util-linux.

All of them are installed by default on most desktop Linux systems.

#Usage

Run bootsh passing the image as an argument and follow the prompts. An example bootsh session:

$ bootsh image.iso
NAME    VENDOR   MODEL                SIZE TRAN
sdb     Seagate  BUP_RD               4.6T usb
sdc     SMI      USB_DISK             3.8G usb
mmcblk0                              59.5G
Enter the NAME of one of the above removable devices or press Ctrl+C to exit:
sdc

Selected removable device sda with capacity 3.8G
Enter the device capacity (3.8G) to continue or press Ctrl+C to exit:
3.8G

Writing image image.iso to device /dev/sdc
[sudo] password for user:
Done! You may remove device /dev/sdc

#Installation

You can install bootsh and its manpage using the provided Makefile. To install system-wide run the following as root:

make install

You can also install them in your home directory using:

env PREFIX=~/.local make install

#License

Copyright 2021-2024 Sotiris Papatheodorou

This program is Free Software: You can use, study share and improve it at your will. Specifically you can redistribute and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

     ooooo  ooooo
     |X  |  |X  |
 ____/X _|__/X  |
/      /        |
====== ==========