summaryrefslogtreecommitdiff
path: root/roles/apps/collabora/code/contrib/extract-lolwsdxml.sh
blob: ab4e5fb4c97dbfb63dd5b93e49845c5c2b1c9ceb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash

if [ -z "$1" ]; then
  echo "Usage: $0 <version>"
  exit 1
fi
VERSION="$1"

IMAGE_TAG="$VERSION"
IMAGE_NAME="collabora/code"
CONF_D=$(realpath "${BASH_SOURCE%/*}/../templates/config")
CONTAINER_NAME="collabora-code-loolwsd.xml-extractor"

sudo docker rm "$CONTAINER_NAME" > /dev/null 2>&1

set -e
sudo docker create --name "$CONTAINER_NAME"  "$IMAGE_NAME:$IMAGE_TAG" /bin/true
sudo docker cp --archive=false "$CONTAINER_NAME:/etc/loolwsd/loolwsd.xml" - | tar -xO loolwsd.xml > "$CONF_D/loolwsd.$VERSION.xml.j2"
sudo docker rm "$CONTAINER_NAME"

echo ""
echo "File extraction was sucessful! Now snyc the config file with existing ones."
echo ""
echo "you might also want to delete the image:"
echo ""
echo "  sudo docker rmi '$IMAGE_NAME:$IMAGE_TAG'"
echo ""