forked from matschaffer/profile
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall
More file actions
76 lines (63 loc) · 2.27 KB
/
install
File metadata and controls
76 lines (63 loc) · 2.27 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
CURRENT_PWD=`pwd`
DATE=`date +%Y%m%d%H%M%S`
PROFILE_REPO="https://github.com/bsauer/profile.git"
PROFILE_DIR="$HOME/.profile.d"
SAVE_PROFILE_DIR="$HOME/.profile.d.${DATE}"
AUTOJUMP_REPO="https://github.com/joelthelion/autojump.git"
AUTOJUMP_DIR="$HOME/.autojump.d"
SAVE_AUTOJUMP_DIR="$HOME/.autojump.d.${DATE}"
if ! type -p git; then
echo "'git' command not found. Please install git first."
exit 1
fi
#cd "$HOME"
if [ -d $PROFILE_DIR ]; then
echo "Moving current $PROFILE_DIR to $SAVE_PROFILE_DIR"
mv $PROFILE_DIR $SAVE_PROFILE_DIR
fi
mkdir $PROFILE_DIR
git clone $PROFILE_REPO $PROFILE_DIR/core
# Check for all dotfiles, make a copy or relink
for dotfile in `ls -1 ${PROFILE_DIR}/core/dotfiles`; do
dotpath="${HOME}/.`basename ${dotfile}`"
if [ -L "${dotpath}" ]; then
echo "Relinking ${dotpath}"
rm "${dotpath}"
elif [ -f "${dotpath}" ]; then
echo "Moving current ${dotpath} to $PROFILE_DIR/user_${dotfile}"
mv "${dotpath}" "$PROFILE_DIR/user_${dotfile}"
fi
ln -s "${PROFILE_DIR}/core/dotfiles/${dotfile}" "${dotpath}"
done
# Repeat above for .profile
if [ -L $HOME/.profile ]; then
echo "Relinking $HOME/.profile"
rm $HOME/.profile
elif [ -f $HOME/.profile ]; then
echo "Moving current $HOME/.profile to $PROFILE_DIR/user_profile.conf"
mv $HOME/.profile $PROFILE_DIR/user_profile.conf
fi
ln -s "$PROFILE_DIR/core/init" ${HOME}/.profile
# Check for files that may hinder our new .profile.d method
for BLOCKING_RC in $HOME/.bashrc $HOME/.login $HOME/.bashprofile $HOME/.bash_profile; do
if [ -f $BLOCKING_RC ]; then
echo "Warning: Found existing $BLOCKING_RC which may cause .profile not to load."
echo " You may want to move this file into a $PROFILE_DIR/$BLOCKING_RC.conf file."
fi
done
# Install autojump
if [ -d $AUTOJUMP_DIR ]; then
echo "Moving current $AUTOJUMP to $SAVE_AUTOJUMP_DIR"
mv $AUTOJUMP_DIR $SAVE_AUTOJUMP_DIR
fi
mkdir $AUTOJUMP_DIR
git clone $AUTOJUMP_REPO $AUTOJUMP_DIR/autojump
cd $AUTOJUMP_DIR/autojump/
$AUTOJUMP_DIR/autojump/install.sh --local
rm -rf $AUTOJUMP_DIR
echo "Autojump installed"
cd ${CURRENT_PWD}
# Install pathogem.vim plugin management
mkdir -p ~/.vim/autoload ~/.vim/bundle ~/.vim/backup; \
curl -Sso ~/.vim/autoload/pathogen.vim \
https://raw.github.com/tpope/vim-pathogen/master/autoload/pathogen.vim