refactor: Remove wget fallbacks
This commit is contained in:
@@ -85,12 +85,10 @@ METASCRIPT_URL="https://git.adityagupta.dev/sortedcord/bootstrap/raw/branch/mast
|
||||
if [ -f "$METASCRIPT_LOCAL" ]; then
|
||||
. "$METASCRIPT_LOCAL"
|
||||
else
|
||||
if command -v wget >/dev/null 2>&1; then
|
||||
eval "$(wget -qO- "$METASCRIPT_URL")"
|
||||
elif command -v curl >/dev/null 2>&1; then
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
eval "$(curl -fsSL "$METASCRIPT_URL")"
|
||||
else
|
||||
echo "Error: Neither wget nor curl is installed to fetch bootstrap.sh." >&2
|
||||
echo "Error: curl is not installed to fetch bootstrap.sh." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
@@ -119,7 +117,7 @@ install_<name>() {
|
||||
# local distro; distro=$(detect_distro)
|
||||
# Use detect_arch for arch-specific logic:
|
||||
# local arch; arch=$(detect_arch)
|
||||
# For GitHub releases, use curl/wget pattern (see bat installer for reference)
|
||||
# For GitHub releases, use curl pattern (see bat installer for reference)
|
||||
}
|
||||
|
||||
# ─── Shell Configuration (if needed) ─────────────────────────────────
|
||||
@@ -237,10 +235,6 @@ if has_command curl; then
|
||||
latest_tag=$(curl -sL https://api.github.com/repos/<owner>/<repo>/releases/latest \
|
||||
| grep '"tag_name":' | head -n1 \
|
||||
| sed -E 's/.*"tag_name": "([^"]+)".*/\1/' || true)
|
||||
elif has_command wget; then
|
||||
latest_tag=$(wget -qO- https://api.github.com/repos/<owner>/<repo>/releases/latest \
|
||||
| grep '"tag_name":' | head -n1 \
|
||||
| sed -E 's/.*"tag_name": "([^"]+)".*/\1/' || true)
|
||||
fi
|
||||
|
||||
if [ -z "$latest_tag" ]; then
|
||||
|
||||
4
b.sh
4
b.sh
@@ -44,13 +44,13 @@ b() {
|
||||
[ -f "$routes_dir/VERSION" ] && local_ver=$(cat "$routes_dir/VERSION" 2>/dev/null | tr -d '[:space:]')
|
||||
|
||||
local remote_ver
|
||||
if remote_ver=$(curl -fsSL "$base_url/VERSION" 2>/dev/null || wget -qO- "$base_url/VERSION" 2>/dev/null); then
|
||||
if remote_ver=$(curl -fsSL "$base_url/VERSION" 2>/dev/null); then
|
||||
remote_ver=$(echo "$remote_ver" | tr -d '[:space:]')
|
||||
if [ -n "$remote_ver" ] && _version_lt "$local_ver" "$remote_ver"; then
|
||||
echo "New version $remote_ver available (local: $local_ver). Auto-updating..." >&2
|
||||
local tmp_bootstrap
|
||||
tmp_bootstrap="$(mktemp)"
|
||||
if curl -fsSL "$base_url/bootstrap.sh" -o "$tmp_bootstrap" 2>/dev/null || wget -qO "$tmp_bootstrap" "$base_url/bootstrap.sh" 2>/dev/null; then
|
||||
if curl -fsSL "$base_url/bootstrap.sh" -o "$tmp_bootstrap" 2>/dev/null; then
|
||||
bash "$tmp_bootstrap" >/dev/null 2>&1
|
||||
fi
|
||||
rm -f "$tmp_bootstrap"
|
||||
|
||||
94
bootstrap.sh
94
bootstrap.sh
@@ -8,6 +8,11 @@ if [ -z "${BASH_VERSION:-}" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! command -v curl >/dev/null 2>&1; then
|
||||
echo "Error: curl is required to run this script." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Detect if the script is sourced
|
||||
is_sourced=false
|
||||
if [ -n "${BASH_SOURCE[0]:-}" ] && [ "${BASH_SOURCE[0]}" != "$0" ]; then
|
||||
@@ -37,35 +42,12 @@ else
|
||||
_BASE_URL="https://git.adityagupta.dev/sortedcord/bootstrap/raw/branch/master"
|
||||
_LIBS=("lib/common.sh" "lib/platform.sh" "lib/shell_config.sh")
|
||||
|
||||
_has_curl=false
|
||||
_has_wget=false
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
_has_curl=true
|
||||
elif command -v wget >/dev/null 2>&1; then
|
||||
_has_wget=true
|
||||
else
|
||||
echo "Error: Neither curl nor wget is installed to download libraries." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$_has_curl" = true ]; then
|
||||
_curl_args=()
|
||||
for _lib in "${_LIBS[@]}"; do
|
||||
mkdir -p "$BOOTSTRAP_TMP_DIR/$(dirname "$_lib")"
|
||||
_curl_args+=("-o" "$BOOTSTRAP_TMP_DIR/$_lib" "$_BASE_URL/$_lib")
|
||||
done
|
||||
curl -fsSL "${_curl_args[@]}" 2>/dev/null
|
||||
elif [ "$_has_wget" = true ]; then
|
||||
_pids=()
|
||||
for _lib in "${_LIBS[@]}"; do
|
||||
mkdir -p "$BOOTSTRAP_TMP_DIR/$(dirname "$_lib")"
|
||||
wget -qO "$BOOTSTRAP_TMP_DIR/$_lib" "$_BASE_URL/$_lib" 2>/dev/null &
|
||||
_pids+=($!)
|
||||
done
|
||||
for _pid in "${_pids[@]}"; do
|
||||
wait "$_pid" || true
|
||||
done
|
||||
fi
|
||||
_curl_args=()
|
||||
for _lib in "${_LIBS[@]}"; do
|
||||
mkdir -p "$BOOTSTRAP_TMP_DIR/$(dirname "$_lib")"
|
||||
_curl_args+=("-o" "$BOOTSTRAP_TMP_DIR/$_lib" "$_BASE_URL/$_lib")
|
||||
done
|
||||
curl -fsSL "${_curl_args[@]}" 2>/dev/null
|
||||
|
||||
if [ -f "$BOOTSTRAP_TMP_DIR/lib/common.sh" ]; then
|
||||
. "$BOOTSTRAP_TMP_DIR/lib/common.sh"
|
||||
@@ -118,46 +100,15 @@ install_bootstrap() {
|
||||
log_info "Downloading bootstrap scripts..."
|
||||
local base_url="https://git.adityagupta.dev/sortedcord/bootstrap/raw/branch/master"
|
||||
|
||||
local has_curl=false
|
||||
local has_wget=false
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
has_curl=true
|
||||
elif command -v wget >/dev/null 2>&1; then
|
||||
has_wget=true
|
||||
else
|
||||
log_error "Neither curl nor wget is installed."
|
||||
local curl_args=()
|
||||
for file in "${files[@]}"; do
|
||||
mkdir -p "$(dirname "$routes_dir/$file")"
|
||||
curl_args+=("-o" "$routes_dir/$file" "$base_url/$file")
|
||||
done
|
||||
if ! curl -fsSL "${curl_args[@]}"; then
|
||||
log_error "Failed to download bootstrap scripts."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$has_curl" = true ]; then
|
||||
local curl_args=()
|
||||
for file in "${files[@]}"; do
|
||||
mkdir -p "$(dirname "$routes_dir/$file")"
|
||||
curl_args+=("-o" "$routes_dir/$file" "$base_url/$file")
|
||||
done
|
||||
if ! curl -fsSL "${curl_args[@]}"; then
|
||||
log_error "Failed to download bootstrap scripts."
|
||||
exit 1
|
||||
fi
|
||||
elif [ "$has_wget" = true ]; then
|
||||
local pids=()
|
||||
for file in "${files[@]}"; do
|
||||
mkdir -p "$(dirname "$routes_dir/$file")"
|
||||
local file_url="$base_url/$file"
|
||||
wget -qO "$routes_dir/$file" "$file_url" &
|
||||
pids+=($!)
|
||||
done
|
||||
local err=0
|
||||
for pid in "${pids[@]}"; do
|
||||
if ! wait "$pid"; then
|
||||
err=1
|
||||
fi
|
||||
done
|
||||
if [ "$err" -ne 0 ]; then
|
||||
log_error "Failed to download some bootstrap scripts."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Create ~/.bash_aliases if it doesn't exist
|
||||
@@ -230,13 +181,8 @@ if [ "$is_sourced" = false ]; then
|
||||
_version_file="$BOOTSTRAP_TMP_DIR/VERSION"
|
||||
_base_url="${_BASE_URL:-https://git.adityagupta.dev/sortedcord/bootstrap/raw/branch/master}"
|
||||
if [ ! -f "$_art_file" ]; then
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
curl -fsSL -o "$_art_file" "$_base_url/assets/pixel_art.ansi" 2>/dev/null
|
||||
curl -fsSL -o "$_version_file" "$_base_url/VERSION" 2>/dev/null
|
||||
elif command -v wget >/dev/null 2>&1; then
|
||||
wget -qO "$_art_file" "$_base_url/assets/pixel_art.ansi" 2>/dev/null
|
||||
wget -qO "$_version_file" "$_base_url/VERSION" 2>/dev/null
|
||||
fi
|
||||
curl -fsSL -o "$_art_file" "$_base_url/assets/pixel_art.ansi" 2>/dev/null
|
||||
curl -fsSL -o "$_version_file" "$_base_url/VERSION" 2>/dev/null
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -18,7 +18,7 @@ if [ -f "$version_file" ]; then
|
||||
fi
|
||||
|
||||
base_url="https://git.adityagupta.dev/sortedcord/bootstrap/raw/branch/master"
|
||||
remote_ver=$(curl -fsSL "$base_url/VERSION" 2>/dev/null || wget -qO- "$base_url/VERSION" 2>/dev/null)
|
||||
remote_ver=$(curl -fsSL "$base_url/VERSION" 2>/dev/null)
|
||||
remote_ver=$(echo "$remote_ver" | tr -d '[:space:]')
|
||||
|
||||
if [ -z "$remote_ver" ]; then
|
||||
@@ -59,7 +59,7 @@ if version_lt "$local_ver" "$remote_ver" || [ "$force_update" = true ]; then
|
||||
fi
|
||||
|
||||
tmp_bootstrap="$(mktemp)"
|
||||
if curl -fsSL "$base_url/bootstrap.sh" -o "$tmp_bootstrap" || wget -qO "$tmp_bootstrap" "$base_url/bootstrap.sh"; then
|
||||
if curl -fsSL "$base_url/bootstrap.sh" -o "$tmp_bootstrap"; then
|
||||
# Run bootstrap.sh in foreground
|
||||
if bash "$tmp_bootstrap"; then
|
||||
# Update the last update timestamp
|
||||
|
||||
@@ -14,12 +14,10 @@ METASCRIPT_URL="https://git.adityagupta.dev/sortedcord/bootstrap/raw/branch/mast
|
||||
if [ -f "$METASCRIPT_LOCAL" ]; then
|
||||
. "$METASCRIPT_LOCAL"
|
||||
else
|
||||
if command -v wget >/dev/null 2>&1; then
|
||||
eval "$(wget -qO- "$METASCRIPT_URL")"
|
||||
elif command -v curl >/dev/null 2>&1; then
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
eval "$(curl -fsSL "$METASCRIPT_URL")"
|
||||
else
|
||||
echo "Error: Neither wget nor curl is installed to fetch bootstrap.sh." >&2
|
||||
echo "Error: curl is not installed to fetch bootstrap.sh." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
@@ -60,11 +58,7 @@ install_agy() {
|
||||
local manifest_url="$DOWNLOAD_BASE_URL/manifests/$platform.json"
|
||||
local manifest_json=""
|
||||
|
||||
if has_command curl; then
|
||||
manifest_json=$(curl -fsSL "$manifest_url" 2>/dev/null || true)
|
||||
elif has_command wget; then
|
||||
manifest_json=$(wget -qO- "$manifest_url" 2>/dev/null || true)
|
||||
fi
|
||||
|
||||
if [ -z "$manifest_json" ]; then
|
||||
log_error "Could not connect to the release server to download the manifest."
|
||||
@@ -112,11 +106,7 @@ install_agy() {
|
||||
fi
|
||||
|
||||
log_info "Downloading release package..."
|
||||
if has_command curl; then
|
||||
curl -fsSL "$url" -o "$staging_payload"
|
||||
else
|
||||
wget -qO "$staging_payload" "$url"
|
||||
fi
|
||||
|
||||
# Verify SHA512 Checksum
|
||||
local actual_hash
|
||||
|
||||
@@ -14,12 +14,10 @@ METASCRIPT_URL="https://git.adityagupta.dev/sortedcord/bootstrap/raw/branch/mast
|
||||
if [ -f "$METASCRIPT_LOCAL" ]; then
|
||||
. "$METASCRIPT_LOCAL"
|
||||
else
|
||||
if command -v wget >/dev/null 2>&1; then
|
||||
eval "$(wget -qO- "$METASCRIPT_URL")"
|
||||
elif command -v curl >/dev/null 2>&1; then
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
eval "$(curl -fsSL "$METASCRIPT_URL")"
|
||||
else
|
||||
echo "Error: Neither wget nor curl is installed to fetch bootstrap.sh." >&2
|
||||
echo "Error: curl is not installed to fetch bootstrap.sh." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
@@ -49,15 +47,11 @@ install_bat() {
|
||||
elif [ "$distro" = "debian" ]; then
|
||||
log_info "Debian/Ubuntu detected"
|
||||
|
||||
pkg_install curl wget
|
||||
pkg_install curl
|
||||
|
||||
log_info "Fetching latest Bat version from GitHub..."
|
||||
local latest_tag=""
|
||||
if has_command curl; then
|
||||
latest_tag=$(curl -sL https://api.github.com/repos/sharkdp/bat/releases/latest | grep '"tag_name":' | head -n1 | sed -E 's/.*"tag_name": "([^"]+)".*/\1/' || true)
|
||||
elif has_command wget; then
|
||||
latest_tag=$(wget -qO- https://api.github.com/repos/sharkdp/bat/releases/latest | grep '"tag_name":' | head -n1 | sed -E 's/.*"tag_name": "([^"]+)".*/\1/' || true)
|
||||
fi
|
||||
|
||||
if [ -z "$latest_tag" ]; then
|
||||
latest_tag="v0.26.1"
|
||||
@@ -79,11 +73,7 @@ install_bat() {
|
||||
|
||||
local deb_url="https://github.com/sharkdp/bat/releases/download/${latest_tag}/bat_${version}_${deb_arch}.deb"
|
||||
log_info "Downloading Bat from ${deb_url}..."
|
||||
if has_command curl; then
|
||||
curl -fsSL "$deb_url" -o "$TMP_DIR/bat.deb"
|
||||
else
|
||||
wget -qO "$TMP_DIR/bat.deb" "$deb_url"
|
||||
fi
|
||||
|
||||
log_info "Installing Bat package..."
|
||||
sudo apt install -y "$TMP_DIR/bat.deb"
|
||||
|
||||
@@ -14,12 +14,10 @@ METASCRIPT_URL="https://git.adityagupta.dev/sortedcord/bootstrap/raw/branch/mast
|
||||
if [ -f "$METASCRIPT_LOCAL" ]; then
|
||||
. "$METASCRIPT_LOCAL"
|
||||
else
|
||||
if command -v wget >/dev/null 2>&1; then
|
||||
eval "$(wget -qO- "$METASCRIPT_URL")"
|
||||
elif command -v curl >/dev/null 2>&1; then
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
eval "$(curl -fsSL "$METASCRIPT_URL")"
|
||||
else
|
||||
echo "Error: Neither wget nor curl is installed to fetch bootstrap.sh." >&2
|
||||
echo "Error: curl is not installed to fetch bootstrap.sh." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
@@ -46,11 +44,7 @@ install_nvm() {
|
||||
# Try to fetch the latest version of NVM from GitHub API
|
||||
log_info "Fetching the latest NVM version..."
|
||||
local latest_tag=""
|
||||
if has_command curl; then
|
||||
latest_tag=$(curl -sL https://api.github.com/repos/nvm-sh/nvm/releases/latest | grep '"tag_name":' | head -n1 | sed -E 's/.*"tag_name": "([^"]+)".*/\1/' || true)
|
||||
elif has_command wget; then
|
||||
latest_tag=$(wget -qO- https://api.github.com/repos/nvm-sh/nvm/releases/latest | grep '"tag_name":' | head -n1 | sed -E 's/.*"tag_name": "([^"]+)".*/\1/' || true)
|
||||
fi
|
||||
|
||||
if [ -z "$latest_tag" ]; then
|
||||
latest_tag="v0.40.5" # Fallback version if API request fails
|
||||
@@ -62,11 +56,7 @@ install_nvm() {
|
||||
local nvm_url="https://github.com/nvm-sh/nvm/archive/refs/tags/${latest_tag}.tar.gz"
|
||||
log_info "Downloading NVM from $nvm_url..."
|
||||
|
||||
if has_command curl; then
|
||||
curl -fsSL "$nvm_url" -o "$TMP_DIR/nvm.tar.gz"
|
||||
else
|
||||
wget -qO "$TMP_DIR/nvm.tar.gz" "$nvm_url"
|
||||
fi
|
||||
|
||||
log_info "Extracting NVM archive directly to $HOME/.nvm (stripping versioned subfolder to keep config generic)..."
|
||||
mkdir -p "$HOME/.nvm"
|
||||
|
||||
@@ -14,12 +14,10 @@ METASCRIPT_URL="https://git.adityagupta.dev/sortedcord/bootstrap/raw/branch/mast
|
||||
if [ -f "$METASCRIPT_LOCAL" ]; then
|
||||
. "$METASCRIPT_LOCAL"
|
||||
else
|
||||
if command -v wget >/dev/null 2>&1; then
|
||||
eval "$(wget -qO- "$METASCRIPT_URL")"
|
||||
elif command -v curl >/dev/null 2>&1; then
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
eval "$(curl -fsSL "$METASCRIPT_URL")"
|
||||
else
|
||||
echo "Error: Neither wget nor curl is installed to fetch bootstrap.sh." >&2
|
||||
echo "Error: curl is not installed to fetch bootstrap.sh." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
@@ -45,7 +43,7 @@ check_config_dir() {
|
||||
install_packages() {
|
||||
log_info "Detecting distribution and installing dependencies..."
|
||||
pkg_install \
|
||||
git wget tar curl unzip ripgrep fzf nodejs npm xclip wl-clipboard \
|
||||
git tar curl unzip ripgrep fzf nodejs npm xclip wl-clipboard \
|
||||
"arch:fd|debian:fd-find|fedora:fd-find" \
|
||||
"arch:cmake|debian:cmake|fedora:cmake" \
|
||||
"arch:make|debian:build-essential|fedora:make" \
|
||||
@@ -87,11 +85,7 @@ install_nvim() {
|
||||
local nvim_url="https://github.com/neovim/neovim/releases/download/v${NVIM_VERSION}/nvim-${nvim_arch}.tar.gz"
|
||||
|
||||
log_info "Downloading Neovim v${NVIM_VERSION} for ${arch}..."
|
||||
if has_command curl; then
|
||||
curl -fsSL "$nvim_url" -o "$TMP_DIR/nvim.tar.gz"
|
||||
else
|
||||
wget -qO "$TMP_DIR/nvim.tar.gz" "$nvim_url"
|
||||
fi
|
||||
|
||||
tar -xzf "$TMP_DIR/nvim.tar.gz" -C "$TMP_DIR"
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
# - Fedora/RHEL: dnf install -y libatomic
|
||||
#
|
||||
# Docker usage:
|
||||
# wget -qO- https://get.pnpm.io/install.sh | ENV="$HOME/.bashrc" SHELL="$(which bash)" bash -
|
||||
# curl -fsSL https://get.pnpm.io/install.sh | ENV="$HOME/.bashrc" SHELL="$(which bash)" bash -
|
||||
#
|
||||
|
||||
# Run metascript to check if the shell is bash and load libraries
|
||||
@@ -25,12 +25,10 @@ METASCRIPT_URL="https://git.adityagupta.dev/sortedcord/bootstrap/raw/branch/mast
|
||||
if [ -f "$METASCRIPT_LOCAL" ]; then
|
||||
. "$METASCRIPT_LOCAL"
|
||||
else
|
||||
if command -v wget >/dev/null 2>&1; then
|
||||
eval "$(wget -qO- "$METASCRIPT_URL")"
|
||||
elif command -v curl >/dev/null 2>&1; then
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
eval "$(curl -fsSL "$METASCRIPT_URL")"
|
||||
else
|
||||
echo "Error: Neither wget nor curl is installed to fetch bootstrap.sh." >&2
|
||||
echo "Error: curl is not installed to fetch bootstrap.sh." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
@@ -46,11 +44,7 @@ trap cleanup EXIT
|
||||
# ─── Helper Functions ─────────────────────────────────────────────────
|
||||
|
||||
download() {
|
||||
if has_command curl; then
|
||||
curl -fsSL "$1"
|
||||
else
|
||||
wget -qO- "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
is_glibc_compatible() {
|
||||
|
||||
@@ -14,22 +14,20 @@ METASCRIPT_URL="https://git.adityagupta.dev/sortedcord/bootstrap/raw/branch/mast
|
||||
if [ -f "$METASCRIPT_LOCAL" ]; then
|
||||
. "$METASCRIPT_LOCAL"
|
||||
else
|
||||
if command -v wget >/dev/null 2>&1; then
|
||||
eval "$(wget -qO- "$METASCRIPT_URL")"
|
||||
elif command -v curl >/dev/null 2>&1; then
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
eval "$(curl -fsSL "$METASCRIPT_URL")"
|
||||
else
|
||||
echo "Error: Neither wget nor curl is installed to fetch bootstrap.sh." >&2
|
||||
echo "Error: curl is not installed to fetch bootstrap.sh." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# Ensure we have curl or wget
|
||||
# Ensure we have curl
|
||||
install_downloader() {
|
||||
if ! has_command curl && ! has_command wget; then
|
||||
log_info "Neither curl nor wget found. Installing curl..."
|
||||
if ! has_command curl; then
|
||||
log_info "curl not found. Installing curl..."
|
||||
pkg_install curl
|
||||
fi
|
||||
}
|
||||
@@ -89,27 +87,7 @@ install_rust() {
|
||||
local dest="$tmpdir/rustup-init"
|
||||
|
||||
log_info "Downloading rustup-init..."
|
||||
# Check for snap curl issue (snap curl cannot write to /tmp/ due to sandbox)
|
||||
local use_wget=false
|
||||
if has_command curl; then
|
||||
local curl_path
|
||||
curl_path=$(command -v curl)
|
||||
if echo "$curl_path" | grep -q "/snap/"; then
|
||||
if has_command wget; then
|
||||
use_wget=true
|
||||
else
|
||||
log_warn "curl is installed via snap and may fail to write to temp directory."
|
||||
fi
|
||||
fi
|
||||
else
|
||||
use_wget=true
|
||||
fi
|
||||
|
||||
if [ "$use_wget" = true ]; then
|
||||
wget -qO "$dest" "$url"
|
||||
else
|
||||
curl -fsSL "$url" -o "$dest"
|
||||
fi
|
||||
curl -fsSL \"$url\" -o \"$dest\"| curl -fsSL \"$url\" -o \"$dest\"
|
||||
|
||||
chmod +x "$dest"
|
||||
|
||||
|
||||
@@ -14,12 +14,10 @@ METASCRIPT_URL="https://git.adityagupta.dev/sortedcord/bootstrap/raw/branch/mast
|
||||
if [ -f "$METASCRIPT_LOCAL" ]; then
|
||||
. "$METASCRIPT_LOCAL"
|
||||
else
|
||||
if command -v wget >/dev/null 2>&1; then
|
||||
eval "$(wget -qO- "$METASCRIPT_URL")"
|
||||
elif command -v curl >/dev/null 2>&1; then
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
eval "$(curl -fsSL "$METASCRIPT_URL")"
|
||||
else
|
||||
echo "Error: Neither wget nor curl is installed to fetch bootstrap.sh." >&2
|
||||
echo "Error: curl is not installed to fetch bootstrap.sh." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
@@ -37,9 +35,9 @@ install_starship() {
|
||||
log_info "Starship is already installed."
|
||||
fi
|
||||
|
||||
# Ensure curl or wget is installed
|
||||
if ! has_command curl && ! has_command wget; then
|
||||
log_info "curl or wget not found. Installing curl..."
|
||||
# Ensure curl is installed
|
||||
if ! has_command curl; then
|
||||
log_info "curl not found. Installing curl..."
|
||||
pkg_install curl
|
||||
fi
|
||||
|
||||
@@ -57,11 +55,7 @@ install_starship() {
|
||||
|
||||
log_info "Fetching latest Starship version from GitHub..."
|
||||
local latest_tag=""
|
||||
if has_command curl; then
|
||||
latest_tag=$(curl -sL https://api.github.com/repos/starship/starship/releases/latest | grep '"tag_name":' | head -n1 | sed -E 's/.*"tag_name": "([^"]+)".*/\1/' || true)
|
||||
elif has_command wget; then
|
||||
latest_tag=$(wget -qO- https://api.github.com/repos/starship/starship/releases/latest | grep '"tag_name":' | head -n1 | sed -E 's/.*"tag_name": "([^"]+)".*/\1/' || true)
|
||||
fi
|
||||
|
||||
local download_url
|
||||
if [ -n "$latest_tag" ]; then
|
||||
@@ -75,11 +69,7 @@ install_starship() {
|
||||
|
||||
log_info "Downloading Starship from ${download_url}..."
|
||||
local archive="$TMP_DIR/starship.tar.gz"
|
||||
if has_command curl; then
|
||||
curl -fsSL "$download_url" -o "$archive"
|
||||
else
|
||||
wget -qO "$archive" "$download_url"
|
||||
fi
|
||||
|
||||
# Extract the binary
|
||||
log_info "Extracting Starship binary..."
|
||||
|
||||
@@ -14,12 +14,10 @@ METASCRIPT_URL="https://git.adityagupta.dev/sortedcord/bootstrap/raw/branch/mast
|
||||
if [ -f "$METASCRIPT_LOCAL" ]; then
|
||||
. "$METASCRIPT_LOCAL"
|
||||
else
|
||||
if command -v wget >/dev/null 2>&1; then
|
||||
eval "$(wget -qO- "$METASCRIPT_URL")"
|
||||
elif command -v curl >/dev/null 2>&1; then
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
eval "$(curl -fsSL "$METASCRIPT_URL")"
|
||||
else
|
||||
echo "Error: Neither wget nor curl is installed to fetch bootstrap.sh." >&2
|
||||
echo "Error: curl is not installed to fetch bootstrap.sh." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
@@ -40,9 +38,9 @@ install_uv() {
|
||||
fi
|
||||
fi
|
||||
|
||||
# Ensure curl or wget is installed
|
||||
if ! has_command curl && ! has_command wget; then
|
||||
log_info "curl or wget not found. Installing curl..."
|
||||
# Ensure curl is installed
|
||||
if ! has_command curl; then
|
||||
log_info "curl not found. Installing curl..."
|
||||
pkg_install curl
|
||||
fi
|
||||
|
||||
@@ -66,11 +64,7 @@ install_uv() {
|
||||
|
||||
log_info "Fetching latest uv version from GitHub..."
|
||||
local latest_tag=""
|
||||
if has_command curl; then
|
||||
latest_tag=$(curl -sL https://api.github.com/repos/astral-sh/uv/releases/latest | grep '"tag_name":' | head -n1 | sed -E 's/.*"tag_name": "([^"]+)".*/\1/' || true)
|
||||
elif has_command wget; then
|
||||
latest_tag=$(wget -qO- https://api.github.com/repos/astral-sh/uv/releases/latest | grep '"tag_name":' | head -n1 | sed -E 's/.*"tag_name": "([^"]+)".*/\1/' || true)
|
||||
fi
|
||||
|
||||
local download_url
|
||||
if [ -n "$latest_tag" ]; then
|
||||
@@ -84,11 +78,7 @@ install_uv() {
|
||||
|
||||
log_info "Downloading uv from ${download_url}..."
|
||||
local archive="$TMP_DIR/uv.tar.gz"
|
||||
if has_command curl; then
|
||||
curl -fsSL "$download_url" -o "$archive"
|
||||
else
|
||||
wget -qO "$archive" "$download_url"
|
||||
fi
|
||||
|
||||
# Extract the binaries
|
||||
log_info "Extracting uv binaries..."
|
||||
|
||||
@@ -14,12 +14,10 @@ METASCRIPT_URL="https://git.adityagupta.dev/sortedcord/bootstrap/raw/branch/mast
|
||||
if [ -f "$METASCRIPT_LOCAL" ]; then
|
||||
. "$METASCRIPT_LOCAL"
|
||||
else
|
||||
if command -v wget >/dev/null 2>&1; then
|
||||
eval "$(wget -qO- "$METASCRIPT_URL")"
|
||||
elif command -v curl >/dev/null 2>&1; then
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
eval "$(curl -fsSL "$METASCRIPT_URL")"
|
||||
else
|
||||
echo "Error: Neither wget nor curl is installed to fetch bootstrap.sh." >&2
|
||||
echo "Error: curl is not installed to fetch bootstrap.sh." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -14,12 +14,10 @@ METASCRIPT_URL="https://git.adityagupta.dev/sortedcord/bootstrap/raw/branch/mast
|
||||
if [ -f "$METASCRIPT_LOCAL" ]; then
|
||||
. "$METASCRIPT_LOCAL"
|
||||
else
|
||||
if command -v wget >/dev/null 2>&1; then
|
||||
eval "$(wget -qO- "$METASCRIPT_URL")"
|
||||
elif command -v curl >/dev/null 2>&1; then
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
eval "$(curl -fsSL "$METASCRIPT_URL")"
|
||||
else
|
||||
echo "Error: Neither wget nor curl is installed to fetch bootstrap.sh." >&2
|
||||
echo "Error: curl is not installed to fetch bootstrap.sh." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
@@ -82,7 +80,7 @@ install_yazi() {
|
||||
log_info "Yazi is already installed."
|
||||
fi
|
||||
|
||||
pkg_install curl wget git
|
||||
pkg_install curl git
|
||||
|
||||
log_info "Fetching latest Yazi version from GitHub..."
|
||||
local latest_tag
|
||||
@@ -93,11 +91,7 @@ install_yazi() {
|
||||
|
||||
local deb_url="https://github.com/sxyazi/yazi/releases/download/${latest_tag}/yazi-x86_64-unknown-linux-gnu.deb"
|
||||
log_info "Downloading Yazi ${latest_tag} from ${deb_url}..."
|
||||
if has_command curl; then
|
||||
curl -fsSL "$deb_url" -o "$TMP_DIR/yazi.deb"
|
||||
else
|
||||
wget -qO "$TMP_DIR/yazi.deb" "$deb_url"
|
||||
fi
|
||||
|
||||
log_info "Installing Yazi package..."
|
||||
sudo apt install -y "$TMP_DIR/yazi.deb"
|
||||
|
||||
@@ -14,12 +14,10 @@ METASCRIPT_URL="https://git.adityagupta.dev/sortedcord/bootstrap/raw/branch/mast
|
||||
if [ -f "$METASCRIPT_LOCAL" ]; then
|
||||
. "$METASCRIPT_LOCAL"
|
||||
else
|
||||
if command -v wget >/dev/null 2>&1; then
|
||||
eval "$(wget -qO- "$METASCRIPT_URL")"
|
||||
elif command -v curl >/dev/null 2>&1; then
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
eval "$(curl -fsSL "$METASCRIPT_URL")"
|
||||
else
|
||||
echo "Error: Neither wget nor curl is installed to fetch bootstrap.sh." >&2
|
||||
echo "Error: curl is not installed to fetch bootstrap.sh." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -27,13 +27,8 @@ else
|
||||
_tmp_registry=$(mktemp)
|
||||
BOOTSTRAP_BASE_URL="${BOOTSTRAP_BASE_URL:-https://git.adityagupta.dev/sortedcord/bootstrap/raw/branch/master}"
|
||||
BOOTSTRAP_FALLBACK_URL="${BOOTSTRAP_FALLBACK_URL:-https://raw.githubusercontent.com/sortedcord/bootstrap/refs/heads/master}"
|
||||
if has_command curl; then
|
||||
curl -fsSL "${BOOTSTRAP_BASE_URL}/lib/registry.sh" -o "$_tmp_registry" 2>/dev/null || \
|
||||
curl -fsSL "${BOOTSTRAP_FALLBACK_URL}/lib/registry.sh" -o "$_tmp_registry" 2>/dev/null
|
||||
elif has_command wget; then
|
||||
wget -qO "$_tmp_registry" "${BOOTSTRAP_BASE_URL}/lib/registry.sh" 2>/dev/null || \
|
||||
wget -qO "$_tmp_registry" "${BOOTSTRAP_FALLBACK_URL}/lib/registry.sh" 2>/dev/null
|
||||
fi
|
||||
curl -fsSL "${BOOTSTRAP_BASE_URL}/lib/registry.sh" -o "$_tmp_registry" 2>/dev/null || \
|
||||
curl -fsSL "${BOOTSTRAP_FALLBACK_URL}/lib/registry.sh" -o "$_tmp_registry" 2>/dev/null
|
||||
if [ -s "$_tmp_registry" ]; then
|
||||
. "$_tmp_registry"
|
||||
else
|
||||
@@ -81,26 +76,12 @@ run_ware() {
|
||||
local download_status=0
|
||||
|
||||
log_info "Downloading ${display_name} installer..."
|
||||
if has_command curl; then
|
||||
curl -fsSL "${BOOTSTRAP_BASE_URL}/${installer_path}" -o "$temp_script"
|
||||
curl -fsSL "${BOOTSTRAP_BASE_URL}/${installer_path}" -o "$temp_script"
|
||||
download_status=$?
|
||||
if [ "$download_status" -ne 0 ]; then
|
||||
log_warn "Failed to download installer from primary URL, trying fallback..."
|
||||
curl -fsSL "${BOOTSTRAP_FALLBACK_URL}/${installer_path}" -o "$temp_script"
|
||||
download_status=$?
|
||||
if [ "$download_status" -ne 0 ]; then
|
||||
log_warn "Failed to download installer from primary URL, trying fallback..."
|
||||
curl -fsSL "${BOOTSTRAP_FALLBACK_URL}/${installer_path}" -o "$temp_script"
|
||||
download_status=$?
|
||||
fi
|
||||
elif has_command wget; then
|
||||
wget -qO "$temp_script" "${BOOTSTRAP_BASE_URL}/${installer_path}"
|
||||
download_status=$?
|
||||
if [ "$download_status" -ne 0 ]; then
|
||||
log_warn "Failed to download installer from primary URL, trying fallback..."
|
||||
wget -qO "$temp_script" "${BOOTSTRAP_FALLBACK_URL}/${installer_path}"
|
||||
download_status=$?
|
||||
fi
|
||||
else
|
||||
log_error "Neither curl nor wget is installed to download the installer."
|
||||
rm -f "$temp_script"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$download_status" -ne 0 ]; then
|
||||
|
||||
Reference in New Issue
Block a user