gistfile1.txt
· 843 B · Text
Raw
diff --git a/msm-firmware-loader.sh b/msm-firmware-loader.sh
index c404553..d2c06a8 100644
--- a/msm-firmware-loader.sh
+++ b/msm-firmware-loader.sh
@@ -25,11 +25,14 @@ set -x
# https://source.android.com/docs/core/architecture/bootloader/updating#slots
ab_get_slot() {
if command -v qbootctl > /dev/null; then
- ab_slot_suffix=$(qbootctl -a | grep -o 'Active slot: ..' | cut -d ":" -f2 | xargs) || :
+ ab_slot_suffix=$(qbootctl -a | grep -oE 'Active slot: ((_[ab])|(\(null\)))' | cut -d ":" -f2 | xargs) || :
else
ab_slot_suffix=$(grep -o 'androidboot\.slot_suffix=..' /proc/cmdline | cut -d "=" -f2) || :
fi
- echo "$ab_slot_suffix"
+ if [ "$ab_slot_suffix" != "(null)" ]
+ then
+ echo "$ab_slot_suffix"
+ fi
}
# Configurations:
| 1 | diff --git a/msm-firmware-loader.sh b/msm-firmware-loader.sh |
| 2 | index c404553..d2c06a8 100644 |
| 3 | --- a/msm-firmware-loader.sh |
| 4 | +++ b/msm-firmware-loader.sh |
| 5 | @@ -25,11 +25,14 @@ set -x |
| 6 | # https://source.android.com/docs/core/architecture/bootloader/updating#slots |
| 7 | ab_get_slot() { |
| 8 | if command -v qbootctl > /dev/null; then |
| 9 | - ab_slot_suffix=$(qbootctl -a | grep -o 'Active slot: ..' | cut -d ":" -f2 | xargs) || : |
| 10 | + ab_slot_suffix=$(qbootctl -a | grep -oE 'Active slot: ((_[ab])|(\(null\)))' | cut -d ":" -f2 | xargs) || : |
| 11 | else |
| 12 | ab_slot_suffix=$(grep -o 'androidboot\.slot_suffix=..' /proc/cmdline | cut -d "=" -f2) || : |
| 13 | fi |
| 14 | - echo "$ab_slot_suffix" |
| 15 | + if [ "$ab_slot_suffix" != "(null)" ] |
| 16 | + then |
| 17 | + echo "$ab_slot_suffix" |
| 18 | + fi |
| 19 | } |
| 20 | |
| 21 | # Configurations: |
| 22 |