我在流浪汉中有一个脚本配置器。我的盒子是ubuntu 64bit Precise。我的脚本的相关行看起来像这样:
sudo bash -c 'echo "deb https://oss.oracle.com/debian/ unstable main non-free" >/etc/apt/sources.list.d/oracle.list'
wget -q https://oss.oracle.com/el4/RPM-GPG-KEY-oracle -O- | sudo apt-key add -
sudo apt-get update -qq
错误代码是:
W: GPG error: https://oss.oracle.com unstable Release: The following signatures were invalid: KEYEXPIRED 1378511808 KEYEXPIRED 1378511808 KEYEXPIRED 1378511808
W: Failed to fetch https://oss.oracle.com/debian/dists/unstable/main/binary-amd64/Packages The requested URL returned error: 404
W: Failed to fetch https://oss.oracle.com/debian/dists/unstable/non-free/binary-amd64/Packages The requested URL returned error: 404
E: Some index files failed to download. They have been ignored, or old ones used instead.
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
问题在于,尽管我知道repo已过期密钥,但不适用于64位架构(仅限32位)。我仍然希望从中安装相关的软件包(这是可能的,使用:<package_name>:i386
)。
但是在更新期间由于非退出状态流浪汉停止并且不再继续我的脚本。
有没有办法(流浪者或apt-get
方面)让流浪者高兴并继续执行我的剧本?
答案 0 :(得分:15)
您可以使用; true
:
sudo sh -c "apt-get update -qq ; true"
答案 1 :(得分:2)
比Igor建议的一个稍微简单的方法是使它成为一个布尔语句:
apt-get update -qq || true
这可以避免调用不必要的子shell。