~sotirisp/bootsh

ref: 1965de4b742ca4e6feea69c9d6ae3edc360e0425 bootsh/README.md -rw-r--r-- 2.6 KiB
1965de4bSotiris Papatheodorou Increment version to v1.1.1 9 months ago

#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, head, printf, read, sed and sh) either from GNU coreutils or busybox.
  • sync either from GNU coreutils or 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-2022 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  |
 /     /       |
|     |        |
===== ==========