diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d0298b2..ebe05f5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install clickable run: | python3 -m pip install clickable-ut @@ -18,7 +18,7 @@ jobs: run: | clickable build - name: Upload Artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: waydroid_helper_UNCONFINED path: build/all/app/*.click diff --git a/po/waydroidhelper.aaronhafer.pot b/po/waydroidhelper.aaronhafer.pot index c1e4a4a..1da192e 100644 --- a/po/waydroidhelper.aaronhafer.pot +++ b/po/waydroidhelper.aaronhafer.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: waydroidhelper.aaronhafer\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-27 23:26+0000\n" +"POT-Creation-Date: 2025-06-14 19:57+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -153,32 +153,30 @@ msgstr "" msgid "I understand the risk" msgstr "" -#: ../qml/Installer.qml:177 ../qml/Installer.qml:210 ../qml/Installer.qml:253 +#: ../qml/Installer.qml:177 ../qml/Installer.qml:209 ../qml/Installer.qml:252 #: ../qml/PasswordPrompt.qml:78 msgid "Cancel" msgstr "" #: ../qml/Installer.qml:194 msgid "" -"Waydroid doesn't officially support Android versions past 11 (yet). Your " -"device can still run unofficial Android 13 images (with some additional " -"bugs) from https://sourceforge.net/projects/aleasto-" -"lineageos/files/LineageOS 20/waydroid_arm64 which Waydroid Helper can " -"setup (excluding GAPPS).

Do you want to continue?" +"Waydroid doesn't support OTAs for Android versions past 11 just yet. Your " +"device can still run the Android 13 images downloaded from the official " +"SourceForge which Waydroid Helper can setup.

Do you want to " +"continue?" msgstr "" #: ../qml/Installer.qml:200 msgid "Yes" msgstr "" -#: ../qml/Installer.qml:239 +#: ../qml/Installer.qml:238 msgid "" "You can install a special version of Waydroid that comes with google apps. " "(I personally do not recommend this as it will result in worse privacy.)" msgstr "" -#: ../qml/Installer.qml:244 +#: ../qml/Installer.qml:243 msgid "Enable GAPPS" msgstr "" diff --git a/qml/Installer.qml b/qml/Installer.qml index ac696d1..363ee36 100644 --- a/qml/Installer.qml +++ b/qml/Installer.qml @@ -191,7 +191,7 @@ Page { title: "Disclaimer!" Label { - text: i18n.tr("Waydroid doesn't officially support Android versions past 11 (yet). Your device can still run unofficial Android 13 images (with some additional bugs) from https://sourceforge.net/projects/aleasto-lineageos/files/LineageOS 20/waydroid_arm64 which Waydroid Helper can setup (excluding GAPPS).

Do you want to continue?") + text: i18n.tr("Waydroid doesn't support OTAs for Android versions past 11 just yet. Your device can still run the Android 13 images downloaded from the official SourceForge which Waydroid Helper can setup.

Do you want to continue?") wrapMode: Text.Wrap onLinkActivated: Qt.openUrlExternally(link) } @@ -201,7 +201,6 @@ Page { color: theme.palette.normal.negative onClicked: { needsCustomImages = true; - gappsAction.visible = false; PopupUtils.close(dialogueCustom); } } diff --git a/src/installer.py b/src/installer.py index 49f7d91..136d3eb 100644 --- a/src/installer.py +++ b/src/installer.py @@ -57,18 +57,15 @@ def install(self, password, gAPPS, needsCustomImages): #Initializing waydroid (downloading lineage) def download(): - if needsCustomImages: - print("Initializing waydroid with custom images (downloading lineage)") - pyotherside.send('state', 'dl.init.vanilla', True) - child.sendline(f"python3 {self.click_rootdir}/src/waydroid-custom-init") - elif gAPPS == True: + waydroid = f"python3 {self.click_rootdir}/src/waydroid-custom-init" if needsCustomImages else "waydroid" + if gAPPS == True: print("Initializing waydroid with GAPPS (downloading lineage)") pyotherside.send('state', 'dl.init.gapps', True) - child.sendline("waydroid init -s GAPPS") + child.sendline(f"{waydroid} init -s GAPPS") else: print("Initializing waydroid (downloading lineage)") pyotherside.send('state', 'dl.init.vanilla', True) - child.sendline("waydroid init") + child.sendline(f"{waydroid} init") def dlstatus(): print("Download status running") diff --git a/src/waydroid-custom-init b/src/waydroid-custom-init index 8e8017a..80fbc4a 100755 --- a/src/waydroid-custom-init +++ b/src/waydroid-custom-init @@ -3,36 +3,35 @@ import sys import os import subprocess import shutil +import zipfile sys.path.insert(1, "/usr/lib/waydroid") import tools as waydroid -is_bindmnt_setup = os.path.ismount("/etc/waydroid-extra") +def ver(v): + return tuple(map(int, (v.split(".")))) + + +waydroid_ver = subprocess.check_output(["waydroid", "--version"]).decode() +wrapper_script_needed = ver(waydroid_ver) < ver("1.5.0") wrapper_script_exists = os.path.exists("/usr/local/bin/waydroid") +wrapper_script_changing = wrapper_script_needed is not wrapper_script_exists +previous_images_path = "/userdata/system-data/etc/waydroid-extra/images" # make / rw was_rw_root = False -if not (is_bindmnt_setup or wrapper_script_exists): +if not os.path.exists("/etc/waydroid-extra") or wrapper_script_changing: root = os.statvfs('/') if root.f_flag & os.ST_RDONLY: subprocess.run(["mount", "-o", "remount,rw", "/"]) else: was_rw_root = True +# still needed for bind-mount to trick "waydroid init" here +os.makedirs("/etc/waydroid-extra", exist_ok=True) -if not is_bindmnt_setup: - # use userdata as backing for /etc/waydroid-extra - os.makedirs("/userdata/system-data/etc/waydroid-extra", exist_ok=True) - os.makedirs("/etc/waydroid-extra", exist_ok=True) - subprocess.run(["mount", "-o", "bind", "/userdata/system-data/etc/waydroid-extra", "/etc/waydroid-extra"]) - - # make bind-mount survive reboots - with open("/etc/system-image/writable-paths", "a") as f: - f.write("/etc/waydroid-extra auto persistent none none\n") - - -if not wrapper_script_exists: +if wrapper_script_needed and not wrapper_script_exists: # workaround having to "double-launch" every UI action with open("/usr/local/bin/waydroid", "w") as f: f.write("""\ @@ -57,13 +56,27 @@ sleep 1 wait """) os.chmod("/usr/local/bin/waydroid", 0o755) - +elif not wrapper_script_needed and wrapper_script_exists: + os.remove("/usr/local/bin/waydroid") # we're done messing with rootfs if not was_rw_root: subprocess.run(["mount", "-o", "remount,ro", "/"]) +# any images setup by Waydroid Helper <=3.2.0 are likely unstable, clean them up and setup the new ones below +if os.path.exists(previous_images_path): + shutil.rmtree(previous_images_path) + +# avoid potential old /etc/system-image/writable-paths artifact +if os.path.ismount("/etc/waydroid-extra"): + subprocess.run(["umount", "/etc/waydroid-extra"]) + +# trick "waydroid init" etc for the remainder of this script +os.makedirs("/var/lib/waydroid/images", exist_ok=True) +subprocess.run(["mount", "--bind", "/var/lib/waydroid", "/etc/waydroid-extra"]) + + # prep for using waydroid download func similar to tools/__init__.py args = waydroid.helpers.arguments() args.work = waydroid.config.defaults["work"] @@ -72,20 +85,27 @@ args.timeout = 1800 args.log = args.work + "/waydroid.log" waydroid.helpers.logging.init(args) - -if os.path.exists("/etc/waydroid-extra/images/system.img"): +if os.path.exists("/var/lib/waydroid/images/vendor.img"): print("Already initialized") sys.exit(0) - -os.makedirs("/etc/waydroid-extra/images", exist_ok=True) -custom_images_url = "https://sourceforge.net/projects/aleasto-lineageos/files/LineageOS%2020/waydroid_arm64" -for img in ["system", "vendor"]: - downloaded_img = waydroid.helpers.http.download(args, f"{custom_images_url}/{img}.img/download", f"{img}.img", cache=False) - print(f"Validating {img} image") # stub - print("Extracting to /etc/waydroid-extra/images") - shutil.move(downloaded_img, f"/etc/waydroid-extra/images/{img}.img") +images_url = "https://sourceforge.net/projects/waydroid/files/images" +system_variant = "GAPPS" if "GAPPS" in sys.argv else "VANILLA" +images_date = "20250614" +for img in [f"system/lineage/waydroid_arm64/lineage-20.0-{images_date}-{system_variant}-waydroid_arm64-system", + f"vendor/waydroid_arm64/lineage-20.0-{images_date}-HALIUM_13-waydroid_arm64-vendor"]: + downloaded_zip = waydroid.helpers.http.download(args, f"{images_url}/{img}.zip/download", os.path.basename(f"{img}.zip"), cache=False) + print(f"Validating {'vendor' if 'vendor' in img else 'system'} image") # stub + print("Extracting to /var/lib/waydroid/images") + with zipfile.ZipFile(downloaded_zip, 'r') as zip_ref: + zip_ref.extractall("/var/lib/waydroid/images") + os.remove(downloaded_zip) # start using downloaded custom images -sys.exit(subprocess.run(["waydroid", "init", "-f"]).returncode) +ret = subprocess.run(["waydroid", "init", "-f"]).returncode +if ret != 0: + sys.exit(ret) + +# finally keep working by always searching for images in persistent-across-OTAs /var/lib/waydroid/images +sys.exit(subprocess.run(["sed", "-i", "s:/etc/waydroid-extra/images:/var/lib/waydroid/images:", "/var/lib/waydroid/waydroid.cfg"]).returncode)