push-update: Detect adb root status
Change-Id: Iaf52450d566f3fce556a134d19e0ce93cd3403d9
This commit is contained in:
@@ -16,9 +16,15 @@ if [ "`adb get-state 2>/dev/null`" != "device" ]; then
|
|||||||
echo "No device found. Waiting for one..."
|
echo "No device found. Waiting for one..."
|
||||||
adb wait-for-device
|
adb wait-for-device
|
||||||
fi
|
fi
|
||||||
if ! adb root; then
|
uid=$(adb shell id -u)
|
||||||
echo "Could not run adbd as root"
|
if [ "$uid" -ne 0 ]; then
|
||||||
exit 1
|
if ! adb root; then
|
||||||
|
echo "Could not run adbd as root"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
did_root=1
|
||||||
|
else
|
||||||
|
did_root=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
zip_path_device=$updates_dir/`basename "$zip_path"`
|
zip_path_device=$updates_dir/`basename "$zip_path"`
|
||||||
@@ -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)" \
|
"\"INSERT INTO updates (status, path, download_id, timestamp, type, version, size)" \
|
||||||
" VALUES ($status, '$zip_path_device', '$id', $timestamp, '$type', '$version', $size)\""
|
" VALUES ($status, '$zip_path_device', '$id', $timestamp, '$type', '$version', $size)\""
|
||||||
|
|
||||||
# Exit root mode
|
if [ "$did_root" -ne 0 ]; then
|
||||||
adb unroot
|
# Exit root mode
|
||||||
|
adb unroot
|
||||||
|
fi
|
||||||
|
Reference in New Issue
Block a user