Полезная информация

UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 52.4 Quick Descriptions of What's on the Disc Chapter 52
What's on the Disc
Next: 52.6 Don't Have a CD-ROM Drive?

52.5 Using the Power Tools CD-ROM

[In addition to this article, be sure to read the file called README for any late-breaking news on using the CD-ROM. -LM]

The CD-ROM that comes with this book can be used in two different ways. First, it can be mounted just long enough for software to be copied onto a local hard disk. In this respect, it is a distribution medium similar to magnetic tapes or floppy disks. Second, it can be mounted so that it is always present and available as a local read-only hard disk. It will appear as a filesystem and you can use familiar UNIX commands to peruse it.

52.5.1 CD-ROM Formats

The Power Tools CD conforms to the ISO standard 9660. This is sometimes called "High Sierra," but there are differences between the two formats. The 9660 standard is what most CD-ROM drivers will support from now on, even though they will read High Sierra discs.

For UNIX users, ISO 9660 may come as a shock. For example, a directory listing of an ISO 9660 disc might look like this:

% ls /cdrom
ALPHA/      CONFIG1      HP700/       INSTINFO/   RS6000/    SUN4C/
BUILD.PT*   CONFIG2.REV  I386/        LINUX/      SOURCES/

ISO 9660 specifies that the filenames are mono-case, and limited to 8 characters with 3-character extensions. If the filename doesn't contain a dot, one is added at the end of the filename. A "version number" is also appended, following a semicolon (version numbers are used in some non-UNIX filesystems such as VMS). Some systems do not use all these features, so there are several variations that you will encounter.

For example, a file called install.pt may appear as any of the following, depending on what system you mount the CD-ROM on:

INSTALL.PT;1 INSTALL.PT install.pt;1 install.pt

Directory names are simply 8 characters or less and mono-case. A directory called "SOURCES" can appear as SOURCES or sources. ISO 9660 also limits directory depth to 8 levels.

Note that the semicolon character (;) in version numbers needs to be quoted (8.14) when you are specifying the filename in a UNIX shell. If you don't quote such a filename, you'll get a message like this:

INSTALL.PT: Command not found.
1: Command not found.

Luckily for you, we provide installation software that hides most of this ugliness.

52.5.2 Mounting the CD-ROM

For UNIX users, the CD-ROM should be made available as if it were a filesystem. In most cases, the standard mount command can be used. This usually has the form:

# mount CD-ROM_device mount_point

The CD-ROM device name varies depending on the type of system. If you do not know the device name, consult the documentation that comes with your system. On some systems, the SCSI ID of the CD-ROM device can vary. The SCSI ID will be part of the device name - for example, /dev/rz3c/ is the CD-ROM at SCSI ID 3 on a DECstation.

The mount point is simply a directory that will become the parent directory of the CD-ROM when it is mounted.

Most systems do not provide a way for unprivileged users to mount the CD. It is probably necessary to mount and use it as the superuser (1.24). For this reason, the bulk of this article assumes some knowledge of system administration and superuser commands. You may need to have your system administrator install the power tools software for you.

As the CD is read-only, you may have to specify this fact to the mount program or it will generate an error if it tries to open the CD-ROM device for writing. Some systems also need to be told the type of filesystem being mounted if it is not the default (usually ufs or nfs). There may be options to the mount program that control whether all the ISO 9660 features (such as version numbers) are turned on.

For example, the CD can be mounted on a SunOS 4.1.1 system with the command:

# /etc/mount -r -t hsfs /dev/sr0 /cdrom

This command mounts the CD (/dev/sr0) on the mount point (/cdrom) in a read-only fashion (-r). If you omit the -r option, mount will give the following error:

mount_hsfs: must be mounted readonly
mount: giving up on:

If you omit the filesystem type of hsfs (High Sierra Filesystem, which preceded the ISO 9660 format), you will get:

mount: /dev/sr0 on /cdrom: Invalid argument
mount: giving up on:

The procedure for mounting a CD-ROM varies with each type of operating system. You should consult the manual pages for the mount command and look for a mention of CD-ROM, ISO 9660, or High Sierra:

