diff options
author | Stefan Welte | 2016-05-30 22:43:00 +0200 |
---|---|---|
committer | Stefan Welte | 2016-05-30 22:43:00 +0200 |
commit | e650be71584d7e0f3740a786e15ebc375c9bd109 (patch) | |
tree | fb4f967cf99158e73e1e8fc301d397db8efb9b52 | |
download | aur-e650be71584d7e0f3740a786e15ebc375c9bd109.tar.gz |
initial commit of veracrypt-hook
-rw-r--r-- | .SRCINFO | 17 | ||||
-rw-r--r-- | PKGBUILD | 20 | ||||
-rw-r--r-- | veracrypt-hook.install | 28 | ||||
-rw-r--r-- | veracrypt_hook | 29 | ||||
-rw-r--r-- | veracrypt_install | 40 |
5 files changed, 134 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..a0e9b71faf8f --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,17 @@ +pkgbase = veracrypt-hook + pkgdesc = Extensive hook for operations on a veracrypt encrypted root (or e.g. home) device + pkgver = 5.1 + pkgrel = 1 + url = https://veracrypt.codeplex.com/ + install = veracrypt-hook.install + arch = any + license = GPL + depends = mkinitcpio + depends = veracrypt + source = veracrypt_hook + source = veracrypt_install + sha512sums = e25717d2d413a1274f5784ffc65f2966411b4402e493c03f7ce48cd68aaf3f04b99ff9a28547b05058d83096e785b4608a7626e0b99ee0dd6a227b9bfa51ae1c + sha512sums = 22c513b19c7b3170497f54799487b61b34180db1c2d45edef3ef744a551e219685d838bf191be47f7503e7e7e8b9a6ee77f4fe3d5eb74105e943387605af10cb + +pkgname = veracrypt-hook + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..096a740cce65 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,20 @@ +# Maintainer: Stefan Welte <archlinux [at] stefan-welte . d [e]> +# Contributor: truecrypt-hook <jim945 [at] mail . r [u]> +pkgname=veracrypt-hook +pkgver=5.1 +pkgrel=1 +pkgdesc="Extensive hook for operations on a veracrypt encrypted root (or e.g. home) device" +arch=(any) +url="https://veracrypt.codeplex.com/" +license=('GPL') +depends=(mkinitcpio veracrypt) +install=${pkgname}.install +source=(veracrypt_hook veracrypt_install) +sha512sums=('e25717d2d413a1274f5784ffc65f2966411b4402e493c03f7ce48cd68aaf3f04b99ff9a28547b05058d83096e785b4608a7626e0b99ee0dd6a227b9bfa51ae1c' + '22c513b19c7b3170497f54799487b61b34180db1c2d45edef3ef744a551e219685d838bf191be47f7503e7e7e8b9a6ee77f4fe3d5eb74105e943387605af10cb') + +package() { + install -o root -g root -D ${srcdir}/veracrypt_hook ${pkgdir}/usr/lib/initcpio/hooks/veracrypt + install -o root -g root -D ${srcdir}/veracrypt_install ${pkgdir}/usr/lib/initcpio/install/veracrypt +} + diff --git a/veracrypt-hook.install b/veracrypt-hook.install new file mode 100644 index 000000000000..983a4837a48f --- /dev/null +++ b/veracrypt-hook.install @@ -0,0 +1,28 @@ +post_install() +{ + echo "To use this hook for veracrypt add hook veracrypt " + echo "to the mkinitcpio hooks in /etc/mkinitcpio.conf then" + echo "add tcdevice=<device>:<slotnum> to your kernel boot command line args" + echo "if you use grub check /boot/grub/menu.lst of /boot/grub/grub.cfg" + echo "The root device of a veracrypt encrypted device will be /dev/mapper/veracrypt<slotnum>" + echo "where as you may have guessed <slotnum> is the number given in tcdevice=<device>:<slotnum>" + echo "this works similar to how cryptluks works" +} + +post_upgrade() +{ + echo "To use this hook for veracrypt add hook veracrypt " + echo "to the mkinitcpio hooks in /etc/mkinitcpio.conf then" + echo "add tcdevice=<device>:<slotnum> to your kernel boot command line args" + echo "if you use grub check /boot/grub/menu.lst of /boot/grub/grub.cfg" + echo "The root device of a veracrypt encrypted device will be /dev/mapper/veracrypt<slotnum>" + echo "where as you may have guessed <slotnum> is the number given in tcdevice=<device>:<slotnum>" + echo "this works similar to how cryptluks works" +} + +post_remove() +{ + echo "remember to remove veracrypt from your mkinitcpio hooks array if you added it" +} + +# vim:set ts=2 sw=2 et: diff --git a/veracrypt_hook b/veracrypt_hook new file mode 100644 index 000000000000..fefac9b3ee97 --- /dev/null +++ b/veracrypt_hook @@ -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 --mount-options=system --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: diff --git a/veracrypt_install b/veracrypt_install new file mode 100644 index 000000000000..3e8dcd0d835d --- /dev/null +++ b/veracrypt_install @@ -0,0 +1,40 @@ +#!/bin/bash + +build() { + local mod + + add_module dm-crypt + if [[ $CRYPTO_MODULES ]]; then + for mod in $CRYPTO_MODULES; do + add_module "$mod" + done + else + add_all_modules '/crypto/' + fi + + add_binary "cryptsetup" + add_binary "dmsetup" + add_file "/usr/lib/udev/rules.d/10-dm.rules" + add_file "/usr/lib/udev/rules.d/13-dm-disk.rules" + add_file "/usr/lib/udev/rules.d/95-dm-notify.rules" + add_file "/usr/lib/initcpio/udev/11-dm-initramfs.rules" "/usr/lib/udev/rules.d/11-dm-initramfs.rules" + + add_module fuse + + add_binary "veracrypt" + add_binary "fusermount" + + # veracrypts directory + add_dir "/dev/mapper" + add_dir "/tmp" + + add_runscript +} + +help () { +cat<<HELPEOF + This hook allows for a veracrypt encrypted root (or e.g. home) device. +HELPEOF +} + +# vim: set ft=sh ts=4 sw=4 et: |