I'm having a script provisioner in vagrant. My box is ubuntu 64bit Precise. The relevant lines of my script look like this:
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
The error code is:
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!
The problem is that despite I know that the repo has expired keys and is not for 64bit architecture (32bit only). Still I'd like to install relevant packages from it (which is possible, using: <package_name>:i386
).
However during update due to non-exit status vagrant stops and doesn't continue my script any more.
Is there a way (either of vagrant or on the apt-get
side) to make vagrant happy and continue execution of my script?
You can force the error status to zero using ; true
:
sudo sh -c "apt-get update -qq ; true"
A slightly simpler approach than Igor's suggestion is to make it a boolean statement:
apt-get update -qq || true
This avoids invoking an unnecessary subshell.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With