# How does bsdinstall script work?



## ahev (Mar 22, 2020)

I have found the sources for bsdinstall in usr.sbin/ directory in the source tree; now I see a reference in that script to some /usr/libexec/bsdinstall; as far as I understand, it is a reference to an already existing script on some floppy disk, for example, that is used for installation; so the question is how do I find this script in the source tree? I have not found anything close to bsdinstall in libexec/ directory...


----------



## George (Mar 22, 2020)

I have /usr/sbin/bsdinstall, and /usr/libexec/bsdinstall/ on my system.


----------



## ahev (Mar 22, 2020)

Elazar said:


> I have /usr/sbin/bsdinstall, and /usr/libexec/bsdinstall/ on my system.


Okay, maybe I do not understand something - I though this script should be also here https://github.com/freebsd/freebsd


----------



## balanga (Mar 22, 2020)

I have too, though I never looked before...


----------



## George (Mar 22, 2020)

Yes, these scripts (https://github.com/freebsd/freebsd/tree/master/usr.sbin/bsdinstall/scripts) will be copied/installed to /usr/libexec/bsdinstall/. That's where I found them in my system. ;D


----------



## T-Daemon (Mar 22, 2020)

ahev said:


> so the question is how do I find this script in the source tree?


Run a search /usr/libexec/bsdinstall at github/freebsd. You will find at the second code BINDIR= ${LIBEXECDIR}/bsdinstall. Run another search with that pattern on github or local `egrep -R '({LINEXECDIR}/bsdinstall)' /usr/src/usr.sbin /bsdinstall`


----------



## T-Daemon (Mar 22, 2020)

T-Daemon said:


> Run a search /usr/libexec/bsdinstall at github/freebsd. You will find at the second code BINDIR= ${LIBEXECDIR}/bsdinstall. Run another search with that pattern on github or local `egrep -R '({LINEXECDIR}/bsdinstall)' /usr/src/usr.sbin /bsdinstall`


Oops. Misunderstanding. I don't know from where that came from, but I had interpreted script for Makefile's. Sorry.


----------



## ahev (Mar 22, 2020)

T-Daemon said:


> Oops. Misunderstanding. I don't know from where that came from, but I had interpreted script for Makefile's. Sorry.



That's okay, I think I finally got it. The script under bsdinstall/ which is named bsdinstall too, is copied into /usr/libexec/bsdinstall/,  and from there when it is run, it calls other scripts that should already be located at /usr/libexec/bsdinstall. See $VERB in bsdinstall script, it gets substituted with something like rootpass, or mount, or config, so here is how it most probably works.


----------