% man mount

Some examples of mount commands for the supported systems are:

Sun4 SunOS 4.1.4

# /etc/mount -r -t hsfs /dev/sr0 /cdrom

IBM RS/6000 AIX 3.2

# /etc/mount -r -v cdrfs /dev/cd0 /cdrom

HP 700 HP-UX

# /etc/mount -r -s cdfs /dev/dsk/c201d2s0 /cdrom


# /etc/mount -r -fHS,lower,intr,soft,novers /dev/cd0 /cdrom


# /etc/mount -F -hsfs -r /dev/dsk/c0t4d0s0 /cdrom


# /usr/sbin/mount -t cdfs -o noversion /dev/rz3c /cdrom


# /bin/mount -t iso9660 -o ro /dev/cdrom /cdrom

An example of a mount command on another system is:


# /usr/etc/mount -o ro,notranslate -t iso9660 \ 
     /dev/scsi/sc0d5l0 /cdrom

You can also start up the cdromd process:

# cdromd -o ro,notranslate -d /dev/scsi/sc0d5l0 /cdrom

To mount the disc, just insert it in the drive. To unmount it, use the eject command.

Once you have the CD-ROM mounted, you can run the installation program to copy pre-compiled binaries off the CD and onto your system's hard disk. The installation program is Ready-to-Run Software's "Smart Installation System."

52.5.3 Installing Pre-Compiled Binaries

There are two software installation programs provided on the CD. The first program "installs" pre-compiled binaries. The second program "builds" programs from source code. If you have one of the supported platforms, you can install software off the CD-ROM and use it immediately. If your platform is not one of the supported platforms or you wish to change the software in some way, you should be able to build it from source code (52.8).

Binaries for the following platforms are on this CD-ROM:

The pre-compiled binaries may work on operating system versions slightly older or newer than the ones listed here. Some programs take advantage of features that are not supported on all the platforms. The install program will tell you if a program is not available for your platform.

If you are uncertain of your operating system version, the uname command may help:

% uname -a
SunOS ruby 4.1.4 1 sun4m

If your platform is not listed, you should try building the programs from source code as described in article 52.8. Directory Structure

There is a standard installation structure for all packages on the CD-ROM. Using this structure (and some simple variations of it), you can tailor how and where your packages will be installed on your system.

The basic directory structure is shown in Figure 52.1.

Figure 52.1: Basic Directory Structure

Figure 52.1

Some packages may deviate from this structure by having extra directories at the <install_dir> level.

Shareable files are those files that are machine independent and can be shared across many machines in a network using a network filesystem (NFS) (1.33). These are typically text files, such as manual pages or "include files." Sharing files reduces the amount of disk space required by allowing several different systems to use the same set of files, as opposed to having to duplicate them for each machine. It also simplifies administration of the files by having only a single copy to maintain.

Non-shareable files are machine/architecture specific and may not be shared (except with other hosts of the same architecture). These are typically binaries or data files that depend on a certain architecture or byte order.

The installation program gives you the ability to split the shareable and non-shareable files into separate directories. Using this scheme, you could put shareable files onto a partition or directory that is mounted by multiple machines.

If you want to store shareable and non-shareable files at the same directory level, the shareable directories will be preceded by a leading s to mark them as "shareable." For example, sbin is shareable, while bin is non-shareable.

[1] Figure 52.2 shows how the default installation directories are arranged.

[1] You may also remove the leading s from the shareable directories sinclude, sspool, sbin, and slib. This way, you can merge slib into lib, and sbin into bin if your shareable and non-shareable files are stored in the same directory, or make names clearer if your shareable and non-shareable files are not stored together.

Figure 52.2: Default Installation Directory Structure

Figure 52.2

You can modify this structure using the Smart Installation System and any necessary directories will be created (if you have permission to do so).

In order to run the software after installation, you will need to make sure that your shell path variable includes <install_dir>/bin (and possibly <install_dir>/share/bin if you choose to use this structure). For example, if <install_dir> is set to /usr/local, set your search path (8.7) as appropriate for your shell:

