bash 安装无需重启弹出窗口

bash 安装无需重启弹出窗口

Ubuntu 22.04 上的 Bash 脚本位于底部。安装时,它不断弹出重新启动服务的窗口,您可以看到我尝试了不少方法。

sudo apt update -y 

sudo apt install -y libgl1

似乎是问题脚本。下面是一张图片:

重启请求

#!/bin/bash

# Create a policy-rc.d script to prevent services from being automatically started/restarted
echo '#!/bin/sh' | sudo tee /usr/sbin/policy-rc.d > /dev/null
echo 'exit 101' | sudo tee -a /usr/sbin/policy-rc.d > /dev/null
sudo chmod +x /usr/sbin/policy-rc.d

# Set environment variables to make apt non-interactive
export DEBIAN_FRONTEND=noninteractive
export DEBCONF_NONINTERACTIVE_SEEN=true

echo "Updating the package list..."
sudo apt update -y

echo "Installing python3-pip..."
sudo apt install -y python3-pip

echo "Installing libgl1..."
sudo apt install -y libgl1

# Remove the policy-rc.d script to allow services to be started/restarted again
sudo rm /usr/sbin/policy-rc.d

echo "Restarting services using outdated libraries..."
sudo needrestart -r a

相关内容