@@ -22,8 +22,6 @@ export https_proxy=http://your-proxy.com:913
2222export http_proxy=http://your-proxy.com:913
2323export no_proxy=127.0.0.1
2424
25- WGET=" wget --no-check-certificate"
26-
2725if [ " $( 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
3735exec > >( 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+
3943echo -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
4550fi
4651
52+ apt update
53+
4754# Install kernel
4855# === Config ===
4956TARGET_VERSION=" 6.14.0-15-generic"
@@ -57,33 +64,23 @@ CURRENT_VERSION="$(uname -r)"
5764echo " Current running kernel: $CURRENT_VERSION "
5865echo " 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."
8784fi
8885
8986# === Check GRUB top-level menu for target kernel ===
150147fi
151148
152149update-initramfs -u
150+ rm -rf $WORK_DIR
153151echo -e " ✅ Update GPU firmware successfully"
154152
155153echo -e " \n[INFO] Disabling intel_iommu..."
@@ -163,7 +161,36 @@ else
163161 exit 1
164162fi
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
169196echo -e " \n✅ [DONE] Environment setup complete. Please reboot your system to apply changes."
0 commit comments