1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

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.
This commit is contained in:
Marcin Cieslak 2012-08-23 17:49:26 +02:00 committed by Jon Trulson
parent 98b17d3551
commit 17a33f0430
32 changed files with 63 additions and 40 deletions

View file

@ -3,6 +3,7 @@ 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) \
-DKORNSHELL=$(KORNSHELL) \
-Usun -Uusl -Uuxp -Uaix -Udec -UAIX -Uibm -Uhp
AllTarget(installCDE dinstallCDE)

View file

@ -1,4 +1,4 @@
XCOMM! /bin/ksh
XCOMM! KORNSHELL
XCOMM $XConsortium: dinstallCDE.src /main/8 1996/11/25 14:20:36 drk $
XCOMM
@ -71,12 +71,12 @@ DoLangScript()
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 | \
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"
$POST_INSTALL_DIR/$ScriptName -d $3 2>&1 | tee -a /tmp/$ScriptName.dverify
KORNSHELL $POST_INSTALL_DIR/$ScriptName -d $3 2>&1 | tee -a /tmp/$ScriptName.dverify
fi
}

View file

@ -1,4 +1,4 @@
XCOMM! /bin/ksh
XCOMM! KORNSHELL
XCOMM $XConsortium: installCDE.src /main/20 1996/11/25 14:21:13 drk $
XCOMM
@ -154,12 +154,12 @@ DoFilesetScript()
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 | \
KORNSHELL $POST_INSTALL_DIR/$PLATFORM_SCRIPT_DIR/$ScriptName -e 2>&1 | \
tee -a $LOGFILE
elif [ -x $POST_INSTALL_DIR/$ScriptName ]
then
Log "Executing $FilesetName customize script"
$POST_INSTALL_DIR/$ScriptName -e 2>&1 | tee -a $LOGFILE
KORNSHELL $POST_INSTALL_DIR/$ScriptName -e 2>&1 | tee -a $LOGFILE
fi
fi
}
@ -182,7 +182,7 @@ CreatePackingList()
for i in `echo $DATABASE_FILES`
do
Log " for $i"
$TOOL_DIR/udbToAny.ksh -toDB -ReleaseStream $PLATFORM $DATABASE_DIR/${i}.udb > /tmp/${i}.db
KORNSHELL $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 \: `
@ -490,10 +490,10 @@ XCOMM don't bother if the fileset doesn't exist
Log " $num installing database $2"
Log " - creating ${2}.lst file"
$TOOL_DIR/udbToAny.ksh -toLst -ReleaseStream $PLATFORM \
KORNSHELL $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 \
KORNSHELL $TOOL_DIR/mkProd -D / -S $BUILD_TREE /tmp/${2}.lst \
2>/tmp/${2}.err 1>/tmp/${2}.good
Log "done."

View file

@ -1,4 +1,4 @@
#! /bin/ksh
#! /bin/sh
#
# Script to move all link refereces in a ".lst" file

View file

@ -1,4 +1,4 @@
#! /bin/ksh
#! /bin/sh
#
# Script to remove comments and blank lines from ".lst" files