#! /bin/sh

# can't use grep here since command not available until postmount
##if ! mount | grep -q /mnt/system/armx; then
if [ "`mount | sed -n '/armx/p'`x" = "x" ]; then
  if [ ! -d /mnt/system/armx ]; then mkdir /mnt/system/armx; fi
  mount -o loop /mnt/data/armx.ext3 /mnt/system/armx
fi

if ! env | /mnt/system/armx/bin/grep -q /mnt/system/armx; then
  export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/mnt/system/armx/usr/lib:/mnt/system/armx/lib
  export PATH=/mnt/system/armx/bin:/mnt/system/armx/sbin:/mnt/system/armx/usr/bin:/mnt/system/armx/usr/sbin:$PATH
  export PYTHONHOME=/mnt/system/armx/usr/lib/python2.4
  export PYTHONPATH=$PYTHONHOME:$PYTHONHOME/lib-dynload
  export C_INCLUDE_PATH=/mnt/system/armx/usr/include
  export LIBRARY_PATH=/lib:/usr/lib:/mnt/system/armx/lib:/mnt/system/armx/usr/lib
fi

export SDL_NOMOUSE=1

export HOME=/mnt/system/armx
export TERMINFO=/mnt/system/armx/usr/share/terminfo/

alias file='file -m /mnt/system/armx/usr/share/misc/file/magic'
alias scp='scp -S /mnt/system/armx/usr/bin/ssh'
alias vi='vim -N'


# set volume using python
# to test use 'playwave /mnt/system/armx/SDLtest/sample.wav' 

volume () { python -c "import ossaudiodev;mixer=ossaudiodev.openmixer();mixer.set(ossaudiodev.SOUND_MIXER_VOLUME,($1,$1))"; }

# share current dir via http://localhost:8000

share () { python -m SimpleHTTPServer; }	
