From 0411196331c3afde4a080553c2bc9b27b3f14d4a Mon Sep 17 00:00:00 2001 From: Toomas Soome Date: Fri, 4 Mar 2016 20:35:11 +0200 Subject: [PATCH] 6723 etc/skel needs cleanup 2931 PS1 prompt in default user .profile is incorrect Reviewed by: Andrew Stormont Reviewed by: Lauri Tirkkonen Reviewed by: Gordon Ross --- usr/src/cmd/login/login.dfl | 9 ++++++--- usr/src/cmd/nsadmin/Makefile | 10 +++++++--- usr/src/cmd/nsadmin/bashrc.sh | 4 +--- usr/src/cmd/nsadmin/dot-kshrc.sh | 11 +++++++++++ usr/src/cmd/nsadmin/dot-profile.sh | 30 ++++++++++++++---------------- usr/src/cmd/nsadmin/etc-profile.sh | 22 ++++++++++++++++++---- usr/src/cmd/nsadmin/local.cshrc | 29 ----------------------------- usr/src/cmd/nsadmin/local.login | 27 --------------------------- usr/src/cmd/nsadmin/local.profile | 28 ---------------------------- usr/src/pkg/manifests/SUNWcs.mf | 5 ++--- 10 files changed, 59 insertions(+), 116 deletions(-) create mode 100644 usr/src/cmd/nsadmin/dot-kshrc.sh rewrite usr/src/cmd/nsadmin/dot-profile.sh (75%) delete mode 100644 usr/src/cmd/nsadmin/local.cshrc delete mode 100644 usr/src/cmd/nsadmin/local.login delete mode 100644 usr/src/cmd/nsadmin/local.profile diff --git a/usr/src/cmd/login/login.dfl b/usr/src/cmd/login/login.dfl index 4b11830230..13ecd51113 100644 --- a/usr/src/cmd/login/login.dfl +++ b/usr/src/cmd/login/login.dfl @@ -47,12 +47,15 @@ PASSREQ=YES ALTSHELL=YES # PATH sets the initial shell PATH variable -# -#PATH=/usr/bin: +# sample with GNU tools in front of the path +# PATH=/usr/gnu/bin:/usr/bin:/usr/sbin:/sbin +# sample with XPG4 tools in front of the path +# PATH=/usr/xpg4/bin:/usr/bin:/usr/sbin:/sbin +PATH=/usr/bin:/usr/sbin:/sbin:/usr/gnu/bin # SUPATH sets the initial shell PATH variable for root # -#SUPATH=/usr/sbin:/usr/bin +SUPATH=/usr/sbin:/sbin:/usr/bin # TIMEOUT sets the number of seconds (between 0 and 900) to wait before # abandoning a login session. diff --git a/usr/src/cmd/nsadmin/Makefile b/usr/src/cmd/nsadmin/Makefile index 620aa978e4..ad8f48a00e 100644 --- a/usr/src/cmd/nsadmin/Makefile +++ b/usr/src/cmd/nsadmin/Makefile @@ -24,7 +24,7 @@ # PROG= profile .login ksh.kshrc system -PROGSKEL= local.login local.profile local.cshrc .profile +PROGSKEL= .profile .bashrc .kshrc PROGROOT= .profile .bashrc include ../Makefile.cmd @@ -35,10 +35,10 @@ ROOTETCSKELPROG= $(PROGSKEL:%=$(ROOTETCSKEL)/%) ROOTROOTPROG= $(PROGROOT:%=$(ROOTROOT)/%) FILEMODE= 0644 -CLOBBERFILES = profile .bashrc .profile .login +CLOBBERFILES = profile .bashrc .profile .login .kshrc .login: login.csh - $(RM) .login; + $(RM) .login $(CP) login.csh .login profile: etc-profile.sh @@ -49,6 +49,10 @@ profile: etc-profile.sh $(RM) .profile $(CP) dot-profile.sh $@ +.kshrc: dot-kshrc.sh + $(RM) .kshrc + $(CP) dot-kshrc.sh $@ + .bashrc: bashrc.sh $(RM) .bashrc $(CP) bashrc.sh $@ diff --git a/usr/src/cmd/nsadmin/bashrc.sh b/usr/src/cmd/nsadmin/bashrc.sh index 128f6b79d7..938b0da67e 100644 --- a/usr/src/cmd/nsadmin/bashrc.sh +++ b/usr/src/cmd/nsadmin/bashrc.sh @@ -2,6 +2,4 @@ # Define default prompt to @:<"($|#) "> # and print '#' for user "root" and '$' for normal users. # -PS1='${LOGNAME}@$(/usr/bin/hostname):$( - [[ "${LOGNAME}" == "root" ]] && printf "%s" "${PWD/${HOME}/~}# " || - printf "%s" "${PWD/${HOME}/~}\$ ")' +typeset +x PS1="\u@\h:\w\\$ " diff --git a/usr/src/cmd/nsadmin/dot-kshrc.sh b/usr/src/cmd/nsadmin/dot-kshrc.sh new file mode 100644 index 0000000000..0ba420ac58 --- /dev/null +++ b/usr/src/cmd/nsadmin/dot-kshrc.sh @@ -0,0 +1,11 @@ +# +# Sample kshrc. Used by ksh for interactive invocations, processed after +# /etc/ksh.kshrc +# + +# alias h='fc -l | more' # View history nicely +# alias logout=exit # Another way to exit +# alias rm='rm -i' # Confirm file removal +# alias del='rm -i' # Confirm file removal +# alias lsf='ls -CF' # List files in nice format +# alias ll='ls -l' # List files in long format diff --git a/usr/src/cmd/nsadmin/dot-profile.sh b/usr/src/cmd/nsadmin/dot-profile.sh dissimilarity index 75% index 33a79c97b2..a45e47b58d 100644 --- a/usr/src/cmd/nsadmin/dot-profile.sh +++ b/usr/src/cmd/nsadmin/dot-profile.sh @@ -1,16 +1,14 @@ -# -# Simple profile places /usr/gnu/bin at front, -# adds /usr/X11/bin, /usr/sbin and /sbin to the end. -# -# Use less(1) as the default pager for the man(1) command. -# -export PATH=/usr/gnu/bin:/usr/bin:/usr/sbin:/sbin -export PAGER="/usr/bin/less -ins" - -# -# Define default prompt to @:<"($|#) "> -# and print '#' for user "root" and '$' for normal users. -# -PS1='${LOGNAME}@$(/usr/bin/hostname):$( - [[ "${LOGNAME}" == "root" ]] && printf "%s" "${PWD/${HOME}/~}# " || - printf "%s" "${PWD/${HOME}/~}\$ ")' +# +# Uncommenting PATH below will place /usr/gnu/bin at front, +# adds /usr/sbin and /sbin to the end. +# +# export PATH=/usr/gnu/bin:/usr/bin:/usr/sbin:/sbin +# +# Define default prompt to @:<"($|#) "> +# and print '#' for user "root" and '$' for normal users. +# +# override default prompt for bash +# case "$0" in +# -bash) +# export PS1="\u@\h:\w\\$ " +# esac diff --git a/usr/src/cmd/nsadmin/etc-profile.sh b/usr/src/cmd/nsadmin/etc-profile.sh index a74965d21a..035e8a3025 100644 --- a/usr/src/cmd/nsadmin/etc-profile.sh +++ b/usr/src/cmd/nsadmin/etc-profile.sh @@ -37,10 +37,24 @@ then export TERM fi +# +# use less(1) as the default pager for the man(1) command. +# +PAGER="/usr/bin/less -ins" +export PAGER + # Login and -su shells get /etc/profile services. # -rsh is given its environment in its .profile. case "$0" in +-bash) + # set prompt for bash + PS1="\u@\h:\w\\$ " + export PS1 + ;; +esac + +case "$0" in -sh | -ksh | -ksh93 | -jsh | -bash | -zsh) if [ ! -f .hushlogin ] @@ -53,12 +67,12 @@ case "$0" in /bin/mail -E case $? in - 0) + 0) echo "You have new mail." - ;; - 2) + ;; + 2) echo "You have mail." - ;; + ;; esac fi esac diff --git a/usr/src/cmd/nsadmin/local.cshrc b/usr/src/cmd/nsadmin/local.cshrc deleted file mode 100644 index 38894ca5b9..0000000000 --- a/usr/src/cmd/nsadmin/local.cshrc +++ /dev/null @@ -1,29 +0,0 @@ -# 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 -# -# Copyright 2000 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -#ident "%Z%%M% %I% %E% SMI" -umask 022 -set path=(/bin /usr/bin /usr/ucb /etc .) -if ( $?prompt ) then - set history=32 -endif diff --git a/usr/src/cmd/nsadmin/local.login b/usr/src/cmd/nsadmin/local.login deleted file mode 100644 index d636b45594..0000000000 --- a/usr/src/cmd/nsadmin/local.login +++ /dev/null @@ -1,27 +0,0 @@ -# -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# 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 "%Z%%M% %I% %E% SMI" -stty -istrip -# setenv TERM `tset -Q -` diff --git a/usr/src/cmd/nsadmin/local.profile b/usr/src/cmd/nsadmin/local.profile deleted file mode 100644 index a85bb9ace1..0000000000 --- a/usr/src/cmd/nsadmin/local.profile +++ /dev/null @@ -1,28 +0,0 @@ -# -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# 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 "%Z%%M% %I% %E% SMI" -stty istrip -PATH=/usr/bin:/usr/ucb:/etc:. -export PATH diff --git a/usr/src/pkg/manifests/SUNWcs.mf b/usr/src/pkg/manifests/SUNWcs.mf index 0bdd8d02d3..31ef812084 100644 --- a/usr/src/pkg/manifests/SUNWcs.mf +++ b/usr/src/pkg/manifests/SUNWcs.mf @@ -435,10 +435,9 @@ file path=etc/security/prof_attr group=sys preserve=true \ timestamp=19700101T000000Z file path=etc/security/prof_attr.d/SUNWcs group=sys file path=etc/shadow group=sys mode=0400 preserve=true +file path=etc/skel/.bashrc group=other preserve=true +file path=etc/skel/.kshrc group=other preserve=true file path=etc/skel/.profile group=other preserve=true -file path=etc/skel/local.cshrc group=sys preserve=true -file path=etc/skel/local.login group=sys preserve=true -file path=etc/skel/local.profile group=sys preserve=true file path=etc/svc/profile/generic_limited_net.xml group=sys mode=0444 file path=etc/svc/profile/generic_open.xml group=sys mode=0444 file path=etc/svc/profile/inetd_generic.xml group=sys mode=0444 -- 2.11.4.GIT