update
This commit is contained in:
parent
6c06ee2b52
commit
cffdc504ca
2 changed files with 51 additions and 3 deletions
|
|
@ -1,2 +1 @@
|
||||||
deps="openssl nginx meshtastic flask"
|
deps="openssl nginx nginx-common python3-meshtastic python3-flask python3-requests"
|
||||||
pkgs="openssl nginx nginx-common python3-meshtastic python3-flask python3-requests"
|
|
||||||
|
|
@ -57,3 +57,52 @@ done
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# List of packages to check
|
||||||
|
packages=("git" "gcc" "python3" "vim")
|
||||||
|
|
||||||
|
# Function to check if a package is installed and install if not
|
||||||
|
check_and_install() {
|
||||||
|
local pkg="$1"
|
||||||
|
local package_manager=""
|
||||||
|
|
||||||
|
# Determine the package manager based on the system
|
||||||
|
if command -v apt-get >/dev/null 2>&1; then
|
||||||
|
package_manager="apt-get"
|
||||||
|
elif command -v yum >/dev/null 2>&1; then
|
||||||
|
package_manager="yum"
|
||||||
|
elif command -v dnf >/dev/null 2>&1; then
|
||||||
|
package_manager="dnf"
|
||||||
|
else
|
||||||
|
echo "Unsupported package manager. Cannot proceed."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if package is installed
|
||||||
|
if dpkg -s "$pkg" >/dev/null 2>&1; then
|
||||||
|
echo "$pkg is already installed."
|
||||||
|
else
|
||||||
|
echo "$pkg is not installed."
|
||||||
|
read -p "Would you like to install $pkg? (Y/N): " answer
|
||||||
|
case $answer in
|
||||||
|
[Yy]*)
|
||||||
|
if [[ "$package_manager" == "apt-get" ]]; then
|
||||||
|
sudo apt-get install -y "$pkg"
|
||||||
|
elif [[ "$package_manager" == "yum" ]]; then
|
||||||
|
sudo yum install -y "$pkg"
|
||||||
|
elif [[ "$package_manager" == "dnf" ]]; then
|
||||||
|
sudo dnf install -y "$pkg"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Skipping installation of $pkg."
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Loop through each package and check/install
|
||||||
|
for pkg in "${packages[@]}"; do
|
||||||
|
check_and_install "$pkg"
|
||||||
|
done
|
||||||
Loading…
Add table
Add a link
Reference in a new issue