fix mk-enc-usb

This commit is contained in:
chaos 2023-10-13 18:00:06 +01:00
parent 65165b4a9d
commit f41ae25fa9

View file

@ -21,12 +21,6 @@ in (writeShellApplication {
# e.g /dev/sdb
USB_DEVICE=$1
if echo "$USB_DEVICE" | grep -q "[0-9]$"; then
PARTITION_SEPARATOR="p"
else
PARTITION_SEPARATOR=""
fi
if [ "$EUID" -ne 0 ]; then
echo "Please run as root"
exit
@ -39,10 +33,10 @@ in (writeShellApplication {
parted "$USB_DEVICE" -- mkpart primary 0% 100%
echo "Creating Encrypted Partition"
cryptsetup luksFormat "''${USB_DEVICE}''${PARTITION_SEPARATOR}1"
cryptsetup luksFormat "$USB_DEVICE"
echo "Opening Encrypted Partition"
cryptsetup open "''${USB_DEVICE}''${PARTITION_SEPARATOR}1" "mk_enc_usb"
cryptsetup open "$USB_DEVICE" "mk_enc_usb"
echo "Making Encrypted Filesystem"
mkfs.ext4 -L "${encryptedUSBData.unencryptedLabel}" /dev/mapper/mk_enc_usb