Newer
Older
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#!/bin/bash
REPO_URL="http://code.jity.de/Jack12816/linux-environment.git"
if [ -z "$INSTALL_DIR" ]; then
INSTALL_DIR="$HOME/.linux-environment"
fi
function check_system
{
if [ -z `which dialog` ]; then
echo 'The `dialog` binary was not found. Please install the according package.'
echo
echo 'Debian/Ubuntu: sudo apt-get install dialog'
echo 'ArchLinux: sudo pacman -S dialog'
exit 1
fi
if [ -z `which git` ]; then
echo 'The `git` binary was not found. Please install the according package.'
echo
echo 'Debian/Ubuntu: sudo apt-get install git'
echo 'ArchLinux: sudo pacman -S git'
exit 1
fi
if [ -z `which vim` ]; then
echo 'The `vim` binary was not found. Please install the according package.'
echo
echo 'Debian/Ubuntu: sudo apt-get install vim'
echo 'ArchLinux: sudo pacman -S vim'
exit 1
fi
if [ -d "$HOME/.bashrc.d" -o -d "$HOME/.linux-environment" ]; then
dialog --msgbox 'You already installed the project! - No need to do anything here.' 0 0
exit 1
fi
}
function confirm_installation
{
dialog --yesno 'Do you want to continue the installation?' 0 0 || \
exit 1
}
function clone_project
{
git clone "$REPO_URL" "$INSTALL_DIR" || \
(dialog --msgbox 'The downloading of the project failed.' 0 0; exit 1)
}
function backup_path
{
if [ -e "$1" ]; then
echo " Backup ${1}.."
mv "$1" "${1}.bak"
fi
}
function install_configs
{
echo "Backup already existing config files.."
backup_path "$HOME/.bash_logout"
backup_path "$HOME/.bash_profile"
backup_path "$HOME/.ctags"
backup_path "$HOME/.dir_colors"
backup_path "$HOME/.gemrc"
backup_path "$HOME/.gitconfig"
backup_path "$HOME/.gitignore"
backup_path "$HOME/.inputrc"
backup_path "$HOME/.fonts"
backup_path "$HOME/.vim"
backup_path "$HOME/.bashrc"
backup_path "$HOME/.vimrc"
echo "Setup the configs directory ($HOME/.bashrc.d/).."
cd "$INSTALL_DIR"
mkdir -p ~/.bashrc.d
eval `find config/*.dist \
| awk '{printf "cp -T " $0; gsub(/\.dist|config\//,""); print " ~/.bashrc.d/" $0 ";"}'`
echo "Link the dot files to your home.."
cd dot && cp `pwd`/.* ~; cd ..
cd dotrc && ln -s `pwd`/.* ~; cd ..
echo "Update the font cache.."
fc-cache -fr
}
function configure_project
{
# Git configuration
dialog --inputbox 'Enter your fullname for the git configuration.' 0 0 \
2>/tmp/.git.fullname
dialog --inputbox 'Enter your email address for the git configuration.' 0 0 \
2>/tmp/.git.email
cp "$HOME/.gitconfig.dist" "$HOME/.gitconfig"
sed -i "s#^ name .*# name = `cat /tmp/.git.fullname`#g" "$HOME/.gitconfig"
sed -i "s#^ email .*# email = `cat /tmp/.git.email`#g" "$HOME/.gitconfig"
# Vim configuration
dialog --checklist 'Choose the bundles for Vim you would like to install.' 0 0 0 \
"VimRCBundlesDevel" "Generic development stuff" "off" \
"VimRCBundlesSysAdmin" "Sysadmin stuff like Puppet" "off" \
"VimRCBundlesHTML" "Some bundles to work with HTML" "off" \
"VimRCBundlesPython" "Python bundles" "off" \
"VimRCBundlesPHP" "PHP bundles" "off" \
"VimRCBundlesJava" "Java bundles" "off" \
"VimRCBundlesJavaScript" "JavaScript bundles" "off" \
"VimRCBundlesRuby" "Ruby bundles" "off" \
2>/tmp/.vimrc.bundles
for KEY in $(cat /tmp/.vimrc.bundles); do
sed -i "/$KEY/s/^\" //" "$HOME/.bashrc.d/vim.conf"
done
}
function install_vim_bundles
{
dialog --msgbox 'The configuration was done. Now we install the configured Vim bundles.' 0 0
</dev/tty vim +PluginInstall +qall
}

Hermann Mayer
committed
function install_php_ctags
{
dialog --yesno 'Do you want to install Ctags support for PHP?' 0 0 || \
return 1
cd "$INSTALL_DIR/dotrc/.vim/tools" && \
git clone https://github.com/techlivezheng/phpctags.git && \
cd phpctags && \
make
}
function installation_done
{
dialog --msgbox 'The installation was completed.' 0 0
}
# Perform the installation receipt
check_system
confirm_installation
clone_project
install_configs
configure_project
install_vim_bundles

Hermann Mayer
committed
install_php_ctags
installation_done