summaryrefslogtreecommitdiff
path: root/roles/apps/collabora/code/contrib/extract-coolwsdxml.sh
blob: 26496ea7c64070e8bf7195448812d0e600d13789 (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%/*}/../instance/templates/config")
CONTAINER_NAME="collabora-code-coolwsd.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/coolwsd/coolwsd.xml" - | tar -xO coolwsd.xml > "$CONF_D/coolwsd.$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 ""