Browse Source

Working on cleaning up the bootstrap script to be clearer and less dependent on the location of where the script is called from.

master
Drew Short 10 years ago
parent
commit
fc670a4a75
  1. 6
      scripts/.update_dotfiles.sh
  2. 32
      scripts/bootstrap.sh

6
scripts/.update_dotfiles.sh

@ -0,0 +1,6 @@
#!/usr/bin/env sh
echo 'Updating dotfiles'
cd /home/sothr/dotfiles
git checkout master
git pull
git submodule update

32
scripts/bootstrap.sh

@ -36,11 +36,37 @@ link_dir() {
set -x set -x
set -e set -e
# Step out of the script directory and into the main dotfiles directory
cd ..
# Need to get the source for the script
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
TARGET="$(readlink "$SOURCE")"
if [[ $TARGET == /* ]]; then
echo "SOURCE '$SOURCE' is an absolute symlink to '$TARGET'"
SOURCE="$TARGET"
else
DIR="$( dirname "$SOURCE" )"
echo "SOURCE '$SOURCE' is a relative symlink to '$TARGET' (relative to '$DIR')"
SOURCE="$DIR/$TARGET" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
fi
done
echo "SOURCE is '$SOURCE'"
RDIR="$( dirname "$SOURCE" )"
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
if [ "$DIR" != "$RDIR" ]; then
echo "DIR '$RDIR' resolves to '$DIR'"
fi
echo "DIR is '$DIR'"
# Step into the directory where thes script is
cd $DIR
# Store the path to the root directory and the reference home directory # Store the path to the root directory and the reference home directory
DOTFILES_DIR="$PWD"
GIT_DIR="$(echo `git rev-parse --show-toplevel`)"
cd $GIT_DIR
# Home directory in the git directory
DOTFILES_DIR="$GIT_DIR"
DOTFILES_HOME="$DOTFILES_DIR/home" DOTFILES_HOME="$DOTFILES_DIR/home"
# Configure .vimrc # Configure .vimrc

Loading…
Cancel
Save