work around LP: #878600, make apt-get more non-interactive
| ... | ... |
@@ -90,8 +90,8 @@ if [[ $EUID -eq 0 ]]; then |
| 90 | 90 |
|
| 91 | 91 |
# since this script runs as a normal user, we need to give that user |
| 92 | 92 |
# ability to run sudo |
| 93 |
- apt-get update |
|
| 94 |
- apt-get install -y sudo |
|
| 93 |
+ apt_get update |
|
| 94 |
+ apt_get install sudo |
|
| 95 | 95 |
|
| 96 | 96 |
if ! getent passwd stack >/dev/null; then |
| 97 | 97 |
echo "Creating a user called stack" |
| ... | ... |
@@ -143,6 +143,14 @@ if [ ! -n "$HOST_IP" ]; then |
| 143 | 143 |
HOST_IP=`LC_ALL=C /sbin/ifconfig | grep -m 1 'inet addr:'| cut -d: -f2 | awk '{print $1}'`
|
| 144 | 144 |
fi |
| 145 | 145 |
|
| 146 |
+# apt-get wrapper to just get arguments set correctly |
|
| 147 |
+function apt_get() {
|
|
| 148 |
+ local sudo="sudo" |
|
| 149 |
+ [ "$(id -u)" = "0" ] && sudo="" |
|
| 150 |
+ $sudo DEBIAN_FRONTEND=noninteractive apt-get \ |
|
| 151 |
+ --option "Dpkg::Options::=--force-confold" --assume-yes "$@" |
|
| 152 |
+} |
|
| 153 |
+ |
|
| 146 | 154 |
# Generic helper to configure passwords |
| 147 | 155 |
function read_password {
|
| 148 | 156 |
set +o xtrace |
| ... | ... |
@@ -283,8 +291,8 @@ fi |
| 283 | 283 |
|
| 284 | 284 |
|
| 285 | 285 |
# install apt requirements |
| 286 |
-sudo apt-get update |
|
| 287 |
-sudo apt-get install -qqy `cat $FILES/apts/* | cut -d\# -f1 | grep -Ev "mysql-server|rabbitmq-server"` |
|
| 286 |
+apt_get update |
|
| 287 |
+apt_get install `cat $FILES/apts/* | cut -d\# -f1 | grep -Ev "mysql-server|rabbitmq-server"` |
|
| 288 | 288 |
|
| 289 | 289 |
# install python requirements |
| 290 | 290 |
sudo PIP_DOWNLOAD_CACHE=/var/cache/pip pip install `cat $FILES/pips/*` |
| ... | ... |
@@ -351,7 +359,11 @@ cp $FILES/screenrc ~/.screenrc |
| 351 | 351 |
|
| 352 | 352 |
if [[ "$ENABLED_SERVICES" =~ "rabbit" ]]; then |
| 353 | 353 |
# Install and start rabbitmq-server |
| 354 |
- sudo apt-get install -y -q rabbitmq-server |
|
| 354 |
+ # the temp file is necessary due to LP: #878600 |
|
| 355 |
+ tfile=$(mktemp) |
|
| 356 |
+ apt_get install rabbitmq-server > "$tfile" 2>&1 |
|
| 357 |
+ cat "$tfile" |
|
| 358 |
+ rm -f "$tfile" |
|
| 355 | 359 |
# change the rabbit password since the default is "guest" |
| 356 | 360 |
sudo rabbitmqctl change_password guest $RABBIT_PASSWORD |
| 357 | 361 |
fi |
| ... | ... |
@@ -383,7 +395,7 @@ EOF |
| 383 | 383 |
fi |
| 384 | 384 |
|
| 385 | 385 |
# Install and start mysql-server |
| 386 |
- sudo apt-get -y -q install mysql-server |
|
| 386 |
+ apt_get install mysql-server |
|
| 387 | 387 |
# Update the DB to give user ‘$MYSQL_USER’@’%’ full control of the all databases: |
| 388 | 388 |
sudo mysql -uroot -p$MYSQL_PASSWORD -e "GRANT ALL PRIVILEGES ON *.* TO '$MYSQL_USER'@'%' identified by '$MYSQL_PASSWORD';" |
| 389 | 389 |
|
| ... | ... |
@@ -486,7 +498,7 @@ if [[ "$ENABLED_SERVICES" =~ "n-cpu" ]]; then |
| 486 | 486 |
# splitting a system into many smaller parts. LXC uses cgroups and chroot |
| 487 | 487 |
# to simulate multiple systems. |
| 488 | 488 |
if [[ "$LIBVIRT_TYPE" == "lxc" ]]; then |
| 489 |
- sudo apt-get install lxc -y |
|
| 489 |
+ apt_get install lxc |
|
| 490 | 490 |
# lxc uses cgroups (a kernel interface via virtual filesystem) configured |
| 491 | 491 |
# and mounted to ``/cgroup`` |
| 492 | 492 |
sudo mkdir -p /cgroup |