

























@@ -577,17 +577,31 @@ is_arch_linux() {
577577return 1
578578}
579579580+apt_get() {
581+if is_root; then
582+ env DEBIAN_FRONTEND="${DEBIAN_FRONTEND:-noninteractive}" NEEDRESTART_MODE="${NEEDRESTART_MODE:-a}" apt-get "$@"
583+else
584+ sudo env DEBIAN_FRONTEND="${DEBIAN_FRONTEND:-noninteractive}" NEEDRESTART_MODE="${NEEDRESTART_MODE:-a}" apt-get "$@"
585+fi
586+}
587+588+apt_get_update() {
589+ apt_get update -qq
590+}
591+592+apt_get_install() {
593+ apt_get install -y -qq \
594+ -o Dpkg::Options::=--force-confdef \
595+ -o Dpkg::Options::=--force-confold \
596+"$@"
597+}
598+580599install_build_tools_linux() {
581600 require_sudo
582601583602if command -v apt-get &> /dev/null; then
584-if is_root; then
585- run_quiet_step "Updating package index" apt-get update -qq
586- run_quiet_step "Installing build tools" apt-get install -y -qq build-essential python3 make g++ cmake
587-else
588- run_quiet_step "Updating package index" sudo apt-get update -qq
589- run_quiet_step "Installing build tools" sudo apt-get install -y -qq build-essential python3 make g++ cmake
590-fi
603+ run_quiet_step "Updating package index" apt_get_update
604+ run_quiet_step "Installing build tools" apt_get_install build-essential python3 make g++ cmake
591605return 0
592606fi
593607@@ -1446,10 +1460,10 @@ install_node() {
14461460 run_quiet_step "Downloading NodeSource setup script" download_file "https://deb.nodesource.com/setup_${NODE_DEFAULT_MAJOR}.x" "$tmp"
14471461if is_root; then
14481462 run_quiet_step "Configuring NodeSource repository" bash "$tmp"
1449- run_quiet_step "Installing Node.js" apt-get install -y -qq nodejs
1463+ run_quiet_step "Installing Node.js" apt_get_install nodejs
14501464else
14511465 run_quiet_step "Configuring NodeSource repository" sudo -E bash "$tmp"
1452- run_quiet_step "Installing Node.js" sudo apt-get install -y -qq nodejs
1466+ run_quiet_step "Installing Node.js" apt_get_install nodejs
14531467fi
14541468elif command -v dnf &> /dev/null; then
14551469local tmp
@@ -1536,13 +1550,8 @@ install_git() {
15361550elif [[ "$OS" == "linux" ]]; then
15371551 require_sudo
15381552if command -v apt-get &> /dev/null; then
1539-if is_root; then
1540- run_quiet_step "Updating package index" apt-get update -qq
1541- run_quiet_step "Installing Git" apt-get install -y -qq git
1542-else
1543- run_quiet_step "Updating package index" sudo apt-get update -qq
1544- run_quiet_step "Installing Git" sudo apt-get install -y -qq git
1545-fi
1553+ run_quiet_step "Updating package index" apt_get_update
1554+ run_quiet_step "Installing Git" apt_get_install git
15461555elif command -v pacman &> /dev/null || is_arch_linux; then
15471556if is_root; then
15481557 run_quiet_step "Installing Git" pacman -Sy --noconfirm git
@@ -2283,6 +2292,11 @@ main() {
22832292 print_gum_status
22842293 detect_os_or_die
228522942295+if [[ "$OS" == "linux" ]]; then
2296+export DEBIAN_FRONTEND="${DEBIAN_FRONTEND:-noninteractive}"
2297+export NEEDRESTART_MODE="${NEEDRESTART_MODE:-a}"
2298+fi
2299+22862300local detected_checkout=""
22872301 detected_checkout="$(detect_openclaw_checkout "$PWD" || true)"
22882302此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。