1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00
cde/cde/admin/IntegTools/dbTools/dinstallCDE.src
Marcin Cieslak 17a33f0430 Use KORNSHELL variable instead of /bin/ksh
This patch removes instances of hardcoded
invocation of /bin/ksh and allows to
replace it with, for, example,
/usr/local/bin/ksh93

Also "ksh93" is accepted whenever "ksh" is.

Tested using the following /bin/ksh:

----8<----
WHAT=`ps -o command= -p $PPID`
msg="Something tried to call /bin/ksh: $PPID: $WHAT"
print -u2 "$msg"
logger user.warn "$msg"
exit 99
----8<----
(Warning: first two lines are FreeBSD specific)

Scripts from Makefiles should now be executed either
with

$(KORNSHELL) korn-shell-script

or

$(SHELL) bourne-shell-script

therefore #!/bin/ksh has not been changed everywhere.

/usr/dt/bin/ scripts have been converted (e.g. Xsession)

Whenever possible Imake and CPP facilities have been used.

For C and C++ programs KORNSHELL needs to be defined to
"/path/to/your/ksh" (with quotes) so that it can make
a valid C constant.

Therefore, when adding KORNSHELL to Imakefile for C files,
you have to add

CXXEXTRA_DEFINES = -DKORNSHELL=\"$(KORNSHELL)\"

or similar (for example, see programs/dtprintinfo)

But for simple shell script substitution we usually change

 LOCAL_CPP_DEFINES = -DCDE_CONFIGURATION_TOP=$(CDE_CONFIGURATION_TOP) \
                     -DCDE_INSTALLATION_TOP=$(CDE_INSTALLATION_TOP) \
                     -DCDE_LOGFILES_TOP=$(CDE_LOGFILES_TOP)

to:

 LOCAL_CPP_DEFINES = -DCDE_CONFIGURATION_TOP=$(CDE_CONFIGURATION_TOP) \
                     -DCDE_INSTALLATION_TOP=$(CDE_INSTALLATION_TOP) \
                     -DCDE_LOGFILES_TOP=$(CDE_LOGFILES_TOP) \
                     -DKORNSHELL=$(KORNSHELL) \
                     -DXPROJECTROOT=X11ProjectRoot

since we don't want quotes for shell scripts.
2012-08-23 20:00:43 -06:00

311 lines
8 KiB
Text
Executable file

XCOMM! KORNSHELL
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"
KORNSHELL $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"
KORNSHELL $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 ""