-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
bsdinstall: set SCRIPT=/path/to/script env var to be able to automate… #473
Conversation
if [ -n "$SCRIPT" ] | ||
then | ||
split -a 2 -p '^#!.*' "$SCRIPT" $TMPDIR/bsdinstall-installscript- | ||
. $TMPDIR/bsdinstall-installscript-aa |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the benefit of stripping the initial comments? #!... would be treated as a comment by /bin/sh. Can't you just . the "$SCRIPT"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't write the line, it comes from https://github.com/freebsd/freebsd-src/blob/main/usr.sbin/bsdinstall/scripts/script#L93
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and see SCRIPTING
part : https://www.unix.com/man-page/freebsd/8/bsdinstall/
The second part is run in the chrooted jail at the end of this script.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The point is to split the 'script' file into two parts
everything before the sh-bang #! is variables to set, and everything after it is a 'post install' script to run at the end.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea, these scripts are 'special' and 'different' in ways that are opaque... OK. this is fine then...
08a58c5
to
5e9977a
Compare
… bsdinstall to a jail
Set SCRIPT=/path/to/script env var to be able to automate bsdinstall to a jail. Pull Request: #473 Reviewed by: allanjude
Landed as 6f4c145 in current. |
Set SCRIPT=/path/to/script env var to be able to automate bsdinstall to a jail. Pull Request: freebsd/freebsd-src#473 Reviewed by: allanjude
automated bsdinstall to a jail
It doesn't seem to be the cleanest way, but it works with my simple example.