Martin Schaffstall wrote: > The following patch enables ksh on Solaris/SunOS to source > /etc/ksh.kshrc for interactive logins like it is done on Linux: > #####CUT#HERE########CUT#HERE########CUT#HERE#### > --- ./src/cmd/ksh93/features/options Fri Mar 25 21:37:14 2005 > +++ ./src/cmd/ksh93/features/options Mon Jul 10 14:06:36 2006 > @@ -33,7 +33,7 @@ > option PFSH $? > /bin/test ! -l . 2> /dev/null > option TEST_L $? > - test -f /etc/ksh.kshrc -o -f /etc/bash.bashrc && > + test -f /etc/ksh.kshrc -o -f /etc/bash.bashrc -o "`uname -s`" > = "SunOS" && > option SYSRC 0 > test -f /bin/universe && univ=`/bin/universe` > /dev/null 2>&1 > -a ucb = "$univ" > option UCB $? > #####CUT#HERE########CUT#HERE########CUT#HERE####
I've commited http://polaris.blastwave.org/changeset/318 to enable SHOPT_SYSRC and add /etc/ksh.kshrc (April: yes, I know... I shouldn't add new stuff - but this was a cheap way to enable a default editor mode (which was one of the top features requested) without violating the POSIX standards). The original patch (attached here as "ksh93_ksh_kshrc_and_bash_bashrc_prototype_diff.txt" for reference) also added /etc/bash.bashrc and made it a softlink to /etc/ksh.kshrc, copying the default used on other operating systems (such as Linux and *BSD variants) - but after some discussion with Mike Kupfer I removed the bash parts as this should be part of another RFE (which may include adding support for /etc/sh.shrc to the bourne shell (and then makes /etc/ksh.kshrc and /etc/bash.bashrc soft links to /etc/sh.shrc (because it is usefull to have ONE configuration file for these shells instead of three))). The downside is that this will require another fight with ARC... ;-(( ---- Bye, Roland -- __ . . __ (o.\ \/ /.o) roland.mainz at nrubsig.org \__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer /O /==\ O\ TEL +49 641 7950090 (;O/ \/ \O;) -------------- next part -------------- Index: src/pkgdefs/SUNWcsr/prototype_com =================================================================== --- src/pkgdefs/SUNWcsr/prototype_com (revision 315) +++ src/pkgdefs/SUNWcsr/prototype_com (working copy) @@ -216,6 +216,8 @@ d none etc/opt 755 root sys e passwd etc/passwd 644 root sys e etcprofile etc/profile 644 root sys +e renameold etc/ksh.kshrc 644 root sys +s none etc/bash.bashrc=./ksh.kshrc e preserve etc/project 644 root sys s none etc/protocols=./inet/protocols s none etc/prtconf=../usr/sbin/prtconf Index: src/cmd/ksh/Makefile.com =================================================================== --- src/cmd/ksh/Makefile.com (revision 315) +++ src/cmd/ksh/Makefile.com (working copy) @@ -74,6 +74,7 @@ -DSHOPT_RAWONLY \ -DSHOPT_SUID_EXEC \ -DSHOPT_VSH \ + -DSHOPT_SYSRC \ -D_BLD_shell \ -D_PACKAGE_ast \ '-DUSAGE_LICENSE="[-author?David Korn <dgk at research.att.com>][-copyright?Copyright (c) 1982-2006 AT&T Knowledge Ventures][-license?http://www.opensource.org/licenses/cpl1.0.txt][--catalog?libshell]"' Index: src/cmd/nsadmin/profile =================================================================== --- src/cmd/nsadmin/profile (revision 315) +++ src/cmd/nsadmin/profile (working copy) @@ -41,7 +41,7 @@ # -rsh is given its environment in its .profile. case "$0" in --sh | -ksh | -jsh | -bash) +-sh | -ksh | -ksh93 | -jsh | -bash) if [ ! -f .hushlogin ] then Index: src/cmd/nsadmin/Makefile =================================================================== --- src/cmd/nsadmin/Makefile (revision 315) +++ src/cmd/nsadmin/Makefile (working copy) @@ -22,10 +22,10 @@ # #ident "@(#)Makefile 1.9 05/06/08 SMI" # -# Copyright (c) 1989, 2001 by Sun Microsystems, Inc. +# Copyright (c) 1989, 2001, 2006 by Sun Microsystems, Inc. # All rights reserved. -PROG= profile .login system +PROG= profile .login ksh.kshrc bash.bashrc system PROGSKEL= local.login local.profile local.cshrc include ../Makefile.cmd @@ -39,6 +39,14 @@ .login: login.csh $(RM) .login; $(CP) login.csh .login +bash.bashrc: ksh.kshrc + +# Custom install rule to make /etc/bash.bashrc a link to /etc/ksh.kshrc +# like other Unix versions do +$(ROOT)/etc/bash.bashrc: + $(RM) $(ROOT)/etc/bash.bashrc + $(SYMLINK) ksh.kshrc $(ROOT)/etc/bash.bashrc + .KEEP_STATE: all: $(PROG) $(PROGSKEL) Index: src/cmd/nsadmin/ksh.kshrc =================================================================== --- src/cmd/nsadmin/ksh.kshrc (revision 0) +++ src/cmd/nsadmin/ksh.kshrc (revision 0) @@ -0,0 +1,32 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License, Version 1.0 only +# (the "License"). You may not use this file except in compliance +# with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +#ident "@(#)ksh.kshrc 1.1 06/06/10 SMI" + +# this file is sourced by interactive ksh93 and bash shells + +# test whether this shell is a ksh93 derivate +if [ "$((echo ${.sh.version}) 2>/dev/null)" != "" ] ; then + # enable gmacs editor mode by default for ksh93 + set -o gmacs +fi + +#EOF. Index: src/lib/libshell/Makefile.com =================================================================== --- src/lib/libshell/Makefile.com (revision 315) +++ src/lib/libshell/Makefile.com (working copy) @@ -152,6 +152,7 @@ -DSHOPT_RAWONLY \ -DSHOPT_SUID_EXEC \ -DSHOPT_VSH \ + -DSHOPT_SYSRC \ -D_BLD_shell \ -D_PACKAGE_ast \ '-DUSAGE_LICENSE="[-author?David Korn <dgk at research.att.com>][-copyright?Copyright (c) 1982-2006 AT&T Knowledge Ventures][-license?http://www.opensource.org/licenses/cpl1.0.txt][--catalog?libshell]"'
