summaryrefslogtreecommitdiff
path: root/src/platform/darwin.sh
blob: 1b76c33551c8f633fa011f268b2086f62d7ca73e (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
# Copyright (C) 2012 - 2014 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
# This file is licensed under the GPLv2+. Please see COPYING for more information.

clip() {
	local sleep_argv0="password store sleep for user $(id -u)"
	pkill -f "^$sleep_argv0" 2>/dev/null && sleep 0.5
	local before="$(pbpaste | openssl base64)"
	echo -n "$1" | pbcopy
	(
		( exec -a "$sleep_argv0" sleep "$CLIP_TIME" )
		local now="$(pbpaste | openssl base64)"
		[[ $now != $(echo -n "$1" | openssl base64) ]] && before="$now"
		echo "$before" | openssl base64 -d | pbcopy
	) 2>/dev/null & disown
	echo "Copied $2 to clipboard. Will clear in 45 seconds."
}

tmpdir() {
	cleanup_tmp() {
		[[ -d $SECURE_TMPDIR ]] || return
		rm -rf "$tmp_file" "$SECURE_TMPDIR" 2>/dev/null
		umount "$SECURE_TMPDIR"
		diskutil quiet eject "$ramdisk_dev"
		rmdir "$SECURE_TMPDIR"
	}
	trap cleanup_tmp INT TERM EXIT
	SECURE_TMPDIR="$(mktemp -t "$template" -d)"
	local ramdisk_dev="$(hdid -drivekey system-image=yes -nomount 'ram://32768' | cut -d ' ' -f 1)" # 32768 sectors = 16 mb
	[[ -z $ramdisk_dev ]] && exit 1
	newfs_hfs -M 700 "$ramdisk_dev" &>/dev/null || exit 1
	mount -t hfs -o noatime -o nobrowse "$ramdisk_dev" "$SECURE_TMPDIR" || exit 1
}

GETOPT="$(brew --prefix gnu-getopt 2>/dev/null || echo /usr/local)/bin/getopt"
SHRED="srm -f -z"
39f8844f6d54fbb958f074f985c130be7989c&follow=1'>Enhance IE scriptRené Neumann1-6/+7 2011-08-11BlaRené 'Necoro' Neumann1-0/+2 2011-08-11Local fontsRené 'Necoro' Neumann1-13/+22 2011-08-11Better inconsolata thingsRené Neumann4-4/+13 2011-08-10Moved some functions to their own filesRené Neumann3-124/+120 2011-08-10More advanced IE scriptRené Neumann2-1/+74 2011-08-10Inconsolata also in emacsRené Neumann1-1/+1 2011-08-10Better vim fontsRené 'Necoro' Neumann1-1/+1 2011-08-09ooffice aliasRené Neumann1-0/+2 2011-08-09Update the needed hg-extensions.René Neumann1-1/+2 2011-06-08gtkrc stuff for Qt-Gtk-StyleRené 'Necoro' Neumann2-0/+8 2011-06-08Updated fonts.conf to work better on lcdsRené 'Necoro' Neumann1-17/+6