Merge branch 'master' of frogit:geoffrey/dotfiles
This commit is contained in:
commit
c45bdf67c3
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/env bash
|
#!/usrenv bash
|
||||||
|
|
||||||
|
|
||||||
# Handles dotfiles
|
# Handles dotfiles
|
||||||
# Yes there are tons of similar scipts yet I wanted no more nor less than what I needed
|
# 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="${1%/}"
|
||||||
dir="${dir#/}"
|
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
|
if [[ -z "$dir" && $(echo $file | grep '^\(\.\|LICENSE\|README\)') ]]; then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -18,6 +18,12 @@ function install-preferences {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Don't ask for things that are already there
|
# 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
|
if which i3 &> /dev/null; then
|
||||||
local GUI=1
|
local GUI=1
|
||||||
fi
|
fi
|
||||||
|
@ -83,19 +89,37 @@ function install-preferences {
|
||||||
|
|
||||||
elif which dpkg &> /dev/null; then
|
elif which dpkg &> /dev/null; then
|
||||||
DEBIAN=1
|
DEBIAN=1
|
||||||
if [ $ADMIN == 1 ]; then
|
if [[ $ADMIN == 1 || $TERMUX == 1 ]]; then
|
||||||
apt-get update
|
if [ $TERMUX == 1 ]; then
|
||||||
|
DEBIAN=0
|
||||||
|
apt update -y
|
||||||
|
else
|
||||||
|
sudo apt-get update -y
|
||||||
|
fi
|
||||||
function installOne { # package
|
function installOne { # package
|
||||||
|
|
||||||
|
# Finding out if it's already installed or not
|
||||||
STATUS=$(mktemp)
|
STATUS=$(mktemp)
|
||||||
LANG=C dpkg --list $1 &> $STATUS
|
LANG=C dpkg-query --status $1 &> $STATUS
|
||||||
|
local installed=0
|
||||||
if [ $? == 0 ]; then
|
if [ $? == 0 ]; then
|
||||||
cat $STATUS | grep '^Status:' | grep ' installed' --quiet
|
cat $STATUS | grep '^Status:' | grep ' installed' --quiet
|
||||||
if [ $? == 0 ]; then
|
if [ $? == 0 ]; then
|
||||||
# TODO noconfirm
|
installed=1
|
||||||
sudo apt-get install $1
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
rm -f $STATUS > /dev/null
|
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
|
function installFileOne { # file
|
||||||
dpkg -i "$1"
|
dpkg -i "$1"
|
||||||
|
@ -145,39 +169,59 @@ function install-preferences {
|
||||||
# Common CLI
|
# Common CLI
|
||||||
|
|
||||||
# Utils
|
# Utils
|
||||||
inst moreutils screen ncdu lsof htop proxytunnel pass pv curl sshfs netcat
|
inst grep sed sh tar
|
||||||
if [ $ARCH == 1 ]; then
|
if [ $TERMUX == 1 ]; then
|
||||||
inst pkgfile
|
inst coreutils man termux-api openssl-tool
|
||||||
if [ $ROOT == 1 ]; then
|
if [ $ROOT == 1 ]; then
|
||||||
|
inst tsu
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
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
|
systemctl enable pkgfile-update.timer
|
||||||
inst cronie
|
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
# Text editor
|
|
||||||
inst vim
|
|
||||||
if [ $ARCH == 1 ]; then
|
|
||||||
inst ctags
|
|
||||||
else
|
|
||||||
inst exuberant-ctags
|
|
||||||
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
|
# Dev
|
||||||
if [ $DEBIAN == 1 ]; then
|
if [ $DEBIAN == 1 ]; then
|
||||||
inst build-essential
|
inst build-essential
|
||||||
elif [ $ARCH == 1 ]; then
|
elif [ $ARCH == 1 ]; then
|
||||||
inst base-devel
|
inst base-devel
|
||||||
|
else
|
||||||
|
inst make
|
||||||
fi
|
fi
|
||||||
inst git cmake clang llvm
|
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
|
# Common GUI
|
||||||
|
|
||||||
if [ $GUI == 1 ]; then
|
if [ $GUI == 1 ]; then
|
||||||
|
@ -211,7 +255,7 @@ function install-preferences {
|
||||||
|
|
||||||
if [ $EXTRA == 1 ]; then
|
if [ $EXTRA == 1 ]; then
|
||||||
# Extra CLI
|
# Extra CLI
|
||||||
inst sl
|
inst sl ffmpeg youtube-dl
|
||||||
|
|
||||||
if [ $ARCH == 1 ]; then
|
if [ $ARCH == 1 ]; then
|
||||||
altInst pdftk
|
altInst pdftk
|
||||||
|
|
Loading…
Reference in a new issue