From 837ea36d0aa61185ac5a51d632353efc361d7ffd Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Fri, 14 Sep 2012 05:24:12 +0200 Subject: Put OSX ramdisk patch into contrib. This should be removed at somepoint in the future. Currently, the Homebrew people need something to make them happy. This is it. --- contrib/osx-ramdisk.patch | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 contrib/osx-ramdisk.patch diff --git a/contrib/osx-ramdisk.patch b/contrib/osx-ramdisk.patch new file mode 100644 index 0000000..b1738b0 --- /dev/null +++ b/contrib/osx-ramdisk.patch @@ -0,0 +1,36 @@ +From 9f640573906bf7f98133006d09cb2bddca5ec5ae Mon Sep 17 00:00:00 2001 +From: "Jason A. Donenfeld" +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 + -- cgit v1.2.3