dotfiles

$HOME is where the <3 is
git clone git://git.alexkarle.com/dotfiles.git
Log | Files | Refs | Submodules | README

commit 53b0e9011bd6050106ea21e84b46ed4324edf869 (patch)
parent 3072c5f0a78625eee9bddc63a0a7411cdd011dbf
Author: Alex Karle <alex@karle.co>
Date:   Wed, 22 Jan 2020 23:01:07 -0500

install: handle existing links better

Previously I would relink each existing link regardless of if it was up
to date. It's better long-term to report up-to-date as its own status.

Diffstat:
Minstall.sh | 13+++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/install.sh b/install.sh @@ -2,15 +2,24 @@ # Minimal install (no prereqs, just the basics) # Intended to be run on a new account, NOT for long term management # However, should be safe to rerun to fix/tune-up an existing install +set -e DOTFILES="$( cd "$(dirname "$0")" ; pwd -P )" # ln with the right settings and a nicer message try_ln() { + # bail out early if source doesn't exist + [ -e "$1" ] || return 0 + + # we know source is legit, set up dest if [ -e "$2" ]; then if [ -h "$2" ]; then - ln -snf $1 $2 - echo "[Updated Link] $2" | sed "s#$HOME#~#" + if [ `readlink $2` = "$1" ]; then + echo "[Up to Date ] $2" | sed "s#$HOME#~#" + else + ln -snf $1 $2 + echo "[Updated Link] $2" | sed "s#$HOME#~#" + fi else echo "[Fail:Exists ] $2" | sed "s#$HOME#~#" return