diff options
| author | mohammadmovaghari <52345697+mohammadmovaghari@users.noreply.github.com> | 2023-04-04 16:44:40 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-04 16:44:40 +0300 |
| commit | 9f18d60b9ce16d89af97ae993a3224bb6c8cd288 (patch) | |
| tree | 978b3178c6dd5bb616d46a442d8c50b19856bb70 /install.sh | |
| parent | c0580bccb5b574f4a8e4a7f2789d5cdf6049e7fc (diff) | |
| parent | 0e5de1aec8f3b090fce14638d7e0030ff7b7f40f (diff) | |
Merge branch 'MHSanaei:main' into api-fix
Diffstat (limited to 'install.sh')
| -rw-r--r-- | install.sh | 27 |
1 files changed, 23 insertions, 4 deletions
@@ -66,14 +66,33 @@ else echo -e "${red}Failed to check the OS version, please contact the author!${plain}" && exit 1 fi - +# This function installs the base packages required for most scripts install_base() { - if [[ "${release}" == "centos" ]]; then - yum install wget curl tar -y + # Store the package names in a variable for easy modification + local packages="wget curl tar" + + # Check for the package managers and install the packages if they are not already installed + if ! command -v wget >/dev/null 2>&1 || ! command -v curl >/dev/null 2>&1 || ! command -v tar >/dev/null 2>&1; then + if command -v apt >/dev/null 2>&1; then + apt-get update && apt-get install -y $packages + elif command -v dnf >/dev/null 2>&1; then + dnf install -y $packages + elif command -v yum >/dev/null 2>&1; then + yum install -y $packages + else + echo "ERROR: No package managers found. Please install wget, curl, and tar manually." + return 1 + fi + + # Print a confirmation message after the installation is complete + echo "The following packages have been successfully installed: $packages" else - apt install wget curl tar -y + # Print a message confirming that the packages are already installed + echo "The following packages are already installed: $packages" fi } + + #This function will be called when user installed x-ui out of sercurity config_after_install() { echo -e "${yellow}Install/update finished! For security it's recommended to modify panel settings ${plain}" |
