-
Notifications
You must be signed in to change notification settings - Fork 19
Check if busybox exists #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 2 commits
3ab0d04
b9cb07e
5eb5be4
3d01ae7
5c0be56
a03965b
fd76886
890a9da
c2f6c2e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,6 +38,35 @@ do_shell() | |
| adb shell "$@" | ||
| } | ||
|
|
||
| do_chroot() | ||
| { | ||
| do_shell "chroot /cache/system $@" | ||
| } | ||
|
|
||
| check_busybox() | ||
| { | ||
| export device_architecture=$(do_shell "uname -m") | ||
| export busybox_exists=$(do_shell "if [ -d /sbin/busybox ]; then echo true; else echo false; fi") | ||
| mkdir busybox | ||
|
|
||
| if [ $busybox_exists = "true" ]; then | ||
| echo 'Using already installed busybox' | ||
| else | ||
| if [ $device_architecture = x86_64 ]; then | ||
| wget https://github.com/meefik/busybox/raw/master/app/src/main/assets/intel/static/bin/busybox -O busybox/busybox | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could actually build our own busybox, or just use a prebuilt static one from busybox.net? I wouldn't necessarily use busybox from a random busybox app.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They are not having armv7 builds I think ... Correct me if I'm wrong. Of course you're right, if you fing a better source, I'll use it.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can use the armv6l variant from https://busybox.net/downloads/binaries/1.26.2-defconfig-multiarch/ . It's working just fine on armv7 |
||
| elif [ $device_architecture = armv7l ]; then | ||
| wget https://github.com/meefik/busybox/raw/master/app/src/main/assets/arm/static/bin/busybox -O busybox/busybox | ||
| elif [ $device_architecture = arm64 ]; then | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should use an armv7l or arm64. Also apparently arm64 can also be called aarch64 but I don't have such devices to test. |
||
| wget https://github.com/meefik/busybox/raw/master/app/src/main/assets/arm/static/bin/busybox -O busybox/busybox | ||
| fi | ||
|
|
||
| adb push busybox/busybox /sbin/busybox | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. actually why do we need the busybox/ folder on the host at all? It's only a single binary...
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that was because I earlier downloaded more to the folder. It's now unnecessary. Thank you for pointing that out. |
||
| do_shell "/sbin/busybox --install" | ||
| fi | ||
|
|
||
| rm busybox -r | ||
| } | ||
|
|
||
| convert_android_img() | ||
| { | ||
| if file $SYSIMG | grep -v ": Linux rev 1.0 ext4" >/dev/null; then | ||
|
|
@@ -165,6 +194,7 @@ if ! adb devices | grep -q recovery; then | |
| exit 1 | ||
| fi | ||
|
|
||
| check_busybox | ||
| check_mounts | ||
|
|
||
| WORKDIR=$(mktemp -d /tmp/halium-install.XXXXX) | ||
|
|
@@ -190,6 +220,13 @@ do_shell "cd /cache/system && zcat /recovery/$TARBALL | tar xf -" | |
| do_shell "[ -e /cache/system/SWAP.swap ] && mv /cache/system/SWAP.swap /data/SWAP.img" | ||
| echo "[done]" | ||
|
|
||
| echo "Generating SSH host keys on the device" | ||
| do_chroot "rm /etc/dropbear/dropbear_rsa_host_key" | ||
| do_chroot "dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key" | ||
|
|
||
| echo "Changing password needed for root ssh login" | ||
| do_chroot passwd root | ||
|
|
||
| echo -n "adding android system image to installation ... " | ||
| convert_android_img | ||
| ANDROID_DIR="/data" | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move the mkdir in the else part of the next if as we don't need that directory if busybox already exists.