⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 0294-0297.html

📁 linux-unix130.linux.and.unix.ebooks130 linux and unix ebookslinuxLearning Linux - Collection of 12 E
💻 HTML
字号:




<HTML>

<HEAD>

<TITLE>Maximum RPM (RPM):Real-World Package Building:EarthWeb Inc.-</TITLE>

<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT>
<!--
function displayWindow(url, width, height) {
        var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>

 -->




<!-- ISBN=0672311054 //-->

<!-- TITLE=Maximum RPM (RPM)//-->

<!-- AUTHOR=Edward Bailey//-->

<!-- PUBLISHER=Macmillan Computer Publishing//-->

<!-- IMPRINT=Sams//-->

<!-- CHAPTER=20 //-->

<!-- PAGES=0275-0304 //-->

<!-- UNASSIGNED1 //-->

<!-- UNASSIGNED2 //-->









<P><CENTER>

<a href="0290-0293.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0298-0300.html">Next</A>

</CENTER></P>



<!-- END CODE SNIP //--><A NAME="PAGENUM-294"><P>Page 294</P></A><!-- CODE //-->

<PRE>



/usr/sbin/amflush

/usr/sbin/amlabel

/usr/sbin/amrestore

/usr/sbin/amtape

%dir     /usr/lib/amanda/

/usr/lib/amanda/taper

/usr/lib/amanda/dumper

/usr/lib/amanda/driver

/usr/lib/amanda/planner

/usr/lib/amanda/reporter

/usr/lib/amanda/getconf

/usr/lib/amanda/chg-generic

/usr/man/man8/amanda.8

/usr/man/man8/amadmin.8

/usr/man/man8/amcheck.8

/usr/man/man8/amcleanup.8

/usr/man/man8/amdump.8

/usr/man/man8/amflush.8

/usr/man/man8/amlabel.8

/usr/man/man8/amrestore.8

/usr/man/man8/amtape.8

%doc README

%doc COPYRIGHT

%doc docs/INSTALL

%doc docs/KERBEROS

%doc docs/SUNOS4.BUG

%doc docs/SYSTEM.NOTES

%doc docs/TAPE.CHANGERS

%doc docs/WHATS.NEW

%doc docs/MULTITAPE

%doc example

</PRE>

<!-- END CODE //-->



<P>You'll note that we neglected to use the %doc directive on the man page files. The reason is

that RPM automatically tags any file destined for

/usr/man as documentation. Now our spec file has a complete set of tags, the two subpackages are defined, it has build-time scripts that

work, and now, %files lists for each subpackage. Why don't we try that build

again?

</P>



<!-- CODE //-->

<PRE>

# rpm -ba   amanda-2.3.0.spec

* Package: amanda

* Package:   amanda-client

* Package:   amanda-server

...

echo Executing: %build

Executing:  %build

+  cd     /usr/src/redhat/BUILD

+ cd amanda-2.3.0

+ make

Making all in common-src

...

+ echo Executing: %install

Executing:    %install

+ cd      /usr/src/redhat/BUILD

+ cd amanda-2.3.0

+ make   install

Making  install  in   common-src

...

+ echo Executing: special doc

Executing: special doc



</PRE>

<!-- END CODE //--><A NAME="PAGENUM-295"><P>Page 295</P></A><!-- CODE //-->

<PRE>



...

Binary  Packaging:  amanda-client-2.3.0-6

Finding   dependencies...

Requires (3): libc.so.5 libdb.so.2 dump

usr/doc/amanda-client-2.3.0-6

usr/doc/amanda-client-2.3.0-6/COPYRIGHT

usr/doc/amanda-client-2.3.0-6/INSTALL

...

usr/lib/amanda/sendbackup-gnutar

usr/lib/amanda/sendsize

1453 blocks

Generating signature: 0

Wrote:            /usr/src/redhat/RPMS/i386/amanda-client-2.3.0-6.i386.rpm

Binary    Packaging: amanda-server-2.3.0-6

Finding      dependencies...

Requires (2): libc.so.5 libdb.so.2

usr/doc/amanda-server-2.3.0-6

usr/doc/amanda-server-2.3.0-6/COPYRIGHT

usr/doc/amanda-server-2.3.0-6/INSTALL

...

usr/sbin/amrestore

usr/sbin/amtape

3404 blocks

Generating signature: 0

Wrote:            /usr/src/redhat/RPMS/i386/amanda-server-2.3.0-6.i386.rpm

...

Source  Packaging:  amanda-2.3.0-6

amanda-2.3.0.spec

amanda-2.3.0-linux.patch

amanda-rpm-instructions.tar.gz

amanda-2.3.0.tar.gz

393 blocks

Generating signature: 0

Wrote:            /usr/src/redhat/SRPMS/amanda-2.3.0-6.src.rpm

#

</PRE>

<!-- END CODE //-->



<P>If we take a quick look at the client and server subpackages, we find that, sure enough,

this time they contain files:

</P>



<!-- CODE //-->

<PRE>

# cd   /usr/src/redhat/RPMS/i386/

# ls -l amanda-*

-rw-r--r-- 1 root root 211409 Nov 21 15:56 amanda-client-2.3.0-1.i386.rpm

-rw-r--r-- 1 root root 512814 Nov 21 15:57 amanda-server-2.3.0-1.i386.rpm

# rpm -qilp amanda-*

Name          : amanda-client         Distribution: (none)

Version     : 2.3.0                       Vendor: (none)

Release     : 1                       Build Date: Thu Nov 21 15:55:59 1996

Install date: (none)                  Build Host: moocow.rpm.org

Group         : System/Backup             Source RPM: amanda-2.3.0-1.src.rpm

Size        : 737101

Summary       : Client-side Amanda package

Description :

The Amanda Network Backup system contains software necessary to

automatically perform backups across a network. Amanda consists of

two packages -- a client (this package), and a server:



The client package enable a network-capable system to have its

filesystems backed up by a system running the Amanda server.



</PRE>

<!-- END CODE //-->

<A NAME="PAGENUM-296"><P>Page 296</P></A>





<TABLE BGCOLOR=#FFFF99><TR><TD>NOTE:</TD></TR><TR><TD>

<!-- CODE SNIP //-->

<PRE>

In order for a system to perform backups of itself, install both

the client and server packages!

</PRE>

<!-- END CODE SNIP //-->

</TD></TR></TABLE>



<!-- CODE //-->

<PRE>

/usr/doc/amanda-client-2.3.0-1

/usr/doc/amanda-client-2.3.0-1/COPYRIGHT

/usr/doc/amanda-client-2.3.0-1/INSTALL

...

/usr/lib/amanda/sendbackup-gnutar

/usr/lib/amanda/sendsize



Name           : amanda-server       Distribution: (none)

Version     : 2.3.0                     Vendor: (none)

Release     : 1                     Build Date: Thu Nov 21 15:55:59 1996

Install date: (none)                Build Host: moocow.rpm.org

Group          : System/Backup         Source RPM: amanda-2.3.0-1.src.rpm

Size        : 1733825

Summary        : Server-side Amanda package

Description :

The Amanda Network Backup system contains software necessary to

automatically perform backups across a network. Amanda consists of

two package -- a client, and a server (this package):



The server package enables a network-capable system to control one

or more Amanda client systems performing backups. The server system

will direct all backups to a locally attached tape drive. Therefore,

the server system requires a tape drive.

</PRE>

<!-- END CODE //-->



<TABLE BGCOLOR=#FFFF99><TR><TD>NOTE:</TD></TR><TR><TD>

<!-- CODE SNIP //-->

<PRE>

In order for a system to perform backups of itself, install both

the client and server packages!

</PRE>

<!-- END CODE SNIP //-->

</TD></TR></TABLE>

<!-- CODE //-->

<PRE>

/usr/doc/amanda-server-2.3.0-1

/usr/doc/amanda-server-2.3.0-1/COPYRIGHT

/usr/doc/amanda-server-2.3.0-1/INSTALL

...

/usr/sbin/amrestore

/usr/sbin/amtape

#

</PRE>

<!-- END CODE //-->



<P>We're finally ready to test these packages!

</P>



<H4><A NAME="ch20_ 23">

20.4.2. Testing Those First Packages

</A></H4>



<P>The system we've built the packages on already has amanda installed. This is due to the

build process itself. However, we can install the new packages on top of the already-existing files:

</P>

<!-- CODE //-->

<PRE>

# cd /usr/src/redhat/RPMS/i386

# rpm -ivh amanda-*-1.i386.rpm

amanda-client    ##################################################

amanda-server    ##################################################

#

</PRE>

<!-- END CODE //-->



<P>Running some tests, it looks like everything is running well. But back in Chapter 11,

specifically in section 11.5.2, we mentioned that it is possible to install a newly built package on

the build system and not realize that the package is missing files. Well, there's another reason

</P>



<A NAME="PAGENUM-297"><P>Page 297</P></A>







<P>installing the package on the build system for testing is a bad idea. Let's bring our packages

to a different system, test them there, and see what happens.

</P>



<H4><A NAME="ch20_ 24">

20.4.2.1. Installing the Package on a Different System

</A></H4>



<P>Looks like we're almost through. Let's install the packages on another system that has not

previously run amanda, and test it there:

</P>



<!-- CODE //-->

<PRE>

# rpm -ivh amanda-*-1.i386.rpm

amanda-client 	##################################################

amanda-server 	##################################################

#

</PRE>

<!-- END CODE //-->



<P>The install went smoothly enough, but testing did not. Why? Nothing was set up! The

server configuration files, the inetd.conf entry for the client&#151;everything was missing. If we stop

and think about it for a moment, it makes sense: We had gone through all those steps on the

build system, but none of those steps can be packaged as files.

</P>



<P>After following the steps in the installation instructions, everything works. While we could

expect users to do most of the grunt work associated with getting amanda configured, RPM does

have the capability to run scripts when packages are installed and erased. Why don't we use

that feature to make life easier for our users?

</P>



<H4><A NAME="ch20_ 25">

20.4.3. Finishing Touches

</A></H4>



<P>At this point in the build process, we're on the home stretch. The software builds correctly

and is packaged. It's time to stop looking at things from a &quot;build the software&quot; perspective,

and time to starting looking at things from a &quot;package the software&quot; point of view.

</P>



<P>The difference lies in looking at the packages from the user's perspective. Does the

package install easily, or does it require a lot of effort to make it operative? When the package is

removed, does it clean up after itself, or does it leave bits and pieces strewn throughout

the filesystem?

</P>



<P>Let's put a bit more effort into this spec file and make life easier on our users.

</P>



<H4><A NAME="ch20_ 26">

20.4.3.1. Creating Install Scripts

</A></H4>



<P>When it comes to needing postinstallation configuration, amanda certainly is no slouch!

We'll work on the client first. Let's look at a section of the script we wrote, comment on it, and

</P>



<P>move on:

</P>



<!-- CODE //-->

<PRE>

%post  client



# See if they've installed amanda before...

# If they have, none of this should be necessary...



if [ &quot;$1&quot; = 1 ];

then



</PRE>

<P><CENTER>

<a href="0290-0293.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0298-0300.html">Next</A>

</CENTER></P>











</td>
</tr>
</table>

<!-- begin footer information -->







</body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -