Calculate the size dynamically (#427)

This commit is contained in:
Howard Wu 2022-06-22 07:57:43 +08:00 committed by GitHub
parent a9bb8433af
commit 1f3721dbd9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -270,17 +270,17 @@ jobs:
urllib.request.urlretrieve(link, out_file) urllib.request.urlretrieve(link, out_file)
print("done", flush=True) print("done", flush=True)
- name: Extract GApps and expand images - name: Extract GApps
if: ${{ github.event.inputs.gapps_variant != 'none' && github.event.inputs.gapps_variant != '' }} if: ${{ github.event.inputs.gapps_variant != 'none' && github.event.inputs.gapps_variant != '' }}
run: | run: |
mkdir gapps mkdir gapps
unzip -p gapps.zip {Core,GApps}/'*.lz' | tar --lzip -C gapps -xvf - -i --strip-components=2 --exclude='setupwizardtablet-x86_64' --exclude='packageinstallergoogle-all' --exclude='speech-common' --exclude='markup-lib-arm' --exclude='markup-lib-arm64' --exclude='markup-all' --exclude='setupwizarddefault-x86_64' --exclude='pixellauncher-all' --exclude='pixellauncher-common' unzip -p gapps.zip {Core,GApps}/'*.lz' | tar --lzip -C gapps -xvf - -i --strip-components=2 --exclude='setupwizardtablet-x86_64' --exclude='packageinstallergoogle-all' --exclude='speech-common' --exclude='markup-lib-arm' --exclude='markup-lib-arm64' --exclude='markup-all' --exclude='setupwizarddefault-x86_64' --exclude='pixellauncher-all' --exclude='pixellauncher-common'
# TODO: calculate the size dynamically for better compatibility - name: Expand images
e2fsck -yf ${{ matrix.arch }}/system_ext.img
resize2fs ${{ matrix.arch }}/system_ext.img 200M
- name: Expand vendor and system
run: | run: |
e2fsck -yf ${{ matrix.arch }}/system_ext.img
system_ext_size=$(( $(du -sB512 ${{ matrix.arch }}/system_ext.img | cut -f1) + 20000 ))
resize2fs ${{ matrix.arch }}/system_ext.img "$system_ext_size"s
e2fsck -yf ${{ matrix.arch }}/product.img e2fsck -yf ${{ matrix.arch }}/product.img
product_size=$(( $(du -sB512 ${{ matrix.arch }}/product.img | cut -f1) + 20000 )) product_size=$(( $(du -sB512 ${{ matrix.arch }}/product.img | cut -f1) + 20000 ))
if [ -d gapps/product ]; then if [ -d gapps/product ]; then
@ -300,7 +300,8 @@ jobs:
fi fi
resize2fs ${{ matrix.arch }}/system.img "$system_size"s resize2fs ${{ matrix.arch }}/system.img "$system_size"s
e2fsck -yf ${{ matrix.arch }}/vendor.img e2fsck -yf ${{ matrix.arch }}/vendor.img
resize2fs ${{ matrix.arch }}/vendor.img 400M vendor_size=$(( $(du -sB512 ${{ matrix.arch }}/vendor.img | cut -f1) + 20000 ))
resize2fs ${{ matrix.arch }}/vendor.img "$vendor_size"s
- name: Mount images - name: Mount images
run: | run: |
sudo mkdir system sudo mkdir system
@ -662,7 +663,7 @@ jobs:
fi fi
echo "artifact_name=WSA${name1}${name2}_${{ env.WSA_VER }}_${{ matrix.arch }}_${{ env.WSA_REL }}" >> $GITHUB_ENV echo "artifact_name=WSA${name1}${name2}_${{ env.WSA_VER }}_${{ matrix.arch }}_${{ env.WSA_REL }}" >> $GITHUB_ENV
- name: Upload WSA - name: Upload WSA
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v3
with: with:
name: ${{ env.artifact_name }} name: ${{ env.artifact_name }}
path: "./${{ matrix.arch }}/*" path: "./${{ matrix.arch }}/*"