-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall
More file actions
executable file
·65 lines (52 loc) · 1.92 KB
/
Copy pathinstall
File metadata and controls
executable file
·65 lines (52 loc) · 1.92 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
#!/bin/bash
# eh, run the whole thing here in debug mode. good reminder of what we're doing
set -x
case "${@[@]}" in *"nopro"*) skip_profile=1 ;; esac
# assumption: your home directory doesn't move. AUTOMOUNT WILL SCREW YOU.
# find our little file friends
# http://mywiki.wooledge.org/BashFAQ/028
if [[ -s "$BASH_SOURCE" ]] && [[ -x "$BASH_SOURCE" ]]; then
# we found ourselves, do the needful.
source_dir=$(dirname $(readlink -f "$BASH_SOURCE"))
if [[ ! -z "$skip_profile" ]] ; then
# bashrc and bash_profile are the same for me, I switch on PS1...
ln -sf "$source_dir"/bashrc "${HOME}"/.bashrc
ln -sf "$source_dir"/bashrc "${HOME}"/.bash_profile
fi
# vimrc is linked, gvimrc is copied as we often have to muck with fonts
ln -sf "$source_dir"/vimrc "${HOME}"/.vimrc
cp "$source_dir"/gvimrc "${HOME}"/.gvimrc
# terminalrc can also have font gripes :-)
# create path if needed
if [ ! -d "${HOME}/.config/Terminal" ]; then
mkdir -p "${HOME}/.config/Terminal"
fi
cp "$source_dir"/terminalrc "${HOME}"/.config/Terminal/terminalrc
if [ ! -f "${HOME}"/.gitconfig ] ; then
# global gitconfig is a copy
cp "$source_dir"/gitconfig "${HOME}"/.gitconfig
cp -R "$source_dir"/git "${HOME}"/.git
fi
# ssh_config is a copy. we also create .ssh directory if needed
if [ ! -d "${HOME}/.ssh" ]; then
mkdir "${HOME}/.ssh"
fi
if [ ! -f "${HOME}/.ssh/config" ] ; then
cp "$source_dir"/ssh_config "${HOME}"/.ssh/config
# fix permissions lest ssh freak out
chmod 0600 "${HOME}"/.ssh/config
fi
if [ ! -d "${HOME}/.gnupg" ] ; then
mkdir "${HOME}/.gnupg"
fi
cp "$source_dir"/gnupg/gpg.conf "${HOME}"/.gnupg/gpg.conf
ln -sf "$source_dir"/Xdefaults "${HOME}"/.Xdefaults
if [ ! -d "${HOME}/.gnupg" ] ; then
mkdir "${HOME}/.gnupg"
fi
if [ ! -f "${HOME}/.gnupg/gpg.conf" ] ; then
cp "$source_dir"/gnupg/gpg.conf "${HOME}"/.gnupg/gpg.conf
fi
else
echo "sorry, you'll need to set up this system manually!"
fi