dotfiles/bin/lmount

20 lines
558 B
Plaintext
Raw Normal View History

#!/usr/bin/env bash
if [ "$#" -ne 2 ]; then
echo -e >&2 "\x1B[1;31merror:\x1B[0;1m this program expects two arguments\x1B[0m"
echo -e >&2 "\x1B[1;33musage:\x1B[0;1m sudo lmount <drive> <mount point>"
exit 1
fi
if [ "$USER" != "root" ]; then
echo -e >&2 "\x1B[1;31merror:\x1B[0;1m this program must be run as root\x1B[0m"
echo -e >&2 "\x1B[1;33musage:\x1B[0;1m sudo lmount <drive> <mount point>"
exit 1
fi
# Mounts an encrypt external drive to a specified mount point
cryptsetup luksOpen $1 external
mount /dev/mapper/external $2