From 34510b73a254a0c7c87ac631cdf2aa06d57d0c49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Sat, 15 Apr 2017 13:28:59 +0200 Subject: [PATCH] Extract installation and configuration of the Nextcloud server MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The installation and configuration of the Nextcloud server as expected by the acceptance tests is extracted to its own script so it can be used from any element that launches the acceptance tests. Signed-off-by: Daniel Calviño Sánchez --- build/acceptance/installAndConfigureServer.sh | 30 +++++++++++++++++++ build/acceptance/run.sh | 4 +-- 2 files changed, 32 insertions(+), 2 deletions(-) create mode 100755 build/acceptance/installAndConfigureServer.sh diff --git a/build/acceptance/installAndConfigureServer.sh b/build/acceptance/installAndConfigureServer.sh new file mode 100755 index 0000000000..c41f03ece1 --- /dev/null +++ b/build/acceptance/installAndConfigureServer.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# @copyright Copyright (c) 2017, Daniel Calviño Sánchez (danxuliu@gmail.com) +# +# @license GNU AGPL version 3 or any later version +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +# Helper script to install and configure the Nextcloud server as expected by the +# acceptance tests. +# +# This script is not meant to be called manually; it is called when needed by +# the acceptance tests launchers. + +set -o errexit + +php occ maintenance:install --admin-pass=admin + +OC_PASS=123456 php occ user:add --password-from-env user0 diff --git a/build/acceptance/run.sh b/build/acceptance/run.sh index a30d9fd8f3..96ed9c8db4 100755 --- a/build/acceptance/run.sh +++ b/build/acceptance/run.sh @@ -190,13 +190,13 @@ function prepareDocker() { # to root). echo "Copying local Git working directory of Nextcloud to the container" tar --create --file="$NEXTCLOUD_LOCAL_TAR" --exclude=".git" --exclude="./build" --exclude="./config/config.php" --exclude="./data" --exclude="./tests" --directory=../../ . + tar --append --file="$NEXTCLOUD_LOCAL_TAR" --directory=../../ build/acceptance/installAndConfigureServer.sh docker cp - $NEXTCLOUD_LOCAL_CONTAINER:/var/www/html/ < "$NEXTCLOUD_LOCAL_TAR" docker exec $NEXTCLOUD_LOCAL_CONTAINER chown -R www-data:www-data /var/www/html/ echo "Installing Nextcloud in the container" - docker exec --user www-data $NEXTCLOUD_LOCAL_CONTAINER php occ maintenance:install --admin-pass=admin - docker exec --user www-data $NEXTCLOUD_LOCAL_CONTAINER bash -c "OC_PASS=123456 php occ user:add --password-from-env user0" + docker exec --user www-data $NEXTCLOUD_LOCAL_CONTAINER build/acceptance/installAndConfigureServer.sh echo "Creating Docker image to be used in acceptance tests" docker commit --message "Nextcloud installed from the local Git working directory" $NEXTCLOUD_LOCAL_CONTAINER $NEXTCLOUD_LOCAL_IMAGE