Revision 5d901aca3bde39cfcd405f154245d09bc6c35584 authored by Anthony Rimet on 26 October 2021, 15:16:25 UTC, committed by Anthony Rimet on 26 October 2021, 15:16:25 UTC
1 parent 1e22719
Raw File
lodex-extended-sync
#!/bin/sh

REPOSITORY_URL="https://github.com/Inist-CNRS"
TARGET_NAME="src/app/custom"
REPOSITORY_NAME="lodex-extented"
REPOSITORY_DIRECTORY="public"

REPOSITORY="$REPOSITORY_URL/$REPOSITORY_NAME"
SCRIPT=`basename $0`
PATHNAME=`dirname $0`
BASEDIR=`cd "$PATHNAME"; pwd`
TARGET="$BASEDIR/$TARGET_NAME"
LOCATION="/tmp"
DIRECTORY=`basename $0`
SOURCE="$LOCATION/$DIRECTORY/$REPOSITORY_NAME/$REPOSITORY_DIRECTORY"
PLUGINS_URL=`jq -r -M .pluginsURL ./config.json | grep -v null`
TAG=`echo "$PLUGINS_URL"|cut -d '/' -f 6`

echo "Syncing $REPOSITORY with $TAG to $TARGET"
(test -d "$LOCATION/$DIRECTORY" && rm -rf "$LOCATION/$DIRECTORY")
(test ! -d "$LOCATION/$DIRECTORY/" && mkdir -p "$LOCATION/$DIRECTORY/")

cd "$LOCATION/$DIRECTORY/"
echo "Working in $PWD"
git clone -b "$TAG" --single-branch --depth 1 "$REPOSITORY"

cd "$SOURCE"
find ./exporters/ -type f -name '*.ini' -exec cp --parents --remove-destination {} $TARGET \;
find ./resources/ -type f -name '*.*' -exec cp --parents --remove-destination {} $TARGET \;
find ./routines/ -type f -name '*.ini' -exec cp --parents --remove-destination {} $TARGET \;
find ./loaders/ -type f -name '*.ini' -exec cp --parents --remove-destination {} $TARGET \;

echo "Clean up $LOCATION/$DIRECTORY/"
rm -rf $LOCATION/$DIRECTORY/
back to top