dotfiles/instala.sh

86 lines
3.0 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
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 "(ignore-errors (load-file \""$EMACSDIR/"init.el\"))"
emacs -Q --batch --eval "(ignore-errors (load-file \""$EMACSDIR/"init-literate.el\"))"
emacs -Q --batch --eval '(ignore-errors (load-file "/tmp/powerline.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 = "" ]]
then
echo "./instala.sh {all, X, i3, tmux, qutebrowser, emacs}"
else
echo "No existe ese parámetro. Escoge: {all, X, i3, tmux, qutebrowser, emacs}"
fi