Skip to content

Commit 01986d7

Browse files
committed
Issue #58: add -f option to createStone, createTodeImage, installServer, and todeClient scripts
-f option forces creation of new stone (stop stone and netldi, then delete directory) and new tode image (install fresh image). updateTodeImage script removed (createTodeImage -f and todeClient -f replaces it). [ci skip]
1 parent 19c417e commit 01986d7

File tree

6 files changed

+74
-94
lines changed

6 files changed

+74
-94
lines changed

Diff for: bin/README.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ Scripts that can be run on the client machine or the server.
5050
|[pharo][21]| Run headless pharo scripts using the Pharo image.|
5151
|[tode][22]| Run headless tode scripts using the todeClient image.|
5252
|[todeClient][15]| Launch todeClient image. Requires X11 client.|
53-
|[updateTodeImage][16]| Update the tODE client image.|
5453

5554
##Utility Scripts
5655
Special purpose utility scripts.
@@ -74,7 +73,7 @@ Special purpose utility scripts.
7473
[13]: stopStone
7574
[14]: createTodeImage
7675
[15]: todeClient
77-
[16]: updateTodeImage
76+
7877
[17]: installGci
7978
[18]: installGemStone
8079
[19]: installPharo

Diff for: bin/createStone

+18-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ echo "================="
99

1010
usage() {
1111
cat <<HELP
12-
USAGE: $(basename $0) [-h] [-n] [-s <snapshot-file-path>] <stone-name> <gemstone-version>
12+
USAGE: $(basename $0) [-h] [-f] [-n] [-s <snapshot-file-path>] <stone-name> <gemstone-version>
1313
1414
Create a new stone with the given stone name. Do not install tODE. Start stone
1515
and netldi unless -n is specified.
@@ -23,6 +23,9 @@ option to start the stone, the first time.
2323
OPTIONS
2424
-h
2525
display help
26+
-f
27+
Force creation of new stone, by deleting
28+
$GS_HOME/gemstone/stone/<stone-name> directory if it exists
2629
-n
2730
No startStone, no startNetldi.
2831
-s <snapshot-file-path>
@@ -31,6 +34,7 @@ OPTIONS
3134
EXAMPLES
3235
$(basename $0) -h
3336
$(basename $0) kit 3.2.1
37+
$(basename $0) -f kit 3.2.1
3438
$(basename $0) -s $GS_HOME/gemstone/snapshots/extent0.tode.3.2.4.dbf kit 3.2.4
3539
3640
HELP
@@ -43,10 +47,11 @@ fi
4347

4448
snapshotFileArg=""
4549
noRestartArg=""
50+
force=""
4651
while getopts "hns:" OPT ; do
4752
case "$OPT" in
4853
h) usage; exit 0;;
49-
n) noRestartArg=" -n ";;
54+
f) force="true";lient
5055
s) snapshotFileArg=" -s ${OPTARG} ";;
5156
*) usage; exit 1;;
5257
esac
@@ -65,6 +70,17 @@ if [ ! -e $pharo/todeClient.image ] ; then
6570
$GS_HOME/bin/createTodeImage
6671
fi
6772

73+
if [ -d $GS_HOME/gemstone/stones/$stoneName ] ; then
74+
if [ "${force}x" = "x" ] ; then
75+
echo "stone $stoneName already exists. Use the -f option to force re-creation"
76+
exit 0
77+
else
78+
echo "deleting old instance of stone $stoneName (stopping stone and netldi first)"
79+
$GS_HOME/bin/stopStone -b $stoneName
80+
rm -rf $GS_HOME/gemstone/stones/$stoneName
81+
fi
82+
fi
83+
6884
echo "Creating stone $stoneName"
6985
$pharo/pharo $pharo/todeClient.image createStone $stoneName $gsvers
7086

Diff for: bin/createTodeImage

+22-8
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,28 @@ echo "================="
99

1010
usage() {
1111
cat <<HELP
12-
USAGE: $(basename $0) [-h] [-p <postfix]
12+
USAGE: $(basename $0) [-h] [-f] [-p <postfix]
1313
1414
Create the tODE client image. Used for running pharo-based scripts
1515
and for running the tODE client UI.
1616
17+
If the tODE client image already exists, the installation is skipped
18+
unless the -f option is specified.
19+
1720
OPTIONS
1821
-h
1922
display help
23+
-f
24+
Force tODE client installation, whether or not the image
25+
already exists.
2026
-p <postfix>
2127
Append <postfix> to end of image name. Useful for creating
2228
multiple tode client images.
2329
2430
EXAMPLES
2531
$(basename $0) -h
2632
$(basename $0) -p _0
33+
$(basename $0) -f
2734
$(basename $0)
2835
2936
HELP
@@ -36,9 +43,11 @@ if [ "${GS_HOME}x" = "x" ] ; then
3643
fi
3744

3845
postFix=""
39-
while getopts ":hp:" OPT ; do
46+
force=""
47+
while getopts ":fhp:" OPT ; do
4048
case "$OPT" in
4149
h) usage; exit 0;;
50+
f) force="true";;
4251
p) postFix="${OPTARG}";;
4352
?) postFix="";; # handle optional -p argument "
4453
*) usage; exit 1;;
@@ -50,10 +59,14 @@ if [ ! -e "$GS_HOME/pharo/pharo" ]; then
5059
$GS_HOME/bin/installPharo
5160
fi
5261

53-
pharo=$GS_HOME/pharo
62+
message="create"
5463
if [ -e $pharo/todeClient${postFix}.image ] ; then
55-
echo "todeClient already installed"
56-
exit 0
64+
if [ "${force}x" = "x" ] ; then
65+
echo "todeClient already created, use -f to update"
66+
exit 0
67+
else
68+
message="update"
69+
fi
5770
fi
5871

