diff --git a/deps.md b/deps.md new file mode 100644 index 0000000..f465f57 --- /dev/null +++ b/deps.md @@ -0,0 +1,3 @@ +# Dependencies required for installer + +- git diff --git a/install.bash b/install.bash new file mode 100644 index 0000000..2f85558 --- /dev/null +++ b/install.bash @@ -0,0 +1,41 @@ +#!/usr/bin/env bash +set -eo pipefail + +DEPS_PATH="${HOME}/.deps" + +install-fzf() { + local install_path="${1}/fzf" + git clone --depth 1 https://github.com/junegunn/fzf.git "${install_path}" + "${install_path}/install" \ + --key-bindings \ + --completion \ + --no-update-rc \ + --xdg +} + +check-script-deps() { + commands_to_check=( + git + ) + for cmd in "${commands_to_check[@]}"; do + if ! command -v "${cmd}"; then + printf "Could not find command: \"%s\"!\n" "${cmd}" >&2 + return 1 + fi + done +} + +main() { + printf "Creating dependencies directory as \"%s\"\n" "${DEPS_PATH}" >&2 + mkdir -p "${DEPS_PATH}" + + printf "Checking script dependencies...\n" >&2 + if ! check-script-deps; then + printf \ + "Script dependencies failed, install missing dependencies and try again\n" \ + >&2 + fi + + printf "Installing FZF\n" >&2 + install-fzf "${DEPS_PATH}" +}