-
Notifications
You must be signed in to change notification settings - Fork 0
/
update.sh
executable file
·71 lines (59 loc) · 1.2 KB
/
update.sh
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
62
63
64
65
66
67
68
69
#!/bin/bash
####
# funciones
# cp
cmd_cp (){
[[ "$HOME/$1" ]] && command cp -r "$HOME/$1" "./$1"; return
echo "\e[33mno existe $1\e[0m"
}
# load tha changed files
loadchanged() {
local dir=$1
# diferencia que deber ser agregadas
if [ -d "./$dir" ]; then
rm -rf ./"$dir"
cmd_cp "$dir"
echo "archivos $dir actualizado"
return
fi
# archivos agragado por primera ves
if [ -d "./$(dirname $dir)" ] ; then
cmd_cp "$dir"
echo "agragando $dir"
return
fi
# diretorio agrado por primera ves
mkdir -p ./$dir
cmd_cp "$dir"
echo "agragando $dir"
}
array=(
".config/i3/"
".config/polybar/"
".config/cmus/"
".config/dunst/"
".config/neofetch/"
".config/picom/"
".config/ranger/"
".config/qterminal.org/"
".config/rofi/"
".config/wal/"
".config/zathura/"
".bashrc"
".fehbg"
".tmux.conf"
".local/bin/statusbar/"
".local/bin/git_status_promt"
)
for i in "${array[@]}"; do
diff=$(diff -rs $HOME/"$i" ./"$i" 2>/dev/null || echo "error")
if [[ $diff == "" ]]; then
echo "--------------"
echo "No hay cambios $i"
echo "--------------"
else
echo "--------------"
loadchanged "$i"
echo "--------------"
fi
done