-
Notifications
You must be signed in to change notification settings - Fork 725
/
install.sh
executable file
·138 lines (120 loc) · 3.51 KB
/
install.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
132
133
134
135
136
137
138
#!/bin/bash
OS=$(cat /etc/issue | cut -f 1 -d ' ')
CHARLES_BACKUP=~/.config/CharlesBackup
case $OS in
'Arch')
INSTALL() { sudo pacman -S --needed $@; }
UPDATE() { sudo pacman -Sy; }
;;
'Ubuntu')
INSTALL() { sudo apt install $@ -y --allow-unauthenticated; }
UPDATE() { sudo apt update; }
;;
*) echo 'Your distribution has not implementd yet, please modify this command' ;;
esac
if [[ $0 != 'debug' ]]; then
set -e
fi
promptn() {
read -p 'Will you run '$1'?[y/N]' PMT
if [[ $PMT == 'y' || $PMT == 'Y' ]]; then
. ./$1
fi
}
prompty() {
read -p 'Will you run '$1'?[Y/n]' PMT
if [[ $PMT != 'n' && $PMT != 'N' ]]; then
. ./$1
fi
}
dependency() {
echo 'Installing part of the dependencies...'
UPDATE
case $OS in
'Arch') INSTALL git cowsay sl fish mlocate fortune-mod ;;
'Ubuntu') INSTALL git cowsay oneko sl fortune fish mlocate ;;
*) echo 'Your distribution has not implementd yet, please modify this command' ;;
esac
sudo updatedb
}
gitclone() {
if [ ! -d ~/.local/share ]; then mkdir -p ~/.local/share; fi
if [[ -x ~/.local/share/CharlesScripts ]]; then rm -rf ~/.local/share/CharlesScripts; fi
git clone https://github.com/the0demiurge/CharlesScripts.git ~/.local/share/CharlesScripts
if [[ ! -x $CHARLES_BACKUP ]]; then
echo 'Please type your backup git repo address. If you do not have one, you may create it on GitHub.com.'
read -p 'Press Enter to skip' REPO
git clone $REPO $CHARLES_BACKUP || true
fi
if [[ ! -x $CHARLES_BACKUP ]]; then
echo 'Clone failed! Default CharlesBackup will be cloned!'
git clone https://github.com/the0demiurge/CharlesBackup.git $CHARLES_BACKUP
echo 'You may modify $CHARLES_BACKUP, and type:'
echo 'cd $CHARLES_BACKUP'
echo 'git remote set-url origin <your-git-url>'
echo 'git add -A; git commit -m "init commit";git push -u origin master'
fi
}
get() {
Y_LIST=(get-fasd
get-powerline
get-thefuck
get-oh-my-fishi
get-albert
get-playdeb
get-typora)
N_LIST=(get-calibre
get-docker
get-spacemacs
get-spacevim
get-sublime-text-3
get-xsh)
for Y in ${Y_LIST[@]}; do
cd ~/.local/share/CharlesScripts/charles/installation.d/get.d/
prompty $Y
done
for N in ${N_LIST[@]}; do
cd ~/.local/share/CharlesScripts/charles/installation.d/get.d/
promptn $N
done
}
conf() {
Y_LIST=(config-bash
config-fish
config-git
config-gnome
config-powerline-bash
config-tmux)
N_LIST=(config-powerline-ipython
config-wine32)
for Y in ${Y_LIST[@]}; do
cd ~/.local/share/CharlesScripts/charles/installation.d/conf.d/
prompty $Y
done
for N in ${N_LIST[@]}; do
cd ~/.local/share/CharlesScripts/charles/installation.d/conf.d/
promptn $N
done
}
restore() {
read -p 'DANGER! Restore dotfiles from ~/.local/share/CharlesScripts/data/home/.* ?[y/N]' PMT
if [[ $PMT == 'y' || $PMT == 'Y' ]]; then
cp -rv ~/.local/share/CharlesScripts/data/home/.* ~/
fi
Y_LIST=(gnome-shell-extensions-restore
)
for Y in ${Y_LIST[@]}; do
cd ~/.local/share/CharlesScripts/charles/bin
prompty $Y
done
}
dependency
gitclone
get
conf
restore
cd ~/.local/share/CharlesScripts/charles/installation.d/get.d/
prompty get-oh-my-fish
cd ~/.local/share/CharlesScripts/charles/bin
prompty omf-restore
echo 'Finished!'