.B \-\-dry\-run\fR, \fB\-n
Do nothing, instead print the commands that would be executed.
.TP
+.B \-\-key\-file \fIPATH\fR, \fB\-k \fIPATH
+Pass the argument \fB\-\-key\-file\fR \fIPATH\fR to \fBcryptsetup\fR.
+.TP
.B \-\-help\fR, \fB\-h
Display usage message.
.TP
action=mount
act=""
+keyfile=""
while [ $# -gt 0 ]; do
case "$1" in
shift
act="echo"
;;
+ --key-file | -k )
+ shift
+ keyfile="$1"
+ shift
+ ;;
--help | -h )
cat <<EOF
Usage:
rsbackup-mount [OPTIONS] [--] [DEVICES]
Options:
- --unmount, -u Unmount instead of mount
- --dry-run, -n Display commands but do nothing
- --help, -h Display usage message
- --version, -V Display version string
+ --unmount, -u Unmount instead of mount
+ --dry-run, -n Display commands but do nothing
+ --key-file, -k PATH Path to encryption key
+ --help, -h Display usage message
+ --version, -V Display version string
EOF
exit 0
;;
if [ ! -e /dev/mapper/$device ]; then
uuid=$(eval echo \$${device}_uuid)
ls -l /dev/disk/by-uuid/$uuid
- $act cryptsetup luksOpen /dev/disk/by-uuid/$uuid $device
+ if [ -n "$keyfile" ]; then
+ $act cryptsetup luksOpen --key-file "$keyfile" /dev/disk/by-uuid/$uuid $device
+ else
+ $act cryptsetup luksOpen /dev/disk/by-uuid/$uuid $device
+ fi
fi
if [ ! -e /$device/device-id ]; then
$act mount /$device