Skip to content

Commit

Permalink
Simplify configuration
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
knackebrot committed Oct 24, 2021
1 parent 9a24d81 commit 93e444e
Show file tree
Hide file tree
Showing 12 changed files with 45 additions and 87 deletions.
1 change: 0 additions & 1 deletion #GAPPS/dummyfile

This file was deleted.

1 change: 0 additions & 1 deletion #IMAGES/dummyfile

This file was deleted.

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
gapps/
images/
34 changes: 5 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:**
```
Expand All @@ -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
Expand Down
16 changes: 16 additions & 0 deletions VARIABLES
Original file line number Diff line number Diff line change
@@ -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"
21 changes: 0 additions & 21 deletions VARIABLES.sh

This file was deleted.

20 changes: 8 additions & 12 deletions apply.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -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 \;
Expand Down
23 changes: 7 additions & 16 deletions extend_and_mount_images.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

. ./VARIABLES.sh
. ./VARIABLES

echo "chk product.img"
e2fsck -f $ImagesRoot/product.img
Expand All @@ -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
Expand All @@ -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 !!"
2 changes: 1 addition & 1 deletion extract_gapps_pico.sh → extract_gapps.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

. ./VARIABLES.sh
. ./VARIABLES

rm -rf $GAppsOutputFolder
rm -rf $GAppsTmpFolder
Expand Down
Empty file added gapps/.gitkeep
Empty file.
Empty file added images/.gitkeep
Empty file.
12 changes: 6 additions & 6 deletions unmount_images.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -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 !!"

0 comments on commit 93e444e

Please sign in to comment.