Skip to content

Instantly share code, notes, and snippets.

@schnatterer
Last active January 4, 2023 21:03
Show Gist options
  • Select an option

  • Save schnatterer/ad7033bf476587aa43a37f3232feeb71 to your computer and use it in GitHub Desktop.

Select an option

Save schnatterer/ad7033bf476587aa43a37f3232feeb71 to your computer and use it in GitHub Desktop.

Revisions

  1. schnatterer revised this gist Jan 4, 2023. 1 changed file with 0 additions and 2 deletions.
    2 changes: 0 additions & 2 deletions boot-img.sh
    Original file line number Diff line number Diff line change
    @@ -23,8 +23,6 @@ TMPDIR=$(mktemp -d)
    ZIP_PATH=$(unzip -l release.zip | grep .zip | awk '{print $4}')
    unzip -j release.zip $ZIP_PATH
    rm release.zip release.zip.minisig
    # only one path inside
    #cd $(ls -d */)
    FINAL_ZIP=$(find . -iname '*.zip')
    # Note that there is a vendor_boot.img
    BOOT_IMG_PATH=$(unzip -l $FINAL_ZIP | grep ' boot.img' | awk '{print $4}')
  2. schnatterer revised this gist Jan 4, 2023. No changes.
  3. schnatterer created this gist Jan 4, 2023.
    39 changes: 39 additions & 0 deletions boot-img.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,39 @@
    #!/usr/bin/env bash

    set -o errexit -o nounset -o pipefail

    # Download lastest Calyx factory image and extract boot.img to be patched via magisk
    # See here for device names: https://calyxos.org/install/
    DEVICE=oriole

    CHANNEL=stable4
    DEST_DIR=/storage/emulated/0/Download
    VERSION=$(curl -s https://release.calyxinstitute.org/$DEVICE-$CHANNEL | cut -d ' ' -f1)
    TMPDIR=$(mktemp -d)
    (
    cd $TMPDIR

    # See also updater app # https://gitlab.com/CalyxOS/platform_packages_apps_Updater/-/blob/android13/src/app/seamlessupdate/client/Service.java#L263
    curl -o release.zip https://release.calyxinstitute.org/oriole-factory-$VERSION.zip
    curl -o release.zip.minisig https://release.calyxinstitute.org/oriole-factory-$VERSION.zip.minisig # Download the public key
    curl -o minisign.pub https://release.calyxinstitute.org/minisign.pub

    minisign -Vm release.zip -p minisign.pub
    #unzip -l e.g. 967 2023-01-04 19:05 something/some.zip
    ZIP_PATH=$(unzip -l release.zip | grep .zip | awk '{print $4}')
    unzip -j release.zip $ZIP_PATH
    rm release.zip release.zip.minisig
    # only one path inside
    #cd $(ls -d */)
    FINAL_ZIP=$(find . -iname '*.zip')
    # Note that there is a vendor_boot.img
    BOOT_IMG_PATH=$(unzip -l $FINAL_ZIP | grep ' boot.img' | awk '{print $4}')

    unzip -j $FINAL_ZIP $BOOT_IMG_PATH
    )

    mv $TMPDIR/boot.img $DEST_DIR/$DEVICE-$VERSION-boot.img
    rm -rf $TMPDIR
    echo Wrote $DEST_DIR/$DEVICE-$VERSION-boot.img
    # Patch img right away?
    # https://github.com/affggh/Magisk_patcher/blob/ttkbootstrap/README_EN.md