Skip to content

Commit

Permalink
init: add mesa and vulkan drivers by default
Browse files Browse the repository at this point in the history
Following what containers/toolbox did here:
containers/toolbox@a87fd19

It's a great idea to present an even more useable system to the users
So let's implement it too

Signed-off-by: Luca Di Maio <[email protected]>
  • Loading branch information
89luca89 committed Sep 16, 2022
1 parent 1ad3204 commit 631a296
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions distrobox-init
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,12 @@ if [ "${upgrade}" -ne 0 ] || ! command -v find || ! command -v mount || ! comman
util-linux \
wget \
vte3
# These are graphics drivers for 3d applications
# shellcheck disable=SC2046
apk add \
$(apk search -q mesa-dri) \
$(apk search -q mesa-vulkan) \
vulkan-loader

elif command -v apt-get; then
# If we need to upgrade, do it and exit, no further action required.
Expand Down Expand Up @@ -317,6 +323,17 @@ if [ "${upgrade}" -ne 0 ] || ! command -v find || ! command -v mount || ! comman
wget \
util-linux

# These are graphics drivers for 3d applications
apt-get install -y \
libegl1-mesa \
libgl1-mesa-glx
# Older versions of debian/ubuntu don't have vulkan, check for it.
if apt-cache show libvulkan1 > /dev/null; then
apt-get install -y \
libvulkan1 \
mesa-vulkan-drivers
fi

elif command -v dnf; then
# If we need to upgrade, do it and exit, no further action required.
if [ "${upgrade}" -ne 0 ]; then
Expand Down Expand Up @@ -356,6 +373,14 @@ if [ "${upgrade}" -ne 0 ] || ! command -v find || ! command -v mount || ! comman
wget \
vte-profile

# These are graphics drivers for 3d applications
if dnf list mesa-dri-drivers > /dev/null; then
dnf install -y \
mesa-dri-drivers \
mesa-vulkan-drivers \
vulkan
fi

elif command -v emerge; then
# Check if shell_pkg is available in distro's repo. If not we
# fall back to bash, and we set the SHELL variable to bash so
Expand Down Expand Up @@ -412,6 +437,14 @@ if [ "${upgrade}" -ne 0 ] || ! command -v find || ! command -v mount || ! comman
vte-profile \
util-linux

# These are graphics drivers for 3d applications
# On these very minimal images, graphics can be abstent
# from the repos, so let's ignore the error in this case.
microdnf install -y \
mesa-dri-drivers \
mesa-vulkan-drivers \
vulkan || :

elif command -v pacman; then
# If we need to upgrade, do it and exit, no further action required.
if [ "${upgrade}" -ne 0 ]; then
Expand Down Expand Up @@ -451,6 +484,13 @@ if [ "${upgrade}" -ne 0 ] || ! command -v find || ! command -v mount || ! comman
wget \
vte-common

# These are graphics drivers for 3d applications
pacman -Sy --noconfirm \
mesa \
opengl-driver \
vulkan-intel \
vulkan-radeon

elif command -v slackpkg; then
# If we need to upgrade, do it and exit, no further action required.
if [ "${upgrade}" -ne 0 ]; then
Expand Down Expand Up @@ -484,6 +524,10 @@ if [ "${upgrade}" -ne 0 ] || ! command -v find || ! command -v mount || ! comman
wget \
util-linux

# These are graphics drivers for 3d applications
yes | slackpkg install -default_answer=yes -batch=yes \
mesa

elif command -v swupd; then
# If we need to upgrade, do it and exit, no further action required.
if [ "${upgrade}" -ne 0 ]; then
Expand All @@ -501,6 +545,11 @@ if [ "${upgrade}" -ne 0 ] || ! command -v find || ! command -v mount || ! comman
sysadmin-basic \
wget

# These are graphics drivers for 3d applications
swupd bundle-add \
lib-opengl \
devpkg-Vulkan-Loader

elif command -v xbps-install; then
# If we need to upgrade, do it and exit, no further action required.
if [ "${upgrade}" -ne 0 ]; then
Expand Down Expand Up @@ -533,6 +582,9 @@ if [ "${upgrade}" -ne 0 ] || ! command -v find || ! command -v mount || ! comman
wget \
util-linux

# These are graphics drivers for 3d applications
xbps-install -Sy mesa-dri

elif command -v yum; then
# If we need to upgrade, do it and exit, no further action required.
if [ "${upgrade}" -ne 0 ]; then
Expand Down Expand Up @@ -571,6 +623,13 @@ if [ "${upgrade}" -ne 0 ] || ! command -v find || ! command -v mount || ! comman
wget \
vte-profile

# These are graphics drivers for 3d applications
# yum distros are too old to have vulkan anyway.
if yum list mesa-dri-drivers > /dev/null; then
yum install -y \
mesa-dri-drivers
fi

elif command -v zypper; then
# If we need to upgrade, do it and exit, no further action required.
if [ "${upgrade}" -ne 0 ]; then
Expand Down Expand Up @@ -600,6 +659,14 @@ if [ "${upgrade}" -ne 0 ] || ! command -v find || ! command -v mount || ! comman
time \
wget \
util-linux

# These are graphics drivers for 3d applications
zypper install -y \
Mesa-dri \
libvulkan1 \
libvulkan_intel \
libvulkan_radeon

# In openSUSE official images, zypper is configured to ignore recommended
# packages (i.e., weak dependencies). This however, results in a rather
# poor out-of-the-box experience (e.g., when trying to run GUI apps).
Expand Down

0 comments on commit 631a296

Please sign in to comment.