views:

150

answers:

2

I have asked similar question for Linux RPM (http://stackoverflow.com/questions/2132828/adding-license-agreement-in-rpm-package). Now i have same query for Solaris package. I could not get any helpful link / details if it is possible. But I have found a package which does exactly the same thing but how it has been implemented, its not mentioned.

$pkgadd -d . SUNWsamfsr SUNWsamfsu

Processing package instance from 

Sun SAM and Sun SAM-QFS software Solaris 10 (root)(i386) 4.6.5,REV=5.10.2007.03.12

Sun SAMFS - Storage & Archiving Management File System

Copyright (c) 2007 Sun Microsystems, Inc.

All Rights Reserved.


----------------------------------------------------- 

In order to install SUNWsamfsr, you must accept the terms of
the Sun License Agreement.
Enter "y" if you do, "n" if you don't, or "v" to view agreement. y

-The administrator commands will be executable by root only (group bin).

If this is the desired value, enter "y". If you want to change 
the specified value enter "c". y   
...   
...

Any ideas how to implement such thing for Solaris package?

A: 

I have found a way to solve it.

The self-extracting binary is the way to do it.

Create a shell script which will first dipslay the end user license and take user input whether user agrees or not.

Once user agrees, extract the binary (solaris package file) embed in the shell script and install it.

To embed installer pacakge, first add a marker lets say PKG_DATA:

shell script contents
exit 0   
PKG_DATA   

Append the package file:
cat pkg_file_name >> your_shell_script

Extract the package and install it:

ARCHIVE=awk '/^__PKG_DATA__/ {print NR + 1; exit 0; }' $0   
outname=install.$$   
tail -n+$ARCHIVE $0 > $outname   

echo "Extracting..."   
pkgadd -d $outname   
rm -f $outname #we dont need it anymore   

exit 0   

PKG_DATA   
<pkg file data here>   
Adil
Usefule links:http://www.linuxjournal.com/content/add-binary-payload-your-shell-scriptshttp://www.linuxjournal.com/node/1005818
Adil
A: 

I would implement that using the checkinstall script.

"exit 3" in that script gracefully ends the package installation.

That's not trivial as you need to create a request script and reference it in the checkinstall one.

http://docs.sun.com/app/docs/doc/817-0406/ch1designpkg-4?a=view

jlliagre
Actually, `checkinstall` is supposed to be noninteractive. `request` is interactive, and it's run during package installation--you don't need to run `request` from `checkinstall`.
Kenster
That's what I meant, although not clearly enough. You use the request script to interact with the user and exit 3 from the checkinstall one.By reference, I mean the request script set a variable that will be used in checkinstall. That's the way request is designed.http://docs.sun.com/app/docs/doc/806-7008/6jftmsc2v?a=view
jlliagre
license agreement should be displayed and accepted before installing the pacakge.
Adil
Indeed. You display the license text and prompt the user for acceptance in the request script. I thought that was obvious.
jlliagre