mirror of
https://github.com/MustardChef/WSABuilds.git
synced 2024-11-27 05:34:16 +01:00
close #28
This commit is contained in:
parent
9817f89a94
commit
9117ee91d1
@ -25,10 +25,9 @@ with zipfile.ZipFile(Path.cwd().parent / "download/wsa.zip") as zip:
|
|||||||
if arch in f.filename.lower():
|
if arch in f.filename.lower():
|
||||||
zip_name = f.filename
|
zip_name = f.filename
|
||||||
output_name = zip_name[11:-5]
|
output_name = zip_name[11:-5]
|
||||||
print(output_name)
|
|
||||||
if not os.path.isfile(workdir / zip_name):
|
if not os.path.isfile(workdir / zip_name):
|
||||||
zip_path = workdir / zip_name
|
zip_path = workdir / zip_name
|
||||||
#print(f"unzipping to {workdir}", flush=True)
|
print(f"unzipping to {workdir}", flush=True)
|
||||||
zip.extract(f, workdir)
|
zip.extract(f, workdir)
|
||||||
ver_no = zip_name.split("_")
|
ver_no = zip_name.split("_")
|
||||||
long_ver = ver_no[1]
|
long_ver = ver_no[1]
|
||||||
@ -55,7 +54,5 @@ with zipfile.ZipFile(Path.cwd().parent / "download/wsa.zip") as zip:
|
|||||||
l.extract(g, workdir / 'xml')
|
l.extract(g, workdir / 'xml')
|
||||||
with zipfile.ZipFile(zip_path) as zip:
|
with zipfile.ZipFile(zip_path) as zip:
|
||||||
if not os.path.isdir(workdir / arch):
|
if not os.path.isdir(workdir / arch):
|
||||||
#print(f"unzipping from {zip_path}", flush=True)
|
print(f"unzipping from {zip_path}", flush=True)
|
||||||
zip.extractall(workdir / arch)
|
zip.extractall(workdir / arch)
|
||||||
|
|
||||||
#print("done", flush=True)
|
|
||||||
|
@ -147,7 +147,7 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
clear
|
clear
|
||||||
echo -e "ARCH=$ARCH\nRELEASE_TYPE=$RELEASE_TYPE\nMAGISK_VER=$MAGISK_VER\nGAPPS_VARIANT=$GAPPS_VARIANT\nREMOVE_AMAZON=$REMOVE_AMAZON\nROOT_SOL=$ROOT_SOL\n"
|
echo -e "ARCH=$ARCH\nRELEASE_TYPE=$RELEASE_TYPE\nMAGISK_VER=$MAGISK_VER\nGAPPS_VARIANT=$GAPPS_VARIANT\nREMOVE_AMAZON=$REMOVE_AMAZON\nROOT_SOL=$ROOT_SOL\nCOMPRESS_OUTPUT=$COMPRESS_OUTPUT"
|
||||||
|
|
||||||
echo "Download WSA"
|
echo "Download WSA"
|
||||||
python3 downloadWSA.py "$ARCH" "$RELEASE_TYPE" || abort
|
python3 downloadWSA.py "$ARCH" "$RELEASE_TYPE" || abort
|
||||||
@ -157,7 +157,7 @@ echo "Extract WSA"
|
|||||||
WSA_WORK_ENV="$WORK_DIR"/ENV
|
WSA_WORK_ENV="$WORK_DIR"/ENV
|
||||||
if [ -f "$WSA_WORK_ENV" ]; then rm -f "$WSA_WORK_ENV"; fi
|
if [ -f "$WSA_WORK_ENV" ]; then rm -f "$WSA_WORK_ENV"; fi
|
||||||
export WSA_WORK_ENV
|
export WSA_WORK_ENV
|
||||||
BASE_NAME=$(python3 extractWSA.py "$ARCH" "$WORK_DIR") || abort
|
python3 extractWSA.py "$ARCH" "$WORK_DIR" || abort
|
||||||
echo -e "Extract done\n"
|
echo -e "Extract done\n"
|
||||||
|
|
||||||
echo "Download Magisk"
|
echo "Download Magisk"
|
||||||
@ -185,37 +185,37 @@ fi
|
|||||||
echo "Expand images"
|
echo "Expand images"
|
||||||
|
|
||||||
e2fsck -yf "$WORK_DIR"/wsa/"$ARCH"/system_ext.img || abort
|
e2fsck -yf "$WORK_DIR"/wsa/"$ARCH"/system_ext.img || abort
|
||||||
SYSTEM_EXT_SIZE=$(($(du -bsB512 "$WORK_DIR"/wsa/"$ARCH"/system_ext.img | cut -f1) + 20000))
|
SYSTEM_EXT_SIZE=$(($(du --apparent-size -sB512 "$WORK_DIR"/wsa/"$ARCH"/system_ext.img | cut -f1) + 20000))
|
||||||
if [ -d "$WORK_DIR"/gapps/system_ext ]; then
|
if [ -d "$WORK_DIR"/gapps/system_ext ]; then
|
||||||
SYSTEM_EXT_SIZE=$(( SYSTEM_EXT_SIZE + $(du -bsB512 "$WORK_DIR"/gapps/system_ext | cut -f1) ))
|
SYSTEM_EXT_SIZE=$(( SYSTEM_EXT_SIZE + $(du --apparent-size -sB512 "$WORK_DIR"/gapps/system_ext | cut -f1) ))
|
||||||
fi
|
fi
|
||||||
resize2fs "$WORK_DIR"/wsa/"$ARCH"/system_ext.img "$SYSTEM_EXT_SIZE"s || abort
|
resize2fs "$WORK_DIR"/wsa/"$ARCH"/system_ext.img "$SYSTEM_EXT_SIZE"s || abort
|
||||||
|
|
||||||
e2fsck -yf "$WORK_DIR"/wsa/"$ARCH"/product.img || abort
|
e2fsck -yf "$WORK_DIR"/wsa/"$ARCH"/product.img || abort
|
||||||
PRODUCT_SIZE=$(($(du -bsB512 "$WORK_DIR"/wsa/"$ARCH"/product.img | cut -f1) + 20000))
|
PRODUCT_SIZE=$(($(du --apparent-size -sB512 "$WORK_DIR"/wsa/"$ARCH"/product.img | cut -f1) + 20000))
|
||||||
if [ -d "$WORK_DIR"/gapps/product ]; then
|
if [ -d "$WORK_DIR"/gapps/product ]; then
|
||||||
PRODUCT_SIZE=$(( PRODUCT_SIZE + $(du -bsB512 "$WORK_DIR"/gapps/product | cut -f1) ))
|
PRODUCT_SIZE=$(( PRODUCT_SIZE + $(du --apparent-size -sB512 "$WORK_DIR"/gapps/product | cut -f1) ))
|
||||||
fi
|
fi
|
||||||
resize2fs "$WORK_DIR"/wsa/"$ARCH"/product.img "$PRODUCT_SIZE"s || abort
|
resize2fs "$WORK_DIR"/wsa/"$ARCH"/product.img "$PRODUCT_SIZE"s || abort
|
||||||
|
|
||||||
e2fsck -yf "$WORK_DIR"/wsa/"$ARCH"/system.img || abort
|
e2fsck -yf "$WORK_DIR"/wsa/"$ARCH"/system.img || abort
|
||||||
SYSTEM_SIZE=$(($(du -bsB512 "$WORK_DIR"/wsa/"$ARCH"/system.img | cut -f1) + 20000))
|
SYSTEM_SIZE=$(($(du --apparent-size -sB512 "$WORK_DIR"/wsa/"$ARCH"/system.img | cut -f1) + 20000))
|
||||||
if [ -d "$WORK_DIR"/gapps ]; then
|
if [ -d "$WORK_DIR"/gapps ]; then
|
||||||
SYSTEM_SIZE=$(( SYSTEM_SIZE + $(du -bsB512 "$WORK_DIR"/gapps | cut -f1) - $(du -bsB512 "$WORK_DIR"/gapps/product | cut -f1) ))
|
SYSTEM_SIZE=$(( SYSTEM_SIZE + $(du --apparent-size -sB512 "$WORK_DIR"/gapps | cut -f1) - $(du --apparent-size -sB512 "$WORK_DIR"/gapps/product | cut -f1) ))
|
||||||
if [ -d "$WORK_DIR"/gapps/system_ext ]; then
|
if [ -d "$WORK_DIR"/gapps/system_ext ]; then
|
||||||
SYSTEM_SIZE=$(( SYSTEM_SIZE - $(du -bsB512 "$WORK_DIR"/gapps/system_ext | cut -f1) ))
|
SYSTEM_SIZE=$(( SYSTEM_SIZE - $(du --apparent-size -sB512 "$WORK_DIR"/gapps/system_ext | cut -f1) ))
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ -d "$WORK_DIR"/magisk ]; then
|
if [ -d "$WORK_DIR"/magisk ]; then
|
||||||
SYSTEM_SIZE=$(( SYSTEM_SIZE + $(du -bsB512 "$WORK_DIR"/magisk/magisk | cut -f1) ))
|
SYSTEM_SIZE=$(( SYSTEM_SIZE + $(du --apparent-size -sB512 "$WORK_DIR"/magisk/magisk | cut -f1) ))
|
||||||
fi
|
fi
|
||||||
if [ -f "$DOWNLOAD_DIR"/magisk.zip ]; then
|
if [ -f "$DOWNLOAD_DIR"/magisk.zip ]; then
|
||||||
SYSTEM_SIZE=$(( SYSTEM_SIZE + $(du -bsB512 "$DOWNLOAD_DIR"/magisk.zip | cut -f1) ))
|
SYSTEM_SIZE=$(( SYSTEM_SIZE + $(du --apparent-size -sB512 "$DOWNLOAD_DIR"/magisk.zip | cut -f1) ))
|
||||||
fi
|
fi
|
||||||
resize2fs "$WORK_DIR"/wsa/"$ARCH"/system.img "$SYSTEM_SIZE"s || abort
|
resize2fs "$WORK_DIR"/wsa/"$ARCH"/system.img "$SYSTEM_SIZE"s || abort
|
||||||
|
|
||||||
e2fsck -yf "$WORK_DIR"/wsa/"$ARCH"/vendor.img || abort
|
e2fsck -yf "$WORK_DIR"/wsa/"$ARCH"/vendor.img || abort
|
||||||
VENDOR_SIZE=$(($(du -bsB512 "$WORK_DIR"/wsa/"$ARCH"/vendor.img | cut -f1) + 20000))
|
VENDOR_SIZE=$(($(du --apparent-size -sB512 "$WORK_DIR"/wsa/"$ARCH"/vendor.img | cut -f1) + 20000))
|
||||||
resize2fs "$WORK_DIR"/wsa/"$ARCH"/vendor.img "$VENDOR_SIZE"s || abort
|
resize2fs "$WORK_DIR"/wsa/"$ARCH"/vendor.img "$VENDOR_SIZE"s || abort
|
||||||
echo -e "Expand images done\n"
|
echo -e "Expand images done\n"
|
||||||
|
|
||||||
@ -541,6 +541,7 @@ EOF
|
|||||||
echo -e "Remove signature and add scripts done\n"
|
echo -e "Remove signature and add scripts done\n"
|
||||||
|
|
||||||
echo "Generate info"
|
echo "Generate info"
|
||||||
|
source "$WORK_DIR/ENV"
|
||||||
if [[ "$ROOT_SOL" = "none" ]]; then
|
if [[ "$ROOT_SOL" = "none" ]]; then
|
||||||
name1=""
|
name1=""
|
||||||
elif [[ "$ROOT_SOL" = "" ]]; then
|
elif [[ "$ROOT_SOL" = "" ]]; then
|
||||||
@ -556,17 +557,18 @@ else
|
|||||||
fi
|
fi
|
||||||
name2="-GApps-${GAPPS_VARIANT}"
|
name2="-GApps-${GAPPS_VARIANT}"
|
||||||
fi
|
fi
|
||||||
echo "WSA${name1}${name2}_${ARCH}"
|
artifact_name="WSA${name1}${name2}_${WSA_VER}_${ARCH}_${WSA_REL}"
|
||||||
cat "$WORK_DIR"/ENV
|
echo "$artifact_name"
|
||||||
|
|
||||||
echo -e "\nFinishing building...."
|
echo -e "\nFinishing building...."
|
||||||
if [ ! -d "$OUTPUT_DIR" ]; then
|
if [ ! -d "$OUTPUT_DIR" ]; then
|
||||||
mkdir "$OUTPUT_DIR"
|
mkdir "$OUTPUT_DIR"
|
||||||
fi
|
fi
|
||||||
if [ "$COMPRESS_OUTPUT" = "yes" ]; then
|
if [ "$COMPRESS_OUTPUT" = "yes" ]; then
|
||||||
zip -jrm "$OUTPUT_DIR"/"WSA-GApps-$GAPPS_VARIANT-$BASE_NAME.zip" "$WORK_DIR"/wsa/"$ARCH" || abort
|
rm -f "$OUTPUT_DIR"/"$artifact_name.7z"
|
||||||
|
7z a "$OUTPUT_DIR"/"$artifact_name.7z" "$WORK_DIR/wsa/$ARCH/" || abort
|
||||||
elif [ "$COMPRESS_OUTPUT" = "no" ]; then
|
elif [ "$COMPRESS_OUTPUT" = "no" ]; then
|
||||||
cp -rf "$WORK_DIR"/wsa/"$ARCH"/* "$OUTPUT_DIR"/"WSA-GApps-$GAPPS_VARIANT-$BASE_NAME" || abort
|
rm -rf "'$OUTPUT_DIR'/'$artifact_name'" || abort
|
||||||
|
mv "$WORK_DIR"/wsa/"$ARCH" "$OUTPUT_DIR"/"$artifact_name" || abort
|
||||||
fi
|
fi
|
||||||
echo -e "done\n"
|
echo -e "done\n"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user