% set path=($path /usr/local/bin /usr/local/share/bin)   csh
$ PATH=$PATH:/usr/local/bin:/usr/local/share/bin ; export PATH   sh

The installation software will automatically print out a suggested path when it finishes installing a program. Starting the Installation

To begin the installation process, become the superuser and mount the CD-ROM. For example, on a Sun running SunOS 4.1.4:

% su
# /etc/mount -r -t hsfs /dev/sr0 /cdrom

Then change directories to the mount point you specified for the CD-ROM and see what is there. In our case, we specified /cdrom as our mount point:

# cd /cdrom
# ls
common          install.pt      alpha           linux
hp700           instinfo        rs6000          sun4c
i386            readme          sources         ssol2

The output could look slightly different depending on the type of system:

ALPHA/      CONFIG1      HP700/       INSTINFO/   RS6000/    SUN4C/
BUILD.PT*   CONFIG2.REV  I386/        LINUX/      SOURCES/

One of the first things that the installation program will do when installing software is to copy the programs into a "staging" area. By default, this is the directory /tmp. By setting the environment variable TMPDIR to another directory, you can alter this location.

For example, if you want to use the directory /mondo for the staging area:

% setenv TMPDIR /mondo   csh
$ TMPDIR=/mondo; export TMPDIR   sh

NOTE: If you wish to install software in "system" areas, you will likely run into problems with file permissions. You can just become the superuser and not worry about permissions, but this is dangerous because you could overwrite previously installed or vendor-supplied software. The other option is to run the install as an unprivileged user. This should prevent you from damaging system areas, but you will have to use chmod (22.7) to make directories writable before you begin the installation process - or possibly use group permissions (22.13) to control access. Running Install

Once you have the CD-ROM properly mounted, run the appropriate install command for your system. For example:

% ./install.pt



The installation program will display menus and prompt you for input from now on. It will also try to guess the type of machine you are running it on and the mount point of the CD-ROM:

Assuming CDROM   is mounted at /archive/cdrom

                      Welcome to Ready-to-Run Software's
                         * Smart Installation System *

