Skip to content

Commit

Permalink
Add OS Commands;
Browse files Browse the repository at this point in the history
  • Loading branch information
Renegade-Master committed Jan 25, 2024
1 parent ce2980e commit 8276030
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 23 deletions.
58 changes: 37 additions & 21 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,31 @@
### User Additions ###
ZomboidConfig/
ZomboidDedicatedServer/

# Created by https://www.toptal.com/developers/gitignore/api/intellij+all,visualstudiocode,go
# Edit at https://www.toptal.com/developers/gitignore?templates=intellij+all,visualstudiocode,go

# Created by https://www.toptal.com/developers/gitignore/api/intellij+all,visualstudiocode
# Edit at https://www.toptal.com/developers/gitignore?templates=intellij+all,visualstudiocode
### Go ###
# If you prefer the allow list template instead of the deny list, see community template:
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
#
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/

# Go workspace file
go.work

### Intellij+all ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
Expand Down Expand Up @@ -70,6 +91,9 @@ atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml

# SonarLint plugin
.idea/sonarlint/

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
Expand All @@ -83,39 +107,31 @@ fabric.properties
.idea/caches/build_file_checksums.ser

### Intellij+all Patch ###
# Ignores the whole .idea folder and all .iml files
# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360

.idea/
# Ignore everything but code style settings and run configurations
# that are supposed to be shared within teams.

# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023
.idea/*

*.iml
modules.xml
.idea/misc.xml
*.ipr

# Sonarlint plugin
.idea/sonarlint
!.idea/codeStyles
!.idea/runConfigurations

### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace
!.vscode/*.code-snippets

# Local History for Visual Studio Code
.history/

# Built Visual Studio Code Extensions
*.vsix

### VisualStudioCode Patch ###
# Ignore all local history of files
.history
.ionide

# Support for Project snippet scope
!.vscode/*.code-snippets

# End of https://www.toptal.com/developers/gitignore/api/intellij+all,visualstudiocode
n
# End of https://www.toptal.com/developers/gitignore/api/intellij+all,visualstudiocode,go
Binary file removed cmd/zomboid-dedicated-server/out
Binary file not shown.
19 changes: 17 additions & 2 deletions internal/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,31 @@ package internal
import (
"log"
"os"
"os/exec"
"regexp"
)

const (
steamInstallFile = "/home/steam/install_server.scmd"
)

func SetVariables() {
log.Println("Setting Environment Variables")

setEnv("GAME_VERSION", "public")

log.Println("Environment Variables set!")
}

func ApplyPreInstallConfig() {
log.Println("Applying PreInstall Config")
gameVersion := os.Getenv("GAME_VERSION")

gameVersion := os.Getenv("GAME_VERSION")
newText := "beta " + gameVersion

replaceTextInFile("/home/steam/install_server.scmd", "beta .*", newText)
replaceTextInFile(steamInstallFile, "beta .*", newText)

log.Println("PreInstall Config set!")
}

func ApplyPostInstallConfig() {
Expand All @@ -26,6 +36,11 @@ func ApplyPostInstallConfig() {

func UpdateServer() {
log.Println("Updating Server")

myCmd := exec.Command("steamcmd", "+runscript", steamInstallFile)
if err := myCmd.Run(); err != nil {
log.Fatalf("Error executing command [%s]: [%s]\n", myCmd, err)
}
}

func TestFirstRun() {
Expand Down

0 comments on commit 8276030

Please sign in to comment.