Skip to content

Instantly share code, notes, and snippets.

@alroniks
Created November 29, 2013 13:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alroniks/7705933 to your computer and use it in GitHub Desktop.
Save alroniks/7705933 to your computer and use it in GitHub Desktop.
#!/bin/bash
DEPLOY_PATH="/var/www/site"
DEPLOYER_PATH="deploy.js"
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do
TARGET="$(readlink "$SOURCE")"
if [[ $SOURCE == /* ]]; 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"
fi
done
RDIR="$( dirname "$SOURCE" )"
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
if [ "$DIR" != "$RDIR" ]; then
echo "local_path is '$DIR'"
fi
node $DEPLOYER_PATH local_path=$DIR deploy_path=$DEPLOY_PATH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment