Skip the second entry of the password by writing a key file

This commit is contained in:
Fierelier 2023-10-31 00:14:33 +01:00
parent 56bd4083bf
commit 39345d9b99

View File

@ -381,9 +381,17 @@ def main():
fh.write('GRUB_CMDLINE_LINUX="$GRUB_CMDLINE_LINUX cryptdevice=UUID=' +cryptPartitionUUID+ ' root=UUID=' +installPartitionUUID+ '"\n')
fh.close()
print("Writing luks auto-key ...")
key = callString(["xxd","-l","64","-c","0","-ps","/dev/random"])
fh = open(ipth(".luks-key"),"w")
fh.write(key)
fh.close()
os.chmod(ipth(".luks-key"),600)
call(["cryptosetup","luksAddKey",cryptPartition,ipth(".luks-key")])
print("Writing crypttab ...")
fh = open(ipth("etc/crypttab"),"w")
fh.write('system UUID=' +cryptPartitionUUID+ ' none luks\n')
fh.write('system UUID=' +cryptPartitionUUID+ ' /.luks-key luks\n')
fh.close()
print("Writing fstab ...")