From 49f0efadc892212a64127989b9fc33351a801fb6 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Tue, 19 May 2015 20:00:16 +0100 Subject: [PATCH 1/3] Added update functions option This new option will update the functions to the newest version by simply deleting the contents of the functions dir --- functions/fn_getopt | 20 +++++++++++++++----- functions/fn_update_funtions | 9 +++++++++ 2 files changed, 24 insertions(+), 5 deletions(-) create mode 100644 functions/fn_update_funtions diff --git a/functions/fn_getopt b/functions/fn_getopt index 0599a94f7..3d37713e0 100644 --- a/functions/fn_getopt +++ b/functions/fn_getopt @@ -22,6 +22,8 @@ case "$getopt" in update-restart) forceupdate=1; fn_update_check;; + update-functions) + fn_update_funtions;; validate) fn_validate;; monitor) @@ -41,7 +43,7 @@ case "$getopt" in auto-install) fn_autoinstall;; *) - echo "Usage: $0 {start|stop|restart|update|force-update|validate|monitor|email-test|details|backup|console|debug|install|auto-install}" + echo "Usage: $0 {start|stop|restart|update|force-update|update-funtions|validate|monitor|email-test|details|backup|console|debug|install|auto-install}" exit 1;; esac exit @@ -57,6 +59,8 @@ case "$getopt" in fn_restart;; update) fn_update_check;; + update-functions) + fn_update_funtions;; monitor) fn_monitor;; email-test) @@ -66,7 +70,7 @@ case "$getopt" in backup) fn_backup;; *) - echo "Usage: $0 {start|stop|restart|update|monitor|email-test|details|backup}" + echo "Usage: $0 {start|stop|restart|update|update-funtions|monitor|email-test|details|backup}" exit 1;; esac exit @@ -80,6 +84,8 @@ case "$getopt" in fn_stop;; restart) fn_restart;; + update-functions) + fn_update_funtions;; monitor) fn_monitor;; email-test) @@ -97,7 +103,7 @@ case "$getopt" in map-compressor) fn_compress_ut99maps;; *) - echo "Usage: $0 {start|stop|restart|monitor|email-test|details|backup|console|debug|install|map-compressor}" + echo "Usage: $0 {start|stop|restart|update-funtions|monitor|email-test|details|backup|console|debug|install|map-compressor}" exit 1;; esac exit @@ -120,6 +126,8 @@ case "$getopt" in update-restart) forceupdate=1; fn_update_check;; + update-functions) + fn_update_funtions;; validate) fn_validate;; monitor) @@ -141,7 +149,7 @@ case "$getopt" in map-compressor) fn_compress_unreal2maps;; *) - echo "Usage: $0 {start|stop|restart|update|validate|monitor|email-test|details|backup|console|debug|install|auto-install|map-compressor}" + echo "Usage: $0 {start|stop|restart|update|update-funtions|validate|monitor|email-test|details|backup|console|debug|install|auto-install|map-compressor}" exit 1;; esac exit @@ -156,6 +164,8 @@ case "$getopt" in fn_stop;; restart) fn_restart;; + update-functions) + fn_update_funtions;; monitor) fn_monitor;; email-test) @@ -173,7 +183,7 @@ case "$getopt" in map-compressor) fn_compress_unreal2maps;; *) - echo "Usage: $0 {start|stop|restart|monitor|email-test|details|backup|console|debug|install|map-compressor}" + echo "Usage: $0 {start|stop|restart|update-funtions|monitor|email-test|details|backup|console|debug|install|map-compressor}" exit 1;; esac exit diff --git a/functions/fn_update_funtions b/functions/fn_update_funtions new file mode 100644 index 000000000..6a52ac024 --- /dev/null +++ b/functions/fn_update_funtions @@ -0,0 +1,9 @@ +#!/bin/bash +# LGSM fn_update_funtions function +# Author: Daniel Gibbs +# Website: http://gameservermanagers.com +# Version: 190515 + +# Description: Deletes the functions dir to allow re-downloading of functions from GitHub. + +rm -rfv "${rootdir}/functions/"* From 0c0eca9b9502a5630d98ec18198b4cb5f5b2541f Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Tue, 19 May 2015 20:07:13 +0100 Subject: [PATCH 2/3] Added fn_update_functions --- functions/fn_functions | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/functions/fn_functions b/functions/fn_functions index fa1fb76a3..fb7a40bc0 100644 --- a/functions/fn_functions +++ b/functions/fn_functions @@ -2,7 +2,7 @@ # LGSM fn_functions function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -# Version: 160515 +# Version: 190515 # Description: Defines all functions to allow download and execution of functions using fn_runfunction. # This function is called first before any other function. Without this file other functions would not load. @@ -149,17 +149,27 @@ functionfile="${FUNCNAME}" fn_runfunction } +fn_update_check(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + +fn_update_functions(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + fn_update_dl(){ functionfile="${FUNCNAME}" fn_runfunction } -fn_validate(){ +fn_update_funtions(){ functionfile="${FUNCNAME}" fn_runfunction } -fn_update_check(){ +fn_validate(){ functionfile="${FUNCNAME}" fn_runfunction } From 624af378cc3d1a0c85f41a3d1420a8a82f1a6c09 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Tue, 19 May 2015 20:15:29 +0100 Subject: [PATCH 3/3] Added error checking. Corrected typo --- functions/fn_functions | 2 +- functions/fn_update_functions | 20 ++++++++++++++++++++ functions/fn_update_funtions | 9 --------- 3 files changed, 21 insertions(+), 10 deletions(-) create mode 100644 functions/fn_update_functions delete mode 100644 functions/fn_update_funtions diff --git a/functions/fn_functions b/functions/fn_functions index fb7a40bc0..1e19e39fa 100644 --- a/functions/fn_functions +++ b/functions/fn_functions @@ -164,7 +164,7 @@ functionfile="${FUNCNAME}" fn_runfunction } -fn_update_funtions(){ +fn_update_functions(){ functionfile="${FUNCNAME}" fn_runfunction } diff --git a/functions/fn_update_functions b/functions/fn_update_functions new file mode 100644 index 000000000..361af6988 --- /dev/null +++ b/functions/fn_update_functions @@ -0,0 +1,20 @@ +#!/bin/bash +# LGSM fn_update_functions function +# Author: Daniel Gibbs +# Website: http://gameservermanagers.com +# Version: 190515 + +# Description: Deletes the functions dir to allow re-downloading of functions from GitHub. + +fn_printdots "Updating functions" +fn_scriptlog "Updating functions" +sleep 1 +rm -rfv "${rootdir}/functions/"* +exitcode=$? +if [ "${exitcode}" == "0" ]; then + fn_printok "Updating functions" + fn_scriptlog "Successfull! Updating functions" +else + fn_printokfail "Updating functions" + fn_scriptlog "Failure! Updating functions" +fi diff --git a/functions/fn_update_funtions b/functions/fn_update_funtions deleted file mode 100644 index 6a52ac024..000000000 --- a/functions/fn_update_funtions +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash -# LGSM fn_update_funtions function -# Author: Daniel Gibbs -# Website: http://gameservermanagers.com -# Version: 190515 - -# Description: Deletes the functions dir to allow re-downloading of functions from GitHub. - -rm -rfv "${rootdir}/functions/"*