This replaces 'apt-get' calls with 'apt_get' function that just
ensures that each call has flags to be non-interactive. This prevents
potential prompts for conf file overwrites and such.
| ... | ... |
@@ -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/*` |
| ... | ... |
@@ -353,7 +361,7 @@ if [[ "$ENABLED_SERVICES" =~ "rabbit" ]]; then |
| 353 | 353 |
# Install and start rabbitmq-server |
| 354 | 354 |
# the temp file is necessary due to LP: #878600 |
| 355 | 355 |
tfile=$(mktemp) |
| 356 |
- sudo apt-get install -y -q rabbitmq-server > "$tfile" 2>&1 |
|
| 356 |
+ apt_get install rabbitmq-server > "$tfile" 2>&1 |
|
| 357 | 357 |
cat "$tfile" |
| 358 | 358 |
rm -f "$tfile" |
| 359 | 359 |
# change the rabbit password since the default is "guest" |
| ... | ... |
@@ -387,7 +395,7 @@ EOF |
| 387 | 387 |
fi |
| 388 | 388 |
|
| 389 | 389 |
# Install and start mysql-server |
| 390 |
- sudo apt-get -y -q install mysql-server |
|
| 390 |
+ apt_get install mysql-server |
|
| 391 | 391 |
# Update the DB to give user ‘$MYSQL_USER’@’%’ full control of the all databases: |
| 392 | 392 |
sudo mysql -uroot -p$MYSQL_PASSWORD -e "GRANT ALL PRIVILEGES ON *.* TO '$MYSQL_USER'@'%' identified by '$MYSQL_PASSWORD';" |
| 393 | 393 |
|
| ... | ... |
@@ -490,7 +498,7 @@ if [[ "$ENABLED_SERVICES" =~ "n-cpu" ]]; then |
| 490 | 490 |
# splitting a system into many smaller parts. LXC uses cgroups and chroot |
| 491 | 491 |
# to simulate multiple systems. |
| 492 | 492 |
if [[ "$LIBVIRT_TYPE" == "lxc" ]]; then |
| 493 |
- sudo apt-get install lxc -y |
|
| 493 |
+ apt_get install lxc |
|
| 494 | 494 |
# lxc uses cgroups (a kernel interface via virtual filesystem) configured |
| 495 | 495 |
# and mounted to ``/cgroup`` |
| 496 | 496 |
sudo mkdir -p /cgroup |