forked from schors/gost-ca-parse
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgit-push.sh
More file actions
executable file
·41 lines (30 loc) · 851 Bytes
/
git-push.sh
File metadata and controls
executable file
·41 lines (30 loc) · 851 Bytes
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
#!/bin/sh
set -e
caxmlfile=$1
certsdir=$2
repodir=`dirname "$certsdir"`
logdate=`date +"%Y-%m-%dT%TZ%z"`
logit() {
echo "${logdate}: $1"
}
if [ x"$certsdir" = "x" -o "$certsdir" = "/" ]; then
logit "[-] $certsdir does not exists"
exit 1
fi
if [ ! -e "$caxmlfile" ]; then
logit "[-] XML-file ${caxmlfile} not found"
exit 1
fi
which git > /dev/null || exit 0
which xmllint > /dev/null || exit 0
cd $repodir
ver=`xmllint --xpath "//АккредитованныеУдостоверяющиеЦентры/Версия/text()" $caxmlfile`
git add "$certsdir"
if ! git diff-index --quiet HEAD --; then
logit "[+] Commit and push Version $ver"
git commit -a -m "Version $ver"
git tag -a $ver -m "version $ver"
git push --follow-tags
else
logit "[=] Nothing to do"
fi