-
-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from PalmDevs/upstream-main
Improvements
- Loading branch information
Showing
9 changed files
with
127 additions
and
74 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ jobs: | |
runs-on: ubuntu-latest | ||
outputs: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
id: ${{ steps.create_release.outputs.id }} | ||
steps: | ||
- name: Determine tag name | ||
id: get_tag_name | ||
|
@@ -58,32 +59,46 @@ jobs: | |
- name: Download latest OTA build for ${{ matrix.device_name }} | ||
run: ./download_latest_ota_build.sh ${{ matrix.device_name }} | ||
|
||
- name: Extract images and build props | ||
- name: Extract images and build | ||
id: extract_and_build | ||
run: ./extract_images.sh | ||
|
||
- name: Prepare for upload | ||
id: prepare | ||
run: | | ||
mkdir -p result | ||
BASE_NAME=${{ steps.extract_and_build.outputs.DEVICE_CODE_NAME_TITLE }}.A${{ steps.extract_and_build.outputs.DEVICE_BUILD_ANDROID_VERSION }}.$(echo ${{ steps.extract_and_build.outputs.DEVICE_BUILD_SECURITY_PATCH }} | sed 's/-//g') | ||
cp ./**/**/{system,module}.prop result/ | ||
cp -r ./magisk_module_files/* result/ | ||
cd result | ||
zip -r ../$BASE_NAME.zip . | ||
cd .. | ||
echo "base_name=$BASE_NAME" >> $GITHUB_OUTPUT | ||
- name: Upload files to release | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ needs.prepare_build.outputs.upload_url }} | ||
asset_path: ./${{ steps.prepare.outputs.base_name }}.zip | ||
asset_name: ${{ steps.prepare.outputs.base_name }}.zip | ||
asset_content_type: application/zip | ||
asset_path: ./${{ steps.extract_and_build.outputs.module_base_name }}.zip | ||
asset_name: ${{ steps.extract_and_build.outputs.module_base_name }}.zip | ||
asset_content_type: application/zip | ||
|
||
- name: Add information to release | ||
uses: irongut/[email protected] | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
id: ${{ needs.prepare_build.outputs.id }} | ||
replacebody: false | ||
body: | | ||
## ${{ steps.extract_and_build.outputs.device_name }} (${{ steps.extract_and_build.outputs.device_code_name_title }}) | ||
#### Module | ||
- File name: `${{ steps.extract_and_build.outputs.module_base_name }}.zip` | ||
- File hash (SHA256): `${{ steps.extract_and_build.outputs.module_hash }}` | ||
#### Firmware | ||
- Build ID: `${{ steps.extract_and_build.outputs.device_build_id }}` | ||
- Android version: `${{ steps.extract_and_build.outputs.device_build_android_version }}` | ||
- Security patch: `${{ steps.extract_and_build.outputs.device_build_security_patch }}` | ||
- name: Send to Telegram | ||
run: | | ||
{ | ||
echo '${{ steps.extract_and_build.outputs.device_name }} - ${{ steps.extract_and_build.outputs.device_code_name_title }}'; | ||
echo 'Security Patch: `${{ steps.extract_and_build.outputs.device_build_security_patch }}`'; | ||
echo 'ID: `${{ steps.extract_and_build.outputs.device_build_id }}`'; | ||
} > .tg_caption | ||
curl -X POST "https://api.telegram.org/bot${{ secrets.BOT_TOKEN }}/sendDocument" \ | ||
-H "Content-Type: multipart/form-data" \ | ||
-F "chat_id=${{ secrets.CHANNEL_ID }}" \ | ||
-F "document=@${{ steps.extract_and_build.outputs.module_base_name }}.zip;type=application/zip" \ | ||
-F "caption=$(cat .tg_caption)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#!/bin/bash | ||
|
||
# Using util_functions.sh | ||
[ -f "util_functions.sh" ] && . ./util_functions.sh || { echo "util_functions.sh not found" && exit 1; } | ||
|
||
# Load data from script base path if no directory were specified | ||
[ -n "$1" ] && dir=$1 || { | ||
for dir in ./*; do # List directory ./* | ||
if [ -d "$dir" ]; then # Check if it is a directory | ||
dir=${dir%*/} # Remove last / | ||
print_message "Processing \"${dir##*/}\"" debug | ||
|
||
# Build system.prop | ||
./"${BASH_SOURCE[0]}" "$dir" | ||
fi | ||
done | ||
exit 1 | ||
} | ||
|
||
vendor_path="$dir/extracted/vendor/build.prop" | ||
system_path="$dir/extracted/system/system/build.prop" | ||
|
||
device_name=$(grep_prop "ro.product.vendor.model" "$vendor_path") | ||
device_build_id=$(grep_prop "ro.build.id" "$system_path") | ||
device_code_name=$(grep_prop "ro.product.vendor.name" "$vendor_path") | ||
device_code_name_title=${device_code_name^} | ||
device_build_android_version=$(grep_prop "ro.vendor.build.version.release" "$vendor_path") | ||
device_build_security_patch=$(grep_prop "ro.vendor.build.security_patch" "$vendor_path") | ||
|
||
mkdir -p result | ||
|
||
base_name=$device_code_name_title.A$device_build_android_version.$(echo "$device_build_security_patch" | sed 's/-//g') | ||
subdir=$(basename "$dir") | ||
|
||
mkdir -p "result/$subdir" | ||
cp "$dir/{module,system}.prop" "result/$subdir/" | ||
cp -r ./magisk_module_files/* "result/$subdir/" | ||
|
||
cd "result/$subdir" || exit 1 | ||
zip -r "../../$base_name.zip" . | ||
cd ../.. | ||
|
||
print_message "Module saved to $base_name.zip" info | ||
|
||
# IMPORTANT: This will save the latest build's (last directory the shell loops thru) base name | ||
# This won't be a problem for GitHub Actions as we have different instances running for each build | ||
if [ -n "$GITHUB_OUTPUT" ]; then | ||
{ | ||
echo "module_base_name=$base_name" ; | ||
echo "module_hash=$(sha256sum "$base_name.zip" | awk '{print $1}')"; | ||
echo "device_name=$device_name"; | ||
echo "device_code_name_title=$device_code_name_title"; | ||
echo "device_build_id=$device_build_id"; | ||
echo "device_build_android_version=$device_build_android_version"; | ||
echo "device_build_security_patch=$device_build_security_patch"; | ||
} >> "$GITHUB_OUTPUT" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,47 @@ | ||
#!/sbin/sh | ||
|
||
# Module variables | ||
SYS_PROP_MANUFACTURER=`grep_prop ro.product.system.manufacturer` | ||
MOD_PROP_MANUFACTURER=`grep_prop ro.product.system.manufacturer $MODPATH/system.prop` | ||
MOD_PROP_MODEL=`grep_prop ro.product.model $MODPATH/system.prop` | ||
MOD_PROP_PRODUCT=`grep_prop ro.build.product $MODPATH/system.prop | tr '[:lower:]' '[:upper:]'` | ||
MOD_PROP_VERSION=`grep_prop ro.build.version.release $MODPATH/system.prop` | ||
MOD_PROP_SECURITYPATCH=`grep_prop ro.build.version.security_patch $MODPATH/system.prop` | ||
MOD_PROP_VERSIONCODE=`date -d $MOD_PROP_SECURITYPATCH '+%y%m%d'` | ||
MOD_PROP_MONTH=`date -d $MOD_PROP_SECURITYPATCH '+%B'` | ||
MOD_PROP_YEAR=`date -d $MOD_PROP_SECURITYPATCH '+%Y'` | ||
SYS_PROP_MANUFACTURER=$(grep_prop ro.product.system.manufacturer) | ||
MOD_PROP_MANUFACTURER=$(grep_prop ro.product.system.manufacturer "$MODPATH/system.prop") | ||
MOD_PROP_MODEL=$(grep_prop ro.product.model "$MODPATH/system.prop") | ||
MOD_PROP_PRODUCT=$(grep_prop ro.build.product "$MODPATH/system.prop" | tr '[:lower:]' '[:upper:]') | ||
MOD_PROP_VERSION=$(grep_prop ro.build.version.release "$MODPATH/system.prop") | ||
MOD_PROP_SECURITYPATCH=$(grep_prop ro.build.version.security_patch "$MODPATH"/system.prop) | ||
MOD_PROP_VERSIONCODE=$(date -d "$MOD_PROP_SECURITYPATCH" '+%y%m%d') | ||
MOD_PROP_MONTH=$(date -d "$MOD_PROP_SECURITYPATCH" '+%B') | ||
MOD_PROP_YEAR=$(date -d "$MOD_PROP_SECURITYPATCH" '+%Y') | ||
|
||
# Print head message | ||
ui_print "- Installing, $MOD_PROP_MODEL ($MOD_PROP_PRODUCT) Prop - $MOD_PROP_MONTH $MOD_PROP_YEAR" | ||
|
||
# Checking if the system sdk matches the module sdk | ||
MOD_API=`grep_prop ro.build.version.sdk $MODPATH/system.prop | grep -ohE '[0-9]{2}'` | ||
MOD_API=$(grep_prop ro.build.version.sdk "$MODPATH/system.prop" | grep -ohE '[0-9]{2}') | ||
|
||
# Make sure device manufacturer was not disturbed | ||
# Make sure device manufacturer was not disturbed | ||
# in order to fix few apps such as camera on Xiaomi devices | ||
if [ $SYS_PROP_MANUFACTURER == $MOD_PROP_MANUFACTURER ]; then | ||
if [ "$SYS_PROP_MANUFACTURER" = "$MOD_PROP_MANUFACTURER" ]; then | ||
ui_print "- MANUFACTURER=$SYS_PROP_MANUFACTURER, running unsafe mode" | ||
else | ||
sed -i 's/^ro.product.system.manufacturer/# ro.product.system.manufacturer/' $MODPATH/system.prop | ||
sed -i 's/^ro.product.system.manufacturer/# ro.product.system.manufacturer/' "$MODPATH"/system.prop | ||
ui_print "- MANUFACTURER=$SYS_PROP_MANUFACTURER, running safe mode" | ||
fi | ||
|
||
# Make sure device API matches the one on the prop in order to avoid bootloop | ||
if [ $API -gt $MOD_API ]; then | ||
if [ "$API" -gt "$MOD_API" ]; then | ||
ui_print "- SDK=$API, running unsafe mode" | ||
else | ||
sed -i 's/^ro.build.version.sdk/# ro.build.version.sdk/' $MODPATH/system.prop | ||
sed -i 's/^ro.build.version.sdk/# ro.build.version.sdk/' "$MODPATH"/system.prop | ||
ui_print "- SDK=$API, running safe mode" | ||
fi | ||
|
||
# Remove comments from files and place them, add blank line to end if not already present | ||
# Scripts | ||
for i in $(find $MODPATH -type f -name "*.sh" -o -name "*.prop" -o -name "*.rule"); do | ||
[ -f $i ] && { sed -i -e "/^#/d" -e "/^ *$/d" $i; [ "$(tail -1 $i)" ] && echo "" >> $i; } || continue | ||
for i in $(find "$MODPATH" -type f -name "*.sh" -o -name "*.prop" -o -name "*.rule"); do | ||
[ -f "$i" ] && { | ||
sed -i -e "/^#/d" -e "/^ *$/d" "$i" | ||
[ "$(tail -1 "$i")" ] && echo "" >>"$i" | ||
} || continue | ||
done | ||
|
||
# Print footer message | ||
ui_print "- Script by Tesla, Telegram: @T3SL4" | ||
ui_print "- Script by Tesla, Telegram: @T3SL4" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters