addet silent exec

This commit is contained in:
pika 2025-05-11 13:40:31 +02:00
parent f8288b8893
commit ad24809234

View file

@ -5,12 +5,34 @@ command_exists() {
command -v "$@" >/dev/null 2>&1 command -v "$@" >/dev/null 2>&1
} }
if command_exists curl; then # WHY:
eval "$(curl -fsSL https://git.k4li.de/scripts/imports/raw/branch/main/distros.sh)" # This import will give you the following variables:
else # _sudo="sudo -E" <- only if non root user
echo "curl is required, but not installed" # distro = <distro name, like 'arch', 'debian', 'fedora'..>
# arch = bool
# fedora = bool
# opensuse = bool....
# You can then use it for, `if $arch; then`
# Also this gives you the _install command, which installs a package pased on the packagemanager/distro used.
# CAUTION:
# This only wokrs for generic package names, like neovim, or vim, or tmux etc..
# not every package packagemanager has the same packagenames for their packages..
getImports() {
i="https://git.k4li.de/scripts/imports/raw/branch/main/distros.sh"
import="$(mktemp)"
if command_exists curl; then
curl -fsSL $i -o $import
elif command_exists wget; then
wget $i -o $import
else
echo "curl/wget is required, but missing.."
exit 1 exit 1
fi fi
source "$import"
sleep 0.3
rm "$import"
}
init_docker() { init_docker() {
if command -v docker >/dev/null 2>&1; then if command -v docker >/dev/null 2>&1; then
@ -29,15 +51,15 @@ init_docker() {
fi fi
} }
main() { _arch() {
case "$distro" in
arch)
clear clear
echo_info "executing arch" echo_info "executing arch"
sleep 2 sleep 2
$_sudo pacman -S docker docker-compose --noconfirm _install docker docker-compose --noconfirm
;; }
debian)
_debian() {
if ! $trixie; then
clear clear
echo_info "executing debian" echo_info "executing debian"
sleep 2 sleep 2
@ -56,9 +78,15 @@ main() {
echo_info "Addet repository. Updating and installing now.." echo_info "Addet repository. Updating and installing now.."
sleep 1 sleep 1
$_sudo apt-get update $_sudo apt-get update
$_sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin checkAndInstall "docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin"
;; else
ubuntu) clear
echo_info "executing trixie.."
_install docker.io docker-compose
fi
}
_ubuntu() {
clear clear
echo_info "executing ubuntu" echo_info "executing ubuntu"
sleep 2 sleep 2
@ -73,20 +101,41 @@ main() {
echo_info "Addet repository. Updating and installing now.." echo_info "Addet repository. Updating and installing now.."
sleep 0.5 sleep 0.5
$_sudo apt-get update $_sudo apt-get update
$_sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin checkAndInstall "docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin"
;; }
fedora)
_fedora() {
clear clear
echo_info "executing fedora" echo_info "executing fedora"
sleep 2 sleep 2
$_sudo dnf -y install dnf-plugins-core _install dnf-plugins-core
$_sudo dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo $_sudo dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo
$_sudo dnf install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin checkAndInstall "docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin"
;; }
main() {
case "$distro" in
arch) _arch ;;
debian) _debian ;;
ubuntu) _ubuntu ;;
fedora) _fedora ;;
*) echo "$distro is not supported by this script" ;; *) echo "$distro is not supported by this script" ;;
esac esac
} }
if main; then if getImports; then
case "$1" in
--silent | -s)
clear
echo_info "Executin $distro"
if silentexec main; then
init_docker init_docker
fi
;;
*)
if main; then
init_docker
fi
;;
esac
fi fi