137 lines
6.0 KiB
Bash
Executable File
137 lines
6.0 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Check if distrobox is installed, if not install it
|
|
if ! command -v distrobox &>/dev/null; then
|
|
if [[ $DISTRO =~ (debian|ubuntu) ]]; then
|
|
sudo apt install distrobox -y
|
|
elif [[ $DISTRO == "fedora" ]]; then
|
|
sudo dnf install distrobox -y
|
|
elif [[ $DISTRO == "arch" ]]; then
|
|
sudo pacman -S --needed distrobox --noconfirm
|
|
fi
|
|
fi
|
|
|
|
# Check if either docker or podman is installed, if none ask the user which one they want to use
|
|
if ! command -v podman &>/dev/null && ! command -v docker &>/dev/null; then
|
|
CHOICE=$(whiptail --title "Container Engine" --menu "Choose a container engine to install" 15 60 2 \
|
|
"docker" "Docker" \
|
|
"podman" "Podman (Recommended)" 3>&1 1>&2 2>&3)
|
|
|
|
case $CHOICE in
|
|
docker)
|
|
if [[ $DISTRO =~ (debian|ubuntu) ]]; then
|
|
sudo apt install docker.io -y
|
|
elif [[ $DISTRO == "fedora" ]]; then
|
|
sudo dnf install docker -y
|
|
elif [[ $DISTRO == "arch" ]]; then
|
|
sudo pacman -S --needed docker --noconfirm
|
|
fi
|
|
;;
|
|
podman)
|
|
if [[ $DISTRO =~ (debian|ubuntu) ]]; then
|
|
sudo apt install podman -y
|
|
elif [[ $DISTRO == "fedora" ]]; then
|
|
sudo dnf install podman -y
|
|
elif [[ $DISTRO == "arch" ]]; then
|
|
sudo pacman -S --needed podman --noconfirm
|
|
fi
|
|
;;
|
|
esac
|
|
fi
|
|
|
|
# Using whiptail checklist ask what container the user wants to setup
|
|
OPTIONS=(
|
|
"arch" "Arch Linux" off
|
|
"debian" "Debian Testing" off
|
|
"fedora-rawhide" "Fedora Rawhide" off
|
|
"almalinux" "AlmaLinux" off
|
|
"opensuse-tumbleweed" "OpenSUSE Tumbleweed" off
|
|
"void" "Void Linux" off
|
|
)
|
|
CHOICES=$(whiptail --title "Select Containers" --checklist "Choose the containers you want to setup" 15 60 6 "${OPTIONS[@]}" 3>&1 1>&2 2>&3)
|
|
|
|
for CHOICE in $CHOICES; do
|
|
CHOICE=$(echo $CHOICE | tr -d '"')
|
|
echo No | distrobox rm $CHOICE --force
|
|
case $CHOICE in
|
|
arch)
|
|
if lspci | grep -i nvidia &>/dev/null; then
|
|
distrobox-create --yes --name arch \
|
|
--image docker.io/library/archlinux:latest --init --pull --nvidia \
|
|
--home /home/"$USER"/distrobox/arch \
|
|
--additional-packages "systemd sudo git zsh nano wget curl fastfetch"
|
|
else
|
|
distrobox-create --yes --name arch \
|
|
--image docker.io/library/archlinux:latest --init --pull \
|
|
--home /home/"$USER"/distrobox/arch \
|
|
--additional-packages "systemd sudo git zsh nano wget curl fastfetch"
|
|
fi
|
|
;;
|
|
debian)
|
|
if lspci | grep -i nvidia &>/dev/null; then
|
|
distrobox-create --yes --name debian \
|
|
--image docker.io/library/debian:testing --init --pull --nvidia \
|
|
--home /home/"$USER"/distrobox/debian \
|
|
--additional-packages "systemd sudo git zsh nano wget curl fastfetch"
|
|
else
|
|
distrobox-create --yes --name debian \
|
|
--image docker.io/library/debian:testing --init --pull \
|
|
--home /home/"$USER"/distrobox/debian \
|
|
--additional-packages "systemd sudo git zsh nano wget curl fastfetch"
|
|
fi
|
|
;;
|
|
fedora-rawhide)
|
|
if lspci | grep -i nvidia &>/dev/null; then
|
|
distrobox-create --yes --name fedora-rawhide \
|
|
--image registry.fedoraproject.org/fedora:rawhide --init --pull --nvidia \
|
|
--home /home/"$USER"/distrobox/fedora-rawhide \
|
|
--additional-packages "systemd sudo git zsh nano wget curl fastfetch"
|
|
else
|
|
distrobox-create --yes --name fedora-rawhide \
|
|
--image registry.fedoraproject.org/fedora:rawhide --init --pull \
|
|
--home /home/"$USER"/distrobox/fedora-rawhide \
|
|
--additional-packages "systemd sudo git zsh nano wget curl fastfetch"
|
|
fi
|
|
;;
|
|
almalinux)
|
|
if lspci | grep -i nvidia &>/dev/null; then
|
|
distrobox-create --yes --name almalinux \
|
|
--image docker.io/library/almalinux:latest --init --pull --nvidia \
|
|
--home /home/"$USER"/distrobox/almalinux \
|
|
--additional-packages "systemd sudo git zsh nano wget curl"
|
|
else
|
|
distrobox-create --yes --name almalinux \
|
|
--image docker.io/library/almalinux:latest --init --pull \
|
|
--home /home/"$USER"/distrobox/almalinux \
|
|
--additional-packages "systemd sudo git zsh nano wget curl"
|
|
fi
|
|
;;
|
|
opensuse-tumbleweed)
|
|
if lspci | grep -i nvidia &>/dev/null; then
|
|
distrobox-create --yes --name opensuse-tumbleweed \
|
|
--image registry.opensuse.org/opensuse/distrobox:latest --init --pull --nvidia \
|
|
--home /home/"$USER"/distrobox/opensuse-tumbleweed \
|
|
--additional-packages "systemd sudo git zsh nano wget curl fastfetch"
|
|
else
|
|
distrobox-create --yes --name opensuse-tumbleweed \
|
|
--image registry.opensuse.org/opensuse/distrobox:latest --init --pull \
|
|
--home /home/"$USER"/distrobox/opensuse-tumbleweed \
|
|
--additional-packages "systemd sudo git zsh nano wget curl fastfetch"
|
|
fi
|
|
;;
|
|
void)
|
|
if lspci | grep -i nvidia &>/dev/null; then
|
|
distrobox-create --yes --name void \
|
|
--image ghcr.io/void-linux/void-musl-full:latest --init --pull --nvidia \
|
|
--home /home/"$USER"/distrobox/void \
|
|
--additional-packages "systemd sudo git zsh nano wget curl fastfetch"
|
|
else
|
|
distrobox-create --yes --name void \
|
|
--image ghcr.io/void-linux/void-musl-full:latest --init --pull \
|
|
--home /home/"$USER"/distrobox/void \
|
|
--additional-packages "systemd sudo git zsh nano wget curl fastfetch"
|
|
fi
|
|
;;
|
|
esac
|
|
done
|