Make Release
Teske, Devin
Devin.Teske at fisglobal.com
Thu Aug 1 17:58:09 UTC 2013
On Aug 1, 2013, at 9:56 AM, Amitabh Kant wrote:
> On Thu, Aug 1, 2013 at 10:13 PM, Teske, Devin <Devin.Teske at fisglobal.com> wrote:
> I'm hoping that my very open development documentation on customizing the release(7) process for producing DruidBSD releases can help you out here.
>
> I've documented much of the internals of the release(7) process (albeit, relevant to the RELENG_8 release(7) Makefile; in RELENG_9 it's still relevant to /usr/src/release/Makefile.sysinstall ... but I gather that much of the knobs may still exist in HEAD).
>
> Have a read through this revision-controlled text file...
>
> http://druidbsd.cvs.sf.net/viewvc/druidbsd/druidbsd/druid/dep/freebsd/patches/README?revision=1.2&view=markup
>
> ALSO NOTE: Yes, the file is dated... it talks about cvsup instead of svn. My hope is that the doco can be a good starting point (even if the data is a bit dated).
>
> In there, you'll find things like (relevant to RELENG_9):
>
> make -f Makefile.sysinstall release \
> MAKE="/usr/bin/env CFLAGS=-DDRUID make" \
> CHROOTDIR=/usr/release EXTSRCDIR=/usr/src KERNELS_BASE= \
> NODOC=YES NO_FLOPPIES=YES NOCDROM=YES NOPORTS=YES \
> WORLD_FLAGS=-DWITHOUT_OPENSSL PATCH_FLAGS=-N \
> LOCAL_PATCHES=/tmp/druid.patches \
> LOCAL_SCRIPT=/tmp/local_script.sh |& tee release.log
>
> Take special note of the "LOCAL_SCRIPT=" option.
>
> Maybe, just maybe, the bsdinstall-specific release(7) process supports LOCAL_SCRIPT too. If it doesn't... why not?
> --
> Devin
>
> Devin
>
> Do you have any idea if there have an changes to bsdinstall process (on scripting side) in the upcoming 9.2 ?
>
Yes, the partedit portion of bsdinstall is scriptable in 9.2. Also, many bug fixes. Also, you can now create /etc/installerconf (no `dot' between installer and conf) and it will be picked up and run by bsdinstall.
For your bsdinstall scripts, 2 new tools and a new framework to learn...
Tools: bsdconfig(8) and sysrc(8)
Framework: bsdconfig libraries (advanced scripting)
If you're behind on your sysinstall(8) *(yes... sysinstall(8)) scripting abilities, then I suggest you brush up.
* bsdconfig(8) is [mostly] backward compatible sysinstall(8) scripts
So... in your bsdinstal installerconf, you can:
# Example A
# ( do bsdinstall stuff ) then...
bsdconfig packages
# Example B
# ( do bsdinstall stuff ) then...
sysrc sshd_enable="YES"
# Example C
# ( do bsdinstall stuff ) then...
. /usr/share/bsdconfig/script.subr || exit 1
for package in a-1.0 b-2.0 c-3.0; do
packageAdd
done
Here's a full list of items that bsdconfig(8) supports which are documented in sysinstall(8) (to which all you need to do to access is to include "/usr/share/bsdconfig/script.subr"):
loadConfig
deviceRescan
mediaOpen
mediaClose
mediaGetType
mediaSetCDROM
mediaSetDOS
mediaSetDirectory
mediaSetFloppy
mediaSetNFS
mediaSetUFS
mediaSetUSB
optionsEditor
tcpMenuSelect
mediaSetFTP
mediaSetFTPActive
mediaSetFTPPassive
mediaSetFTPUserPass
mediaSetHTTP
mediaSetHTTPProxy
configPCNFSD
configPackages
packageAdd
packageDelete
packageReinstall
installVarDefaults
dumpVariables
But that's only the tip of the iceberg. To get a full idea of what you can do with shell-script ALONE, you have to see the bsdconfig includes, which are in /usr/share/bsdconfig (link to what's released into 9.2 below):
http://svnweb.freebsd.org/base/stable/9/usr.sbin/bsdconfig/share/
For example, there is:
common.subr -- stuff everybody should use (makes your code cleaner and gives you basic abilities missing in shell, like f_getvar -- partner to setvar)
device.subr -- scan for known devices and create structures with device info and type. Also provide routines for quickly scanning the array of structures for pre-probed devices of a specific type. Also contains code for presenting a menu of devices (of given type) to the user to select, returning the user's selection for processing.
dialog.subr -- a *monster* of a library (uber documented to boot). Allows clean abstraction of dialog to where either dialog(1) or Xdialog(1) is a simple proposition to interface to.
mustberoot.subr -- if your shell script needs to be able to run as non-root but escalate to root as-needed, this provides a clean way to transition to where your users seemlessly elevate.
script.subr -- a dummy include that includes all the other includes.
strings.subr -- handy string manipulation routines (tuned both for convenience and performance).
struct.subr -- hold information in structs (using shell!)
sysrc.subr -- manage rc.conf(5)!
variable.subr -- variable definitions (boring; unless you code on bsdconfig -- hey, think about writing a module sometime! I encourage it, it's fun!)
Beyond that... ( ok that's enough for this e-mail ).
--
Devin
_____________
The information contained in this message is proprietary and/or confidential. If you are not the intended recipient, please: (i) delete the message and all copies; (ii) do not disclose, distribute or use the message in any manner; and (iii) notify the sender immediately. In addition, please be aware that any message addressed to our domain is subject to archiving and review by persons other than the intended recipient. Thank you.
More information about the freebsd-questions
mailing list