blob: 732601837306a64f96d711a9346a31983a9d190e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
#!/bin/sh
# Author: Bert Freudenberg
# Purpose: Run Etoys using the Squeak virtual machine
[ "$SUGAR_LOGGER_LEVEL" = "debug" ] && export ETOYS_DEBUG=1
[ "0$ETOYS_DEBUG" -gt "0" ] && DEBUG=echo || DEBUG=false
# arguments are unordered, have to loop
args=""
while [ -n "$2" ] ; do
case "$1" in
-b | --bundle-id) bundle_id="$2" ; args="$args BUNDLE_ID $2" ;;
-a | --activity-id) activity_id="$2" ; args="$args ACTIVITY_ID $2";;
-o | --object-id) object_id="$2" ; args="$args OBJECT_ID $2";;
-u | --uri) uri="$2" ; args="$args URI $2";;
*) echo unknown argument $1 $2 ;;
esac
shift;shift
done
# really need bundle id and activity id
if [ -z "$bundle_id" -o -z "$activity_id" ] ; then
echo ERROR: bundle-id and activity-id arguments required
echo Aborting
exit 1
fi
# some debug output
$DEBUG launching $bundle_id instance $activity_id
[ -n "$object_id" ] && $DEBUG with journal obj $object_id
[ -n "$uri" ] && $DEBUG loading uri $uri
$DEBUG
# sanitize
[ -z "$SUGAR_PROFILE" ] && SUGAR_PROFILE=default
[ -z "$SUGAR_ACTIVITY_ROOT" ] && SUGAR_ACTIVITY_ROOT="$HOME/.sugar/$SUGAR_PROFILE/etoys"
# rainbow-enforced locations
export SQUEAK_SECUREDIR="$SUGAR_ACTIVITY_ROOT/data/private"
export SQUEAK_USERDIR="$SUGAR_ACTIVITY_ROOT/data/MyEtoys"
# make group-writable for rainbow
umask 0002
[ ! -d "$SQUEAK_SECUREDIR" ] && mkdir -p "$SQUEAK_SECUREDIR" && chmod o-rwx "$SQUEAK_SECUREDIR"
[ ! -d "$SQUEAK_USERDIR" ] && mkdir -p "$SQUEAK_USERDIR"
# look for alternate images on USB, in data dir, and in bundle
ALTIMG=`echo /media/*/olpc-dev/etoys.image`
if [ -r "$ALTIMG" ] ; then
args="$args --image $ALTIMG"
export SQUEAK_USERDIR=`dirname $ALTIMG`
else
ALTIMG="$SUGAR_ACTIVITY_ROOT/data/etoys.image"
if [ -r "$ALTIMG" ] ; then
args="$args --image $ALTIMG"
else
ALTIMG="$SUGAR_BUNDLE_PATH/etoys.image"
if [ -r "$ALTIMG" ] ; then
args="$args --image $ALTIMG"
fi
fi
fi
# look for additional translations
if [ -d "$SUGAR_BUNDLE_PATH/locale" ] ; then
args="$args MO_PATH $SUGAR_BUNDLE_PATH/locale"
fi
# put Squeaklets in instance dir so datastore can move files
squeaklets="$SUGAR_ACTIVITY_ROOT/instance"
[ ! -d "$squeaklets" ] && mkdir -p "$squeaklets"
# do not crash on dbus errors
export DBUS_FATAL_WARNINGS=0
# now run Squeak VM with Etoys image
exec etoys \
-sugarBundleId $bundle_id \
-sugarActivityId $activity_id \
BUNDLE_PATH $SUGAR_BUNDLE_PATH \
SQUEAKLETS "$squeaklets" \
$args
|