dotfiles/instala.sh

128 lines
4.6 KiB
Bash
Executable File

#!/bin/bash
#
# Author:: drymer <drymer [ EN ] autistici.org>
# Copyright:: Copyright (c) 2016, drymer
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or (at
# your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
if [[ $1 = "all" ]]
then
bash instala.sh X
bash instala.sh i3
bash instala.sh tmux
bash instala.sh qutebrowser
bash instala.sh emacs
elif [[ $1 = "X" ]]
then
ln -sf $(pwd)/Xdefaults $HOME/.Xdefaults
ln -sf $(pwd)/Xmodmap $HOME/.Xmodmap
ln -s $(pwd)/compton.conf $HOME/.compton.conf
elif [[ $1 = "i3" ]]
then
ln -sf $(pwd)/i3 $HOME/.i3
ln -sf $(pwd)/i3/i3blocks.conf $HOME/.i3blocks.conf
elif [[ $1 = "mutt" ]]
then
ln -sf $(pwd)/mutt $HOME/.mutt
ln -sf $(pwd)/mutt/muttrc.example $HOME/.muttrc
ln -sf $(pwd)/mutt/offlineimaprc.example $HOME/.offlineimaprc
elif [[ $1 = "tmux" ]]
then
ln -sf $(pwd)/tmux.conf $HOME/.tmux.conf
elif [[ $1 = "qutebrowser" ]]
then
mkdir -p $HOME/.config/qutebrowser/
ln -sf $(pwd)/qutebrowser/{qutebrowser.conf,keys.conf} $HOME/.config/qutebrowser/
echo "Necesito permiso de superusuaria para copiar los archivos hosts, capture y umpv a su sitio."
sudo ln -sf $(pwd)/qutebrowser/{capture,umpv} /usr/local/bin/
sudo ln -sf $(pwd)/qutebrwoser/hosts/ /etc/hosts
elif [[ $1 = "emacs" ]]
then
# Establece el directorio de las configuraciones, lo crea y las copia ahí
EMACSDIR="$HOME/.emacs.d"
mkdir -p $EMACSDIR
ln -sf $(pwd)/emacs.d/{init.el,init-literate.org} $EMACSDIR
# crear private-literate.org si no existe para que no se queje init.el
if [[ ! -e $EMACSDIR/private-literate.org ]]
then
echo -e "* Vacio\n#+BEGIN_SRC emacs-lisp\n#+END_SRC" > $EMACSDIR/private-literate.org
fi
# Instalar todos los paquetes de emacs
emacs -Q --batch --eval "(load-file \""$EMACSDIR/"init.el\")"
# Por algún motivo al compilar desde el-get mete una ruta incorrecta en org-loaddefs.el
find $EMACSDIR -name 'org-loaddefs.el' | xargs sed -i "s,org-mode-maint/lisp/,,g"
# Necesito permiso de superusuario para copiar los scripts capture y demacs en /usr/local/bin/
sudo ln -sf $(pwd)/emacs.d/{capture,demacs} /usr/local/bin/
elif [[ $1 = "fonts" ]]
then
FONTDIR="$HOME/.local/share/fonts"
mkdir -p $HOME/.local/share/
ln -fs $(pwd)/fonts/ $HOME/.local/share/
fc-cache -fv $FONTDIR
# las cuatro siguientes no se si son necesarias, pero es gratis ponerlas
fc-cache -fv $FONTDIR/misc
fc-cache -fv $FONTDIR/ohsnap
fc-cache -fv $FONTDIR/tewi
fc-cache -fv $FONTDIR/terminesspowerline
xset +fp $FONTDIR/
# las cuatro siguientes no se si son necesarias, pero es gratis ponerlas
xset +fp $FONTDIR/misc
xset +fp $FONTDIR/ohsnap
xset +fp $FONTDIR/tewi
xset +fp $FONTDIR/terminesspowerline
xset fp rehash
elif [[ $1 = "pypi" ]]
then
sudo pip3 install rope importmagic autopep8 yapf Nikola Nikola[extras] mps-youtube youtube-dl speedtest-cli twine setuptools
sudo pip2 install rope importmagic autopep8 yapf virtualenv virtualenvwrapper setuptools
echo """
export WORKON_HOME=~/.virtualenvs
mkdir -p $WORKON_HOME
source `which virtualenvwrapper.sh` > /dev/null
""" >> $HOME/.bashrc
echo """
export WORKON_HOME=~/.virtualenvs
mkdir -p $WORKON_HOME
source `which virtualenvwrapper.sh` > /dev/null
""" >> $HOME/.zshrc
export WORKON_HOME=~/.virtualenvs
source `which virtualenvwrapper.sh`
echo "pip install jedi rope importmagic autopep8 yapf" >> $WORKON_HOME/postmkvirtualenv
elif [[ $1 = "shell" ]]
then
if [[ ! -d $HOME/.oh-my-zsh ]]
then
git clone git://github.com/robbyrussell/oh-my-zsh.git $HOME/.oh-my-zsh
chsh -s /bin/zsh
fi
ln -sf $(pwd)/shell/zsh_custom_themes/* $HOME/.oh-my-zsh/custom/themes/
ln -sf $(pwd)/shell/aliases $HOME/.aliases
ln -sf $(pwd)/shell/bashrc $HOME/.bashrc
ln -sf $(pwd)/shell/zshrc $HOME/.zshrc
elif [[ $1 = "" ]]
then
echo "./instala.sh {all, X, i3, tmux, qutebrowser, emacs, fonts, pypi, shell}"
else
echo "No existe ese parámetro. Escoge: {all, X, i3, tmux, qutebrowser, emacs, fonts, pypi, shell}"
fi