From 4a4c7b9071931a49ab854286acde4ba29da42c98 Mon Sep 17 00:00:00 2001 From: Junya Okabe Date: Mon, 19 Aug 2024 15:53:38 +0900 Subject: [PATCH] feat: add some scripts --- .zsh/dependency-check.zsh | 46 +++++++++++++++++++++++++++++++++++++++ Makefile | 26 ++++++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100755 .zsh/dependency-check.zsh create mode 100644 Makefile diff --git a/.zsh/dependency-check.zsh b/.zsh/dependency-check.zsh new file mode 100755 index 0000000..657d13f --- /dev/null +++ b/.zsh/dependency-check.zsh @@ -0,0 +1,46 @@ +#!/usr/bin/env zsh + +set -euo pipefail + +function check_homebrew() { + if [ ! -d "/opt/homebrew" ]; then + echo "Homebrew is not installed!" + echo "Please install Homebrew first!" + exit 1 + else + sleep 1 + echo "Homebrew is already installed!" + fi +} + +function check_lsd() { + if ! command -v lsd 1>/dev/null 2>&1; then + echo "lsd is not installed!" + echo "Please install lsd first!" + exit 1 + else + sleep 1 + echo "lsd is already installed!" + fi +} + +function check_oh_my_zsh() { + if [ ! -d "$HOME/.oh-my-zsh" ]; then + echo "Oh My Zsh is not installed!" + echo "Please install Oh My Zsh first!" + exit 1 + else + sleep 1 + echo "Oh My Zsh is already installed!" + fi +} + +function main() { + check_homebrew + check_lsd + check_oh_my_zsh + + echo "All dependencies are installed!" +} + +main diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..7462bda --- /dev/null +++ b/Makefile @@ -0,0 +1,26 @@ +DEFAULT: install-all + +.PHONY: install-all +install-all: + @echo "Installing all dependencies and Setting up" + ./install.zsh + +.PHONY: symlink +symlink: + @echo "Setting up symlinks" + ./install/symlink.zsh + +.PHONY: dependency-check +dependency-check: + @echo "Checking dependencies" + ./.zsh/dependency-check.zsh + +.PHONY: help +help: + @echo "Usage: make [target]" + @echo "" + @echo "Targets:" + @echo " install-all: Install all dependencies and setup" + @echo " symlink: Create symlinks" + @echo " dependency-check: Check dependencies" + @echo " help: Show this help message"