Fixed subroutines

This commit is contained in:
Andreas Fendt 2019-02-20 00:02:55 +01:00
parent 6a1788d3bf
commit a063527886

View File

@ -9,7 +9,7 @@
# create the temporary script # create the temporary script
script=/tmp/install-script script=/tmp/install-script
cat > $script << 'EOL' cat > $script << 'EOL'
# change behaviour of bash # change behavior of bash
set -e set -e
# configure vim # configure vim
@ -24,12 +24,16 @@ configure-vim() {
# install fzf # install fzf
install-fzf() { install-fzf() {
[ ! -d ~/.fzf ]&& cd ~ && git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf && ~/.fzf/install if [ ! -d ~/.fzf ]; then
cd ~ && git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf && ~/.fzf/install
else
echo "fzf is already installed for $(id)"
fi
} }
# install oh-my-zsh # install oh-my-zsh
install-ohmyzsh() { install-ohmyzsh() {
[ ! -d ~/.oh-my-zsh ] && ( if [ ! -d ~/.oh-my-zsh ]; then
# install oh-my-zsh # install oh-my-zsh
git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
cp ~/.zshrc ~/.zshrc.orig cp ~/.zshrc ~/.zshrc.orig
@ -43,7 +47,9 @@ install-ohmyzsh() {
if [[ $EUID -ne 0 ]]; then if [[ $EUID -ne 0 ]]; then
grep "ZSH_TMUX_AUTOSTART" ~/.zshrc || sed -i -- '1s/^/ZSH_TMUX_AUTOSTART="true"\nZSH_TMUX_AUTOQUIT="false"\n\n/' ~/.zshrc grep "ZSH_TMUX_AUTOSTART" ~/.zshrc || sed -i -- '1s/^/ZSH_TMUX_AUTOSTART="true"\nZSH_TMUX_AUTOQUIT="false"\n\n/' ~/.zshrc
fi fi
) else
echo "oh-my-zsh is already installed for $(id)"
fi
} }
# call target function depending of the arguments # call target function depending of the arguments
@ -52,7 +58,7 @@ exit 0
EOL EOL
chmod +x $script chmod +x $script
# change behaviour of bash # change behavior of bash
set -e set -e
# check if root # check if root