3 # Launch squeakvm from the command line or a menu script, with a good
4 # plugin path, text encodings and pulseaudio kludge
6 # Last edited: 2013-11-13 19:51:35 by piumarta on emilia
9 PLUGIN_REV
=5.0-202412141720
13 while test -L "${path}"; do
14 dir
=`dirname "${path}"`
15 dir
=`cd "${dir}" && pwd -P`
16 path
=`basename "${path}"`
17 path
=`ls -l "${dir}/${path}" | sed 's,.* -> ,,'`
18 if test `expr "${path}" : "/"` -eq 0; then
22 if test -d "${path}"; then
23 (cd "${path}" && pwd -P)
25 dir
=`dirname "${path}"`
26 base
=`basename "${path}"`
27 (cd "${dir}" && echo "`pwd -P`/${base}")
31 bindir
=`realpath "${0}"`
32 bindir
=`dirname "${bindir}"`
33 prefix
=`dirname "${bindir}"`
34 libdir
="${prefix}/lib/squeak"
35 plgdir
="${libdir}/$PLUGIN_REV-32bit"
40 plgd64
="${prefix}/lib/amd64/squeak/$PLUGIN_REV-64bit"
51 # look for VM options affecting this script's behaviour
54 while test "$#" -gt "0"; do
56 -vm-sound*) useoss
="false";;
57 -vm) shift; case "$1" in sound
*) useoss
="false"; esac;;
58 -image-info) info
="true";;
60 *) if test ! "$image" -a \
( -f "$1.image" -o -f "$1" \
); then image
="$1"; fi;;
67 -jit) jit
=$1; shift; squeakvm
=""; squeakvm64
="";;
68 -nojit) jit
=$1; shift; cogvm
=""; cogvm64
="";;
73 # try to find the image file format
75 if test -x "${plgd64}/${ck}"; then ck="${plgd64}/${ck}"
76 elif test -x "${plgdir}/${ck}"; then ck="${plgdir}/${ck}"
77 elif test -x "${libdir}/${ck}"; then ck="${libdir}/${ck}"
78 elif test -x "${bindir}/${ck}"; then ck="${bindir}/${ck}"
79 elif test -x "`which ${ck}`"; then ck
="`which ${ck}`"
82 if test -z "${image}"; then image
="${SQUEAK_IMAGE}"; fi
83 if test -z "${image}"; then image
="squeak"; fi
84 if test -f "${image}.image"; then image
="${image}.image"; fi
86 if test "${info}"; then
87 if test ! -x "${ck}"; then
88 echo "cannot find executable file: ${ck}" >&2
91 if test ! -f "${image}"; then
92 echo "cannot find image file: ${image}" >&2
95 exec "${ck}" "${image}"
98 if test -x "${ck}" -a -f "${image}"; then
99 format
=`"${ck}" "${image}"`
101 6521|
7033) vms
="${squeakvm}";;
102 68021|
68533) vms
="${squeakvm64}"; plgdir
="${plgd64}";;
103 *) vms
="${squeakvm}";;
106 vms
="${squeakvm}" # no image found, run default VM with args
109 # find the vm and set the plugin path
111 if test -z "${vms}"; then
112 echo "cannot find VM to run image '${image}' with option '${jit}'" >&2
116 for avm
in ${vms}; do
117 #echo CHECKING ${avm}
118 if test -x "${plgdir}/${avm}"; then # bin/squeak -> lib/squeak/x.y-z/squeakvm
119 vm
="${plgdir}/${avm}"
122 elif test -x "${bindir}/${avm}"; then # bld/squeak -> bld/squeakvm
123 vm
="${bindir}/${avm}"
124 plugins
="${bindir}/%n"
126 elif test -x "`which ${avm}`"; then
133 if test -z "${vm}"; then
134 echo "cannot find executable file: ${vms}" >&2
138 # command-line overrides environment, so communicate anything we decide here via the environment
140 if test -z "${SQUEAK_PATHENC}"; then SQUEAK_PATHENC
="UTF-8"; export SQUEAK_PATHENC
; fi
141 if test -z "${SQUEAK_ENCODING}"; then SQUEAK_ENCODING
="UTF-8"; export SQUEAK_ENCODING
; fi
143 if test -z "${SQUEAK_PLUGINS}"; then
144 if test -n "${plugins}"; then
145 SQUEAK_PLUGINS
="${plugins}"
146 export SQUEAK_PLUGINS
150 # deal with pulseaudio if it is running
152 if test -z "${SQUEAK_VM}"; then
154 if pulseaudio
--check 2>/dev
/null
; then
155 if padsp true
2>/dev
/null
; then
157 SQUEAK_VM
="sound-OSS"
166 if test -z "$LC_ALL"; then
173 if test "0$SQUEAK_DEBUG" -gt "0"; then
180 exec ${wrapper} "${vm}" "$@"