scripts/deps.sh: Use os-release(5) to select correct package manager

Fedora has apt packaged, which causes this script to do the wrong
thing if it is installed. Instead of checking for the package manager
binary, use os-release(5) data to select the correct package manager
to use.
This commit is contained in:
Neal Gompa
2021-02-22 00:17:28 -05:00
committed by Jeremy Soller
parent 09e2a550ea
commit 7a7bc80b8f

View File

@@ -8,8 +8,10 @@ function msg {
trap 'msg "\x1B[31mFailed to install dependencies!"' ERR trap 'msg "\x1B[31mFailed to install dependencies!"' ERR
if which apt-get > /dev/null source /etc/os-release
then
if [[ "${ID}" =~ "debian" ]] || [[ "${ID_LIKE}" =~ "debian" ]]; then
msg "Installing system build dependencies" msg "Installing system build dependencies"
sudo apt-get install \ sudo apt-get install \
avr-libc \ avr-libc \
@@ -36,7 +38,7 @@ then
sdcc \ sdcc \
uuid-dev \ uuid-dev \
zlib1g-dev zlib1g-dev
elif which dnf > /dev/null elif [[ "${ID}" =~ "fedora" ]] || [[ "${ID_LIKE}" =~ "fedora" ]]; then
then then
msg "Installing system build dependencies" msg "Installing system build dependencies"
sudo dnf group install c-development sudo dnf group install c-development