Skip to content

Commit

Permalink
Import NetBSD shell environment files
Browse files Browse the repository at this point in the history
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
  • Loading branch information
sambuc committed Nov 10, 2014
1 parent 123aceb commit 957802c
Show file tree
Hide file tree
Showing 23 changed files with 322 additions and 72 deletions.
22 changes: 18 additions & 4 deletions distrib/sets/lists/minix/mi
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
10 changes: 6 additions & 4 deletions etc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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}; \
Expand Down Expand Up @@ -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 \
Expand All @@ -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
Expand Down
1 change: 0 additions & 1 deletion etc/ast/.exrc

This file was deleted.

33 changes: 0 additions & 33 deletions etc/ast/.profile

This file was deleted.

3 changes: 3 additions & 0 deletions etc/csh.cshrc
Original file line number Diff line number Diff line change
@@ -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 changes: 3 additions & 0 deletions etc/csh.login
Original file line number Diff line number Diff line change
@@ -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 changes: 3 additions & 0 deletions etc/csh.logout
Original file line number Diff line number Diff line change
@@ -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).
2 changes: 1 addition & 1 deletion etc/mtree/NetBSD.dist.base
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
./etc/fonts/conf.avail
./etc/fonts/conf.d
./etc/mtree
./etc/skel
./etc/system.conf.d
./home
./lib
Expand All @@ -50,7 +51,6 @@
./usr
./usr/adm
./usr/adm/old
./usr/ast
./usr/bin
./usr/etc
./usr/benchmarks
Expand Down
31 changes: 6 additions & 25 deletions etc/profile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -32,5 +14,4 @@ if [ -f ${RC_TZ} ]; then
. ${RC_TZ}
fi

export PATH TZ

export TZ
19 changes: 19 additions & 0 deletions etc/root/Makefile
Original file line number Diff line number Diff line change
@@ -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 changes: 43 additions & 0 deletions etc/root/dot.cshrc
Original file line number Diff line number Diff line change
@@ -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 changes: 2 additions & 0 deletions etc/root/dot.klogin
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# $NetBSD: dot.klogin,v 1.3 1997/10/28 03:33:20 mrg Exp $

8 changes: 8 additions & 0 deletions etc/root/dot.login
Original file line number Diff line number Diff line change
@@ -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 changes: 29 additions & 0 deletions etc/root/dot.profile
Original file line number Diff line number Diff line change
@@ -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 changes: 12 additions & 0 deletions etc/root/dot.shrc
Original file line number Diff line number Diff line change
@@ -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 changes: 20 additions & 0 deletions etc/shrc
Original file line number Diff line number Diff line change
@@ -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 changes: 10 additions & 0 deletions etc/skel/Makefile
Original file line number Diff line number Diff line change
@@ -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 changes: 57 additions & 0 deletions etc/skel/dot.cshrc
Original file line number Diff line number Diff line change
@@ -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
Loading

0 comments on commit 957802c

Please sign in to comment.