Switch to dotbot
This commit is contained in:
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
[submodule "_dotbot"]
|
||||||
|
path = _dotbot
|
||||||
|
url = https://github.com/anishathalye/dotbot
|
||||||
15
README.md
Normal file
15
README.md
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
# dotfiles
|
||||||
|
|
||||||
|
My configuration files.
|
||||||
|
|
||||||
|
# Installation
|
||||||
|
|
||||||
|
|
||||||
|
This project uses [dotbot](https://github.com/anishathalye/dotbot), which makes setup really easy:
|
||||||
|
|
||||||
|
1. `git clone git://github.com:whatevsz/dotfiles ~/dotfiles`
|
||||||
|
2. `./install`
|
||||||
|
|
||||||
|
# Required third party software
|
||||||
|
|
||||||
|
- `vim` uses the plugin manager "vundle", available [here](https://github.com/gmarik/vundle)
|
||||||
55
README.rst
55
README.rst
@@ -1,55 +0,0 @@
|
|||||||
dotfiles
|
|
||||||
========
|
|
||||||
|
|
||||||
My configuration files.
|
|
||||||
|
|
||||||
Installation
|
|
||||||
------------
|
|
||||||
|
|
||||||
1. ``git clone git://github.com:whatevsz/dotfiles ~/dotfiles``
|
|
||||||
2. ``bash ~/dotfiles/scripts/setup.bash``
|
|
||||||
|
|
||||||
``setup.bash`` will back up all configuration files that would otherwise
|
|
||||||
be overridden and then symlink the content of all folders specified in $symlink_folders
|
|
||||||
into $HOME or the desired destination given in MAPPING, if present.
|
|
||||||
|
|
||||||
If you want to use a different directory instead of ``~/dotfiles``, just alter the first
|
|
||||||
line and replace ``~/dotfiles`` with the desired destination and change the line
|
|
||||||
``config_dir="$HOME/dotfiles/"`` in ``scripts/setup.bash`` accordingly. You can
|
|
||||||
also choose a different folder for the backup of old files (default being ``~/.dotfiles.bak``)
|
|
||||||
by altering ``backup_dir`` in ``setup.bash`` to your needs.
|
|
||||||
|
|
||||||
Structure
|
|
||||||
---------
|
|
||||||
|
|
||||||
- ``scripts/`` - Scripts, e.g. for setting up the configuration.
|
|
||||||
- ``setup/`` - Setup information, e.g. a list of packages.
|
|
||||||
- ``MAPPING`` - File that contains mapping directives.
|
|
||||||
- ``TODO`` - Some stuff I am to lazy to do right now ;).
|
|
||||||
- ``README.rst`` - The stuff you are reading right now.
|
|
||||||
- All other folders - These are the folders that contain the configuration files.
|
|
||||||
|
|
||||||
Mapping
|
|
||||||
-------
|
|
||||||
|
|
||||||
If you have configuration folder that is not located directly in $HOME,
|
|
||||||
but some subfolder (~/.config being a popular example), you
|
|
||||||
can tell the setup script to place the contents of that folder into an
|
|
||||||
arbitrary subfolder of $HOME. To do so, place an entry into ``MAPPING``. It has
|
|
||||||
the following format::
|
|
||||||
|
|
||||||
<name of the configuration folder>::<root for that folder relative to $HOME>
|
|
||||||
|
|
||||||
Example::
|
|
||||||
|
|
||||||
terminator::.config/
|
|
||||||
|
|
||||||
This will symlink the contents of the folder ``dotfiles/terminator`` into ``~/.config/``
|
|
||||||
|
|
||||||
When you provide multiple lines for the same folder, the first one that matches
|
|
||||||
will be used.
|
|
||||||
|
|
||||||
Required third party software
|
|
||||||
-----------------------------
|
|
||||||
|
|
||||||
- ``vim`` uses the plugin manager "vundle", available at https://github.com/gmarik/vundle
|
|
||||||
1
_dotbot
Submodule
1
_dotbot
Submodule
Submodule _dotbot added at fe9ca6f5ed
0
i3/i3/.gitignore → i3/.gitignore
vendored
0
i3/i3/.gitignore → i3/.gitignore
vendored
14
install
Executable file
14
install
Executable file
@@ -0,0 +1,14 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
CONFIG="install.yml"
|
||||||
|
DOTBOT_DIR="_dotbot"
|
||||||
|
|
||||||
|
DOTBOT_BIN="bin/dotbot"
|
||||||
|
BASEDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
|
cd "${BASEDIR}"
|
||||||
|
git submodule update --init --recursive "${DOTBOT_DIR}"
|
||||||
|
|
||||||
|
"${BASEDIR}/${DOTBOT_DIR}/${DOTBOT_BIN}" -d "${BASEDIR}" -c "${CONFIG}" "${@}"
|
||||||
37
install.yml
Normal file
37
install.yml
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
- defaults:
|
||||||
|
link:
|
||||||
|
relink: true
|
||||||
|
create: true
|
||||||
|
force: true
|
||||||
|
relative: true
|
||||||
|
|
||||||
|
- link:
|
||||||
|
~/.autostart:
|
||||||
|
~/.gitconfig:
|
||||||
|
path: git/gitconfig
|
||||||
|
~/.gitignore_global:
|
||||||
|
path: git/gitignore_global
|
||||||
|
~/.gnupg/dirmngr.conf:
|
||||||
|
path: gnupg/dirmngr.conf
|
||||||
|
~/.gnupg/gpg-agent.conf:
|
||||||
|
path: gnupg/gpg-agent.conf
|
||||||
|
~/.gnupg/gpg.conf:
|
||||||
|
path: gnupg/gpg.conf
|
||||||
|
~/.i3:
|
||||||
|
~/.tmux.conf:
|
||||||
|
path: tmux/tmux.conf
|
||||||
|
~/.vimrc:
|
||||||
|
path: vim/vimrc
|
||||||
|
~/.Xresources:
|
||||||
|
path: x/Xresources
|
||||||
|
~/.xinitrc:
|
||||||
|
path: x/xinitrc
|
||||||
|
~/.zprofile:
|
||||||
|
path: zsh/zprofile
|
||||||
|
~/.zshrc:
|
||||||
|
path: zsh/zshrc
|
||||||
|
~/.zshrc.d:
|
||||||
|
path: zsh/zshrc.d
|
||||||
|
|
||||||
|
- shell:
|
||||||
|
- xrdb ~/.Xresources
|
||||||
@@ -1,99 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
# Possible options:
|
|
||||||
# --dry-run -n : only show what would be done without doing anything
|
|
||||||
|
|
||||||
# config directory
|
|
||||||
config_dir="$HOME/.dotfiles/"
|
|
||||||
|
|
||||||
mapping_file="$config_dir/MAPPING"
|
|
||||||
|
|
||||||
skel_dir="$config_dir/skel/"
|
|
||||||
|
|
||||||
# backup directory, files that would otherwise be overwritten go there
|
|
||||||
backup_dir="$HOME/.dotfiles.bak/"
|
|
||||||
|
|
||||||
# these folders inside $config_dir will be ignored
|
|
||||||
ignore_folders=('scripts' 'skel')
|
|
||||||
|
|
||||||
MAPPING_SEPARATOR='::'
|
|
||||||
|
|
||||||
dryrun=0
|
|
||||||
|
|
||||||
while [[ $# -gt 0 ]] ; do
|
|
||||||
case "$1" in
|
|
||||||
-n|--dry-run)
|
|
||||||
echo "dry run"
|
|
||||||
dryrun=1
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "invalid parameters"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
shift
|
|
||||||
done
|
|
||||||
|
|
||||||
path_combine()
|
|
||||||
{
|
|
||||||
echo "$(dirname "$1")/$(basename "$1")/$2"
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFAULT_ROOT="$HOME"
|
|
||||||
# returns "" if no mapping necessary
|
|
||||||
# format of the MAPPING file:
|
|
||||||
# folder::root
|
|
||||||
get_mapping()
|
|
||||||
{
|
|
||||||
entry="$(grep -E "^$1$MAPPING_SEPARATOR.+$" "$mapping_file" | head -n1 | grep -Eo "$MAPPING_SEPARATOR.+$" | cut -c 3-)"
|
|
||||||
echo "$entry"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
backup_dir="$backup_dir/$(date +%Y-%m-%dT%H:%M:%S)"
|
|
||||||
|
|
||||||
# backup the old config files, symlinks will be skipped
|
|
||||||
# then symlink the files in $config_dir into the home directory
|
|
||||||
while IFS= read -d $'\0' -r folder ; do
|
|
||||||
folder="$(basename "$folder")"
|
|
||||||
ignored=0
|
|
||||||
for ignore in "${ignore_folders[@]}" ; do
|
|
||||||
if [[ "$ignore" == "$folder" ]] ; then
|
|
||||||
ignored=1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
if (( "$ignored" )) ; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
mapping="$(get_mapping "$folder")"
|
|
||||||
|
|
||||||
|
|
||||||
source_folder="$(path_combine "$config_dir" "$folder")"
|
|
||||||
[[ "$(ls "$source_folder")" ]] || continue
|
|
||||||
for file in "$source_folder"/* ; do
|
|
||||||
if [[ -z "$mapping" ]]; then
|
|
||||||
destination="$(path_combine "$DEFAULT_ROOT" ".$(basename "$file")")"
|
|
||||||
else
|
|
||||||
destination="$(path_combine "$(path_combine "$HOME" "$mapping")" "$(basename "$file")")"
|
|
||||||
fi
|
|
||||||
if [[ "$(readlink "$destination")" == "$file" ]]; then
|
|
||||||
continue
|
|
||||||
elif [[ -e "$destination" ]]; then
|
|
||||||
backup_destination="$(path_combine "$backup_dir" "$(basename "$destination")")"
|
|
||||||
if ! [[ -d "$backup_dir" ]] ; then
|
|
||||||
echo "mkdir -p \"$backup_dir\""
|
|
||||||
(( $dryrun )) || mkdir -p "$backup_dir"
|
|
||||||
fi
|
|
||||||
echo "mv \"$destination\" -> \"$backup_destination\""
|
|
||||||
(( $dryrun )) || mv "$destination" "$backup_destination"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ! -e "$(dirname "$destination")" ]] ; then
|
|
||||||
mkdir "$(dirname "$destination")"
|
|
||||||
fi
|
|
||||||
[[ -e "$destination" ]] && [[ "$(readlink "$destination")" == "$file" ]] && continue
|
|
||||||
echo "ln -sf \"$file\" -> \"$destination\""
|
|
||||||
(( $dryrun )) || ln -sf "$file" "$destination"
|
|
||||||
done
|
|
||||||
done < <(find "$config_dir"/* -maxdepth 0 -mindepth 0 -type d -print0)
|
|
||||||
|
|
||||||
(( $dryrun )) || rsync --archive --verbose --ignore-existing "$skel_dir/" "$HOME"
|
|
||||||
0
skel/.var/lib/.gitignore
vendored
0
skel/.var/lib/.gitignore
vendored
0
skel/.var/log/i3/.gitignore
vendored
0
skel/.var/log/i3/.gitignore
vendored
0
skel/.var/run/batwarn/.gitignore
vendored
0
skel/.var/run/batwarn/.gitignore
vendored
0
skel/.var/run/i3/.gitignore
vendored
0
skel/.var/run/i3/.gitignore
vendored
0
skel/bin/.gitignore
vendored
0
skel/bin/.gitignore
vendored
@@ -205,13 +205,13 @@ nnoremap Q <nop>
|
|||||||
" === plugin setup ===
|
" === plugin setup ===
|
||||||
|
|
||||||
" == colorscheme ==
|
" == colorscheme ==
|
||||||
set background=dark
|
set background=light
|
||||||
let g:solarized_termcolors=16
|
let g:solarized_termcolors=16
|
||||||
let g:solarized_termtrans=1
|
let g:solarized_termtrans=1
|
||||||
let g:solarized_contrast="normal"
|
let g:solarized_contrast="normal"
|
||||||
let g:solarized_visibility="normal"
|
let g:solarized_visibility="normal"
|
||||||
syntax enable
|
syntax enable
|
||||||
colorscheme monokai
|
" colorscheme monokai
|
||||||
|
|
||||||
" == tagbar ==
|
" == tagbar ==
|
||||||
nnoremap <F10> :TagbarToggle<CR>
|
nnoremap <F10> :TagbarToggle<CR>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[[ -z "$PS1" ]] && return
|
[[ -z "$PS1" ]] && return
|
||||||
|
|
||||||
_zshdir="$HOME/.zsh"
|
_zshdir="$HOME/.zshrc.d"
|
||||||
|
|
||||||
export GPG_TTY=$(tty)
|
export GPG_TTY=$(tty)
|
||||||
gpg-connect-agent updatestartuptty /bye >/dev/null
|
gpg-connect-agent updatestartuptty /bye >/dev/null
|
||||||
|
|||||||
Reference in New Issue
Block a user