Initial import of the CDE 2.1.30 sources from the Open Group.
This commit is contained in:
11
cde/admin/IntegTools/dbTools/Imakefile
Normal file
11
cde/admin/IntegTools/dbTools/Imakefile
Normal file
@@ -0,0 +1,11 @@
|
||||
XCOMM $XConsortium: Imakefile /main/5 1996/04/23 21:26:14 drk $
|
||||
|
||||
LOCAL_CPP_DEFINES = -DCDE_INSTALLATION_TOP=$(CDE_INSTALLATION_TOP) \
|
||||
-DCDE_CONFIGURATION_TOP=$(CDE_CONFIGURATION_TOP) \
|
||||
-DCDE_LOGFILES_TOP=$(CDE_LOGFILES_TOP) \
|
||||
-Usun -Uusl -Uuxp -Uaix -Udec -UAIX -Uibm -Uhp
|
||||
|
||||
AllTarget(installCDE dinstallCDE)
|
||||
|
||||
CppScriptTarget(installCDE,installCDE.src,$(LOCAL_CPP_DEFINES),)
|
||||
CppScriptTarget(dinstallCDE,dinstallCDE.src,$(LOCAL_CPP_DEFINES),)
|
||||
216
cde/admin/IntegTools/dbTools/UDB.format
Normal file
216
cde/admin/IntegTools/dbTools/UDB.format
Normal file
@@ -0,0 +1,216 @@
|
||||
|
||||
UDB FILE FORMAT
|
||||
|
||||
The udb (universal data base) format attempts to allow product delivery
|
||||
information for several closely related products to co-exist in the
|
||||
same database file. This is an HP Corvallis home-grown format which
|
||||
was originally created to deal with the delivery of similar products
|
||||
on hp-ux, domain and osf platforms.
|
||||
|
||||
The format is meant to be more or less free form without regard to
|
||||
intervening newlines or whitespace. Comments violate this principle
|
||||
by being line oriented. Any line whose first non-whitespace character
|
||||
is a '#' is considered a comment. A semi-colon may be placed between
|
||||
two identifiers to break them up into separate tokens. If more than
|
||||
one keyword/value pair is placed on a line, semi-colons can be used
|
||||
to separate them visually. The semi-colons are ignored by the parser.
|
||||
|
||||
The special syntax characters ( "{",":",";","=","}") may be embedded
|
||||
in an identifier by escaping them with a backslash.
|
||||
|
||||
Semantic Note:
|
||||
The tools associated with the udb databases apply semantic meaning
|
||||
to seven kinds of information about a file. There are seven Special
|
||||
Tokens which may be used to identify the keywords with which the
|
||||
semantic information should be associated.
|
||||
|
||||
Special Token description
|
||||
------------ -----------
|
||||
<SRC> The path (relative to the top of a
|
||||
build tree) to the source of a
|
||||
product deliverable file.
|
||||
|
||||
<DEST> The full destination path location of
|
||||
a deliverable file in the target
|
||||
machine's file system.
|
||||
|
||||
<LNK> The full path name (in the target
|
||||
machine's file system) of the source
|
||||
file for a symbolic link. (i.e. The file
|
||||
pointed to).
|
||||
|
||||
<TYPE> The kind of file object being installed.
|
||||
(i.e. file, sym_link, hard_link,
|
||||
directory, etc. )
|
||||
|
||||
<MODE> The (numeric) permissions assigned to
|
||||
the new object. This value should be
|
||||
in the usual octal notation.
|
||||
|
||||
<OWNER> The symbolic name of the owner of the
|
||||
new file.
|
||||
|
||||
<GROUP> The symbolic name of the group of the
|
||||
new file.
|
||||
|
||||
The hp-ux fileset databases have traditionally used the
|
||||
following keywords for these items:
|
||||
|
||||
hpux keyword Special Token
|
||||
------------ -----------
|
||||
a_out_location : <SRC>
|
||||
install_target : <DEST>
|
||||
link_source : <LNK>
|
||||
type : <TYPE>
|
||||
mode : <MODE>
|
||||
owner : <OWNER>
|
||||
group : <GROUP>
|
||||
|
||||
The default for the udb databases is to associate the <SRC> semantics
|
||||
with the "a_out_location" keyword, the <DEST> semantics with the
|
||||
"install_target" keyword, etc. This behavior may be modified by
|
||||
assigning a special token to a keyword in the Release Definition
|
||||
Section of the database file.
|
||||
|
||||
|
||||
General Format:
|
||||
A udb file has two sections. First, a Release Definition Section,
|
||||
which describes the keyword pairs to be maintained for a given
|
||||
release stream and second, the individual file records for each
|
||||
file which is to be delivered.
|
||||
|
||||
1) Release Definition Section
|
||||
|
||||
The Release Definition Section defines the keyword-value
|
||||
pairs which are to be maintained for each release. The
|
||||
release_id is an identifier which is used to identify the
|
||||
set of defaults for a particular release. The special
|
||||
release_id of "default" is used specify the default set
|
||||
of keyword/value pairs for an undefined release_id. The
|
||||
values associated with keywords in this section provide
|
||||
defaults for those keywords in later File Entries.
|
||||
|
||||
The name and number of these pairs need not be the same for
|
||||
all release streams.
|
||||
------------------------------
|
||||
For example:
|
||||
The following entry in the Release Definition Section
|
||||
|
||||
{ hpux : defaults
|
||||
src = <SRC>
|
||||
dest = <DEST>
|
||||
link_source =
|
||||
type = file
|
||||
perm = <MODE>
|
||||
perm = 0555
|
||||
owner = bin
|
||||
group = bin
|
||||
project = xwindows
|
||||
}
|
||||
|
||||
defines the defaults for the "hpux" release stream. It
|
||||
states that we should maintain information about src, dest, link_source, type, perm, owner, group and project in the database. Furthermore
|
||||
the semantics of <SRC> are to be associated with the keyword "src",
|
||||
<DEST> with "dest", link_source is associated with <LNK> by default,
|
||||
and type is associated with <TYPE> by default. Note that we associate
|
||||
perm with <MODE> semantics and supply a default value (0555) different
|
||||
from the automatic 0444 default. Owner and group have their usual
|
||||
meaning and a field called "project" is defined with a default value
|
||||
of "xwindows". No semantic information is known about the "project"
|
||||
field but it's value will be maintained.
|
||||
-------------------------
|
||||
|
||||
|
||||
2) File Entries
|
||||
After the Release Definition Section, come the entries for
|
||||
the deliverable files comprising the release. The build-tree-top
|
||||
relative path name of a source file is followed by one or more
|
||||
destination specifications which describe where in the product
|
||||
this file should go, as well as the ownerships/permissions etc. that
|
||||
should be associated with it. Any missing keyword/value pairs will
|
||||
be filled in by the defaults provided in the Release Definition
|
||||
Section.
|
||||
Information may differ between release
|
||||
streams. If there is no destination spec for a given release and
|
||||
there is no "default" destination spec then that souce file will
|
||||
not be delivered for that release. The "default" destination spec
|
||||
(if it exists) should come last and is applied for release streams
|
||||
that do not have more specific destination specs.
|
||||
|
||||
-------------------
|
||||
For example The following file entry:
|
||||
|
||||
cose/unity1/types/coe.vf
|
||||
{ hp-ux
|
||||
install_target = /usr/coe/newconfig/coe.vf
|
||||
}
|
||||
{ aix
|
||||
install_target = /usr/coe/types/coe.vf
|
||||
}
|
||||
{ default
|
||||
install_target = /var/coe/types/coe.vf
|
||||
owner = sys
|
||||
group = admin
|
||||
}
|
||||
|
||||
states that on hp-ux the file found at
|
||||
$(TOP)/cose/unity1/types/coe.vf in the build tree, is to be delivered
|
||||
to "/usr/coe/newconfig/coe.vf" on hp-ux; "/usr/coe/types/coe.vf" on
|
||||
aix; and "/var/coe/types/coe.vf" on all other release platforms. In
|
||||
addition, on all platforms other than hp-ux and aix the default
|
||||
owner and group (usually bin,bin) are replaced by sys,admin for this
|
||||
file.
|
||||
------------------
|
||||
|
||||
Pseudo-BNF:
|
||||
Here follows a pseudo-BNF description of the syntax of a
|
||||
udb file:
|
||||
---------------------------------------------------------------------
|
||||
|
||||
udbFile = release_definition_section file_records
|
||||
|
||||
release_definition_section = release_def release_definition_section |
|
||||
release_def
|
||||
|
||||
release_def = "{" release_id ":" "defaults" record_defs "}"
|
||||
|
||||
release_id = "hp-ux" | "aix" | "sun" | "usl" | "uxp" | "default"
|
||||
|
||||
record_defs = keyword_def "=" special_token |
|
||||
keyword_def "=" keyword_value
|
||||
|
||||
special_token = "<SRC>" | "<DEST>" | "<LNK>" |
|
||||
"<TYPE>" | "<MODE>" | "<OWNER>" | "<GROUP>"
|
||||
|
||||
keyword_def = identifier
|
||||
keyword_value = identifier
|
||||
|
||||
file_records = file_rec file_records |
|
||||
file_rec
|
||||
|
||||
file_rec = src_spec dest_specs
|
||||
|
||||
src_spec = a_out_loc | link_path
|
||||
|
||||
a_out_loc = < the build tree-top relative path to the source file >
|
||||
|
||||
link_path = < the full path to the link source in the product >
|
||||
|
||||
dest_specs = dest_spec dest_specs |
|
||||
dest_spec
|
||||
|
||||
dest_spec = "{" release_id value_specs "}"
|
||||
|
||||
|
||||
value_spec = keyword "=" value
|
||||
|
||||
keyword = identifier
|
||||
value = identifier
|
||||
|
||||
identifier = < any sequence of non-whitespace characters which
|
||||
does not contain an unescaped instance of one of
|
||||
the syntax_chars >
|
||||
|
||||
syntax_chars = "{", ":", ";", "=", "}"
|
||||
|
||||
|
||||
82
cde/admin/IntegTools/dbTools/UDB.tools
Normal file
82
cde/admin/IntegTools/dbTools/UDB.tools
Normal file
@@ -0,0 +1,82 @@
|
||||
|
||||
UDB TOOLS
|
||||
---------
|
||||
|
||||
The udb tools are located in the shared source tree in:
|
||||
/x/cdesrc/admin/IntegTools/dbTools
|
||||
|
||||
The basic tools for manipulating "udb" databases are:
|
||||
|
||||
udbParseLib.awk -- the awk parser for "udb" files.
|
||||
This awk file contains functions which read the udb
|
||||
databases into memory and set up awk-style
|
||||
associative arrays of keyword value pairs
|
||||
for all the file entries. This "library"
|
||||
also contains the default set of print
|
||||
routines that allow the database information
|
||||
to be printed in a number of different
|
||||
formats.
|
||||
Custom print routines can easily
|
||||
be written by following the conventions used
|
||||
in the default print routines.
|
||||
This parser is used by "udbToAny.ksh" and other
|
||||
scripts which manipulate the ".udb" databases.
|
||||
|
||||
udbToAny.ksh -- A ksh front end which allows the contents of the
|
||||
"udb" file to be transformed into a number of different
|
||||
formats. It also accepts the name of "custom" awk print
|
||||
routine which can do new and mysterious things. The
|
||||
most useful output at present is the "-toLst" option which
|
||||
produces output suitable for the "mkProd" script.
|
||||
NOTE: This script accepts more than one "udb" file
|
||||
as input but only the Release Definitions from the first
|
||||
udb file will be applied.
|
||||
|
||||
mkProd -- a ksh script which will create a product tree from the
|
||||
files in a build tree based on the contents of its input.
|
||||
This script takes a one-line format (.lst format) as input.
|
||||
This one-line format can be generated from a "udb" file by
|
||||
using the "-toLst" option in "udbToAny.ksh".
|
||||
This script calls two other ksh scripts "uncomment"
|
||||
and "linksLast". They do very simple tasks and should
|
||||
probably be rewritten as simple ksh functions in mkProd.
|
||||
NOTE: There is shell code to do automatic stripping of
|
||||
executables and compression of man pages etc. but
|
||||
most of that is turned off.
|
||||
|
||||
|
||||
There are other more complicated tools that act on "udb" databases,
|
||||
but they are hp-ux specific.
|
||||
|
||||
Example 1
|
||||
---------
|
||||
Suppose /x/cde_hpux is a build tree containing a successful hpux build.
|
||||
Suppose COE-RUN.udb and COE-RUN-ADMIN.udb are databases defining the
|
||||
COE-RUN product.
|
||||
To create a product tree at: "/prod/hpux/COE-RUN"
|
||||
run the following two commands (as root):
|
||||
|
||||
1) udbToAny.ksh -ReleaseStream hp-ux -toLst COE-RUN.udb COE-RUN-ADMIN.udb > COE-RUN.lst
|
||||
2) mkProd -D /prod/hpux/COE-RUN -S /x/cde_hpux COE-RUN.lst
|
||||
|
||||
NOTE: mkProd -f COE-RUN -D /prod/hpux -S /x/cde_hpux COE-RUN.lst
|
||||
would produce essentially the same results as 2) above.
|
||||
|
||||
Example 2
|
||||
---------
|
||||
Suppose we wanted to install the above bits on a test system. Then
|
||||
as root:
|
||||
|
||||
1) udbToAny.ksh -ReleaseStream hp-ux -toLst COE-RUN.udb COE-RUN-ADMIN.udb
|
||||
| mkProd -D / -S /x/cde_hpux
|
||||
|
||||
will install the bits on your root file system.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
311
cde/admin/IntegTools/dbTools/dinstallCDE.src
Executable file
311
cde/admin/IntegTools/dbTools/dinstallCDE.src
Executable file
@@ -0,0 +1,311 @@
|
||||
XCOMM! /bin/ksh
|
||||
XCOMM $XConsortium: dinstallCDE.src /main/8 1996/11/25 14:20:36 drk $
|
||||
|
||||
XCOMM
|
||||
XCOMM This script uses the 'CDE' configuration scripts to de-install the Desktop
|
||||
XCOMM environment.
|
||||
XCOMM
|
||||
XCOMM this script accepts the following parameters:
|
||||
XCOMM
|
||||
XCOMM Optional parameters:
|
||||
XCOMM
|
||||
XCOMM -f <filesets> -- a quoted, space-separated list of
|
||||
XCOMM filesets to unload. The .udb
|
||||
XCOMM extension is not required.
|
||||
XCOMM
|
||||
XCOMM -clean -- remove the temporaray and configuration directories
|
||||
XCOMM -cleanVar-- remove the temporary directory but NOT the
|
||||
XCOMM configuration directory
|
||||
XCOMM -prog -- load only the development environment
|
||||
XCOMM -runtime -- load only the runtime environment
|
||||
XCOMM
|
||||
XCOMM ##########################################################################
|
||||
|
||||
#define HASH #
|
||||
#define STAR *
|
||||
|
||||
REVISION="$(echo "$Revision: /main/8 $" | awk '{print $2}')"
|
||||
|
||||
Log()
|
||||
{
|
||||
echo "$1" | tee -a /tmp/dinstallCDE.log
|
||||
}
|
||||
|
||||
DoFilesetScript()
|
||||
{
|
||||
typeset ScriptName
|
||||
|
||||
FilesetName=$1
|
||||
ScriptName=$2 # use long config file name (configFoo)
|
||||
|
||||
test_string=${DATABASE_FILES#*$FilesetName}
|
||||
if (( ${#DATABASE_FILES} > ${#test_string} ))
|
||||
then
|
||||
if [ -x $POST_INSTALL_DIR/$PLATFORM_SCRIPT_DIR/$ScriptName ]
|
||||
then
|
||||
Log "Executing $PLATFORM specific $FilesetName de-customize script"
|
||||
$POST_INSTALL_DIR/$PLATFORM_SCRIPT_DIR/$ScriptName -d 2>&1 | \
|
||||
tee -a /tmp/$ScriptName.dverify
|
||||
elif [ -x $POST_INSTALL_DIR/$ScriptName ]
|
||||
then
|
||||
Log "Executing $FilesetName de-customize script"
|
||||
$POST_INSTALL_DIR/$ScriptName -d 2>&1 | tee -a /tmp/$ScriptName.dverify
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
DoLangScript()
|
||||
{
|
||||
typeset ScriptName
|
||||
|
||||
if [ "$BUILD_TREE" = "" ]; then
|
||||
ScriptName=$2 # use short config file name (foo.cfg)
|
||||
else
|
||||
ScriptName=$1 # use long config file name (configFoo)
|
||||
fi
|
||||
|
||||
if [ $CDECONFIGDIR = "CONFIG" ]; then
|
||||
typeset -u ScriptName
|
||||
fi
|
||||
|
||||
if [ -x $POST_INSTALL_DIR/$PLATFORM_SCRIPT_DIR/$ScriptName ]
|
||||
then
|
||||
Log "Executing $PLATFORM specific $FilesetName de-customize script"
|
||||
$POST_INSTALL_DIR/$PLATFORM_SCRIPT_DIR/$ScriptName -d $3 2>&1 | \
|
||||
tee -a /tmp/$ScriptName.dverify
|
||||
elif [ -x $POST_INSTALL_DIR/$ScriptName ]
|
||||
then
|
||||
Log "Executing $FilesetName de-customize script"
|
||||
$POST_INSTALL_DIR/$ScriptName -d $3 2>&1 | tee -a /tmp/$ScriptName.dverify
|
||||
fi
|
||||
}
|
||||
|
||||
DoScripts()
|
||||
{
|
||||
Log " "
|
||||
|
||||
DoFilesetScript CDE-TT configTT tt.cfg
|
||||
DoFilesetScript CDE-MIN configMin min.cfg
|
||||
DoFilesetScript CDE-RUN configRun run.cfg
|
||||
DoFilesetScript CDE-HELP-C configHelp help.cfg
|
||||
DoFilesetScript CDE-HELP-PRG configHelpPrg helpprg.cfg
|
||||
DoFilesetScript CDE-HELP-RUN configHelpRun helprun.cfg
|
||||
DoFilesetScript CDE-SHLIBS configShlibs shlibs.cfg
|
||||
DoFilesetScript CDE-DEMOS configDemos demos.cfg
|
||||
DoFilesetScript CDE-FONTS configFonts fonts.cfg
|
||||
DoFilesetScript CDE-ICONS configIcons icons.cfg
|
||||
DoFilesetScript CDE-INC configInc inc.cfg
|
||||
DoFilesetScript CDE-MAN configMan man.cfg
|
||||
DoFilesetScript CDE-MAN-DEV configManDev mandev.cfg
|
||||
DoFilesetScript CDE-MSG-C configMsgCat msgcat.cfg
|
||||
DoFilesetScript CDE-PRG configPrg prg.cfg
|
||||
|
||||
HASH see if a lang has been specified and configure backdrops and
|
||||
HASH palettes if it has.
|
||||
|
||||
if [ "$LangOption" != "" ]
|
||||
then
|
||||
DoLangScript configLang lang.cfg $theLang
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
USAGE()
|
||||
{
|
||||
echo "Usage: $(basename $0) [options]"
|
||||
echo ""
|
||||
echo "\tOptions:"
|
||||
echo ""
|
||||
echo "\t[-a <udb directory>]\t\talternate place to get the"
|
||||
echo "\t\t\t\t\tudb files from."
|
||||
echo "\t[-f <filesets>]\t\t\tspecify filesets to be unloaded."
|
||||
echo "\t\t\t\t\tThe list should be double-quoted,"
|
||||
echo "\t\t\t\t\tspace-separated, with no .udb"
|
||||
echo "\t\t\t\t\textensions."
|
||||
echo ""
|
||||
echo "\t[-clean]\t\t\tremove the temporary and configuration"
|
||||
echo "\t\t\t\t\tdirectories"
|
||||
echo "\t[-cleanVar]\t\t\tremove the temporary but NOT the "
|
||||
echo "\t\t\t\t\tconfiguration directory"
|
||||
echo "\t[-prog]\t\t\t\tload only the development environment"
|
||||
echo "\t[-runtime]\t\t\tload only the runtime environment"
|
||||
echo "\t[-relative]\t\t\trun the relative-located config scripts"
|
||||
echo "\t[-lang LANG]\t\t\tspecify LANG to use for backdrops and"
|
||||
echo "\t\t\t\t\tpalettes"
|
||||
echo ""
|
||||
}
|
||||
|
||||
ORIGINAL_COMMAND_LINE="$*"
|
||||
|
||||
XCOMM Set which system we are on
|
||||
BUILDSYSTEM=$(uname)
|
||||
|
||||
PLATFORM=""
|
||||
PLATFORM_SCRIPT_DIR=""
|
||||
|
||||
XCOMM
|
||||
XCOMM Set system
|
||||
XCOMM
|
||||
if [ $BUILDSYSTEM = "AIX" ];
|
||||
then
|
||||
PLATFORM=aix
|
||||
PLATFORM_SCRIPT_DIR=ibm
|
||||
elif [ $BUILDSYSTEM = "SunOS" ];
|
||||
then
|
||||
PLATFORM=sun
|
||||
PLATFORM_SCRIPT_DIR=sun
|
||||
elif [ $BUILDSYSTEM = "UNIX_SV" ];
|
||||
then
|
||||
PLATFORM=usl
|
||||
PLATFORM_SCRIPT_DIR=usl
|
||||
elif [ $BUILDSYSTEM = "UNIX_System_V" ];
|
||||
then
|
||||
PLATFORM=uxp
|
||||
PLATFORM_SCRIPT_DIR=uxp
|
||||
elif [ $BUILDSYSTEM = "OSF1" ];
|
||||
then
|
||||
PLATFORM=dec
|
||||
PLATFORM_SCRIPT_DIR=dec
|
||||
else # Build system = HP
|
||||
PLATFORM=hp-ux
|
||||
PLATFORM_SCRIPT_DIR=hp
|
||||
fi
|
||||
|
||||
if [ "$PLATFORM" = "aix" ];
|
||||
then
|
||||
USER=`/bin/whoami`
|
||||
elif [ "$PLATFORM" = "sun" -o "$PLATFORM" = "usl" -o "$PLATFORM" = "uxp" ];
|
||||
then
|
||||
USER=`/usr/ucb/whoami`
|
||||
else
|
||||
USER=`/usr/bin/whoami`
|
||||
fi
|
||||
|
||||
if [ "$USER" != "root" ];
|
||||
then
|
||||
USAGE
|
||||
echo ""
|
||||
echo "You must be root to run this script"
|
||||
echo ""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PATH=/bin:/usr/bin:/etc:/usr/bin/X11:
|
||||
export PATH
|
||||
|
||||
CLEANING="no"
|
||||
CLEANING_ETC="no"
|
||||
USE_ALTERNATE_UDB_DIR="no"
|
||||
USE_RELATIVE="no"
|
||||
STARTING_DIR=$PWD
|
||||
DATABASE_FILES=""
|
||||
LeaveLinks="no"
|
||||
REMOVE_LINKS="no"
|
||||
CLEAN_DAEMONS="yes"
|
||||
theLang=""
|
||||
DEVELOP_ENV="yes"
|
||||
RUNTIME_ENV="yes"
|
||||
|
||||
rm -f /tmp/dinstallCDE.log
|
||||
|
||||
Log "Options specified..."
|
||||
while [ $# -ne 0 ]; do
|
||||
case $1 in
|
||||
-a) Log " - alternate place to get the udb files from"
|
||||
shift;
|
||||
[ $# -ne 0 ] || {
|
||||
USAGE
|
||||
exit 1;
|
||||
}
|
||||
ALTERNATE_UDB_DIR=$1
|
||||
USE_ALTERNATE_UDB_DIR="yes"
|
||||
shift;
|
||||
;;
|
||||
-f) Log " - load specific filesets"
|
||||
shift;
|
||||
[ $# -ne 0 ] || {
|
||||
USAGE
|
||||
exit 1;
|
||||
}
|
||||
DATABASE_FILES=$1
|
||||
shift;
|
||||
;;
|
||||
-clean) Log " - delete all three cde directories"
|
||||
CLEANING="yes"
|
||||
CLEANING_ETC="yes"
|
||||
shift;
|
||||
;;
|
||||
-cleanVar) Log " - delete only temporary and installation directories"
|
||||
CLEANING="yes"
|
||||
shift;
|
||||
;;
|
||||
-relative) Log " - run the relative-located config scripts"
|
||||
USE_RELATIVE="yes"
|
||||
shift;
|
||||
;;
|
||||
-prog) Log " - remove only the development environment"
|
||||
RUNTIME_ENV="no"
|
||||
shift;
|
||||
;;
|
||||
-runtime) Log " - remove only the runtime environment"
|
||||
DEVELOP_ENV="no"
|
||||
shift;
|
||||
;;
|
||||
-lang) Log " - configure backdrops and palettes for LANG"
|
||||
shift;
|
||||
[ $# -ne 0 ] || {
|
||||
USAGE
|
||||
exit 1;
|
||||
}
|
||||
theLang=$1
|
||||
shift;
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
echo ""
|
||||
|
||||
TOOL_DIR=$BUILD_TREE/admin/IntegTools/dbTools
|
||||
if [ "$USE_RELATIVE" = "yes" ]
|
||||
then
|
||||
POST_INSTALL_DIR=../post_install
|
||||
else
|
||||
POST_INSTALL_DIR=$BUILD_TREE/admin/IntegTools/post_install
|
||||
fi
|
||||
|
||||
if [ "$USE_ALTERNATE_UDB_DIR" = "yes" ]
|
||||
then
|
||||
DATABASE_DIR=$ALTERNATE_UDB_DIR/databases
|
||||
else
|
||||
DATABASE_DIR=$BUILD_TREE/databases
|
||||
fi
|
||||
|
||||
if [ "$DATABASE_FILES" = "" ]
|
||||
then
|
||||
if [ "$DEVELOP_ENV" = "yes" -a "$RUNTIME_ENV" = "yes" ]
|
||||
then
|
||||
DATABASE_FILES="CDE-RUN CDE-MIN CDE-TT CDE-MAN CDE-HELP-RUN CDE-C \
|
||||
CDE-MSG-C CDE-HELP-C CDE-SHLIBS CDE-HELP-PRG \
|
||||
CDE-PRG CDE-INC CDE-DEMOS CDE-MAN-DEV CDE-ICONS \
|
||||
CDE-FONTS"
|
||||
elif [ "$DEVELOP_ENV" = "yes" ]
|
||||
then
|
||||
DATABASE_FILES="CDE-HELP-PRG CDE-PRG CDE-INC CDE-DEMOS \
|
||||
CDE-MAN-DEV CDE-SHLIBS"
|
||||
elif [ "$RUNTIME_ENV" = "yes" ]
|
||||
then
|
||||
DATABASE_FILES="CDE-RUN CDE-MIN CDE-TT CDE-MAN CDE-HELP-RUN CDE-C \
|
||||
CDE-HELP-C CDE-MSG-C CDE-SHLIBS CDE-ICONS CDE-FONTS"
|
||||
fi
|
||||
fi
|
||||
|
||||
INSTALL_LOCATION=CDE_INSTALLATION_TOP
|
||||
CONFIGURE_LOCATION=CDE_CONFIGURATION_TOP
|
||||
LOGFILES_LOCATION=CDE_LOGFILES_TOP
|
||||
|
||||
DoScripts
|
||||
|
||||
echo "Done."
|
||||
echo ""
|
||||
echo "See /tmp/dinstallCDE.log for a log of this de-install session."
|
||||
echo ""
|
||||
964
cde/admin/IntegTools/dbTools/installCDE.src
Executable file
964
cde/admin/IntegTools/dbTools/installCDE.src
Executable file
@@ -0,0 +1,964 @@
|
||||
XCOMM! /bin/ksh
|
||||
XCOMM $XConsortium: installCDE.src /main/20 1996/11/25 14:21:13 drk $
|
||||
|
||||
XCOMM
|
||||
XCOMM This script uses the 'CDE' databases to install either the Desktop
|
||||
XCOMM environment on a specified machine or creates a tar ball to be used
|
||||
XCOMM in an install process.
|
||||
XCOMM
|
||||
XCOMM this script accepts the following parameters:
|
||||
XCOMM -s <source> -- The top of build tree where the files are
|
||||
XCOMM gathered from.
|
||||
XCOMM -z <package> -- The desktop install package
|
||||
XCOMM
|
||||
XCOMM Optional parameters:
|
||||
XCOMM
|
||||
XCOMM -t <package destination> -- where to store install package
|
||||
XCOMM -pI <actual install location> -- where CDE_INSTALLATION_TOP will be linked to.
|
||||
XCOMM -pC <actual config location> -- where CDE_CONFIGURATION_TOP will be linked to.
|
||||
XCOMM -pV <actual var location> -- where CDE_LOGFILES_TOP will be linked to.
|
||||
XCOMM -a <alternate udb directory>
|
||||
XCOMM -f <filesets> -- a quoted, space-separated list of
|
||||
XCOMM filesets to load. The .udb extension
|
||||
XCOMM is not required.
|
||||
XCOMM
|
||||
XCOMM -clean -- remove the temporary, configuration and installation
|
||||
XCOMM directories
|
||||
XCOMM -cleanTwo-- remove the temporary and installation directories
|
||||
XCOMM but NOT the configuration directory
|
||||
XCOMM -cleanEtc-- remove the configuration directories
|
||||
XCOMM -prog -- load only the development environment
|
||||
XCOMM -runtime -- load only the runtime environment
|
||||
XCOMM -pack -- create packing list
|
||||
XCOMM -pseudo -- don't configure the desktop
|
||||
XCOMM -nocompress -- don't compress the tarball (-t only)
|
||||
XCOMM
|
||||
XCOMM -Lang -- load the localized filesets
|
||||
XCOMM -LinkStepOnly -- set up the -pI, -pC, and -pV links
|
||||
XCOMM then exit
|
||||
XCOMM -DontRunScripts -- stop after installation
|
||||
XCOMM -RunScriptsOnly -- only execute the scripts
|
||||
XCOMM -configureOnly -- only configure the desktop
|
||||
XCOMM
|
||||
XCOMM ##########################################################################
|
||||
|
||||
#define HASH #
|
||||
#define STAR *
|
||||
|
||||
|
||||
REVISION="$(echo "$Revision: /main/20 $" | awk '{print $2}')"
|
||||
|
||||
Log()
|
||||
{
|
||||
echo "$1" | tee -a /tmp/installCDE.log
|
||||
}
|
||||
|
||||
MakeTarball()
|
||||
{
|
||||
Log "\nGenerating UNIX Desktop install package $DATE in $TARBALL_LOCATION"
|
||||
HASH
|
||||
HASH create installable tarball
|
||||
HASH
|
||||
Log "Creating tarball..."
|
||||
|
||||
if [ $PLATFORM = "usl" -o "$PLATFORM" = "uxp" ]
|
||||
then
|
||||
ulimit -f unlimited
|
||||
fi
|
||||
|
||||
DIRNAME=build.$DATE
|
||||
mkdir -p $TARBALL_LOCATION/$DIRNAME
|
||||
cd /
|
||||
echo $DATE >$LOGFILES_LOCATION/.build.$DATE
|
||||
chown bin $LOGFILES_LOCATION/.build.$DATE
|
||||
|
||||
if [ "$COMPRESS_TARBALL" = "yes" ]; then
|
||||
tar -cf - $INSTALL_LOCATION/STAR \
|
||||
2>$TARBALL_LOCATION/$DIRNAME/extract.err |
|
||||
compress -c >$TARBALL_LOCATION/$DIRNAME/dttar.Z
|
||||
else
|
||||
tar -cf $TARBALL_LOCATION/$DIRNAME/dt.tar \
|
||||
$INSTALL_LOCATION/STAR \
|
||||
2>$TARBALL_LOCATION/$DIRNAME/extract.err 2>&1
|
||||
fi
|
||||
|
||||
if [ "$ACTUAL_INSTALLATION_LOC" = "" ]; then
|
||||
actualInstallDir=$INSTALL_LOCATION
|
||||
else
|
||||
actualInstallDir=$ACTUAL_INSTALLATION_LOC
|
||||
fi
|
||||
let size=$(du -s $actualInstallDir | awk '{print $1}')*512
|
||||
|
||||
HASH load installation fileset *after* tarball generated
|
||||
LoadFileSet "" "CDE-INSTALL"
|
||||
|
||||
HASH create config dir
|
||||
destPost=$TARBALL_LOCATION/$DIRNAME/config
|
||||
mkdir $destPost
|
||||
|
||||
HASH copy config and platform config scripts
|
||||
src=$INSTALL_LOCATION/install/$PLATFORM_SCRIPT_DIR
|
||||
cp $src/config/STAR.cfg $destPost
|
||||
|
||||
HASH copy this script and install.dt platform overrides
|
||||
cp $src/install.dto $TARBALL_LOCATION/$DIRNAME/install.dto
|
||||
cp $src/install.cde $TARBALL_LOCATION/$DIRNAME/install.cde
|
||||
chmod 755 $TARBALL_LOCATION/$DIRNAME/install.cde
|
||||
|
||||
cd /
|
||||
|
||||
Log "done."
|
||||
|
||||
cat >$TARBALL_LOCATION/$DIRNAME/dt.pkg <<FIN
|
||||
PLATFORM: $PLATFORM
|
||||
VERSION: $REVISION
|
||||
TS: $DATE
|
||||
COMPRESSED: $COMPRESS_TARBALL
|
||||
SIZE: $size
|
||||
CL: $ORIGINAL_COMMAND_LINE
|
||||
FILESETS: $DATABASE_FILES
|
||||
FIN
|
||||
|
||||
cat >$TARBALL_LOCATION/$DIRNAME/build.status <<FIN
|
||||
The UNIX Desktop
|
||||
|
||||
BUILD: $DATE
|
||||
OVERALL STATUS: <not yet tested>
|
||||
OVERALL PERFORMANCE: <not yet tested>
|
||||
MAJOR PROBLEMS: <not yet tested>
|
||||
|
||||
FIN
|
||||
|
||||
chmod g+w $TARBALL_LOCATION/$DIRNAME/build.status
|
||||
}
|
||||
|
||||
DoFilesetScript()
|
||||
{
|
||||
typeset ScriptName
|
||||
|
||||
FilesetName=$1
|
||||
if [ "$BUILD_TREE" = "" ]; then
|
||||
ScriptName=$3 # use short config file name (foo.cfg)
|
||||
else
|
||||
ScriptName=$2 # use long config file name (configFoo)
|
||||
fi
|
||||
|
||||
if [ $CDECONFIGDIR = "CONFIG" ]; then
|
||||
typeset -u ScriptName
|
||||
fi
|
||||
|
||||
test_string=${DATABASE_FILES#*$FilesetName}
|
||||
if (( ${#DATABASE_FILES} > ${#test_string} ))
|
||||
then
|
||||
if [ -x $POST_INSTALL_DIR/$PLATFORM_SCRIPT_DIR/$ScriptName ]
|
||||
then
|
||||
Log "Executing $PLATFORM specific $FilesetName customize script"
|
||||
$POST_INSTALL_DIR/$PLATFORM_SCRIPT_DIR/$ScriptName -e 2>&1 | \
|
||||
tee -a /tmp/installCDE.log
|
||||
elif [ -x $POST_INSTALL_DIR/$ScriptName ]
|
||||
then
|
||||
Log "Executing $FilesetName customize script"
|
||||
$POST_INSTALL_DIR/$ScriptName -e 2>&1 | tee -a /tmp/installCDE.log
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
DoScripts()
|
||||
{
|
||||
Log " "
|
||||
|
||||
DoFilesetScript CDE-TT configTT tt.cfg
|
||||
DoFilesetScript CDE-MIN configMin min.cfg
|
||||
DoFilesetScript CDE-SHLIBS configShlibs shlibs.cfg
|
||||
DoFilesetScript CDE-RUN configRun run.cfg
|
||||
}
|
||||
|
||||
CreatePackingList()
|
||||
{
|
||||
Log " "
|
||||
Log "Creating packing list."
|
||||
touch $INSTALL_LOCATION/Packing_list
|
||||
for i in `echo $DATABASE_FILES`
|
||||
do
|
||||
Log " for $i"
|
||||
$TOOL_DIR/udbToAny.ksh -toDB -ReleaseStream $PLATFORM $DATABASE_DIR/${i}.udb > /tmp/${i}.db
|
||||
if [ -r /tmp/${i}.db ]
|
||||
then
|
||||
for file in `fgrep install_target /tmp/${i}.db | cut -sf 2 -d \: `
|
||||
do
|
||||
echo "$file" >>$INSTALL_LOCATION/Packing_list
|
||||
done
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
CleanDaemons()
|
||||
{
|
||||
HASH kill these processes so that they can be removed and new ones
|
||||
HASH installed
|
||||
|
||||
for i in inetd rpc.ttdbserver rpc.cmsd
|
||||
do
|
||||
if [ "$PLATFORM" = "aix" -a $i = "inetd" ]
|
||||
then
|
||||
lssrc -s inetd >/dev/null 2>&1
|
||||
if [ $? = "0" ]
|
||||
then
|
||||
stopsrc -s inetd >>/tmp/installCDE.log 2>&1
|
||||
fi
|
||||
else
|
||||
ps -ef | grep $i | grep -v grep >/tmp/tmppsout
|
||||
if [ -s /tmp/tmppsout ]
|
||||
then
|
||||
awk '{print "kill " $2}' /tmp/tmppsout | /bin/csh -f
|
||||
sleep 2
|
||||
fi
|
||||
fi
|
||||
done
|
||||
rm -f /tmp/tmppsout
|
||||
}
|
||||
|
||||
RestartInetd()
|
||||
{
|
||||
HASH now restart inetd
|
||||
|
||||
OLDPWD=`pwd`
|
||||
cd /
|
||||
if [ "$PLATFORM" = "sun" -o "$PLATFORM" = "usl" -o "$PLATFORM" = "uxp" ]
|
||||
then
|
||||
/usr/sbin/inetd -s
|
||||
elif [ "$PLATFORM" = "aix" ]
|
||||
then
|
||||
startsrc -s inetd >>/tmp/installCDE.log 2>&1
|
||||
elif [ "$PLATFORM" = "dec" ]
|
||||
then
|
||||
/usr/sbin/inetd
|
||||
else
|
||||
#ifdef hpV4
|
||||
/usr/sbin/inetd
|
||||
#else
|
||||
/etc/inetd
|
||||
#endif
|
||||
fi
|
||||
cd $OLDPWD
|
||||
}
|
||||
|
||||
CheckForActualLocations()
|
||||
{
|
||||
XCOMM
|
||||
XCOMM if different actual locations specified, set up the links
|
||||
XCOMM
|
||||
|
||||
|
||||
if [ "$CLEAN_DAEMONS" = "yes" ]
|
||||
then
|
||||
CleanDaemons
|
||||
fi
|
||||
|
||||
HASH remove the contents of the installation directory then the directory
|
||||
HASH itself
|
||||
|
||||
if [ "$CLEANING" = "yes" ]
|
||||
then
|
||||
Log "Removing $INSTALL_LOCATION contents... "
|
||||
if [ -d $INSTALL_LOCATION ]
|
||||
then
|
||||
rm -rf $INSTALL_LOCATION/STAR
|
||||
if [ "$LeaveLinks" = "yes" ]
|
||||
then
|
||||
if [ ! -L $INSTALL_LOCATION ]
|
||||
then
|
||||
rm -rf $INSTALL_LOCATION
|
||||
fi
|
||||
else
|
||||
if [ -L $INSTALL_LOCATION ]
|
||||
then
|
||||
rm -f $INSTALL_LOCATION
|
||||
else
|
||||
rm -rf $INSTALL_LOCATION
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$CONFIGURE_ONLY" = "no" ]
|
||||
then
|
||||
if [ "$ACTUAL_INSTALLATION_LOC" != "" ]
|
||||
then
|
||||
|
||||
HASH
|
||||
HASH first create the actual directory - if not there
|
||||
HASH
|
||||
|
||||
if [ ! -d $ACTUAL_INSTALLATION_LOC ]
|
||||
then
|
||||
mkdir -p $ACTUAL_INSTALLATION_LOC
|
||||
if [ ! -d $ACTUAL_INSTALLATION_LOC ]
|
||||
then
|
||||
Log "cannot create $ACTUAL_INSTALLATION_LOC directory"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
ln -s $ACTUAL_INSTALLATION_LOC $INSTALL_LOCATION
|
||||
|
||||
else
|
||||
if [ ! -d $INSTALL_LOCATION -a ! -L $INSTALL_LOCATION ];
|
||||
then
|
||||
mkdir -p $INSTALL_LOCATION
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$CLEAN_DAEMONS" = "yes" ]
|
||||
then
|
||||
RestartInetd
|
||||
fi
|
||||
|
||||
HASH remove the contents of the configuration directory
|
||||
|
||||
if [ "$CLEANING_ETC" = "yes" ]
|
||||
then
|
||||
Log "Removing $CONFIGURE_LOCATION contents... "
|
||||
if [ -d $CONFIGURE_LOCATION ]
|
||||
then
|
||||
rm -rf $CONFIGURE_LOCATION/STAR
|
||||
if [ "$LeaveLinks" = "yes" ]
|
||||
then
|
||||
if [ ! -L $CONFIGURE_LOCATION ]
|
||||
then
|
||||
rm -rf $CONFIGURE_LOCATION
|
||||
fi
|
||||
else
|
||||
if [ -L $CONFIGURE_LOCATION ]
|
||||
then
|
||||
rm -f $CONFIGURE_LOCATION
|
||||
else
|
||||
rm -rf $CONFIGURE_LOCATION
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$ACTUAL_CONFIGURATION_LOC" != "" ]
|
||||
then
|
||||
if [ ! -d $ACTUAL_CONFIGURATION_LOC ]
|
||||
then
|
||||
mkdir -p $ACTUAL_CONFIGURATION_LOC
|
||||
if [ ! -d $ACTUAL_CONFIGURATION_LOC ]
|
||||
then
|
||||
Log "cannot create $ACTUAL_CONFIGURATION_LOC directory"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
ln -s $ACTUAL_CONFIGURATION_LOC $CONFIGURE_LOCATION
|
||||
|
||||
else
|
||||
if [ ! -d $CONFIGURE_LOCATION -a ! -L $CONFIGURE_LOCATION ];
|
||||
then
|
||||
mkdir -p $CONFIGURE_LOCATION
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$CLEANING" = "yes" ]
|
||||
then
|
||||
Log "Removing $LOGFILES_LOCATION contents... "
|
||||
if [ -d $LOGFILES_LOCATION ]
|
||||
then
|
||||
rm -rf $LOGFILES_LOCATION/STAR
|
||||
if [ "$LeaveLinks" = "yes" ]
|
||||
then
|
||||
if [ ! -L $LOGFILES_LOCATION ]
|
||||
then
|
||||
rm -rf $LOGFILES_LOCATION
|
||||
fi
|
||||
else
|
||||
if [ -L $LOGFILES_LOCATION ]
|
||||
then
|
||||
rm -f $LOGFILES_LOCATION
|
||||
else
|
||||
rm -rf $LOGFILES_LOCATION
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$ACTUAL_VAR_LOC" != "" ]
|
||||
then
|
||||
if [ ! -d $ACTUAL_VAR_LOC ]
|
||||
then
|
||||
mkdir -p $ACTUAL_VAR_LOC
|
||||
if [ ! -d $ACTUAL_VAR_LOC ]
|
||||
then
|
||||
Log "cannot create $ACTUAL_VAR_LOC directory"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
ln -s $ACTUAL_VAR_LOC $LOGFILES_LOCATION
|
||||
|
||||
else
|
||||
if [ ! -d $LOGFILES_LOCATION -a ! -L $LOGFILES_LOCATION ];
|
||||
then
|
||||
mkdir -p $LOGFILES_LOCATION
|
||||
fi
|
||||
fi
|
||||
|
||||
Log " "
|
||||
}
|
||||
|
||||
USAGE()
|
||||
{
|
||||
echo "Usage: $(basename $0) {-s <source>|-z <package>} [options]"
|
||||
echo ""
|
||||
echo "\t-s <source>\t\t\tthe top of the build tree"
|
||||
echo "\t-z <package>\t\tthe desktop install package"
|
||||
echo ""
|
||||
echo "\tOptions:"
|
||||
echo ""
|
||||
echo "\t[-t <package_destination>]\tif specified create an"
|
||||
echo "\t\t\t\t\tinstall package and store it in the"
|
||||
echo "\t\t\t\t\tdestination."
|
||||
echo "\t[-pI <actual install location>]\twhere" CDE_INSTALLATION_TOP "will be linked to."
|
||||
echo "\t[-pC <actual config location>]\twhere" CDE_CONFIGURATION_TOP "will be linked to."
|
||||
echo "\t[-pV <actual var location>]\twhere" CDE_LOGFILES_TOP "will be linked to."
|
||||
echo ""
|
||||
echo "\t[-a <udb directory>]\t\talternate place to get the"
|
||||
echo "\t\t\t\t\tudb files from."
|
||||
echo "\t[-f <filesets>]\t\t\tspecify filesets to be loaded."
|
||||
echo "\t\t\t\t\tThe list should be double-quoted,"
|
||||
echo "\t\t\t\t\tspace-separated, with no .udb"
|
||||
echo "\t\t\t\t\textensions."
|
||||
echo ""
|
||||
echo "\t[-clean]\t\t\tremove the temporary, configuration, and"
|
||||
echo "\t\t\t\t\tinstallation directory"
|
||||
echo "\t[-cleanTwo]\t\t\tremove the temporary and installation "
|
||||
echo "\t\t\t\t\tdirectory, but NOT the configuration directory"
|
||||
echo "\t[-cleanEtc]\t\t\tremove the configuration directory, but "
|
||||
echo "\t\t\t\t\NOT the temporary and installation directories"
|
||||
echo "\t[-prog]\t\t\t\tload only the development environment"
|
||||
echo "\t[-runtime]\t\t\tload only the runtime environment"
|
||||
echo "\t[-relative]\t\t\trun the relative-located config scripts"
|
||||
echo "\t[-pack]\t\t\t\tcreate a packing list"
|
||||
echo "\t[-pseudo]\t\t\tdo not configure desktop when installing"
|
||||
echo "\t[-nocompress]\t\t\tdo not compress tarball when creating package"
|
||||
echo "\t[-lang LANG]\t\t\tspecify LANG to load appropriate localized"
|
||||
echo "\t\t\t\t\tfilesets"
|
||||
echo "\t[-LeaveLinks]\t\t\t\tdo not delete the links after cleaning"
|
||||
echo ""
|
||||
echo "\t[-LinkStepOnly]\t\t\tset up the -pI, -pC, and -pV links"
|
||||
echo "\t\t\t\t\tthen exit"
|
||||
echo "\t[-DontRunScripts]\t\tstop after installation"
|
||||
echo "\t[-RunScriptsOnly]\t\tonly execute the scripts"
|
||||
echo "\t[-configureOnly]\t\tonly configure the desktop"
|
||||
echo ""
|
||||
echo "\tExamples:"
|
||||
echo ""
|
||||
echo "\tinstallCDE -s /x/cde_hp700_90"
|
||||
echo "\tinstallCDE -s /x/cde_aix_32 -f \"CDE_MIN CDE-SHLIBS\""
|
||||
echo "\tinstallCDE -s /x/cde_sun_52 -pI /bigdisk/opt/dt -clean"
|
||||
echo "\tinstallCDE -s /x/cde_sun_52 -pI /dtinstall -clean\\"
|
||||
echo "\t\t-pseudo -t /dtpackages -nocompress"
|
||||
}
|
||||
|
||||
XCOMM
|
||||
XCOMM LoadFileSet() - load a UDB file
|
||||
XCOMM $1 - fileset number
|
||||
XCOMM $2 - fileset name
|
||||
XCOMM
|
||||
LoadFileSet()
|
||||
{
|
||||
if [ "$1" = "" ]; then
|
||||
num=""
|
||||
else
|
||||
num="$1."
|
||||
fi
|
||||
|
||||
Log " $num installing database $2"
|
||||
Log " - creating ${2}.lst file"
|
||||
$TOOL_DIR/udbToAny.ksh -toLst -ReleaseStream $PLATFORM \
|
||||
$DATABASE_DIR/${2}.udb > /tmp/${2}.lst
|
||||
|
||||
Log " - installing ... \c"
|
||||
$TOOL_DIR/mkProd -D / -S $BUILD_TREE /tmp/${2}.lst \
|
||||
2>/tmp/${2}.err 1>/tmp/${2}.good
|
||||
Log "done."
|
||||
|
||||
Log " - checking for errors ..."
|
||||
rm -f /tmp/${2}.missing
|
||||
awk '{if ($1 == "ERROR:") print " " $4}' \
|
||||
/tmp/${2}.err >> /tmp/${2}.missing
|
||||
if [ -s /tmp/${2}.missing ]
|
||||
then
|
||||
Log " - missing files:"
|
||||
cat /tmp/${2}.missing | tee -a /tmp/installCDE.log
|
||||
fi
|
||||
}
|
||||
|
||||
ORIGINAL_COMMAND_LINE="$*"
|
||||
|
||||
XCOMM Set which system we are on
|
||||
BUILDSYSTEM=$(uname)
|
||||
|
||||
PLATFORM=""
|
||||
PLATFORM_SCRIPT_DIR=""
|
||||
|
||||
XCOMM
|
||||
XCOMM Set system
|
||||
XCOMM
|
||||
if [ $BUILDSYSTEM = "AIX" ];
|
||||
then
|
||||
PLATFORM=aix
|
||||
PLATFORM_SCRIPT_DIR=ibm
|
||||
elif [ $BUILDSYSTEM = "SunOS" ];
|
||||
then
|
||||
PLATFORM=sun
|
||||
PLATFORM_SCRIPT_DIR=sun
|
||||
elif [ $BUILDSYSTEM = "UNIX_SV" ];
|
||||
then
|
||||
PLATFORM=usl
|
||||
PLATFORM_SCRIPT_DIR=usl
|
||||
elif [ $BUILDSYSTEM = "UNIX_System_V" ];
|
||||
then
|
||||
PLATFORM=uxp
|
||||
PLATFORM_SCRIPT_DIR=uxp
|
||||
elif [ $BUILDSYSTEM = "OSF1" ];
|
||||
then
|
||||
PLATFORM=dec
|
||||
PLATFORM_SCRIPT_DIR=dec
|
||||
else # Build system = HP
|
||||
PLATFORM=hp-ux
|
||||
PLATFORM_SCRIPT_DIR=hp
|
||||
fi
|
||||
|
||||
if [ "$PLATFORM" = "aix" ];
|
||||
then
|
||||
USER=`/bin/whoami`
|
||||
elif [ "$PLATFORM" = "sun" -o "$PLATFORM" = "usl" -o "$PLATFORM" = "uxp" ];
|
||||
then
|
||||
USER=`/usr/ucb/whoami`
|
||||
else
|
||||
USER=`/usr/bin/whoami`
|
||||
fi
|
||||
|
||||
if [ "$USER" != "root" ];
|
||||
then
|
||||
USAGE
|
||||
echo ""
|
||||
echo "You must be root to run this script"
|
||||
echo ""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$PLATFORM" = "usl" -o "$PLATFORM" = "uxp" ]
|
||||
then
|
||||
umask 000
|
||||
fi
|
||||
|
||||
unset TMPDIR
|
||||
|
||||
PATH=/bin:/usr/bin:/etc:/usr/bin/X11:
|
||||
export PATH
|
||||
|
||||
CLEANING="no"
|
||||
CLEANING_ETC="no"
|
||||
TARBALL="no"
|
||||
COMPRESS_TARBALL="yes"
|
||||
USE_ALTERNATE_UDB_DIR="no"
|
||||
DEVELOP_ENV="no"
|
||||
RUNTIME_ENV="no"
|
||||
USE_RELATIVE="no"
|
||||
STARTING_DIR=$PWD
|
||||
ACTUAL_INSTALLATION_LOC=""
|
||||
ACTUAL_CONFIGURATION_LOC=""
|
||||
ACTUAL_VAR_LOC=""
|
||||
CREATE_PACKING_LIST="no"
|
||||
DO_LINK_STEP_ONLY="no"
|
||||
DO_INSTALL_ONLY="no"
|
||||
RUN_SCRIPTS="yes"
|
||||
RUN_SCRIPTS_ONLY="no"
|
||||
DATABASE_FILES=""
|
||||
BUILD_TREE=""
|
||||
TAR_DIR=""
|
||||
LeaveLinks="no"
|
||||
REMOVE_LINKS="no"
|
||||
CLEAN_DAEMONS="yes"
|
||||
theLang=""
|
||||
CONFIGURE_ONLY="no"
|
||||
|
||||
rm -f /tmp/installCDE.log
|
||||
|
||||
Log "Options specified..."
|
||||
while [ $# -ne 0 ]; do
|
||||
case $1 in
|
||||
-s) Log " - get the build tree to extract from"
|
||||
shift;
|
||||
[ $# -ne 0 ] || {
|
||||
USAGE
|
||||
exit 1;
|
||||
}
|
||||
BUILD_TREE=$1
|
||||
shift;
|
||||
;;
|
||||
-z) Log " - get the install package to extract from"
|
||||
shift;
|
||||
[ $# -ne 0 ] || {
|
||||
USAGE
|
||||
exit 1;
|
||||
}
|
||||
TAR_TREE=$1
|
||||
shift;
|
||||
;;
|
||||
-t) Log " - where to put the install package"
|
||||
shift;
|
||||
[ $# -ne 0 ] || {
|
||||
USAGE
|
||||
exit 1;
|
||||
}
|
||||
if [ "$SOURCE_TAR_FILE" = "" ]
|
||||
then
|
||||
TARBALL="yes"
|
||||
TARBALL_LOCATION=$1
|
||||
fi
|
||||
shift;
|
||||
;;
|
||||
-a) Log " - alternate place to get the udb files from"
|
||||
shift;
|
||||
[ $# -ne 0 ] || {
|
||||
USAGE
|
||||
exit 1;
|
||||
}
|
||||
ALTERNATE_UDB_DIR=$1
|
||||
USE_ALTERNATE_UDB_DIR="yes"
|
||||
shift;
|
||||
;;
|
||||
-f) Log " - load specific filesets"
|
||||
shift;
|
||||
[ $# -ne 0 ] || {
|
||||
USAGE
|
||||
exit 1;
|
||||
}
|
||||
DATABASE_FILES=$1
|
||||
shift;
|
||||
;;
|
||||
-p) Log " - get all locations"
|
||||
shift;
|
||||
[ $# -ne 0 ] || {
|
||||
USAGE
|
||||
exit 1;
|
||||
}
|
||||
ACTUAL_INSTALLATION_LOC=$1
|
||||
ACTUAL_CONFIGURATION_LOC=$1
|
||||
ACTUAL_VAR_LOC=$1
|
||||
shift;
|
||||
;;
|
||||
-pI) Log " - get actual installation location"
|
||||
shift;
|
||||
[ $# -ne 0 ] || {
|
||||
USAGE
|
||||
exit 1;
|
||||
}
|
||||
ACTUAL_INSTALLATION_LOC=$1
|
||||
shift;
|
||||
;;
|
||||
-pC) Log " - get actual configuration location"
|
||||
shift;
|
||||
[ $# -ne 0 ] || {
|
||||
USAGE
|
||||
exit 1;
|
||||
}
|
||||
ACTUAL_CONFIGURATION_LOC=$1
|
||||
shift;
|
||||
;;
|
||||
-pV) Log " - get actual var location"
|
||||
shift;
|
||||
[ $# -ne 0 ] || {
|
||||
USAGE
|
||||
exit 1;
|
||||
}
|
||||
ACTUAL_VAR_LOC=$1
|
||||
shift;
|
||||
;;
|
||||
-clean) Log " - delete all three cde directories"
|
||||
CLEANING="yes"
|
||||
CLEANING_ETC="yes"
|
||||
shift;
|
||||
;;
|
||||
-cleanTwo) Log " - delete only temporary and installation directories"
|
||||
CLEANING="yes"
|
||||
shift;
|
||||
;;
|
||||
-cleanEtc) Log " - delete only the configuration directory"
|
||||
CLEANING_ETC="yes"
|
||||
shift;
|
||||
;;
|
||||
-prog) Log " - load only the development environment"
|
||||
DEVELOP_ENV="yes"
|
||||
RUNTIME_ENV="no"
|
||||
shift;
|
||||
;;
|
||||
-runtime) Log " - load only the runtime environment"
|
||||
RUNTIME_ENV="yes"
|
||||
DEVELOP_ENV="no"
|
||||
shift;
|
||||
;;
|
||||
-relative) Log " - run the relative-located config scripts"
|
||||
USE_RELATIVE="yes"
|
||||
shift;
|
||||
;;
|
||||
-pack) Log " - create a packing list"
|
||||
CREATE_PACKING_LIST="yes"
|
||||
shift;
|
||||
;;
|
||||
-LeaveLinks) Log " - do not remove the links"
|
||||
LeaveLinks="yes"
|
||||
shift;
|
||||
;;
|
||||
-LinkStepOnly) Log " - do link step only"
|
||||
DO_LINK_STEP_ONLY="yes"
|
||||
shift;
|
||||
;;
|
||||
-DontRunScripts) Log " - stop after installation"
|
||||
DO_INSTALL_ONLY="yes"
|
||||
shift;
|
||||
;;
|
||||
-RunScriptsOnly) Log " - only run scripts"
|
||||
RUN_SCRIPTS_ONLY="yes"
|
||||
shift;
|
||||
;;
|
||||
-pseudo) Log " - pseudo install"
|
||||
RUN_SCRIPTS="no"
|
||||
REMOVE_LINKS="yes"
|
||||
CLEAN_DAEMONS="no"
|
||||
shift;
|
||||
;;
|
||||
-nocompress) Log " - do not compress tarball"
|
||||
COMPRESS_TARBALL="no"
|
||||
shift;
|
||||
;;
|
||||
-lang) Log " - load localized filesets"
|
||||
shift;
|
||||
[ $# -ne 0 ] || {
|
||||
USAGE
|
||||
exit 1;
|
||||
}
|
||||
theLang=$1
|
||||
shift;
|
||||
;;
|
||||
-configureOnly) Log " - Configure only"
|
||||
CONFIGURE_ONLY="yes"
|
||||
CLEAN_DAEMONS="yes"
|
||||
shift;
|
||||
;;
|
||||
*) Log " - unknown option"
|
||||
USAGE
|
||||
exit 1;
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
echo ""
|
||||
|
||||
if [ -z "$BUILD_TREE" -a -z "$TAR_TREE" ]
|
||||
then
|
||||
USAGE
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$BUILD_TREE" != "" -a ! -d "$BUILD_TREE" ]
|
||||
then
|
||||
Log "Build tree does not exist."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$TAR_TREE" != "" -a ! -d "$TAR_TREE" ]
|
||||
then
|
||||
Log "Tar tree does not exist."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CDEPACKAGE=dt.pkg
|
||||
CDETARFILE=dt.tar
|
||||
CDETARFILEZ=dttar.Z
|
||||
CDECONFIGDIR=config
|
||||
|
||||
XCOMM
|
||||
XCOMM get the current time stamp if going to create a tarball
|
||||
XCOMM
|
||||
|
||||
if [ $TARBALL = "yes" ];
|
||||
then
|
||||
set -- `/bin/date`
|
||||
DATE=$2_$3_$4_$6
|
||||
fi
|
||||
|
||||
if [ -z "$BUILD_TREE" -a ${0##STAR/} = INSTALL.CDE ]; then
|
||||
typeset -u CDEPACKAGE
|
||||
typeset -u CDETARFILE
|
||||
typeset -u CDETARFILEZ
|
||||
typeset -u CDECONFIGDIR
|
||||
fi
|
||||
|
||||
TOOL_DIR=$BUILD_TREE/admin/IntegTools/dbTools
|
||||
if [ "$USE_RELATIVE" = "yes" ]
|
||||
then
|
||||
POST_INSTALL_DIR=../post_install
|
||||
else
|
||||
if [ -z "$BUILD_TREE" ]
|
||||
then
|
||||
POST_INSTALL_DIR=$TAR_TREE/$CDECONFIGDIR
|
||||
else
|
||||
POST_INSTALL_DIR=$BUILD_TREE/admin/IntegTools/post_install
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$USE_ALTERNATE_UDB_DIR" = "yes" ]
|
||||
then
|
||||
DATABASE_DIR=$ALTERNATE_UDB_DIR/databases
|
||||
else
|
||||
DATABASE_DIR=$BUILD_TREE/databases
|
||||
fi
|
||||
|
||||
if [ "$DATABASE_FILES" = "" ]
|
||||
then
|
||||
if [ "$DEVELOP_ENV" = "yes" ]
|
||||
then
|
||||
DATABASE_FILES="CDE-HELP-PRG CDE-PRG CDE-INC CDE-DEMOS \
|
||||
CDE-MAN-DEV CDE-SHLIBS"
|
||||
elif [ "$RUNTIME_ENV" = "yes" ]
|
||||
then
|
||||
DATABASE_FILES="CDE-RUN CDE-MIN CDE-TT CDE-MAN CDE-HELP-RUN CDE-C \
|
||||
CDE-HELP-C CDE-MSG-C CDE-SHLIBS CDE-ICONS CDE-FONTS \
|
||||
CDE-INFO CDE-INFOLIB-C"
|
||||
else
|
||||
DATABASE_FILES="CDE-RUN CDE-MIN CDE-TT CDE-MAN CDE-HELP-RUN CDE-C \
|
||||
CDE-MSG-C CDE-HELP-C CDE-SHLIBS CDE-HELP-PRG \
|
||||
CDE-PRG CDE-INC CDE-DEMOS CDE-MAN-DEV CDE-ICONS \
|
||||
CDE-FONTS CDE-INFO CDE-INFOLIB-C"
|
||||
fi
|
||||
|
||||
HASH now load any localized filesets
|
||||
|
||||
if [ "$DEVELOP_ENV" != "yes" ]
|
||||
then
|
||||
if [ "$theLang" != "" ]
|
||||
then
|
||||
DATABASE_FILES="$DATABASE_FILES CDE-$theLang CDE-MSG-$theLang \
|
||||
CDE-HELP-$theLang"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
INSTALL_LOCATION=CDE_INSTALLATION_TOP
|
||||
CONFIGURE_LOCATION=CDE_CONFIGURATION_TOP
|
||||
LOGFILES_LOCATION=CDE_LOGFILES_TOP
|
||||
|
||||
if [ -L $INSTALL_LOCATION -a "$CONFIGURE_ONLY" != "yes" ]
|
||||
then
|
||||
touch $INSTALL_LOCATION/foo >/dev/null 2>/dev/null
|
||||
if [ ! -f $INSTALL_LOCATION/foo ]
|
||||
then
|
||||
Log "Insufficient permissions to install CDE files in $INSTALL_LOCATION"
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -O $INSTALL_LOCATION/foo ]
|
||||
then
|
||||
Log "Root access to $INSTALL_LOCATION is required for CDE installation."
|
||||
exit 1
|
||||
fi
|
||||
rm $INSTALL_LOCATION/foo
|
||||
fi
|
||||
|
||||
if [ -d $INSTALL_LOCATION ]
|
||||
then
|
||||
if [ -x $INSTALL_LOCATION/bin -a ! -d $INSTALL_LOCATION/bin ]
|
||||
then
|
||||
rm -f $INSTALL_LOCATION/bin
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$CONFIGURE_ONLY" = "yes" ]
|
||||
then
|
||||
CheckForActualLocations
|
||||
DoScripts
|
||||
Log "Configuration completed."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$RUN_SCRIPTS_ONLY" = "yes" ]
|
||||
then
|
||||
DoScripts
|
||||
exit 0
|
||||
fi
|
||||
|
||||
CheckForActualLocations
|
||||
|
||||
if [ "$DO_LINK_STEP_ONLY" = "yes" ]
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$CREATE_PACKING_LIST" = "yes" ]
|
||||
then
|
||||
CreatePackingList
|
||||
exit 0
|
||||
fi
|
||||
|
||||
XCOMM
|
||||
XCOMM we are ready to load the environment ...
|
||||
XCOMM
|
||||
|
||||
if [ "$BUILD_TREE" != "" ]
|
||||
then
|
||||
Log "Load the Desktop from $BUILD_TREE"
|
||||
|
||||
cd $STARTING_DIR
|
||||
let j=1
|
||||
for i in `echo $DATABASE_FILES`
|
||||
do
|
||||
LoadFileSet "$j" "$i"
|
||||
let j=j+1
|
||||
done
|
||||
else
|
||||
Log "Load the Desktop from $TAR_TREE"
|
||||
compressed=$(awk '/COMPRESSED: /{print $2}' $TAR_TREE/$CDEPACKAGE)
|
||||
if [ "$compressed" = "yes" ]; then
|
||||
uncompress <$TAR_TREE/$CDETARFILEZ | tar xvf - $INSTALL_LOCATION
|
||||
else
|
||||
tar -xvf $TAR_TREE/$CDETARFILE $INSTALL_LOCATION
|
||||
fi
|
||||
DATABASE_FILES=$(awk 'BEGIN {FS=":"} /FILESETS: /{print $2}' $TAR_TREE/$CDEPACKAGE)
|
||||
fi
|
||||
|
||||
Log " "
|
||||
Log "Desktop installed in $INSTALL_LOCATION"
|
||||
|
||||
if [ "$DO_INSTALL_ONLY" = "yes" ]
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ $TARBALL = "yes" ];
|
||||
then
|
||||
MakeTarball
|
||||
fi
|
||||
|
||||
cd $STARTING_DIR
|
||||
|
||||
if [ "$RUN_SCRIPTS" = "yes" ]
|
||||
then
|
||||
DoScripts
|
||||
fi
|
||||
|
||||
if [ "$REMOVE_LINKS" = "yes" ]
|
||||
then
|
||||
[ -L /usr/dt ] && rm /usr/dt
|
||||
[ -L /etc/dt ] && rm /etc/dt
|
||||
[ -L /var/dt ] && rm /var/dt
|
||||
fi
|
||||
|
||||
echo "Done."
|
||||
echo ""
|
||||
echo "See /tmp/installCDE.log for a log of this install session."
|
||||
echo ""
|
||||
23
cde/admin/IntegTools/dbTools/linksLast
Executable file
23
cde/admin/IntegTools/dbTools/linksLast
Executable file
@@ -0,0 +1,23 @@
|
||||
#! /bin/ksh
|
||||
|
||||
#
|
||||
# Script to move all link refereces in a ".lst" file
|
||||
# to the end of the file.
|
||||
#
|
||||
|
||||
USAGE="Usage: $0 file.lst"
|
||||
|
||||
case $# in
|
||||
0) echo $USAGE;;
|
||||
1);;
|
||||
*) echo $USAGE;;
|
||||
esac
|
||||
|
||||
awk '
|
||||
/hard_link|sym_link/ { links[i++] = $0 ; next; }
|
||||
{ print $0 }
|
||||
END {
|
||||
if ( i > 0 )
|
||||
for ( i in links) print links[i];
|
||||
}
|
||||
' $@
|
||||
650
cde/admin/IntegTools/dbTools/mkProd
Executable file
650
cde/admin/IntegTools/dbTools/mkProd
Executable file
@@ -0,0 +1,650 @@
|
||||
#! /bin/ksh
|
||||
|
||||
export SYSTYPE=bsd4.3
|
||||
|
||||
# This script is aimed at producing Apollo product tree but
|
||||
# it should work as well on hp-ux systems. There is at least
|
||||
# one special rule "-n" which should not be generated on hp-ux systems
|
||||
# where it is not necessary to run nroff on the man page sources.
|
||||
|
||||
|
||||
# Put "/etc" in the path
|
||||
# because this is where "chown" appears on bsd4.3 systems (i.e. apollo).
|
||||
# Put "/usr/apollo/bin" on the path to access "chacl" on apollo systems.
|
||||
|
||||
export PATH=":/etc:$PATH:/usr/apollo/bin:"
|
||||
typeset STRIP=""
|
||||
|
||||
|
||||
# this alias makes for more "beautiful" output.
|
||||
alias echo=print
|
||||
|
||||
#
|
||||
# Shell script to read a file full of destination/perm/source triples and
|
||||
# create data base entries in a format suitable for 8.0 release. All other
|
||||
# information defaults to the default values for now -- this should be correct
|
||||
# in most cases but may require editing of the result for those cases
|
||||
# needing special handling.
|
||||
#
|
||||
# Lst file syntax:
|
||||
# [<install-flags>] <destination_path> <perm> <src> [ <type> <owner> <group> <status> <processor> <resp_proj> ]
|
||||
#
|
||||
# <install-rule> ==> [optional] 2 character field encoding special actions to be invoked when
|
||||
# creating the product tree. In the absence of this field the file is subject
|
||||
# to defaults based on its name,destination directory and permissions.
|
||||
# valid values:
|
||||
# -- Do nothing special
|
||||
# c- compress the file
|
||||
# -n run it through an nroff pipeline
|
||||
# -s strip the file (should be a binary executable)
|
||||
#
|
||||
# <destination_path> ===> full path name on target system
|
||||
# <perm> ===> numeric permission (with leading 0)
|
||||
# <src> ===> build tree path name (relative to build tree root)
|
||||
# | full path name of link source
|
||||
# | "-" to ignore this field (source for directory not required)
|
||||
# <type> ===> "file" | "empty_dir" | "directory" | "hard_link" | NULL
|
||||
# <owner> ===> file owner name -- defaults to bin
|
||||
# <group> ===> file group ownership --- defaults to bin
|
||||
# <status> ===> "di----" default
|
||||
# <processor> ===> valid processor "3-" | "-8" | "38" -- defaults to "38"
|
||||
# <resp_proj> ===> responsible project --- defaults to "xwindows"
|
||||
#
|
||||
|
||||
Usage="Usage: $0 [-f filesetName] -D <desttree> -S <srctree> <file> ...\n
|
||||
\tfilesetName \t==> (optional) used to create subdirectory in desttree\n
|
||||
\tdesttree \t==> destination directory\n
|
||||
\tsrctree \t==> usually a build tree containing the source\n
|
||||
\tfile \t\t==> data base file in \".lst\" format"
|
||||
|
||||
FILE='file'
|
||||
STATUS='di----'
|
||||
PROCESSOR='378'
|
||||
DESTTREE='.'
|
||||
|
||||
if [ -f /com/ctnode ]; then
|
||||
# Apollo systems
|
||||
OWNER='root'
|
||||
GROUP='staff'
|
||||
# set flag used to test for soft links
|
||||
LNKTST="L"
|
||||
else
|
||||
# hp-ux systems (and all other systems)
|
||||
OWNER='bin'
|
||||
GROUP='bin'
|
||||
# set flag used to test for soft links
|
||||
LNKTST="h"
|
||||
fi
|
||||
|
||||
BUILD_TARGET='/'
|
||||
INSTALL_RULE='--'
|
||||
INSTALL_FLAGS=''
|
||||
ORDER='0'
|
||||
RESP_PROJ='xwindows'
|
||||
|
||||
# Set which system we are on
|
||||
BUILDSYSTEM=$(uname)
|
||||
|
||||
# Set system
|
||||
if [ $BUILDSYSTEM = "AIX" ];
|
||||
then
|
||||
PLATFORM=aix
|
||||
elif [ $BUILDSYSTEM = "SunOS" ];
|
||||
then
|
||||
PLATFORM=sun
|
||||
elif [ $BUILDSYSTEM = "UNIX_SV" ];
|
||||
then
|
||||
PLATFORM=usl
|
||||
elif [ $BUILDSYSTEM = "UNIX_System_V" ];
|
||||
then
|
||||
PLATFORM=uxp
|
||||
elif [ $BUILDSYSTEM = "OSF1" ];
|
||||
then
|
||||
PLATFORM=dec
|
||||
else # Build system = HP
|
||||
PLATFORM=hp-ux
|
||||
fi
|
||||
|
||||
if [ $PLATFORM = "aix" ];
|
||||
then
|
||||
USER=`/bin/whoami`
|
||||
elif [ $PLATFORM = "sun" -o $PLATFORM = "usl" -o $PLATFORM = "uxp" ];
|
||||
then
|
||||
USER=`/usr/ucb/whoami`
|
||||
else
|
||||
USER=`/usr/bin/whoami`
|
||||
fi
|
||||
|
||||
awkit() {
|
||||
awk '
|
||||
BEGIN {
|
||||
print "#"
|
||||
print "# TYPE RULE SRC DEST MODE OWNER GROUP LINKSRC"
|
||||
print ""
|
||||
}
|
||||
|
||||
/^[ ]*#/ { next }
|
||||
{
|
||||
# initialize install_rule to NULL
|
||||
install_rule=""
|
||||
|
||||
# skip blank lines
|
||||
if ( NF == 0 )
|
||||
next
|
||||
# do a little syntax checking
|
||||
|
||||
if ( $1 !~ /\// ) {
|
||||
# check for special install_rule values
|
||||
if ( $1 ~ /[-c][-ns]/ ) {
|
||||
# set the special install rule
|
||||
install_rule=$1
|
||||
|
||||
# shift the rest of the fields left
|
||||
for ( i = 1; i < NF; i++) {
|
||||
$i = $(i+1)
|
||||
}
|
||||
NF=NF-1
|
||||
}
|
||||
else {
|
||||
print "Syntax Error (line " NR ") destination path: " $1
|
||||
print "text: " $0
|
||||
next
|
||||
}
|
||||
}
|
||||
|
||||
if ( NF > 9 ) {
|
||||
print "Syntax Error (line " NR ") number of fields"
|
||||
print "text: " $0
|
||||
exit
|
||||
}
|
||||
|
||||
if ( $2 !~ /0[0-7][0-7]*/ ) {
|
||||
print "Syntax Error (line " NR ") perm : " $2
|
||||
print "text: " $0
|
||||
next
|
||||
}
|
||||
# if ( $4 ~ /link/ && $3 !~ /^\// && $3 !~ /`node_data/) {
|
||||
# changed to allow local link (using ./file syntax) -- Should this be
|
||||
# domain only?
|
||||
#
|
||||
if ( $4 ~ /link/ && $3 !~ /^\// && $3 !~ /`node_data/ && \
|
||||
$3 !~ /^\.\// && $3 !~ /^\.\.\// ) {
|
||||
print "Syntax Error (line " NR ") source: " $3
|
||||
print "text: " $0
|
||||
next
|
||||
}
|
||||
|
||||
# Check for special install rules
|
||||
# man pages are compressed use rule "c-"
|
||||
# font files are compressed use rule "c-"
|
||||
# directories have no source i.e. src = "-"
|
||||
|
||||
src = $3;
|
||||
link_src = "";
|
||||
type = "'$FILE'";
|
||||
owner = "'$OWNER'";
|
||||
group = "'$GROUP'";
|
||||
status = "'$STATUS'";
|
||||
processor = "'$PROCESSOR'";
|
||||
resp_proj = "'$RESP_PROJ'";
|
||||
if ( $4 != "" )
|
||||
{
|
||||
type = $4;
|
||||
if ( $4 ~ /link/ ) {
|
||||
src = "";
|
||||
if ( $3 ~ /^\// || $3 ~ /`node_data/ || \
|
||||
$3 ~ /^\.\// || $3 ~ /^\.\.\// )
|
||||
link_src = $3;
|
||||
else {
|
||||
print "Syntax Error (line " NR ") link_src: " $3
|
||||
print "text: " $0
|
||||
next;
|
||||
};
|
||||
}
|
||||
else if ( $4 == "directory" )
|
||||
if ( $3 != "-" )
|
||||
{
|
||||
print "Syntax Error (line " NR ") directory: " $3;
|
||||
print "text: " $0;
|
||||
next;
|
||||
}
|
||||
else
|
||||
src="";
|
||||
else if ( $4 == "empty_dir" )
|
||||
{
|
||||
resp_proj = "common";
|
||||
status = "------";
|
||||
if ( $3 != "-" )
|
||||
{
|
||||
print "Syntax Error (line " NR ") empty_dir: " $3;
|
||||
print "text: " $0;
|
||||
next;
|
||||
}
|
||||
else
|
||||
src="";
|
||||
}
|
||||
else if ( $4 == "file" && $3 == "-" )
|
||||
if ( $7 == "---cu-")
|
||||
src = "";
|
||||
}
|
||||
#
|
||||
# If owner an/or group are specified all previous fields (including
|
||||
# type) must be specified.
|
||||
#
|
||||
if ( $5 != "" )
|
||||
owner = $5;
|
||||
|
||||
if ( $6 != "" )
|
||||
group = $6;
|
||||
|
||||
if ( $7 != "" )
|
||||
status = $7
|
||||
|
||||
if ( $8 != "" )
|
||||
processor = $8;
|
||||
|
||||
if ($9 != "" )
|
||||
resp_proj= $9;
|
||||
|
||||
if ( install_rule != "" ) {
|
||||
; # install rule has been explicitly set -- do nothing
|
||||
}
|
||||
else if ( $1 ~ /\/usr\/man\/man.*\.Z\// )
|
||||
{
|
||||
install_rule = "c-";
|
||||
}
|
||||
else if ( $1 ~ /\/usr\/X11\/man\/cat[1-9]\/.*[1-9]/ )
|
||||
{
|
||||
install_rule = "-n";
|
||||
}
|
||||
else if ( $1 ~ /\/bsd4.3\/usr\/man\/cat[1-9]\/.*[1-9]/ )
|
||||
{
|
||||
install_rule = "-n";
|
||||
}
|
||||
else if ( $1 ~ /\/sys5.3\/usr\/catman\/.*man[1-9]\/.*[1-9]/ )
|
||||
{
|
||||
install_rule = "-n";
|
||||
}
|
||||
else if ( $1 ~ /.*\/fonts\/.*.scf$/ && $3 ~ /.*.snf$/ )
|
||||
{
|
||||
install_rule = "c-";
|
||||
}
|
||||
else if ( $1 ~ /.*\/fonts\/.*.snf\.Z$/ && $3 ~ /.*.snf$/ )
|
||||
{
|
||||
install_rule = "c-";
|
||||
}
|
||||
else if ( $1 ~ /^\/integration\// && $3 ~ /^doc\/upinfo\// )
|
||||
{
|
||||
install_rule = "";
|
||||
}
|
||||
else if ( $2 ~ /[1357]/ && $4 == "file" )
|
||||
{ # executable files may be stripped
|
||||
install_rule = "-s";
|
||||
}
|
||||
else
|
||||
install_rule = "'$INSTALL_RULE'";
|
||||
|
||||
|
||||
# print "install_target : " $1
|
||||
# print "fileset : " "'$FILESET'"
|
||||
# print "type : " type
|
||||
# print "status : " status
|
||||
# print "processor : " processor
|
||||
# print "mode : " $2
|
||||
# print "owner : " owner
|
||||
# print "group : " group
|
||||
# print "link_source : " link_src
|
||||
# print "build_target : " "'$BUILD_TARGET'"
|
||||
# print "install_rule_name : " install_rule
|
||||
# print "install_flags : " "'$INSTALL_FLAGS'"
|
||||
# print "a_out_location : " src
|
||||
# print "order : " "'$ORDER'"
|
||||
# print "responsible_project : " resp_proj
|
||||
# print "#"
|
||||
|
||||
if ( type ~ /.*link/ )
|
||||
src= link_src
|
||||
else if ( type ~ /.*directory/ )
|
||||
src="-"
|
||||
|
||||
print type, install_rule, src, $1, $2, owner ,group
|
||||
}
|
||||
|
||||
' $1
|
||||
}
|
||||
|
||||
#
|
||||
# createPath
|
||||
# function to create a directory path. (mkdir -p replacement on bsd4.3)
|
||||
#
|
||||
createPath()
|
||||
{
|
||||
if [ $# -ne 1 ]; then
|
||||
echo "ERROR: \"$0\" invalid argument count" >&2
|
||||
echo " ARGS=$@"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Since we are SYSTYPE bsd4.3 "-x" won't work.
|
||||
if [ -r /sys5.3/bin/mkdir ]; then
|
||||
/sys5.3/bin/mkdir -p $1
|
||||
return
|
||||
fi
|
||||
if hp9000s300 > /dev/null 2>&1 || hp9000s800 > /dev/null 2>&1; then
|
||||
mkdir -p $1
|
||||
return
|
||||
fi
|
||||
|
||||
#
|
||||
# We can't use mkdir -p so do the hard way.
|
||||
# starting at the root check/create all the directories
|
||||
# in the given path
|
||||
#
|
||||
|
||||
typeset xdirs=""
|
||||
typeset nextdir=""
|
||||
typeset fulldirs
|
||||
|
||||
# provide extra slash for apollo systems (//hp* syntax)?
|
||||
|
||||
if [ "$1" = "${1##/}" ]; then
|
||||
# not a full path name so attach path to current directory
|
||||
fulldirs=`/bin/pwd`/$1
|
||||
xdirs="/" # added to support apollo "//host" syntax
|
||||
elif [ "$1" != "${1##//}" ]; then
|
||||
# using "//host" syntax
|
||||
fulldirs=$1
|
||||
xdirs="/"
|
||||
else
|
||||
fulldirs=$1
|
||||
xdirs=""
|
||||
fi
|
||||
|
||||
echo creating path: $1
|
||||
|
||||
while nextdir=`expr /$fulldirs/ : '/*\([^/]*\)/.*'`; do
|
||||
xdirs=$xdirs/$nextdir
|
||||
if [ ! -d $xdirs ]; then
|
||||
mkdir $xdirs
|
||||
fi
|
||||
|
||||
fulldirs=`expr $fulldirs : '/*[^/]*/\(.*\)'`
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
||||
# doit
|
||||
# function to put the source file into the product tree. This function
|
||||
# reads its stdin for file movement rules.
|
||||
#
|
||||
doit()
|
||||
{
|
||||
if [ $# -ne 0 ]; then
|
||||
echo "ERROR: \"$0\" incorrect arg count" >&2
|
||||
echo "ARGS: $@" >&2
|
||||
fi
|
||||
|
||||
typeset TYPE
|
||||
typeset RULE
|
||||
typeset SRC
|
||||
typeset DEST
|
||||
typeset MODE
|
||||
typeset OWNER
|
||||
typeset GROUP
|
||||
|
||||
while read TYPE RULE SRC DEST MODE OWNER GROUP; do
|
||||
# ignore blank lines
|
||||
if [ -z "$TYPE" ]; then
|
||||
continue;
|
||||
fi
|
||||
# ignore comment lines (match longest string starting with '#')
|
||||
if [ "${TYPE###}" != "$TYPE" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
DEST=$DESTTREE/$FILESET${DEST}
|
||||
CMD=""
|
||||
|
||||
case $TYPE in
|
||||
directory)
|
||||
if [ ! -d "$DEST" ]; then
|
||||
CMD="createPath $DEST"
|
||||
fi
|
||||
;;
|
||||
file)
|
||||
SRC=$SRCTREE/$SRC
|
||||
if [ "$CHECK_BEFORE" = "yes" ]
|
||||
then
|
||||
if [ ! -f $SRC ]
|
||||
then
|
||||
echo "Missing: $SRC"
|
||||
echo "Missing: $SRC" >>/tmp/mkprod.missing
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
if [ ! -f $SRC ]; then
|
||||
echo "ERROR: Cannot read \"$SRC\"." >&2
|
||||
echo " LINE=$TYPE $RULE $SRC $DEST $MODE $OWNER $GROUP " >&2
|
||||
continue
|
||||
fi
|
||||
case $RULE in
|
||||
c-) # compress rule
|
||||
CMD="compress -c $SRC > $DEST"
|
||||
;;
|
||||
-n) # nroff rule (for apollo man pages)
|
||||
if egrep -c '^\.TH[ ]|^\.ds[ ]' $SRC > /dev/null ; then
|
||||
CMD="tbl $SRC|eqn|nroff -man|col -b> $DEST"
|
||||
else
|
||||
CMD="cp $SRC $DEST"
|
||||
fi
|
||||
;;
|
||||
-s) # strip rule
|
||||
# Domain Only
|
||||
# if [ "$(find $SRC -typeuid coff -print)" = "$SRC" ]; then
|
||||
# hp-ux
|
||||
if [ -z "$STRIP" ]; then
|
||||
CMD="cp $SRC $DEST"
|
||||
else if file $SRC | grep -q "not stripped"; then
|
||||
CMD="cp $SRC $DEST; strip $DEST"
|
||||
else
|
||||
CMD="cp $SRC $DEST"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
--) # default (no special processing)
|
||||
CMD="cp $SRC $DEST"
|
||||
;;
|
||||
*) # huh?
|
||||
echo "ERROR: Unrecognized rule: \"$RULE\"" >&2
|
||||
echo " LINE=$TYPE $RULE $SRC $DEST $MODE $OWNER $GROUP " >&2
|
||||
continue;
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
sym_link)
|
||||
if [ -z "$SRC" ]; then
|
||||
echo "ERROR: No link source for \"$DEST\"" >&2
|
||||
echo " LINE=$TYPE $RULE $SRC $DEST $MODE $OWNER $GROUP " >&2
|
||||
continue;
|
||||
fi
|
||||
if [ "${SRC#\`node_data}" != "$SRC" ]; then
|
||||
# apollo-style special link
|
||||
echo "WARNING: encountered special link: $SRC" >&2
|
||||
# try to make link to this SRC by adding a
|
||||
# backslash to protect the tic mark.
|
||||
SRC=\\$SRC
|
||||
elif [ "${SRC#/}" = "$SRC" ]; then
|
||||
# echo "ERROR: Relative link \"$SRC\"" >&2
|
||||
# echo "WARNING: Relative link \"$SRC\"" >&2
|
||||
# echo " LINE=$TYPE $RULE $SRC $DEST $MODE $OWNER $GROUP " >&2
|
||||
# Protect the potential variant link variable
|
||||
# (eg lnk_$(LNK))
|
||||
SRC=\'$SRC\'
|
||||
# continue;
|
||||
fi
|
||||
CMD="ln -s $SRC $DEST"
|
||||
# Remove existing link if one already exists
|
||||
[ -${LNKTST} "$DEST" ] && rm $DEST
|
||||
;;
|
||||
hard_link)
|
||||
# Hard links are assumed to be made only to other
|
||||
# files in the submittal -- not to existing system
|
||||
# files.
|
||||
SRC="$DESTTREE/$FILESET${SRC}"
|
||||
if [ -z "$SRC" ]; then
|
||||
echo "ERROR: No link source for \"$DEST\"" >&2
|
||||
echo " LINE=$TYPE $RULE $SRC $DEST $MODE $OWNER $GROUP" >&2
|
||||
continue;
|
||||
fi
|
||||
CMD="ln $SRC $DEST"
|
||||
;;
|
||||
*) echo "ERROR: Unrecognized type: \"$TYPE\"" >&2
|
||||
echo " LINE=$TYPE $RULE $SRC $DEST $MODE $OWNER $GROUP" >&2
|
||||
continue;
|
||||
;;
|
||||
esac
|
||||
|
||||
# createPath issues its own error messages
|
||||
if [ ! -d ${DEST%/*} ]; then
|
||||
createPath ${DEST%/*} || continue
|
||||
fi
|
||||
[ -z "$CMD" ] && continue
|
||||
eval "$CMD" || {
|
||||
echo "ERROR: \"$CMD\" failed" >&2
|
||||
echo " LINE=$TYPE $RULE $SRC $DEST $MODE $OWNER $GROUP" >&2;
|
||||
continue;
|
||||
}
|
||||
# set permissions for non-links
|
||||
if [ "${TYPE%link}" = "$TYPE" ]; then
|
||||
if [ "$USER" = "root" ]; then
|
||||
chmod $MODE $DEST ||
|
||||
echo "ERROR: \"chmod $MODE $DEST\" failed" >&2
|
||||
chgrp $GROUP $DEST ||
|
||||
echo "ERROR: \"chgrp $GROUP $DEST\" failed" >&2
|
||||
chown $OWNER $DEST ||
|
||||
echo "ERROR: \"chown $OWNER $DEST\" failed" >&2
|
||||
fi
|
||||
fi
|
||||
|
||||
echo $TYPE $RULE $SRC $DEST $MODE $OWNER $GROUP
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
###################################################
|
||||
# MAIN BODY
|
||||
###################################################
|
||||
|
||||
#
|
||||
# Check Path for chmod, chown, and chgrp
|
||||
#
|
||||
whence chmod > /dev/null || {
|
||||
echo "ERROR: \"chmod\" not in PATH." >&2
|
||||
exit 1
|
||||
}
|
||||
whence chown > /dev/null || {
|
||||
echo "ERROR: \"chown\" not in PATH." >&2
|
||||
exit 1
|
||||
}
|
||||
whence chgrp > /dev/null || {
|
||||
echo "ERROR: \"chgrp\" not in PATH." >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
CHECK_BEFORE="no"
|
||||
|
||||
while [ $# -ne 0 ] ; do
|
||||
case $1 in
|
||||
-f*)
|
||||
FILESET=${1#-f}
|
||||
if [ -z "$FILESET" ]; then
|
||||
if [ $# -ge 1 ]; then
|
||||
shift;
|
||||
FILESET=$1
|
||||
else
|
||||
echo $Usage
|
||||
exit 1;
|
||||
fi
|
||||
fi;;
|
||||
-S*) SRCTREE=${1#-S}
|
||||
if [ -z "$SRCTREE" ]; then
|
||||
if [ $# -ge 1 ]; then
|
||||
shift;
|
||||
SRCTREE=$1
|
||||
else
|
||||
echo $Usage
|
||||
exit 1;
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
-D*) DESTTREE=${1#-D}
|
||||
if [ -z "$DESTTREE" ]; then
|
||||
if [ $# -ge 1 ]; then
|
||||
shift;
|
||||
DESTTREE=$1
|
||||
else
|
||||
echo $Usage
|
||||
exit 1;
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
-P*) CHECK_BEFORE="yes"
|
||||
;;
|
||||
|
||||
*) files="$files $1";;
|
||||
esac
|
||||
if [ $# -ge 1 ]; then
|
||||
shift;
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -z "$files" -o -z "$SRCTREE" ]; then
|
||||
echo $Usage >&2
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
if [ ! -d "$SRCTREE" ]; then
|
||||
echo "ERROR: Cannot access \"$SRCTREE\"." >&2
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -d "$DESTTREE" ]; then
|
||||
echo "ERROR: Cannot access \"$DESTTREE\"." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
umask 022
|
||||
if [ -f /com/ctnode ]; then
|
||||
#
|
||||
# Make sure berkely style permissions are applied to the product tree
|
||||
# This should cause directories to be created with permissions based
|
||||
# on the umask (which is otherwise ignored on "open security model"
|
||||
# file systems).
|
||||
#
|
||||
chacl -RB $DESTTREE
|
||||
fi
|
||||
|
||||
# Debug Stmts
|
||||
echo FILESET=$FILESET
|
||||
echo files=$files
|
||||
echo SRCTREE=$SRCTREE
|
||||
echo DESTTREE=$DESTTREE
|
||||
echo "#-------------- $(date) --------------"
|
||||
echo ""
|
||||
|
||||
TOOL_DIR=$SRCTREE/admin/IntegTools/dbTools
|
||||
|
||||
#
|
||||
# Avoid making duplicate entries
|
||||
# make sure links are referred to AFTER the files to which they point.
|
||||
#
|
||||
if [ $PLATFORM = "uxp" ]; then
|
||||
$TOOL_DIR/uncomment $files | sort | uniq | $TOOL_DIR/linksLast - > /tmp/awk.in
|
||||
cat /tmp/awk.in | awkit > /tmp/awk.out
|
||||
cat /tmp/awk.out | doit
|
||||
else
|
||||
$TOOL_DIR/uncomment $files | sort | uniq | $TOOL_DIR/linksLast - | awkit | doit
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "#-------------- $(date) --------------"
|
||||
765
cde/admin/IntegTools/dbTools/udbParseLib.awk
Normal file
765
cde/admin/IntegTools/dbTools/udbParseLib.awk
Normal file
@@ -0,0 +1,765 @@
|
||||
|
||||
# Awk Library file for parsing UDB files
|
||||
#
|
||||
function parseUdb() {
|
||||
# nawk has already read the initial line.
|
||||
# Tokenize it before doing anything else.
|
||||
tokenize()
|
||||
readDefaults(defaults)
|
||||
# assign hp-ux ".db" file src and link defaults
|
||||
# if none were designated.
|
||||
if ( SrcDefault == "" )
|
||||
SrcDefault = "a_out_location"
|
||||
if ( LnkDefault == "" )
|
||||
LnkDefault = "link_source"
|
||||
if ( TypDefault == "" )
|
||||
TypDefault = "type"
|
||||
if ( DestDefault == "" )
|
||||
DestDefault = "install_target"
|
||||
if ( ModeDefault == "" )
|
||||
ModeDefault = "mode"
|
||||
if ( OwnerDefault == "" )
|
||||
OwnerDefault = "owner"
|
||||
if ( GroupDefault == "" )
|
||||
GroupDefault = "group"
|
||||
readData()
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------
|
||||
# readDefaults
|
||||
# This routine reads the defaults at the front section
|
||||
# of the universal database and salts the defaults away.
|
||||
#
|
||||
# -------------------------------------------------------------
|
||||
function readDefaults(dflts)
|
||||
{
|
||||
if ( DeBug > 0 ) {
|
||||
Depth++
|
||||
for ( i=1; i < Depth; i++ )
|
||||
printf(" ") > DeBugFile
|
||||
print "Entering function readDefaults" > DeBugFile
|
||||
}
|
||||
do {
|
||||
os = getOS()
|
||||
if ( osQual != "defaults" )
|
||||
syntaxError("No defaults for: " BlockToken)
|
||||
if ( os == BlockToken || os == "default" )
|
||||
break
|
||||
skipToToken("}")
|
||||
} while ( 1 )
|
||||
fillDefaults()
|
||||
if ( DeBug > 1 )
|
||||
print "Skipping remaining defaults" > DeBugFile
|
||||
# skip remaining default specs
|
||||
while ( lookAhead() == "{" ) {
|
||||
# This should be another default spec
|
||||
# skip it. (watch out for syntax errors)
|
||||
os = getOS()
|
||||
if ( osQual != "defaults" )
|
||||
syntaxError("Expected os:defaults found: \"" os ":" osQual "\"")
|
||||
if ( os == BlockToken && fileName == FILENAME )
|
||||
syntaxError("Only one \"defaults\" record allowed per os" )
|
||||
|
||||
skipToToken("}");
|
||||
}
|
||||
if ( DeBug > 0 ) Depth--
|
||||
}
|
||||
# -------------------------------------------------------------
|
||||
# syntaxError
|
||||
# bail out
|
||||
#
|
||||
# (optionally) mail a message to an administrator if a syntax
|
||||
# error occurs in a database.
|
||||
#
|
||||
# -------------------------------------------------------------
|
||||
function syntaxError(reason) {
|
||||
if ( DeBug > 0 ) {
|
||||
Depth++
|
||||
for ( i=1; i < Depth; i++ )
|
||||
printf(" ") > DeBugFile
|
||||
print "Entering function syntaxError:" > DeBugFile
|
||||
}
|
||||
print "Syntax ERROR line: " NR " of file: " FILENAME
|
||||
if (reason)
|
||||
print " " reason
|
||||
system( "rm -f /tmp/SyntaxError" )
|
||||
system( "touch /tmp/SyntaxError" )
|
||||
print "Syntax ERROR line: " NR " of file: " FILENAME > "/tmp/SyntaxError"
|
||||
if (reason)
|
||||
print " " reason >> "/tmp/SyntaxError"
|
||||
close( "/tmp/SyntaxError" )
|
||||
if ( mailTo != "" ) {
|
||||
system( "mailx -s \"database syntax error\" "mailTo" < /tmp/SyntaxError" )
|
||||
}
|
||||
system( "rm -f /tmp/SyntaxError" )
|
||||
exit 1
|
||||
}
|
||||
# -------------------------------------------------------------
|
||||
# fillDefaults
|
||||
# This routine reads the defaults in the OS
|
||||
# defaults section of the database. It saves the defaults
|
||||
# in the "defaults" awk-style string array.
|
||||
#
|
||||
# -------------------------------------------------------------
|
||||
function fillDefaults() {
|
||||
if ( DeBug > 0 ) {
|
||||
Depth++
|
||||
for ( i=1; i < Depth; i++ )
|
||||
printf(" ") > DeBugFile
|
||||
print "Entering function fillDefaults:" > DeBugFile
|
||||
}
|
||||
tempDflt = ""
|
||||
NumEntries = 1
|
||||
do {
|
||||
if ( tempDflt != "" ) {
|
||||
keyword = tempDflt
|
||||
tempDflt = ""
|
||||
}
|
||||
else
|
||||
keyword = nextToken()
|
||||
|
||||
if ( keyword == "}" )
|
||||
break;
|
||||
if ( "=" != nextToken())
|
||||
syntaxError("Keyword: " keyword " not followed by \"=\" ");
|
||||
tempDflt = nextToken();
|
||||
if ( lookAhead() == "=" )
|
||||
defaults[keyword]=""
|
||||
else {
|
||||
if ( tempDflt == "<SRC>" ) {
|
||||
SrcDefault = keyword;
|
||||
tempDflt = ""
|
||||
}
|
||||
if ( tempDflt == "<LNK>" ) {
|
||||
LnkDefault = keyword;
|
||||
tempDflt = ""
|
||||
}
|
||||
if ( tempDflt == "<TYPE>" ) {
|
||||
TypDefault = keyword;
|
||||
tempDflt = "file"
|
||||
}
|
||||
if ( tempDflt == "<DEST>" ) {
|
||||
DestDefault = keyword;
|
||||
tempDflt = ""
|
||||
}
|
||||
if ( tempDflt == "<MODE>" ) {
|
||||
ModeDefault = keyword;
|
||||
tempDflt = "0444"
|
||||
}
|
||||
if ( tempDflt == "<OWNER>" ) {
|
||||
OwnerDefault = keyword;
|
||||
tempDflt = "bin"
|
||||
}
|
||||
if ( tempDflt == "<GROUP>" ) {
|
||||
GroupDefault = keyword;
|
||||
tempDflt = "bin"
|
||||
}
|
||||
defaults[keyword]= tempDflt
|
||||
|
||||
tempDflt = ""
|
||||
}
|
||||
defOrder[NumEntries++] = keyword;
|
||||
} while ( 1 )
|
||||
if ( DeBug > 3 ) {
|
||||
DBGprintArray(defaults,"defaults")
|
||||
print "SrcDefault =" SrcDefault > DeBugFile
|
||||
print "LnkDefault =" LnkDefault > DeBugFile
|
||||
print "TypDefault =" TypDefault > DeBugFile
|
||||
}
|
||||
if ( DeBug > 0 ) Depth--
|
||||
}
|
||||
# -------------------------------------------------------------
|
||||
# getOS
|
||||
# This routine scans the database for an
|
||||
# open brace, then a token, then a ":" indicating
|
||||
# the start of an OS defaults section.
|
||||
#
|
||||
# -------------------------------------------------------------
|
||||
function getOS()
|
||||
{
|
||||
if ( DeBug > 0 ) {
|
||||
Depth++
|
||||
for ( i=1; i < Depth; i++ )
|
||||
printf(" ") > DeBugFile
|
||||
print "Entering function getOS:" > DeBugFile
|
||||
}
|
||||
osQual = ""
|
||||
gotOS = 0
|
||||
|
||||
if ( "{" != nextToken() )
|
||||
syntaxError("Missing initial {")
|
||||
os = nextToken();
|
||||
if ( lookAhead() == ":" ) {
|
||||
nextToken();
|
||||
osQual= nextToken();
|
||||
} else
|
||||
osQual= ""
|
||||
if ( DeBug > 0 ) Depth--
|
||||
return os
|
||||
}
|
||||
# -------------------------------------------------------------
|
||||
# nextToken
|
||||
# parse the incoming data stream into tokens.
|
||||
#
|
||||
# -------------------------------------------------------------
|
||||
function nextToken() {
|
||||
if ( DeBug > 0 ) {
|
||||
Depth++
|
||||
for ( i=1; i < Depth; i++ )
|
||||
printf(" ") > DeBugFile
|
||||
print "Entering function nextToken:" > DeBugFile
|
||||
}
|
||||
if ( EOF_Reached == 1 )
|
||||
syntaxError("Premature EOF");
|
||||
tmpToken=tokens[TK++]
|
||||
while ( TK > Ntokens || tokens[TK] == ";" ) {
|
||||
TK++
|
||||
if ( TK > Ntokens )
|
||||
if ( newLine() <= 0 ) {
|
||||
EOF_Reached = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( DeBug > 2 )
|
||||
print "Returning token: " tmpToken > DeBugFile
|
||||
if ( DeBug > 0 ) Depth--
|
||||
return tmpToken
|
||||
}
|
||||
# -------------------------------------------------------------
|
||||
# lookAhead
|
||||
# return the token at the head of the current list of
|
||||
# tokens, but do not bump the token count in TK
|
||||
#
|
||||
# -------------------------------------------------------------
|
||||
function lookAhead() {
|
||||
if ( DeBug > 0 ) {
|
||||
Depth++
|
||||
for ( i=1; i < Depth; i++ )
|
||||
printf(" ") > DeBugFile
|
||||
print "Entering function lookAhead" > DeBugFile
|
||||
}
|
||||
if ( DeBug > 0 ) Depth--
|
||||
return tokens[TK];
|
||||
}
|
||||
# -------------------------------------------------------------
|
||||
# newLine, tokenize
|
||||
# read a new line of input and tokenize it.
|
||||
#
|
||||
# -------------------------------------------------------------
|
||||
function newLine() {
|
||||
if ( DeBug > 0 ) {
|
||||
Depth++
|
||||
for ( i=1; i < Depth; i++ )
|
||||
printf(" ") > DeBugFile
|
||||
print "Entering function newLine:" > DeBugFile
|
||||
}
|
||||
if ( (retval = getline) <= 0 ) {
|
||||
if ( DeBug > 0 ) Depth--
|
||||
return retval
|
||||
}
|
||||
retval = tokenize()
|
||||
if ( DeBug > 0 ) Depth--
|
||||
return retval
|
||||
}
|
||||
function tokenize() {
|
||||
if ( DeBug > 0 ) {
|
||||
Depth++
|
||||
for ( i=1; i < Depth; i++ )
|
||||
printf(" ") > DeBugFile
|
||||
print "Entering function tokenize:" > DeBugFile
|
||||
}
|
||||
# Skip blank/comment lines
|
||||
while ( NF == 0 || $0 ~ /^[ ]*#/ ) {
|
||||
if ( (getline) <= 0 ) {
|
||||
if ( DeBug > 0 ) Depth--
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Make sure syntactically meaningful characters are surrounded by
|
||||
# white space. (I gave up on gsub for this purpose).
|
||||
#
|
||||
last=1
|
||||
Str="" # temp string for modified input line
|
||||
tstStr=$0 # part of input line being tested
|
||||
newStr=$0 # current input line image with modifications
|
||||
##########################################################################
|
||||
# REPLACE THE FOLLOWING LINE WITH A WORK_AROUND FOR A PROBLEM WITH
|
||||
# THE MATCH FUNCTION FOR THE SUN VERSION OF "nawk"
|
||||
#
|
||||
# while ( match(tstStr,"[^\\\][:=}{;]") ) {
|
||||
#
|
||||
while ( match(tstStr,"[:=}{;]") ) {
|
||||
if ( RSTART-1 > 0 && substr(tstStr,RSTART-1,1) != "\\") {
|
||||
RSTART=RSTART-1
|
||||
LENGTH=LENGTH+1
|
||||
} else {
|
||||
#
|
||||
# The character was escaped with a backslash.
|
||||
# Patch things up -- continue testing the rest
|
||||
# of the line.
|
||||
#
|
||||
Str=Str substr($0,last,RSTART+1)
|
||||
last = last + RSTART + 1
|
||||
tstStr =substr($0,last)
|
||||
newStr = Str tstStr
|
||||
continue;
|
||||
}
|
||||
####################### end of workaround ################################
|
||||
############################################################################
|
||||
if ( DeBug > 1 ) {
|
||||
print "Tokenize: Match found in: " tstStr
|
||||
print "RSTART= " RSTART " ; RLENGTH = " RLENGTH
|
||||
}
|
||||
# match found --
|
||||
# the temp string is now modified to contain:
|
||||
# 1) all characters up to the match and the first char of match
|
||||
# 2) blank before the syntactically significant char
|
||||
# 3) the significant character
|
||||
# 4) blank following the significant character
|
||||
|
||||
Str=Str substr($0,last,RSTART) " " substr($0,last+RSTART,1) " "
|
||||
last = last + RSTART + 1;
|
||||
#
|
||||
# Test remaining part of input line for additional occurances
|
||||
# of syntactically significant characters.
|
||||
#
|
||||
tstStr=substr($0,last)
|
||||
#
|
||||
# Our best guess for the new string is the part of the
|
||||
# input line already tested plus the part yet to be tested.
|
||||
#
|
||||
newStr=Str tstStr
|
||||
}
|
||||
#
|
||||
# Check for any instances of syntax chars at the start of the line
|
||||
#
|
||||
sub("^[:=}{;]","& ",newStr);
|
||||
$0 = newStr
|
||||
|
||||
#
|
||||
# allow escaping of significant syntax characters
|
||||
#
|
||||
gsub("[\\\][{]","{")
|
||||
gsub("\\\:",":")
|
||||
gsub("\\\;",";")
|
||||
gsub("\\\=","=")
|
||||
gsub("[\\\][}]","}")
|
||||
|
||||
#
|
||||
# Having insured that interesting chars are surrounded by blanks
|
||||
# now tokenize the input line.
|
||||
#
|
||||
|
||||
Ntokens = split($0,tokens)
|
||||
TK = 1
|
||||
if ( DeBug > 3 )
|
||||
DBGprintTokens()
|
||||
if ( DeBug > 0 ) Depth--
|
||||
return Ntokens
|
||||
}
|
||||
function DBGprintTokens()
|
||||
{
|
||||
for ( i = 1; i <= Ntokens ; i++ )
|
||||
print "tokens[" i "] = " tokens[i] > DeBugFile
|
||||
return 0
|
||||
}
|
||||
function DBGprintArray(array,name) {
|
||||
for ( i in array) {
|
||||
print name "[" i "] = " array[i] > DeBugFile
|
||||
}
|
||||
}
|
||||
# -------------------------------------------------------------
|
||||
# skipToToken
|
||||
# read until the passed in token is encountered
|
||||
#
|
||||
# -------------------------------------------------------------
|
||||
function skipToToken(tok)
|
||||
{
|
||||
if ( DeBug > 0 ) {
|
||||
Depth++
|
||||
for ( i=1; i < Depth; i++ )
|
||||
printf(" ") > DeBugFile
|
||||
print "Entering function skipToToken:" > DeBugFile
|
||||
}
|
||||
while ( nextToken() != tok )
|
||||
;
|
||||
if ( DeBug > 0 ) Depth--
|
||||
}
|
||||
# -------------------------------------------------------------
|
||||
# readData
|
||||
#
|
||||
# -------------------------------------------------------------
|
||||
function readData() {
|
||||
if ( DeBug > 0 ) {
|
||||
Depth++
|
||||
for ( i=1; i < Depth; i++ )
|
||||
printf(" ") > DeBugFile
|
||||
print "Entering function readData" > DeBugFile
|
||||
}
|
||||
while ( EOF_Reached == 0 ) {
|
||||
if ( fileName != FILENAME ) {
|
||||
if ( DeBug > 1 ) {
|
||||
print "====>Files Changed" > DeBugFile
|
||||
print "fileName= " fileName > DeBugFile
|
||||
print "FILENAME= " FILENAME > DeBugFile
|
||||
}
|
||||
fileName = FILENAME
|
||||
# skip over defaults section of the new file
|
||||
while ( lookAhead() == "{" ) {
|
||||
# This should be another default spec
|
||||
# skip it. (watch out for syntax errors)
|
||||
os = getOS()
|
||||
if ( osQual != "defaults" )
|
||||
syntaxError("Expected os:defaults found: \"" os ":" osQual "\"")
|
||||
#
|
||||
# Relax this restriction since we are
|
||||
# ignoring this defaults record
|
||||
#if ( os == BlockToken )
|
||||
# syntaxError("Only one \"defaults\" record allowed per os" )
|
||||
|
||||
skipToToken("}");
|
||||
}
|
||||
}
|
||||
if ( getNextRecord(record) > 0 )
|
||||
PRTREC(record);
|
||||
# skip remaining os entries for this source
|
||||
# sorry no error checking.
|
||||
while ( EOF_Reached == 0 && lookAhead() == "{" )
|
||||
skipToToken("}")
|
||||
if ( DeBug > 1 )
|
||||
print "EOF_Reached = " EOF_Reached > DeBugFile
|
||||
}
|
||||
if ( DeBug > 0 ) Depth--
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------
|
||||
# getNextRecord
|
||||
#
|
||||
# this function fills the rec[] array with defaults
|
||||
#
|
||||
# then it scans for a block that has a token maching
|
||||
# BlockToken, or accepts a block with the "default"
|
||||
# token. The "default" token is not accepted if
|
||||
# defaults are disallowed.
|
||||
#
|
||||
# finally fillRecord is called to read in the lines
|
||||
# in the block and override the entries in the rec[] array.
|
||||
#
|
||||
# -------------------------------------------------------------
|
||||
function getNextRecord(rec) {
|
||||
if ( DeBug > 0 ) {
|
||||
Depth++
|
||||
for ( i=1; i < Depth; i++ )
|
||||
printf(" ") > DeBugFile
|
||||
print "Entering function getNextRecord:" > DeBugFile
|
||||
}
|
||||
# fill with defaults
|
||||
for ( i in defaults )
|
||||
rec[i] = defaults[i];
|
||||
do {
|
||||
src = nextToken()
|
||||
if ( DeBug > 2 )
|
||||
print "src=" src > DeBugFile
|
||||
# Allow special characters to appear in src names if they have been backslashed
|
||||
# if ( src ~ /[{:=}]/ )
|
||||
# syntaxError("Invalid source: \"" src "\"");
|
||||
do {
|
||||
os = getOS()
|
||||
if ( DeBug > 1 ) {
|
||||
print "Got os " os " and qual= " osQual > DeBugFile
|
||||
print "NR= " NR " : " $0 > DeBugFile
|
||||
}
|
||||
if (( os != BlockToken || osQual == "not" ) \
|
||||
&& ( os != "default" || UseDefaultBlocks != "Y" ) ) {
|
||||
|
||||
if ( DeBug > 2)
|
||||
print "Skipping to end of os rec" > DeBugFile
|
||||
skipToToken("}");
|
||||
}
|
||||
if ( EOF_Reached == 1 || fileName != FILENAME ){
|
||||
if ( DeBug > 0 ) Depth--
|
||||
return 0
|
||||
}
|
||||
if ( DeBug > 2 )
|
||||
print "Look Ahead is: " tokens[TK] > DeBugFile
|
||||
} while ( lookAhead() == "{" )
|
||||
} while (( os != BlockToken ) && ( os != "default" || UseDefaultBlocks != "Y"))
|
||||
if ( DeBug > 2)
|
||||
print "About to call fillRecord" > DeBugFile
|
||||
fillRecord(rec)
|
||||
if ( DeBug > 0 ) Depth--
|
||||
return 1
|
||||
}
|
||||
function fillRecord(rec) {
|
||||
if ( DeBug > 0 ) {
|
||||
Depth++
|
||||
for ( i=1; i < Depth; i++ )
|
||||
printf(" ") > DeBugFile
|
||||
print "Entering fillRecord:" > DeBugFile
|
||||
}
|
||||
tempEntry = ""
|
||||
do {
|
||||
if ( tempEntry != "" ) {
|
||||
keyword = tempEntry;
|
||||
tempEntry = ""
|
||||
} else
|
||||
keyword = nextToken();
|
||||
if ( keyword == "}" )
|
||||
break;
|
||||
if ( "=" != nextToken())
|
||||
syntaxError("Keyword: " keyword " not followed by \"=\"");
|
||||
tempEntry = nextToken();
|
||||
if ( lookAhead() == "=" )
|
||||
rec[keyword] = ""
|
||||
else {
|
||||
rec[keyword] = tempEntry
|
||||
tempEntry = ""
|
||||
}
|
||||
} while (1)
|
||||
#
|
||||
# check for source entry
|
||||
# THIS IMPLIES KNOWLEDGE OF .db FILE ENTRIES!!
|
||||
if ( DeBug > 2)
|
||||
print "TYPE= " rec[TypDefault] > DeBugFile
|
||||
if ( src == "-" )
|
||||
if ( rec[TypDefault]=="directory" || rec[TypDefault]=="empty_dir")
|
||||
{
|
||||
# no source required for a directory
|
||||
if ( rec[SrcDefault] != "" )
|
||||
syntaxError(SrcDefault " \"" rec[SrcDefault] "\" specified for a directory.")
|
||||
if ( rec[LnkDefault] != "" )
|
||||
syntaxError(LnkDefault " \"" rec[LnkDefault] "\" specfied for a directory.")
|
||||
|
||||
rec[SrcDefault] = src;
|
||||
} else if ( rec["status"] == "---cu-" ) {
|
||||
# This is used for some reason (X11-SERV.db)
|
||||
if ( rec[SrcDefault] != "" )
|
||||
syntaxError( "File: \"" rec["install_target"] "\" with special status: \"---cu-\" should have no source.");
|
||||
} else
|
||||
syntaxError("Invalid source: \"" src "\" for type: \"" rec[TypDefault] )
|
||||
else if ( rec[TypDefault] ~ /link/ )
|
||||
if ( src ~ /^\// || src ~ /^\./ ) {
|
||||
if ( rec[SrcDefault] != "")
|
||||
syntaxError( SrcDefault ": \"" rec[SrcDefault] "\" specified for link: \"" src "\"")
|
||||
if ( rec[LnkDefault] == "" )
|
||||
rec[LnkDefault]=src;
|
||||
} else
|
||||
syntaxError("Invalid source: \"" src "\" for type: \"" rec[TypDefault] "\"")
|
||||
else if ( rec[TypDefault] == "file" || rec[TypDefault] == "control" )
|
||||
rec[SrcDefault] = src;
|
||||
else
|
||||
syntaxError("Unrecognized type:\"" rec[TypDefault] "\"")
|
||||
|
||||
if ( DeBug > 0 ) Depth--
|
||||
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------
|
||||
# printDB
|
||||
# Print records in ".db" format
|
||||
# -------------------------------------------------------------
|
||||
function printDb(rec) {
|
||||
if ( DeBug > 0 ) {
|
||||
Depth++
|
||||
for ( i=1; i < Depth; i++ )
|
||||
printf(" ") > DeBugFile
|
||||
print "Entering printDb:" > DeBugFile
|
||||
}
|
||||
# NumEntries should be one greater than the number of defaults
|
||||
# read in.
|
||||
for ( i = 1; i< NumEntries; i++ ) {
|
||||
printf("%-40s %s %s\n",defOrder[i], ":",rec[defOrder[i]])
|
||||
}
|
||||
print "#"
|
||||
if ( DeBug > 0 ) Depth--
|
||||
}
|
||||
|
||||
|
||||
# -------------------------------------------------------------
|
||||
# printLst
|
||||
# Print records in ".lst" format
|
||||
# -------------------------------------------------------------
|
||||
function printLst(rec) {
|
||||
if ( DeBug > 0 ) {
|
||||
Depth++
|
||||
for ( i=1; i < Depth; i++ )
|
||||
printf(" ") > DeBugFile
|
||||
print "Entering printLst:" > DeBugFile
|
||||
}
|
||||
if ( rec[TypDefault] ~ /link/ )
|
||||
Source = LnkDefault
|
||||
else
|
||||
Source = SrcDefault
|
||||
|
||||
printf("%s %s %s %s %s %s %s %s %s\n",
|
||||
rec[ DestDefault],
|
||||
rec[ ModeDefault ],
|
||||
rec[ Source ],
|
||||
rec[ TypDefault ],
|
||||
rec[ OwnerDefault ],
|
||||
rec[ GroupDefault ],
|
||||
rec[ "status" ],
|
||||
rec[ "processor" ],
|
||||
rec[ "responsible_project" ] )
|
||||
|
||||
if ( DeBug > 0 ) Depth--
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------
|
||||
# printGather
|
||||
# print records in one of the formats expected by Gather.ksh
|
||||
# (Jim Andreas print routine).
|
||||
# -------------------------------------------------------------
|
||||
function printGather(rec) {
|
||||
# print "Entering printRecord: "
|
||||
|
||||
if (( BlockToken == "hp-ux" ) && ( rec[ "processor" ] != "378" ))
|
||||
{
|
||||
if ( index( rec[ "processor" ], Machine ) == 0 )
|
||||
{
|
||||
#printf( "skipping %s, Machine %s machines %s\n", src, Machine, rec[ "processor" ] );
|
||||
return
|
||||
}
|
||||
}
|
||||
if ( action == "toSDD" )
|
||||
{
|
||||
if ( rec[ "type" ] == "file" )
|
||||
{
|
||||
printf("%s:F:%s:%s:%s:*::\n",
|
||||
rec[ "install_target" ], rec[ "owner" ],
|
||||
rec[ "group" ], rec[ "mode" ])
|
||||
}
|
||||
}
|
||||
else if ( action == "toReleaseTree" )
|
||||
{
|
||||
if ( ( rec[ "type" ] == "hard_link" ) ||
|
||||
( rec[ "type" ] == "sym_link" ) ||
|
||||
( rec[ "type" ] == "file" ) )
|
||||
{
|
||||
|
||||
#
|
||||
# if this is a link, then fudge a source file for Gather.ksh
|
||||
# to check on. Really we are linking two dest files together
|
||||
# so the hack is to get around the check in Gather.ksh
|
||||
#
|
||||
|
||||
if ( ( rec[ "type" ] == "hard_link" ) ||
|
||||
( rec[ "type" ] == "sym_link" ) )
|
||||
{
|
||||
printf( " {s}%s {d}%s\n", "-", rec[ "install_target" ] );
|
||||
}
|
||||
else if ( length( src ) > 34 )
|
||||
printf( " {s}%s {d}%s\n", src, rec[ "install_target" ] );
|
||||
else
|
||||
printf( " {s}%-34s {d}%s\n", src, rec[ "install_target" ] );
|
||||
|
||||
if ( rec[ "install_rule_name" ] == "c-" )
|
||||
{
|
||||
printf( "compress -c < {s}%s > {d}%s\n", src,
|
||||
rec[ "install_target" ] );
|
||||
}
|
||||
else if ( rec[ "type" ] == "sym_link" )
|
||||
{
|
||||
printf( "ln -s %s {d}%s\n", src,
|
||||
rec[ "install_target" ] );
|
||||
}
|
||||
else if ( rec[ "type" ] == "hard_link" )
|
||||
{
|
||||
printf( "ln {d}%s {d}%s\n", src,
|
||||
rec[ "install_target" ] );
|
||||
}
|
||||
else if ( rec[ "uncompress" ] == "true" )
|
||||
{
|
||||
printf( "uncompress -c < {s}%s > {d}%s\n", src,
|
||||
rec[ "install_target" ] );
|
||||
}
|
||||
else if ( length( src ) > 34 )
|
||||
{
|
||||
printf( "cp {s}%s {d}%s\n", src,
|
||||
rec[ "install_target" ] );
|
||||
}
|
||||
else
|
||||
{
|
||||
printf( "cp {s}%-34s {d}%s\n", src,
|
||||
rec[ "install_target" ] );
|
||||
}
|
||||
printf( "%s %s %s\n", rec[ "owner" ], rec[ "group" ], rec[ "mode" ])
|
||||
rec[ "install_rule_name" ] = "";
|
||||
rec[ "uncompress" ] = "";
|
||||
}
|
||||
}
|
||||
else if ( action == "toDeliverArgs" )
|
||||
{
|
||||
temp = rec[ "install_target" ];
|
||||
m = n = index( temp, "/" );
|
||||
while ( n != 0 )
|
||||
{
|
||||
temp = substr( temp, n+1 );
|
||||
n = index( temp, "/" );
|
||||
m += n;
|
||||
}
|
||||
dirnametarget = substr( rec[ "install_target" ], 1, m-1 );
|
||||
|
||||
if ( length( rec[ "install_target" ] ) > 40 )
|
||||
{
|
||||
printf("%s -d .%s\n", rec[ "install_target" ], dirnametarget );
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("%-40s -d .%s\n", rec[ "install_target" ], dirnametarget );
|
||||
}
|
||||
}
|
||||
else if ( action == "toCheckBuild" )
|
||||
{
|
||||
# print "Entering printRecord - toCheckBuild: "
|
||||
#
|
||||
# skip any link info
|
||||
#
|
||||
if ( rec[ "type" ] == "file" )
|
||||
{
|
||||
#
|
||||
# just print the source path for the checker tool
|
||||
#
|
||||
printf("%s\n", src );
|
||||
}
|
||||
}
|
||||
else if ( action == "toFileList" )
|
||||
{
|
||||
#
|
||||
# skip any link info
|
||||
#
|
||||
if ( rec[ "type" ] == "file" )
|
||||
{
|
||||
#
|
||||
# print the source and install_target for the human person
|
||||
#
|
||||
if ( length( src ) > 40 || length( rec[ "install_target" ] ) > 40 )
|
||||
{
|
||||
printf("%s -> %s %s\n", src,
|
||||
rec[ "install_target" ], rec[ "mode" ] );
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("%-40s -> %-40s %s\n", src,
|
||||
rec[ "install_target" ], rec[ "mode" ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( action == "toTargetList" )
|
||||
{
|
||||
#
|
||||
# skip any link info
|
||||
#
|
||||
if ( rec[ "type" ] == "file" )
|
||||
{
|
||||
#
|
||||
# just print the install_target
|
||||
#
|
||||
printf("%s\n", rec[ "install_target" ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
437
cde/admin/IntegTools/dbTools/udbToAny.ksh
Executable file
437
cde/admin/IntegTools/dbTools/udbToAny.ksh
Executable file
@@ -0,0 +1,437 @@
|
||||
#!/bin/ksh
|
||||
|
||||
# -------------------------------------------------------------
|
||||
# udbToAny.ksh
|
||||
#
|
||||
# This script was leveraged from "databaseConversionTool.ksh"
|
||||
# it should provide a superset of the functionality of that script;
|
||||
# however the primary motivation was to get away from the use of
|
||||
# multiple divergent parsers for the ".udb" style database. The
|
||||
# parser has been moved into an awk "library" file: udbParseLib.awk.
|
||||
# this parser can and should be used by all scripts wishing to parse
|
||||
# the ".udb" data bases.
|
||||
#
|
||||
# ----------------------------
|
||||
# new features:
|
||||
#
|
||||
# -toDB to convert to old mksubmit-style ".db" format
|
||||
# -toLst to convert to old domain-port-style ".lst" files
|
||||
# -toCustom <prt> to specify a print routine for a custom format
|
||||
# -custom <awklib> to specify a library containing custom print routines.
|
||||
# -udbParseLib <awkLib> to specify a library containing an alternate parser.
|
||||
# -mailTo <user> to specify an administrator who will receive mail
|
||||
# concerning parsing errors.
|
||||
#
|
||||
# -Database is now obsolete (although it will still work)
|
||||
# <udbfile> ... ... The script can now take multiple udb files (Only the
|
||||
# defaults specified in the first udb file will apply).
|
||||
#
|
||||
# ----------------------------
|
||||
#
|
||||
# This script converts a universal database to an
|
||||
# HP OSF style System Definition Database (SDD) file,
|
||||
# or a set of args suitable to supply to the Chelmsford deliver
|
||||
# tool, or a set of commands to build a delivery tree.
|
||||
# For more details, please refer to the "X11 and VUE for HP_OSF/1.0"
|
||||
# document.
|
||||
#
|
||||
# This script was leveraged (read hacked extensively) from
|
||||
# the "udbToDb" script by Jim Andreas. Ron Voll authored the
|
||||
# original "udbToDb" script.
|
||||
#
|
||||
# -------------------------------------------------------------
|
||||
|
||||
# usage: databaseToSDD.ksh Option udbFile
|
||||
#
|
||||
# where Option is one of the following:
|
||||
#
|
||||
# -toDB convert a .udb to ".db" format
|
||||
# -toLst convert a .udb to ".lst" format
|
||||
# -toSDD convert a .udb to SDD format
|
||||
# -toDeliverArgs convert a .udb to args that the deliver tool likes
|
||||
# -toReleaseTree convert a .udb to a script to build a delivery tree
|
||||
# -toCheckBuild convert a .udb to a script to check the items in a build
|
||||
# -toFileList convert a .udb to a list of files for carbon units
|
||||
# -Machine specifies 3,7,8 for hp-ux releases
|
||||
# -ReleaseStream {hp-ux, osf, whatever}
|
||||
# -NoDefaults do not convert any records labeled default
|
||||
# -toTargetList convert a .udb to a list of target files in product tree
|
||||
# the leading path is stripped and just the target
|
||||
# file is left - for easy diffing with some other
|
||||
# version of a release
|
||||
# -custom <awkFile> Supply a custom "awk" print library
|
||||
# -toCustom <prt routine>
|
||||
# -udbParseLib <awkFile> Supply an alternate "awk" parser library
|
||||
|
||||
|
||||
# -------------------------------------------------------------
|
||||
# ConvertRoutine
|
||||
#
|
||||
# This ksh function invokes awk to do all of the dirty
|
||||
# work. The DoAction variable is consulted only in the
|
||||
# final stages of printing the desired info after the
|
||||
# .udb "phrases" are parsed.
|
||||
#
|
||||
# -------------------------------------------------------------
|
||||
ConvertRoutine()
|
||||
{
|
||||
|
||||
|
||||
#
|
||||
# set what we are going to do
|
||||
#
|
||||
typeset DoAction=$1
|
||||
|
||||
#
|
||||
# set the "release stream" or token in a block in the .udb
|
||||
# file for which we will scan.
|
||||
#
|
||||
typeset BlockToken=$2
|
||||
|
||||
#
|
||||
# and for HP-UX releases, the particular machine 68k/Snake/S800 3/7/8
|
||||
#
|
||||
typeset machine=$3
|
||||
#
|
||||
# set flag if default blocks are to be processed
|
||||
#
|
||||
typeset UseDefaultBlocks=$4
|
||||
|
||||
shift
|
||||
shift
|
||||
shift
|
||||
shift
|
||||
|
||||
AWK=/usr/bin/awk
|
||||
if [ -x /usr/bin/nawk ]; then
|
||||
AWK=/usr/bin/nawk
|
||||
fi
|
||||
|
||||
#
|
||||
# Custom print routines may use the following parser variables:
|
||||
# defOrder[] --- An array containing the names of the fields in
|
||||
# a data base record (in the correct order).
|
||||
# NumEntries --- One MORE than the number of entries in the
|
||||
# "defOrder" array. This is the number of fields
|
||||
# in a data base record.
|
||||
# rec[] --- An associative array indexed by data base record
|
||||
# field name containing the value of the field.
|
||||
#
|
||||
# Assign custom print routines to be used for output. The default is to
|
||||
# use the "printDb" function associated with the library.
|
||||
#
|
||||
|
||||
typeset PRT=printDb
|
||||
case "$DoAction" in
|
||||
toDB)
|
||||
PRT=printDb
|
||||
;;
|
||||
toLst)
|
||||
PRT=printLst
|
||||
;;
|
||||
toFileList|toTargetList|toCheckBuild|toReleaseTree|toDeliverArgs|toSDD)
|
||||
PRT=printGather;
|
||||
;;
|
||||
toCustom)
|
||||
CUSTOM_PRINT="-f $CUSTOM_PRINT_LIB"
|
||||
PRT=$CUS_PRT
|
||||
;;
|
||||
*) # Unknown Action
|
||||
echo "$0: Unknown Action>> \"$doAction\""
|
||||
exit 1;
|
||||
;;
|
||||
esac
|
||||
|
||||
cat > /tmp/awk$$ <<EOF
|
||||
#
|
||||
# The function name "PRTREC" is used by the parsing routines
|
||||
# to do the output. By providing a custom output function you
|
||||
# can print the database any way you want. The default is to
|
||||
# use the "printRecord" function built defined in the awk file
|
||||
# containing the awk parser.
|
||||
#
|
||||
function PRTREC(rec) {
|
||||
$PRT(rec)
|
||||
}
|
||||
BEGIN {
|
||||
parseUdb()
|
||||
}
|
||||
{
|
||||
print "Getting New Line AWK style -- Problem?"
|
||||
exit 1
|
||||
}
|
||||
EOF
|
||||
|
||||
#
|
||||
# Create a single awk file for use with the "-f" parameter.
|
||||
# IBM's awk only allows one "-f"
|
||||
#
|
||||
cat "$UDB_PARSE_LIB" >> /tmp/awk$$
|
||||
[ -z "$CUSTOM_PRINT" ] || cat "$CUSTOM_PRINT_LIB" >> /tmp/awk$$
|
||||
|
||||
$AWK -v mailTo="$Administrator" \
|
||||
-v action="$DoAction" \
|
||||
-v BlockToken="$BlockToken" \
|
||||
-v Machine="$machine" \
|
||||
-v UseDefaultBlocks="$UseDefaultBlocks" \
|
||||
-v DeBugFile="$DEBUGFILE" \
|
||||
-v DeBug="$DEBUGLEVEL" \
|
||||
-f /tmp/awk$$ $*
|
||||
|
||||
|
||||
#
|
||||
# Removed from parameter list because IBM's awk only allows one "-f"
|
||||
# $CUSTOM_PRINT \
|
||||
# -f "$UDB_PARSE_LIB" \
|
||||
#
|
||||
|
||||
rm /tmp/awk$$
|
||||
}
|
||||
|
||||
#
|
||||
# print a handy usage message to stderr (file descriptor 2 )
|
||||
#
|
||||
#
|
||||
usage()
|
||||
{
|
||||
exec >&2
|
||||
|
||||
echo "$ScriptName: usage:"
|
||||
echo ""
|
||||
echo " $ScriptName [Options] <UdbFile> ..."
|
||||
echo ""
|
||||
echo " -toDB convert a .udb to \".db\" format"
|
||||
echo " -toLst convert a .udb to \".lst\" format"
|
||||
echo " -toSDD convert a .udb to SDD format"
|
||||
echo " -toDeliverArgs convert a .udb to args that the deliver tool likes"
|
||||
echo " -toReleaseTree convert a .udb to a script to build a delivery tree"
|
||||
echo " -toCheckBuild convert a .udb to a script to check a build"
|
||||
echo " -toFileList convert a .udb to a list of files"
|
||||
echo " -toTargetList convert a .udb to a list of product files"
|
||||
echo " -ReleaseStream {hp-ux, osf, whatever}"
|
||||
echo " -Machine specifies machine 3,7,8 for hp-ux"
|
||||
echo " -NoDefaults do not convert any records labeled \"default\""
|
||||
echo " -Database path (obsolete) specifies full path to the .udb file to convert"
|
||||
echo " -mailTo <user> Specify a user to receive mail on errors."
|
||||
echo " -toCustom <prt> Specify the name of a custom print routine."
|
||||
echo " -custom <awkFile> Supply a custom "awk" print library."
|
||||
echo " -udbParseLib <awkFile> Supply an alternate 'awk' parser library"
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
# OK, here is where we really start execution.
|
||||
# Check that the first argument defines what this script is
|
||||
# supposed to do:
|
||||
|
||||
# Obscurity footprint-in-the-sand: "${1##*/}" is equivalent
|
||||
# to basename(1)
|
||||
#
|
||||
ScriptName=${0##*/}
|
||||
|
||||
# -toSDD convert a .udb to SDD format
|
||||
# -toDeliverArgs convert a .udb to args that the deliver tool likes
|
||||
# -toReleaseTree convert a .udb to a script to build a delivery tree
|
||||
# -toCheckBuild convert a .udb to a script to check the items in a build
|
||||
|
||||
if [ $# -le 3 ]; then
|
||||
usage $0
|
||||
fi
|
||||
|
||||
typeset TakeDefaultBlocks="Y"
|
||||
typeset Administrator=""
|
||||
#typeset DBTOOLSRC=/x/toolsrc/dbTools
|
||||
typeset DBTOOLSRC=`dirname $0`
|
||||
typeset UDB_PARSE_LIB="$DBTOOLSRC/udbParseLib.awk"
|
||||
typeset CUSTOM_PRINT_LIB=""
|
||||
typeset DEBUGFILE="/dev/tty"
|
||||
typeset DEBUGLEVEL=0
|
||||
|
||||
if [ $# -gt 2 ]; then
|
||||
while [ $# -gt 0 ]
|
||||
do
|
||||
case $1 in
|
||||
-NoDefaults)
|
||||
TakeDefaultBlocks=N
|
||||
shift
|
||||
continue
|
||||
;;
|
||||
-toDB)
|
||||
Action=toDB
|
||||
shift;
|
||||
continue;
|
||||
;;
|
||||
-toLst)
|
||||
Action=toLst
|
||||
shift;
|
||||
continue;
|
||||
;;
|
||||
-toSDD)
|
||||
Action=toSDD
|
||||
shift
|
||||
continue
|
||||
;;
|
||||
-toDeliverArgs)
|
||||
Action=toDeliverArgs
|
||||
shift
|
||||
continue
|
||||
;;
|
||||
-toReleaseTree)
|
||||
Action=toReleaseTree
|
||||
shift
|
||||
continue
|
||||
;;
|
||||
-toCheckBuild)
|
||||
Action=toCheckBuild
|
||||
shift
|
||||
continue
|
||||
;;
|
||||
-toTargetList)
|
||||
Action=toTargetList
|
||||
shift
|
||||
continue
|
||||
;;
|
||||
-toFileList)
|
||||
Action=toFileList
|
||||
shift
|
||||
continue
|
||||
;;
|
||||
-Machine)
|
||||
if [ "x$2" = "x" ]; then
|
||||
usage
|
||||
fi
|
||||
Machine=$2
|
||||
shift
|
||||
shift
|
||||
continue
|
||||
;;
|
||||
-ReleaseStream)
|
||||
if [ "x$2" = "x" ]; then
|
||||
usage
|
||||
fi
|
||||
ReleaseStream=$2
|
||||
shift
|
||||
shift
|
||||
continue
|
||||
;;
|
||||
-Database)
|
||||
if [ "x$2" = "x" ]; then
|
||||
usage
|
||||
fi
|
||||
if [ ! -r "$2" ]; then
|
||||
usage
|
||||
fi
|
||||
Database="$Database $2"
|
||||
shift
|
||||
shift
|
||||
continue
|
||||
;;
|
||||
-udbParseLib) # specify alternate "awk" parser location
|
||||
if [ "x$2" = "x" ]; then
|
||||
usage
|
||||
fi
|
||||
if [ ! -r "$2" ]; then
|
||||
usage
|
||||
fi
|
||||
UDB_PARSE_LIB=$2
|
||||
shift
|
||||
shift
|
||||
continue
|
||||
;;
|
||||
-toCustom) # specify custom "awk" print routines
|
||||
if [ "x$2" = "x" ]; then
|
||||
usage
|
||||
fi
|
||||
Action=toCustom
|
||||
CUS_PRT=$2
|
||||
shift
|
||||
shift
|
||||
continue
|
||||
;;
|
||||
-custom) # specify custom "awk" print routines
|
||||
if [ "x$2" = "x" ]; then
|
||||
usage
|
||||
fi
|
||||
if [ ! -r "$2" ]; then
|
||||
usage
|
||||
fi
|
||||
CUSTOM_PRINT_LIB=$2
|
||||
shift
|
||||
shift
|
||||
continue
|
||||
;;
|
||||
-mailTo) # specify an administrator who receives mail about errors.
|
||||
if [ "x$2" = "x" ]; then
|
||||
usage
|
||||
fi
|
||||
Administrator=$2
|
||||
shift
|
||||
shift
|
||||
continue
|
||||
;;
|
||||
-DeBugFile) # specify a debug file and debug level for parser debug info
|
||||
if [ "x$2" = "x" ]; then
|
||||
usage
|
||||
fi
|
||||
if [ "x$3" = "x" ]; then
|
||||
usage
|
||||
fi
|
||||
DEBUGFILE=$2
|
||||
shift 2
|
||||
continue
|
||||
;;
|
||||
-DeBugLevel) # specify a debug level for parser debug info
|
||||
if [ "x$2" = "x" ]; then
|
||||
usage
|
||||
fi
|
||||
if [ "x$3" = "x" ]; then
|
||||
usage
|
||||
fi
|
||||
DEBUGLEVEL=$2
|
||||
shift 2
|
||||
continue
|
||||
;;
|
||||
-*)
|
||||
echo "unknown option: $1"
|
||||
echo ""
|
||||
usage
|
||||
exit 1;
|
||||
;;
|
||||
*) if [ ! -r $1 ]; then
|
||||
usage
|
||||
fi
|
||||
Database="$Database $1"
|
||||
shift;
|
||||
;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
if [ "$Action" = "toCustom" ]; then
|
||||
if [ -z "$CUSTOM_PRINT_LIB" ]; then
|
||||
echo "You Must specify an awk file containing the custom print routine \"$CUS_PRT\""
|
||||
exit 1;
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if [ "$Machine" = "" ]; then
|
||||
Machine=NA
|
||||
elif [ "$Machine" = "300" ]; then
|
||||
Machine="3"
|
||||
elif [ "$Machine" = "700" ]; then
|
||||
Machine="7"
|
||||
elif [ "$Machine" = "800" ]; then
|
||||
Machine="8"
|
||||
fi
|
||||
if [ "$ReleaseStream" = "" ]; then
|
||||
echo "$ScriptName: need to specify a -ReleaseStream" >&2
|
||||
exit 1
|
||||
fi
|
||||
if [ "$Database" = "" ]; then
|
||||
echo "$ScriptName: need to specify a -Database" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
ConvertRoutine $Action $ReleaseStream $Machine $TakeDefaultBlocks $Database
|
||||
9
cde/admin/IntegTools/dbTools/uncomment
Executable file
9
cde/admin/IntegTools/dbTools/uncomment
Executable file
@@ -0,0 +1,9 @@
|
||||
#! /bin/ksh
|
||||
|
||||
#
|
||||
# Script to remove comments and blank lines from ".lst" files
|
||||
# and coalesce multiple blanks/tabs into a single blank
|
||||
#
|
||||
|
||||
cat $@ | egrep -v '^[ ]*#|^[ ]*$' | sed 's/[ ][ ]*/ /g'|\
|
||||
sed 's/ $//'
|
||||
Reference in New Issue
Block a user