From 5a992cccf5be5c7bbeb48855b43c0f7acb870e64 Mon Sep 17 00:00:00 2001 From: ashish-kus Date: Fri, 8 Sep 2023 16:36:59 +0530 Subject: [PATCH 1/4] added a make file for instalation and uninstalation --- Makefile | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..9c5baf8 --- /dev/null +++ b/Makefile @@ -0,0 +1,31 @@ +# Define the dependencies +DEPENDENCIES = chafa convert jq curl + +# Define the installation directories +INSTALL_DIR = /usr/local + +# Installation instructions +install: check_dependencies + @echo "Installing..." + sudo mkdir -pv $(INSTALL_DIR) + sudo cp -rv bin $(INSTALL_DIR) + sudo cp -rv share $(INSTALL_DIR) + @echo "Installation complete." + +# Uninstallation instructions +uninstall: + @echo "Uninstalling..." + sudo rm -rf $(INSTALL_DIR)/bin + sudo rm -rf $(INSTALL_DIR)/share + @echo "Uninstallation complete." + +# 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 + From 8dcf64d7117d36dba3b9caaa7ef0725e36616601 Mon Sep 17 00:00:00 2001 From: ashish-kus Date: Fri, 8 Sep 2023 19:27:23 +0530 Subject: [PATCH 2/4] updated make script --- Makefile | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 9c5baf8..acce699 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,7 @@ INSTALL_DIR = /usr/local # Installation instructions install: check_dependencies @echo "Installing..." + @echo "Installed " sudo mkdir -pv $(INSTALL_DIR) sudo cp -rv bin $(INSTALL_DIR) sudo cp -rv share $(INSTALL_DIR) @@ -15,8 +16,17 @@ install: check_dependencies # Uninstallation instructions uninstall: @echo "Uninstalling..." - sudo rm -rf $(INSTALL_DIR)/bin - sudo rm -rf $(INSTALL_DIR)/share + + @echo "Removing files" + sudo rm -rf $(INSTALL_DIR)/bin/pokeshell + @echo "Removing Complitions" + sudo rm -rf $(INSTALL_DIR)/share/bash-completion/completions/pokeshell + + @echo "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 "Uninstallation complete." # Target to check dependencies From f7575c895990858c8056b780edea20871611ec10 Mon Sep 17 00:00:00 2001 From: ashish-kus Date: Sat, 9 Sep 2023 10:45:20 +0530 Subject: [PATCH 3/4] make script updatet path variable after instalation and updated Readme --- Makefile | 3 +++ README.md | 15 +++++++++------ install.sh | 5 ----- uninstall.sh | 8 -------- 4 files changed, 12 insertions(+), 19 deletions(-) delete mode 100755 install.sh delete mode 100755 uninstall.sh diff --git a/Makefile b/Makefile index acce699..369be89 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,9 @@ install: check_dependencies sudo cp -rv bin $(INSTALL_DIR) sudo cp -rv share $(INSTALL_DIR) @echo "Installation complete." + @echo "updating your $PATH variable" + export PATH=$PATH:/usr/local/bin + @echo "DONE pokeshell is now installed" # Uninstallation instructions uninstall: diff --git a/README.md b/README.md index 75e7408..2b1454e 100644 --- a/README.md +++ b/README.md @@ -15,21 +15,21 @@ Key features include: ## Installation -You can install pokeshell system-wide with the `install.sh` script like so: +You can install pokeshell system-wide with the `make install` command like so: ```bash -sudo ./install.sh +make install ``` This will allow you to run `pokeshell` anywhere on your system as well as add shell completions. -An uninstall script is also provided: +An uninstalltion is also provided: ```bash -sudo ./uninstall.sh +make uninstall ``` If you do not want to install then you can still run pokeshell anywhere -by adding the following lines to your `~/.bashrc`. +by just colning the repo and adding the path to repo to your $PATH variable by adding the following lines to your `~/.bashrc`. ```bash export PATH=/path/to/pokeshell:$PATH @@ -38,7 +38,10 @@ export PATH=/path/to/pokeshell:$PATH ## Usage ```bash -pokeshell --help + +pokeshell -a random s:pikachu-gmax" + +for more options $ pokeshell --help ``` or if running from this directory: diff --git a/install.sh b/install.sh deleted file mode 100755 index e775cce..0000000 --- a/install.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env sh - -mkdir -pv /usr/local -cp -rv bin /usr/local -cp -rv share /usr/local diff --git a/uninstall.sh b/uninstall.sh deleted file mode 100755 index e6507a3..0000000 --- a/uninstall.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env sh - -rm -v /usr/local/bin/pokeshell -rm -v /usr/local/share/bash-completion/completions/pokeshell - -rmdir -v /usr/local/bin -rmdir -v /usr/local/share/bash-completion/completions -rmdir -v /usr/local/share/bash-completion From c8b85c78be6dedca70106472375ad278930cf26b Mon Sep 17 00:00:00 2001 From: ashish-kus Date: Sat, 9 Sep 2023 11:01:08 +0530 Subject: [PATCH 4/4] updated makefile --- Makefile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 369be89..d0a0770 100644 --- a/Makefile +++ b/Makefile @@ -6,15 +6,15 @@ INSTALL_DIR = /usr/local # Installation instructions install: check_dependencies - @echo "Installing..." - @echo "Installed " + @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" - export PATH=$PATH:/usr/local/bin - @echo "DONE pokeshell is now installed" + + @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: @@ -25,12 +25,12 @@ uninstall: @echo "Removing Complitions" sudo rm -rf $(INSTALL_DIR)/share/bash-completion/completions/pokeshell - @echo "Removing directories" + @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 "Uninstallation complete." + @echo -e "\033[1;31m pokeshell uninstalled \033[1;32m OK \033[0m" # Target to check dependencies check_dependencies: