pokeshell icon indicating copy to clipboard operation
pokeshell copied to clipboard

Streamlining Setup: Introducing a Makefile for Effortless Dependency Management and Installation

Open ashish-kus opened this issue 1 year ago • 0 comments

Wanted to contribute to this awesome project. I've replaced the install and uninstall scripts with a MAKEFILE to handle dependency checks and installations, ensuring a smoother user experience and for better management. I've made some updates to the README to reflect the changes I've introduced.

Installation: make install Uninstallation: make uninstall

Please review and share your thoughts. Thanks!

# Define the dependencies
DEPENDENCIES = chafa convert jq curl

# Define the installation directories
INSTALL_DIR = /usr/local

# Installation instructions
install: check_dependencies
	@echo "\033[1;32m Installing... \033[0m"
	sudo mkdir -pv $(INSTALL_DIR)
	sudo cp -rv bin $(INSTALL_DIR)
	sudo cp -rv share $(INSTALL_DIR)
	@echo "Installation complete."
	@echo "updating your $PATH variable"

	@echo -e "\033[1;32m DONE \033[0m pokeshell is now installed"
	@echo -e "\033[1;32m RELOAD YOUR SHELL BEFORE USING POKESHELL \033[0m"

# Uninstallation instructions
uninstall:
	@echo "Uninstalling..."

	@echo "Removing files"	 
	sudo rm -rf $(INSTALL_DIR)/bin/pokeshell
	@echo "Removing Complitions"
	sudo rm -rf $(INSTALL_DIR)/share/bash-completion/completions/pokeshell

	@echo -e "Removing directories "
	sudo rmdir -v $(INSTALL_DIR)/bin
	sudo rmdir -v $(INSTALL_DIR)/share/bash-completion/completions
	sudo rmdir -v $(INSTALL_DIR)/share/bash-completion

	@echo -e "\033[1;31m pokeshell uninstalled \033[1;32m OK \033[0m"

# Target to check dependencies
check_dependencies:
	@echo "Checking dependencies..."
	@for dep in $(DEPENDENCIES); do \
		command -v $$dep >/dev/null 2>&1 || { echo "$$dep is required but not installed. Aborting."; exit 1; }; \
	done


.PHONY: install uninstall check_dependencies

ashish-kus avatar Sep 09 '23 05:09 ashish-kus