Calculate product size dynamically

This commit is contained in:
Howard Wu 2022-06-17 19:39:42 +08:00 committed by LoveSy
parent e1bdbdf39e
commit 58763270a9

View File

@ -269,12 +269,16 @@ jobs:
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 # TODO: calculate the size dynamically for better compatibility
e2fsck -yf ${{ matrix.arch }}/product.img
resize2fs ${{ matrix.arch }}/product.img 1024M
e2fsck -yf ${{ matrix.arch }}/system_ext.img e2fsck -yf ${{ matrix.arch }}/system_ext.img
resize2fs ${{ matrix.arch }}/system_ext.img 200M resize2fs ${{ matrix.arch }}/system_ext.img 200M
- name: Expand vendor and system - name: Expand vendor and system
run: | run: |
e2fsck -yf ${{ matrix.arch }}/product.img
product_size=$(( $(du -sB512 ${{ matrix.arch }}/product.img | cut -f1) + 20000 ))
if [ -d gapps/product ]; then
product_size=$(( $product_size + $(du -sB512 gapps/product | cut -f1) ))
fi
resize2fs ${{ matrix.arch }}/product.img "$product_size"s
e2fsck -yf ${{ matrix.arch }}/system.img e2fsck -yf ${{ matrix.arch }}/system.img
system_size=$(( $(du -sB512 ${{ matrix.arch }}/system.img | cut -f1) + 20000 )) system_size=$(( $(du -sB512 ${{ matrix.arch }}/system.img | cut -f1) + 20000 ))
if [ -d gapps ]; then if [ -d gapps ]; then