← Back to team overview

orchestra team mailing list archive

[Merge] lp:~jtv/orchestra/odev-without-apt-get-update into lp:~orchestra/orchestra/odev


Jeroen T. Vermeulen has proposed merging lp:~jtv/orchestra/odev-without-apt-get-update into lp:~orchestra/orchestra/odev.

Requested reviews:
  orchestra (orchestra)

For more details, see:

Installing the required packages was agonizingly slow and error-prone for Julian (who is no longer very close to the data centre).  This should speed it up.

The trick I use to check of missing packages works on Lucid and Precise, which are the only systems I tried it on.
Your team orchestra is requested to review the proposed merge of lp:~jtv/orchestra/odev-without-apt-get-update into lp:~orchestra/orchestra/odev.
=== modified file 'bin/system-setup'
--- bin/system-setup	2012-03-01 17:00:18 +0000
+++ bin/system-setup	2012-03-08 07:06:19 +0000
@@ -10,25 +10,30 @@
 pkgs="$pkgs python-cheetah" # for setup.py
 pkgs="$pkgs qemu-utils qemu-kvm" # needed generally
-for pkg in ${pkgs}; do
-	dpkg-query --show "$pkg" >/dev/null ||
-		new_pkgs="${new_pkgs:+${new_pkgs} }${pkg}"
-if [ -n "$new_pkgs" ]; then
-	sudo apt-get update -qq || /bin/true
+need_packages_installed() {
+	# Do any of the packages in $pkgs need installing?
+	# (Show all installed versions for $pkgs, one per line, and grep for
+	# blank lines in the output.)
+	dpkg-query -f '${Version}\n' --show $pkgs | grep -q '^$'
+if need_packages_installed
 	sudo apt-get install -y $pkgs </dev/null
-for group in libvirtd kvm; do
+for group in libvirtd kvm
 	groups $USER | grep -q $group && continue
 	sudo adduser $USER $group
 	new_groups="${new_groups:+${new_groups} }${group}"
-if [ -n "$new_groups" ]; then
+if [ -n "$new_groups" ]
 	cat <<EOF
@@ -39,6 +44,7 @@
 	# The user may need to log out at this point.
-	echo "Ctrl-C if you want to log out now.  Otherwise, press <enter>."
+	echo "Abort with ctrl-C if you need to log out first."
+	echo "Otherwise, press <enter>."

Follow ups