Skip to content

Commit

Permalink
Merge pull request #39 from jjkola/fix/better_busybox_check
Browse files Browse the repository at this point in the history
Ensure that busybox is found from expected path
  • Loading branch information
YasserNull authored Sep 28, 2024
2 parents 369f15e + 865754d commit 51d96e5
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion system/bin/chroot-distro
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,22 @@ if [ "$(whoami)" != "root" ]; then
exit 1
fi

if ! command -v busybox 1> /dev/null 2>&1; then
busyboxpath="$(command -v busybox 2> /dev/null)"
# shellcheck disable=SC2181
# need both ouput and error code thus needs indirect error checking
if [ $? -ne 0 ]; then
echo "busybox not found, install busybox for Android NDK and try again"
exit 1
fi
case "$busyboxpath" in
/bin/*) ;; # assume that it is ok (either old android, or linux), nothing to do
/system/*) ;; # busybox in system partition, nothing to do
/usr/bin/*) ;; # running linux, assume that all is ok, nothing to do
*)
echo "busybox not found from the expected path, ensure that busybox for Android NDK has been installed and try again"
exit 1
;;
esac

getopt --test > /dev/null && true
if [ $? -ne 4 ]; then
Expand Down

0 comments on commit 51d96e5

Please sign in to comment.