Skip to content
Browse files

detect version of erlang in boot script and rebuild them if needed

SVN Revision: 554
  • Loading branch information...
1 parent ffbf528 commit 0964e946011269bd757095dba4cfef2a8fea3300 @nniclausse nniclausse committed Nov 4, 2005
Showing with 37 additions and 0 deletions.
  1. +7 −0 Makefile.in
  2. +30 −0 idx-tsunami.sh.in
View
7 Makefile.in
@@ -110,6 +110,9 @@ BUILD_OPTIONS = '[{systools, \
}]}, \
{sh_script, none}, \
{make_app, true }, {make_rel, true}].'
+
+BUILD_OPTIONS_DOT = $(subst $(PWD)/temp/,./,$(BUILD_OPTIONS))
+
BUILD_OPTIONS_FILE = ./BUILD_OPTIONS
DIST_COMMON=Makefile.in $(CONFFILE_SRC) $(PERL_SCRIPTS_SRC) idx-tsunami.sh.in idx-tsunami.spec.in
@@ -155,11 +158,13 @@ install: doc boot install_recorder install_controller $(CONFFILE)
cp $(INC_FILES) $(TARGETDIR)/include
cp $(TARGET) $(TARGETDIR)/ebin
+ cp builder.beam $(TARGETDIR)/ebin
cp $(TGT_APPFILES_E) $(TARGETDIR)/ebin
cp $(TGT_APPFILES_P) $(TARGETDIR)/priv
cp $(SRC) $(SRC_APPFILES) $(TARGETDIR)/src
+ echo $(BUILD_OPTIONS_DOT) > $(TARGETDIR)/BUILD_OPTIONS
# install the man page & user's manual
install -d $(MAN_DIR)
@@ -192,6 +197,7 @@ install_recorder:
cp $(RECORDER_TGT_APPFILES_P) $(RECORDER_TARGETDIR)/priv
cp $(RECORDER_SRC) $(RECORDER_SRC_APPFILES) $(RECORDER_TARGETDIR)/src
+ echo $(BUILD_OPTIONS_DOT) > $(RECORDER_TARGETDIR)/BUILD_OPTIONS
install_controller:
install -d $(CONTROLLER_TARGETDIR)/priv
@@ -205,6 +211,7 @@ install_controller:
cp $(CONTROLLER_TGT_APPFILES_P) $(CONTROLLER_TARGETDIR)/priv
cp $(CONTROLLER_SRC) $(CONTROLLER_SRC_APPFILES) $(CONTROLLER_TARGETDIR)/src
+ echo $(BUILD_OPTIONS_DOT) > $(CONTROLLER_TARGETDIR)/BUILD_OPTIONS
uninstall:
rm -rf $(TARGETDIR) $(SCRIPT)
View
30 idx-tsunami.sh.in
@@ -30,6 +30,8 @@ REC_DEBUG_LEVEL=5
ERL_RSH=" -rsh ssh "
ERL_OPTS=" +A 1 @ERL_OPTS@ "
COOKIE='tsunami'
+ERTS_RUN=`$ERL -version 2>&1 | tr -d '[A-Za-z] (),\f\n\r'`
+ERTS_BOOT=`grep erts $TSUNAMIPATH/../priv/tsunami.rel | tr -d 'a-z{}"" ,\n'`
stop() {
$ERL $ERL_OPTS $ERL_RSH -noshell -sname killer -setcookie $COOKIE -pa $TSUNAMIPATH -pa $CONTROLLERPATH -s tsunami_controller stop_all $HOST -s init stop
@@ -39,6 +41,27 @@ stop_recorder() {
$ERL $ERL_OPTS $ERL_RSH -noshell -sname killer -setcookie $COOKIE -pa $TSUNAMIPATH -pa $RECORDERPATH -s tsunami_recorder stop_all $HOST -s init stop
}
+checkversion() {
+ if [ $ERTS_RUN != $ERTS_BOOT ]
+ then
+ echo "Erlang version has changed ! [$ERTS_BOOT] != [$ERTS_RUN]"
+ echo "Must create new boot files (you may have to run this once as root ! )"
+ makebootfiles
+ fi
+}
+
+makebootfiles() {
+ cd $TSUNAMIPATH/..
+ echo "creating boot file for tsunami application"
+ $ERL $ERL_OPTS -noshell -pa $TSUNAMIPATH -s builder go -s init stop > /dev/null
+ cd $CONTROLLERPATH/..
+ echo "creating boot file for tsunami_controller application"
+ $ERL $ERL_OPTS -noshell -pa $TSUNAMIPATH -s builder go -s init stop > /dev/null
+ echo "creating boot file for tsunami_recorder application"
+ cd $RECORDERPATH/..
+ $ERL $ERL_OPTS -noshell -pa $TSUNAMIPATH -s builder go -s init stop > /dev/null
+}
+
start() {
echo "Starting IDX-Tsunami"
$ERL $ERL_OPTS $ERL_RSH -noshell -sname $CONTROLLER -setcookie $COOKIE $BOOT_OPT \
@@ -116,19 +139,26 @@ shift $(($OPTIND - 1))
case $1 in
start)
checkconfig
+ checkversion
maindir
logdir
start
;;
recorder)
+ checkversion
maindir
logdir
recorder
;;
+ boot)
+ checkversion
+ ;;
+
debug)
checkconfig
+ checkversion
maindir
logdir
debug

0 comments on commit 0964e94

Please sign in to comment.
Something went wrong with that request. Please try again.