From 8853a0f85ade8b1dc45a462e64e253b9c3d98b9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Roberto=20S=C3=A1nchez?= Date: Fri, 4 Nov 2022 02:46:43 -0600 Subject: [PATCH] Added CheckEnv for package manager. Tar and neovim are needed. --- .bashrc | 9 ++++++++- setup.sh | 14 +++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/.bashrc b/.bashrc index 4a23f35..3489375 100644 --- a/.bashrc +++ b/.bashrc @@ -601,4 +601,11 @@ eval "$(starship init bash)" #Autojump -. /usr/share/autojump/autojump.sh +if [ -f "/usr/share/autojump/autojump.sh" ]; then + . /usr/share/autojump/autojump.sh +elif [ -f "/usr/share/autojump/autojump.bash" ]; then + . /usr/share/autojump/autojump.bash +else + echo "can't found the autojump script" +fi + diff --git a/setup.sh b/setup.sh index 5a5c81a..94fbe90 100755 --- a/setup.sh +++ b/setup.sh @@ -14,7 +14,7 @@ checkEnv(){ fi ## Check for requirements. - REQUIREMENTS='curl apt groups sudo' + REQUIREMENTS='curl groups sudo' if ! which ${REQUIREMENTS}>/dev/null;then echo -e "${RED}To run me, you need: ${REQUIREMENTS}${RC}" exit 1 @@ -25,20 +25,24 @@ checkEnv(){ echo -e "${RED}You need to be a member of the sudo group to run me!" exit 1 fi + + if [[ ! -x "/usr/bin/apt-get" ]] || [[ ! -x "/usr/bin/yum" ]]; then + echo -e "Can't find a supported package manager" + exit 1 + fi + } installDepend(){ ## Check for dependencies. - DEPENDENCIES='autojump bash bash-completion' + DEPENDENCIES='autojump bash bash-completion tar neovim' echo -e "${YELLOW}Installing dependencies...${RC}" if [[ -x "/usr/bin/apt-get" ]]; then sudo dpkg --configure -a sudo apt-get install -fyq ${DEPENDENCIES} sudo dpkg --configure -a elif [[ -x "/usr/bin/yum" ]]; then - sudo yum install -fyq ${DEPENDENCIES} - else - echo "Can't check the package manager to use" + sudo yum install -yq ${DEPENDENCIES} fi }