mirror of
https://github.com/kevinveenbirkenbach/linux-image-manager.git
synced 2024-11-21 22:51:05 +01:00
Finished luks setup
This commit is contained in:
parent
76f1a35a46
commit
a03a4adc96
@ -82,6 +82,17 @@ set_device_path(){
|
||||
error
|
||||
}
|
||||
|
||||
overwritte_device_with_zeros(){
|
||||
question "Should $device_path be overwritten with zeros before copying?(y/N)" && read -r copy_zeros_to_device
|
||||
if [ "$copy_zeros_to_device" = "y" ]
|
||||
then
|
||||
info "Overwritting..." &&
|
||||
dd if=/dev/zero of="$device_path" bs="$OPTIMAL_BLOCKSIZE" status=progress || error "Overwritting $device_path failed."
|
||||
else
|
||||
info "Skipping Overwritting..."
|
||||
fi
|
||||
}
|
||||
|
||||
HEADER(){
|
||||
echo
|
||||
echo "${COLOR_YELLOW}The"
|
||||
|
@ -4,8 +4,9 @@ echo "Mounts encrypted storages"
|
||||
|
||||
set_device_mount_and_mapper_paths
|
||||
|
||||
partition_path="$device_path""1"
|
||||
info "Unlock partition..." &&
|
||||
sudo cryptsetup luksOpen $device_path $mapper_name ||
|
||||
sudo cryptsetup luksOpen $partition_path $mapper_name ||
|
||||
error
|
||||
|
||||
info "Mount partition..." &&
|
||||
|
@ -3,38 +3,43 @@ echo "Setups disk encryption"
|
||||
|
||||
set_device_mount_and_mapper_paths
|
||||
|
||||
info "Overwritting device \"$device_path\" with zeros..." &&
|
||||
sudo dd if=/dev/zero of=$device_path bs=$OPTIMAL_BLOCKSIZE status=progress conv=fdatasync ||
|
||||
error
|
||||
overwritte_device_with_zeros
|
||||
|
||||
info "Creating new GPT partition table..."
|
||||
( echo "g" # create a new empty GPT partition table
|
||||
echo "w" # Write partition table
|
||||
)| sudo fdisk "$device_path" || error
|
||||
)| sudo fdisk --wipe always "$device_path" ||
|
||||
error
|
||||
|
||||
info "Creating partition table..."
|
||||
( echo "n" # Create GPT partition table
|
||||
( echo "n" # Create new partition
|
||||
echo "" # Accept default
|
||||
echo "" # Accept default
|
||||
echo "" # Accept default
|
||||
echo "p" # Create GPT partition table
|
||||
echo "w" # Write partition table
|
||||
)| sudo fdisk "$device_path" || error
|
||||
|
||||
info "Show memory devices..." &&
|
||||
sudo fdisk -l || error
|
||||
)| sudo fdisk --wipe always "$device_path" ||
|
||||
error
|
||||
|
||||
partition_path="$device_path""1"
|
||||
info "Encrypt $device_path..." &&
|
||||
sudo cryptsetup -v -y luksFormat $device_path
|
||||
sudo cryptsetup -v -y luksFormat $partition_path ||
|
||||
error
|
||||
|
||||
info "Unlock partition..." &&
|
||||
sudo cryptsetup luksOpen $device_path $mapper_name
|
||||
sudo cryptsetup luksOpen $partition_path $mapper_name ||
|
||||
error
|
||||
|
||||
info "Create btrfs file system..." &&
|
||||
sudo mkfs.btrfs $mapper_path || error
|
||||
|
||||
info "Creating mount folder unter \"$mount_path\"..." &&
|
||||
mkdir -p $mount_path || error
|
||||
sudo mkdir -p $mount_path || error
|
||||
|
||||
info "Mount partition..." &&
|
||||
sudo mount $mapper_path $mount_path || error
|
||||
sudo mount $mapper_path $mount_path ||
|
||||
error
|
||||
|
||||
info "Own partition by user..." &&
|
||||
sudo chown -R $USER:$USER $mount_path || error
|
||||
sudo chown -R $USER:$USER $mount_path ||
|
||||
error
|
||||
|
@ -214,14 +214,7 @@ question "Should the image be transfered to $device_path?(y/n)" && read -r trans
|
||||
if [ "$transfer_image" = "y" ]
|
||||
then
|
||||
|
||||
question "Should $device_path be overwritten with zeros before copying?(y/n)" && read -r copy_zeros_to_device
|
||||
if [ "$copy_zeros_to_device" = "y" ]
|
||||
then
|
||||
info "Overwritting..." &&
|
||||
dd if=/dev/zero of="$device_path" bs="$OPTIMAL_BLOCKSIZE" status=progress || error "Overwritting $device_path failed."
|
||||
else
|
||||
info "Skipping Overwritting..."
|
||||
fi
|
||||
overwritte_device_with_zeros
|
||||
|
||||
info "Starting image transfer..."
|
||||
if [ "$os" = "arch" ]
|
||||
|
Loading…
Reference in New Issue
Block a user