man makecat () - Build an Interchange catalog from a template

NAME

makecat - Build an Interchange catalog from a template

SYNOPSIS

makecat [--options] name

VERSION

# CW$Id: makecat.PL,v 2.25 2005/01/24 22:08:50 jon Exp $

INTRODUCTION

The makecat program builds a Interchange catalog from a template based on your server configuration. It interrogates for parameters like the directories to use, URL to base the catalog in, HTTP server definitions, and file ownership. It is self-documenting in that it asks verbose questions and gives relevant examples.

On UNIX, if you want to check on something during the process you can usually hit <CTRL-Z> to suspend the program and do something and then type CWfg to return to <makecat>. Also, if your input begins with an exclamation mark (CW!), it will be interpreted as a shell command. An exclamation mark (CW!) alone should drop you into a shell.

If you have the CWTerm::ReadLine::Perl and CWTerm::ReadKey modules installed, the <UP> and <DOWN> arrows will cycle between suggested defaults; and the following features will be in place:

    TAB       Completes file name
    <UP>      Cycle suggestion up
    <DOWN>    Cycle suggestion down
    <CTRL-P>  Cycle suggestion up
    <CTRL-N>  Cycle suggestion down
    <CTRL-B>  Go back one question (if possible)
    <CTRL-U>  Erase line
    <LEFT>    Command-line editing left
    <RIGHT>   Command-line editing left

Also, if you make a mistake at some stage of the interrogation, you can often hit the <CTRL-B> key to return to the previous query. If you don't have Term::ReadLine installed, then you can enter an at sign (CW@) by itself on the line.

OPTIONS

usage: makecat [options] [catalogname]

The makecat program can build a catalog based completely on a command line description. An example is in eg/makecat.sh.

There are just a few flag-based options: Force make of catalog with defaults supplied on command line. Configuration file default is makecat.cfg in Interchange Confdir (etc) directory. File to log to (default makecat.log) Reconfigure defaults normally set in makecat.cfg; this is done automatically the first time the program is run.

The remainder of the options are supplied on the command line as named parameters followed by an CW= sign, followed by the value, i.e.

  --parameter=value

Normally, if CWmakecat supplies a default you might guess at that. It is fairly intelligent if you have an Apache server and it has found the httpd.conf file. If you are on a Netscape or other web server, it is less likely to be right.

The options set at reconfig time, i.e. the first time the program is run:

--basedir=directory
Base directory for catalogs. This defaults to CWcatalogs in the home directory of the catalog user.
--cgibase=url_fragment
Base URL for link programs. This is normally either blank (your programs are made with .cgi extension) or CW/cgi-bin (you have a CGI directory).
--documentroot=directory
The directory where HTML is based. This is the root directory of the web server, i.e. DocumentRoot.
--interchangegroup=group
The default group files should be owned by.
--interchangeuser=username
The user ID which runs Interchange.
--serverconf=filename
Location of httpd.conf; you will be queried otherwise.
--vendroot=filename
Location of Interchange software.
--homedir=directory
Use instead of \$HOME to set defaults

These are options which are required to be set for any catalog; the default will often be correct if you have set the above options correctly.

--catroot=directory
Directory where Interchange catalog files go. This is the base directory for this catalog.
--cgidir=directory
The directory the CGI link should go to. This is the CGI directory; if your CGI programs all end in CW.cgi then this would normally be the same as CWdocumentroot; if you have a CWcgi bin directory it should be used.
--servername=server
Name of server (www.whatever.domain). You can supply a port:
    www.foo.com:8080
or a username:
    www.foo.com/~bar
For testing on your local machine, just use CWlocalhost.
--cgiurl=url_fragment
The path to the CGI link (no server name). For a catalog named CWstandard, this would normally be one of:
    --cgiurl=/cgi-bin/standard
or
    --cgiurl=/standard.cgi
--demotype=template
The template catalog. The default is <standard>.
--mailorderto=email
Email address to send orders
--catuser=username
The user files should be owned by (option only operative if CWroot).

The rest of the parameters need not be supplied on the command line as intelligent defaults can be derived from the above parameters.

--samplehtml=directory
The directory where template HTML goes.
--imagedir=directory
The directory where template images go.
--imageurl=url
The URL to prefix images with.
--sharedir=directory
The directory where shared admin images go.
--shareurl=url
The URL to prefix shared admin images with.
--nocfg
Don't add to interchange.cfg.
--nocopy
Don't actually copy the files, just test.
--norunning
Don't add to running server.
--reference
Return hash of config as string (sets CW-F, no write). This is for passing back to the makecat program in a autobuild environment.
--linkprogram=file
Use file as link program instead of vlink/tlink.
--linkmode=mode
UNIX or INET (link program vlink or tlink).
--sampleurl=url
URL to access HTML for catalog.
--noumask
Don't set umask to the value implied by mode.
--catalogconf=file
Use file as configuration file for catalog definitions. This option has been designed for the use with Debian installations.

DESCRIPTION

