Skip to content

Commit 72f6e1a

Browse files
authored
Merge pull request #29 from james-tang17/hot-fix-ww32
Add docker repo and fix bug for early exit with target kernel installed
2 parents 84f3771 + 248658c commit 72f6e1a

File tree

1 file changed

+51
-24
lines changed

1 file changed

+51
-24
lines changed

vllm/tools/native_bkc_setup.sh

Lines changed: 51 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ export https_proxy=http://your-proxy.com:913
2222
export http_proxy=http://your-proxy.com:913
2323
export no_proxy=127.0.0.1
2424

25-
WGET="wget --no-check-certificate"
26-
2725
if [ "$(id -u)" -ne 0 ]; then
2826
echo "[ERROR] This script must be run as root. Exiting."
2927
exit 1
@@ -35,15 +33,24 @@ trap 'echo "[ERROR] Script failed at line $LINENO."' ERR
3533

3634
# Output both to terminal and log file
3735
exec > >(tee -i /var/log/multi_arc_setup_env.log) 2>&1
38-
36+
37+
if [[ "$http_proxy" == "http://your-proxy.com:913" ]] || [[ "$https_proxy" == "http://your-proxy.com:913" ]]; then
38+
echo "[ERROR] Proxy environment variables http_proxy or https_proxy are still set to default placeholder values."
39+
echo "Please update them to your actual proxy before running this script."
40+
exit 1
41+
fi
42+
3943
echo -e "\n[INFO] Starting environment setup..."
4044

4145
# Internet access check
42-
echo "[INFO] Testing internet access to www.google.com ..."
43-
if ! curl -s --connect-timeout 10 https://www.bing.com >/dev/null; then
44-
echo "[WARNING] Internet access through proxy may be unavailable."
46+
echo "[INFO] Testing internet access to www.bing.com ..."
47+
if ! wget -q --spider --timeout=10 https://www.bing.com; then
48+
echo "[WARNING] Internet access through proxy may be unavailable. Check your connection!"
49+
exit 1
4550
fi
4651

52+
apt update
53+
4754
# Install kernel
4855
# === Config ===
4956
TARGET_VERSION="6.14.0-15-generic"
@@ -57,33 +64,23 @@ CURRENT_VERSION="$(uname -r)"
5764
echo "Current running kernel: $CURRENT_VERSION"
5865
echo "Target kernel version: $TARGET_VERSION"
5966

60-
if [[ "$CURRENT_VERSION" == "$TARGET_VERSION" ]]; then
61-
echo "✅ Already running the target kernel. No changes needed."
62-
exit 0
63-
fi
64-
65-
# === Check if target kernel is installed ===
66-
if [[ ! -d "/lib/modules/$TARGET_VERSION" ]]; then
67-
echo "⚠️ Target kernel is not installed. Installing..."
68-
69-
apt update
70-
67+
if dpkg -s "linux-image-${TARGET_VERSION}" >/dev/null 2>&1; then
68+
echo "Kernel ${TARGET_VERSION} installed, skip..."
69+
else
70+
echo "Kernel ${TARGET_VERSION} not installed, start installation..."
7171
for pkg in \
7272
"linux-image-$TARGET_VERSION" \
7373
"linux-headers-$TARGET_VERSION" \
7474
"linux-modules-$TARGET_VERSION" \
75-
"linux-modules-extra-$TARGET_VERSION"; do
76-
75+
"linux-modules-extra-$TARGET_VERSION";
76+
do
7777
echo "Installing $pkg ..."
7878
if ! apt install -y "$pkg"; then
7979
echo "❌ Failed to install $pkg. Check repository or kernel version."
8080
exit 1
8181
fi
8282
done
83-
8483
echo "✅ Kernel $TARGET_VERSION installed successfully."
85-
else
86-
echo "✅ Target kernel is already installed."
8784
fi
8885

8986
# === Check GRUB top-level menu for target kernel ===
@@ -150,6 +147,7 @@ else
150147
fi
151148

152149
update-initramfs -u
150+
rm -rf $WORK_DIR
153151
echo -e "✅ Update GPU firmware successfully"
154152

155153
echo -e "\n[INFO] Disabling intel_iommu..."
@@ -163,7 +161,36 @@ else
163161
exit 1
164162
fi
165163

166-
# Install docker environment
167-
apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
164+
# Check if Docker is already installed
165+
if command -v docker >/dev/null 2>&1; then
166+
echo "[INFO] Docker is already installed. Skipping installation."
167+
else
168+
echo "[INFO] Docker is not installed. Starting installation..."
169+
170+
# Add Docker GPG key if not present
171+
if [ ! -f /etc/apt/keyrings/docker.asc ]; then
172+
echo "[INFO] Adding Docker GPG key..."
173+
apt-get install -y ca-certificates curl
174+
install -m 0755 -d /etc/apt/keyrings
175+
curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
176+
chmod a+r /etc/apt/keyrings/docker.asc
177+
fi
178+
179+
# Add Docker repository if not present
180+
if [ ! -f /etc/apt/sources.list.d/docker.list ]; then
181+
echo "[INFO] Adding Docker repository..."
182+
echo \
183+
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
184+
$(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \
185+
tee /etc/apt/sources.list.d/docker.list > /dev/null
186+
apt-get update
187+
fi
188+
189+
# Install Docker packages
190+
echo "[INFO] Installing Docker..."
191+
apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
192+
193+
echo "[INFO] Docker installation completed successfully."
194+
fi
168195

169196
echo -e "\n✅ [DONE] Environment setup complete. Please reboot your system to apply changes."

0 commit comments

Comments
 (0)