summaryrefslogtreecommitdiff
path: root/contrib/osx-ramdisk.patch
blob: b1738b0dcf432a1814c762510f92a7981a71a0ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
From 9f640573906bf7f98133006d09cb2bddca5ec5ae Mon Sep 17 00:00:00 2001
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
Date: Wed, 12 Sep 2012 21:08:56 +0200
Subject: [PATCH] Use ramdisk for volatile storage in OSX.

---
 src/password-store.sh | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/password-store.sh b/src/password-store.sh
index c736d7b..33a0e97 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -239,6 +239,19 @@ case "$command" in
 
 		if [[ -d /dev/shm && -w /dev/shm && -x /dev/shm ]]; then
 			tmp_dir="$(TMPDIR=/dev/shm mktemp -t $template -d)"
+		elif [[ $(uname) = "Darwin" ]]; then
+			cleanup_tmp() {
+				[[ -d $tmp_dir ]] || return
+				rm -rf "$tmp_file" "$tmp_dir" 2>/dev/null
+				umount "$tmp_dir"
+				diskutil quiet eject "$ramdisk_dev"
+				rmdir "$tmp_dir"
+			}
+			trap cleanup_tmp INT TERM EXIT
+			tmp_dir="$(mktemp -t $template -d)"
+			ramdisk_dev="$(hdid -drivekey system-image=yes -nomount 'ram://32768' | cut -d ' ' -f 1)" # 32768 sectors = 16 mb
+			newfs_hfs -M 700 "$ramdisk_dev" &>/dev/null || exit 1
+			mount -t hfs -o noatime -o nobrowse "$ramdisk_dev" "$tmp_dir" || exit 1
 		else
 			prompt=$(echo    "Your system does not have /dev/shm, which means that it may"
 			         echo    "be difficult to entirely erase the temporary non-encrypted"
-- 
1.7.12
12:39 +0100'>2015-01-27Strip ".gpg" from symlinks as wellTheo Chatzimichos1-2/+2 Symlinks inside password-store make sense when using passff in firefox, and have the same LDAP password in different websites. In order to have passff working correctly then, we need to strip the .gpg extension from symlinks as well. Example output of `pass find site1` or `pass | grep site1` before this commit: site1.job.com.gpg -> site2.job.com and after: site1.job.com -> site2.job.com 2015-01-19clip: Show an error message if xclip returns a non-zero exit codeWieland Hoffmann1-3/+2 xclip will return a non-zero exit code if $DISPLAY is not set, which might happen, for example, if you're running pass in a tmux session remotely or something like that. xclip itself will also show an error message ("Can't open display") which provides enough context to figure out what the problem is. There might be other reasons for xclip to return a non-zero exit code, but the man page doesn't list them. 2015-01-19Correct path for top level grepJason A. Donenfeld1-2/+3