35 lines
762 B
Bash
Executable file
35 lines
762 B
Bash
Executable file
#!/bin/bash
|
|
|
|
function do_stow() {
|
|
local package="$1"
|
|
local opts=( "--dotfiles" "--dir" "${DOTFILES_DIR}" )
|
|
|
|
if [[ "$#" -ge 2 ]]; then
|
|
opts+=( "--target" "$2" )
|
|
fi
|
|
|
|
stow "${opts[@]}" "$package"
|
|
}
|
|
|
|
set -eo pipefail
|
|
|
|
DOTFILES_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)"
|
|
TARGET_DIR="${HOME}"
|
|
|
|
if ! command -v stow &> /dev/null; then
|
|
echo "[!] Stow is not installed!"
|
|
exit 1
|
|
fi
|
|
|
|
# Make sure directories exist.
|
|
mkdir -p "${TARGET_DIR}/.ssh"
|
|
mkdir -p "${TARGET_DIR}/.config"
|
|
|
|
# Install SSH separately, as it requres a different target.
|
|
do_stow ssh "${TARGET_DIR}/.ssh" || true
|
|
do_stow tmux || true
|
|
do_stow git || true
|
|
do_stow zsh || true
|
|
do_stow nvim "${TARGET_DIR}/.config" || true
|
|
|
|
echo "[+] Installed!"
|