This commit is contained in:
teldra 2022-02-07 23:07:46 +01:00
parent a28099ab22
commit 898d6150f1
2 changed files with 14 additions and 15 deletions

View File

@ -50,8 +50,10 @@ if [ "$ENCRYPTION_STYLE" == "a" ] || [ "$ENCRYPTION_STYLE" == "d" ]; then
echo -n $pass | cryptsetup luksAddKey $TARGET_PHY_ID-part${TARGET_PART} /boot/volume.key
chmod 000 /boot/volume.key
chmod -R g-rwx,o-rwx /boot
echo "luks_${TARGETNAME_UNDERSCORE} $TARGET_PHY_ID-part${TARGET_PART} /boot/volume.key luks" >> /etc/crypttab
echo "install_items+=\" /boot/volume.key /etc/crypttab \"" > /etc/dracut.conf.d/10-crypt.conf
if [ "$ENCRYPTION_STYLE" == "a" ]; then
echo "luks_${TARGETNAME_UNDERSCORE} $TARGET_PHY_ID-part${TARGET_PART} /boot/volume.key luks" >> /etc/crypttab
echo "install_items+=\" /boot/volume.key /etc/crypttab \"" > /etc/dracut.conf.d/10-crypt.conf
fi
fi
if [ "$ENC" == "1" ]; then

23
main.sh
View File

@ -65,11 +65,11 @@ encryption_style() {
header "Choose encryption style"
echo "a)keyfile in initramfs" #bios: 1 uefi: 2
echo "b)no encryption" #bios: 2 uefi: 2
echo "c)no keyfile (double pw enter)" #bios: 1 uefi: 2
#echo "not implemented:"
#echo "c)no keyfile (double pw enter)" #bios: 1 uefi: 2
#echo "d)keyfile on usb" #bios: 1 uefi: ?
#echo "e)unencrypted boot" #bios: 2 uefi: 2
multiplechoice "a" "b" #"c" "d" "e"
multiplechoice "a" "b" "c" #"d" "e"
ENCRYPTION_STYLE="${output}"
if [ "${ENCRYPTION_STYLE}" == "b" ]; then
ENC=0
@ -100,6 +100,7 @@ hibernation() {
do_partition() {
header "do partition"
start=1
TARGET_PART="1"
if [ "$EFI" == "1" ]; then
parted "${TARGET_PHY_ID}" -s -- mklabel gpt
sleep 2
@ -109,28 +110,24 @@ do_partition() {
sleep 2
start="$(( start + size ))"
parted "${TARGET_PHY_ID}" unit mib -s -- mkpart root ext4 "$start" 100%
sleep 2
mkfs.vfat -F32 "${TARGET_PHY_ID}-part1"
TARGET_PART="2"
else
parted "${TARGET_PHY_ID}" -s -- mklabel msdos
sleep 2
TARGET_PART="1"
if [ "${ENCRYPTION_STYLE}" == "b" ] || [ "${ENCRYPTION_STYLE}" == "e" ]; then
size=2048
parted "${TARGET_PHY_ID}" unit mib -s -- mkpart primary ext4 "${start}" "$(( start + size ))"
sleep 2
start="$(( start + size ))"
mkfs.btrfs -f "${TARGET_PHY_ID}-part1"
TARGET_PART="2"
fi
size=2048
parted "${TARGET_PHY_ID}" unit mib -s -- mkpart primary ext4 "${start}" "$(( start + size ))"
sleep 2
start="$(( start + size ))"
parted $TARGET_PHY_ID unit mib -s -- mkpart primary ext4 "$start" -1s
mkfs.btrfs -f "${TARGET_PHY_ID}-part1"
TARGET_PART="2"
fi
sleep 2
TARGETNAME="$(basename "${TARGET_PHY_ID}-part${TARGET_PART}")"
TARGETNAME_UNDERSCORE="${TARGETNAME//-/_}"
T="/dev/disk/by-id/${TARGET_PHY_ID}-part${TARGET_PART}"
if [ "${ENCRYPTION_STYLE}" == "a" ]; then
if [ "${ENCRYPTION_STYLE}" == "a" ] || [ "${ENCRYPTION_STYLE}" == "c" ] || [ "${ENCRYPTION_STYLE}" == "d" ]; then
T="/dev/mapper/luks_${TARGETNAME_UNDERSCORE}"
echo -n $pass | cryptsetup luksFormat --type luks1 "${TARGET_PHY_ID}-part${TARGET_PART}" -d -
#echo -n $pass | sudo cryptsetup luksOpen /dev/sdc1 sdc1 -d -