Fix input redirection for quiet command execution and Python version check in installer script
This commit is contained in:
+5
-6
@@ -27,7 +27,7 @@ log_error() { echo -e "${RED}[err]${NC} $1"; exit 1; }
|
|||||||
run_quiet() {
|
run_quiet() {
|
||||||
local _log
|
local _log
|
||||||
_log="$(mktemp /tmp/lwc-cmd.XXXXXX.log)"
|
_log="$(mktemp /tmp/lwc-cmd.XXXXXX.log)"
|
||||||
if "$@" > "$_log" 2>&1; then
|
if "$@" </dev/null >"$_log" 2>&1; then
|
||||||
rm -f "$_log"
|
rm -f "$_log"
|
||||||
else
|
else
|
||||||
cat "$_log" >&2
|
cat "$_log" >&2
|
||||||
@@ -155,13 +155,12 @@ install_uv() {
|
|||||||
|
|
||||||
check_python() {
|
check_python() {
|
||||||
log_info "Checking Python $PYTHON_VERSION..."
|
log_info "Checking Python $PYTHON_VERSION..."
|
||||||
if "$UV_CMD" python find "$PYTHON_VERSION" &>/dev/null; then
|
if "$UV_CMD" python find "$PYTHON_VERSION" </dev/null &>/dev/null; then
|
||||||
local ver
|
local ver
|
||||||
ver="$("$UV_CMD" python find "$PYTHON_VERSION" | xargs -I{} {} --version 2>&1)"
|
ver="$("$UV_CMD" python find "$PYTHON_VERSION" </dev/null | xargs -I{} {} --version 2>&1)"
|
||||||
log_success "$ver found"
|
log_success "$ver found"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
# uv умеет скачивать и изолировать нужную версию Python без sudo
|
|
||||||
log_info "Installing Python $PYTHON_VERSION via uv..."
|
log_info "Installing Python $PYTHON_VERSION via uv..."
|
||||||
run_quiet "$UV_CMD" python install "$PYTHON_VERSION" || log_error "Failed to install Python $PYTHON_VERSION"
|
run_quiet "$UV_CMD" python install "$PYTHON_VERSION" || log_error "Failed to install Python $PYTHON_VERSION"
|
||||||
log_success "Python $PYTHON_VERSION installed"
|
log_success "Python $PYTHON_VERSION installed"
|
||||||
@@ -181,7 +180,7 @@ resolve_install_dir() {
|
|||||||
# Repo already cloned — pull instead of re-clone
|
# Repo already cloned — pull instead of re-clone
|
||||||
if [ -d "$INSTALL_DIR/.git" ]; then
|
if [ -d "$INSTALL_DIR/.git" ]; then
|
||||||
log_info "Repo already exists at $INSTALL_DIR — pulling latest..."
|
log_info "Repo already exists at $INSTALL_DIR — pulling latest..."
|
||||||
git -C "$INSTALL_DIR" pull --ff-only origin dev \
|
git -C "$INSTALL_DIR" pull --ff-only origin dev </dev/null \
|
||||||
&& log_success "Repo updated" \
|
&& log_success "Repo updated" \
|
||||||
|| log_warn "Could not pull latest — using existing version"
|
|| log_warn "Could not pull latest — using existing version"
|
||||||
return
|
return
|
||||||
@@ -195,7 +194,7 @@ resolve_install_dir() {
|
|||||||
|
|
||||||
log_info "Cloning repo into $INSTALL_DIR..."
|
log_info "Cloning repo into $INSTALL_DIR..."
|
||||||
mkdir -p "$(dirname "$INSTALL_DIR")"
|
mkdir -p "$(dirname "$INSTALL_DIR")"
|
||||||
git clone --branch dev "$REPO_URL" "$INSTALL_DIR" \
|
git clone --branch dev "$REPO_URL" "$INSTALL_DIR" </dev/null \
|
||||||
|| log_error "Failed to clone repo from $REPO_URL"
|
|| log_error "Failed to clone repo from $REPO_URL"
|
||||||
log_success "Repo cloned to $INSTALL_DIR"
|
log_success "Repo cloned to $INSTALL_DIR"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user