Hồng Thất Công
Đả Cẩu Bổng Pháp
Followed your instructions and here's is the output of cat
ledop:~$ cat /mnt/utmp/moonlight/runscript.sh
#!/bin/bash
pwd=$(pwd)
export PS1='\w\$ '
umask 022
version="01"
export PATH=$pwdPATH
export LD_LIBRARY_PATH=$pwd/libLD_LIBRARY_PATH
if [ ! -e home ]
then
echo "--------------------------------------------------------------"
echo "mkdir home"
mkdir home
fi
if [ -e home/.version ];then
lastrun=`cat home/.version`
else
lastrun="00"
fi
#check Java
if [ ! -e /usr/bin/java ];then
zenity --error --title="Moonlight" --text="You need JAVA to run this game.
Go grab the JAVA PND, it's easy to install..."
exit
fi
if [ -z "$REAL_HOME" ];then
export REAL_HOME="$HOME"
fi
export HOME=$pwd/home
#all done, write the new lastrun...
if [ ! "$version" = "$lastrun" ];then
echo "$version">home/.version
fi
free=`free -mt | grep Total | awk '{print $4}'`
#check free mem, as low mem will probably lead to quiet error and sure hang...
if [ $free -lt 250 ];then
echo Low on memory, but not critical, warn user about it
zenity --warning --title="Moonlight" --text="Warning, your free memory is a bit low. You have $free, and 256Mo is recommanded.
It will strart, but creating/loading a game will probably silently failed.
If the game takes forever to create the world (it's a long process anyway), create a Swapfile to add some free memory"
fi
if [ ! -e left_nub ];then
cat /proc/pandora/nub0/mode >left_nub
fi
if [ ! -e right_nub ];then
cat /proc/pandora/nub1/mode >right_nub
fi
left_nub=`cat left_nub`
right_nub=`cat right_nub`
# handle analog nubs => save current version and switch to joystick for both
cat /proc/pandora/nub0/mode > /tmp/moonlight_nub0mode_before
cat /proc/pandora/nub1/mode > /tmp/moonlight_nub1mode_before
if [ -e /usr/pandora/scripts/op_nubchange.sh ]; then
/usr/pandora/scripts/op_nubchange.sh $left_nub $right_nub
else
echo $left_nub > /proc/pandora/nub0/mode
echo $right_nub > /proc/pandora/nub1/mode
fi
echo System check
echo ============
echo Freememory is $free
echo Cpu Speed is `cat /proc/pandora/cpu_mhz_max`
echo Sys Speed is `cat /proc/pandora/sys_mhz_max`
echo nubs has $left_nub $right_nub
[ -e "$HOME/pre_script.sh" ] && . $HOME/pre_script.sh
if [ -e "$HOME/post_script.sh" ];then
java -Xmx256m -jar build/moonlight-pandora.jar
. $HOME/post_script.sh
else
java -Xmx256m build/moonlight-pandora.jar
fi
cat /tmp/moonlight_nub0mode_before > /proc/pandora/nub0/mode
cat /tmp/moonlight_nub1mode_before > /proc/pandora/nub1/mode
sleep 1
rm /tmp/moonlight_nub0mode_before /tmp/moonlight_nub1mode_before
# set back the nubs to their initial state
#!/bin/bash
pwd=$(pwd)
export PS1='\w\$ '
umask 022
version="01"
export PATH=$pwdPATH
export LD_LIBRARY_PATH=$pwd/libLD_LIBRARY_PATH
if [ ! -e home ]
then
echo "--------------------------------------------------------------"
echo "mkdir home"
mkdir home
fi
if [ -e home/.version ];then
lastrun=`cat home/.version`
else
lastrun="00"
fi
#check Java
if [ ! -e /usr/bin/java ];then
zenity --error --title="Moonlight" --text="You need JAVA to run this game.
Go grab the JAVA PND, it's easy to install..."
exit
fi
if [ -z "$REAL_HOME" ];then
export REAL_HOME="$HOME"
fi
export HOME=$pwd/home
#all done, write the new lastrun...
if [ ! "$version" = "$lastrun" ];then
echo "$version">home/.version
fi
free=`free -mt | grep Total | awk '{print $4}'`
#check free mem, as low mem will probably lead to quiet error and sure hang...
if [ $free -lt 250 ];then
echo Low on memory, but not critical, warn user about it
zenity --warning --title="Moonlight" --text="Warning, your free memory is a bit low. You have $free, and 256Mo is recommanded.
It will strart, but creating/loading a game will probably silently failed.
If the game takes forever to create the world (it's a long process anyway), create a Swapfile to add some free memory"
fi
if [ ! -e left_nub ];then
cat /proc/pandora/nub0/mode >left_nub
fi
if [ ! -e right_nub ];then
cat /proc/pandora/nub1/mode >right_nub
fi
left_nub=`cat left_nub`
right_nub=`cat right_nub`
# handle analog nubs => save current version and switch to joystick for both
cat /proc/pandora/nub0/mode > /tmp/moonlight_nub0mode_before
cat /proc/pandora/nub1/mode > /tmp/moonlight_nub1mode_before
if [ -e /usr/pandora/scripts/op_nubchange.sh ]; then
/usr/pandora/scripts/op_nubchange.sh $left_nub $right_nub
else
echo $left_nub > /proc/pandora/nub0/mode
echo $right_nub > /proc/pandora/nub1/mode
fi
echo System check
echo ============
echo Freememory is $free
echo Cpu Speed is `cat /proc/pandora/cpu_mhz_max`
echo Sys Speed is `cat /proc/pandora/sys_mhz_max`
echo nubs has $left_nub $right_nub
[ -e "$HOME/pre_script.sh" ] && . $HOME/pre_script.sh
if [ -e "$HOME/post_script.sh" ];then
java -Xmx256m -jar build/moonlight-pandora.jar
. $HOME/post_script.sh
else
java -Xmx256m build/moonlight-pandora.jar
fi
cat /tmp/moonlight_nub0mode_before > /proc/pandora/nub0/mode
cat /tmp/moonlight_nub1mode_before > /proc/pandora/nub1/mode
sleep 1
rm /tmp/moonlight_nub0mode_before /tmp/moonlight_nub1mode_before
# set back the nubs to their initial state