From 5f6f0e8719e2448363bf94915571dbe415cc0930 Mon Sep 17 00:00:00 2001 From: "ron.record" Date: Mon, 10 Jun 2024 14:30:30 -0700 Subject: [PATCH] Install figlet with Homebrew on macOS --- etc/install-figlet | 43 ++++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/etc/install-figlet b/etc/install-figlet index da0f454..13cf814 100755 --- a/etc/install-figlet +++ b/etc/install-figlet @@ -13,24 +13,33 @@ export PATH have_figlet=$(type -p figlet) [ "${have_figlet}" ] || { - have_make=$(type -p make) - if [ "${have_make}" ]; then - printf "\nInstalling figlet\n" - uid=$(id -u) - SUDO="sudo" - if [ "${EUID}" ]; then - [ ${EUID} -eq 0 ] && SUDO= + darwin= + platform=$(uname -s) + [ "${platform}" == "Darwin" ] && darwin=1 + have_brew=$(type -p brew) + if [ "${have_brew}" ] && [ "${darwin}" ]; then + printf "\nInstalling figlet with Homebrew\n" + brew install figlet >/dev/null 2>&1 + else + have_make=$(type -p make) + if [ "${have_make}" ]; then + printf "\nInstalling figlet\n" + uid=$(id -u) + SUDO="sudo" + if [ "${EUID}" ]; then + [ ${EUID} -eq 0 ] && SUDO= + else + [ ${uid} -eq 0 ] && SUDO= + fi + HERE=$(pwd) + git clone https://github.com/cmatsuoka/figlet /tmp/figlet$$ > /dev/null 2>&1 + cd /tmp/figlet$$ + ${SUDO} make install > /dev/null 2>&1 + cd "${HERE}" + ${SUDO} rm -rf /tmp/figlet$$ else - [ ${uid} -eq 0 ] && SUDO= + printf "\nInstallation of figlet requires 'make' but 'make' not found." + printf "\nInstall 'make' and try again. Skipping installation of figlet.\n" fi - HERE=$(pwd) - git clone https://github.com/cmatsuoka/figlet /tmp/figlet$$ > /dev/null 2>&1 - cd /tmp/figlet$$ - ${SUDO} make install > /dev/null 2>&1 - cd "${HERE}" - ${SUDO} rm -rf /tmp/figlet$$ - else - printf "\nInstallation of figlet requires 'make' but 'make' not found." - printf "\nInstall 'make' and try again. Skipping installation of figlet.\n" fi }