From 88c2854c380215fecbe26101ef2ef6197a6907a3 Mon Sep 17 00:00:00 2001 From: David Runge Date: Sun, 21 Jan 2018 20:00:05 +0100 Subject: bin/cs: Adding the automatic creation of mountpoints if not available yet. --- bin/cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bin/cs b/bin/cs index c4d6de9..0eb3693 100755 --- a/bin/cs +++ b/bin/cs @@ -8,6 +8,8 @@ command_name=${1:-} device_name=${2:-} . ~/.config/cs.conf +#TODO: do sanity checks on mountpoints and (dm) devices +#TODO: display list of devices available, if no argument given function open_cryptdevice() { if [ -L "/dev/disk/by-uuid/$1" ]; then @@ -24,7 +26,10 @@ function close_cryptdevice() { function mount_cryptdevice() { if [[ -e "/dev/mapper/$1" ]]; then - sudo mount /dev/mapper/$1 /mnt/$1 + if [[ ! -d "/mnt/$1" ]]; then + sudo mkdir "/mnt/$1" + fi + sudo mount "/dev/mapper/$1" "/mnt/$1" if [ $1 = "media" ]; then sudo mount --bind /mnt/media/music /mnt/music sudo mount --bind /mnt/media/photos /mnt/photos @@ -80,5 +85,3 @@ esac exit 0 -#TODO: create mount point if not available -#TODO: display list of devices available, if no argument given -- cgit v1.2.3-70-g09d2