[Index] [About]  
Author Simes
Created:  2005-11-18
Last changed:  2005-11-18
[Root]  [Prev] [Idx] [Next] http://www.bpfh.net/computing/software/pkg-tools/hints.html 

Hints and tips


Re-building a package

Thanks to how build-pkg works, once the InstallPackage/build directory exists and has content, build-pkg will no longer call chroot-install to put content within it.

This action is not very helpful if you need to re-build the contents of the InstallPackage/build for some reason; i.e. you've tried to pkgadd the built package and something was not correct.

Whilst you could just remove the InstallPackage/build directory, there is a problem of permissions. It is highly likely that the files and directories under InstallPackage/build will require root privilages to remove them as they are generally owned by root.

If like me you do not run build-pkg as root (which is highly sensible IMHO) then you can give build-pkg the -K option. This option tells build-pkg to always invoke chroot-install. It also gets build-pkg to pass the -S to chroot-install; this option tells chroot-install to clean its installation root directory - in other words InstallPackage/build - before doing any other work.

Thus you can use:

+---------

% build-pkg -K

+---------

Instead of:

+---------

% su
Password: <root password>
% build-pkg

+---------

To re-build a package

[Top]


Startup/shutdown scripts and post-installation changes

As noted above, build-pkg will only invoke chroot-install if the InstallPackage/build is empty. This way of working allows you to make changes to the structure created by the installation process of the software you are creating a package for.

This means that you can put system startup and shutdown scripts in place for a package, even if they are not installed by a package.

For example, with OpenSSH I did the following. It assumes that you have a startup/shutdown script called openssh.rc in the directory above the one containing InstallPackage/build and that you place additional startup scripts in /usr/local/startup rather than /etc/init.d/

+---------

% build-pkg make install
    <Output of command snipped>
% umask 022
% mkdir -p InstallPackage/build/usr/local/startup
% cp ../openssh.rc InstallPackage/build/usr/local/startup/openssh
% chmod 755 InstallPackage/build/usr/local/startup/openssh
% mkdir -p InstallPackage/build/etc/rc0.d
% mkdir -p InstallPackage/build/etc/rc3.d
% ln -s /usr/local/startup/openssh InstallPackage/build/etc/rc0.d/K01openssh
% ln -s /usr/local/startup/openssh InstallPackage/build/etc/rc3.d/S20openssh
% build-pkg
    <Output of command snipped>
%

+---------

It does look strange to specify /usr/local/startup/openssh as the destination of the symbolic link when you are dealing with a directory structure which assumes the root directory is at InstallPackage/build since /usr/local/startup/openssh is unlikely to exist until the package has been added to the system via pkgadd.

However using the standard Solaris /usr/bin/ln, this works fine.

It should be noted that you can make other changes to the structure under InstallPackage/build if so desired. Once you have made such changes you just have to run build-pkg to re-build the package. Just remember to not give the -K option to build-pkg otherwise it will remove all the work you have just done to the post chroot-install InstallPackage/build structure.

[Top]

[Root]  [Prev] [Idx] [Next] http://www.bpfh.net/computing/software/pkg-tools/hints.html 
 [Index] [About] Powered by WML
Author Simes
Created:  2005-11-18
Last changed:  2005-11-18
 
More by the same author Comments? EMail webmaster@bpfh.net
 
© Simes