fix mk-enc-usb to use correct partition

This commit is contained in:
chaos 2023-11-10 19:00:15 +00:00
parent 4c2189c770
commit c41539f275
No known key found for this signature in database
2 changed files with 4 additions and 4 deletions

View file

@ -33,10 +33,10 @@ in (writeShellApplication {
parted "$USB_DEVICE" -- mkpart primary 0% 100% parted "$USB_DEVICE" -- mkpart primary 0% 100%
echo "Creating Encrypted Partition" echo "Creating Encrypted Partition"
cryptsetup luksFormat "$USB_DEVICE" cryptsetup luksFormat "''${USB_DEVICE}1"
echo "Opening Encrypted Partition" echo "Opening Encrypted Partition"
cryptsetup open "$USB_DEVICE" "mk_enc_usb" cryptsetup open "''${USB_DEVICE}1" "mk_enc_usb"
echo "Making Encrypted Filesystem" echo "Making Encrypted Filesystem"
mkfs.ext4 -L "${encryptedUSBData.unencryptedLabel}" /dev/mapper/mk_enc_usb mkfs.ext4 -L "${encryptedUSBData.unencryptedLabel}" /dev/mapper/mk_enc_usb

View file

@ -60,18 +60,18 @@ in {
mount -n -t ${encryptedUSB.unencryptedFSType} -o ro ${encryptedUSB.preBootMapperPath} ${encryptedUSB.mountpoint} mount -n -t ${encryptedUSB.unencryptedFSType} -o ro ${encryptedUSB.preBootMapperPath} ${encryptedUSB.mountpoint}
cp ${encryptedUSB.encryptionKeysPath}/${config.networking.hostName}.key /keys cp ${encryptedUSB.encryptionKeysPath}/${config.networking.hostName}.key /keys
chmod 0755 /keys/${config.networking.hostName}.key
umount -f ${encryptedUSB.mountpoint} umount -f ${encryptedUSB.mountpoint}
cryptsetup close ${encryptedUSB.preBootMapperName} cryptsetup close ${encryptedUSB.preBootMapperName}
''; '';
initrd.luks.devices = { initrd.luks.devices = {
"${driveData.mapperName}" = { "${driveData.mapperName}" = {
device = "${driveData.encryptedPath}"; device = "${driveData.encryptedPath}";
keyFile = "/keys/${config.networking.hostName}.key"; keyFile = "/keys/${config.networking.hostName}.key";
preLVM = false; preLVM = false;
allowDiscards = true; allowDiscards = true;
fallbackToPassword = true;
}; };
}; };
}; };