Added retry around apt-get

Added a retry mechanism around apt-get to avoid failures
caused by something else running apt-get.
apt-get is called until success or error different from
the one caused by dpkg lock
Stop jujud earlier in the process
Merge pull request #404 from perrito666/1342937_restore_fails_if_apt_running

fix lp:1342937 restore fails if apt running

Stop jujud before everything else so no worker will be running when we destroy the basic bootstrap.
Retry APT to make sure it is not failing because some other apt is finishing.