forked from sk1418/myConf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetConf.sh
executable file
·131 lines (115 loc) · 2.6 KB
/
getConf.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#!/bin/bash
##############################################
#
# the script backups some configuration files
# to current directory depending on the Hostname
#
##############################################
source var.sh
#===========================
# backup common config files
#===========================
backup_common(){
print_sep
echo "backing up common configs"
print_sep
mkdir -p $COMMON_DIR >/dev/null 2>&1
COMMON_FILES=(.Xdefaults
.Xresources
.zshrc
.screenrc
.tmux.conf
.vimrc
.Xmodmap
.profile
base.vimrc
.ctags
.todo
.bcrc
firefoxProxy.pac
)
for f in ${COMMON_FILES[@]}
do
rsync -a --exclude="todo.txt" $HOME/$f $COMMON_DIR
done
# zsh completion
mkdir -p $COMMON_ZSH_COMP > /dev/null 2>&1
rsync -a $ZSH_COMP/* $COMMON_ZSH_COMP
echo "done!"
}
#======================
# host specific configurations
#======================
backup_host_config(){
print_sep
mkdir -p $MY_DOTFILES > /dev/null 2>&1
print_sep
HOST_FILES=(.bashrc
.xinitrc
.hgrc
.hgignore
.gitconfig
.gitignore)
for f in ${HOST_FILES[@]}; do
cp -f $HOME/$f $MY_DOTFILES/.
done
rsync -arv --exclude=".zsh_*" --exclude="completion" $HOME/.zsh $MY_DOTFILES/
# rsync -arv $HOME/.vim $MY_DOTFILES/ #don't sync .vim/backups for privcy reason
#cp ssh config and keep directory structure
mkdir -p $MY_DOTFILES/.ssh
cp $HOME/.ssh/config $MY_DOTFILES/.ssh/config > /dev/null 2>&1
echo "done!"
}
#======================
# Arch config files
#======================
backup_arch_config(){
print_sep
echo "$ME - Arch configurations {/etc/confs, systemd modules}"
print_sep
mkdir -p $MY_Arch > /dev/null 2>&1
mkdir -p "$MY_Arch/systemd/confs" > /dev/null 2>&1
ARCH_FILES=(/etc/hostname
/etc/hosts
/etc/vconsole.conf
/etc/locale.conf
/etc/locale.gen
)
for f in ${ARCH_FILES[@]}; do
cp -f $f "$MY_Arch/systemd/confs/" > /dev/null 2>&1
done
sudo rsync -arv /etc/modules-load.d "$MY_Arch/systemd/"
sudo chown -R $USER "$MY_Arch/systemd"
echo "done!"
}
#======================
# CUPS config
#======================
backup_cups_config(){
print_sep
echo "$ME /etc/cups root password needed[sudo]"
print_sep
mkdir -p $HOST_DIR/cups > /dev/null 2>&1
sudo cp -rf /etc/cups/* $HOST_DIR/cups/
sudo chown -R $USER $HOST_DIR/cups
echo "done!"
}
#======================
# /etc
#======================
backup_etc_config(){
print_sep
echo "$ME /etc "
print_sep
mkdir -p $HOST_DIR/etc > /dev/null 2>&1
sudo cp /etc/mtab $HOST_DIR/etc/
sudo cp /etc/fstab $HOST_DIR/etc/
sudo chown -R $USER $HOST_DIR/etc
echo "done!"
}
backup_common
backup_host_config
backup_arch_config
backup_etc_config
backup_cups_config
# vim:ts=2 sw=2