Skip to content

Instantly share code, notes, and snippets.

@anotherjesse
Created March 16, 2012 17:26
Show Gist options
  • Select an option

  • Save anotherjesse/2051275 to your computer and use it in GitHub Desktop.

Select an option

Save anotherjesse/2051275 to your computer and use it in GitHub Desktop.
juju
#!/bin/sh
apt-get update
echo root:passwd | chpasswd
add-apt-repository ppa:juju/pkgs
apt-get update && apt-get install juju
@kragen
Copy link
Copy Markdown

kragen commented Mar 16, 2012

Why do you check for errors only on the next-to-last command? You could write

apt-get update &&
echo root:passwd | chpasswd &&
add-apt-repository ppa:juju/pkgs &&
apt-get update &&
apt-get install juju

Also, why the first apt-get update?

@anotherjesse
Copy link
Copy Markdown
Author

the first apt-get is because when a cloud vm first launches on a cloud the apt list is stale/partial. If you try to install things, it will usually fail.

Regarding the question about why am I only doing && on the last line? because I was just getting started. I usually set errexit and don't use && at all.

In trying to debug these I decided to implement https://github.com/angst/cloudtee ... it helps debug failures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment