1#
2# Administrative startup for /bin/sh
3# Place user customizations in ~/config/settings/profile
4#
5
6_ARCH=`getarch 2>/dev/null`
7if [ "$_ARCH" = "`getarch -p 2>/dev/null`" ] ; then
8	echo -e "\nWelcome to the Haiku shell.\n"
9	PS1="\w"
10else
11	echo -e "\nSwitching to architecture `getarch`\n"
12	PS1="[$_ARCH] \w"
13fi
14unset _ARCH
15
16export PS1="\["'`if [ $? = 0 ]; then echo "\e[32m";
17	else echo "\e[31m"; fi`'"\]$PS1\[\e[0m\]> "
18
19export USER=`id -un`
20export GROUP=`id -gn`
21
22if [ -z $BE_HOST_CPU ]; then
23	. /boot/system/boot/SetupEnvironment
24fi
25
26export HISTFILESIZE=500
27export HISTCONTROL=ignoredups
28
29alias ls="ls --color=auto"
30alias ll="ls -lA"
31alias la="ls -A"
32alias m="more"
33
34test -n "$BASH_VERSION" && shopt -s checkwinsize
35
36if test -n "$KSH_VERSION"; then
37	ps1_pwd() {
38		local e=$? d=${PWD:-?}/ p=~
39		[[ $p = ?(*/) ]] || d=${d/#$p\//\~/}
40		print -nr -- "${d%/}"
41		return $e
42	}
43	PS1=${PS1/'\w'/'$(ps1_pwd)'}
44else
45	test -n "$BASH_VERSION" || PS1=$(printf '%s' "$PS1" | \
46	    sed 's/\\w/$PWD/')
47fi
48
49function dir {
50	ls -lF "$@";
51}
52
53for dir in `findpaths -Re B_FIND_PATH_DATA_DIRECTORY profile.d 2> /dev/null`; do
54  for i in $dir/*.sh; do
55    if [ -r $i ]; then
56      . $i
57    fi
58  done
59  unset i
60done
61unset dir
62
63if [ -d /etc/profile.d ]; then
64  for i in /etc/profile.d/*.sh; do
65    if [ -r $i ]; then
66      . $i
67    fi
68  done
69  unset i
70fi
71