Skip to content
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

Check if busybox exists #2

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

jbruechert
Copy link
Member

@jbruechert jbruechert commented Jul 10, 2017

halium-install Outdated
wget https://github.com/meefik/busybox/raw/master/app/src/main/assets/intel/static/bin/busybox -O busybox/busybox
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
Copy link
Collaborator

Choose a reason for hiding this comment

The 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.

halium-install Outdated
{
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
Copy link
Collaborator

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.

halium-install Outdated
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
Copy link
Collaborator

@z3ntu z3ntu Jul 10, 2017

Choose a reason for hiding this comment

The 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.

Copy link
Member Author

Choose a reason for hiding this comment

The 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.

Copy link
Collaborator

Choose a reason for hiding this comment

The 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

halium-install Outdated
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
Copy link
Collaborator

Choose a reason for hiding this comment

The 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...

Copy link
Member Author

Choose a reason for hiding this comment

The 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.

@z3ntu
Copy link
Collaborator

z3ntu commented Jul 11, 2017

If it works, it's good :)

halium-install Outdated
elif [ $device_architecture = arm64 ]; then
elif [ $device_architecture = aarch64 ]; then
wget https://github.com/meefik/busybox/raw/master/app/src/main/assets/arm/static/bin/busybox
elif [ $device_architecture = armv8l ]; then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should do if device_architecture is armv7l or aarch64 or armv8l and not three seperate branches that do exactly the same.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm new to bash and didn't know it can do this. Will of course correct :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better now?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep looks good :)

@jbruechert jbruechert changed the title [WIP] Check busybox Check if busybox exists Jul 11, 2017
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't work with /bin/sh, so I switched to bash. If you know any reason why we should only use the sh, please report :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Depends what's symlinked to /bin/sh. On Arch it's bash by default but I don't know about other distros. /bin/bash ensures we get bash.

@jbruechert
Copy link
Member Author

I tested the changes with my device, which already has busybox installed. If you still need further testing, we need a device without busybox installed in recovery.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants