commit 098429d139364df152131f2e83f08e11fe9c7a14 parent 36c7549543aacc092b6584ffcb3ecb8fd24d7642 Author: finwo <finwo@pm.me> Date: Thu, 10 Jan 2019 15:28:32 +0100 Add alpine support in install script Diffstat:
| M | install.sh | | | 34 | ++++++++++++++++++++-------------- |
1 file changed, 20 insertions(+), 14 deletions(-)
diff --git a/install.sh b/install.sh @@ -12,22 +12,28 @@ echo " )v( DEP general-purpose" echo " \\_/ dependency manager" echo "==\"==" -# Check if curl is present -command -v curl &>/dev/null || { - - # Check if we can install it - command -v apt-get &>/dev/null || { - echo "cUrl is missing and we're not able to install it" >&2 - exit 1 - } - - echo "Installing cUrl" - apt-get install -y -qq curl || { - echo "Unable to install cUrl" - } - +function install { + case "$(command -v apt apt-get apk | head -1)" in + apt) + sudo apt install "$1" -y -qq + ;; + apt-get) + sudo apt-get install "$1" -y -qq + ;; + apk) + sudo apk add "$1" -y -qq + ;; + *) + echo "No supported package manager detected" + echo "Please install '$1' to run this script" + exit 1 + ;; + esac } +# Ensure our dependencies +command -v curl &>/dev/null || install curl + # Default install directory mkdir -p /usr/local/bin