-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy pathupgrade.sh
More file actions
executable file
·42 lines (35 loc) · 946 Bytes
/
upgrade.sh
File metadata and controls
executable file
·42 lines (35 loc) · 946 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
41
42
#!/bin/bash
set -e
USERNAME=$1
PASSWORD=$2
SECONDS=0
pushd tdlib > /dev/null
ORIGINAL_REMOTE=$(git remote get-url origin)
if [[ "$ORIGINAL_REMOTE" =~ ^ssh://git@.* ]]; then
REMOTE="${ORIGINAL_REMOTE}"
else
REMOTE="https://${USERNAME}:${PASSWORD}@${ORIGINAL_REMOTE}"
fi
git checkout main > /dev/null
git pull origin main > /dev/null
cd source/td
git checkout master > /dev/null
git pull origin master
cd ..
echo "Building..."
./rebuild.sh > /dev/null 2>&1
git add --all
echo "Build finished."
cd ..
TDLIB_COMMIT=$(cat version.txt | cut -c 1-7)
COMMIT_MSG="Upgrade TDLib to tdlib/td@${TDLIB_COMMIT} + Rebuild OpenSSL"
if [ "$SECONDS" -ge 60 ]; then
git commit -m "$COMMIT_MSG" -m "Built in $(expr $SECONDS / 60)m $(expr $SECONDS % 60)s"
elif [ "$SECONDS" -gt 0 ]; then
git commit -m "$COMMIT_MSG" -m "Built in ${SECONDS}s"
else
git commit -m "$COMMIT_MSG"
fi
echo "Pushing..."
git push "$REMOTE" > /dev/null 2>&1
popd > /dev/null