From b0031ab50256647d124000340ed539d19b03d9d2 Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Wed, 27 Jan 2016 16:45:29 +0100 Subject: better *_crypt scripts --- make_crypt | 14 +++++++++++--- mount_crypt | 9 ++++++--- umount_crypt | 8 +++++--- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/make_crypt b/make_crypt index 6d12614..523ffab 100755 --- a/make_crypt +++ b/make_crypt @@ -1,9 +1,17 @@ #!/bin/zsh -if [ "$#" -ne 1 ]; then - echo "missing arg." +. /home/pks/bin/func.zsh +check_root + +if [ "$#" -ne 2 ]; then + echo "missing args: make_crypt " exit fi -cryptsetup -c aes-xts-plain64 -s 256 -h sha256 -i 1000 --use-random -y luksFormat $1 +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 diff --git a/mount_crypt b/mount_crypt index 517c444..2483aec 100755 --- a/mount_crypt +++ b/mount_crypt @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/zsh . /home/pks/bin/func.zsh check_root @@ -8,6 +8,9 @@ if [ "$#" -ne 2 ]; then exit fi -cryptsetup luksOpen $1 $2 -mount /dev/mapper/$2 +DEVICE=$1 +NAME=$2 + +cryptsetup luksOpen $DEVICE $NAME +mount /dev/mapper/$NAME diff --git a/umount_crypt b/umount_crypt index 5d6d1e1..489d8d3 100755 --- a/umount_crypt +++ b/umount_crypt @@ -4,10 +4,12 @@ check_root if [ "$#" -ne 2 ]; then - echo "missing arg.: umount_crypt " + echo "missing args: umount_crypt " exit fi -umount $2 -cryptsetup luksClose /dev/mapper/$1 +NAME=$1 + +umount /media/$NAME +cryptsetup luksClose /dev/mapper/$NAME -- cgit v1.2.3