Create a package installation package on Solaris

Source: Internet
Author: User
Http://blog.csdn.net/Borenbao/archive/2007/02/05/1502780.aspx

This article mainly describes how to use pkgadd to read and install the package program on Solaris 2.5, 2.6, and 7.
In AnswerBook 2, we will discuss the package process in detail.
Describes how to use package.
Note: In some of the following steps, you must have the root privilege on your machine to use it.
** Select your software
Find the original program code of the software and download it. Read all installation-related files. Pay attention to all settings.
Fixed files, including checking makefile. executable files and their links.
** Read manuals and man pages
Although many people are reluctant to read these man pages, you may think it is tiring to read man pgae.
But you 'd better take a look at the man page of the following commands.
Pkgadd, pkginfo, pkgmk, pkgparam, pkgproto, pkgtrans, pkgrm
There are many options which are described in detail. You must solve them to facilitate the following descriptions.
** Set the directory structure
Generally, I am used to creating a directory, such as/opt/software. In general, most of the software will be installed
In/usr/local, the creation of/opt/software is to store the software to be made into a package, while
Avoid mixing the file with the original file in/usr/local. The next step will show you how to use it.
** Compile and install the software in/usr/local or elsewhere
Change the directory to the location where you store the original software program and read related commands for use. Most of the software
There will be detailed installation instructions, which usually appear in the format of readme install.
Read and compile your software into executable files. When your software compilation is complete, you will execute"
To install your program to/usr/local or other places. Execute "make install"
Previously, you need to do the following:
% Su
% Cd/usr
% MV local. Full
% Ln-s local/opt/software
Then execute "make install". In this way, although it is installed in/usr/local, it is actually
Put it in/opt/software.
** Create the prototype and pkginfo files.
Change the directory to/usr/local...
% Cd/usr/local
Execute the following command...
% Find.-print | pkgproto> prototype
This line of command will create a prototype file in/usr/local
Next, use your text editor (such as VI) to edit the prototype file and add the following line.
I pkginfo =./pkginfo
Change user and group to bin. The following is an example of the modification...
I pkginfo =./pkginfo
D None bin 0755 Bin
F none bin/prog 0755 Bin
D None Doc 0755 Bin
F none DOC/doc1 0644 Bin
D None lib 0755 Bin
F none lib/lib1 0644 Bin
D None man 0755 Bin
F none man/Man1 0644 Bin
It is very important to change user and group to bin. If user and group are not Bin
Running pkgadd fails.
Edit installation script
When creating a package, you can also edit a series of scripts to execute the script when installing the package.
These scripts mainly include the following types:
Copyright: defines the copyright statement when a software package is released.
Depend: defines the package to be installed before the package is installed.
Checkinstall: Check whether the environment variable and package have been installed before installing the package.
Request: defines the variables to be entered during installation.
Preinstall: defines the command to be executed before the package installs the file to the system.
Postinstall: defines the command to be executed after the package installs the file to the system.
Preremove: defines the command to be executed before deleting the package file
Postremove: defines the command to be executed after the package file is deleted.

You do not have to include the preceding files when creating a package. This can be defined in the prototype file.
When creating the owldap package, I defined the following files:
Copyright, request, checkinstll, postinstall, preremove
I will not post the specific script content here to prevent the suspicion of bumping water. In fact, it is similar to writing shell scripts :)
Similarly, you need to add references to these files in the prototype file:
I pkginfo =./pkginfo
I copyright =./Copyright
I request =./Request
I checkinstall =./checkinstall
I postinstall =./postinstall
I preremove =./preremove
D None bin 0755 Bin
F none bin/ldapadd 0755 root other
F none bin/ldapdelete 0755 root other
F none bin/ldapmodrdn 0755 root other
F none bin/ldappasswd 0755 root other
F none bin/ldapsearch 0755 root other
F none bin/UD 0755 root other
L none bin/ldapmodify = ldapadd
......
Create the pkginfo file under/usr/local in the following format:
PKG = "scprog"
Name = "prog"
Arch = "iSCSI"
Version = "1.00"
Category = "application"
Vendor = "Computer Science of Chun-Hua University"
Email = "chunpo@csie.chu.edu.tw"
Pstamp = "podscat Kuo"
Basedir = "/usr/local"
Classes = "NONE"
These parameters are described as follows:
PKG = Directory Name of the Selected Package
Name = program name
Arch = version of the job system
Version = version number of the program
Category = this program is an application
Vendor = the company that writes the program
Email = Email content
Pstamp = who made the software
Basedir =/usr/local is where the file is installed
Classes = just write none.
** Run pkgmk
Execute the following command in/usr/local...
% Pkgmk-r 'pwd'
After executing this command, a package directory will be created in/var/spool/PKG (in the preceding example,
Will create a scprog directory), which stores your prepared package.
Basically, the package can be completed. You can use tar and gzip to press this scprog.
. During installation, you only need to extract it into the scprog directory type, and then execute
% Pkagdd-D.
In this way, you can...
** Run pkgtrans.
You can use pkgtrans to convert your package from the file system format to datastream.
Format:
% Cd/var/spool/PKG
% Pkgtrans-s 'pwd'/tmp/prog-1.00
After executing this command, the package in datastream format prog-1.00 will be generated under/tmp.
To install the package, run the following command.
% Pkagdd-D prog-1.00.
The above is the method of the entire package. I hope it will help you.
Next we will describe pkgtrans .......
The so-called file system format is our general format. If there are several packages in
In this directory, "pkgadd-D." is used to list all packages.
The datastream format is to make the entire file system into an archive, a bit similar to tar
To install a package in datastream format, you must specify the file name instead "."
Only one package can be installed at a time. However, only one file is required.
To convert the format of File System to the format of datastream, the following commands can be used:
% Pkgtrans source DeST.
To convert the format of datastream to the format of file system, the following commands can be used:
% Pkgtrans-s 'pwd' DeST.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.