forked from pkiraly/qa-catalogue
-
Notifications
You must be signed in to change notification settings - Fork 0
/
metadata-qa.sh
executable file
·50 lines (43 loc) · 1.07 KB
/
metadata-qa.sh
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
. ./setdir.sh
options=$(getopt -o n:p:m:c:v: --long name:,params:,mask:,catalogue:,version: -- "$@")
[ $? -eq 0 ] || {
echo "Incorrect options provided"
exit 1
}
eval set -- "$options"
MARC_DIR=${BASE_INPUT_DIR}
NAME=metadata-qa
VERSION=
while true; do
case "$1" in
-n|--name) NAME=$2 ; shift;;
-p|--params) TYPE_PARAMS=$2 ; shift;;
-m|--mask) MASK=$2 ; shift;;
-c|--catalogue) CATALOGUE=$2 ; shift;;
-v|--version) VERSION=$2 ; shift;;
--)
shift
break
;;
esac
shift
done
if [[ "$CATALOGUE" != "" ]]; then
FILE=/var/www/html/metadata-qa/configuration.cnf
count=$(grep -c catalogue $FILE)
if [[ $count == 1 ]]; then
grep -v catalogue $FILE > /tmp/catalogue
mv /tmp/catalogue $FILE
fi
echo "catalogue=$CATALOGUE" >> $FILE
FILE=/var/www/html/metadata-qa/configuration.js
count=$(grep -c catalogue $FILE)
if [[ $count == 1 ]]; then
grep -v catalogue $FILE > /tmp/catalogue
mv /tmp/catalogue $FILE
fi
echo "var catalogue = '$CATALOGUE'" >> $FILE
fi
. ./common-script $1
exit 0;