Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Aug 2013 17:58:05 +0000
From:      "Teske, Devin" <Devin.Teske@fisglobal.com>
To:        Amitabh Kant <amitabhkant@gmail.com>
Cc:        "Sam Fourman Jr." <sfourman@gmail.com>, Devin Teske <dteske@freebsd.org>, FreeBSD Questions <freebsd-questions@freebsd.org>
Subject:   Re: Make Release
Message-ID:  <13CA24D6AB415D428143D44749F57D7201FFEEA3@ltcfiswmsgmb21>
In-Reply-To: <CAPTAQB%2BCGBxyfvMr9tFHMxm7UH4t6aWS-kJh6znqJT0pVKG-hQ@mail.gmail.com>
References:  <CAOFF%2BZ3-b_ZUYeWjTY1XcEXse6DUv_FkbmBKDFJpE4zoSCf6_A@mail.gmail.com> <13CA24D6AB415D428143D44749F57D7201FFEB17@ltcfiswmsgmb21> <CAPTAQB%2BCGBxyfvMr9tFHMxm7UH4t6aWS-kJh6znqJT0pVKG-hQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On Aug 1, 2013, at 9:56 AM, Amitabh Kant wrote:

> On Thu, Aug 1, 2013 at 10:13 PM, Teske, Devin <Devin.Teske@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.
>=20
> 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 releva=
nt to /usr/src/release/Makefile.sysinstall ... but I gather that much of th=
e knobs may still exist in HEAD).
>=20
> Have a read through this revision-controlled text file...
>=20
> http://druidbsd.cvs.sf.net/viewvc/druidbsd/druidbsd/druid/dep/freebsd/pat=
ches/README?revision=3D1.2&view=3Dmarkup
>=20
> 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).
>=20
> In there, you'll find things like (relevant to RELENG_9):
>=20
> make -f Makefile.sysinstall release \
>                 MAKE=3D"/usr/bin/env CFLAGS=3D-DDRUID make" \
>                 CHROOTDIR=3D/usr/release EXTSRCDIR=3D/usr/src KERNELS_BAS=
E=3D \
>                 NODOC=3DYES NO_FLOPPIES=3DYES NOCDROM=3DYES NOPORTS=3DYES=
 \
>                 WORLD_FLAGS=3D-DWITHOUT_OPENSSL PATCH_FLAGS=3D-N \
>                 LOCAL_PATCHES=3D/tmp/druid.patches \
>                 LOCAL_SCRIPT=3D/tmp/local_script.sh |& tee release.log
>=20
> Take special note of the "LOCAL_SCRIPT=3D" option.
>=20
> Maybe, just maybe, the bsdinstall-specific release(7) process supports LO=
CAL_SCRIPT too. If it doesn't... why not?
> --
> Devin
>=20
> Devin
>=20
> Do you have any idea if there have an changes to bsdinstall process (on s=
cripting side) in the upcoming 9.2 ?=20
>=20

Yes, the partedit portion of bsdinstall is scriptable in 9.2. Also, many bu=
g fixes. Also, you can now create /etc/installerconf (no `dot' between inst=
aller 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 ab=
ilities, 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=3D"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 "/us=
r/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 a=
re 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 give=
s you basic abilities missing in shell, like f_getvar -- partner to setvar)

device.subr -- scan for known devices and create structures with device inf=
o and type. Also provide routines for quickly scanning the array of structu=
res for pre-probed devices of a specific type. Also contains code for prese=
nting a menu of devices (of given type) to the user to select, returning th=
e user's selection for processing.

dialog.subr -- a *monster* of a library (uber documented to boot). Allows c=
lean abstraction of dialog to where either dialog(1) or Xdialog(1) is a sim=
ple 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 convenie=
nce 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 ).
--=20
Devin

_____________
The information contained in this message is proprietary and/or confidentia=
l. If you are not the intended recipient, please: (i) delete the message an=
d all copies; (ii) do not disclose, distribute or use the message in any ma=
nner; and (iii) notify the sender immediately. In addition, please be aware=
 that any message addressed to our domain is subject to archiving and revie=
w by persons other than the intended recipient. Thank you.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?13CA24D6AB415D428143D44749F57D7201FFEEA3>