2023-01-10 08:06:54 +00:00
|
|
|
#! /usr/bin/env sh
|
|
|
|
# Install various dotfiles into their proper places
|
|
|
|
|
2023-01-12 11:55:57 +00:00
|
|
|
create_symlink () {
|
2023-01-12 14:25:46 +00:00
|
|
|
FILENAME="$(basename $2)"
|
2023-01-12 11:55:57 +00:00
|
|
|
if [ ! -e "$1/$FILENAME" ]
|
|
|
|
then
|
|
|
|
ln -s $(readlink -f "$2") "$1/$FILENAME"
|
|
|
|
echo "$(readlink -f $2) -> $1/$FILENAME"
|
|
|
|
else
|
|
|
|
echo "$1/$FILENAME already exists"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
git_clone_if_missing () {
|
2023-01-13 10:25:07 +00:00
|
|
|
if [ ! -d "$2" ]
|
2023-01-12 11:55:57 +00:00
|
|
|
then
|
2023-01-13 10:25:07 +00:00
|
|
|
git clone --depth 1 "$1" "$2"
|
2023-01-12 11:55:57 +00:00
|
|
|
else
|
2023-01-18 10:15:19 +00:00
|
|
|
echo "$1 already checked out: $2"
|
2023-01-12 11:55:57 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2023-01-10 08:06:54 +00:00
|
|
|
# .config files
|
|
|
|
CONFIG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}"
|
|
|
|
|
2023-01-12 14:25:46 +00:00
|
|
|
mkdir -p "$CONFIG_DIR"
|
|
|
|
for FILE in config/*
|
|
|
|
do
|
2023-01-13 10:25:07 +00:00
|
|
|
create_symlink "$CONFIG_DIR" "$FILE"
|
2023-01-10 08:06:54 +00:00
|
|
|
done
|
2023-01-10 10:30:42 +00:00
|
|
|
|
2023-01-12 14:25:46 +00:00
|
|
|
mkdir -p "$CONFIG_DIR/systemd/user"
|
|
|
|
for FILE in systemd/*
|
|
|
|
do
|
2023-01-13 10:25:07 +00:00
|
|
|
create_symlink "$CONFIG_DIR/systemd/user" "$FILE"
|
2023-01-12 14:25:46 +00:00
|
|
|
done
|
|
|
|
|
2023-01-12 15:27:06 +00:00
|
|
|
# SSH sockets
|
|
|
|
mkdir -p "$HOME/.ssh/sockets"
|
2023-01-16 11:14:42 +00:00
|
|
|
[ ! -e "$HOME/.ssh/config" ] && cp templates/ssh-config "$HOME/.ssh/config"
|
2023-01-12 11:55:57 +00:00
|
|
|
|
2023-01-12 09:01:23 +00:00
|
|
|
# nvim setup - install Packer
|
2023-01-12 11:55:57 +00:00
|
|
|
PACKER_REPO="https://github.com/wbthomason/packer.nvim"
|
2023-01-12 09:01:23 +00:00
|
|
|
PACKER_DIR="$HOME/.local/share/nvim/site/pack/packer/start/packer.nvim"
|
2023-01-13 10:25:07 +00:00
|
|
|
git_clone_if_missing "$PACKER_REPO" "$PACKER_DIR"
|
2023-01-12 11:55:57 +00:00
|
|
|
|
2023-01-13 09:56:36 +00:00
|
|
|
# oh-my-zsh
|
2023-01-18 10:15:19 +00:00
|
|
|
if [ ! -d "$ZSH" ]
|
|
|
|
then
|
|
|
|
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
|
|
|
|
else
|
|
|
|
echo "oh-my-zsh already installed: $ZSH"
|
|
|
|
fi
|
2023-01-12 11:55:57 +00:00
|
|
|
OHMYZSH_DIR="${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}"
|
2023-01-13 10:25:07 +00:00
|
|
|
if [ -d "$OHMYZSH_DIR" ]
|
2023-01-12 11:55:57 +00:00
|
|
|
then
|
|
|
|
# Powerlevel10k theme
|
|
|
|
POWERLEVEL_REPO="https://github.com/romkatv/powerlevel10k.git"
|
|
|
|
POWERLEVEL_DIR="$OHMYZSH_DIR/themes/powerlevel10k"
|
2023-01-13 10:25:07 +00:00
|
|
|
git_clone_if_missing "$POWERLEVEL_REPO" "$POWERLEVEL_DIR"
|
2023-01-12 11:55:57 +00:00
|
|
|
# aliases
|
2023-01-13 10:25:07 +00:00
|
|
|
create_symlink "$OHMYZSH_DIR" "./aliases.zsh"
|
|
|
|
create_symlink "$OHMYZSH_DIR" "./completions.zsh"
|
2023-01-12 09:01:23 +00:00
|
|
|
fi
|
2023-01-13 09:56:36 +00:00
|
|
|
|
|
|
|
# Set up git editor if missing
|
|
|
|
grep "editor" "$HOME/.gitconfig" > /dev/null || git config --global core.editor "nvim"
|
2023-01-13 10:25:07 +00:00
|
|
|
|
|
|
|
# Add NerdFont symbols
|
2023-01-16 11:14:42 +00:00
|
|
|
mkdir -p "$HOME/.local/share/fonts"
|
|
|
|
for FILE in nerdfont_symbols/*
|
|
|
|
do
|
|
|
|
create_symlink "$HOME/.local/share/fonts" "$FILE"
|
|
|
|
done
|
2023-01-13 10:39:37 +00:00
|
|
|
|
|
|
|
# Ensure nvim plugins
|
2023-01-16 11:14:42 +00:00
|
|
|
mkdir -p "$HOME/.local/bin"
|
|
|
|
for FILE in bin/*
|
|
|
|
do
|
|
|
|
which -a "$(basename $FILE)" > /dev/null || create_symlink "$HOME/.local/bin" "$FILE"
|
|
|
|
done
|