Spaces:
Sleeping
Sleeping
File size: 11,781 Bytes
01d5a5d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 |
#!/bin/bash
# Installation recommendations configuration
# Import logging utilities if not already imported
if ! command -v log_warning &>/dev/null; then
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/logging.sh"
fi
# Get installation recommendation for a package
get_install_recommendation() {
local package="$1"
local system_id="$2"
case "$package" in
"python")
get_python_recommendation "$system_id"
;;
"npm")
get_npm_recommendation "$system_id"
;;
"node")
get_node_recommendation "$system_id"
;;
"cmake")
get_cmake_recommendation "$system_id"
;;
"poetry")
get_poetry_recommendation "$system_id"
;;
"sqlite")
get_sqlite_recommendation "$system_id"
;;
*)
log_warning "No specific recommendation available for $package"
;;
esac
}
# Python installation recommendations
get_python_recommendation() {
local system_id="$1"
case "$system_id" in
"macos")
log_warning "Recommended installation for macOS: 'brew install python3'"
log_warning "Or download from: https://www.python.org/downloads/macos/"
;;
"linux-debian")
log_warning "Recommended installation for Debian/Ubuntu: 'sudo apt update && sudo apt install python3 python3-pip'"
;;
"linux-fedora")
log_warning "Recommended installation for Fedora: 'sudo dnf install python3 python3-pip'"
;;
"linux-redhat")
log_warning "Recommended installation for CentOS/RHEL: 'sudo yum install python3 python3-pip'"
;;
"linux-arch")
log_warning "Recommended installation for Arch Linux: 'sudo pacman -S python python-pip'"
;;
"linux-alpine")
log_warning "Recommended installation for Alpine Linux: 'apk add python3 py3-pip'"
;;
"linux-other")
log_warning "Please install Python 3.12+ using your distribution's package manager"
log_warning "Or download from: https://www.python.org/downloads/linux/"
;;
"windows")
log_warning "Recommended installation for Windows:"
log_warning "1. Download from: https://www.python.org/downloads/windows/"
log_warning "2. Or using winget: 'winget install Python.Python.3'"
log_warning "3. Or using Chocolatey: 'choco install python'"
;;
*)
log_warning "Please download Python from: https://www.python.org/downloads/"
;;
esac
}
# NPM installation recommendations
get_npm_recommendation() {
local system_id="$1"
case "$system_id" in
"macos")
log_warning "Recommended installation for macOS: 'brew install npm'"
;;
"linux-debian")
log_warning "Recommended installation for Debian/Ubuntu: 'sudo apt update && sudo apt install npm'"
;;
"linux-fedora")
log_warning "Recommended installation for Fedora: 'sudo dnf install npm'"
;;
"linux-redhat")
log_warning "Recommended installation for CentOS/RHEL: 'sudo yum install npm'"
;;
"linux-arch")
log_warning "Recommended installation for Arch Linux: 'sudo pacman -S npm'"
;;
"linux-alpine")
log_warning "Recommended installation for Alpine Linux: 'apk add npm'"
;;
"linux-other")
log_warning "Please install npm using your distribution's package manager"
;;
"windows")
log_warning "Recommended installation for Windows:"
log_warning "1. Install Node.js (includes npm): https://nodejs.org/en/download/"
log_warning "2. Or using winget: 'winget install OpenJS.NodeJS'"
log_warning "3. Or using Chocolatey: 'choco install nodejs'"
;;
*)
log_warning "Please install Node.js (includes npm): https://nodejs.org/en/download/"
;;
esac
}
# Node.js installation recommendations
get_node_recommendation() {
local system_id="$1"
case "$system_id" in
"macos")
log_warning "Recommended installation for macOS: 'brew install node'"
;;
"linux-debian")
log_warning "Recommended installation for Debian/Ubuntu: 'sudo apt update && sudo apt install nodejs'"
;;
"linux-fedora")
log_warning "Recommended installation for Fedora: 'sudo dnf install nodejs'"
;;
"linux-redhat")
log_warning "Recommended installation for CentOS/RHEL: 'sudo yum install nodejs'"
;;
"linux-arch")
log_warning "Recommended installation for Arch Linux: 'sudo pacman -S nodejs'"
;;
"linux-alpine")
log_warning "Recommended installation for Alpine Linux: 'apk add nodejs'"
;;
"linux-other")
log_warning "Please install Node.js using your distribution's package manager"
;;
"windows")
log_warning "Recommended installation for Windows:"
log_warning "1. Download from: https://nodejs.org/en/download/"
log_warning "2. Or using winget: 'winget install OpenJS.NodeJS'"
log_warning "3. Or using Chocolatey: 'choco install nodejs'"
;;
*)
log_warning "Please download Node.js from: https://nodejs.org/en/download/"
;;
esac
}
# CMake installation recommendations
get_cmake_recommendation() {
local system_id="$1"
case "$system_id" in
"macos")
log_warning "Recommended installation for macOS: 'brew install cmake'"
;;
"linux-debian")
log_warning "Recommended installation for Debian/Ubuntu: 'sudo apt update && sudo apt install cmake'"
;;
"linux-fedora")
log_warning "Recommended installation for Fedora: 'sudo dnf install cmake'"
;;
"linux-redhat")
log_warning "Recommended installation for CentOS/RHEL: 'sudo yum install cmake'"
;;
"linux-arch")
log_warning "Recommended installation for Arch Linux: 'sudo pacman -S cmake'"
;;
"linux-alpine")
log_warning "Recommended installation for Alpine Linux: 'apk add cmake'"
;;
"linux-other")
log_warning "Please install CMake using your distribution's package manager"
log_warning "Or download from: https://cmake.org/download/"
;;
"windows")
log_warning "Recommended installation for Windows:"
log_warning "1. Download from: https://cmake.org/download/"
log_warning "2. Or using winget: 'winget install Kitware.CMake'"
log_warning "3. Or using Chocolatey: 'choco install cmake'"
;;
*)
log_warning "Please download CMake from: https://cmake.org/download/"
;;
esac
}
# Poetry installation recommendations
get_poetry_recommendation() {
local system_id="$1"
case "$system_id" in
"macos")
log_warning "Recommended installation for macOS:"
log_warning "1. 'brew install poetry'"
log_warning "2. Or using the official installer: 'curl -sSL https://install.python-poetry.org | python3 -'"
;;
"linux-debian")
log_warning "Recommended installation for Debian/Ubuntu:"
log_warning "1. Using pipx (recommended): 'sudo apt install pipx && pipx install poetry'"
log_warning "2. Or using the official installer in your home directory:"
log_warning " 'curl -sSL https://install.python-poetry.org | python3 -'"
log_warning "3. Or in a virtual environment:"
log_warning " 'python3 -m venv ~/.poetry-venv && ~/.poetry-venv/bin/pip install poetry'"
log_warning " Then add ~/.poetry-venv/bin to your PATH"
;;
"linux-fedora")
log_warning "Recommended installation for Fedora:"
log_warning "1. 'sudo dnf install poetry'"
log_warning "2. Or using the official installer: 'curl -sSL https://install.python-poetry.org | python3 -'"
;;
"linux-redhat")
log_warning "Recommended installation for CentOS/RHEL:"
log_warning "1. Using the official installer: 'curl -sSL https://install.python-poetry.org | python3 -'"
;;
"linux-arch")
log_warning "Recommended installation for Arch Linux:"
log_warning "1. 'sudo pacman -S python-poetry'"
;;
"linux-alpine")
log_warning "Recommended installation for Alpine Linux:"
log_warning "1. 'apk add py3-poetry'"
log_warning "2. Or using the official installer: 'curl -sSL https://install.python-poetry.org | python3 -'"
;;
"linux-other")
log_warning "Recommended installation for Linux:"
log_warning "1. Using the official installer: 'curl -sSL https://install.python-poetry.org | python3 -'"
;;
"windows")
log_warning "Recommended installation for Windows:"
log_warning "1. Using PowerShell: '(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | python -'"
log_warning "2. Or using Chocolatey: 'choco install poetry'"
;;
*)
log_warning "Please install Poetry using the official installer:"
log_warning "curl -sSL https://install.python-poetry.org | python3 -"
;;
esac
}
# SQLite installation recommendations
get_sqlite_recommendation() {
local system_id="$1"
case "$system_id" in
"macos")
log_warning "Recommended installation for SQLite on macOS:"
log_warning "1. 'brew install sqlite'"
log_warning "SQLite is usually pre-installed on macOS, but this will ensure you have the latest version."
;;
"linux-debian")
log_warning "Recommended installation for SQLite on Debian/Ubuntu:"
log_warning "1. 'sudo apt update && sudo apt install sqlite3'"
;;
"linux-fedora")
log_warning "Recommended installation for SQLite on Fedora:"
log_warning "1. 'sudo dnf install sqlite'"
;;
"linux-redhat")
log_warning "Recommended installation for SQLite on CentOS/RHEL:"
log_warning "1. 'sudo yum install sqlite'"
;;
"linux-arch")
log_warning "Recommended installation for SQLite on Arch Linux:"
log_warning "1. 'sudo pacman -S sqlite'"
;;
"linux-alpine")
log_warning "Recommended installation for SQLite on Alpine Linux:"
log_warning "1. 'apk add sqlite'"
;;
"linux-other")
log_warning "Recommended installation for SQLite on Linux:"
log_warning "Please install SQLite using your distribution's package manager"
;;
"windows")
log_warning "Recommended installation for SQLite on Windows:"
log_warning "1. Download from: https://www.sqlite.org/download.html"
log_warning "2. Or using Chocolatey: 'choco install sqlite'"
;;
*)
log_warning "Please download SQLite from: https://www.sqlite.org/download.html"
;;
esac
}
|