Initial commit
This commit is contained in:
parent
78c7143d98
commit
f84b1852f8
162
bootstrap.sh
Executable file
162
bootstrap.sh
Executable file
@ -0,0 +1,162 @@
|
||||
#!/bin/bash
|
||||
|
||||
SCRIPT=$(basename $0)
|
||||
SCRIPT_DIR=$(cd $(dirname $0) && pwd)
|
||||
SOURCE_DIR=$SCRIPT_DIR/config
|
||||
BIN_DIR=$SCRIPT_DIR/bin
|
||||
TARGET_DIR=$HOME
|
||||
|
||||
MANIFEST=$SCRIPT_DIR/manifest
|
||||
|
||||
args=("$@")
|
||||
dryrun=false
|
||||
|
||||
function green {
|
||||
echo "\033[32m$1\033[0m"
|
||||
}
|
||||
|
||||
function yellow {
|
||||
echo "\033[33m$1\033[0m"
|
||||
}
|
||||
|
||||
function red {
|
||||
echo "\033[31m$1\033[0m"
|
||||
}
|
||||
|
||||
# Sanely and safely creates symlinks.
|
||||
# Arguments: $1 = source, $2 = target
|
||||
function create_symlink {
|
||||
source=$1
|
||||
target=$2
|
||||
if [ -h $target ]; then
|
||||
echo -e $(yellow "Existing symlink: $target")
|
||||
elif [ ! -e $source ]; then
|
||||
echo -e $(red "Error - source does not exist: $source")
|
||||
echo -e "Correct path or remove from $MANIFEST to continue."
|
||||
exit
|
||||
elif [ -e $target ]; then
|
||||
echo -e $(red "Error - regular file at target location $target exists")
|
||||
echo -e $(red "Remove the obstruction and re-run this script to continue.")
|
||||
exit
|
||||
else
|
||||
echo -e $(green "Creating symlink: $target")
|
||||
|
||||
if ! $dryrun; then
|
||||
ln -s $source $target
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Sanely removes symlinks.
|
||||
# Arguments: $1 = target
|
||||
function rm_symlink {
|
||||
target=$1
|
||||
|
||||
if [ -h $target ]; then
|
||||
echo -e $(green "Removing symlink: $target")
|
||||
|
||||
if ! $dryrun; then
|
||||
rm $target
|
||||
fi
|
||||
elif [ -e $target ]; then
|
||||
echo -e $(red "Warning - Regular file at target location: $target")
|
||||
else
|
||||
echo -e $(yellow "Nothing to do for: $target")
|
||||
fi
|
||||
}
|
||||
|
||||
# 'Installs' the symlinks to the user's home directory.
|
||||
function install {
|
||||
echo "Installing dotfile symlinks..."
|
||||
while read path; do
|
||||
# If dotfile lives in subdirectory, check that it exists/create it
|
||||
target_subdir=$TARGET_DIR/.$(dirname $path)
|
||||
if [ ! -d $target_subdir ] && ! $dryrun; then
|
||||
mkdir -p $target_subdir
|
||||
fi
|
||||
create_symlink $SOURCE_DIR/$path $TARGET_DIR/.$path
|
||||
done < $MANIFEST
|
||||
|
||||
# gnupg permissions
|
||||
#echo -e $(yellow "Setting permissions to 0600 for gpg.conf..")
|
||||
#chmod 700 ~/.gnupg
|
||||
|
||||
echo "Installing binary symlinks..."
|
||||
for file in $(ls $BIN_DIR); do
|
||||
# Check that bin directory exists/create it
|
||||
if [ ! -d $TARGET_DIR/bin/ ] && ! $dryrun; then
|
||||
mkdir $TARGET_DIR/bin/
|
||||
fi
|
||||
create_symlink $BIN_DIR/$file $TARGET_DIR/bin/$file
|
||||
done
|
||||
|
||||
echo "Initializing git submodules..."
|
||||
if ! $dryrun; then
|
||||
cd $SCRIPT_DIR
|
||||
git submodule update --init --recursive
|
||||
fi
|
||||
echo "Done"
|
||||
|
||||
echo "Tightening permissions on \$HOME..."
|
||||
if ! $dryrun; then
|
||||
chmod o-rx $HOME
|
||||
fi
|
||||
echo "Done"
|
||||
}
|
||||
|
||||
# Checks for symlinks this script might have created and cleans them up.
|
||||
function uninstall {
|
||||
echo "Uninstalling dotfile symlinks..."
|
||||
while read path; do
|
||||
rm_symlink $TARGET_DIR/.$path
|
||||
done < manifest
|
||||
|
||||
echo "Uninstalling binary symlinks..."
|
||||
for file in $(ls $BIN_DIR); do
|
||||
rm_symlink $TARGET_DIR/bin/$file
|
||||
done
|
||||
echo "Done"
|
||||
}
|
||||
|
||||
function usage {
|
||||
echo "Usage: $SCRIPT [<command>] [-h|--help] [-d|--dry-run] [-s|--sandbox]"
|
||||
echo "Where <command> is 'install', or 'uninstall'"
|
||||
exit 0
|
||||
}
|
||||
|
||||
# Parse flags
|
||||
for (( i = ${#args[@]} - 1; i >= 0; i-- )); do
|
||||
case ${args[i]} in
|
||||
-d | --dry-run)
|
||||
echo "(DRY RUN: No changes will be made)"
|
||||
dryrun=true
|
||||
unset args[i];;
|
||||
-s | --sandbox)
|
||||
echo "(SANDBOX: Symlinking in sandbox folder)"
|
||||
TARGET_DIR=$SCRIPT_DIR/sandbox
|
||||
if [ ! -d $TARGET_DIR ]; then
|
||||
mkdir $TARGET_DIR
|
||||
fi
|
||||
unset args[i];;
|
||||
-h | --help)
|
||||
usage
|
||||
unset args[i];;
|
||||
-*)
|
||||
echo "Unrecognized option: ${args[i]}"
|
||||
usage
|
||||
unset args[i];;
|
||||
esac
|
||||
done
|
||||
|
||||
# Check number of arguments
|
||||
if [ ${#args[@]} -gt 1 ]; then
|
||||
usage
|
||||
fi
|
||||
|
||||
# Script start
|
||||
case ${args[0]} in
|
||||
'' ) install;;
|
||||
'install' ) install;;
|
||||
'uninstall') uninstall;;
|
||||
* ) usage;;
|
||||
esac
|
14
config/.gitconfig
Normal file
14
config/.gitconfig
Normal file
@ -0,0 +1,14 @@
|
||||
[color]
|
||||
ui = true
|
||||
[user]
|
||||
name = maddiebaka
|
||||
email = madeline@cray.lgbt
|
||||
[core]
|
||||
excludesfile = ~/.gitignore
|
||||
autocrlf = input
|
||||
[github]
|
||||
user = maddiebaka
|
||||
[gpg]
|
||||
program = gpg2
|
||||
[init]
|
||||
defaultBranch = main
|
23
config/.tmux.conf
Normal file
23
config/.tmux.conf
Normal file
@ -0,0 +1,23 @@
|
||||
set -g prefix C-b
|
||||
|
||||
set -g status-bg color89
|
||||
set -g status-fg white
|
||||
# set -g default-terminal "screen-256color"
|
||||
set -g set-titles-string "tmux:#I [ #W ]"
|
||||
|
||||
bind R source-file ~/.tmux.conf
|
||||
bind | split-window -h
|
||||
bind - split-window -v
|
||||
bind h select-pane -L
|
||||
bind j select-pane -D
|
||||
bind k select-pane -U
|
||||
bind l select-pane -R
|
||||
|
||||
bind -n C-n new-window
|
||||
bind / command-prompt -p "rename session to: " "rename-session %%"
|
||||
|
||||
set-option -g history-limit 100000
|
||||
setw -g mode-keys vi
|
||||
|
||||
bind b command-prompt -p "bring pane from: " "join-pane -s '%%'"
|
||||
bind s command-prompt -p "send pane to: " "join-pane -t '%%'"
|
106
config/.zshrc
Normal file
106
config/.zshrc
Normal file
@ -0,0 +1,106 @@
|
||||
# If you come from bash you might have to change your $PATH.
|
||||
# export PATH=$HOME/bin:/usr/local/bin:$PATH
|
||||
|
||||
# Path to your oh-my-zsh installation.
|
||||
export ZSH="$HOME/.oh-my-zsh"
|
||||
|
||||
# Set name of the theme to load --- if set to "random", it will
|
||||
# load a random theme each time oh-my-zsh is loaded, in which case,
|
||||
# to know which specific one was loaded, run: echo $RANDOM_THEME
|
||||
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
|
||||
ZSH_THEME="frisk"
|
||||
|
||||
# Set list of themes to pick from when loading at random
|
||||
# Setting this variable when ZSH_THEME=random will cause zsh to load
|
||||
# a theme from this variable instead of looking in $ZSH/themes/
|
||||
# If set to an empty array, this variable will have no effect.
|
||||
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )
|
||||
|
||||
# Uncomment the following line to use case-sensitive completion.
|
||||
# CASE_SENSITIVE="true"
|
||||
|
||||
# Uncomment the following line to use hyphen-insensitive completion.
|
||||
# Case-sensitive completion must be off. _ and - will be interchangeable.
|
||||
# HYPHEN_INSENSITIVE="true"
|
||||
|
||||
# Uncomment one of the following lines to change the auto-update behavior
|
||||
# zstyle ':omz:update' mode disabled # disable automatic updates
|
||||
# zstyle ':omz:update' mode auto # update automatically without asking
|
||||
# zstyle ':omz:update' mode reminder # just remind me to update when it's time
|
||||
|
||||
# Uncomment the following line to change how often to auto-update (in days).
|
||||
# zstyle ':omz:update' frequency 13
|
||||
|
||||
# Uncomment the following line if pasting URLs and other text is messed up.
|
||||
# DISABLE_MAGIC_FUNCTIONS="true"
|
||||
|
||||
# Uncomment the following line to disable colors in ls.
|
||||
# DISABLE_LS_COLORS="true"
|
||||
|
||||
# Uncomment the following line to disable auto-setting terminal title.
|
||||
# DISABLE_AUTO_TITLE="true"
|
||||
|
||||
# Uncomment the following line to enable command auto-correction.
|
||||
# ENABLE_CORRECTION="true"
|
||||
|
||||
# Uncomment the following line to display red dots whilst waiting for completion.
|
||||
# You can also set it to another string to have that shown instead of the default red dots.
|
||||
# e.g. COMPLETION_WAITING_DOTS="%F{yellow}waiting...%f"
|
||||
# Caution: this setting can cause issues with multiline prompts in zsh < 5.7.1 (see #5765)
|
||||
COMPLETION_WAITING_DOTS="true"
|
||||
|
||||
# Uncomment the following line if you want to disable marking untracked files
|
||||
# under VCS as dirty. This makes repository status check for large repositories
|
||||
# much, much faster.
|
||||
# DISABLE_UNTRACKED_FILES_DIRTY="true"
|
||||
|
||||
# Uncomment the following line if you want to change the command execution time
|
||||
# stamp shown in the history command output.
|
||||
# You can set one of the optional three formats:
|
||||
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
|
||||
# or set a custom format using the strftime function format specifications,
|
||||
# see 'man strftime' for details.
|
||||
# HIST_STAMPS="mm/dd/yyyy"
|
||||
|
||||
# Would you like to use another custom folder than $ZSH/custom?
|
||||
# ZSH_CUSTOM=/path/to/new-custom-folder
|
||||
|
||||
# Which plugins would you like to load?
|
||||
# Standard plugins can be found in $ZSH/plugins/
|
||||
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
|
||||
# Example format: plugins=(rails git textmate ruby lighthouse)
|
||||
# Add wisely, as too many plugins slow down shell startup.
|
||||
plugins=(git)
|
||||
|
||||
source $ZSH/oh-my-zsh.sh
|
||||
|
||||
# User configuration
|
||||
|
||||
# export MANPATH="/usr/local/man:$MANPATH"
|
||||
|
||||
# You may need to manually set your language environment
|
||||
# export LANG=en_US.UTF-8
|
||||
|
||||
# Preferred editor for local and remote sessions
|
||||
# if [[ -n $SSH_CONNECTION ]]; then
|
||||
# export EDITOR='vim'
|
||||
# else
|
||||
# export EDITOR='mvim'
|
||||
# fi
|
||||
|
||||
# Compilation flags
|
||||
# export ARCHFLAGS="-arch x86_64"
|
||||
|
||||
# Set personal aliases, overriding those provided by oh-my-zsh libs,
|
||||
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
|
||||
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
|
||||
# For a full list of active aliases, run `alias`.
|
||||
#
|
||||
# Example aliases
|
||||
# alias zshconfig="mate ~/.zshrc"
|
||||
# alias ohmyzsh="mate ~/.oh-my-zsh"
|
||||
|
||||
|
||||
# Aliases
|
||||
alias ls="ls -F"
|
||||
export LC_CTYPE="en_US.UTF-8"
|
0
config/vimrc
Normal file
0
config/vimrc
Normal file
3
install-oh-my-zsh.sh
Executable file
3
install-oh-my-zsh.sh
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
wget --no-check-certificate https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh
|
Loading…
Reference in New Issue
Block a user