aboutsummaryrefslogtreecommitdiffstats
path: root/bin/cs
diff options
context:
space:
mode:
authorDavid Runge <dave@sleepmap.de>2018-01-21 20:00:05 +0100
committerDavid Runge <dave@sleepmap.de>2018-01-21 20:00:05 +0100
commit88c2854c380215fecbe26101ef2ef6197a6907a3 (patch)
tree013249c450ce129533e65c9508d577112a0278f9 /bin/cs
parent5483272cc7d2c4668b437c3ac79a7e5bdadf951b (diff)
downloaddotfiles-88c2854c380215fecbe26101ef2ef6197a6907a3.tar.gz
dotfiles-88c2854c380215fecbe26101ef2ef6197a6907a3.tar.bz2
dotfiles-88c2854c380215fecbe26101ef2ef6197a6907a3.tar.xz
dotfiles-88c2854c380215fecbe26101ef2ef6197a6907a3.zip
bin/cs: Adding the automatic creation of mountpoints if not available yet.
Diffstat (limited to 'bin/cs')
-rwxr-xr-xbin/cs9
1 files 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