Code Monkey home page Code Monkey logo

Comments (5)

bacongravy avatar bacongravy commented on July 21, 2024

Hi @damacus ! Could you attach your script so I can see what it is doing?

from macinbox.

damacus avatar damacus commented on July 21, 2024

Hey! thanks for the response:

Here's the script:

# Install homebrew
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh  | sudo bash

# Install chef-client
curl -L https://omnitruck.chef.io/install.sh | sudo bash -s -- -c current -P chef

command -v chef
command -v brew

chef --version

from macinbox.

bacongravy avatar bacongravy commented on July 21, 2024

Ah ha! The issue here is that the install script runs in the context of the host computer, not the target box. The commands you are running are installing homebrew and chef on the host computer, not into the box.

The location of the box file system is provided as the first argument to the user script. But you still need to figure out how to tell the homebrew and chef installers to install to a non-running system, which they may not support.

If you review the Homebrew site you can find manual installation instructions. If you adapt those in your user script, with all of the paths prefixed with “${1}/“, that might work better.

I can try to put together a Homebrew example later this week if that would help. See #24 in the meantime for an example user-script that uses ${1}.

from macinbox.

bacongravy avatar bacongravy commented on July 21, 2024

@damacus I looked at the content of the install.sh script for Homebrew. I don't know how to replicate the part of the install.sh script that installs the command-line developer tools in a macinbox user script, but here is how I think you would install Homebrew, at least:

#!/bin/sh

cd "${1}/usr/local"
mkdir Homebrew
curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C Homebrew
ln -sf /usr/local/Homebrew/bin/brew "${1}/usr/local/bin/brew"

You would still need to run brew update --force in the box after booting it to complete the installation.

I think the best use of a user script is to copy new files to the box and modify existing files. Executing installers is not really going to work, unless you can tell the installers which system volume to target.

I have been searching for a good automated way to install Xcode or the command-line tools into a vagrant box for a very long time, and the best I've come up with is to install Xcode.app onto the host computer and then ditto it into the box using a user script.

For your use case, you might want to consider putting the Homebrew and Chef installation into a vagrant provisioning step. That way the commands will run in the context of the box instead of the host. If your provider supports it (VMware and VirtualBox do, I think) you could then use the vagrant package command to repackage the running machine into a new box.

from macinbox.

damacus avatar damacus commented on July 21, 2024

Ah!

I thought the script would be copied to the box and run. My mistake when reading the docs!

Yep, back to Vagrant package to get this one done. Thanks for your time! I'll report back if parallels works with this. VritualBox was being weirdly buggy with MacOS

from macinbox.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.