-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate.sh
executable file
·57 lines (42 loc) · 1.08 KB
/
update.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
51
52
53
54
55
56
57
#!/bin/bash
set -e
REPO="https://github.com/tigris-mt/aurum"
BRANCH="$(git rev-parse --abbrev-ref HEAD)"
T="/tmp/aurum-release-$BRANCH"
test -e update.sh
echo "Fetching repository..."
mkdir -p "$T"
pushd "$T"
if [ ! -d .git ]; then
git init
git remote add origin "$REPO"
fi
git remote set-url origin "$REPO"
git fetch origin
git reset --hard origin/"$BRANCH"
git submodule update --init --recursive
git clean -ffxd
popd
echo "Cleaning..."
git add update.sh
git rm --cached -rq .
git add update.sh
git clean -fxdq
echo "Copying..."
f() {
find "$T" -follow -mindepth 1 "$@" -not -iwholename '*/.git*' -printf '%P\n'
}
f -type d | while read n; do
mkdir -p "$n"
done
f -type f | while read n; do
cp -RL "$T/$n" "$n"
done
find "$T" -type l -printf '%P\n' | while read n; do echo "$n" '->' "$(readlink "$T/$n")"; done | sort > symlink_report.txt
echo "Committing..."
. tools/config.sh
git add .
git rm -frq submodules
git commit -m "Update: aurum $BRANCH at $(git -C "$T" rev-parse --short HEAD)"
git tag -a "$BRANCH.v$(version)" -m "$BRANCH.v$(version)" || echo "Could not tag."
echo "Done."