diff options
| author | Jake Koroman <jake@jakekoroman.com> | 2025-06-01 10:55:23 -0400 |
|---|---|---|
| committer | Jake Koroman <jake@jakekoroman.com> | 2025-06-01 10:55:23 -0400 |
| commit | 3b4590b1a745b06ce36cb558a4749923675e9b35 (patch) | |
| tree | 532e9f00ae0b7fdeb3645f13b926e8a65b74f1ec /deploy.sh | |
Ready. Set. Go!
Diffstat (limited to 'deploy.sh')
| -rwxr-xr-x | deploy.sh | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/deploy.sh b/deploy.sh new file mode 100755 index 0000000..fb2d879 --- /dev/null +++ b/deploy.sh @@ -0,0 +1,44 @@ +#!/bin/sh + +# stolen from: https://github.com/rexim/dotfiles/blob/master/deploy.sh + +SCRIPT_DIR="$( cd "$( dirname "$BASH_SOURCE[0]" )" && pwd )" + +symlinkFile() { + filename="$SCRIPT_DIR/$1" + destination="$HOME/$2/$1" + + mkdir -p $(dirname "$destination") + + if [ ! -L "$destination" ]; then + if [ -e "$destination" ]; then + echo "[ERROR] $destination exists but it's not a symlink. Please fix that manually" && exit 1 + else + ln -s "$filename" "$destination" + echo "[OK] $filename -> $destination" + fi + else + echo "[WARNING] $filename already symlinked" + fi +} + +deployManifest() { + for row in $(cat $SCRIPT_DIR/$1); do + filename=$(echo $row | cut -d \| -f 1) + operation=$(echo $row | cut -d \| -f 2) + destination=$(echo $row | cut -d \| -f 3) + + case $operation in + symlink) + symlinkFile $filename $destination + ;; + + *) + echo "[WARNING] Unknown operation $operation. Skipping..." + ;; + esac + done +} + +echo "--- Configs ---" +deployManifest MANIFEST |