CWmakecat needs a template catalog to operate on. The Foundation Store demo template is distributed with Interchange. You can also look for additional demo catalogs (mostly for ideas) at http://www.icdevgroup.org/

IMPORTANT NOTE: You only make a catalog once. All further configuration is done by editing the files within the catalog directory.

A catalog template contains an image of a configured catalog. The best way to see what the makecat program does is to configure the 'standard' demo and then run a recursive CWdiff on the template and configured catalog directories:

  diff -r interchange/standard catalogs/standard

You will see that the files are mostly the same, except that certain macro strings have been replaced with the answers you gave to the script. For example, if you answered CWwww.mydomain.com at the prompt for server name, then you would see this difference in the catalog.cfg file:

    # template
    Variable SERVER_NAME  __MVC_SERVERNAME__

    # configured catalog
    Variable SERVER_NAME  www.mydomain.com

The macro string __MVC_SERVERNAME__ was substituted with the answer to the question about server name. In the same way, other variables are substituted, and include (at least):

    MVC_BASEDIR      MVC_IMAGEDIR
    MVC_CATROOT      MVC_IMAGEURL
    MVC_CATUSER      MVC_MAILORDERTO
    MVC_CGIBASE      MVC_MINIVENDGROUP
    MVC_CGIDIR       MVC_MINIVENDUSER
    MVC_CGIURL       MVC_SAMPLEHTML
    MVC_DEMOTYPE     MVC_SAMPLEURL
    MVC_DOCUMENTROOT MVC_VENDROOT
    MVC_ENCRYPTOR

(Not all of these are present in the standard template, and quite a few more may be defined.) In fact, any environment variable that is set and begins with MVC_ will be substituted for by the CWmakecat script. So if you wanted to set up a configurable parameter to customize the COMPANY variable in catalog.cfg, you could run a pre-qualifying script that set the environment variable MVC_COMPANY and then place in the catalog.cfg file:

    Variable   COMPANY   __MVC_COMPANY__

All files within a template directory are substituted for macros, not just the catalog.cfg file. There are two special directories named CWhtml and CWimages. These will be recursively copied to the directories defined as SampleHTML and ImageDir.

IMPORTANT NOTE: The template directory is located in the Interchange software directory, i.e. where CWinterchange.cfg resides. You normally do not edit files in the template directory. If you want to try creating your own template, it is recommended that you name it something besides standard and copy the CWstandard demo directory to it as a starting point. Templates are normally placed in the Interchange base directory, but can be located anywhere the script will prompt you for location if it cannot find a template.

In addition to the standard parameters prompted for by Interchange, and the standard catalog creation procedure, you may define four other files in the CWconfig directory of the template:

    additional_fields  -- file with more parameters for macro substitution
    additional_help    -- extended description for the additional_fields
    precopy_commands   -- commands passed to the system prior to catalog copy
    postcopy_commands  -- commands passed to the system after catalog copy

All files are paragraph-based; in other words, a blank line (with no spaces) terminates the individual setting.

The additional_fields file contains:

    PARAM
    The prompt. Set PARAM to?
    The default value of PARAM

This would cause a question during makecat:

    The prompt. Set PARAM to?.....[The default value of PARAM]

If the additional_help file is present, you can give additional instructions for PARAM.

    PARAM
    These are additional instructions for PARAM, and they
    may span multiple lines up to the first blank line.

The prompt would now be:

    These are additional instructions for PARAM, and they
    may span multiple lines up to the first blank line.

    The prompt. Set PARAM to?.....[The default value of PARAM]

If the file config/precopy_commands exists, it will be read as a command followed by the prompt/help value.

    mysqladmin create __MVC_CATALOGNAME__
    We need to create an SQL database for your Interchange
    database tables.

This will cause the prompt:

    We need to create an SQL database for your Interchange
    database tables.

    Run command "mysqladmin create test_standard"?

If the response is y or yes, then the command will be run by passing it through the Perl system() function. As with any of the additional configuration files, MVC_PARAM macro substitution is done on the command and help. Obviously you must have proper permissions for the command.

The file config/postcopy_commands is exactly the same as precopy_commands except you are prompted after the catalog files are copied and macro substitution is performed on all files.

ABOUT INTERCHANGE IN GENERAL

Interchange has many, many, functions and features; they are too numerous to describe in this venue. Complete information can be found at its web site:

        http://www.icdevgroup.org/

Interchange requires Perl 5.6.0 or higher; more information on Perl can be seen at:

        http://www.perl.com/

SEE ALSO

LICENSE

Interchange comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute and modify it under the terms of the GNU General Public License.

COPYRIGHT

Copyright 2002-2005 Interchange Development Group. Copyright 1995-2002, Red Hat, Inc. All rights reserved except as in the license.

AUTHOR

Mike Heins, <mike@perusion.com>. Please do not contact the author for direct help with the system. Use the Interchange mail list:

    interchange-users

Information on subscribing to the list, and general information and documentation for Interchange is at:

    http://www.icdevgroup.org/