forked from Inist-CNRS/lodex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lodex-extended-sync
executable file
·34 lines (28 loc) · 1.24 KB
/
lodex-extended-sync
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
28
29
30
31
32
33
34
#!/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/