This repository was archived by the owner on Jun 28, 2021. It is now read-only.
forked from adiatul16/aosp-building
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsync
executable file
·38 lines (34 loc) · 1.57 KB
/
sync
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
#!/bin/bash
source ${CIRRUS_WORKING_DIR}/rb.conf
cd ${ROM_FOLDER}
#Sync rom source
# Repo init command, that -device,-mips,-darwin,-notdefault part will save you more time and storage to sync, add more according to your rom and choice. Optimization is welcomed! Let's make it quit, and with depth=1 so that no unnecessary things.
git config --global user.name ${GIT_USERNAME}
git config --global user.email ${GIT_EMAIL}
repo init --no-repo-verify -u ${ROM_MANIFEST} -b ${ROM_BRANCH} --groups=all,-notdefault,-device,-generic,-google,-darwin,-x86,-mips,-exynos5,mako --depth=1
if [ "${SEND_SYNC_MESSAGES_TO_TG}" = true ]; then
SYNC_START=$(date +"%s")
# Report to tg group/channel
read -r -d '' MESSAGE <<-_EOL_
<strong>Sync Started!</strong>
<strong>@</strong> $(date "+%I:%M%p") ($(date +"%Z%:z"))
<strong>Syncing:</strong> ${ROM_NAME}
_EOL_
curl -s -X POST -d chat_id="${CHAT_ID}" -d parse_mode=html -d text="${MESSAGE}" -d disable_web_page_preview="true" https://api.telegram.org/bot"${BOT_TOKEN}"/sendMessage
fi
# Sync source with -q, no need unnecessary messages
if [ "${SYNC_ARGUMENTS}" = false ]; then
repo sync
else
repo sync ${SYNC_ARGUMENTS}
fi
if [ "${SEND_SYNC_MESSAGES_TO_TG}" = true ]; then
SYNC_END=$(date +"%s")
DIFF=$((SYNC_END - SYNC_START))
# Sync succeded! report to tg group/channel
read -r -d '' MESSAGE <<-_EOL_
<strong>Sync Finished!</strong>
<strong>Time :</strong> $((DIFF / 60)) minutes and $((DIFF % 60)) seconds
_EOL_
curl -s -X POST -d chat_id="${CHAT_ID}" -d parse_mode=html -d text="${MESSAGE}" https://api.telegram.org/bot"${BOT_TOKEN}"/sendMessage
fi