forked from directbuy/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathubuntu-install
executable file
·23 lines (22 loc) · 948 Bytes
/
ubuntu-install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash
pushd `dirname $0` > /dev/null
dotfiles_dir=`pwd -P`
popd > /dev/null
user=${1:-`whoami`};
home_dir=$(eval echo "~${user}")
echo "Installing dotfiles for $user"
pushd $home_dir > /dev/null
sudo chsh -s `which zsh` $user;
ln -f -s $dotfiles_dir /tmp/dotfiles ;
chmod 0775 /tmp/dotfiles ;
sudo -u $user rsync -rlvtD --no-p --chmod=D0700,F600 /tmp/dotfiles/vim/ $home_dir
sudo -u $user rsync -rlvtD --no-p --chmod=D0700,F600 /tmp/dotfiles/zsh/ $home_dir
sudo -u $user rsync -rlvtD --no-p --chmod=D0700,F600 /tmp/dotfiles/ipython/ $home_dir
if [[ -f /tmp/dotfiles/zsh/$user.zsh_aliases ]]; then
sudo -u $user cp /tmp/dotfiles/zsh/$user.zsh_aliases $home_dir/.zsh_aliases
fi
rm /tmp/dotfiles ;
sudo find ${home_dir} -mindepth 1 -type d -\! -name '.cache' -prune -\! -name 'pip' -prune -\! -name '.npm' -prune -exec sudo chmod 0700 {} \;
if [[ -d ${home_dir}/.ssh ]] ; then
sudo find ${home_dir}/.ssh -type f -exec chmod 0600 {} \;
fi