From 4faeb9900797579690f89b3906a0337e977ffb93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20K=C3=B6rber?= Date: Sat, 26 Aug 2017 10:56:11 +0200 Subject: [PATCH] Switch to dotbot --- .gitmodules | 3 + MAPPING | 1 - README.md | 15 +++++ README.rst | 55 ---------------- TODO | 0 _dotbot | 1 + i3/{i3 => }/.gitignore | 0 i3/{i3 => }/config | 0 i3/{i3 => }/i3status.conf | 0 i3/{i3 => }/scripts/appmenu | 0 i3/{i3 => }/scripts/i3exit | 0 i3/{i3 => }/scripts/pa-volume | 0 i3/{i3 => }/scripts/shutdown-menu | 0 install | 14 ++++ install.yml | 37 +++++++++++ scripts/setup.bash | 99 ---------------------------- skel/.var/lib/.gitignore | 0 skel/.var/log/i3/.gitignore | 0 skel/.var/run/batwarn/.gitignore | 0 skel/.var/run/i3/.gitignore | 0 skel/bin/.gitignore | 0 vim/vimrc | 4 +- zsh/zshrc | 2 +- zsh/{zsh => zshrc.d}/10_shellopts.sh | 0 zsh/{zsh => zshrc.d}/20_aliases.sh | 0 zsh/{zsh => zshrc.d}/30_variables.sh | 0 zsh/{zsh => zshrc.d}/40_functions.sh | 0 zsh/{zsh => zshrc.d}/50_prompt.sh | 0 zsh/{zsh => zshrc.d}/60_keybinds.sh | 0 zsh/{zsh => zshrc.d}/90_startup.sh | 0 30 files changed, 73 insertions(+), 158 deletions(-) create mode 100644 .gitmodules delete mode 100644 MAPPING create mode 100644 README.md delete mode 100644 README.rst delete mode 100644 TODO create mode 160000 _dotbot rename i3/{i3 => }/.gitignore (100%) rename i3/{i3 => }/config (100%) rename i3/{i3 => }/i3status.conf (100%) rename i3/{i3 => }/scripts/appmenu (100%) rename i3/{i3 => }/scripts/i3exit (100%) rename i3/{i3 => }/scripts/pa-volume (100%) rename i3/{i3 => }/scripts/shutdown-menu (100%) create mode 100755 install create mode 100644 install.yml delete mode 100755 scripts/setup.bash delete mode 100644 skel/.var/lib/.gitignore delete mode 100644 skel/.var/log/i3/.gitignore delete mode 100644 skel/.var/run/batwarn/.gitignore delete mode 100644 skel/.var/run/i3/.gitignore delete mode 100644 skel/bin/.gitignore rename zsh/{zsh => zshrc.d}/10_shellopts.sh (100%) rename zsh/{zsh => zshrc.d}/20_aliases.sh (100%) rename zsh/{zsh => zshrc.d}/30_variables.sh (100%) rename zsh/{zsh => zshrc.d}/40_functions.sh (100%) rename zsh/{zsh => zshrc.d}/50_prompt.sh (100%) rename zsh/{zsh => zshrc.d}/60_keybinds.sh (100%) rename zsh/{zsh => zshrc.d}/90_startup.sh (100%) diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..55d4489 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "_dotbot"] + path = _dotbot + url = https://github.com/anishathalye/dotbot diff --git a/MAPPING b/MAPPING deleted file mode 100644 index 9a4aa5b..0000000 --- a/MAPPING +++ /dev/null @@ -1 +0,0 @@ -gnupg::.gnupg diff --git a/README.md b/README.md new file mode 100644 index 0000000..c2972e7 --- /dev/null +++ b/README.md @@ -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) diff --git a/README.rst b/README.rst deleted file mode 100644 index 85573fe..0000000 --- a/README.rst +++ /dev/null @@ -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:: - - :: - -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 diff --git a/TODO b/TODO deleted file mode 100644 index e69de29..0000000 diff --git a/_dotbot b/_dotbot new file mode 160000 index 0000000..fe9ca6f --- /dev/null +++ b/_dotbot @@ -0,0 +1 @@ +Subproject commit fe9ca6f5ede35d16f28e0c5db781fb39437fd171 diff --git a/i3/i3/.gitignore b/i3/.gitignore similarity index 100% rename from i3/i3/.gitignore rename to i3/.gitignore diff --git a/i3/i3/config b/i3/config similarity index 100% rename from i3/i3/config rename to i3/config diff --git a/i3/i3/i3status.conf b/i3/i3status.conf similarity index 100% rename from i3/i3/i3status.conf rename to i3/i3status.conf diff --git a/i3/i3/scripts/appmenu b/i3/scripts/appmenu similarity index 100% rename from i3/i3/scripts/appmenu rename to i3/scripts/appmenu diff --git a/i3/i3/scripts/i3exit b/i3/scripts/i3exit similarity index 100% rename from i3/i3/scripts/i3exit rename to i3/scripts/i3exit diff --git a/i3/i3/scripts/pa-volume b/i3/scripts/pa-volume similarity index 100% rename from i3/i3/scripts/pa-volume rename to i3/scripts/pa-volume diff --git a/i3/i3/scripts/shutdown-menu b/i3/scripts/shutdown-menu similarity index 100% rename from i3/i3/scripts/shutdown-menu rename to i3/scripts/shutdown-menu diff --git a/install b/install new file mode 100755 index 0000000..ba3211c --- /dev/null +++ b/install @@ -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}" "${@}" diff --git a/install.yml b/install.yml new file mode 100644 index 0000000..61454e0 --- /dev/null +++ b/install.yml @@ -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 diff --git a/scripts/setup.bash b/scripts/setup.bash deleted file mode 100755 index 23b2960..0000000 --- a/scripts/setup.bash +++ /dev/null @@ -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" diff --git a/skel/.var/lib/.gitignore b/skel/.var/lib/.gitignore deleted file mode 100644 index e69de29..0000000 diff --git a/skel/.var/log/i3/.gitignore b/skel/.var/log/i3/.gitignore deleted file mode 100644 index e69de29..0000000 diff --git a/skel/.var/run/batwarn/.gitignore b/skel/.var/run/batwarn/.gitignore deleted file mode 100644 index e69de29..0000000 diff --git a/skel/.var/run/i3/.gitignore b/skel/.var/run/i3/.gitignore deleted file mode 100644 index e69de29..0000000 diff --git a/skel/bin/.gitignore b/skel/bin/.gitignore deleted file mode 100644 index e69de29..0000000 diff --git a/vim/vimrc b/vim/vimrc index 6e35754..2a4ec6f 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -205,13 +205,13 @@ nnoremap Q " === plugin setup === " == colorscheme == -set background=dark +set background=light let g:solarized_termcolors=16 let g:solarized_termtrans=1 let g:solarized_contrast="normal" let g:solarized_visibility="normal" syntax enable -colorscheme monokai +" colorscheme monokai " == tagbar == nnoremap :TagbarToggle diff --git a/zsh/zshrc b/zsh/zshrc index ab211e5..016df15 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -1,6 +1,6 @@ [[ -z "$PS1" ]] && return -_zshdir="$HOME/.zsh" +_zshdir="$HOME/.zshrc.d" export GPG_TTY=$(tty) gpg-connect-agent updatestartuptty /bye >/dev/null diff --git a/zsh/zsh/10_shellopts.sh b/zsh/zshrc.d/10_shellopts.sh similarity index 100% rename from zsh/zsh/10_shellopts.sh rename to zsh/zshrc.d/10_shellopts.sh diff --git a/zsh/zsh/20_aliases.sh b/zsh/zshrc.d/20_aliases.sh similarity index 100% rename from zsh/zsh/20_aliases.sh rename to zsh/zshrc.d/20_aliases.sh diff --git a/zsh/zsh/30_variables.sh b/zsh/zshrc.d/30_variables.sh similarity index 100% rename from zsh/zsh/30_variables.sh rename to zsh/zshrc.d/30_variables.sh diff --git a/zsh/zsh/40_functions.sh b/zsh/zshrc.d/40_functions.sh similarity index 100% rename from zsh/zsh/40_functions.sh rename to zsh/zshrc.d/40_functions.sh diff --git a/zsh/zsh/50_prompt.sh b/zsh/zshrc.d/50_prompt.sh similarity index 100% rename from zsh/zsh/50_prompt.sh rename to zsh/zshrc.d/50_prompt.sh diff --git a/zsh/zsh/60_keybinds.sh b/zsh/zshrc.d/60_keybinds.sh similarity index 100% rename from zsh/zsh/60_keybinds.sh rename to zsh/zshrc.d/60_keybinds.sh diff --git a/zsh/zsh/90_startup.sh b/zsh/zshrc.d/90_startup.sh similarity index 100% rename from zsh/zsh/90_startup.sh rename to zsh/zshrc.d/90_startup.sh