-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetconfigs
executable file
·61 lines (53 loc) · 1.15 KB
/
setconfigs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env zsh
function linkconf() {
local conf=$1
local link=$2
ln -s "$link" $conf
}
setconf() {
local confdir="$HOME$1"
local conf="$confdir$2"
local backupdir="$confdir.backup"
local backup="$backupdir/$2-backup-`date -u +%Y-%m-%dT%H:%M:%S%Z`"
local link="$KUTEN$3"
if [[ -d "$confdir" ]] then
echo "$confdir exist"
if [[ -f $conf || -h $conf ]] then
if [[ ! -d "$backupdir" ]] then
echo "$backupdir"
mkdir "$backupdir"
fi
mv $conf $backup
echo "backup $conf\nto: $backup"
linkconf $conf $link
else
echo "$conf doesn't exist..."
linkconf $conf $link
fi
else
echo "$confdir doesn't exist... create dir"
mkdir -p $confdir
linkconf $conf $link
fi
echo "\n"
printf "%0.s—" {1..`tput cols`}
echo "\n"
}
echo "Setconfig: kuten(dotfiles)"
printf "%0.s—" {1..`tput cols`}
echo "\n\n"
# while read line
exec < "$KUTEN/symlinks.csv"
read header
while IFS="," read link confdir conf
do
# echo "conf: $confdir/$conf\nlink: $link"
setconf $confdir $conf $link
done
if [[ $OSTYPE == darwin* ]]; then
echo "Darwin"
zsh darwin/setconfigs
elif [[ $OSTYPE == linux* ]]; then
echo "Linux"
zsh linux/setconfigs
fi