@@ -49,9 +49,8 @@ RESET := $(shell tput -Txterm sgr0)
4949
5050# targets
5151.PHONY : all
52- all : ansible sanity-check git help homebrew just install xcode
52+ all : ansible ansible-galaxy sanity-check git help homebrew just install mpr update xcode
5353
54- # TODO: QA Linux (Debian/Ubuntu)
5554# * cf. `distrobox create --name i-use-arch-btw --image archlinux:latest && distrobox enter i-use-arch-btw`
5655# * || `distrobox create --name debby --image debian:stable && distrobox enter debby`
5756
@@ -67,78 +66,108 @@ sanity-check: ## output environment variables
6766 @echo " PIP: ${PIP} "
6867
6968xcode : # # install xcode command line tools
70- @echo " Installing Xcode command line tools... "
71- if [ " ${UNAME} " == " Darwin " ] && [ " ${XCODE} " -ne 1 ] ; then \
72- xcode-select --install; \
69+ if [ " ${UNAME} " = " Darwin " ] ; then \
70+ echo " Installing Xcode command line tools... " ; \
71+ [ " ${XCODE} " -ne 1 ] && xcode-select --install; \
7372 fi
7473
7574homebrew : # # install homebrew
76- @echo " Installing Homebrew... "
77- if [ " ${UNAME} " == " Darwin " ] && [ -z " ${BREW} " ] ; then \
75+ if [ " ${UNAME} " = " Darwin " ] && [ -z " ${BREW} " ] ; then \
76+ echo " Installing Homebrew... " ; \
7877 /bin/bash -c " $$ (curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" ; \
7978 fi
8079
80+ update : # # update package manager
81+ @echo " Updating package manager..."
82+ if [ " ${UNAME} " = " Darwin" ] && [ " $( command -v brew > /dev/null 2>&1 ; echo $? ) " -eq 0 ]; then \
83+ brew update; \
84+ elif [ " ${ID} " = " ubuntu" ]; then \
85+ sudo apt update; \
86+ elif [ " ${ID} " = " fedora" ]; then \
87+ sudo dnf update; \
88+ elif [ " ${ID} " = " arch" ]; then \
89+ yes | sudo pacman -Syu; \
90+ fi
91+
8192git : # # install git
8293 @echo " Installing Git..."
83- if [ " ${UNAME} " == " Darwin" ] && [ " $( command -v brew > /dev/null 2>&1 ; echo $? ) " -eq 0 ]; then \
94+ if [ " ${UNAME} " = " Darwin" ] && [ " $( command -v brew > /dev/null 2>&1 ; echo $? ) " -eq 0 ]; then \
8495 brew install git; \
85- elif [ " ${ID} " == " ubuntu" ]; then \
96+ elif [ " ${ID} " = " ubuntu" ]; then \
8697 sudo apt install -y git; \
87- elif [ " ${ID} " == " fedora" ]; then \
98+ elif [ " ${ID} " = " fedora" ]; then \
8899 sudo dnf install -y git; \
89- elif [ " ${ID} " == " arch" ]; then \
100+ elif [ " ${ID} " = " arch" ]; then \
90101 yes | sudo pacman -S git; \
91102 fi
92103
93104python : # # install python
94105 @echo " Installing Python..."
95- if [ " ${UNAME} " == " Darwin" ] && [ -z " ${PYTHON} " ]; then \
106+ if [ " ${UNAME} " = " Darwin" ] && [ -z " ${PYTHON} " ]; then \
96107 brew install python; \
97- elif [ " ${ID} " == " ubuntu" ]; then \
108+ elif [ " ${ID} " = " ubuntu" ]; then \
98109 sudo apt install -y python3; \
99- elif [ " ${ID} " == " fedora" ]; then \
110+ elif [ " ${ID} " = " fedora" ]; then \
100111 sudo dnf install -y python3; \
101- elif [ " ${ID} " == " arch" ]; then \
112+ elif [ " ${ID} " = " arch" ]; then \
102113 yes | sudo pacman -S python; \
103114 fi
104115
105116pip : python # # install pip
106117 @echo " Installing Pip..."
107- if [ " ${UNAME} " == " Darwin" ] && [ -z " ${PYTHON} )" ]; then \
118+ if [ " ${UNAME} " = " Darwin" ] && [ -z " ${PYTHON} )" ]; then \
108119 brew install python; \
109- elif [ " ${ID} " == " ubuntu" ] && [ -z " ${PIP} " ]; then \
120+ elif [ " ${ID} " = " ubuntu" ] && [ -z " ${PIP} " ]; then \
110121 sudo apt install -y python3-pip; \
111- elif [ " ${ID} " == " fedora" ] && [ -z " ${PIP} " ]; then \
122+ elif [ " ${ID} " = " fedora" ] && [ -z " ${PIP} " ]; then \
112123 sudo dnf install -y python3-pip; \
113- elif [ " ${ID} " == " arch" ] && [ -z " ${PIP} " ]; then \
124+ elif [ " ${ID} " = " arch" ] && [ -z " ${PIP} " ]; then \
114125 yes | sudo pacman -S python-pip; \
115126 fi \
116127
117128ansible : pip # # install ansible
118129 @echo " Installing Ansible..."
119- if [ " ${UNAME} " == " Darwin" ] && [ -z " ${ANSIBLE} " ] || [ -z " ${ANSIBLE_LINT} " ]; then \
130+ if [ " ${UNAME} " = " Darwin" ]; then \
120131 brew install ansible ansible-lint; \
121132 else \
122133 python3 -m pip install ansible ansible-lint; \
123134 sudo touch /var/log/ansible.log; \
124135 sudo chmod 666 /var/log/ansible.log; \
125136 fi
126137
127- just : # # install justfile
138+ ansible-galaxy : ansible git # # install ansible galaxy roles
139+ @echo " Installing Ansible Galaxy roles..."
140+ curl https://raw.githubusercontent.com/pythoninthegrass/framework/master/requirements.yml -o /tmp/requirements.yml; \
141+ if [ " ${UNAME} " = " Darwin" ]; then \
142+ ansible-galaxy install -r /tmp/requirements.yml; \
143+ elif [ " ${UNAME} " = " Linux" ]; then \
144+ ~ /.local/bin/ansible-galaxy install -r /tmp/requirements.yml; \
145+ fi
146+
147+ # TODO: "/usr/bin/sh: 3: [: =: unexpected operator" `ne` and `!=` operators don't work (╯°□°)╯︵ ┻━┻
148+ mpr : # # install the makedeb package repo (mpr) for prebuilt packages
149+ @echo " Installing the makedeb package repo (mpr)..."
150+ if [ " ${ID} " = " ubuntu" ]; then \
151+ [ $( command -v wget > /dev/null 2>&1 ; echo $? ) = 0 ] || sudo apt install -y wget; \
152+ 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; \
153+ 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; \
154+ fi ; \
155+
156+ just : mpr update# # install justfile
128157 @echo " Installing Justfile..."
129- if [ " ${UNAME} " == " Darwin" ]; then \
158+ if [ " ${UNAME} " = " Darwin" ]; then \
130159 brew install just; \
131- elif [ " ${ID} " == " ubuntu" ]; then \
160+ elif [ " ${ID} " = " ubuntu" ]; then \
132161 sudo apt install -y just; \
133- elif [ " ${ID} " == " fedora" ]; then \
162+ elif [ " ${ID} " = " fedora" ]; then \
134163 sudo dnf install -y just; \
135- elif [ " ${ID} " == " arch" ]; then \
164+ elif [ " ${ID} " = " arch" ]; then \
136165 yes | sudo pacman -S just; \
137166 fi
138167
139- install : sanity-check xcode homebrew git python pip ansible just # # install all dependencies
168+ install : sanity-check update xcode homebrew git python pip ansible ansible-galaxy mpr just # # install all dependencies
140169
141- help : # # Show this help.
170+ help : # # show this help
142171 @echo ' '
143172 @echo ' Usage:'
144173 @echo ' ${YELLOW}make${RESET} ${GREEN}<target>${RESET}'
0 commit comments