~drgeo-developers/drgeo/trunk

« back to all changes in this revision

Viewing changes to sugar-bundle/DrGeoII.activity/bin/DrGeoII.sh

  • Committer: Hilaire Fernandes
  • Date: 2012-01-27 21:15:40 UTC
  • Revision ID: hilaire.fernandes@gmail.com-20120127211540-912spf97bhpx6mve
Initial additions

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
# Author: Bert Freudenberg
 
3
# Purpose: Run DrGeoII.pr in Etoys
 
4
 
 
5
# arguments are unordered, have to loop
 
6
args=""
 
7
while [ -n "$2" ] ; do
 
8
    case "$1" in
 
9
        -b | --bundle-id)   bundle_id="$2"   ; args="$args BUNDLE_ID $2" ;;
 
10
        -a | --activity-id) activity_id="$2" ; args="$args ACTIVITY_ID $2";;
 
11
        -o | --object-id)   object_id="$2"   ; args="$args OBJECT_ID $2";;
 
12
        -u | --uri)         uri="$2"         ; args="$args URI $2";;
 
13
        *) echo unknown argument $1 $2 ;;
 
14
    esac
 
15
    shift;shift
 
16
done
 
17
 
 
18
# really need bundle id and activity id
 
19
if [ -z "$bundle_id" -o -z "$activity_id" ] ; then
 
20
  echo ERROR: bundle-id and activity-id arguments required
 
21
  echo Aborting
 
22
  exit 1
 
23
fi
 
24
 
 
25
# more useful args
 
26
args="$args BUNDLE_PATH $SUGAR_BUNDLE_PATH"
 
27
 
 
28
# some debug output
 
29
echo launching $bundle_id instance $activity_id
 
30
[ -n "$object_id"   ] && echo with journal obj $object_id
 
31
[ -n "$uri"         ] && echo loading uri $uri
 
32
echo
 
33
 
 
34
# sanitize
 
35
[ -z "$SUGAR_PROFILE" ] && SUGAR_PROFILE=default
 
36
[ -z "$SUGAR_ACTIVITY_ROOT" ] && SUGAR_ACTIVITY_ROOT="$HOME/.sugar/$SUGAR_PROFILE/drgeo"
 
37
 
 
38
# rainbow-enforced locations
 
39
export SQUEAK_SECUREDIR="$SUGAR_ACTIVITY_ROOT/data/private"
 
40
export SQUEAK_USERDIR="$SUGAR_ACTIVITY_ROOT/data/MyEtoys"
 
41
 
 
42
# make group-writable for rainbow
 
43
umask 0002
 
44
[ ! -d "$SQUEAK_SECUREDIR" ] && mkdir -p "$SQUEAK_SECUREDIR" && chmod o-rwx "$SQUEAK_SECUREDIR"
 
45
[ ! -d "$SQUEAK_USERDIR" ] && mkdir -p "$SQUEAK_USERDIR"
 
46
 
 
47
# do not crash on dbus errors
 
48
export DBUS_FATAL_WARNINGS=0
 
49
 
 
50
# now run Squeak VM with Etoys image
 
51
exec vm/bin/squeak \
 
52
    -encoding UTF-8 -vm-display-x11 -xshm \
 
53
    -sugarBundleId $bundle_id \
 
54
    -sugarActivityId $activity_id \
 
55
    drgeo/drgeo.image \
 
56
    "" \
 
57
    $args