# This patch file was generated by NetBeans IDE
# Following Index: paths are relative to: /home/lighta/Documents/Myscript/RO/Servs/rathena
# This patch can be applied using context Tools: Patch action on respective folder.
# It uses platform neutral UTF-8 encoding and \n newlines.
# Above lines and this line are ignored by the patching process.
Index: Makefile.in
--- Makefile.in Base (BASE)
+++ Makefile.in Locally Modified (Based On LOCAL)
@@ -2,13 +2,12 @@
HAVE_MYSQL=@HAVE_MYSQL@
ifeq ($(HAVE_MYSQL),yes)
- ALL_DEPENDS=common_sql login_sql char_sql map_sql tools import
- SQL_DEPENDS=common_sql login_sql char_sql map_sql import
+ ALL_DEPENDS=sql tools
+ SQL_DEPENDS=common_sql login_sql char_sql map_sql import test
COMMON_SQL_DEPENDS=mt19937ar libconfig
LOGIN_SQL_DEPENDS=mt19937ar libconfig common_sql
CHAR_SQL_DEPENDS=mt19937ar libconfig common_sql
MAP_SQL_DEPENDS=mt19937ar libconfig common_sql
- CONVERTERS_DEPENDS=common_sql
else
ALL_DEPENDS=needs_mysql
SQL_DEPENDS=needs_mysql
@@ -20,7 +19,7 @@
#####################################################################
-.PHONY: sql \
+.PHONY: all sql \
common_sql \
mt19937ar \
login_sql \
@@ -29,7 +28,8 @@
tools \
import \
test \
- clean help
+ clean help \
+ install uninstall bin-clean \
all: $(ALL_DEPENDS)
@@ -38,12 +38,6 @@
common_sql: $(COMMON_SQL_DEPENDS)
@$(MAKE) -C src/common sql
-mt19937ar:
- @$(MAKE) -C 3rdparty/mt19937ar
-
-libconfig:
- @$(MAKE) -C 3rdparty/libconfig
-
login_sql: $(LOGIN_SQL_DEPENDS)
@$(MAKE) -C src/login sql
@@ -53,6 +47,12 @@
map_sql: $(MAP_SQL_DEPENDS)
@$(MAKE) -C src/map sql
+mt19937ar:
+ @$(MAKE) -C 3rdparty/mt19937ar
+
+libconfig:
+ @$(MAKE) -C 3rdparty/libconfig
+
tools:
@$(MAKE) -C src/tool
@@ -94,46 +94,22 @@
@echo " 'map_sql' and 'import')"
@echo "'test' - builds tests"
@echo "'clean' - cleans builds and objects"
+ @echo "'install' - runs installer to set up rAthena in /opt/"
+ @echo "'bin-clean' - deletes installed binary"
+ @echo "'uninstall' - runs uninstaller to erase all installation changes"
@echo "'help' - outputs this message"
-#####################################################################
-
needs_mysql:
@echo "MySQL not found or disabled by the configure script"
@exit 1
-#####################################################################
-# TODO
+install:
+ @sh ./install.sh
-install: conf/%.conf conf/%.txt
- $(shell read -p "WARNING: This target does not work properly yet. Press Ctrl+C to cancel or Enter to continue.")
- $(shell mkdir -p /opt/rathena/bin/)
- $(shell mkdir -p /opt/rathena/etc/rathena/)
- $(shell mkdir -p /opt/rathena/var/log/rathena/)
- $(shell mv save /opt/rathena/etc/rathena/save)
- $(shell mv db /opt/rathena/etc/rathena/db)
- $(shell mv conf /opt/rathena/etc/rathena/conf)
- $(shell mv npc /opt/rathena/etc/rathena/npc)
- $(shell mv log/* /opt/rathena/var/log/rathena/)
- $(shell cp *-server* /opt/rathena/bin/)
- $(shell ln -s /opt/rathena/etc/rathena/save/ /opt/rathena/bin/)
- $(shell ln -s /opt/rathena/etc/rathena/db/ /opt/rathena/bin/)
- $(shell ln -s /opt/rathena/etc/rathena/conf/ /opt/rathena/bin/)
- $(shell ln -s /opt/rathena/etc/rathena/npc/ /opt/rathena/bin/)
- $(shell ln -s /opt/rathena/var/log/rathena/ /opt/rathena/bin/log)
-
bin-clean:
- $(shell rm /opt/rathena/bin/login-server*)
- $(shell rm /opt/rathena/bin/char-server*)
- $(shell rm /opt/rathena/bin/map-server*)
+ @sh ./uninstall.sh bin
uninstall:
- $(shell read -p "WARNING: This target does not work properly yet. Press Ctrl+C to cancel or Enter to continue.")
- bin-clean
- $(shell rm /opt/rathena/bin/save)
- $(shell rm /opt/rathena/bin/db)
- $(shell rm /opt/rathena/bin/conf)
- $(shell rm /opt/rathena/bin/npc)
- $(shell rm /opt/rathena/bin/log)
- $(shell rm -rf /opt/rathena/etc/rathena)
- $(shell rm -rf /opt/rathena/var/log/rathena)
+ @sh ./uninstall.sh all
+
+#####################################################################
Index: athena-start
--- athena-start Base (BASE)
+++ athena-start Locally Modified (Based On LOCAL)
@@ -1,64 +1,85 @@
#!/bin/sh
-# athena starting script by rowla
-# modified by [email protected] (NL101541)
-PATH=./:$PATH
+#source var/function
+. ./function.sh
+inst_launch_workaround
-L_SRV=login-server_sql
-C_SRV=char-server_sql
-M_SRV=map-server_sql
-
+PATH=./:$PATH
print_start() {
# more << EOF
echo "Athena Starting..."
-echo " (c) 2003 Athena Project"
-echo " modified by [email protected]"
+ echo " (c) 2013 rAthena Project"
echo ""
-#echo "Debug informations will appear,"
-#echo "since this is a test release."
-#echo ""
+ echo ""
echo "checking..."
#EOF
}
-check_files() {
-
- for i in ${L_SRV} ${C_SRV} ${M_SRV}
- do
- if [ ! -f ./$i ]; then
- echo "$i does not exist, or can't run."
- echo "Stop. Check your compile."
- exit 1;
+get_status(){
+ PIDFILE=.$1.pid
+ if [ -e ${PIDFILE} ]; then
+ ISRUN=$(ps ax | grep $(cat ${PIDFILE}) | grep $1)
+ PSRUN=$(echo "$ISRUN" | awk '{ print substr( $0, 0, 7) }')
fi
- done
+}
-# more << EOF
-echo "Check complete."
-echo "Looks good, a nice Athena!"
-#EOF
+#Checking if already started, launch and mark in log
+start_serv(){
+ LOGFILE=./log/$1.log
+ get_status $1
+ if [ -z ${PSRUN} ]; then
+ exec ./$1&
+ echo $! > .$1.pid
+ echo "Server '$1' started at `date +"%m-%d-%H:%M-%S"`" >> ${LOGFILE}
+ else echo "Can't start '$1' because it is already running p${PSRUN}" >> ${LOGFILE}
+ fi
}
+watch_serv(){
+ LOGFILE=./log/$1.log
+ ulimit -Sc unlimited
+ while true; do
+ get_status $1
+ if [ -z ${PSRUN} ]; then
+ $count=$count+1
+ echo "Server '$1' is down." >> ${LOGFILE}
+ echo "Restarting server at time at `date +"%m-%d-%H:%M-%S"`">> ${LOGFILE}
+ exec ./$1&
+ echo $! > .$1.pid
+
+ if [ $3 ] && [ $3 -lt $count ]; then break; fi
+ else sleep $2
+ fi
+}
+
case $1 in
'start')
print_start
check_files
-
- exec ./${L_SRV}&
- echo $! > .${L_SRV}.pid
- exec ./${C_SRV}&
- echo $! > .${C_SRV}.pid
- exec ./${M_SRV}&
- echo $! > .${M_SRV}.pid
-
+ echo "Check complete."
+ echo "Looks good, a nice Athena!"
+ for i in ${L_SRV} ${C_SRV} ${M_SRV}
+ do
+ start_serv $i
+ done
echo "Now Started Athena."
;;
+#experimental
+ 'watch')
+ for i in ${L_SRV} ${C_SRV} ${M_SRV}
+ do
+ watch_serv $i 10 3
+ done
+ echo "Now watching Athena."
+;;
'stop')
- for i in .${L_SRV}.pid .${C_SRV}.pid .${M_SRV}.pid
+ for i in ${L_SRV} ${C_SRV} ${M_SRV}
do
- if [ -e ./$i ]; then
- kill $(cat $i)
- rm $i
+ PIDFILE=.${i}.pid
+ if [ -e ./${PIDFILE} ]; then
+ kill $(cat ${PIDFILE})
+ rm ${PIDFILE}
fi
done
;;
@@ -66,7 +87,16 @@
$0 stop
$0 start
;;
+ 'status')
+ for i in ${L_SRV} ${C_SRV} ${M_SRV}
+ do
+ get_status ${i}
+ if [ ${PSRUN} ]; then echo "'${i}' is running p${PSRUN}"; else echo "${i} seems down"; fi
+ done
+;;
*)
- echo "Usage: athena-start { start | stop | restart }"
+ echo "Usage: athena-start { start | stop | restart | status | watch }"
;;
esac
+
+
Index: char-server.sh
--- char-server.sh Base (BASE)
+++ char-server.sh Locally Deleted
@@ -1,16 +0,0 @@
-#/bin/sh
-#Hi my naem is Kirt and I liek anime
-
-ulimit -Sc unlimited
-
-while [ 3 ] ; do
-if [ -f .stopserver3 ] ; then
-echo server marked down >> servlog.txt
-else
-echo restarting server at time at `date +"%m-%d-%H:%M-%S"`>> startlog.txt
-./char-server_sql
-fi
-
-sleep 5
-
-done
Index: function.sh
--- function.sh No Base Revision
+++ function.sh Locally New
@@ -0,0 +1,26 @@
+L_SRV=login-server_sql
+C_SRV=char-server_sql
+M_SRV=map-server_sql
+INST_PATH=/opt
+PKG=rathena
+PKG_PATH=$INST_PATH/$PKG
+
+check_files() {
+ for i in ${L_SRV} ${C_SRV} ${M_SRV}
+ do
+ if [ ! -f ./$i ]; then
+ echo "$i does not exist, exiting..."
+ exit 1;
+ fi
+ done
+}
+
+check_inst_right(){
+ if [ ! -w $INST_PATH ]; then echo "You must have sudo right to use this install (writte/read permission in /opt/ )" && exit; fi
+}
+
+inst_launch_workaround(){
+ if [ -d $PKG_PATH ]; then
+ if [ $(pwd) != $PKG_PATH ]; then cd $PKG_PATH; fi
+ fi
+}
Index: install.sh
--- install.sh No Base Revision
+++ install.sh Locally New
@@ -0,0 +1,25 @@
+#!/bin/sh
+#source var/function
+. ./function.sh
+
+check_inst_right
+check_files
+read -p "WARNING: This target is experimental. Press Ctrl+C to cancel or Enter to continue." readEnterKey
+mkdir -p $PKG_PATH/bin/
+mkdir -p $PKG_PATH/etc/$PKG/
+mkdir -p $PKG_PATH/var/$PKG/
+
+#We copy all file into opt/ dir and treat dir like normal unix arborescence
+rsync -r --exclude .svn db/ $PKG_PATH/var/$PKG/db
+rsync -r --exclude .svn log/ $PKG_PATH/var/$PKG/log
+rsync -r --exclude .svn conf/ $PKG_PATH/etc/$PKG/conf
+rsync -r --exclude .svn npc/ $PKG_PATH/npc
+cp athena-start $PKG_PATH/
+mv *-server* $PKG_PATH/bin/
+
+ln -fs $PKG_PATH/var/$PKG/db/ $PKG_PATH/db
+ln -fs $PKG_PATH/var/$PKG/log/ $PKG_PATH/log
+ln -fs $PKG_PATH/etc/$PKG/conf/ $PKG_PATH/conf
+ln -fs $PKG_PATH/athena-start /usr/bin/$PKG
+for f in $(ls $PKG_PATH/bin/) ; do ln -fs $PKG_PATH/bin/$f $PKG_PATH/$f; done
+echo "Installation complete. You can now control server with '$PKG start'."
Index: login-server.sh
--- login-server.sh Base (BASE)
+++ login-server.sh Locally Deleted
@@ -1,16 +0,0 @@
-#/bin/sh
-#Hi my naem is Kirt and I liek anime
-
-ulimit -Sc unlimited
-
-while [ 2 ] ; do
-if [ -f .stopserver2 ] ; then
-echo server marked down >> servlog.txt
-else
-echo restarting server at time at `date +"%m-%d-%H:%M-%S"`>> startlog.txt
-./login-server_sql
-fi
-
-sleep 5
-
-done
Index: map-server.sh
--- map-server.sh Base (BASE)
+++ map-server.sh Locally Deleted
@@ -1,16 +0,0 @@
-#/bin/sh
-#Hi my naem is Kirt and I liek anime
-
-ulimit -Sc unlimited
-
-while [ 1 ] ; do
-if [ -f .stopserver ] ; then
-echo server marked down >> servlog.txt
-else
-echo restarting server at time at `date +"%m-%d-%H:%M-%S"`>> startlog.txt
-./map-server_sql
-fi
-
-sleep 5
-
-done
Index: src/char/Makefile.in
--- src/char/Makefile.in Base (BASE)
+++ src/char/Makefile.in Locally Modified (Based On LOCAL)
@@ -21,35 +21,38 @@
HAVE_MYSQL=@HAVE_MYSQL@
ifeq ($(HAVE_MYSQL),yes)
- CHAR_SERVER_SQL_DEPENDS=obj_sql $(CHAR_OBJ) ../common/obj_sql/common_sql.a ../common/obj_all/common.a $(MT19937AR_OBJ)
+ SQL_DEPENDS=char-server_sql
else
- CHAR_SERVER_SQL_DEPENDS=needs_mysql
+ SQL_DEPENDS=needs_mysql
endif
+ALL_DEPENDS=sql
@SET_MAKE@
#####################################################################
-.PHONY : all char-server_sql clean help
+.PHONY : all sql clean help
-all: char-server_sql
+all: $(ALL_DEPENDS)
-char-server_sql: $(CHAR_SERVER_SQL_DEPENDS)
- @echo " LD $@"
- @@CC@ @LDFLAGS@ -o ../../char-server_sql@EXEEXT@ $(CHAR_OBJ) ../common/obj_sql/common_sql.a ../common/obj_all/common.a $(MT19937AR_OBJ) $(LIBCONFIG_OBJ) @LIBS@ @MYSQL_LIBS@
+sql: $(SQL_DEPENDS)
clean:
@echo " CLEAN char"
@rm -rf *.o obj_sql ../../char-server_sql@EXEEXT@
help:
- @echo "possible targets are 'char-server_sql' 'all' 'clean' 'help'"
- @echo "'char-server_sql' - char server (SQL version)"
+ @echo "possible targets are 'sql' 'all' 'clean' 'help'"
+ @echo "'sql' - char server (SQL version)"
@echo "'all' - builds all above targets"
@echo "'clean' - cleans builds and objects"
@echo "'help' - outputs this message"
#####################################################################
+char-server_sql: obj_sql $(CHAR_OBJ) ../common/obj_sql/common_sql.a ../common/obj_all/common.a $(MT19937AR_OBJ)
+ @echo " LD $@"
+ @@CC@ @LDFLAGS@ -o ../../char-server_sql@EXEEXT@ $(CHAR_OBJ) ../common/obj_sql/common_sql.a ../common/obj_all/common.a $(MT19937AR_OBJ) $(LIBCONFIG_OBJ) @LIBS@ @MYSQL_LIBS@
+
needs_mysql:
@echo "MySQL not found or disabled by the configure script"
@exit 1
Index: src/common/Makefile.in
--- src/common/Makefile.in Base (BASE)
+++ src/common/Makefile.in Locally Modified (Based On LOCAL)
@@ -24,11 +24,11 @@
HAVE_MYSQL=@HAVE_MYSQL@
ifeq ($(HAVE_MYSQL),yes)
- ALL_DEPENDS=sql
SQL_DEPENDS=common common_sql
else
SQL_DEPENDS=needs_mysql
endif
+ALL_DEPENDS=sql
@SET_MAKE@
Index: src/login/Makefile.in
--- src/login/Makefile.in Base (BASE)
+++ src/login/Makefile.in Locally Modified (Based On LOCAL)
@@ -19,19 +19,20 @@
HAVE_MYSQL=@HAVE_MYSQL@
ifeq ($(HAVE_MYSQL),yes)
- LOGIN_SERVER_SQL_DEPENDS=obj_sql $(LOGIN_SQL_OBJ) ../common/obj_sql/common_sql.a ../common/obj_all/common.a $(MT19937AR_OBJ)
+ SQL_DEPENDS=login-server_sql
else
- LOGIN_SERVER_SQL_DEPENDS=needs_mysql
+ SQL_DEPENDS=needs_mysql
endif
+ALL_DEPENDS= sql
@SET_MAKE@
#####################################################################
.PHONY :all sql clean help
-all: sql
+all: $(ALL_DEPENDS)
-sql: obj_sql login-server_sql
+sql: $(SQL_DEPENDS)
clean:
@echo " CLEAN login"
@@ -58,7 +59,7 @@
#executables
-login-server_sql: $(LOGIN_SERVER_SQL_DEPENDS)
+login-server_sql: obj_sql $(LOGIN_SQL_OBJ) ../common/obj_sql/common_sql.a ../common/obj_all/common.a $(MT19937AR_OBJ)
@echo " LD $@"
@@CC@ @LDFLAGS@ -o ../../login-server_sql@EXEEXT@ $(LOGIN_SQL_OBJ) ../common/obj_sql/common_sql.a ../common/obj_all/common.a $(MT19937AR_OBJ) $(LIBCONFIG_OBJ) @LIBS@ @MYSQL_LIBS@
Index: src/map/Makefile.in
--- src/map/Makefile.in Base (BASE)
+++ src/map/Makefile.in Locally Modified (Based On LOCAL)
@@ -31,13 +31,11 @@
HAVE_MYSQL=@HAVE_MYSQL@
ifeq ($(HAVE_MYSQL),yes)
- ALL_DEPENDS=txt sql
SQL_DEPENDS=map-server_sql
else
- ALL_TARGET=txt
SQL_DEPENDS=needs_mysql
endif
-TXT_DEPENDS=map-server
+ALL_DEPENDS=sql
HAVE_PCRE=@HAVE_PCRE@
ifeq ($(HAVE_PCRE),yes)
@@ -49,12 +47,10 @@
@SET_MAKE@
#####################################################################
-.PHONY : all txt sql clean help
+.PHONY : all sql clean help
all: $(ALL_DEPENDS)
-txt: $(TXT_DEPENDS)
-
sql: $(SQL_DEPENDS)
clean:
@@ -62,13 +58,8 @@
@rm -rf *.o obj_txt obj_sql ../../map-server@EXEEXT@ ../../map-server_sql@EXEEXT@
help:
-ifeq ($(HAVE_MYSQL),yes)
@echo "possible targets are 'sql' 'txt' 'all' 'clean' 'help'"
@echo "'sql' - map server (SQL version)"
-else
- @echo "possible targets are 'txt' 'all' 'clean' 'help'"
-endif
- @echo "'txt' - map server (TXT version)"
@echo "'all' - builds all above targets"
@echo "'clean' - cleans builds and objects"
@echo "'help' - outputs this message"
Index: src/test/Makefile.in
--- src/test/Makefile.in Base (BASE)
+++ src/test/Makefile.in Locally Modified (Based On LOCAL)
@@ -19,10 +19,14 @@
@SET_MAKE@
#####################################################################
-.PHONY :all test_spinlock
+.PHONY :all test_spinlock clean
all: test_spinlock
+test_spinlock: $(TEST_SPINLOCK_DEPENDS)
+ @echo " LD $@"
+ @@CC@ @LDFLAGS@ -o ../../test_spinlock@EXEEXT@ $(TEST_SPINLOCK_OBJ) ../common/obj_sql/common_sql.a ../common/obj_all/common.a $(MT19937AR_OBJ) $(LIBCONFIG_OBJ) @LIBS@ @MYSQL_LIBS@
+
clean:
@echo " CLEAN test"
@rm -rf *.o obj ../../test_spinlock@EXEEXT@
@@ -35,12 +39,6 @@
@echo " MKDIR obj"
@-mkdir obj
-#executables
-
-test_spinlock: $(TEST_SPINLOCK_DEPENDS)
- @echo " LD $@"
- @@CC@ @LDFLAGS@ -o ../../test_spinlock@EXEEXT@ $(TEST_SPINLOCK_OBJ) ../common/obj_sql/common_sql.a ../common/obj_all/common.a $(MT19937AR_OBJ) $(LIBCONFIG_OBJ) @LIBS@ @MYSQL_LIBS@
-
# login object files
obj/%.o: %.c $(COMMON_H) $(MT19937AR_H) $(LIBCONFIG_H)
Index: test.sh
--- test.sh No Base Revision
+++ test.sh Locally New
@@ -0,0 +1,39 @@
+#!/bin/sh
+L_SRV=login-server_sql
+C_SRV=char-server_sql
+M_SRV=map-server_sql
+INST_PATH=/opt
+PKG=rathena
+PKG_PATH=$INST_PATH/$PKG
+
+check_files() {
+ for i in ${L_SRV} ${C_SRV} ${M_SRV}
+ do
+ if [ ! -f ./$i ]; then
+ echo "$i does not exist, installation cannot proceed."
+ exit 1;
+ fi
+ done
+}
+
+if [ ! -w $INST_PATH ]; then echo "You must have sudo right to use this install (writte/read permission in $INST_PATH )" && exit; fi
+check_files
+read -p "WARNING: This target is experimental. Press Ctrl+C to cancel or Enter to continue." readEnterKey
+mkdir -p $PKG_PATH/bin/
+mkdir -p $PKG_PATH/etc/rathena/
+mkdir -p $PKG_PATH/var/rathena/
+
+#We copy all file into opt/ dir and treat dir like normal unix arborescence
+rsync -r --exclude .svn db/ $PKG_PATH/var/rathena/db
+rsync -r --exclude .svn log/ $PKG_PATH/var/rathena/log
+rsync -r --exclude .svn conf/ $PKG_PATH/etc/rathena/conf
+rsync -r --exclude .svn npc/ $PKG_PATH/npc
+cp athena-start $PKG_PATH/
+mv *-server* $PKG_PATH/bin/
+
+ln -fs $PKG_PATH/var/rathena/db/ $PKG_PATH/db
+ln -fs $PKG_PATH/var/rathena/log/ $PKG_PATH/log
+ln -fs $PKG_PATH/etc/rathena/conf/ $PKG_PATH/conf
+ln -fs $PKG_PATH/athena-start /usr/bin/rathena
+for f in $(ls $PKG_PATH/bin/) ; do ln -fs $PKG_PATH/bin/$f $PKG_PATH/$f; done
+echo "Installation complete. You can now control server with 'rathena start'"
Index: uninstall.sh
--- uninstall.sh No Base Revision
+++ uninstall.sh Locally New
@@ -0,0 +1,23 @@
+#!/bin/sh
+#source var/function
+. ./function.sh
+echo "My pkg path is $PKG_PATH"
+
+check_inst_right
+read -p "WARNING: This target is experimental. Press Ctrl+C to cancel or Enter to continue." readEnterKey
+case $1 in
+ 'bin')
+ echo "Starting binary cleanup..."
+ rm -rf $PKG_PATH/bin/*
+ echo "Binary file was deleted."
+ ;;
+ 'all')
+ echo "Starting uninstallation..."
+ rm -rf $PKG_PATH
+ rm -rf /usr/bin/$PKG
+ echo "Uninstallation successful."
+ ;;
+ '*')
+ echo "Please enter a target usage './uninstall { all | bin }'"
+esac
+