From 1f3721dbd941a096e53a0b14001ab1a4ae2759f2 Mon Sep 17 00:00:00 2001 From: Howard Wu <40033067+Howard20181@users.noreply.github.com> Date: Wed, 22 Jun 2022 07:57:43 +0800 Subject: [PATCH] Calculate the size dynamically (#427) --- .github/workflows/magisk.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/magisk.yml b/.github/workflows/magisk.yml index 7ebf5a5..125fa41 100644 --- a/.github/workflows/magisk.yml +++ b/.github/workflows/magisk.yml @@ -270,17 +270,17 @@ jobs: urllib.request.urlretrieve(link, out_file) 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 != '' }} run: | 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' - # TODO: calculate the size dynamically for better compatibility - e2fsck -yf ${{ matrix.arch }}/system_ext.img - resize2fs ${{ matrix.arch }}/system_ext.img 200M - - name: Expand vendor and system + - name: Expand images 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 product_size=$(( $(du -sB512 ${{ matrix.arch }}/product.img | cut -f1) + 20000 )) if [ -d gapps/product ]; then @@ -300,7 +300,8 @@ jobs: fi resize2fs ${{ matrix.arch }}/system.img "$system_size"s 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 run: | sudo mkdir system @@ -662,7 +663,7 @@ jobs: fi echo "artifact_name=WSA${name1}${name2}_${{ env.WSA_VER }}_${{ matrix.arch }}_${{ env.WSA_REL }}" >> $GITHUB_ENV - name: Upload WSA - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: ${{ env.artifact_name }} path: "./${{ matrix.arch }}/*"