Skip to content

Commit

Permalink
fix: "Package manager not found or not supported. Please install jq m…
Browse files Browse the repository at this point in the history
…anually."
  • Loading branch information
BruceWind committed Sep 17, 2024
1 parent 6b41e0a commit f743fdb
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions update_cdn_ranges.sh
Original file line number Diff line number Diff line change
@@ -1,28 +1,35 @@
#!/bin/bash
#!/bin/sh

# 检查 jq 是否已安装
if ! command -v jq &> /dev/null; then
if ! command -v jq > /dev/null 2>&1; then
echo "jq is not installed. Installing jq..."

# 使用 apt-get 包管理器安装 jq
if [[ -n $(command -v apt-get) ]]; then
sudo apt-get update
sudo apt-get install -y jq
# Try to detect package manager and install jq
if command -v apt-get > /dev/null 2>&1; then
sudo apt-get update && sudo apt-get install -y jq
elif command -v yum > /dev/null 2>&1; then
sudo yum install -y jq
elif command -v brew > /dev/null 2>&1; then
brew install jq
else
echo "Package manager not found or not supported. Please install jq manually."
exit 1
fi
else
echo "jq is already installed."
fi

# 检查 curl 是否已安装
if ! command -v curl &> /dev/null; then
if ! command -v curl > /dev/null 2>&1; then
echo "curl is not installed. Installing curl..."

# 使用 apt-get 包管理器安装 curl
if [[ -n $(command -v apt-get) ]]; then
sudo apt-get update
sudo apt-get install -y curl
# Try to detect package manager and install curl
if command -v apt-get > /dev/null 2>&1; then
sudo apt-get update && sudo apt-get install -y curl
elif command -v yum > /dev/null 2>&1; then
sudo yum install -y curl
elif command -v brew > /dev/null 2>&1; then
brew install curl
else
echo "Package manager not found or not supported. Please install curl manually."
exit 1
Expand Down

0 comments on commit f743fdb

Please sign in to comment.