From 088055f065c5eb3568a69a58509c1421c3873120 Mon Sep 17 00:00:00 2001 From: knackebrot Date: Sun, 24 Oct 2021 04:34:11 +0200 Subject: [PATCH] Simplify configuration - mount partitions to the empty folders on system partition - add executable permissions to scripts in repo - increase system partition size to accomodate bigger GApps (nano works) - use .gitkeep files --- #GAPPS/dummyfile | 1 - #IMAGES/dummyfile | 1 - .gitignore | 2 ++ README.md | 38 +++++------------------ VARIABLES | 16 ++++++++++ VARIABLES.sh | 21 ------------- apply.sh | 20 +++++------- extend_and_mount_images.sh | 23 +++++--------- extract_gapps_pico.sh => extract_gapps.sh | 2 +- gapps/.gitkeep | 0 images/.gitkeep | 0 unmount_images.sh | 12 +++---- 12 files changed, 47 insertions(+), 89 deletions(-) delete mode 100644 #GAPPS/dummyfile delete mode 100644 #IMAGES/dummyfile create mode 100644 .gitignore create mode 100644 VARIABLES delete mode 100644 VARIABLES.sh mode change 100644 => 100755 apply.sh mode change 100644 => 100755 extend_and_mount_images.sh rename extract_gapps_pico.sh => extract_gapps.sh (98%) mode change 100644 => 100755 create mode 100644 gapps/.gitkeep create mode 100644 images/.gitkeep mode change 100644 => 100755 unmount_images.sh diff --git a/#GAPPS/dummyfile b/#GAPPS/dummyfile deleted file mode 100644 index 2995a4d..0000000 --- a/#GAPPS/dummyfile +++ /dev/null @@ -1 +0,0 @@ -dummy \ No newline at end of file diff --git a/#IMAGES/dummyfile b/#IMAGES/dummyfile deleted file mode 100644 index 2995a4d..0000000 --- a/#IMAGES/dummyfile +++ /dev/null @@ -1 +0,0 @@ -dummy \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3448ff2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +gapps/ +images/ diff --git a/README.md b/README.md index 927f58c..509fa65 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ sudo apt install unzip lzip ### Download gapps -Select Platform: x86_64 if Windows architecture is x64, otherwise choose ARM64, Android: 11 and Variant: Pico on [OpenGApps](https://opengapps.org/) +Select Platform: x86_64 if Windows architecture is x64, otherwise choose ARM64, Android: 11 and Variant: Pico (or Nano) on [OpenGApps](https://opengapps.org/) ### Extract msixbundle @@ -46,39 +46,16 @@ For Ubuntu ``` git clone https://github.com/ADeltaX/WSAGAScript -cd WSAGAScript/\#IMAGES -mv /mnt/path-to-extracted-msix/*.img . -cd ../\#GAPPS -cp /mnt/path-to-downloaded-gapps/*.zip . +cd WSAGAScript/ +mv /mnt/path-to-extracted-msix/*.img images/ +cp /mnt/path-to-downloaded-gapps/*.zip gapps/ ``` paths in wsl follow the same as windows after /mnt/ its just the drive letter then folder structure as normal. For example /mnt/c/users would be the c:\users folder ### Edit scripts -Set executable permission for the scripts - -``` -cd .. -sudo chmod +x extract_gapps_pico.sh -sudo chmod +x extend_and_mount_images.sh -sudo chmod +x apply.sh -sudo chmod +x unmount_images.sh -``` - -Change the root directory in VARIABLES.sh - -``` -pwd -``` - -(take note of the output) - -``` -nano VARIABLES.sh -``` - -replace the root variable with the output of pwd up until and including the WSAGAScript folder +If needed, you can change the variables used in the scripts in the `VARIABLES` file. The defaults should work fine. **Debian WSL users need to create an mtab symlink:** ``` @@ -88,7 +65,7 @@ sudo ln -s /proc/self/mounts /etc/mtab ### Run the scripts ``` -sudo ./extract_gapps_pico.sh +sudo ./extract_gapps.sh sudo ./extend_and_mount_images.sh sudo ./apply.sh sudo ./unmount_images.sh @@ -97,8 +74,7 @@ sudo ./unmount_images.sh ### Copy the edited images ``` -cd \#IMAGES -cp *.img /mnt/path-to-extracted-msix/ +cp images/*.img /mnt/path-to-extracted-msix/ ``` ### Register the edited WSA diff --git a/VARIABLES b/VARIABLES new file mode 100644 index 0000000..3365bb0 --- /dev/null +++ b/VARIABLES @@ -0,0 +1,16 @@ +# Modify your variables here to corretly reference your directory and subdir + +Root="$(dirname "$(realpath "$0")")" + +MiscRoot="$Root/misc" + +GAppsRoot="$Root/gapps" +GAppsOutputFolder="$GAppsRoot/output" +GAppsExtractFolder="$GAppsRoot/extract" +GAppsTmpFolder="$GAppsRoot/tmp" + +ImagesRoot="$Root/images" +MountPointSystem="/mnt/system" + +InstallPartition="$MountPointSystem" +InstallDir="$InstallPartition/system" diff --git a/VARIABLES.sh b/VARIABLES.sh deleted file mode 100644 index c9d9278..0000000 --- a/VARIABLES.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -# Modify your variables here to corretly reference your directory and subdir - -Root="/mnt/c/GAppsWSA" - -MiscRoot="$Root/misc" - -GAppsRoot="$Root/#GAPPS" -GAppsOutputFolder="$GAppsRoot/output" -GAppsExtractFolder="$GAppsRoot/extract" -GAppsTmpFolder="$GAppsRoot/tmp" - -ImagesRoot="$Root/#IMAGES" -MountPointProduct="/mnt/product" -MountPointSystemExt="/mnt/system_ext" -MountPointSystem="/mnt/system" -MountPointVendor="/mnt/vendor" - -InstallPartition="/mnt/system" -InstallDir="$InstallPartition/system" \ No newline at end of file diff --git a/apply.sh b/apply.sh old mode 100644 new mode 100755 index 09a125d..0975a21 --- a/apply.sh +++ b/apply.sh @@ -1,21 +1,17 @@ #!/bin/bash -. ./VARIABLES.sh +. ./VARIABLES echo "Copying build.prop for each image" -cp "$MiscRoot/prop/build_system_ext.prop" /mnt/system_ext/build.prop -cp "$MiscRoot/prop/build_system.prop" /mnt/system/build.prop -cp "$MiscRoot/prop/build_system.prop" /mnt/system/system/build.prop -cp "$MiscRoot/prop/build_product.prop" /mnt/product/build.prop -cp "$MiscRoot/prop/build_vendor.prop" /mnt/vendor/build.prop -cp "$MiscRoot/prop/build_vendor_odm.prop" /mnt/vendor/odm/etc/vendor.prop +cp "$MiscRoot/prop/build_system_ext.prop" "$MountPointSystem/system_ext/build.prop" +cp "$MiscRoot/prop/build_system.prop" "$MountPointSystem/build.prop" +cp "$MiscRoot/prop/build_system.prop" "$MountPointSystem/system/build.prop" +cp "$MiscRoot/prop/build_product.prop" "$MountPointSystem/product/build.prop" +cp "$MiscRoot/prop/build_vendor.prop" "$MountPointSystem/vendor/build.prop" +cp "$MiscRoot/prop/build_vendor_odm.prop" "$MountPointSystem/vendor/odm/etc/vendor.prop" echo "Copying GApps files to system..." -cp -f -a $GAppsOutputFolder/app/* $InstallDir/app -cp -f -a $GAppsOutputFolder/etc/* $InstallDir/etc -cp -f -a $GAppsOutputFolder/overlay/* $InstallDir/overlay -cp -f -a $GAppsOutputFolder/priv-app/* $InstallDir/priv-app -cp -f -a $GAppsOutputFolder/framework/* $InstallDir/framework +cp -Ra $GAppsOutputFolder/* $InstallDir/ echo "Applying root file ownership" find $InstallDir/app -exec chown root:root {} &>/dev/null \; diff --git a/extend_and_mount_images.sh b/extend_and_mount_images.sh old mode 100644 new mode 100755 index f5a8b15..c84fc02 --- a/extend_and_mount_images.sh +++ b/extend_and_mount_images.sh @@ -1,6 +1,6 @@ #!/bin/bash -. ./VARIABLES.sh +. ./VARIABLES echo "chk product.img" e2fsck -f $ImagesRoot/product.img @@ -12,7 +12,7 @@ echo "chk system.img" e2fsck -f $ImagesRoot/system.img echo "Resizing system.img" -resize2fs $ImagesRoot/system.img 1280M +resize2fs $ImagesRoot/system.img 1536M echo "chk system_ext.img" e2fsck -f $ImagesRoot/system_ext.img @@ -26,28 +26,19 @@ e2fsck -f $ImagesRoot/vendor.img echo "Resizing vendor.img" resize2fs $ImagesRoot/vendor.img 300M -echo "Creating mount point for product" -mkdir -p $MountPointProduct - -echo "Creating mount point for system_ext" -mkdir -p $MountPointSystemExt - echo "Creating mount point for system" mkdir -p $MountPointSystem -echo "Creating mount point for vendor" -mkdir -p $MountPointVendor +echo "Mounting system" +mount -o rw $ImagesRoot/system.img $MountPointSystem echo "Mounting product" -mount -o rw $ImagesRoot/product.img $MountPointProduct +mount -o rw $ImagesRoot/product.img $MountPointSystem/product echo "Mounting system_ext" -mount -o rw $ImagesRoot/system_ext.img $MountPointSystemExt - -echo "Mounting system" -mount -o rw $ImagesRoot/system.img $MountPointSystem +mount -o rw $ImagesRoot/system_ext.img $MountPointSystem/system_ext echo "Mounting vendor" -mount -o rw $ImagesRoot/vendor.img $MountPointVendor +mount -o rw $ImagesRoot/vendor.img $MountPointSystem/vendor echo "!! Images mounted !!" \ No newline at end of file diff --git a/extract_gapps_pico.sh b/extract_gapps.sh old mode 100644 new mode 100755 similarity index 98% rename from extract_gapps_pico.sh rename to extract_gapps.sh index af0c195..128d5c9 --- a/extract_gapps_pico.sh +++ b/extract_gapps.sh @@ -1,6 +1,6 @@ #!/bin/bash -. ./VARIABLES.sh +. ./VARIABLES rm -rf $GAppsOutputFolder rm -rf $GAppsTmpFolder diff --git a/gapps/.gitkeep b/gapps/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/images/.gitkeep b/images/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/unmount_images.sh b/unmount_images.sh old mode 100644 new mode 100755 index 7b0ef6d..6387c7f --- a/unmount_images.sh +++ b/unmount_images.sh @@ -1,17 +1,17 @@ #!/bin/bash -. ./VARIABLES.sh +. ./VARIABLES echo "Unmounting product.img" -umount $MountPointProduct +umount $MountPointSystem/product echo "Unmounting system_ext.img" -umount $MountPointSystemExt +umount $MountPointSystem/system_ext + +echo "Unmounting vendor.img" +umount $MountPointSystem/vendor echo "Unmounting system.img" umount $MountPointSystem -echo "Unmounting vendor.img" -umount $MountPointVendor - echo "!! Unmounting completed !!" \ No newline at end of file