mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-08-15 17:32:22 +00:00
Update install_proxmenux.sh
This commit is contained in:
parent
6b6977a2b0
commit
67c934081b
@ -45,7 +45,6 @@ LOCAL_VERSION_FILE="$BASE_DIR/version.txt"
|
|||||||
MENU_SCRIPT="menu.sh"
|
MENU_SCRIPT="menu.sh"
|
||||||
|
|
||||||
|
|
||||||
# Try to load utils.sh from GitHub
|
|
||||||
if ! source <(curl -sSf "$UTILS_URL"); then
|
if ! source <(curl -sSf "$UTILS_URL"); then
|
||||||
echo "$(translate 'Error: Could not load utils.sh from') $UTILS_URL"
|
echo "$(translate 'Error: Could not load utils.sh from') $UTILS_URL"
|
||||||
exit 1
|
exit 1
|
||||||
@ -53,7 +52,6 @@ fi
|
|||||||
|
|
||||||
# ==========================================================
|
# ==========================================================
|
||||||
|
|
||||||
# Verify that it's run as root
|
|
||||||
if [ "$(id -u)" -ne 0 ]; then
|
if [ "$(id -u)" -ne 0 ]; then
|
||||||
msg_error "This script must be run as root."
|
msg_error "This script must be run as root."
|
||||||
exit 1
|
exit 1
|
||||||
@ -63,7 +61,6 @@ fi
|
|||||||
show_proxmenu_logo
|
show_proxmenu_logo
|
||||||
|
|
||||||
|
|
||||||
# Display installation confirmation
|
|
||||||
echo -e "${YW}To function correctly, ProxMenu needs to install the following components:${CL}"
|
echo -e "${YW}To function correctly, ProxMenu needs to install the following components:${CL}"
|
||||||
echo -e "${TAB}- whiptail (if not already installed)"
|
echo -e "${TAB}- whiptail (if not already installed)"
|
||||||
echo -e "${TAB}- curl (if not already installed)"
|
echo -e "${TAB}- curl (if not already installed)"
|
||||||
@ -81,125 +78,74 @@ then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Check system dependencies
|
# Install dependencies =====================================
|
||||||
|
|
||||||
msg_info "Checking system dependencies..."
|
msg_info "Checking system dependencies..."
|
||||||
|
|
||||||
# Install `whiptail`
|
|
||||||
if ! command -v whiptail &> /dev/null; then
|
|
||||||
msg_info "Installing whiptail..."
|
|
||||||
if apt-get update && apt-get install -y whiptail; then
|
|
||||||
msg_ok "whiptail installed successfully."
|
|
||||||
else
|
|
||||||
msg_error "Failed to install whiptail. Please install it manually."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
msg_ok "whiptail is already installed."
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Install `curl`
|
DEPS=("whiptail" "curl" "jq" "python3" "python3-venv" "python3-pip")
|
||||||
if ! command -v curl &> /dev/null; then
|
for pkg in "${DEPS[@]}"; do
|
||||||
msg_info "Installing curl..."
|
if ! dpkg -l | grep -qw "$pkg"; then
|
||||||
if apt-get update && apt-get install -y curl; then
|
msg_info "Installing $pkg..."
|
||||||
msg_ok "curl installed successfully."
|
if apt-get update && apt-get install -y "$pkg"; then
|
||||||
|
msg_ok "$pkg installed successfully."
|
||||||
|
else
|
||||||
|
msg_error "Failed to install $pkg. Please install it manually."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
msg_error "Failed to install curl. Please install it manually."
|
msg_ok "$pkg is already installed."
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
else
|
done
|
||||||
msg_ok "curl is already installed."
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Install `jq`
|
# Set up virtual environment ==============================
|
||||||
if ! command -v jq &> /dev/null; then
|
|
||||||
msg_info "Installing jq..."
|
|
||||||
if apt-get update && apt-get install -y jq; then
|
|
||||||
msg_ok "jq installed successfully."
|
|
||||||
else
|
|
||||||
msg_error "Failed to install jq. Please install it manually."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
msg_ok "jq is already installed."
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Install Python and virtualenv
|
|
||||||
if ! command -v python3 &> /dev/null; then
|
|
||||||
msg_info "Installing Python 3..."
|
|
||||||
if apt-get update && apt-get install -y python3 python3-venv python3-pip; then
|
|
||||||
msg_ok "Python 3 installed successfully."
|
|
||||||
else
|
|
||||||
msg_error "Failed to install Python 3. Please install it manually."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
msg_ok "Python 3 is already installed."
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Create and configure the virtual environment
|
|
||||||
msg_info "Setting up the virtual environment for translations..."
|
msg_info "Setting up the virtual environment for translations..."
|
||||||
if [ ! -d "$VENV_PATH" ]; then
|
if [ ! -d "$VENV_PATH" ]; then
|
||||||
python3 -m venv "$VENV_PATH"
|
python3 -m venv "$VENV_PATH"
|
||||||
source "$VENV_PATH/bin/activate"
|
source "$VENV_PATH/bin/activate"
|
||||||
if pip install googletrans==4.0.0-rc1; then
|
|
||||||
|
if pip install --no-cache-dir googletrans==4.0.0-rc1; then
|
||||||
msg_ok "Virtual environment configured and googletrans installed."
|
msg_ok "Virtual environment configured and googletrans installed."
|
||||||
else
|
else
|
||||||
msg_error "Failed to configure the virtual environment or install googletrans."
|
msg_error "Failed to install googletrans. Please check your internet connection."
|
||||||
deactivate
|
deactivate
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
deactivate
|
deactivate
|
||||||
else
|
else
|
||||||
msg_ok "Virtual environment already configured."
|
msg_ok "Virtual environment already configured."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create necessary folders
|
# Download necessary files =================================
|
||||||
msg_info "Creating necessary directories..."
|
|
||||||
|
msg_ok "Necessary directories created."
|
||||||
mkdir -p "$BASE_DIR"
|
mkdir -p "$BASE_DIR"
|
||||||
msg_ok "Directories created."
|
|
||||||
|
|
||||||
# Download the cache file
|
|
||||||
msg_info "Downloading the cache file..."
|
|
||||||
if wget -qO "$CACHE_FILE" "$REPO_URL/lang/cache.json"; then
|
|
||||||
msg_ok "Cache file downloaded successfully."
|
|
||||||
else
|
|
||||||
msg_error "Failed to download the cache file. Check the URL and your Internet connection."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Download utils.sh
|
FILES=(
|
||||||
msg_info "Downloading utils.sh..."
|
"$CACHE_FILE $REPO_URL/lang/cache.json"
|
||||||
if wget -qO "$UTILS_FILE" "$REPO_URL/scripts/utils.sh"; then
|
"$UTILS_FILE $REPO_URL/scripts/utils.sh"
|
||||||
msg_ok "utils.sh downloaded successfully."
|
"$INSTALL_DIR/$MENU_SCRIPT $REPO_URL/$MENU_SCRIPT"
|
||||||
else
|
"$LOCAL_VERSION_FILE $REPO_URL/version.txt"
|
||||||
msg_error "Failed to download utils.sh. Check the URL and your Internet connection."
|
)
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Download the main script (menu.sh)
|
for file in "${FILES[@]}"; do
|
||||||
msg_info "Downloading the main script..."
|
IFS=" " read -r dest url <<< "$file"
|
||||||
if wget -qO "$INSTALL_DIR/$MENU_SCRIPT" "$REPO_URL/$MENU_SCRIPT"; then
|
msg_info "Downloading ${dest##*/}..."
|
||||||
chmod +x "$INSTALL_DIR/$MENU_SCRIPT"
|
if wget -qO "$dest" "$url"; then
|
||||||
msg_ok "Main script downloaded and made executable."
|
msg_ok "${dest##*/} downloaded successfully."
|
||||||
else
|
else
|
||||||
msg_error "Failed to download the main script. Check the URL and your Internet connection."
|
msg_error "Failed to download ${dest##*/}. Check your Internet connection."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
# Download the initial version
|
|
||||||
msg_info "Downloading version file..."
|
|
||||||
if wget -qO "$LOCAL_VERSION_FILE" "$REPO_URL/version.txt"; then
|
|
||||||
msg_ok "Version file downloaded."
|
|
||||||
else
|
|
||||||
msg_error "Failed to download the version file."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Confirmation
|
chmod +x "$INSTALL_DIR/$MENU_SCRIPT"
|
||||||
#msg_ok "ProxMenux has been installed successfully."
|
|
||||||
#echo -e "${GN} 🌟 Run: menu.sh as root to start the menu.${CL}"
|
|
||||||
|
|
||||||
#msg_ok "ProxMenux has been installed successfully."
|
# Installation complete ====================================
|
||||||
echo
|
echo
|
||||||
echo -e "${YW}╭─────────────────────────────────────────────────────╮${CL}"
|
echo -e "${YW}╭─────────────────────────────────────────────────────╮${CL}"
|
||||||
echo -e "${YW}│${CL} ${GN}🌟 ProxMenux has been installed successfull 🌟 ${CL} ${YW}│${CL}"
|
echo -e "${YW}│${CL} ${GN}🌟 ProxMenux has been installed successfull 🌟 ${CL} ${YW}│${CL}"
|
||||||
@ -211,6 +157,9 @@ echo -e "${YWB} menu.sh${CL}"
|
|||||||
echo
|
echo
|
||||||
|
|
||||||
|
|
||||||
# Exit
|
|
||||||
rm -f "$BASE_DIR/install_proxmenux.sh"
|
if [ -f "$BASE_DIR/install_proxmenux.sh" ]; then
|
||||||
|
rm -f "$BASE_DIR/install_proxmenux.sh"
|
||||||
|
fi
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user