From: Rick L Bird Date: Sun, 8 May 2011 23:35:06 +0000 (-0400) Subject: Added framework to create restart out of restart.dst As this script wasnt' being... X-Git-Url: https://git.theari.com/?a=commitdiff_plain;h=c6bdb6848c91577e5dd8e6bf364bd83dcdc4f381;p=cobramush.git Added framework to create restart out of restart.dst As this script wasnt' being automagickally created. Also.. Upon distribution of an updated restart.dst the code will prompt to create a new restart from the restart.dst file. Unless they have no bash shell(as Debian is replacing dash with bash which use to be the default shell), if there is no bash shell present it give instructions how to copy the restart script. --- diff --git a/Makefile.in b/Makefile.in index 98318d8..4697972 100644 --- a/Makefile.in +++ b/Makefile.in @@ -128,14 +128,7 @@ customize: update-conf # other game directories. GAMEDIR=game -update-conf: game/mushcnf.dst game/aliascnf.dst game/restrictcnf.dst game/namescnf.dst - -@@TOUCH@ game/mushcnf.dst - -@@PERL@ utils/update-cnf.pl $(GAMEDIR)/mush.cnf game/mushcnf.dst - -@@TOUCH@ game/aliascnf.dst - -@@PERL@ utils/update-cnf.pl $(GAMEDIR)/alias.cnf game/aliascnf.dst - -@@TOUCH@ game/restrictcnf.dst - -@@PERL@ utils/update-cnf.pl $(GAMEDIR)/restrict.cnf game/restrictcnf.dst - -@if [ ! -f $(GAMEDIR)/names.cnf ]; then $(CP) game/namescnf.dst $(GAMEDIR)/names.cnf; fi +update-conf: game/mush.cnf game/alias.cnf game/restrict.cnf game/names.cnf game/restart $(GAMEDIR)/alias.cnf: game/aliascnf.dst -@@TOUCH@ game/aliascnf.dst @@ -150,6 +143,19 @@ $(GAMEDIR)/names.cnf: game/namescnf.dst $(CP) game/namescnf.dst $(GAMEDIR)/names.cnf \ fi +$(GAMEDIR)/restart: game/restart.dst +ifeq ("$(shell which bash)", "") + @echo "********************************************************************************"; + @echo "* Restart script has been updated in this distribution. *"; + @echo "* However, bash has not been installed on your system. *"; + @echo "* Please cp game/restart.dst to game/restart if you would like our updated *"; + @echo "* restart script. *"; + @echo "********************************************************************************"; +else + -@@BASH@ utils/checkrestart.sh +endif + + $(GAMEDIR)/mush.cnf: game/mushcnf.dst -@@TOUCH@ game/mushcnf.dst -@@PERL@ utils/update-cnf.pl $(GAMEDIR)/mush.cnf game/mushcnf.dst diff --git a/configure.ac b/configure.ac index e324915..e6d0b68 100644 --- a/configure.ac +++ b/configure.ac @@ -43,6 +43,7 @@ if test "${PERL+set}" != "set"; then AC_MSG_ERROR([perl is required to build and run CobraMUSH]) fi +AC_PATH_PROG(BASH, bash) AC_PATH_PROG(TEST, test) AC_PATH_PROG(TOUCH, touch) AC_PATH_PROG(RM, rm) diff --git a/utils/checkrestart.sh b/utils/checkrestart.sh new file mode 100755 index 0000000..d29d625 --- /dev/null +++ b/utils/checkrestart.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# Many systems are switching to dash are their default shell.. Well.. its syntax breaks us so we need to specify bash. + +if test ! -f game/restart ; then + echo "Creating restart script from restart.dst"; + cp game/restart.dst game/restart; +else + read -p "Restart script has changed in this distribution. Should we replace your current restart script with ours?" -n 1; + if [[ $REPLY =~ ^[Yy]$ ]];then + echo -e "\nSaving your restart script as restart.bup."; + cp game/restart game/restart.bup; + echo "Moving restart.dst to restart."; + cp game/restart.dst game/restart; + else + echo -e "\nOk.. not copying"; + fi +fi diff --git a/utils/preparedist.sh b/utils/preparedist.sh index c6c89b8..1b1f50a 100755 --- a/utils/preparedist.sh +++ b/utils/preparedist.sh @@ -15,6 +15,7 @@ chmod 755 utils/customize.pl chmod 755 utils/make_access_cnf.sh chmod 755 utils/update-cnf.pl chmod 755 utils/update.pl +chmod 755 utils/checkrestart.sh # Step 2: create auto-generated source/header files echo "Generating source and header files..."