Repository navigation
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·85 lines (65 loc) · 1.97 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·85 lines (65 loc) · 1.97 KB
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
#!/bin/bash
put ()
{
if [[ -f "${2}" ]]; then
if [[ -x $(which colordiff 2>/dev/null) ]]; then
colordiff "${2}" "${1}"
elif [[ -x $(which diff 2>/dev/null) ]]; then
diff "${2}" "${1}"
fi
fi
if [[ -x $(which rsync 2>/dev/null) ]]; then
rsync -pc "${1}" "${2}"
else
cp "${1}" "${2}"
fi
}
# Whether mac or other linux
if [[ -f "/etc/os-release" ]];then
MAC=0
echo "linux"
else
MAC=1
echo "Mac"
fi
# -------------------------------
# 1. ENVIRONMENT for Both
# -------------------------------
DEST=${1:-${HOME}}
echo "[DEST=${DEST}]"
# .aliases, .vimrc ...
for cf in $(cat ./config.list); do
put "config/$cf" "${DEST}/.$cf"
done
# install vim plugin
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
vim -c ":PluginInstall" -c ":q" -c ":q"
# install gef https://github.com/hugsy/gef
wget -q -O- https://github.com/hugsy/gef/raw/master/scripts/gef.sh | sh
# generate ecdsa key
ssh-keygen -t ecdsa -b 521 -N "" -f id_ecdsa
# copy my public key to authorized_keys
mkdir ~/.ssh
cat key_pub.txt >> ~/.ssh/authorized_keys
# allow local ssh
cat id_ecdas.pub >> ~/.ssh/authorized_keys
# -------------------------------
# 2. ENVIRONMENT for Linux
# -------------------------------
if [ $MAC -eq 0 ]; then
# copy my scripts
mkdir -p ${DEST}/program/usr/bin
rsync -rpc bin/ ${DEST}/program/usr/bin
# copy my lib
mkdir -p ${DEST}/program/usr/lib
# Install bash-it
# git clone --depth=1 https://github.com/Bash-it/bash-it.git ~/.bash_it
git clone --depth=1 https://github.com/hansonzhao007/bash-it.git ~/.bash_it
~/.bash_it/install.sh
fi
# -------------------------------
# 3. Final Setup
# -------------------------------
echo "source ~/.aliases " >> ~/.bashrc
echo "source ~/.installed_package" >> ~/.bashrc
source ~/.bashrc