@@ -44,6 +44,14 @@ ifeq ($(shell command -v ansible-lint >/dev/null 2>&1; echo $$?), 0)
4444 export ANSIBLE_LINT := $(shell which ansible-lint)
4545endif
4646
47+ ifeq ($(shell command -v just >/dev/null 2>&1; echo $$? ) , 0)
48+ export JUST := $(shell which just)
49+ endif
50+
51+ ifeq ($(shell command -v wget >/dev/null 2>&1; echo $$? ) , 0)
52+ export WGET := $(shell which wget)
53+ endif
54+
4755ifneq (,$(wildcard /etc/os-release) )
4856 include /etc/os-release
4957endif
@@ -74,15 +82,23 @@ sanity-check: ## output environment variables
7482 @echo " PIP: ${PIP} "
7583
7684xcode : # # install xcode command line tools
77- if [ " ${UNAME} " = " Darwin" ]; then \
85+ if [ " ${UNAME} " = " Darwin" ] && [ " ${XCODE} " -ne 1 ] ; then \
7886 echo " Installing Xcode command line tools..." ; \
79- [ " ${XCODE} " -ne 1 ] && xcode-select --install; \
87+ xcode-select --install; \
88+ elif [ " ${UNAME} " = " Darwin" ] && [ " ${XCODE} " -eq 1 ]; then \
89+ echo " xcode already installed." ; \
90+ else \
91+ echo " xcode not available on macOS." ; \
8092 fi
8193
8294homebrew : # # install homebrew
8395 if [ " ${UNAME} " = " Darwin" ] && [ -z " ${BREW} " ]; then \
8496 echo " Installing Homebrew..." ; \
8597 /bin/bash -c " $$ (curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" ; \
98+ elif [ " ${UNAME} " = " Darwin" ] && [ ! -z " ${BREW} " ]; then \
99+ echo " Homebrew already installed." ; \
100+ else \
101+ echo " brew not available on macOS." ; \
86102 fi
87103
88104update : # # update package manager
@@ -107,6 +123,8 @@ git: ## install git
107123 sudo dnf install -y git; \
108124 elif [ " ${ID} " = " arch" ]; then \
109125 yes | sudo pacman -S git; \
126+ else \
127+ echo " git already installed." ; \
110128 fi
111129
112130python : # # install python
@@ -119,6 +137,8 @@ python: ## install python
119137 sudo dnf install -y python3; \
120138 elif [ " ${ID} " = " arch" ]; then \
121139 yes | sudo pacman -S python; \
140+ else \
141+ echo " python already installed." ; \
122142 fi
123143
124144pip : python # # install pip
@@ -131,7 +151,9 @@ pip: python ## install pip
131151 sudo dnf install -y python3-pip; \
132152 elif [ " ${ID} " = " arch" ] && [ -z " ${PIP} " ]; then \
133153 yes | sudo pacman -S python-pip; \
134- fi \
154+ else \
155+ echo " pip already installed." ; \
156+ fi
135157
136158ansible : pip # # install ansible
137159 if [ -z ${ANSIBLE} ]; then \
@@ -142,8 +164,10 @@ ansible: pip ## install ansible
142164 python3 -m pip install ansible ansible-lint; \
143165 sudo touch /var/log/ansible.log; \
144166 sudo chmod 666 /var/log/ansible.log; \
145- fi
146- fi ; \
167+ fi ; \
168+ else \
169+ echo " ansible already installed." ; \
170+ fi
147171
148172ansible-galaxy : ansible git # # install ansible galaxy roles
149173 @echo " Installing Ansible Galaxy roles..."
@@ -159,25 +183,30 @@ ansible-galaxy: ansible git ## install ansible galaxy roles
159183 " ${ANSIBLE_GALAXY} " install -r /tmp/requirements.yml; \
160184 fi
161185
162- # TODO: "/usr/bin/sh: 3: [: =: unexpected operator" `ne` and `!=` operators don't work (╯°□°)╯︵ ┻━┻
163186mpr : # # install the makedeb package repo (mpr) for prebuilt packages
164187 @echo " Installing the makedeb package repo (mpr)..."
165188 if [ " ${ID} " = " ubuntu" ]; then \
166- [ $( command -v wget > /dev/null 2>&1 ; echo $? ) = 0 ] || sudo apt install -y wget; \
189+ [ -z " ${WGET} " ] || sudo apt install -y wget; \
167190 wget -qO - ' https://proget.makedeb.org/debian-feeds/prebuilt-mpr.pub' | gpg --dearmor | sudo tee /usr/share/keyrings/prebuilt-mpr-archive-keyring.gpg 1> /dev/null; \
168191 echo " deb [arch=amd64 signed-by=/usr/share/keyrings/prebuilt-mpr-archive-keyring.gpg] https://proget.makedeb.org prebuilt-mpr $( lsb_release -cs) " | sudo tee /etc/apt/sources.list.d/prebuilt-mpr.list; \
169- fi ; \
192+ else \
193+ echo " mpr not available on ${UNAME} ." ; \
194+ fi
170195
171196just : mpr update# # install justfile
172- @echo " Installing Justfile..."
173- if [ " ${UNAME} " = " Darwin" ]; then \
174- brew install just; \
175- elif [ " ${ID} " = " ubuntu" ]; then \
176- sudo apt install -y just; \
177- elif [ " ${ID} " = " fedora" ]; then \
178- sudo dnf install -y just; \
179- elif [ " ${ID} " = " arch" ]; then \
180- yes | sudo pacman -S just; \
197+ if [ -z " ${WGET} " ] && [ -z " ${JUST} " ]; then \
198+ echo " Installing Justfile..." ; \
199+ if [ " ${UNAME} " = " Darwin" ]; then \
200+ brew install just; \
201+ elif [ " ${ID} " = " ubuntu" ]; then \
202+ sudo apt install -y just; \
203+ elif [ " ${ID} " = " fedora" ]; then \
204+ sudo dnf install -y just; \
205+ elif [ " ${ID} " = " arch" ]; then \
206+ yes | sudo pacman -S just; \
207+ fi ; \
208+ else \
209+ echo " just already installed." ; \
181210 fi
182211
183212install : sanity-check update xcode homebrew git python pip ansible ansible-galaxy mpr just # # install all dependencies
0 commit comments