Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7c9ce4bc authored by Tom Marshall's avatar Tom Marshall
Browse files

push-update: Detect adb root status

Change-Id: Iaf52450d566f3fce556a134d19e0ce93cd3403d9
parent f42f69bf
Loading
Loading
Loading
Loading
+13 −5
Original line number Diff line number Diff line
@@ -16,10 +16,16 @@ if [ "`adb get-state 2>/dev/null`" != "device" ]; then
    echo "No device found. Waiting for one..."
    adb wait-for-device
fi
uid=$(adb shell id -u)
if [ "$uid" -ne 0 ]; then
    if ! adb root; then
        echo "Could not run adbd as root"
        exit 1
    fi
    did_root=1
else
    did_root=0
fi

zip_path_device=$updates_dir/`basename "$zip_path"`
if adb shell test -f "$zip_path_device"; then
@@ -52,5 +58,7 @@ adb shell "sqlite3 /data/data/org.lineageos.updater/databases/updates.db" \
    "\"INSERT INTO updates (status, path, download_id, timestamp, type, version, size)" \
    "  VALUES ($status, '$zip_path_device', '$id', $timestamp, '$type', '$version', $size)\""

if [ "$did_root" -ne 0 ]; then
    # Exit root mode
    adb unroot
fi