Skip to content

Commit

Permalink
Generalize package manager support to include DNF
Browse files Browse the repository at this point in the history
  • Loading branch information
randomoracle committed Sep 7, 2024
1 parent 8538b36 commit 132c606
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions scripts/setup.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
set -euo pipefail

# This script is used to setup the project, install erlang, elixir, and mix dependencies.
Expand All @@ -15,12 +15,27 @@ function install_asdf_deps() {
# Linux
Linux*)
echo "Setting up project for Linux"
sudo apt install curl git -y
# TODO: what if they don't use apt or don't have sudo?

# Currently supporting APT & DNF only.
for candidate in apt-get dnf
do
if [ -x "$(command -v ${candidate})" ]
then
package_manager=$candidate
fi
done

if [ -z "${package_manager+X}" ]
then
>&2 echo "Unknown package manager."
exit +1
fi

sudo "${package_manager}" install -y curl git automake autoconf libncurses-dev
;;
*)
echo "Unsupported OS: $(uname -s)"
exit 1
>&2 echo "Unsupported OS: $(uname -s)"
exit +2
;;
esac
}
Expand Down

0 comments on commit 132c606

Please sign in to comment.