Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

demo #5

Open
wants to merge 14 commits into
base: dmcrypt-replaces-truecrypt
Choose a base branch
from
4 changes: 2 additions & 2 deletions bash/bash_extra_rc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Relevance "etc" scripts
B="~/opensource/etc/bash"
B=~/opensource/etc/bash

if [ -d $B ]; then
source $B/git.sh
Expand All @@ -11,7 +11,7 @@ if [ -d $B ]; then
fi

# Local executables
export PATH=$HOME/bin:$PATH
export PATH=$HOME/bin:$HOME/opensource/etc/scripts:$PATH

# Pairhost aliases
alias sourcecode="truecrypt -t -k '' --protect-hidden=no $HOME/sourcecode.tc $HOME/src"
Expand Down
2 changes: 1 addition & 1 deletion bash/git_prompt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function git_branch_and_user {
branch_pattern="^On branch ([^${IFS}]*)"
remote_pattern="Your branch is (.*) of"
diverge_pattern="Your branch and (.*) have diverged"
if [[ ! ${git_status} =~ "working directory clean" ]]; then
if [[ ! ${git_status} =~ "working tree clean" ]]; then
state=" ${RED}⚡"
else
state=""
Expand Down
32 changes: 32 additions & 0 deletions scripts/mountsrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/sh

# usage: mountsrc [cryptfile] [mount dir]

CRYPTFILE=$1
: ${CRYPTFILE:="/home/pair/sourcecode.tc"}

MOUNTDIR=$2
: ${MOUNTDIR:="/home/pair/src"}


# check for sudo
if [ `whoami` != "root" ]
then
echo "You should really run this as root."
exit 1
fi

# make the dir if it doesn't exist
if ! [ -d $MOUNTDIR ]
then
echo "Creating mount point $MOUNTDIR."
sudo -u pair mkdir $MOUNTDIR
fi

# the heavy lifting

echo "Mounting source $CRYPTFILE to $MOUNTDIR."
DEV=`losetup -f`
losetup $DEV $CRYPTFILE
cryptsetup luksOpen $DEV src
mount -t ext4 /dev/mapper/src $MOUNTDIR
10 changes: 9 additions & 1 deletion scripts/pair
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,23 @@ AUTHORS = {
"ba" => "Brenton Ashworth",
"bb" => "Brandon Bloom",
"bc" => "Bobby Calderwood",
"bk" => "Ben Kamphaus",
"bn" => "Bobby Norton",
"bv" => "Ben Vandgrift",
"cm" => "Carin Meier",
"ca" => "Craig Andera",
"cd" => "Clinton Dreisbach",
"cd" => "Clinton Dreisbach",
"cm" => "Carin Meier",
"cr" => "Chris Redinger",
"dc" => "David Chelimsky",
"dm" => "Daemian Mack",
"dn" => "David Nolen",
"gh" => "Gabriel Horner",
"gs" => "Ghadi Shayban",
"jb" => "Jeb Beich",
"jd" => "Jon Distad",
"jg" => "Justin Gehtland",
"jh" => "Jan Herich",
"jk" => "Jamie Kite",
"jm" => "Jen Myers",
"jam" => "Jen Myers",
Expand All @@ -48,6 +55,7 @@ AUTHORS = {
"mp" => "Michael Parenteau",
"nm" => "Nelson Morris",
"pd" => "Paul deGrandis",
"pm" => "Philipp Meier",
"rh" => "Rich Hickey",
"rn" => "Ryan Neufeld",
"ro" => "Russ Olsen",
Expand Down
27 changes: 27 additions & 0 deletions scripts/umountsrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/sh

# usage: umountsrc [cryptfile] [mount dir]

# check for sudo
if [ `whoami` != "root" ]
then
echo "You should really run this as root."
exit 1
fi

CRYPTFILE=$1
: ${CRYPTFILE:="/home/pair/sourcecode.tc"}

MOUNTDIR=$2
: ${MOUNTDIR:="/home/pair/src"}

echo "Dismounting source code volume $CRYPTFILE from $MOUNTDIR"

umount $MOUNTDIR
cryptsetup luksClose src
for lodevice in `sudo losetup -j $CRYPTFILE | awk -F ':' ' { print $1 } '`
do
# we remove the loopback binding for each device
losetup -d $lodevice
done

2 changes: 1 addition & 1 deletion tmux.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Work nicely with emacs key combos
set -g default-terminal "screen-256color"
set -g default-terminal "xterm-256color"
set-window-option -g xterm-keys on

# Bind <C-q> to leader
Expand Down