This commit is contained in:
teldra 2022-02-07 00:25:49 +01:00
parent 47e0bd6003
commit 065d02d36b

18
main.sh
View File

@ -87,29 +87,29 @@ do_partition() {
header "do partition"
start=1
if [ "$EFI" == "1" ]; then
echo parted -a optimal $TARGET_PHY_WWN mklabel gpt
parted -a optimal $TARGET_PHY_WWN mklabel gpt
size=500
echo parted -a optimal $TARGET_PHY_WWN unit mib mkpart EFI fat32 $start $(($start+$size))
parted -a optimal $TARGET_PHY_WWN unit mib mkpart EFI fat32 $start $(($start+$size))
start=$(($start+$size+1))
echo parted -a optimal $TARGET_PHY_WWN unit mib mkpart root $start -1s
parted -a optimal $TARGET_PHY_WWN unit mib mkpart root $start -1s
mkfs.vfat -F32 $TARGET_PHY_WWN-part1
TARGET_PART="2"
else
echo parted -a optimal $TARGET_PHY_WWN mklabel msdos
parted -a optimal $TARGET_PHY_WWN mklabel msdos
TARGET_PART="1"
if [ "$ENCRYPTION_STYLE" == "b" ] || [ "$ENCRYPTION_STYLE" == "e" ]; then
size=2048
echo parted -a optimal $TARGET_PHY_WWN unit mib mkpart primary ext4 $start $(($start+$size))
parted -a optimal $TARGET_PHY_WWN unit mib mkpart primary ext4 $start $(($start+$size))
start=$(( $start + $size + 1 ))
mkfs.btrfs $TARGET_PHY_WWN-part1
TARGET_PART="2"
fi
echo parted -a optimal $TARGET_PHY_WWN unit mib mkpart primary ext4 $start -1
parted -a optimal $TARGET_PHY_WWN unit mib mkpart primary ext4 $start -1
fi
TARGETNAME=$(basename ${TARGET_PHY_WWN}-part${TARGET_PART})
echo -n $pass | cryptsetup luksFormat ${TARGET_PHY_WWN}-part${TARGET_PART}
echo -n $pass | cryptsetup luksFormat ${TARGET_PHY_WWN}-part${TARGET_PART} -d -
#echo -n $pass | sudo cryptsetup luksOpen /dev/sdc1 sdc1 -d -
echo -n $pass | cryptsetup luksOpen ${TARGET_PHY_WWN}-part${TARGET_PART} "luks-${TARGETNAME}"
echo -n $pass | cryptsetup luksOpen ${TARGET_PHY_WWN}-part${TARGET_PART} "luks-${TARGETNAME}" -d -
vgcreate vg-${TARGETNAME} /dev/mapper/luks-${TARGETNAME}
lvcreate --name swap -L ${SWAPSIZE}G vg-${TARGETNAME}
lvcreate --name root -l 100%FREE vg-${TARGETNAME}
@ -141,4 +141,4 @@ hibernation
do_partition
#do_partition