~drscream

Personal packages in SmartOS global zone

Maybe you’ve the same problem as me, some “really really important” package is missing in the SmartOS global zone. I’m not 100% sure if this is the right way how it works, but it works for me :-)

For this customization you should know, that you must create your own SmartOS build and image.

So we starting with a SmartOS build environment. Please follow the good and helpful instructions from the wiki page. I’ve not so much memory as required, because is running my build environment on some Hetzner server, but it works also. If it fails for unknown reason run gmake world again. Don’t spend all your time in front of your computer, a full build could take an hour ;-)

There are two ways for modification, need a full binary build of some package (for example munin-node or nano) or deploy some bash scripts and config modifications.

/content/smartos-live      # My smartos src directory
	overlays               # Overlays that contains extra scripts/config files
	projects               # Contains illumos git src, extra packages, etc.
		illumos            # The illumos clone from git (via configure)
		illumos-extra      # The extra packages build for SmartOS (gnupg, openssl, etc.)
	proto                  # Prototyping folder, contain live content after `gmake world`

Add shell scripts

This could also be used to deploy binary scripts, but it isn’t recommended maybe they need to be linked to some libraries, etc.

In the SmartOS source directory (after cloning and configure your environment) you will find a folder called overlay. Create a folder with your company name or your name (for example skylime).

/content/smartos-live/
	overlays/
		order
		generic/
		smartos/
		skylime/
			manifest
			usr/
				sbin/
					zrep

My example will deploy the zrep shell script to /usr/sbin/zrep. You must create a manifest file which contains the information of folder and file creation.

# type folder|file mode user group
d usr/sbin 0755 root bin
f usr/sbin/zrep 0755 root bin

Also modify the order file and add the folder path to the list (if you didn’t run ./configure again).

/content/smartos-live/overlay/smartos /content/smartos-live/overlay/generic /content/smartos-live/overlay/skylime

After building a new package (gmake world && gmake live) this will contains /usr/sbin/zrep.

Add binary files / custom software

You are missing nano or you like munin-node in the global zone to get some stats? I think this is they way it should go. We will have a look at the illumos-extra repository from Joyent. This contains a lot of extra software that will be build and installed in the global zone. So why not doing the same as they do :-)

First create a folder with the software you would like include in the global zone, we choose nano. So you will have the following folder structure:

/content/smartos-live/projects/illumos-extra/nano

Please note that most of the folders in projects will be automatically cloned from git at the configure process.

Download the source code of your software as tar (.gz/.bz2) archive an place it in the folder. Create a Makefile, maybe by copying a file from another folder.

Because nano is a nice software with a ./configure script, no special hack is required. So you could use a simple Makefile.

VER =   nano-2.2.6

include ../Makefile.defs
include ../Makefile.targ

LDFLAGS = $(T32_LDFLAGS) -zassert-deflib

all: all_autoconf

install: all
        mkdir -p $(DESTDIR)/usr/bin
        ginstall -m 0555 $(BASE)/$(VER.32)/src/nano $(DESTDIR)/usr/bin/nano
        mkdir -p $(DESTDIR)/usr/share/man/man1
        ginstall -m 0444 $(BASE)/$(VER.32)/doc/man/nano.1 \
            $(DESTDIR)/usr/share/man/man1

If everything works and your required software build without an error you should modify the Makefile in the projects/illumos-extra folder. Also modify the manifest file in the projects/illumos-extra folder, to deploy the files and folders.

Tip: I used gmake first from the /content/smartos-live folder and than checked the proto folder about the files.

Have a look in my illumos-extra repository if you would like to see the changes. You could use find for that task, check out the gist.

Maybe you must modify the tools/build_live file to increase the usr image size. In the script change the variable USIZE.

After all you could use gmake world && gmake live to create your personal SmartOS version.


Send your comment by mail.