Import NetBSD shell environment files

With the import of Xorg, a proper separation between login-time and sub
shell-time of the environment setup is necessary.

Instead of re-developping this from scratch, I am taking the opportunity
to import the NetBSD default environment.

Change-Id: Ib6a8fbd9c2f407ccd59be57a52ef9df21c2c9ce7
This commit is contained in:
Lionel Sambuc 2014-11-10 16:09:08 +01:00
parent 123aceb045
commit 957802cd0c
23 changed files with 322 additions and 72 deletions

View File

@ -75,6 +75,9 @@
./etc minix-sys
./etc/atf minix-sys atf
./etc/boot.cfg.default minix-sys
./etc/csh.cshrc minix-sys
./etc/csh.login minix-sys
./etc/csh.logout minix-sys
./etc/defaults minix-sys
./etc/defaults/minix.rc.conf minix-sys
./etc/defaults/rc.conf minix-sys
@ -115,6 +118,13 @@
./etc/rs.single minix-sys
./etc/services minix-sys
./etc/shells minix-sys
./etc/shrc minix-sys
./etc/skel minix-sys
./etc/skel/.cshrc minix-sys
./etc/skel/.login minix-sys
./etc/skel/.logout minix-sys
./etc/skel/.profile minix-sys
./etc/skel/.shrc minix-sys
./etc/spwd.db minix-sys
./etc/syslog.conf minix-sys
./etc/system.conf minix-sys
@ -149,8 +159,12 @@
./mnt minix-sys
./proc minix-sys
./root minix-sys
./root/.exrc minix-sys
./root/.cshrc minix-sys
./root/.exrc minix-sys obsolete
./root/.klogin minix-sys
./root/.login minix-sys
./root/.profile minix-sys
./root/.shrc minix-sys
./sbin minix-sys
./sbin/chown minix-sys
./sbin/fsck minix-sys
@ -200,9 +214,9 @@
./usr minix-sys
./usr/adm minix-sys
./usr/adm/old minix-sys
./usr/ast minix-sys
./usr/ast/.exrc minix-sys
./usr/ast/.profile minix-sys
./usr/ast minix-sys obsolete
./usr/ast/.exrc minix-sys obsolete
./usr/ast/.profile minix-sys obsolete
./usr/benchmarks minix-sys
./usr/benchmarks/unixbench minix-sys
./usr/benchmarks/unixbench/pgms minix-sys

View File

