So in the last video, we learned how the bootstrappers environment works and now we're going to learn
how to create our own bootstrappers environment.
So to do that, we need to download the bootstrappers program.
And when you download it, you're going to get a directory that looks like this.
And so what we have here is we have a make dmg shell script, and that's what makes the bootstrappers
disk image.
Now, the bootstrappers disk image is the image that we copied in our demo to the monkey server, and
that's the image that we mounted when we were in recovery.
All right.
So you can see that there's also a directory called Bootstrap.
And if we go into that directory and take a listing, you can see that we have an alias called Run that
runs the bootstrappers shell script.
And that script is what basically runs the packages in the package folder.
All right.
So let's go to the packages folder and inside the packages folder, we have a list of packages and scripts
that are going to run in alphabetical order.
Now, I went ahead and numbered mine in the order I want to go in.
And when a system runs things in alphabetical order and you rename them numerically like I have, then
it will basically run in numerical order.
The first thing that this does is it runs a script called Rename.
And now this is a script that I wrote.
Basically what it does is it renames the computer, but it does it, I think, in a kind of a unique
way.
So what we're going to do is we're going to ask the user to enter a computer name and then assign it
the variable new name.
Now, how it actually names the computer, because remember, we are booted in recovery mode.
We're not booted from the hard disk that we're going to be using in production.
And that's why we're going to do what's called a TERU now, which basically logs you in.
So you're using a different file system.
So what we're doing is we're going to take root as user root to the Macintosh hard drive volume.
Now, when this whole procedure is done and we reboot the computer, we're booting from the Macintosh
hard drive volume.
But the commands that we run in the Chubut environment are going to affect that Macintosh hard drive
volume.
So as you can see, we're going to be running a command studio set computer named Variable.
We're going to be executing that command onto the Macintosh hard drive, not the hard drive from the
computer in which we're booted, which is the recovery partition.
So we're going to set all three computer names to our new name, variable.
And then the last line just prints that variable out.
All right, so the next thing that we do is we installed the Monkey Tools package, and this is the
package that you can download from the Monkey website.
It's the same one we've used to install Monkey on our admin machine and our client machine.
And then the next package, it gets installed as Monkey Kickstart, also available from the Monkey website.
And this is what puts the computer in monkey bootstrap mode, which we talked about earlier.
Now, the fourth package, Skip Apple, set up assistant, that's a package that I downloaded from the
Internet that's designed to skip the prompts when a user logs in for the first time.
And then create administrator package.
This is a package that will create that creates the first user account on the system and our demo case
administrator and it assigns it a password.
And how this package was created was using a program called P, why create a user package?
Now, when you download this program, you get a folder that looks like this and basically you're just
going to be running the create user package program.
And when you do that without any arguments, then you get a list of available options.
So what we're going to do is we're going to create user package and then we're going to go hyphen and
for administrator and then hyphen you for you.
And we're going to use the UID of five, one in five.
One is the other that gets assigned to whatever account you create when you run the apple set up system,
when you take the computer out of the box.
So our packages are going to basically recreate that process.
Then we're going to do hyphen B for version number and that's going to be the version of this package.
If you upgrade this package in the future, then you can just upgrade the version number and then we're
going to need a unique identifier and we're going to just call it a automata administrator.
And now we need to enter a password and so we can just type our password in.
Then there's some other options that you can enter, such as a full name.
And so the last option that I'm going to pick is hyphen a four Adnen.
So this is going to make this account an administrator account.
And then the last thing you need to do is give it a file name.
So we're going to go ahead and say create admin that package and then it's going to go ahead and create
a package file.
So if I do a listing, you can see I've got to create an ID package now and we need what we need to
do is basically take this package file and copy it to the packages folder in our bootstrap directory.
All right, so with the administrator account created, then the next thing that I'm running is another
script that I wrote, and this is the script that asks the user for the name in the manifest they wanted
to use.
So the there's a note in here basically that says to run this command and the Manifest Util Command
is a command from monkey tools and what it does is it it lists the manifest.
And I'm going to take that listing and I'm going to write it to a file on our monkey server.
Now, if I go ahead and take a look at that file in its current state.
Then you will see that I have.
Two manifests that are in my monkey server now, if I go ahead and create a new manifest.
And I say that.
And then I run this command.
And now I take a look at that file again, you can see that I've now I've got the three manifests that
are in Monkey.
All right.
Now, if you remember when we ran bootstrappers, it also offered us a couple more manifest names.
And we'll go ahead and get to that in a moment.
So as you can see on this line over here, we're downloading that file, but we're writing it to the
Macintosh hard drive volume in a temp folder.
And then over here, what we're going to do is we're going to assign a variable new name to our computers
computer name, but remember, the computer name isn't.
On the computer we're booting from it's we said it to the volume in which we're going to be booting
to after bootstrappers done.
So, again, I have to use that cheroot command.
And then what we're going to do here is we're going to write that variable.
So the computer running from the cheroot environment and we're adding it to the list of the monkey manifest
file that we downloaded from our monkey server.
And we're going to do the exact same thing.
But for the serial number and that's how we got all of those options in the monkey manifest.
All right.
So this part, this code over here, this basically asks the user which monkey manifest that they want
to use and then it gives them the options from the file and it waits for input.
And then once it gets input, it will write the right manifest that you choose to the manifest file.
So over here, the last bit of code, this is where we're writing the manifest preference or this is
where we're writing the monkey preference file.
So we're going to route into the Macintosh hard drive and we're going to use the default rights command
that we used when we learned about installing monkey earlier.
And we're going to sign it a monkey repo and we're going to sign it and manifest and we're going to
suppress the user notification.
And then when everything is done, we're going to erase that monkey manifest list file from the computer.
All right, so when that's done, then here's a script that another script I found on the Internet,
and this suppresses the question that new user gets asked about sending diagnostics to Apple.
Now, I had to change the script so it would write all of this stuff to the Macintosh hard drive.
So I had to do it in the cheroot environment.
Now, a lot of these things could be just done in Monkey, so the renamed script actually has to be
done in bootstrappers, installing monkey tools and Monkey Kickstart has to be done in bootstrap or
this skipping the apple setup assistant and the administrator package could be done in just in monkey
itself and the supressed diagnostics.
Also, that script could be run from monkey by itself.
Now choosing the monkey manifest and writing the preference file for Monkey itself does have to be done
in bootstrappers.
Now, if you don't if you want these other packages to be in your monkey environment, you could pull
them out of the strapper.
But when you build your bootstrap environment, just think about what actually has to be run in bootstrappers,
in what can be run and monkey.
All right.
So now that we have everything that we want in our bootstrappers environment, we need to build the
disk image for bootstrappers.
So what we're going to do is we're going to get out of this directory and get back to the bootstrap
our master home directory where the shelf script is.
And then we're just going to go ahead and run the Shell script and it's going to generate a bootstrap
DMG file.
And now that bootstrap that DMG file, we just need to copy to a Web server someplace.
And you saw my demo.
I copied it to our monkey server.
And so then when whoever is going to be setting up the computer, they can take the computer out of
the box, go to recovery, they can go right to the terminal and then do HDI util attach and then the
path to this bootstrap dmg and then run the run command.
And however your environment is set up, it will prompt the user if there's any prompts or it will just
install packages.
And then once it's reboot, then the computer will reboot and do whatever it is that monkey tells it
to do.