PDA

View Full Version : Is there a place to define globally available environment



garyng
05-30-2003, 08:05 AM
I mean the PATH= stuff etc.

Such that any systematic changes(say installing a new app in an odd directory) would still be available to all users, or changing default machine locales.

Dave_Bechtel
05-30-2003, 10:04 PM
--I set up an /etc/profile.local and created a ~/.bash_login and a ~/.bashrc:

$ cat .bash_login


#!/bin/sh

source /etc/profile.local
source ~/.bashrc

# Moved to bashrc
#PATH=~/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/usr/local/sbin:/usr/local/bin:/usr/games
#export PATH

##############

[ p233 (scrn=0) ]
53 ~ $ cat .bashrc


# /etc/bash.bashrc
[ -f /etc/profile ] && . /etc/profile
[ -f /etc/profile.local ] && . /etc/profile.local

alias scrn='screen -aA'

# From linuxgazette-dec.2001
function calc() { perl -wlne'print eval'; }
export -f calc

##alias sf='xinit /usr/bin/sawfish &'

PATH=~/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/usr/local/sbin:/usr/local/bin:/usr/games
export PATH

##############

--This is what /etc/profile.local looks like:


#!/bin/bash
# System wide environment and startup programs
# Functions and aliases go in /etc/bashrc

echo 'Running profile.local...'
#Some of this stuff taken from suse bash.bashrc...
alias dir='ls -l'
alias ll='ls -l'
alias la='ls -la'
alias l='ls -alF'
alias ls-l='ls -l'

#
# Set some generic aliases
#
alias o='less'
alias ..='cd ..'
alias ...='cd ../..'
if test "$is" != "ksh" ; then
alias -- +='pushd .'
alias -- -='popd'
fi
alias rd=rmdir
alias md='mkdir -p'
alias unix2dos='recode lat1..ibmpc'
alias dos2unix='recode ibmpc..lat1'
alias which='type -p'
alias rehash='hash -r'

# From suse...
# /etc/profile.local

# Addendum 1999.1013
##PATH="$PATH:/usr/X11R6/bin:/opt/kde/bin"

#PS1="[\u@\h \W]\\$ "
#Use MAN BASH, look for PROMPTING

PS1="[ \H (scrn=$WINDOW) ]\n $\! \u \w \\$ "
#PS1="\![\h \l \u \w]\\$ "
# old PS1="\![\u \w]\\$ "
# \! == History cmd #
# \u == Username
# \w == Full pathname

set -o notify
# also = set -b
# Report BG jobs-end immed, without waiting for next prompt
# Finally got this wkg == 2001.0810
# XXX NOTE - THESE OPTIONS ARE NOT ON BY DEFAULT! = 2001.0810
shopt -s histreedit histverify checkwinsize
# Check w/ ' shopt -p '

# 2001.0810 = Set new user limits in prep for C devel
# 2002.0831 - Removed ulimits - its borked in krnl
#ulimit -c 2000
# Max size of CORE files (2MB)
#ulimit -d 32000
# max data size of a program is 15 MB
#ulimit -s 15000
# max stack size of a program is 15 MB
#ulimit -m 30000 # max resident set size is 30 MB


##MANPATH="$MANPATH:/opt/schily/man"
##export MANPATH

export PATH PS1 HOSTNAME HISTSIZE HISTFILESIZE USER LOGNAME MAIL
# notify

# No screen saver
/usr/bin/setterm -blank 0

fortune

# /etc/bashrc

# System wide functions and aliases
# Environment stuff goes in /etc/profile

# For some unknown reason bash refuses to inherit
# PS1 in some circumstances that I can't figure out.
# Putting PS1 here ensures that it gets loaded every time.

#PS1="[\u@\h \W]\\$ "

# Changed from /usr/local 1999.1003
#MOZILLA_HOME="/opt/netscape"
MOZILLA_HOME="/usr/bin/mozilla"

# XXX 1999.0524
MOZILLA_NO_ASYNC_DNS=True
export MOZILLA_NO_ASYNC_DNS
#

# XXX 2001.0814 for cdrecord
# module now - set in boot.local
# W/o SCSI card
#export CDR_DEVICE='0,0,0'
#export CDR_DEVICE='1,0,0'
export CDR_DEVICE='0,1,0'
export CDR_SPEED='32 driveropts=burnfree '

# . ./.profile == source .profile

# Changed from /etc/bashrc
# Chgd from profile.local to profile == 2001.0809 ('real' didnt catch evy)
alias real='source /etc/profile; source ~/.profile; source ~/.bashrc'
#alias real='unalias -a;source /etc/profile'

alias which="type -path"

alias edit="jstar "
# bashrc
alias edalias="edit /etc/profile.local ; echo PK: ; read ; real ; alias"
##alias edboot='edit /etc/init.d/boot.local'
alias xedalias="gedit /etc/profile.local &"

#alias edaliasg="edit /etc/profile.local"

alias edlocal="edit ~/localinfo.dat"
alias xedlocal='kedit ~/localinfo.dat &'
alias ls="ls -al "
##alias crpm='cd /mnt/cdrom/Mandrake/RPMS'

# This unmounts cd image files correctly
alias unloop='losetup -d /dev/loop6;losetup -d /dev/loop7'
alias usecdrw2='source ~/bin/usecdrw2--source'

alias pppstatus='nice pppstatus -s 1540'

##alias zerocd='nice time dd if=/dev/zero of=/mnt/cdtemp/image1.raw bs=2048k cou
nt=325 &'
alias zerocd='nice time dd if=/dev/zero of=/mnt/cdtemp/image1.raw bs=2048k count
=350 &'
#alias zerocd2='nice time dd if=/dev/zero of=/mnt/cdtemp/image1.raw bs=1024k cou
nt=700 &'

# FINALLY got this shit wrkg == 2001.0809 - use 'set' instd of alias to view
# (alias doesnt support arg expansion!)
function mnt {
tmpmnt=$1;
mount /mnt/$tmpmnt && cd /mnt/$tmpmnt && /bin/ls -al
}

function dism {
tmpvar=$*
echo TMPVAR=.$tmpvar.
umount /mnt/$tmpvar && eject /mnt/$tmpvar
}

#alias killns='kill `cat ~/.netscape/lock`'
alias caud='mount /mnt/cdtemp ; cd /mnt/cdtemp/audio'

alias scrn='screen -aAO'

alias make='make -s -j 2 '
alias w3='w3m '
alias ww='w3m '

##alias hangup='/etc/init.d/wvdial.dod hangup'

alias pingfamvid='ping -i 30 www.famvid.com &'

function newexec {
tmpvar=$*
touch ~/bin/$tmpvar
chmod +x ~/bin/$tmpvar
edit ~/bin/$tmpvar
/bin/ls -l ~/bin/$tmpvar
}

###############


I mean the PATH= stuff etc.

Such that any systematic changes(say installing a new app in an odd directory) would still be available to all users, or changing default machine locales.