Merge branch 'master' of github.com:GeoffreyFrogeye/dotfiles
This commit is contained in:
commit
3039d5cd25
0
config/.dfrecur
Normal file
0
config/.dfrecur
Normal file
|
@ -262,10 +262,10 @@ set $mode_system [L] Vérouillage [E] Déconnexion [S] Veille [H] Hibernation [R
|
|||
mode "$mode_system" {
|
||||
bindsym l exec --no-startup-id $locker, mode "default"
|
||||
bindsym e exit, mode "default"
|
||||
bindsym s exec --no-startup-id systemctl suspend, mode "default"
|
||||
bindsym h exec --no-startup-id systemctl hibernate, mode "default"
|
||||
bindsym s exec --no-startup-id $locker & systemctl suspend, mode "default"
|
||||
bindsym h exec --no-startup-id $locker & systemctl hibernate, mode "default"
|
||||
bindsym r exec --no-startup-id systemctl reboot, mode "default"
|
||||
bindsym p exec --no-startup-id systemctl poweroff -i, mode "default"
|
||||
bindsym p exec --no-startup-id systemctl poweroff -i, mode "default"
|
||||
|
||||
# back to normal: Enter or Escape
|
||||
bindsym Return mode "default"
|
||||
|
|
1
dotsync
1
dotsync
|
@ -1 +0,0 @@
|
|||
Subproject commit 54bcb2ac28d2c2a49caa1b78a0cceee9ae041122
|
8
gitconfig
Normal file
8
gitconfig
Normal file
|
@ -0,0 +1,8 @@
|
|||
[user]
|
||||
name = Geoffrey Frogeye
|
||||
email = geoffrey@frogeye.fr
|
||||
[core]
|
||||
editor = vim
|
||||
excludesfile = ~/.gitignore
|
||||
[push]
|
||||
default = matching
|
|
@ -1,31 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Installs all programs on the system
|
||||
|
||||
function debloc-custom-cli {
|
||||
# Utils
|
||||
debloc-install moreutils screen ncdu htop sl proxytunnel pass pv curl
|
||||
|
||||
# Text editor
|
||||
debloc-install vim exuberant-ctags
|
||||
|
||||
# Dev
|
||||
debloc-install build-essential cmake clang llvm git
|
||||
}
|
||||
|
||||
function debloc-custom {
|
||||
debloc-custom-cli
|
||||
|
||||
# Desktop manager
|
||||
debloc-install i3 i3lock dmenu dunst unclutter xautolock feh numlockx scrot imagemagick suckless-tools
|
||||
ln -s $DEBLOC_ROOT/bin/dmenu{.xft,}
|
||||
|
||||
# qutebrowser
|
||||
debloc-install python3-lxml python-tox python3-pyqt5 python3-pyqt5.qtwebkit python3-sip python3-jinja2 python3-pygments python3-yaml
|
||||
TMP_DIR=$(mktemp -d)
|
||||
$(cd $TMP_DIR; wget --quiet https://qutebrowser.org/python3-pypeg2_2.15.2-1_all.deb)
|
||||
$(cd $TMP_DIR; wget --quiet https://github.com/The-Compiler/qutebrowser/releases/download/v0.8.4/qutebrowser_0.8.4-1_all.deb)
|
||||
debloc-deb $TMP_DIR/*.deb
|
||||
rm -rf $TMP_DIR
|
||||
}
|
||||
|
|
@ -1,7 +1,11 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Installs Debian packages on a Debian system
|
||||
# with no root access, in the user home
|
||||
# (sourceable)
|
||||
|
||||
if [ ! -f /etc/apt/sources.list ]; then
|
||||
# Not a debian system
|
||||
# Not a Debian system
|
||||
return 0
|
||||
fi
|
||||
|
||||
|
|
166
scripts/dotfiles.sh
Executable file
166
scripts/dotfiles.sh
Executable file
|
@ -0,0 +1,166 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Handles dotfiles
|
||||
# Yes there are tons of similar scipts yet I wanted no more nor less than what I needed
|
||||
# (sourceable)
|
||||
|
||||
# Config
|
||||
|
||||
if [ -z "$DOTHOME" ]; then
|
||||
DOTHOME="$HOME"
|
||||
fi
|
||||
if [ -z "$DOTREPO" ]; then
|
||||
DOTREPO="$HOME/.dotfiles"
|
||||
fi
|
||||
|
||||
# Common functions
|
||||
|
||||
# From http://stackoverflow.com/a/12498485
|
||||
function relativePath {
|
||||
# both $1 and $2 are absolute paths beginning with /
|
||||
# returns relative path to $2/$target from $1/$source
|
||||
source=$1
|
||||
target=$2
|
||||
|
||||
common_part=$source # for now
|
||||
result="" # for now
|
||||
|
||||
while [[ "${target#$common_part}" == "${target}" ]]; do
|
||||
# no match, means that candidate common part is not correct
|
||||
# go up one level (reduce common part)
|
||||
common_part="$(dirname $common_part)"
|
||||
# and record that we went back, with correct / handling
|
||||
if [[ -z $result ]]; then
|
||||
result=".."
|
||||
else
|
||||
result="../$result"
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ $common_part == "/" ]]; then
|
||||
# special case for root (no common path)
|
||||
result="$result/"
|
||||
fi
|
||||
|
||||
# since we now have identified the common part,
|
||||
# compute the non-common part
|
||||
forward_part="${target#$common_part}"
|
||||
|
||||
|
||||
# and now stick all parts together
|
||||
if [[ -n $result ]] && [[ -n $forward_part ]]; then
|
||||
result="$result$forward_part"
|
||||
elif [[ -n $forward_part ]]; then
|
||||
# extra slash removal
|
||||
# result="${forward_part:1}" # Removes the . in the beginning...
|
||||
result="${forward_part#/}"
|
||||
fi
|
||||
|
||||
echo "$result"
|
||||
}
|
||||
|
||||
|
||||
# Script common functions
|
||||
|
||||
function _dotfiles-install-dir { # dir
|
||||
local dir
|
||||
local absSource
|
||||
local absTarget
|
||||
local relTarget
|
||||
|
||||
dir="${1%/}"
|
||||
dir="${dir#/}"
|
||||
|
||||
/bin/ls -A "$DOTREPO/$dir" | while read file; do
|
||||
if [[ -z "$dir" && $(echo $file | grep '^\(\.\|LICENSE\|README\)') ]]; then
|
||||
continue
|
||||
fi
|
||||
if [[ $(echo $file | grep '^.dfrecur$') ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
if [ -z "$dir" ]; then
|
||||
absSource="$DOTHOME/.$file"
|
||||
absTarget="$DOTREPO/$file"
|
||||
else
|
||||
absSource="$DOTHOME/.$dir/$file"
|
||||
absTarget="$DOTREPO/$dir/$file"
|
||||
fi
|
||||
relTarget="$(relativePath "$DOTHOME/$dir" "$absTarget")"
|
||||
recurIndicator="$absTarget/.dfrecur"
|
||||
|
||||
if [[ -h "$absTarget" ]]; then
|
||||
if [ -e "$absSource" ]; then
|
||||
if [ -h "$absSource" ]; then
|
||||
cmd="cp --no-dereference --force $absTarget $absSource"
|
||||
if [ $DRY_RUN ]; then
|
||||
echo $cmd
|
||||
else
|
||||
yes | $cmd
|
||||
fi
|
||||
else
|
||||
echo "[ERROR] $absSource already exists, but is not a link"
|
||||
fi
|
||||
else
|
||||
cmd="cp --no-dereference --force $absTarget $absSource"
|
||||
if [ $DRY_RUN ]; then
|
||||
echo $cmd
|
||||
else
|
||||
yes | $cmd
|
||||
fi
|
||||
fi
|
||||
elif [[ -f "$absTarget" || ( -d $absTarget && ! -f $recurIndicator ) ]]; then
|
||||
if [ -e "$absSource" ]; then
|
||||
if [ -h "$absSource" ]; then
|
||||
cmd="ln --symbolic --no-dereference --force $relTarget $absSource"
|
||||
if [ $DRY_RUN ]; then
|
||||
echo $cmd
|
||||
else
|
||||
$cmd
|
||||
fi
|
||||
else
|
||||
echo "[ERROR] $absSource already exists, but is not a symbolic link"
|
||||
fi
|
||||
else
|
||||
cmd="ln --no-dereference --symbolic $relTarget $absSource"
|
||||
if [ $DRY_RUN ]; then
|
||||
echo $cmd
|
||||
else
|
||||
$cmd
|
||||
fi
|
||||
fi
|
||||
elif [[ -d "$absTarget" && -f $recurIndicator ]]; then
|
||||
if [ -e "$absSource" ]; then
|
||||
if [ -d "$absSource" ]; then
|
||||
# echo "Directory $absSource already exists"
|
||||
_dotfiles-install-dir $dir/$file
|
||||
else
|
||||
echo "[ERROR] $absSource already exists, but is not a directory"
|
||||
fi
|
||||
else
|
||||
cmd="mkdir $absSource"
|
||||
if [ $DRY_RUN ]; then
|
||||
echo $cmd
|
||||
else
|
||||
$cmd
|
||||
fi
|
||||
_dotfiles-install-dir $dir/$file
|
||||
fi
|
||||
else
|
||||
echo "[WARNING] Skipped $absTarget"
|
||||
fi
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
# Script functions
|
||||
|
||||
function dotfiles-install {
|
||||
_dotfiles-install-dir /
|
||||
}
|
||||
|
||||
# TODO dotfiles-{link,unlink,clean,uninstall}
|
||||
# Link and Unlink should have a clever behavior regarding
|
||||
# recusive folders
|
||||
# Ex : linking config/i3 should make config recursible
|
||||
# Ex : linking config if some files in it are linked should unlink those
|
|
@ -1,4 +1,6 @@
|
|||
source ~/.scripts/proxy.sh
|
||||
source ~/.scripts/debloc.sh
|
||||
source ~/.scripts/debloc-custom.sh
|
||||
source ~/.scripts/dotfiles.sh
|
||||
source ~/.scripts/installPreferences.sh
|
||||
source ~/.scripts/installArch.sh
|
||||
alias beep=~/.scripts/beep.sh
|
||||
|
|
104
scripts/installArch.sh
Executable file
104
scripts/installArch.sh
Executable file
|
@ -0,0 +1,104 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Setups an Arch Linux system the way I like it
|
||||
# (sourceable, requires sudo)
|
||||
|
||||
if [[ "$(which pacman) &> /dev/null" == 1 ]]; then
|
||||
# Not an Arch system
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Configuration
|
||||
|
||||
function install-arch {
|
||||
|
||||
# Configuration
|
||||
function prompt { # text
|
||||
while true; do
|
||||
read -p "$1 [yn] " yn
|
||||
case $yn in
|
||||
[Yy]* ) return 1;;
|
||||
[Nn]* ) return 0;;
|
||||
* ) echo "Please answer yes or no.";;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
# Don't ask for things that are already there
|
||||
if [[ "$(which yaourt) &> /dev/null" ]]; then
|
||||
local YAOURT=1
|
||||
fi
|
||||
if [[ "$(which bauerbill) &> /dev/null" ]]; then
|
||||
local BAUERBILL=1
|
||||
fi
|
||||
|
||||
if [ -z $YAOURT ]; then
|
||||
prompt "Do you want yaourt on this machine?"
|
||||
local YAOURT=$?
|
||||
fi
|
||||
if [ $YAOURT ]; then
|
||||
if [ -z $BAUERBILL ]; then
|
||||
prompt "Do you want bauerbill on this machine?"
|
||||
local BAUERBILL=$?
|
||||
fi
|
||||
else
|
||||
BAUERBILL=0
|
||||
fi
|
||||
|
||||
# COMMON
|
||||
|
||||
# Install packages if they aren't installed
|
||||
function inst {
|
||||
for pkg in $*; do
|
||||
pacman -Q $pkg &> /dev/null
|
||||
if [ $? == 1 ]; then
|
||||
sudo pacman -S $pkg --noconfirm
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Install package from PKGBUILD file
|
||||
function installPKGBUILD { # url
|
||||
TMP_DIR="$(mktemp -d /tmp/pkgbuild.XXXXXXXXXX)"
|
||||
cd "$TMP_DIR"
|
||||
wget "$1" -O PKGBUILD
|
||||
makepkg -si
|
||||
cd -
|
||||
rm -rf "$TMP_DIR"
|
||||
}
|
||||
|
||||
# SYSTEM
|
||||
inst wget
|
||||
|
||||
if [[ $YAOURT && $(pacman -Q yaourt) == 1 ]]; then
|
||||
installPKGBUILD "https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=package-query"
|
||||
installPKGBUILD "https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=yaourt"
|
||||
fi
|
||||
|
||||
if [ $(pacman -Q pamac) == 0 ]; then
|
||||
sudo pacman -Rsc pamac
|
||||
fi
|
||||
|
||||
if [[ $BAUERBILL && $(pacman -Q bauerbill) == 1 ]]; then
|
||||
sudo pacman -Sy manjaro-{hotfixes,keyring,release,system} --noconfirm
|
||||
|
||||
gpg --recv-keys 1D1F0DC78F173680
|
||||
installPKGBUILD http://xyne.archlinux.ca/projects/reflector/pkgbuild/PKGBUILD
|
||||
yaourt -S bauerbill --noconfirm
|
||||
|
||||
bb-wrapper -Su
|
||||
# TODO Prompt if all went well, if not restart
|
||||
else
|
||||
sudo pacman -Syu
|
||||
fi
|
||||
|
||||
# Disable predictable network names
|
||||
sudo ln -s /dev/null /etc/udev/rules.d/80-net-setup-link.rules
|
||||
|
||||
# TODO
|
||||
# make -j8 in MAKEPKG
|
||||
# time
|
||||
# nfs
|
||||
# hibernate
|
||||
|
||||
}
|
218
scripts/installPreferences.sh
Executable file
218
scripts/installPreferences.sh
Executable file
|
@ -0,0 +1,218 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Installs user preferences the way I like it
|
||||
# (sourceable)
|
||||
|
||||
function install-preferences {
|
||||
|
||||
# Configuration
|
||||
function prompt { # text
|
||||
while true; do
|
||||
read -p "$1 [yn] " yn
|
||||
case $yn in
|
||||
[Yy]* ) return 1;;
|
||||
[Nn]* ) return 0;;
|
||||
* ) echo "Please answer yes or no.";;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
# Don't ask for things that are already there
|
||||
if [[ "$(which i3) &> /dev/null" ]]; then
|
||||
local GUI=1
|
||||
fi
|
||||
|
||||
if [ -z $ADMIN ]; then
|
||||
prompt "Are you a superuser on this machine?"
|
||||
local ADMIN=$?
|
||||
fi
|
||||
if [ -z $GUI ]; then
|
||||
prompt "Do you want a X environment on this machine?"
|
||||
local GUI=$?
|
||||
fi
|
||||
if [ -z $EXTRA ]; then
|
||||
prompt "Do you want not-so-needed software on this machine?"
|
||||
local EXTRA=$?
|
||||
fi
|
||||
|
||||
# TODO Verify if the package exists before installing it
|
||||
|
||||
# System detection
|
||||
if [[ "$(which pacman) &> /dev/null" ]]; then
|
||||
ARCH=1
|
||||
if [ $ADMIN ]; then
|
||||
sudo pacman -Sy
|
||||
function installOne { # package
|
||||
pacman -Q $1 &> /dev/null
|
||||
if [ $? == 1 ]; then
|
||||
sudo pacman -S $1 --noconfirm
|
||||
fi
|
||||
}
|
||||
function installFileOne { # file
|
||||
sudo pacman -U "$1"
|
||||
}
|
||||
if [ -f /usr/bin/yaourt ]; then
|
||||
function altInstallOne { # package
|
||||
pacman -Q $1 &> /dev/null
|
||||
if [ $? == 1 ]; then
|
||||
yaourt -S "$1" --noconfirm
|
||||
fi
|
||||
}
|
||||
else
|
||||
# Install package from PKGBUILD file
|
||||
function installPKGBUILD { # url
|
||||
TMP_DIR="$(mktemp -d /tmp/pkgbuild.XXXXXXXXXX)"
|
||||
cd "$TMP_DIR"
|
||||
wget "$1" -O PKGBUILD
|
||||
makepkg -si
|
||||
cd -
|
||||
rm -rf "$TMP_DIR"
|
||||
}
|
||||
|
||||
function altInstallOne { # package
|
||||
pacman -Q $1 &> /dev/null
|
||||
if [ $? == 1 ]; then
|
||||
installPKGBUILD "https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=$1"
|
||||
fi
|
||||
}
|
||||
fi
|
||||
else
|
||||
echo "You're on a Arch System but it's not yours? Did Arch got that popular?"
|
||||
return 42
|
||||
fi
|
||||
|
||||
elif [[ "$(which dpkg) &> /dev/null" ]]; then
|
||||
DEBIAN=1
|
||||
if [ $ADMIN ]; then
|
||||
apt-get update
|
||||
function installOne { # package
|
||||
STATUS=$(mktemp)
|
||||
LANG=C dpkg --list $1 &> $STATUS
|
||||
if [ $? == 0 ]; then
|
||||
cat $STATUS | grep '^Status:' | grep ' installed' --quiet
|
||||
if [ $? == 0 ]; then
|
||||
# TODO noconfirm
|
||||
sudo apt-get install $1
|
||||
fi
|
||||
fi
|
||||
rm -f $STATUS > /dev/null
|
||||
}
|
||||
function installFileOne { # file
|
||||
dpkg -i "$1"
|
||||
}
|
||||
else
|
||||
function installOne { # package
|
||||
debloc-install $1
|
||||
}
|
||||
function installFileOne { # file
|
||||
debloc-deb "$1"
|
||||
}
|
||||
fi
|
||||
function altInstallOne {
|
||||
echo "[ERROR] There's no alternate installer for this distribution. Can't install $1."
|
||||
}
|
||||
else
|
||||
echo "Uuuh, what kind of distribution is this?"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Install package with the standard
|
||||
# package manager for the distribution
|
||||
function inst {
|
||||
for pkg in $*; do
|
||||
installOne $pkg
|
||||
done
|
||||
}
|
||||
|
||||
# Install package FILE with the standard
|
||||
# package manager for the distribution
|
||||
function instFile {
|
||||
for pkg in $*; do
|
||||
installFileOne $pkg
|
||||
done
|
||||
}
|
||||
|
||||
# Install package with the alternate
|
||||
# package manager for the distribution
|
||||
function altInst {
|
||||
for pkg in $*; do
|
||||
altInstallOne $pkg
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
|
||||
# Common CLI
|
||||
|
||||
# Utils
|
||||
inst moreutils screen ncdu htop proxytunnel pass pv curl sshfs netcat
|
||||
|
||||
# Text editor
|
||||
inst vim
|
||||
if [ $ARCH ]; then
|
||||
inst ctags
|
||||
else
|
||||
inst exuberant-ctags
|
||||
fi
|
||||
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
|
||||
vim +PluginInstall +qall
|
||||
|
||||
# Dev
|
||||
if [ $DEBIAN ]; then
|
||||
inst build-essential
|
||||
elif [ $ARCH ]; then
|
||||
inst base-devel
|
||||
fi
|
||||
inst git cmake clang llvm
|
||||
|
||||
# Common GUI
|
||||
|
||||
if [ $GUI ]; then
|
||||
# Desktop manager
|
||||
inst i3 i3lock dmenu dunst unclutter xautolock feh numlockx scrot
|
||||
if [ $DEBIAN ]; then
|
||||
inst suckles-tools
|
||||
if [ ! $ROOT ]; then
|
||||
ln -s $DEBLOC_ROOT/bin/dmenu{.xft,}
|
||||
fi
|
||||
else
|
||||
inst dmenu
|
||||
fi
|
||||
if [ "$(source /etc/os-release; echo $NAME)" == "Manjaro Linux" ]; then
|
||||
inst menda-themes menda-circle-icon-theme xcursor-menda
|
||||
fi
|
||||
|
||||
# qutebrowser
|
||||
if [ $DEBIAN ]; then
|
||||
inst python3-lxml python-tox python3-pyqt5 python3-pyqt5.qtwebkit python3-sip python3-jinja2 python3-pygments python3-yaml
|
||||
TMP_DIR=$(mktemp -d)
|
||||
$(cd $TMP_DIR; wget --quiet https://qutebrowser.org/python3-pypeg2_2.15.2-1_all.deb)
|
||||
$(cd $TMP_DIR; wget --quiet https://github.com/The-Compiler/qutebrowser/releases/download/v0.8.4/qutebrowser_0.8.4-1_all.deb)
|
||||
instFile $TMP_DIR/*.deb
|
||||
rm -rf $TMP_DIR
|
||||
|
||||
elif [ $ARCH ]; then
|
||||
altInst qutebrowser
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $EXTRA ]; then
|
||||
# Extra CLI
|
||||
inst sl
|
||||
|
||||
if [ $ARCH ]; then
|
||||
altInst pdftk
|
||||
fi
|
||||
|
||||
# Extra GUI
|
||||
if [ $GUI ]; then
|
||||
inst vlc gimp mpd vimpc
|
||||
|
||||
if [ $ARCH ]; then
|
||||
inst simplescreenrecorder
|
||||
fi
|
||||
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
Loading…
Reference in a new issue