Skip to content

Commit

Permalink
Add handle done msg
Browse files Browse the repository at this point in the history
  • Loading branch information
idoybh committed Sep 15, 2024
1 parent dc2cd9e commit f91ee58
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@ Set to `0` by default.
Set this to an extra message you want to send when the upload is done.
A good option may be a tag list or a link to changelog.
Set to nothing to disable. Disabled by default.
##### HANDLE_DONE_MSG
Set this to an extra message you want to send when file handling is done.
A good option may be a tag list or a link to changelog.
Will only fire where no other messages are sent.
Set to nothing to disable. Disabled by default.
##### FAILURE_MSG
Set this to an extra message you want to send if the build fails.
Set to nothing to disable. Disabled by default.
Expand Down
2 changes: 2 additions & 0 deletions build.conf
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ AUTO_REBOOT = 0
AUTO_SLOT = 0
# An extra message to send when uploading is done (blank to disable)
UPLOAD_DONE_MSG =
# An extra message to send when all handlings are done (blank to disable)
HANDLE_DONE_MSG =
# An extra message to send when the build fails (blank to disable)
FAILURE_MSG =
# twrp decryption key / pattern
Expand Down
12 changes: 11 additions & 1 deletion makeBuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ adb_wait()
done
}

# waits until device is unlocked unlocked
# waits until device is unlocked
# $1: (optional) delay between scans in seconds (defaults to 1)
# $2: (optional) path to check (defaults to /sdcard/)
adb_wait_unlocked()
Expand Down Expand Up @@ -370,6 +370,7 @@ rewrite_config()
config_write "AUTO_REBOOT" "${AUTO_REBOOT}" $confPath
config_write "AUTO_SLOT" "${AUTO_REBOOT}" $confPath
config_write "UPLOAD_DONE_MSG" "${UPLOAD_DONE_MSG}" $confPath
config_write "HANDLE_DONE_MSG" "${HANDLE_DONE_MSG}" $confPath
config_write "FAILURE_MSG" "${FAILURE_MSG}" $confPath
config_write "TWRP_PIN" "${TWRP_PIN}" $confPath
config_write "TWRP_SIDELOAD" "${TWRP_SIDELOAD}" $confPath
Expand Down Expand Up @@ -525,6 +526,8 @@ init_conf()
fi
echo -en "${YELLOW}Set extra upload message [${BLUE}blank${YELLOW}]: ${NC}"
read UPLOAD_DONE_MSG
echo -en "${YELLOW}Set extra handling done message [${BLUE}blank${YELLOW}]: ${NC}"
read HANDLE_DONE_MSG
echo -en "${YELLOW}Set extra failure message [${BLUE}blank${YELLOW}]: ${NC}"
read FAILURE_MSG
echo -en "${YELLOW}Set TWRP decryption pin "
Expand Down Expand Up @@ -654,6 +657,9 @@ print_confs()
if [[ $UPLOAD_DONE_MSG != '' ]]; then
echo -e "Upload done message :${BLUE} ${UPLOAD_DONE_MSG}${NC}"
fi
if [[ $HANDLE_DONE_MSG != '' ]]; then
echo -e "Handling done message :${BLUE} ${HANDLE_DONE_MSG}${NC}"
fi
if [[ $FAILURE_MSG != '' ]]; then
echo -e "Failure message :${BLUE} ${FAILURE_MSG}${NC}"
fi
Expand Down Expand Up @@ -1396,6 +1402,10 @@ if [[ $buildRes == 0 ]]; then # if build succeeded
trap - SIGINT
fi

if [[ $HANDLE_DONE_MSG != '' ]] && [[ $isSilent == 0 ]] && [[ $isUpload != 1 ]]; then
./telegramSend.sh --cite --tmp "${tmpDir}" --config "${TG_SEND_CFG_FILE}" "${HANDLE_DONE_MSG}"
fi

# Should only reach here if not handled yet
if [[ $UNHANDLED_PATH != '' ]] && [[ $isKeep != 1 ]]; then
mv $PATH_TO_BUILD_FILE "${UNHANDLED_PATH}"/
Expand Down

0 comments on commit f91ee58

Please sign in to comment.