summaryrefslogtreecommitdiff
path: root/deploy.sh
diff options
context:
space:
mode:
Diffstat (limited to 'deploy.sh')
-rwxr-xr-xdeploy.sh62
1 files changed, 31 insertions, 31 deletions
diff --git a/deploy.sh b/deploy.sh
index 43f4a80..deb1538 100755
--- a/deploy.sh
+++ b/deploy.sh
@@ -6,43 +6,43 @@ SCRIPT_DIR="$( cd "$( dirname "$BASH_SOURCE[0]" )" && pwd )"
MANIFEST_FILE="MANIFEST"
symlink_file() {
- filename="$SCRIPT_DIR/$1"
- destination=$(echo "$HOME/$2/$1" | sed 's/\/\//\//g')
-
- mkdir -p $(dirname "$destination")
-
- if [ -L "$destination" ]; then
- echo "info: updating $filename symlink"
- rm -f "$destination" > /dev/null
- ln -s "$filename" "$destination"
- else
- if [ -e "$destination" ]; then
- echo "error: $destination exists but it's not a symlink. Please fix that manually" && return
- else
- ln -s "$filename" "$destination"
- echo "info: $filename -> $destination"
- fi
- fi
+ filename="$SCRIPT_DIR/$1"
+ destination=$(echo "$HOME/$2/$1" | sed 's/\/\//\//g')
+
+ mkdir -p $(dirname "$destination")
+
+ if [ -L "$destination" ]; then
+ echo "info: updating $filename symlink"
+ rm -f "$destination" > /dev/null
+ ln -s "$filename" "$destination"
+ else
+ if [ -e "$destination" ]; then
+ echo "error: $destination exists but it's not a symlink. Please fix that manually" && return
+ else
+ ln -s "$filename" "$destination"
+ echo "info: $filename -> $destination"
+ fi
+ fi
}
deploy_manifest() {
- echo "--- deploying ---"
- for row in $(cat "$SCRIPT_DIR/$MANIFEST_FILE"); do
- filename=$(echo $row | cut -d \| -f 1)
- destination=$(echo $row | cut -d \| -f 2)
- symlink_file $filename $destination
- done
+ echo "--- deploying ---"
+ for row in $(cat "$SCRIPT_DIR/$MANIFEST_FILE"); do
+ filename=$(echo $row | cut -d \| -f 1)
+ destination=$(echo $row | cut -d \| -f 2)
+ symlink_file $filename $destination
+ done
}
clean() {
- echo "--- cleaning up ---"
- for row in $(cat "$SCRIPT_DIR/$MANIFEST_FILE"); do
- filename=$(echo $row | cut -d \| -f 1)
- destination=$(echo $row | cut -d \| -f 2)
- result=$(echo "$HOME/$destination/$filename" | sed 's/\/\//\//g')
- rm -f "$result" > /dev/null
- echo "info: removed $result symlink"
- done
+ echo "--- cleaning up ---"
+ for row in $(cat "$SCRIPT_DIR/$MANIFEST_FILE"); do
+ filename=$(echo $row | cut -d \| -f 1)
+ destination=$(echo $row | cut -d \| -f 2)
+ result=$(echo "$HOME/$destination/$filename" | sed 's/\/\//\//g')
+ rm -f "$result" > /dev/null
+ echo "info: removed $result symlink"
+ done
}
[ "$1" = "clean" ] && clean && exit