Fix returning stor directory from database in uninstall, work on getting lxc-bootstrap working with debian

This commit is contained in:
Duncan Sommerville 2015-01-13 15:50:01 -05:00
parent 3908e82667
commit 9f6bd33076
2 changed files with 8 additions and 6 deletions

View File

@ -35,11 +35,11 @@ lxc-start -n ${name} -d
echo "...Done" echo "...Done"
echo -e "\n * Running apt update..." echo -e "\n * Running apt update..."
lxc-attach -n ${name} -e -- apt-get update lxc-attach -n ${name} -- apt-get update
echo "...Done" echo "...Done"
echo -e "\n * Installing git..." 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 "...Done"
echo -e "\n * Cloning Airtime..." echo -e "\n * Cloning Airtime..."

View File

@ -9,12 +9,12 @@ fi
getStorDirFromDatabase() { getStorDirFromDatabase() {
# here-doc to execute this block as postgres user # here-doc to execute this block as postgres user
su postgres <<'EOF' result=`su postgres <<'EOF'
set +e 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 set -e
# don't indent this! # don't indent this!
EOF EOF`
echo $result echo $result
} }
@ -22,7 +22,9 @@ dropAirtimeDatabase() {
# here-doc to execute this block as postgres user # here-doc to execute this block as postgres user
su postgres <<'EOF' su postgres <<'EOF'
set +e 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 set -e
# don't indent this! # don't indent this!
EOF EOF