bash – 如何在没有用户交互的情况下使用APT安装软件包?
发布时间:2020-12-15 18:36:30 所属栏目:安全 来源:网络整理
导读:我有一个脚本,可以在Debian squeeze中下载并替换内核头文件. function fixHeaders(){ #Replace the kernel headers from OVH with standard kernel headers... aptitude -y install linux-image-2.6.32-5-amd64 sed s/'GRUB_DEFAULT=0'/'GRUB_DEFAULT=1'/g u
我有一个脚本,可以在Debian squeeze中下载并替换内核头文件.
function fixHeaders(){ #Replace the kernel headers from OVH with standard kernel headers... aptitude -y install linux-image-2.6.32-5-amd64 sed s/'GRUB_DEFAULT=0'/'GRUB_DEFAULT=1'/g update-grub echo "Rebooting the machine. Run this script again after reboot and choose option 2." sleep 1 reboot } 我遇到的问题是,在aptitude下载软件包后,它会将脚本抛入文本gui并向用户询问一堆问题.有没有办法跳过这个或在适当的时间发送标签/输入为所有答案选择“确定”?
基于Daniel t的评论,我能够用DEBIAN_FRONTEND = noninteractive来做到这一点
DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get install -y -q --force-yes linux-image-2.6.32-5-amd64 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |