summaryrefslogtreecommitdiff
path: root/tools/install-defaults
blob: f7b75d0005f1bed5feebbe979105c20a7bc0c089 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/zsh

for DF in ~/.resources/default-dotfiles/*[^~]; do
    SDF=$(echo $(basename $DF) | sed -e's@__@/@g')
    DOTNAME=~/.${SDF}
    DIROF=$(dirname $DOTNAME)
    mkdir -p $DIROF
    if [ ! -e $DOTNAME ]; then
	echo Installing $DOTNAME
	cp $DF $DOTNAME
    else
	cmp -s $DF $DOTNAME
	if [ "$?" != "0" ]; then
	    echo "$DOTNAME has changed:"
	    diff -u $DOTNAME $DF
	    echo "Apply changes [Y/n]?"
	    read FOO
	    if [ "x$FOO" = "xy" -o "x$FOO" = "x" ]; then
		cp $DF $DOTNAME
	    fi
	fi
    fi
done