blob: 3c5577d2d14659a2da67517dda29ab2873c8a0f7 (
plain)
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
51
52
53
54
55
56
|
#!/bin/sh
#
# simple script to call the 'vlanscrape' script, check if there are changes
# in the output directory, and `git add . ; git commit -m "msg" ; git push`
# if there are
# call the script
/usr/local/bin/vlanscrape
cd /home/vlanscrape/git/git.nordu.net/vlanscrape-data
TmpFile=$(mktemp)
if [ -z $TmpFile ]
then
echo "cannot create temp file, giving up on versioning vlanscrape data"
exit 1
fi
git status --porcelain=1 >$TmpFile
FilesAdded=$(grep -E '^??' $TmpFile | wc -l)
FilesAdded=$(echo $FilesAdded | cut -f 1 -d \ )
FilesModified=$(grep -E '^ M' $TmpFile | wc -l)
FilesModified=$(echo $FilesModified | cut -f 1 -d \ )
Something=$(wc -l $TmpFile)
Something=$(echo $Something | cut -f 1 -d \ )
if [ $Something -ne 0 ]
then
if [ $FilesAdded -ne 0 ]
then
CommitMsg="File addition"
fi
if [ $FilesModified -ne 0 ]
then
if [ -z $CommitMsg ]
then
CommitMsg="File modification"
else
CommitMsg="$CommiMsg and modification"
fi
fi
if [ -z $CommitMsg ]
then
CommitMsg="something changed"
fi
fi
if [ ! -z $CommitMsg ]
then
git add .
git commit -m "$CommitMsg"
git push
fi
rm ${TmpFile}
|