Skip to content

Commit

Permalink
Install pkg-config and cc when missing (#207)
Browse files Browse the repository at this point in the history
  • Loading branch information
ia0 authored Aug 21, 2023
1 parent 7aa7bfd commit 1998535
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions scripts/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ if ! has_bin rustup; then
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
fi

apt_install() {
has_bin apt-get || e "Unsupported system. Install:$MISSING"
x sudo apt-get install "$@"
}

has_bin pkg-config || apt_install pkgconf

MISSING=
add_missing() {
MISSING="$MISSING $1"
Expand All @@ -34,11 +41,9 @@ has_pkg() {
pkg-config --exists $1
}

has_bin cc || add_missing build-essential
has_bin usbip || add_missing usbip
has_pkg libudev || add_missing libudev-dev
has_pkg libusb-1.0 || add_missing libusb-1.0-0-dev
has_bin usbip || add_missing usbip

if [ -n "$MISSING" ]; then
has_bin apt-get || e "Unsupported system. Install:$MISSING"
x sudo apt-get install$MISSING
fi
[ -z "$MISSING" ] || apt_install$MISSING

0 comments on commit 1998535

Please sign in to comment.