Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qol(bifrost): ensure build-essential and libssl-dev are installed on linux machines #510

Merged
merged 1 commit into from
Oct 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions bifrost/bifrost
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env bash
#!/bin/bash

set -e

BIFROST_PATH=${BIFROST_PATH:-"$HOME/.bifrost"}
Expand All @@ -9,6 +11,8 @@ main() {
requires_cmd git
requires_cmd curl
requires_cmd cargo
ensure_apt_package "libssl-dev"
ensure_apt_package "build-essential"

# parsing parameters
while [[ $1 ]]; do
Expand Down Expand Up @@ -202,6 +206,22 @@ ensure() {
if ! "$@"; then echo "bifrost: required command '$*' failed."; exit 1; fi
}

# ensure an apt package is installed
ensure_apt_package() {
# if we are not on a linux system, return success
if [[ "$OSTYPE" != "linux-gnu"* ]]; then
return
fi

# if the package is not installed, install it
if ! dpkg -l | grep -q $1; then
echo "bifrost: installing $1."
ensure sudo apt-get install -y $1
else
echo "bifrost: $1 is already installed."
fi
}

# command_exists checks if a command exists
command_exists() {
command -v "$1" > /dev/null 2>&1
Expand Down
Loading