forked from GsDevKit/gsDevKitHome
-
Notifications
You must be signed in to change notification settings - Fork 0
/
createTodeImage
executable file
·93 lines (75 loc) · 2.21 KB
/
createTodeImage
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
83
84
85
86
87
88
89
90
91
92
93
#! /bin/bash
#=========================================================================
# Copyright (c) 2014, 2015 GemTalk Systems, LLC <dhenrich@gemtalksystems.com>.
#=========================================================================
echo "================="
echo " GsDevKit script: $(basename $0) $*"
echo "================="
usage() {
cat <<HELP
USAGE: $(basename $0) [-h] [-f] [-p <postfix]
Create the tODE client image. Used for running pharo-based scripts
and for running the tODE client UI.
If the tODE client image already exists, the installation is skipped
unless the -f option is specified.
OPTIONS
-h
display help
-f
Force tODE client installation, whether or not the image
already exists.
-p <postfix>
Append <postfix> to end of image name. Useful for creating
multiple tode client images.
EXAMPLES
$(basename $0) -h
$(basename $0) -p _0
$(basename $0) -f
$(basename $0)
HELP
}
set -e # exit on error
if [ "${GS_HOME}x" = "x" ] ; then
echo "the GS_HOME environment variable needs to be defined"
exit 1
fi
postFix=""
force=""
while getopts ":fhp:" OPT ; do
case "$OPT" in
h) usage; exit 0;;
f) force="true";;
p) postFix="${OPTARG}";;
?) postFix="";; # handle optional -p argument "
*) usage; exit 1;;
esac
done
shift $(($OPTIND - 1))
if [ ! -e "$GS_HOME/pharo/pharo" ]; then
$GS_HOME/bin/installPharo
fi
pharo=$GS_HOME/pharo
message="create"
if [ -e $pharo/todeClient${postFix}.image ] ; then
if [ "${force}x" = "x" ] ; then
echo "todeClient already created, use -f to force update"
exit 0
else
message="update"
fi
fi
todeLoadPath=$GS_HOME/tode/sys/default/pharo/todeLoad.st
if [ -e $GS_HOME/tode/sys/local/pharo/todeLoad.st ] ; then
todeLoadPath=$GS_HOME/tode/sys/local/pharo/todeLoad.st
fi
echo "${message} todeClient${postFix} image using $todeLoadPath"
if [ "${force}" = "true" ] ; then
$pharo/pharo $pharo/todeClient${postFix}.image save todeClientTmp
else
$pharo/pharo $pharo/Pharo.image save todeClientTmp
fi
$pharo/pharo $pharo/todeClientTmp.image st --quit --save $todeLoadPath
$pharo/pharo $pharo/todeClientTmp.image save todeClient${postFix}
rm -f $pharo/todeClientTmp.*
echo
echo "...finished $(basename $0)"