Delete encrypt.sh
This commit is contained in:
parent
cd6c4c01af
commit
356c5c67a0
86
encrypt.sh
86
encrypt.sh
|
@ -1,86 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Get variable from filesystem.
|
|
||||||
part=$(</tmp/disk)2
|
|
||||||
|
|
||||||
# Encrypting partition.
|
|
||||||
echo "Encrypting system partition."
|
|
||||||
echo -e
|
|
||||||
|
|
||||||
cryptsetup -c aes-xts-plain -y -s 512 luksFormat /dev/$part &&
|
|
||||||
echo "Partition successfully encrypted."
|
|
||||||
echo -e
|
|
||||||
|
|
||||||
# Opening encrypted partition and mounting at /dev/mapper/lvm.
|
|
||||||
echo "Opening and mounting encrypted partition."
|
|
||||||
echo -e
|
|
||||||
|
|
||||||
cryptsetup luksOpen /dev/$part lvm &&
|
|
||||||
echo "Partition opened and mounted:"
|
|
||||||
echo -e
|
|
||||||
|
|
||||||
disk="${part%?}"
|
|
||||||
lsblk | grep "$disk"
|
|
||||||
echo -e
|
|
||||||
|
|
||||||
# Creating physical volume.
|
|
||||||
echo "Creating physical volume."
|
|
||||||
pvcreate /dev/mapper/lvm &&
|
|
||||||
echo -e
|
|
||||||
|
|
||||||
# Creating volume group "main".
|
|
||||||
echo "Creating volume group."
|
|
||||||
vgcreate main /dev/mapper/lvm &&
|
|
||||||
echo -e
|
|
||||||
|
|
||||||
# Creating logical volumes.
|
|
||||||
echo "Creating logical volumes for root and home."
|
|
||||||
echo -e
|
|
||||||
|
|
||||||
# Lol, this part:
|
|
||||||
part=$(</tmp/disk)2 && i=( $(lsblk | grep "$part" | tail -n+1 | awk '{print $4}') ) && size="${i%?}"
|
|
||||||
|
|
||||||
echo "Your system partition has a size of $size GB."
|
|
||||||
echo "What size should your root partition have?"
|
|
||||||
read root
|
|
||||||
echo "Creating a $root GB root volume."
|
|
||||||
echo -e
|
|
||||||
|
|
||||||
lvcreate -L ${root}G -n root main &&
|
|
||||||
lvcreate -l 100%FREE -n home main &&
|
|
||||||
echo -e
|
|
||||||
|
|
||||||
echo "Logical volumes successfully created."
|
|
||||||
echo -e
|
|
||||||
|
|
||||||
echo "Creating the filesystem."
|
|
||||||
echo -e
|
|
||||||
|
|
||||||
boot=$(</tmp/disk)1
|
|
||||||
|
|
||||||
mkfs.fat -F 32 -n UEFI /dev/$boot &&
|
|
||||||
echo "Filesystem for boot successfully created."
|
|
||||||
echo -e
|
|
||||||
|
|
||||||
mkfs.ext4 -L root /dev/mapper/main-root &&
|
|
||||||
echo "Filesystem for root successfully created."
|
|
||||||
echo -e
|
|
||||||
|
|
||||||
mkfs.ext4 -L home /dev/mapper/main-home &&
|
|
||||||
echo "Filesystem for home successfully created."
|
|
||||||
echo -e
|
|
||||||
|
|
||||||
echo "Mounting.."
|
|
||||||
echo -e
|
|
||||||
|
|
||||||
mount /dev/mapper/main-root /mnt
|
|
||||||
mkdir /mnt/boot
|
|
||||||
mkdir /mnt/home
|
|
||||||
mount /dev/$boot /mnt/boot
|
|
||||||
mount /dev/mapper/main-home /mnt/home
|
|
||||||
|
|
||||||
echo "Mounting complete."
|
|
||||||
echo -e
|
|
||||||
|
|
||||||
lsblk
|
|
||||||
echo -e
|
|
Loading…
Reference in New Issue