doomhammer / brewstrap Goto Github PK
View Code? Open in Web Editor NEWBootstraps Linuxbrew on machines lacking necessary tools (such as Chromebooks and embedded)
License: Other
Bootstraps Linuxbrew on machines lacking necessary tools (such as Chromebooks and embedded)
License: Other
On chromeos, some flavors of debian/ubuntu and others, /bin/sh is actually dash shell, and is only POSIX-ly compatible. There are a few things in brewstrap-0.1.sh that rely on bash features (command line parsing of --fixpaths for instance).
You probably want to explicitly call bash, or change your [ tests to be dash compatible...
I added set -x as 2nd line of script to demonstrate:
chronos@localhost ~ $ ./brewstrap-0.1.sh
+ VERSION=0.1
+ pwd
+ ORIGWD=/usr/local/fred
+ BREWSTRAP_DIR=/usr/local/fred/.linuxbrew/Cellar/brewstrap/0.1
+ [ x == x--fixpaths ]
[: 1: x: unexpected operator
+ before_extraction
...
You can read all about dash vs bash and how to convert here:
https://wiki.ubuntu.com/DashAsBinSh
In this particular instance changing
if [ "x$1" == "x--fixpaths" ]; then
to
if [ "x$1" = "x--fixpaths" ]; then
(e.g. just changing == to =) should do the trick
Hi,
I used the xenial chroot on my ChromiumOS as host, and tried to install brewstrap on the raw ChromiumOS as target. Here's the result:
brewstrap-0.1.sh: 109: /home/chronos/user/.linuxbrew/Cellar/brewstrap/0.1/bin/ruby: Permission denied
sed: can't read linuxbrew-install: No such file or directory
ruby: No such file or directory -- linuxbrew-install (LoadError)
brewstrap-0.1.sh: 109: brew: not found
brewstrap-0.1.sh: 109: brew: not found
sed: can't read /home/chronos/user/.linuxbrew/Library/Homebrew/utils.rb: No such file or directory
brewstrap-0.1.sh: 109: brew: not found
sed: can't read /home/chronos/user/.linuxbrew/Library/Taps/homebrew/homebrew-core/Formula/perl.rb: No such file or directory
brewstrap-0.1.sh: 109: brew: not found
brewstrap-0.1.sh: 109: brew: not found
brewstrap-0.1.sh: 109: brew: not found
brewstrap-0.1.sh: 109: cannot create /bin/sbrew: Read-only file system
brewstrap-0.1.sh: 109: brew: not found
chmod: cannot access ‘/bin/sbrew’: No such file or directory
brewstrap-0.1.sh: 109: sbrew: not found
brewstrap-0.1.sh: 109: sbrew: not found
You may now `sbrew uninstall brewstrap`
Any idea?
you should include a build of homebrew-dupes/file-forumula package in your initial package or bottles fail. Or perhaps recommend installing from source with --build-from-source as the first package after install...
Would it be possible to add a LICENSE file to this repo? BSD-2-Clause would make it easier to integrate into Linuxbrew, but if that's not your preference, obviously pick what you want 😄
first issue with brewstrap: chromebooks have the user homedir mounted noexec - so... I see that you're extracting and running in $HOME - I set my $home to /usr/local/tempbrew, which is ok in the short run - might want to prompt for a spot, or pick $HOMEBREW_PREFIX/.brewstrap or something My goal is to end up with linuxbrew installed in /usr/local, but still have a normal ~.linuxbrew directory with cache and logs etc.
This brings up the point that I need to set $HOMEBREW_PREFIX to the right place (/usr/local in my case) Perhaps update the readme to mention setting it.
In this case this is what I do...
export HOMEBREW_PREFIX=/usr/local
bash brewstrap-0.1.sh
brewstrap-0.1.sh: line 16 /home/chronos/user/.linuxbrew/Cellar/brewstrap/0.1/bin/ruby: Permission denied
so I edit brewstrap-0.1.sh and change BREWSTRAP_DIR to
BREWSTRAP_DIR=$HOMEBREW_PREFIX/.linuxbrew/Cellar/brewstrap/$VERSION
and fix up a few other places it is used (replacing $HOME)
Next, the linuxbrew-install file you download hard-code munges HOMEBREW_PREFIX overwriting the one I set... even though the script comments at the top claim otherwise... so I fake that by inserting a sleep in brewstrap-0.1.sh just before linuxbrew-install is invoked, I swap in a modified version that sets HOMEBREW_PREFIX right.
Second, at some point you swap out /usr/bin/which with /bin/which or something or other. On my chromebook /bin/which doesn't exist, only /usr/bin/which.... curl also - it lives at /usr/bin/curl but... hm. I just edited linuxbrew-install to just call 'which' rather than by full path. This probably isn't the right long term fix.
Press RETURN to continue or any other key to abort
==> Downloading and installing Linuxbrew...
sh: /bin/which: not found
curl: (1) Protocol "git" not supported or disabled in libcurl
gzip: stdin: unexpected end of file
tar: Child returned status 1
followed by a bunch of brew: command not found lines...
So, fixing up /bin/which back to /usr/bin/which makes that work and the curl error above also disappears.
A lot more happens - lots of git-clone errors and stuff I'll have to dig in to later.
Looks like some stuff is missing, some ends up in /usr/local/.linuxbrew/Cellar and some stuff is in /usr/local/
so far most of the issues seem to be related to the fact that I'm NOT building in $HOME/.linuxbrew (because of the noexec thing...)
Hi,
Thanks for the effort.
I tried to run this with my Fedora as the host and an ArchLinux chroot as the target. However, when running brewstrap script I got this:
Don't run this as root!
brewstrap-0.1.sh: line 32: brew: command not found
brewstrap-0.1.sh: line 36: brew: command not found
sed: can't read /root/.linuxbrew/Library/Homebrew/utils.rb: No such file or directory
brewstrap-0.1.sh: line 39: brew: command not found
sed: can't read /root/.linuxbrew/Library/Taps/homebrew/homebrew-core/Formula/perl.rb: No such file or directory
brewstrap-0.1.sh: line 57: brew: command not found
brewstrap-0.1.sh: line 60: brew: command not found
brewstrap-0.1.sh: line 65: brew: command not found
brewstrap-0.1.sh: line 65: brew: command not found
brewstrap-0.1.sh: line 65: brew: command not found
brewstrap-0.1.sh: line 65: brew: command not found
brewstrap-0.1.sh: line 65: brew: command not found
brewstrap-0.1.sh: line 65: brew: command not found
brewstrap-0.1.sh: line 65: brew: command not found
brewstrap-0.1.sh: line 65: brew: command not found
brewstrap-0.1.sh: line 65: brew: command not found
brewstrap-0.1.sh: line 85: brew: command not found
tail: cannot open '/bin/brew' for reading: No such file or directory
sed: can't read /root/.linuxbrew/bin/brew: No such file or directory
sed: can't read /root/.linuxbrew/Library/brew.sh: No such file or directory
sed: can't read /root/.linuxbrew/Library/ENV/scm/git: No such file or directory
sed: can't read /root/.linuxbrew/Library/Homebrew/utils.rb: No such file or directory
sed: can't read /root/.linuxbrew/Library/Homebrew/keg_relocate.rb: No such file or directory
tail: cannot open '/bin/brew' for reading: No such file or directory
You may now `sbrew uninstall brewstrap`
I'm totally lost. Why does it expect to find brew
somewhere while it is supposed to install it on the system?
Thank you and sorry for my naivety.
Best
One idea I had is that for each of the unix command line tools that is a dependency (e.g. as listed in README.md) - you might use each of those commands 'bare' with no path and then put in your instructions that the user's path needs to include each dependency. In fact, early on in the script you could test for each of those and complain..
This would make your script work in a much wider variety of weird os configurations...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.