#!/bin/bash operating_system() { grep -E '^(VERSION_)?ID=' /etc/os-release | \ sort | cut -d '=' -f 2- | sed 's/"//g' | paste -s -d '-' } check_all_yum() { local missing="" for pkg in $1; do if ! yum list installed "$pkg" >/dev/null 2>/dev/null; then missing="$pkg $missing" fi done if [ "$missing" != "" ]; then echo "MISSING PACKAGES: $missing" exit 1 fi } check_all_dpkg() { local missing="" for pkg in $1; do if ! dpkg -s "$pkg" >/dev/null 2>/dev/null; then missing="$pkg $missing" fi done if [ "$missing" != "" ]; then echo "MISSING PACKAGES: $missing" exit 1 fi } check_all_dnf() { local missing="" for pkg in $1; do if ! dnf list installed "$pkg" >/dev/null 2>/dev/null; then missing="$pkg $missing" fi done if [ "$missing" != "" ]; then echo "MISSING PACKAGES: $missing" exit 1 fi } install_all_apt() { for pkg in $1; do apt install -y "$pkg" done }