fnacy flags
This commit is contained in:
@@ -1,7 +1,36 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
# root check
|
||||||
|
if [[ $EUID -ne 0 ]]; then
|
||||||
|
echo "You must be root to do this." 1>&2
|
||||||
|
exit 100
|
||||||
|
fi
|
||||||
|
|
||||||
mount_points=("/dev" "/dev/pts" "/proc" "/sys" "/sys/firmware/efi/efivars" "/run")
|
mount_points=("/dev" "/dev/pts" "/proc" "/sys" "/sys/firmware/efi/efivars" "/run")
|
||||||
|
NO_WRITE=false
|
||||||
|
|
||||||
|
# arguments
|
||||||
|
for arg in "$@"; do
|
||||||
|
case $arg in
|
||||||
|
--nowrite)
|
||||||
|
NO_WRITE=true
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-h)
|
||||||
|
printf "%-20s %s\n" "Flags:" "Description:"
|
||||||
|
echo
|
||||||
|
printf "%-20s %s\n" "--nowrite" "Disables Writing to Disk only modifys Existing Partitions"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unknown option: $arg"
|
||||||
|
echo "Try -h"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
cleanup() {
|
cleanup() {
|
||||||
echo "Cleaning Mounts"
|
echo "Cleaning Mounts"
|
||||||
@@ -16,14 +45,6 @@ cleanup() {
|
|||||||
}
|
}
|
||||||
trap cleanup EXIT
|
trap cleanup EXIT
|
||||||
|
|
||||||
# Ensure the script is run as root
|
|
||||||
if [[ $EUID -ne 0 ]]; then
|
|
||||||
echo "You must be root to do this." 1>&2
|
|
||||||
exit 100
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Set your target disk here
|
# Set your target disk here
|
||||||
udevadm trigger
|
udevadm trigger
|
||||||
|
|
||||||
@@ -38,8 +59,8 @@ disk_name="/dev/${disk_suffix}"
|
|||||||
echo "Chose disk $disk_name"
|
echo "Chose disk $disk_name"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
if [[ $NO_WRITE == "true" ]]; then
|
if [[ $NO_WRITE == true ]]; then
|
||||||
echo "NO_WRITE is true no need for Img no disks will be written to"
|
echo "--nowrite is specified no need for Img no disks will be written to"
|
||||||
else
|
else
|
||||||
read -rp "Enter the name of the usb partition in /dev/mapper (e.g., sda1): " disk_suffix
|
read -rp "Enter the name of the usb partition in /dev/mapper (e.g., sda1): " disk_suffix
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user