diff options
author | Nikita Ignatovich | 2016-08-16 18:17:09 +0300 |
---|---|---|
committer | Nikita Ignatovich | 2016-08-16 18:17:09 +0300 |
commit | 594db74befdcf8683cb3ac0c8045a5af5af9de2a (patch) | |
tree | d1caf931f5eb591c93ba1e214bc41d21be864ba6 /veracrypt_hook_nonroot | |
parent | 06c49f409d61b736bafbf09360cefe6ad193151b (diff) | |
download | aur-veracrypt-hook-nonroot.tar.gz |
small fixes in new package
Diffstat (limited to 'veracrypt_hook_nonroot')
-rw-r--r-- | veracrypt_hook_nonroot | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/veracrypt_hook_nonroot b/veracrypt_hook_nonroot new file mode 100644 index 000000000000..34a85e463bf8 --- /dev/null +++ b/veracrypt_hook_nonroot @@ -0,0 +1,29 @@ +#!/usr/bin/ash + +run_hook () { + modprobe -a -q dm-crypt >/dev/null 2>&1 + [ "${quiet}" = "y" ] && CSQUIET=">/dev/null" + + modprobe -a -q fuse >/dev/null 2>&1 + + # get the veracrypt volume and slot + if [ -n "${vcdevice}" ]; then + # get total number of ':' in vcdevice (for devices in /dev/disk/by-id/ + count="$(echo "${vcdevice}" | grep -o ':' | wc -l )" + cryptdev="$(echo "${vcdevice}" | cut -d: -f1-$count)" + cryptslot="$(echo "${vcdevice}" | cut -d: -f$(( $count + 1 )) )" + cryptname="veracrypt${cryptslot}" + else + err "No veracrypt device defined on the command line..." + exit 1 + fi + + veracrypt -t --slot="${cryptslot}" --filesystem=none --keyfiles="" --protect-hidden=no "${cryptdev}" + + if [ ! -e "/dev/mapper/${cryptname}" ]; then + err "No such device ${cryptname}" + fi + +} + +# vim: set ft=sh ts=4 sw=4 et: |