diff options
-rw-r--r-- | .zsh.after/functions.zsh | 42 |
1 files changed, 34 insertions, 8 deletions
diff --git a/.zsh.after/functions.zsh b/.zsh.after/functions.zsh index 5867ce4..9839658 100644 --- a/.zsh.after/functions.zsh +++ b/.zsh.after/functions.zsh @@ -222,23 +222,49 @@ function tar_tlz { ##CRYPTSETUP AND LUKS function lopen () { - case $1 in - "music") - sudo cryptsetup luksOpen /dev/disk/by-id/ata-ST9500325AS_6VE152RS $1 - ;; - "photos") - sudo cryptsetup luksOpen /dev/disk/by-id/ata-ST9500325AS_6VE457TN $1 + case $HOST in + "homey") + case $1 in + "video-backup") + sudo cryptsetup luksOpen /dev/disk/by-id/ata-SAMSUNG_HD153WI_S1UVJ1VZ400797 $1 + ;; + "video") + sudo cryptsetup luksOpen /dev/disk/by-id/ata-SAMSUNG_HD153WI_S1UVJ1VZ400798 $1 + ;; + "photos") + sudo cryptsetup luksOpen /dev/disk/by-id/ata-SAMSUNG_HD501LJ_S0MUJ1FQ104574 $1 + ;; + "music") + sudo cryptsetup luksOpen /dev/disk/by-id/ata-SAMSUNG_HD501LJ_S0MUJ1FPB87663 $1 + ;; + "music-external") + sudo cryptsetup luksOpen /dev/disk/by-id/ata-ST9500325AS_6VE152RS $1 + ;; + "photos-external") + sudo cryptsetup luksOpen /dev/disk/by-id/ata-ST9500325AS_6VE457TN $1 + ;; + esac ;; + "dvzrv") + case $1 in + "music") + sudo cryptsetup luksOpen /dev/disk/by-id/ata-ST9500325AS_6VE152RS $1 + ;; + "photos") + sudo cryptsetup luksOpen /dev/disk/by-id/ata-ST9500325AS_6VE457TN $1 + ;; + esac esac sudo mount /dev/mapper/$1 /mnt/$1 } function lclose () { notmounted=$(mountpoint /mnt/$1) - echo $notmounted - if [[ $notmounted != 0 ]] ; then + if [ "$?" -eq 0 ]; then sudo umount /mnt/$1 sudo cryptsetup luksClose $1 + else + echo "/mnt/$1 is not a mountpoint" fi } |