diff --git a/functions/fn_functions b/functions/fn_functions index fa1fb76a3..1e19e39fa 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_functions(){ functionfile="${FUNCNAME}" fn_runfunction } -fn_update_check(){ +fn_validate(){ functionfile="${FUNCNAME}" fn_runfunction } 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_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