Shell script to format & write or flash a bootable device.
Usage:
First compile to run this script:
$ gcc dwrite.c -o dwrite; ./dwrite -h
-h: prints the help option.
-c: check devices.
-o: the path of the device.
-i: the ISO image.
-v: show the version of the script.
-F: format tables.(FAT32/EXT4/NTFS/ZERO)
Use the device path and the format that you desire to write:
$ ./dwrite -o /dev/sdx -F EXT4
Use the ISO path and device flags:
$ ./dwrite -o /dev/sdx -i /path/of/the.iso
Use the main partition to describe it. The script will automatically write in the correct table.
Example: /dev/sdb | /dev/sdc | /dev/sde...
You can also use it without enter in the folder where the script is:
$ mv dwrite /usr/local/sbin/dwrite
$ dwrite
Or as a ROOT:
# mv dwrite /usr/sbin/dwrite
# dwrite
This script have implemented sudo, because to write partitions you need to have the administrator's authority.