forked from ndbroadbent/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dev_machine_setup.sh
executable file
·91 lines (75 loc) · 3.25 KB
/
dev_machine_setup.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
#!/bin/bash
. setup/_shared.sh
# This bash script will set up (or update) your development environment for Ubuntu (v=>9.10)
scripts=""
apt_packages="" # Installs all packages in a single transaction
if [[ $EUID -eq 0 ]]; then
echo -e "\e[01;31mPlease do not use sudo to run this script!\e[00m" 2>&1
exit 1
fi
echo -e "
---------------------------------
| Ubuntu Developer Setup Script |
---------------------------------\n"
# Prerequisites
# -------------------------------------
# Requires root permissions (requests password here)
sudo true
# '--all' flag installs everything
if [ "$1" = "--all" ]; then
echo "== Setting up default environment..."
scripts="packages dropbox skype keepass2 bashrc git_config
vim gnome conky startup apt-install rvm "
prompt_for_git
prompt_for_netrc
# '--update' flag updates everything that doesn't require user input
elif [ "$1" = "--update" ]; then
echo "== Running default update..."
scripts="packages bashrc vim gnome conky startup apt-install "
# If no flag given, ask user which scripts they would like to run.
else
confirm_by_default "Git config" 'git_config'
if [[ "$scripts" =~ "git_config" ]]; then prompt_for_git; fi # prompt for git user details
confirm_by_default "~/.netrc" 'netrc'
if [[ "$scripts" =~ "netrc" ]]; then prompt_for_netrc; fi # prompt for git user details
confirm_by_default "apt packages" 'packages'
confirm_by_default "Dropbox" 'dropbox'
confirm_by_default "Skype" 'skype'
confirm_by_default "Keepass 2" 'keepass2'
confirm_by_default "bashrc, irbrc, ackrc, etc." 'bashrc'
confirm_by_default "ruby config (dotfiles)" 'ruby_dotfiles'
confirm_by_default "vim customizations" 'vim'
confirm_by_default "gnome themes and fonts" 'gnome'
confirm_by_default "conky (system stats)" 'conky'
confirm_by_default "FF, term & gedit on startup" 'startup'
# Defines the point where script should install packages
scripts+="apt-install "
confirm_by_default "RVM (Ruby Version Manager)" 'rvm'
echo -e "\n===== Thanks. Now executing 'rm -rf /'... No, not really."
fi
scripts=`echo $scripts` # Remove line-breaks
echo -e "\n===== Now executing the following scripts:"
echo -e " [ $scripts ]\n"
# Include each configured script
# --------------------------------------------------------------
for script in $scripts; do
if [[ "$script" =~ "apt-install" ]]; then
# Update sources and install apt packages
# --------------------------------------------------------------
echo "== Updating apt sources..."
sudo apt-get update -qq
echo "== Installing apt packages..."
sudo apt-get install -ym $apt_packages | grep -v "is already the newest version"
sudo apt-get autoremove -ym
else
. setup/$script.sh
fi
done
# Restarting nautilus for dropbox and image resizer
nautilus -q
echo -e "\n===== Ubuntu development machine has been set up!\n"
echo -e "Further manual configuration may be needed:\n"
echo " Synergy - Copy your synergy conf to '/etc/synergy.conf' & add to startup:"
echo " synergys --config '/etc/synergy.conf'"
echo " Dropbox Symlinks - Run 'dropbox_links_setup.sh' after you have set up your Dropbox account."
echo