From 5fbbea45f62513cc0a215dfea2c99c68996ad3e9 Mon Sep 17 00:00:00 2001 From: h3o66 Date: Thu, 16 Apr 2015 16:50:18 +0200 Subject: [PATCH 1/8] create function file --- functions/fn_content_gmod | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 functions/fn_content_gmod diff --git a/functions/fn_content_gmod b/functions/fn_content_gmod new file mode 100644 index 000000000..e69de29bb From 6c58ff77b5731d9b9256881e89418b643461921c Mon Sep 17 00:00:00 2001 From: h3o66 Date: Thu, 16 Apr 2015 17:02:44 +0200 Subject: [PATCH 2/8] header commit --- functions/fn_content_gmod | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/functions/fn_content_gmod b/functions/fn_content_gmod index e69de29bb..09ab23d89 100644 --- a/functions/fn_content_gmod +++ b/functions/fn_content_gmod @@ -0,0 +1,6 @@ +#!/bin/bash +# LGSM fn_content_gmod function +# Author: Christian Birk +# E-Mail: github@birkc.de +# Version: 20150416 + From ae640c4e1167ed4bb8b6b7cb5e7c8c98f3b3c7a6 Mon Sep 17 00:00:00 2001 From: h3o66 Date: Wed, 22 Apr 2015 22:00:50 +0200 Subject: [PATCH 3/8] First Version --- functions/fn_content_gmod | 100 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) diff --git a/functions/fn_content_gmod b/functions/fn_content_gmod index 09ab23d89..cf821e7fc 100644 --- a/functions/fn_content_gmod +++ b/functions/fn_content_gmod @@ -4,3 +4,103 @@ # E-Mail: github@birkc.de # Version: 20150416 +# Check Root +fn_check_root + +# Variables +installcontent=-1 +contentid=0 + +# funktions +usage_content(){ + echo "Usage: ./$selfname content [install|update|validate|remove] [css|tf2|portal2]" +} + + +# Server installed +if [ ! -d "$filesdir" ]; then + echo "It seems that Garry's Mod is not installed please check \$filesdir" + exit 1 +fi + +# Install or Remove game ? +if [ "$parm_action" == "install" ]; then + installcontent=1 +elif [ "$parm_action" == "remove" ]; then + installcontent=0 +elif [ "$parm_action" == "update" ]; then + installcontent=2 +elif [ "$parm_action" == "validate" ]; then + installcontent=3 +else + usage_content + #For debugging + echo "$parm_action $parm_type $rootdir" + exit 1 +fi + +# Detect content +if [ "$parm_type" == "css" ]; then + contentid=232330 + contentfolder="$filesdir/content/css" +elif [ "$parm_type" == "tf2" ]; then + contentid=232250 + contentfolder="$filesdir/content/tf2" +elif [ "$parm_type" == "portal2" ]; then + contentid= + contentfolder="$filesdir/content/portal2" +else + usage_content + exit 1 +fi + +#Set ContentID +appid=${contentid} + +#Set FilesDir +filesdir=${contentfolder} + +# Contentdir already created ? +if [ ! -d "$filesdir/content" ]; then + mkdir $rootdir/content +fi + +if [ "$installcontent" == 1 ]; then + if [ ! -d "$contentfolder" ]; then + mkdir $contentfolder + fi + + echo " " + echo "Installing ${parm_type} Content" + echo "=================================" + fn_scriptlog "Installing ${parm_type} Content" + + fn_install_serverfiles + fn_install_complete + +elif [ "$installcontent" == 0 ]; then + if [ -d "$contentfolder" ]; then + rm -rf $contentfolder + else + echo "$parm_type was not installed on the Server before" + fi + +elif [ "$installcontent" == 2 ]; then + if [ ! -d "$contentfolder" ]; then + echo "$parm_type was not installed before" + exit 1 + fi + +elif [ "$installcontent" == 2 ]; then + if [ ! -d "$contentfolder" ]; then + echo "$parm_type was not installed before" + fi + echo " " + echo "Validate ${parm_type} Content" + echo "=================================" + + fn_validate + +else + #do Nothing +fi From da072e6a5f7d50b562a89442ad5f8130f16659aa Mon Sep 17 00:00:00 2001 From: h3o66 Date: Wed, 22 Apr 2015 22:01:25 +0200 Subject: [PATCH 4/8] Changes for Garrys Mod --- functions/fn_functions | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/functions/fn_functions b/functions/fn_functions index 80298516f..cc6ee0a4d 100644 --- a/functions/fn_functions +++ b/functions/fn_functions @@ -273,5 +273,10 @@ functionfile="${FUNCNAME}" fn_runfunction } +fn_content_gmod(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + # Calls on-screen messages fn_messages From 670c164cf55e81f06371ba9342abe08148f11dd2 Mon Sep 17 00:00:00 2001 From: h3o66 Date: Wed, 22 Apr 2015 22:02:37 +0200 Subject: [PATCH 5/8] Changes for Garrys Mod --- functions/fn_getopt | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/functions/fn_getopt b/functions/fn_getopt index ab2135a0c..657595468 100644 --- a/functions/fn_getopt +++ b/functions/fn_getopt @@ -68,6 +68,44 @@ esac exit } +fn_getopt_gmodserver(){ +case "$getopt" in + start) + fn_start;; + stop) + fn_stop;; + restart) + fn_restart;; + update) + fn_update_check;; + validate) + fn_validate;; + monitor) + fn_monitor;; + email-test) + fn_email_test;; + details) + fn_details;; + backup) + fn_backup;; + console) + fn_console;; + debug) + fn_debug;; + install) + fn_install;; + auto-install) + fn_autoinstall;; + content) + fn_content_gmod;; + *) + echo "Usage: $0 {start|stop|restart|update|validate|monitor|email-test|details|backup|console|debug|install|auto-install|content}" + exit 1;; +esac +exit +} + + fn_getopt_unreal(){ case "$getopt" in start) @@ -178,6 +216,8 @@ elif [ "${engine}" == "unreal2" ]; then fi elif [ "${engine}" == "unreal" ]; then fn_getopt_unreal +elif [ "$gamename" == "Garry's Mod" ]; then + fn_getopt_gmodserver else fn_getopt_generic -fi \ No newline at end of file +fi From c710bed3cf5c7d61d3e344ee6ce77ab111c3c6af Mon Sep 17 00:00:00 2001 From: h3o66 Date: Wed, 22 Apr 2015 22:09:26 +0200 Subject: [PATCH 6/8] Remove debugging message --- functions/fn_content_gmod | 2 -- 1 file changed, 2 deletions(-) diff --git a/functions/fn_content_gmod b/functions/fn_content_gmod index cf821e7fc..474752144 100644 --- a/functions/fn_content_gmod +++ b/functions/fn_content_gmod @@ -34,8 +34,6 @@ elif [ "$parm_action" == "validate" ]; then installcontent=3 else usage_content - #For debugging - echo "$parm_action $parm_type $rootdir" exit 1 fi From 48da5b99ed386417aded50771548900ff2cdd769 Mon Sep 17 00:00:00 2001 From: h3o66 Date: Wed, 22 Apr 2015 22:25:15 +0200 Subject: [PATCH 7/8] Corrected Update Function --- functions/fn_content_gmod | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/functions/fn_content_gmod b/functions/fn_content_gmod index 474752144..92a17505c 100644 --- a/functions/fn_content_gmod +++ b/functions/fn_content_gmod @@ -79,6 +79,8 @@ if [ "$installcontent" == 1 ]; then elif [ "$installcontent" == 0 ]; then if [ -d "$contentfolder" ]; then rm -rf $contentfolder + echo "" + echo "$parm_type was succesfully deleted" else echo "$parm_type was not installed on the Server before" fi @@ -89,6 +91,8 @@ elif [ "$installcontent" == 2 ]; then exit 1 fi + fn_update_check + elif [ "$installcontent" == 2 ]; then if [ ! -d "$contentfolder" ]; then echo "$parm_type was not installed before" From 35fe7fadfa8d43e3375c713d208ece1fec4e6296 Mon Sep 17 00:00:00 2001 From: h3o66 Date: Wed, 22 Apr 2015 22:41:01 +0200 Subject: [PATCH 8/8] add fn_check_update as dependency --- functions/fn_functions | 1 + 1 file changed, 1 insertion(+) diff --git a/functions/fn_functions b/functions/fn_functions index cc6ee0a4d..cd88fbf2c 100644 --- a/functions/fn_functions +++ b/functions/fn_functions @@ -275,6 +275,7 @@ fn_runfunction fn_content_gmod(){ functionfile="${FUNCNAME}" +fn_update_check fn_runfunction }