From 422d1fd9a815a383642f175000b7de7382440d22 Mon Sep 17 00:00:00 2001 From: Albert-LGTM Date: Thu, 10 Oct 2024 15:18:23 +0200 Subject: [PATCH] split podman install into podman and podman-compose --- .../podman-compose-setup.sh | 37 ++++++++++++ core/tabs/applications-setup/podman-setup.sh | 59 ++----------------- 2 files changed, 41 insertions(+), 55 deletions(-) create mode 100644 core/tabs/applications-setup/podman-compose-setup.sh diff --git a/core/tabs/applications-setup/podman-compose-setup.sh b/core/tabs/applications-setup/podman-compose-setup.sh new file mode 100644 index 00000000..708513bf --- /dev/null +++ b/core/tabs/applications-setup/podman-compose-setup.sh @@ -0,0 +1,37 @@ +#!/bin/sh -e + +. ../common-script.sh + +install_podman_compose() { + printf "%b\n" "${YELLOW}Installing Podman Compose...${RC}" + case "$PACKAGER" in + apt-get|nala) + "$ESCALATION_TOOL" "$PACKAGER" install -y podman-compose + ;; + zypper) + "$ESCALATION_TOOL" "$PACKAGER" --non-interactive install podman-compose + ;; + pacman) + "$ESCALATION_TOOL" "$PACKAGER" -S --noconfirm --needed podman-compose + ;; + dnf) + "$ESCALATION_TOOL" "$PACKAGER" install -y podman-compose + ;; + *) + printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}" + exit 1 + ;; + esac +} + +install_components() { + if ! command_exists podman-compose || ! command_exists podman compose version; then + install_podman_compose + else + printf "%b\n" "${GREEN}Podman Compose is already installed.${RC}" + fi +} + +checkEnv +checkEscalationTool +install_components diff --git a/core/tabs/applications-setup/podman-setup.sh b/core/tabs/applications-setup/podman-setup.sh index 7b0e2a1f..6d5474b7 100644 --- a/core/tabs/applications-setup/podman-setup.sh +++ b/core/tabs/applications-setup/podman-setup.sh @@ -2,23 +2,6 @@ . ../common-script.sh -choose_installation() { - clear - printf "%b\n" "${YELLOW}Choose what to install:${RC}" - printf "%b\n" "1. ${YELLOW}Podman${RC}" - printf "%b\n" "2. ${YELLOW}Podman Compose${RC}" - printf "%b\n" "3. ${YELLOW}Both${RC}" - printf "%b" "Enter your choice [1-3]: " - read -r CHOICE - - case "$CHOICE" in - 1) INSTALL_PODMAN=1; INSTALL_COMPOSE=0 ;; - 2) INSTALL_PODMAN=0; INSTALL_COMPOSE=1 ;; - 3) INSTALL_PODMAN=1; INSTALL_COMPOSE=1 ;; - *) printf "%b\n" "${RED}Invalid choice. Exiting.${RC}"; exit 1 ;; - esac -} - install_podman() { printf "%b\n" "${YELLOW}Installing Podman...${RC}" case "$PACKAGER" in @@ -41,45 +24,11 @@ install_podman() { esac } -install_podman_compose() { - printf "%b\n" "${YELLOW}Installing Podman Compose...${RC}" - case "$PACKAGER" in - apt-get|nala) - "$ESCALATION_TOOL" "$PACKAGER" install -y podman-compose - ;; - zypper) - "$ESCALATION_TOOL" "$PACKAGER" --non-interactive install podman-compose - ;; - pacman) - "$ESCALATION_TOOL" "$PACKAGER" -S --noconfirm --needed podman-compose - ;; - dnf) - "$ESCALATION_TOOL" "$PACKAGER" install -y podman-compose - ;; - *) - printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}" - exit 1 - ;; - esac -} - install_components() { - choose_installation - - if [ "$INSTALL_PODMAN" -eq 1 ]; then - if ! command_exists podman; then - install_podman - else - printf "%b\n" "${GREEN}Podman is already installed.${RC}" - fi - fi - - if [ "$INSTALL_COMPOSE" -eq 1 ]; then - if ! command_exists podman-compose || ! command_exists podman compose version; then - install_podman_compose - else - printf "%b\n" "${GREEN}Podman Compose is already installed.${RC}" - fi + if ! command_exists podman; then + install_podman + else + printf "%b\n" "${GREEN}Podman is already installed.${RC}" fi }