5972

@@ -62,14 +75,15 @@ if [ -e $GS_HOME/tode/sys/local/pharo/todeLoad.st ] ; then
6275
todeLoadPath=$GS_HOME/tode/sys/local/pharo/todeLoad.st
6376
fi
6477

65-
echo "creating todeClient${postFix} image using $todeLoadPath"
78+
echo "${message} todeClient${postFix} image using $todeLoadPath"
6679

80+
pharo=$GS_HOME/pharo
6781
$pharo/pharo $pharo/Pharo.image save todeClientTmp
6882

6983
$pharo/pharo $pharo/todeClientTmp.image st --quit --save $todeLoadPath
7084

7185
$pharo/pharo $pharo/todeClientTmp.image save todeClient${postFix}
7286

73-
rm -f todeClientTmp.*
87+
rm -f $pharo/todeClientTmp.*
7488
echo
75-
echo "tODEClient${postFix} image creation complete"
89+
echo "tODEClient${postFix} image ${message} complete"

Diff for: bin/installServer

+24-5
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,30 @@ echo "================="
99

1010
usage() {
1111
cat <<HELP
12-
USAGE: $(basename $0) [-h] <stone-name> <gemstone-version>
12+
USAGE: $(basename $0) [-h] [-f] <stone-name> <gemstone-version>
1313
1414
Install GemStone/S, create a stone, start the stone, create a todeClient
1515
image. Runs the installGemstone, createTodeImage, createStone,
1616
startStone, startNetldi, startStatmonitor, installTodeStone and
1717
todeClient scripts.
1818
19+
If a stone named $stoneName exists, the existing directory will be left
20+
alone unless the -f option is specified in which case the existing
21+
stone directory is deleted.
22+
23+
If a todeClient image exists, the creation of a new image will be skipped
24+
unless the -f option is specified in which case the todeClient image is
25+
re-created.
26+
1927
OPTIONS
2028
-h display help
29+
-f force creation of stone and tode image
2130
2231
EXAMPLES
2332
$(basename $0) -h
2433
$(basename $0) kit 3.2.1
34+
$(basename $0) kit 3.2.1
35+
$(basename $0) -f kit 3.2.1
2536
2637
HELP
2738
}
@@ -30,8 +41,16 @@ set -e # exit on error
3041
if [ "${GS_HOME}x" = "x" ] ; then
3142
echo "the GS_HOME environment variable needs to be defined"; exit 1
3243
fi
33-
source ${GS_HOME}/bin/shFunctions
34-
getOpts_help $@
44+
45+
forceArg=""
46+
while getopts "fhns:" OPT ; do
47+
case "$OPT" in
48+
h) usage; exit 0;;
49+
f) forceArg="-f";;
50+
*) usage; exit 1;;
51+
esac
52+
done
53+
shift $(($OPTIND - 1))
3554

3655
if [ $# -ne 2 ]; then
3756
usage; exit 1
@@ -41,9 +60,9 @@ gsvers="$2"
4160

4261
$GS_HOME/bin/installGemStone $gsvers
4362

44-
$GS_HOME/bin/createTodeImage
63+
$GS_HOME/bin/createTodeImage $forceArg
4564

46-
$GS_HOME/bin/createStone $stoneName $gsvers
65+
$GS_HOME/bin/createStone $forceArg $stoneName $gsvers
4766

4867
if [ "${GS_TRAVIS}x" = "x" ] ; then
4968
$GS_HOME/bin/startStatmonitor $stoneName

Diff for: bin/todeClient

+9-10
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,33 @@ echo "================="
1010

1111
usage() {
1212
cat <<HELP
13-
USAGE: $(basename $0) [-h] [-c] [-p <postfix>]
13+
USAGE: $(basename $0) [-h] [-f] [-p <postfix>]
1414
1515
Launch todeClient image.
1616
1717
OPTIONS
1818
-h
1919
display help
20-
-c
21-
Clean and rebuild the todeClient image
20+
-f
21+
Rebuild the todeClient image
2222
-p <postfix>
2323
Launch the tode client image created with a matching postfix. If
2424
the tode client image does not exist, build it.
2525
2626
EXAMPLES
2727
$(basename $0) -h
28+
$(basename $0) -f
2829
$(basename $0)
2930
$(basename $0) -p _0 # Launches the image named todeClient_0.image
3031
3132
HELP
3233
}
3334

3435
postFix=""
35-
cleanImage=""
36-
while getopts "hp:" OPT ; do
36+
force=""
37+
while getopts "fhp:" OPT ; do
3738
case "$OPT" in
38-
c) cleanImage="clean";;
39+
c) force="true";;
3940
h) usage; exit 0 ;;
4041
p) postFix="${OPTARG}" ;;
4142
*) usage; exit 1 ;;
@@ -51,10 +52,8 @@ fi
5152
set -e # exit on error
5253
pharo=$GS_HOME/pharo
5354

54-
if [ -e $pharo/todeClient${postFix}.image ] ; then
55-
if [ "$cleanImage" = "clean" ] ; then
56-
rm $pharo/todeClient${postFix}.image $pharo/todeClient${postFix}.changes
57-
fi
55+
if [ "$force" = "true" ] ; then
56+
$GS_HOME/bin/createTodeImage -f -p ${postFix}
5857
fi
5958

6059
if [ ! -e $pharo/todeClient${postFix}.image ] ; then

Diff for: bin/updateTodeImage

-67
This file was deleted.

0 commit comments

Comments
 (0)