Merge branch 'master' of frogit:geoffrey/dotfiles

This commit is contained in:
Geoffrey Frogeye 2016-12-30 15:36:30 +01:00
commit c45bdf67c3
2 changed files with 73 additions and 28 deletions

View file

@ -1,4 +1,5 @@
#!/usr/bin/env bash
#!/usrenv bash
# Handles dotfiles
# Yes there are tons of similar scipts yet I wanted no more nor less than what I needed
@ -71,7 +72,7 @@ function _dotfiles-install-dir { # dir
dir="${1%/}"
dir="${dir#/}"
/bin/ls -A "$DOTREPO/$dir" | while read file; do
ls -A "$DOTREPO/$dir" | while read file; do
if [[ -z "$dir" && $(echo $file | grep '^\(\.\|LICENSE\|README\)') ]]; then
continue
fi

View file

@ -18,6 +18,12 @@ function install-preferences {
}
# Don't ask for things that are already there
local TERMUX=0
if [ -d /data/data/com.termux/files ]; then
local TERMUX=1
local GUI=0
fi
if which i3 &> /dev/null; then
local GUI=1
fi
@ -83,19 +89,37 @@ function install-preferences {
elif which dpkg &> /dev/null; then
DEBIAN=1
if [ $ADMIN == 1 ]; then
apt-get update
if [[ $ADMIN == 1 || $TERMUX == 1 ]]; then
if [ $TERMUX == 1 ]; then
DEBIAN=0
apt update -y
else
sudo apt-get update -y
fi
function installOne { # package
# Finding out if it's already installed or not
STATUS=$(mktemp)
LANG=C dpkg --list $1 &> $STATUS
LANG=C dpkg-query --status $1 &> $STATUS
local installed=0
if [ $? == 0 ]; then
cat $STATUS | grep '^Status:' | grep ' installed' --quiet
if [ $? == 0 ]; then
# TODO noconfirm
sudo apt-get install $1
installed=1
fi
fi
rm -f $STATUS > /dev/null
echo 101 $1 $installed
# Installing if it's not installed
if [ $installed == 0 ]; then
# TODO noconfirm
if [ $TERMUX == 1 ]; then
apt install $1 -y
else
sudo apt-get install $1 -y
fi
fi
}
function installFileOne { # file
dpkg -i "$1"
@ -145,39 +169,59 @@ function install-preferences {
# Common CLI
# Utils
inst moreutils screen ncdu lsof htop proxytunnel pass pv curl sshfs netcat
if [ $ARCH == 1 ]; then
inst pkgfile
inst grep sed sh tar
if [ $TERMUX == 1 ]; then
inst coreutils man termux-api openssl-tool
if [ $ROOT == 1 ]; then
systemctl enable pkgfile-update.timer
inst cronie
inst tsu
fi
fi
# Text editor
inst vim
if [ $ARCH == 1 ]; then
inst ctags
else
inst exuberant-ctags
inst moreutils screen ncdu lsof htop proxytunnel pass pv curl wget sshfs netcat
if [[ $ARCH == 1 && $ROOT == 1 ]]; then
inst pkgfile
systemctl enable pkgfile-update.timer
fi
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
vim +PluginInstall +qall
# YouCompleteMe (vim plugin)
if [ $DEBIAN == 1 ]; then
inst build-essential cmake python-dev python3-dev
fi
$HOME/.vim/bundle/YouCompleteMe/install.sh --clang-completer --tern-completer
# Dev
if [ $DEBIAN == 1 ]; then
inst build-essential
elif [ $ARCH == 1 ]; then
inst base-devel
else
inst make
fi
inst git cmake clang llvm
# Text editor
if [ $GUI == 1 ]; then
inst gvim
else
if [ $TERMUX == 1 ]; then
inst vim-python
else
inst vim
fi
fi
if [ $DEBIAN == 1 ]; then
inst exuberant-ctags
else
inst ctags
fi
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
vim +PluginInstall +qall
# YouCompleteMe (vim plugin)
if [ $DEBIAN == 1 || $TERMUX == 1 ]; then
inst python-dev python3-dev
fi
local YCM_ARGS=""
if [ $TERMUX == 0 ]; then
YCM_ARGS="$YCM_ARGS --clang-completer --tern-completer"
fi
python $HOME/.vim/bundle/YouCompleteMe/install.python $YCM_ARGS
# Common GUI
if [ $GUI == 1 ]; then
@ -211,7 +255,7 @@ function install-preferences {
if [ $EXTRA == 1 ]; then
# Extra CLI
inst sl
inst sl ffmpeg youtube-dl
if [ $ARCH == 1 ]; then
altInst pdftk