Skip to content

Commit

Permalink
android-gadget-setup: fix conditional argument to assign serial variable
Browse files Browse the repository at this point in the history
Change the conditional argument to check if androidserial is non-empty. The
condition `[ -n ]` ussed is an incomplete conditional test. In bash and
similar shells, `[ -n ]` without a string following `-n` is considered a syntax
error. /usr/bin/android-gadget-setup starts with `set -e` is used to change
behavior of the shell in various ways. `-e` option causes the shell to exit as
soon a command exits with a non-zero status. The syntax error in `[ -n ]`
causes the script to step and hence, android-tools-adbd service doesn't start.

Signed-off-by: Chirag Jain <[email protected]>
  • Loading branch information
chirag-jn committed Nov 21, 2023
1 parent 1842039 commit 24009a5
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
manufacturer=Qualcomm
model=`hostname`
androidserial="$(sed -n -e '/androidboot.serialno/ s/.*androidboot.serialno=\([^ ]*\).*/\1/gp ' /proc/cmdline)"
[ -n "$androidserial" ] && serial="$androidserial"
if [ -n "$androidserial" ]; then
serial="$androidserial"
fi

0 comments on commit 24009a5

Please sign in to comment.