@ -308,7 +308,11 @@ install-etc-files: .PHONY .MAKE check_DESTDIR MAKEDEV
${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/ ${DESTDIR}/etc/ resolv.conf \
${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/ ${DESTDIR}/etc/ motd \
${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/ ${DESTDIR}/etc/ rc.conf \
${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/ ${DESTDIR}/etc/ profile
${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/ ${DESTDIR}/etc/ shrc \
${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/ ${DESTDIR}/etc/ csh.cshrc \
${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/ ${DESTDIR}/etc/ csh.login \
${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/ ${DESTDIR}/etc/ csh.logout \
${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/ ${DESTDIR}/etc/ profile
${_MKMSG_INSTALL} ${DESTDIR}${tdir}${files:T}
if [ ! -e ${tdir} ]; then \
${INSTALL_DIR} ${tdir}; \
@ -434,8 +438,6 @@ install-etc-files-safe: .PHONY .MAKE check_DESTDIR MAKEDEV
${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/devmand/ ${DESTDIR}/etc/devmand/ usb_storage.cfg \
${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/devmand/scripts/ ${DESTDIR}/etc/devmand/scripts/ block \
${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/devmand/scripts/ ${DESTDIR}/etc/devmand/scripts/ singlechar \
${BINOWN} ${BINGRP} ${NONBINMODE} ${NETBSDSRCDIR}/etc/ast/ ${DESTDIR}/usr/ast/ .[aepv]* \
${BINOWN} ${BINGRP} ${NONBINMODE} ${NETBSDSRCDIR}/etc/ast/ ${DESTDIR}/root/ .[aepv]* \
${_MKMSG_INSTALL} ${DESTDIR}${tdir}${files:T}
if [ ! -e ${tdir} ]; then \
@ -449,7 +451,7 @@ install-etc-files-safe: .PHONY .MAKE check_DESTDIR MAKEDEV
${INSTALL_FILE} -m ${BINMODE} -o ${BINOWN} -g ${BINGRP} ${NETBSDSRCDIR}/etc/rc.capes/* ${DESTDIR}/etc/rc.capes
${INSTALL_FILE} -m ${BINMODE} -o ${BINOWN} -g ${BINGRP} ${NETBSDSRCDIR}/minix/drivers/usb/usbd/usbd.conf ${DESTDIR}/etc/system.conf.d/usbd
.endif # Minix/earm specific
.for subdir in . defaults mtree
.for subdir in . defaults mtree root skel
${MAKEDIRTARGET} ${subdir} configinstall
.endfor
${_MKMSG_INSTALL} ${DESTDIR}/usr/lib/fonts

View File

@ -1 +0,0 @@
set autoindent autowrite report=2 showmatch

View File

@ -1,33 +0,0 @@
# Login shell profile.
umask 022
# Favourite editor and pager, search path for binaries, etc.
export EDITOR=vi
export PAGER=less
# Let cd display the current directory on the status line.
if [ -t 0 -a -f /usr/bin/tget ] && tget -flag hs
then
case $- in *i*)
hostname=$(expr $(uname -n) : '\([^.]*\)')
eval "cd()
{
chdir \"\$@\" &&
echo -n '$(tget -str ts \
"$USER@$hostname:'\"\`pwd\`\"'" \
-str fs)'
}"
unset hostname
cd .
;;
esac
fi
# Check terminal type.
case $TERM in
dialup|unknown|network)
echo -n "Terminal type? ($TERM) "; read term
TERM="${term:-$TERM}"
unset term
esac

3
etc/csh.cshrc Normal file
View File

@ -0,0 +1,3 @@
# $NetBSD: csh.cshrc,v 1.2 1996/05/08 17:19:27 thorpej Exp $
#
# System-wide .cshrc file for csh(1).

3
etc/csh.login Normal file
View File

@ -0,0 +1,3 @@
# $NetBSD: csh.login,v 1.2 1996/05/08 17:19:28 thorpej Exp $
#
# System-wide .login file for csh(1).

3
etc/csh.logout Normal file
View File

@ -0,0 +1,3 @@
# $NetBSD: csh.logout,v 1.2 1996/05/08 17:19:31 thorpej Exp $
#
# System-wide .logout file for csh(1).

View File

@ -38,6 +38,7 @@
./etc/fonts/conf.avail
./etc/fonts/conf.d
./etc/mtree
./etc/skel
./etc/system.conf.d
./home
./lib
@ -50,7 +51,6 @@
./usr
./usr/adm
./usr/adm/old
./usr/ast
./usr/bin
./usr/etc
./usr/benchmarks

View File

@ -1,28 +1,10 @@
# Default system-wide login shell profile.
# Activate emacs keybindings and command line history support
set -o emacs
set -o tabcomplete
# Set the default path
PATH=/usr/X11R7/bin:/usr/local/bin:/usr/pkg/bin:/usr/bin:/bin:/usr/games
# Add ~/bin, iff it is present
if [ -e ${HOME}/bin ]; then
PATH=${HOME}/bin:${PATH}
fi
# Add sbin for root
if [ "x$(id -u)" = "x0" ]; then
PATH=/usr/X11R7/sbin:/usr/local/sbin:/usr/pkg/sbin:/usr/sbin:/sbin:${PATH}
if [ -e ${HOME}/sbin ]; then
PATH=${HOME}/sbin:${PATH}
fi
fi
# $NetBSD: profile,v 1.1 1997/06/21 06:07:39 mikel Exp $
#
# System-wide .profile file for sh(1).
# MINIX specifics
# Set library path
export LD_LIBRARY_PATH="/usr/local/lib:/usr/pkg/lib:/usr/X11R7/lib:/usr/lib:/lib"
export LD_LIBRARY_PATH="/lib:/usr/lib:/usr/X11R7/lib:/usr/pkg/lib:/usr/local/lib"
# Set the timezone
export TZ=GMT0
@ -32,5 +14,4 @@ if [ -f ${RC_TZ} ]; then
. ${RC_TZ}
fi
export PATH TZ
export TZ

19
etc/root/Makefile Normal file
View File

@ -0,0 +1,19 @@
# $NetBSD: Makefile,v 1.4 2012/11/17 23:08:38 uwe Exp $
CONFIGFILES= dot.cshrc dot.klogin dot.login dot.profile dot.shrc
FILESDIR= /root
FILESMODE= 644
FILESMODE_dot.klogin= 600
.for F in ${CONFIGFILES}
FILESNAME_${F}= ${F:S/dot//}
.endfor
.include <bsd.own.mk>
.if !defined(__MINIX)
CONFIGLINKS= /root/.cshrc /.cshrc \
/root/.profile /.profile
.endif # !defined(__MINIX)
.include <bsd.files.mk>
.include <bsd.links.mk>

43
etc/root/dot.cshrc Normal file
View File

@ -0,0 +1,43 @@
# $NetBSD: dot.cshrc,v 1.24 2012/03/11 17:28:47 he Exp $
alias h history
alias j jobs -l
alias hup '( set pid=$< ; kill -HUP $pid ) < /var/run/\!$.pid'
alias la ls -a
alias lf ls -FA
alias ll ls -l
alias x exit
alias z suspend
alias back 'set back="$old"; set old="$cwd"; cd "$back"; unset back; dirs'
alias cd 'set old="$cwd"; chdir \!*'
alias pd pushd
alias pd2 pushd +2
alias pd3 pushd +3
alias pd4 pushd +4
alias tset 'set noglob histchars=""; eval `\tset -s \!*`; unset noglob histchars'
setenv BLOCKSIZE 1k
# Uncomment the following line(s) to install binary packages
# from ftp.NetBSD.org via pkg_add. (See also pkg_install.conf)
#setenv PKG_PATH "ftp://ftp.NetBSD.org/pub/pkgsrc/packages/NetBSD/`uname -m`/6.0/All"
#setenv PKG_PATH "${PKG_PATH};ftp://ftp.NetBSD.org/pub/pkgsrc/packages/NetBSD/`uname -m`/5.1/All"
#setenv PKG_PATH "${PKG_PATH};ftp://ftp.NetBSD.org/pub/pkgsrc/packages/NetBSD/`uname -m`/5.0/All"
set history=1000
set path=(/sbin /usr/sbin /bin /usr/bin /usr/pkg/sbin /usr/pkg/bin /usr/X11R7/bin /usr/X11R6/bin /usr/local/sbin /usr/local/bin)
# directory stuff: cdpath/cd/back
set cdpath=(/usr/src/{sys,bin,sbin,usr.{bin,sbin},lib,libexec,share,local,games,gnu/{usr.{bin,sbin},libexec,lib,games}})
if ($?prompt && -x /usr/bin/id ) then
if (`/usr/bin/id -u` == 0) then
set prompt="`hostname -s`# "
else
set prompt="`hostname -s`% "
endif
endif
umask 022

2
etc/root/dot.klogin Normal file
View File

@ -0,0 +1,2 @@
# $NetBSD: dot.klogin,v 1.3 1997/10/28 03:33:20 mrg Exp $

8
etc/root/dot.login Normal file
View File

@ -0,0 +1,8 @@
# $NetBSD: dot.login,v 1.9 2009/05/15 23:57:50 ad Exp $
eval `tset -sQrm 'unknown:?unknown'`
# Do not display in 'su -' case
if ( ! $?SU_FROM ) then
echo "We recommend that you create a non-root account and use su(1) for root access."
endif

29
etc/root/dot.profile Normal file
View File

@ -0,0 +1,29 @@
# $NetBSD: dot.profile,v 1.26 2012/03/11 17:28:47 he Exp $
export PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/pkg/sbin:/usr/pkg/bin
export PATH=${PATH}:/usr/X11R7/bin:/usr/X11R6/bin:/usr/local/sbin:/usr/local/bin
# Uncomment the following line(s) to install binary packages
# from ftp.NetBSD.org via pkg_add. (See also pkg_install.conf)
#export PKG_PATH=ftp://ftp.NetBSD.org/pub/pkgsrc/packages/NetBSD/$(uname -m)/6.0/All
#export PKG_PATH="${PKG_PATH};ftp://ftp.NetBSD.org/pub/pkgsrc/packages/NetBSD/$(uname -m)/5.1/All"
#export PKG_PATH="${PKG_PATH};ftp://ftp.NetBSD.org/pub/pkgsrc/packages/NetBSD/$(uname -m)/5.0/All"
export BLOCKSIZE=1k
export HOST="$(hostname)"
if [ -x /usr/bin/tset ]; then
eval $(tset -sQrm 'unknown:?unknown')
fi
umask 022
#ulimit -c 0
export ENV=/root/.shrc
# Do not display in 'su -' case
# Would be nice, but still not tested enough on MINIX
#if [ -z "$SU_FROM" ]; then
# echo "We recommend that you create a non-root account and use su(1) for root access."
#fi

12
etc/root/dot.shrc Normal file
View File

@ -0,0 +1,12 @@
# $NetBSD: dot.shrc,v 1.8 2007/11/24 11:14:41 pavel Exp $
if [ -f /etc/shrc ]; then
. /etc/shrc
fi
hup(){ (read pid; kill -HUP $pid) </var/run/$1.pid; }
case "$-" in *i*)
# interactive mode settings go here
;;
esac

20
etc/shrc Normal file
View File

@ -0,0 +1,20 @@
# $NetBSD: shrc,v 1.7 2010/12/27 03:38:52 christos Exp $
#
# System-wide .shrc file for sh(1).
ll(){ ls -l ${1+"$@"}; }
case "$-" in *i*)
if /bin/test -z "${HOST}"; then
HOST="$(hostname)"
fi
# hostname is set to the ip address by default on MINIX, so
# don't truncate on the first dot.
#PS1="${HOST%%.*}$PS1"
PS1="${HOST}$PS1"
set -o emacs
# This file is used by shells that might not support
# set -o tabcomplete, so check before trying to use it.
( set -o tabcomplete 2>/dev/null ) && set -o tabcomplete
;;
esac

10
etc/skel/Makefile Normal file
View File

@ -0,0 +1,10 @@
# $NetBSD: Makefile,v 1.8 2006/09/01 13:01:55 tron Exp $
# from: @(#)Makefile 8.1 (Berkeley) 6/8/93
CONFIGFILES= dot.cshrc dot.login dot.logout dot.profile dot.shrc
FILESDIR= /etc/skel
.for F in ${CONFIGFILES}
FILESNAME_${F}= ${F:S/dot//}
.endfor
.include <bsd.prog.mk>

57
etc/skel/dot.cshrc Normal file
View File

@ -0,0 +1,57 @@
# $NetBSD: dot.cshrc,v 1.7 2011/10/19 14:42:37 christos Exp $
#
# This is the default .cshrc file.
# Users are expected to edit it to meet their own needs.
#
# The commands in this file are executed each time a new csh shell
# is started.
#
# See csh(1) for details.
#
# Set your editor. Default to explicitly setting vi, as otherwise some
# software will run ed and other software will fail. Can be set to
# emacs or nano or whatever other editor you may prefer, but of course
# those editors must be installed before you can use them.
setenv EDITOR vi
# vi settings: set show-match auto-indent always-redraw shift-width=4
#setenv EXINIT "se sm ai redraw sw=4"
# VISUAL sets the "visual" editor, i.e., vi rather than ed, which if
# set will be run by preference to $EDITOR by some software. It is
# mostly historical and usually does not need to be set.
#setenv VISUAL ${EDITOR}
# Set the pager. This is used by, among other things, man(1) for
# showing man pages. The default is "more". Another reasonable choice
# (included with the system by default) is "less".
#setenv PAGER more
# Set your default printer, if desired.
#setenv PRINTER change-this-to-a-printer
# Set the search path for programs.
set path = (~/bin /bin /sbin /usr/{bin,sbin,X11R7/bin,X11R6/bin,pkg/{,s}bin,games} \
/usr/local/{,s}bin)
if ($?prompt) then
# An interactive shell -- set some stuff up
# Filename completion.
set filec
# Size of the history buffer.
set history = 1000
# Do not exit on EOF condition (e.g. ^D typed)
# (disabled by default, not default behavior)
#set ignoreeof
# Set the location of your incoming email for mail notification.
set mail = (/var/mail/$USER)
# Set the prompt to include the hostname.
set mch = `hostname -s`
set prompt = "${mch:q}: {\!} "
endif

21
etc/skel/dot.login Normal file
View File

@ -0,0 +1,21 @@
# $NetBSD: dot.login,v 1.3 2003/04/24 01:02:26 perry Exp $
#
# This is the default .login file.
# Users are expected to edit it to meet their own needs.
#
# The commands in this file are executed when a csh user first
# logs in. This file is processed after .cshrc.
#
# See csh(1) for details.
#
if ( ! $?SHELL ) then
setenv SHELL /bin/csh
endif
set noglob
eval `tset -s -m 'network:?xterm'`
unset noglob
stty status '^T' crt -tostop
if ( -x /usr/games/fortune ) /usr/games/fortune

10
etc/skel/dot.logout Normal file
View File

@ -0,0 +1,10 @@
# $NetBSD: dot.logout,v 1.1 2003/04/24 01:01:39 perry Exp $
#
# This is the default .logout file.
# Users are expected to edit it to meet their own needs.
#
# The commands in this file are executed when a csh login shell
# terminates.
#
# See csh(1) for details.
#

41
etc/skel/dot.profile Normal file
View File

@ -0,0 +1,41 @@
# $NetBSD: dot.profile,v 1.9 2012/04/10 19:02:30 dholland Exp $
#
# This is the default .profile file.
# Users are expected to edit it to meet their own needs.
#
# The commands in this file are executed when an sh user first
# logs in.
#
# See sh(1) for details.
#
# Set your editor. Default to explicitly setting vi, as otherwise some
# software will run ed and other software will fail. Can be set to
# emacs or nano or whatever other editor you may prefer, but of course
# those editors must be installed before you can use them.
export EDITOR=vi
# vi settings: set show-match auto-indent always-redraw shift-width=4
#export EXINIT="se sm ai redraw sw=4"
# VISUAL sets the "visual" editor, i.e., vi rather than ed, which if
# set will be run by preference to $EDITOR by some software. It is
# mostly historical and usually does not need to be set.
#export VISUAL=${EDITOR}
# Set the pager. This is used by, among other things, man(1) for
# showing man pages. The default is "more". Another reasonable choice
# (included with the system by default) is "less".
#export PAGER=more
# Set your default printer, if desired.
#export PRINTER=change-this-to-a-printer
# Set the search path for programs.
PATH=$HOME/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R7/bin:/usr/X11R6/bin:/usr/pkg/bin
PATH=${PATH}:/usr/pkg/sbin:/usr/games:/usr/local/bin:/usr/local/sbin
export PATH
# Configure the shell to load .shrc at startup time.
# This will happen for every shell started, not just login shells.
export ENV=$HOME/.shrc

10
etc/skel/dot.shrc Normal file
View File

@ -0,0 +1,10 @@
# $NetBSD: dot.shrc,v 1.3 2007/11/24 11:14:42 pavel Exp $
if [ -f /etc/shrc ]; then
. /etc/shrc
fi
case "$-" in *i*)
# interactive mode settings go here
;;
esac

View File

@ -151,12 +151,8 @@ enum {
#endif
#ifndef DEF_SKELDIR
#if defined(__minix)
#define DEF_SKELDIR "/usr/ast"
#else
#define DEF_SKELDIR "/etc/skel"
#endif
#endif /* defined(__minix) */
#ifndef DEF_SHELL
#define DEF_SHELL _PATH_BSHELL