From 9f6bd33076f8b2d19dda9c0cc01e374a59d9b5be Mon Sep 17 00:00:00 2001
From: Duncan Sommerville <duncan.sommerville@gmail.com>
Date: Tue, 13 Jan 2015 15:50:01 -0500
Subject: [PATCH] Fix returning stor directory from database in uninstall, work
 on getting lxc-bootstrap working with debian

---
 installer/lxc-bootstrap |  4 ++--
 uninstall               | 10 ++++++----
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/installer/lxc-bootstrap b/installer/lxc-bootstrap
index e5add84c7..c361d46b5 100755
--- a/installer/lxc-bootstrap
+++ b/installer/lxc-bootstrap
@@ -35,11 +35,11 @@ lxc-start -n ${name} -d
 echo "...Done"
 
 echo -e "\n * Running apt update..."
-lxc-attach -n ${name} -e -- apt-get update
+lxc-attach -n ${name} -- apt-get update
 echo "...Done"
 
 echo -e "\n * Installing git..."
-lxc-attach -n ${name} -e -- apt-get -y --force-yes install git
+lxc-attach -n ${name} -- apt-get -y --force-yes install git
 echo "...Done"
 
 echo -e "\n * Cloning Airtime..."
diff --git a/uninstall b/uninstall
index e889c6568..ab0f667fa 100755
--- a/uninstall
+++ b/uninstall
@@ -9,12 +9,12 @@ fi
 
 getStorDirFromDatabase() {
     # here-doc to execute this block as postgres user
-    su postgres <<'EOF'
+    result=`su postgres <<'EOF'
     set +e
-    result=$(psql -d airtime -tAc "SELECT directory FROM cc_music_dirs WHERE type='stor'")
+    echo $(psql -d airtime -tAc "SELECT directory FROM cc_music_dirs WHERE type='stor'")
     set -e
 # don't indent this!
-EOF
+EOF`
     echo $result
 }
 
@@ -22,7 +22,9 @@ dropAirtimeDatabase() {
     # here-doc to execute this block as postgres user
     su postgres <<'EOF'
     set +e
-    psql -d postgres -tAc "DROP DATABASE IF EXISTS airtime; DROP USER IF EXISTS airtime;"
+    # DROP DATABASE cannot be executed from a function or multi-command string
+    psql -d postgres -tAc "DROP DATABASE IF EXISTS airtime"
+    psql -d postgres -tAc "DROP USER IF EXISTS airtime"
     set -e
 # don't indent this!
 EOF