#!/bin/zsh

. $(dirname $0:A)/func.zsh
check_root

if [ "$#" -ne 2 ]; then
  echo "missing args: make_crypt </dev/device> <name>"
  exit
fi

DEVICE=$1
NAME=$2

cryptsetup -c aes-xts-plain64 -s 256 -h sha256 -i 1000 --use-random -y luksFormat $DEVICE
cryptsetup luksOpen $DEVICE $NAME
mkfs.xfs -L $NAME /dev/mapper/$NAME