This installation system requires write permission in /tmp (or $TMPDIR if
it's set) directory (for staging the install) and write permission in the
installation directory for the actual install (these may be the same).

At this point, the installation program may ask if you want to use a different umask (22.4) value for the installation process:

Use umask of 022 instead of 007 for install [y]? y

This will affect the permissions of the software when it is installed. The suggested value of 022 will allow anyone to execute or read the programs, but gives write permission only to you.

The install program will then present a list of the available software:

The PowerTools2 package contains the following scripts:

!            80cols       Clear        _emacs_ml    _enter_csh   _enter_sh    
_exit_csh    _exit_sh     addup        age_files    ascii        awf          
behead       bkedit       cal_today    catsaway     center       cgrep        

The PowerTools2 package contains the following packages:

bash         bitmaps      bsdtar       bsplit       calen        cpmod
cvtbase      delete       diff         ediff        emacs        fgrep
fileutils    find         gawk         getopt       glimpse      grabchars

After the names of the software packages have been displayed, you are prompted for which ones to install:

Enter the name of a package to install or choose Search, Quit or All
<package>, S(earch), A(ll), Q(uit) [Search]?

You can now type the name of the package, search for packages, quit the installation program, or install all packages in one fell swoop. Installing a Single Program

Some of you might prefer not to install the entire distribution, but just selected programs.

For this example, let's assume you are looking for programs that do something with terminals, but you don't know what they are called. You can use the "Search" function at the main menu to look for you. Just press RETURN at the prompt, as the "Search" is the default action in the square brackets ([]).

<package>, S(earch), A(ll), Q(uit) [Search]? s

Then type in "terminal" for the search keyword:

Search package descriptions for (? for help) []? terminal

All packages matching this description will be displayed:

The descriptions for the following packages mention "terminal":
   1.  Clear
   2.  emacs
   3.  qterm
   4.  screen
   5.  tcap
   6.  termtest
   7.  tputinit

   A.  ALL
   N.  NONE

Choose one please:

For this example, the qterm program is selected, which is option 1:

Choose one please: 3

A description of the program is now displayed:

qterm - version 5.0         Version 5.0

Qterm is a program that queries terminals to find out what kind of
terminal is responding.  It is useful to automagically define your
terminal type.  It prints the name of the terminal (compatible,
hopefully, with a termcap/terminfo name) such as "vt100" to standard

The qterm package is approximately  64Kb
     32Kb - Required
     15Kb - Shared: Formatted Man pages
      3Kb - Shared: Other Shareable files
     13Kb - Shared: Unformatted Man pages

Install qterm [y]?
qterm was compiled and made "Ready-to-Run" by
        Ready-to-Run Software, Inc.

   Copyright (c) 1990 Michael A. Cooper.
   This software may be freely distributed provided it is not sold for
   profit and the author is credited appropriately.

Power Tools distribution by permission of the author.


After information about qterm is printed, you are told how much space it will require and then asked whether you want it installed. Press RETURN to install it, or "n" for "no" (followed by RETURN) if you don't want it installed. For our example, we want qterm installed, so we just press RETURN.

The qterm package is approximately  56Kb
     24Kb - Required
     15Kb - Shared: Formatted Man pages
      3Kb - Shared: Other Shareable files
     13Kb - Shared: Unformatted Man pages

Install qterm [y]? [RETURN]

Any copyright information for the qterm package is printed out now:

qterm was compiled and made "Ready-to-Run" by 
        Ready-to-Run Software, Inc.

 * Copyright (c) 1990 Michael A. Cooper.
 * This software may be freely distributed provided it is not sold for 
 * profit and the author is credited appropriately.

You are then prompted with installation questions, with the default answers printed within square brackets ([]).

The first question is where to install the software. The installation program assumes /usr/local as the default installation directory. If you want to change the default, type the name of a different directory here. This directory will now be used when you are prompted for the same information in all subsequent packages.

Install package at dir [/usr/local]? /work/tools [RETURN]

The next question is where to install the shared files for the package. The default is to use a share subdirectory of whatever directory you specified in the previous question.

Install shared files at [/work/tools/share]? [RETURN]

Third, you're asked whether to remove the s prefix from the names of the directories in which you install the shared files. The default is "y" for "yes"-remove the s prefix.

Convert slib->lib, sbin->bin, sspool->spool, sinclude->include [y]? [RETURN]

The fourth question is whether to install all the shared files, some, or none of them. The default is to install just some selected shared files.

Install Shared files (All, Some, None) [s]? [RETURN]

Now you're asked whether to install the manpages. The default is to install them all. You might choose not to install unformatted manpages if you are low on disk space or if you don't have nroff on your system to format them with:

Install Unformatted Man pages (Approx  13Kb) [y]? [RETURN]
Install Formatted Man pages (Approx  15Kb) [y]? [RETURN]

Finally you're asked about any other shareable files.

Install Other Shareable files (Approx   3Kb) [y]? [RETURN]

(Other packages might have other questions, as appropriate. For example, the gawk installation asks whether to install Texinfo files, PostScript format documentation, and DVI format documentation.)

If you want the answer to any question to be used for all subsequent packages without further prompting, enter the answer in uppercase. You can enter a pathname in uppercase, and the installation script will convert it to lowercase before using it. For example:

Install package at dir [/usr/local]? /WORK/TOOLS [RETURN]
Install shared files at [/work/tools/share]? /WORK/TOOLS/SHARE [RETURN]
Convert slib->lib, sbin->bin, sspool->spool, sinclude->include [y]? Y [RETURN]
Install Shared files (All, Some, None) [s]? S [RETURN]
Install Unformatted Man pages (Approx  13Kb) [y]? Y [RETURN]
Install Formatted Man pages (Approx  15Kb) [y]? Y [RETURN]
Install Other Shareable files (Approx   3Kb) [y]? Y [RETURN]

After answering all the questions, the installation script sets up its installation information and asks you once more if it's correct. If you change your mind about the current configuration, press "n" to get another chance to change some of your installation parameters or to abort the installation of this package entirely. If the current configuration is acceptable, press RETURN a final time, and the package is installed.

Please wait....

    About To Install: qterm

        at /work/tools
        with shareable files at /work/tools/share
        slib->lib, sbin->bin, sspool->spool, sinclude->include

Are these correct [y]? [RETURN]
Proceeding with install...

0 directories added, 6 files installed, 0 symbolic links created.
Approximately  99Kb installed.

Once the qterm installation is completed, the installation script returns to the main menu if this is the only package you have selected.

After all programs are installed, you can quit the installation program. Upon quitting, the installation program suggests a new search path (8.7) for you.

You may want to change your path to include:

Suggested new path:
/work/tools/bin:/work/tools/share/bin:/bin:/usr/bin ...

A log file of the installation process is kept in /tmp/RTRinstall.log. A typical entry looks like this:

Package: jot - installed Thu Jul 10 14:39:52 EDT 1997

   /usr3/tmp/sidh/sundae/bin: Making directory
   /usr3/tmp/sidh/sundae/share: Making directory
   /usr3/tmp/sidh/sundae: Making directory

3 directories added, 1 file installed.
Approximately  24Kb installed. Installing Everything Using the Defaults

If you don't want to be bothered with being questioned about every package in the installation, and the default values are fine with you, you can bypass the questions and install everything at once. At the main menu, press "A" for "All" to install all packages:

bash         bitmaps      bsdtar       bsplit       calen        cpmod
cvtbase      delete       diff         ediff        emacs        fgrep
fileutils    find         gawk         getopt       glimpse      grabchars
Enter the name of a package to install or choose Search, Quit or All
<package, S(earch), A(ll), Q(uit) [Search]? A [RETURN]

You are shown information about the first program, bash. Then you are asked whether to install bash:

GNU Bash, version 1.14.6.

Bash is the GNU Project's Bourne Again SHell, an interactive shell with
Bourne shell syntax (/bin/sh); but also with interactive command line
editing, job control on architectures that support it, Csh-like history
features and brace expansion, and a slew of other stuff.

The bash package is approximately 2.3Mb
    601Kb - Required
    383Kb - Shared: DVI Format Documentation
    205Kb - Shared: Formatted Man pages
    217Kb - Shared: Info files
      9Kb - Shared: Other Documentation
    741Kb - Shared: PostScript Format Documentation

    165Kb - Shared: Unformatted Man pages
     49Kb - Shared: examples/templates/extra info

Install bash [y]? y

The default answer is "y", to install bash. However, if you respond instead with the string ++, bash will be installed and furthermore, all default values will be used from now on without prompting.

Install bash [y]? ++ [RETURN]
bash was compiled and made "Ready-to-Run" by
        Ready-to-Run Software, Inc.

Copyright (C) Free Software Foundation, Inc.

GNU bash is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 1, or (at your option) any
later version.

GNU bash is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
for more details.

Please wait....

    About To Install: bash

        at /usr3/tmp/sidh
        with shareable files at /usr3/tmp/sidh/share
        slib-lib, sbin-bin, sspool-spool, sinclude-include

Are these correct [y]? y
Proceeding with install...

14 directories added, 27 files installed, 0 symbolic links created.
Approximately 2.3Mb installed.
Notes (file, print, view, done) [view]? done

At this point, you can go to lunch and come back to find everything installed in /usr/local.

Another alternative is to call the installation script with the -D option to use the defaults. For example:

% install.pt -D

You'll still have to answer the question about your umask, and you'll have to answer "A" for "All" to the main menu, but then all packages will be installed without prompting.

Note that to run a default installation, you will need to have write permission to the default directory of /usr/local.

52.5.4 Unmounting the CD-ROM

When you are finished with the installation, you can unmount the CD-ROM with the umount command with just the mount point as the argument:

# /etc/umount /cdrom

52.5.5 What to Do if You Have Problems

If you can't get the software to install and/or run, then you can call Ready-to-Run's CD support line (52.9).

- EP

Previous: 52.4 Quick Descriptions of What's on the Disc UNIX Power ToolsNext: 52.6 Don't Have a CD-ROM Drive?
52.4 Quick Descriptions of What's on the Disc Book Index52.6 Don't Have a CD-ROM Drive?

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System