tadded override config file - coffin - secure lan file storage on a device
 (HTM) git clone git://parazyd.org/coffin.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) Submodules
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit c4ed1f8e424d2a2aa952640be61bf13eb6171c22
 (DIR) parent f93af1133909fc68bb6a6d4aa83a219750a197b8
 (HTM) Author: parazyd <parazyd@dyne.org>
       Date:   Tue, 29 Mar 2016 17:27:26 +0200
       
       added override config file
       
       Diffstat:
         A src/coffinrc                        |      10 ++++++++++
         M src/sacrist                         |      18 +++++++++++-------
         A src/zlibs/config                    |      19 +++++++++++++++++++
       
       3 files changed, 40 insertions(+), 7 deletions(-)
       ---
 (DIR) diff --git a/src/coffinrc b/src/coffinrc
       t@@ -0,0 +1,10 @@
       +# Configuration file for coffin. If you want to override any defaults,
       +# please do so here, and rename the file to '.coffinrc'.
       +# Careful!
       +#
       +# Directory where you keep all your tombs and data
       +GRAVEYARD        /home/graveyard
       +# Directory where your keys get mounted
       +KEYMOUNT        /media/tombkey
       +# Path to tomb executable
       +TOMB        /usr/local/bin/tomb
 (DIR) diff --git a/src/sacrist b/src/sacrist
       t@@ -16,7 +16,7 @@ swapoff -a # Security
        zkv=1
        helpers=1
        
       -R=${COFFIN_PATH:-`pwd`}
       +R=`pwd`
        source $R/zlibs/zuper
        
        # USB key
       t@@ -33,24 +33,28 @@ source $R/zlibs/hooks
        source $R/zlibs/keyfiles
        source $R/zlibs/mounts
        source $R/zlibs/ttab
       +source $R/zlibs/config
        
        LOCK=$R/.lock
        [[ -f $LOCK ]] && { warn "Lock found. Wait until finished." && exit }
        touch $LOCK
        
       +# Check for a configuration file
       +[[ -f ".coffinrc" ]] && parse-config
       +
        device=$1 && xxx "Device: $device"
        happenz=$2 && xxx "Happenz: $happenz"
        keyuuid=$(lsblk -no uuid $device) && xxx "Key UUID: $keyuuid"
        
        GRAVEYARD="${GRAVEYARD:-/home/graveyard}" # Our graveyard, with all the tombs
       -TOMBS="${TOMBS:-$GRAVEYARD/tombs}" # Info about opened tombs, holds keyuuid, keyhash and tombid
       -TMPTOMBS="${TMPTOMBS:-$GRAVEYARD/tmptombs}" # Temp tempfile, for updating $tombs
       +TOMBS="$GRAVEYARD/tombs" # Info about opened tombs, holds keyuuid, keyhash and tombid
       +TMPTOMBS="$GRAVEYARD/tmptombs" # Temp tempfile, for updating $tombs
       +TOMBPASSWD="$GRAVEYARD/passwd"
        KEYMOUNT="${KEYMOUNT:-/media/tombkey}" # Directory where keys get mounted
       -COFFINDOT="${COFFINDOT:-$KEYMOUNT/.coffin}" # .coffin directory on the usb key
       -TTAB="${TTAB:-$COFFINDOT/ttab}" # Our ttab
       -HOOKS="${HOOKS:-$COFFINDOT/hook}"
       +COFFINDOT="$KEYMOUNT/.coffin" # .coffin directory on the usb key
       +TTAB="$COFFINDOT/ttab" # Our ttab
       +HOOKS="$COFFINDOT/hook"
        TOMB="${TOMB:-/usr/local/bin/tomb}"
       -TOMBPASSWD="${TOMBPASSWD:-$GRAVEYARD/passwd}"
        
        # Main
        req=(happenz device)
 (DIR) diff --git a/src/zlibs/config b/src/zlibs/config
       t@@ -0,0 +1,19 @@
       +#!/usr/bin/env zsh
       +
       +parse-config() {
       +        act "Found config file. Parsing..."
       +
       +        ttmp=`awk '
       +        /^#/ { next }        
       +        /^GRAVEYARD / { printf "GRAVEYARD=\"%s\";", $2 }
       +        /^KEYMOUNT / { printf "KEYMOUNT=\"%s\";", $2 }
       +        /^TOMB / { printf "TOMB=\"%s\";", $2 }
       +        ' "$R/.coffinrc"`        
       +        { test $? = 0 } || {
       +                die "Error parsing config file."
       +                return 1
       +        }
       +
       +        eval "$ttmp"
       +        act "Success parsing config file!"
       +}