Rework Part 1
This commit is contained in:
150
distrobox-setup.sh
Executable file
150
distrobox-setup.sh
Executable file
@@ -0,0 +1,150 @@
|
||||
#!/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" 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
|
||||
"steamos" "SteamOS" off
|
||||
"void" "Void Linux" off
|
||||
)
|
||||
CHOICES=$(whiptail --title "Select Containers" --checklist "Choose the containers you want to setup" 20 78 7 "${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 fastfetch"
|
||||
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 fastfetch"
|
||||
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
|
||||
;;
|
||||
steamos)
|
||||
if lspci | grep -i nvidia &>/dev/null; then
|
||||
distrobox-create --yes --name steamos \
|
||||
--image ghcr.io/linuxserver/steamos:latest --init --pull --nvidia \
|
||||
--home /home/"$USER"/distrobox/steamos \
|
||||
--additional-packages "systemd sudo git zsh nano wget curl fastfetch"
|
||||
else
|
||||
distrobox-create --yes --name steamos \
|
||||
--image ghcr.io/linuxserver/steamos:latest --init --pull \
|
||||
--home /home/"$USER"/distrobox/steamos \
|
||||
--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
|
||||
Reference in New Issue
Block a user