install sh

This commit is contained in:
qiaofeng1227 2023-11-08 11:52:21 +08:00
parent f8550afc83
commit 91f43a3e9e
4 changed files with 39 additions and 13 deletions

View file

@ -108,6 +108,13 @@ export tools_yum="git curl wget epel-release yum-utils jq bc unzip inotify-tools
export tools_apt="git curl wget jq bc unzip inotify-tools"
export docker_network="websoft9"
export artifact_url="https://w9artifact.blob.core.windows.net/$channel/websoft9"
# export OS release environments
if [ -f /etc/os-release ]; then
. /etc/os-release
else
echo "Can't judge your Linux distribution"
exit 1
fi
echo Install from url: $artifact_url
# Define common functions
@ -133,9 +140,8 @@ install_tools(){
echo_prefix_tools=$'\n[Tools] - '
echo "$echo_prefix_tools Starting install necessary tool..."
OS_TYPE=$(cat /etc/*-release | awk -F= '/^NAME/{print $2}' | tr -d '"')
if [[ $OS_TYPE == "Red Hat Enterprise Linux" ]]; then
RHEL_VERSION=$(rpm -E %{rhel})
if [ "$ID" = "rhel" ]; then
RHEL_VERSION=${VERSION_ID%%.*}
sudo yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-${RHEL_VERSION}.noarch.rpm
else
echo "The script is only applicable to Red Hat Enterprise Linux."

View file

@ -322,15 +322,15 @@ Install_Cockpit(){
for pkg in $cockpit_packages
do
echo "Install or upgrade $pkg"
sudo dnf upgrade -y "$pkg"
sudo dnf install -y "$pkg" || echo "$pkg failed to install or upgrade"
sudo dnf upgrade -y "$pkg" || echo "$pkg failed to upgrade"
sudo dnf install -y "$pkg" || echo "$pkg failed to install"
done
elif [ $yum_status -eq 0 ]; then
for pkg in $cockpit_packages
do
echo "Install or update $pkg"
sudo yum update -y "$pkg"
sudo yum install -y "$pkg" || echo "$pkg failed to install or update"
sudo yum update -y "$pkg" || echo "$pkg failed to update"
sudo yum install -y "$pkg" || echo "$pkg failed to install"
done
elif [ $apt_status -eq 0 ]; then
export DEBIAN_FRONTEND=noninteractive
@ -379,7 +379,6 @@ Test_Cockpit(){
#### -------------- main() start here ------------------- ####
Install_PackageKit
Set_Repository
Install_Cockpit
Test_Cockpit

View file

@ -67,12 +67,24 @@ Install_Docker(){
curl -fsSL https://get.docker.com -o get-docker.sh
timeout $timeout sh get-docker.sh --channel stable --mirror $mirror
else
# For other distributions(Redhat and Rocky linux)
sudo yum install yum-utils -y > /dev/null
sudo yum-config-manager --add-repo $repo_url
timeout $timeout sudo yum install $docker_packages -y
# For other distributions(Redhat and Rocky linux ...)
dnf --version >/dev/null 2>&1
dnf_status=$?
yum --version >/dev/null 2>&1
yum_status=$?
if [ $dnf_status -eq 0 ]; then
sudo dnf install dnf-utils -y > /dev/null
sudo dnf config-manager --add-repo $repo_url
timeout $timeout sudo dnf install $docker_packages -y
elif [ $yum_status -eq 0 ]; then
sudo yum install yum-utils -y > /dev/null
sudo yum-config-manager --add-repo $repo_url
timeout $timeout sudo yum install $docker_packages -y
else
echo "None of the required package managers are installed."
fi
fi
fi
# For Ubuntu, Debian, or Raspbian
if type apt >/dev/null 2>&1; then

View file

@ -52,6 +52,15 @@ versions_url="$source_github_pages/version.json"
file_suffix=".zip"
plugin_path="/usr/share/cockpit"
if ! command -v python3 &> /dev/null
then
echo "Python 3 is not installed. Installing..."
sudo yum install -y python3 &> /dev/null || sudo apt update -y && sudo apt install -y python3 &> /dev/null
else
echo "Python 3 is already installed."
fi
echo "$echo_prefix_plugins Starting download plugin and update it"
python3 - << END