Skip to content

Commit

Permalink
Merge pull request containers#622 from containers/install-ostree
Browse files Browse the repository at this point in the history
Avoid dnf install on OSTree system
  • Loading branch information
rhatdan authored Jan 24, 2025
2 parents b5137ce + 7d8cc5a commit 484457b
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,29 @@ download() {
echo "Downloaded $bn"
}

dnf_install() {
if ! available podman; then
$sudo dnf install -y --best podman || true
fi
}

apt_get_install() {
apt-get -qq -y install "$1"
}

apt_install() {
if ! available podman; then
$sudo apt-get update -qq || true

# only install docker if podman can't be
if ! $sudo apt_get_install podman; then
if ! available docker; then
$sudo apt_get_install docker || true
fi
fi
fi
}

check_platform() {
if [ "$os" = "Darwin" ]; then
if [ "$EUID" -eq 0 ]; then
Expand All @@ -49,11 +68,10 @@ check_platform() {
sudo="sudo"
fi

if available dnf; then
$sudo dnf install -y --best podman || true
if available dnf && ! grep -q ostree= /proc/cmdline; then
dnf_install
elif available apt-get; then
$sudo apt-get update -qq || true
$sudo apt_get_install podman || $sudo apt_get_install docker || true
apt_install
fi
else
echo "This script is intended to run on Linux and macOS only"
Expand Down

0 comments on commit 484457b

Please sign in to comment.