Skip to content

Instantly share code, notes, and snippets.

@mrdaemon
Created March 13, 2011 07:29
Show Gist options
  • Save mrdaemon/867954 to your computer and use it in GitHub Desktop.
Save mrdaemon/867954 to your computer and use it in GitHub Desktop.
Random snippets I shuffle around in my dotfiles init scripts.
# $DOTFILESREPOS should be defined by now.
# Let's still make an extra effort because it is most useful.
if [-z "$DOTFILES"] ; then
# ZOMG env var not found. I suspect a failing .boostrap.rc
# or some similar horror. Let's manually load the cache.
echo -n "PROFILE: WARNING DOTFILES not exported?" 1>&2
if [ -f "$HOME/.bootstrap.rc.cache" ] ; then
. "$HOME/.bootstrap.rc.cache"
# Check if cache contained proper value
if [ -n "$DOTFILES"]
export DOTFILES
echo " (using value from cache)" 1>&2
else
echo " (NOT in cache)" 1>&2
fi
else
echo "PROFILE: Failed to set DOTFILES location." 1>&2
fi
fi
# Validate value
if [ -d "$DOTFILES" ] ; then
# Export repository location
export DOTFILES
else
echo "PROFILE: ERROR - $DOTFILES: not a valid directory!" 1>&2
echo "PROFILE: Verify configuration, because that's bad." 1>&2
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment