Thougt I chime in here! Thanks for a great game server application software!
I ran into a few problems with installing and uninstalling scripts within TCAdmin with the DayZ Stand Alone Server on Linux. Not so much TCAdmin's fault
Current modders of DayZ have ways of doing things and not all modders are uniformed in the way they pack mods
i.e Capitalization, single quotes in file names and directory names can break Linux from executing commands.
I took it upon myself to change a few lines of code in the Install and uninstall scripts for DayZ Stand Alone server.
It rewrites the folder names of the mod stripping out single quotes, double spaces, and commas in its name.
It also allows for either "key" "Key" and "Keys" "keys" folders to properly be searched for key files and place them in your servers' "keys" folder.
A lot of modders change the name of this folder all the time hence the capitalization.
After Workshop Content Installed Script:
import clr
from System import Array, String
from System.IO import File, Path, Directory, SearchOption
import re
servertag="Server"
servermods=""
mods=""
y=[]
ModName=""
# Check for FileTitle
if len(FileTitle) != 0:
# Check FileTitle for special character
for i in range(len(FileTitle)):
if bool(re.search('[a-zA-Z0-9 \]\[_\'+-]', FileTitle[i])) :
y.append(FileTitle[i])
else:
y.append("")
ModName= "".join(str(x) for x in y)
# Remove Single quote double spacing and single spacing in file name for linux compatibility
ModName= ModName.Replace(" "," ").Replace(" ","_").Replace("'","")
ModName= ModName.strip()
else:
ModName = FileId
if ThisService.Variables.HasValue("ServerMods") :
servermods=ThisService.Variables["ServerMods"]
if ThisService.Variables.HasValue("Mods") :
mods=ThisService.Variables["Mods"]
if Array.IndexOf(TagsArray, servertag) == -1 :
ThisService.Variables["Mods"]=String.Format("@{0}", ModName) + ";" + mods
else :
ThisService.Variables["ServerMods"]=String.Format("@{0}", ModName) + ";" + servermods
# Move folder to correct location
modfolder=Path.Combine(ThisService.RootDirectory, String.Format("@{0}", ModName))
if Directory.Exists(modfolder) :
Directory.Delete(modfolder, True)
Directory.Move(InstallPath, modfolder)
# Move keys to root key folder
modkeys=Path.Combine(modfolder, "keys")
rootkeys=Path.Combine(ThisService.RootDirectory, "keys")
Directory.CreateDirectory(rootkeys)
if Directory.Exists(modkeys) :
for file in Directory.GetFiles(modkeys, "*", SearchOption.AllDirectories):
keyfile = Path.Combine(rootkeys, Path.GetFileName(file))
if File.Exists(keyfile) :
File.Delete(keyfile)
File.Move(file, keyfile)
# Move key to root key folder
modkeys=Path.Combine(modfolder, "key")
if Directory.Exists(modkeys) :
for file in Directory.GetFiles(modkeys, "*", SearchOption.AllDirectories):
keyfile = Path.Combine(rootkeys, Path.GetFileName(file))
if File.Exists(keyfile) :
File.Delete(keyfile)
File.Move(file, keyfile)
# Move key to root key folder for linux compatibility with modders using captitalization in folder name
modkeys=Path.Combine(modfolder, "Key")
if Directory.Exists(modkeys) :
for file in Directory.GetFiles(modkeys, "*", SearchOption.AllDirectories):
keyfile = Path.Combine(rootkeys, Path.GetFileName(file))
if File.Exists(keyfile) :
File.Delete(keyfile)
File.Move(file, keyfile)
# Move key to root key folder for linux compatibility with modders using captitalization in folder name
modkeys=Path.Combine(modfolder, "Keys")
if Directory.Exists(modkeys) :
for file in Directory.GetFiles(modkeys, "*", SearchOption.AllDirectories):
keyfile = Path.Combine(rootkeys, Path.GetFileName(file))
if File.Exists(keyfile) :
File.Delete(keyfile)
File.Move(file, keyfile)
# Update command line
ThisService.Save()
ThisService.Configure()
After Workshop Content Uninstalled Script:
import clr
from System import Array, String
from System.IO import Path, Directory
import re
servermods=""
mods=""
y=[]
ModName=""
# Check for FileTitle
if len(FileTitle) != 0:
# Check FileTitle for special character
for i in range(len(FileTitle)):
if bool(re.search('[a-zA-Z0-9 \]\[_\'+-]', FileTitle[i])) :
y.append(FileTitle[i])
else:
y.append("")
ModName= "".join(str(x) for x in y)
# Remove Single quote double spacing and single spacing in file name for linux compatibility
ModName= ModName.Replace(" "," ").Replace(" ","_").Replace("'","")
ModName= ModName.strip()
else:
ModName = FileId
if ThisService.Variables.HasValue("ServerMods") :
servermods=ThisService.Variables["ServerMods"]
if ThisService.Variables.HasValue("Mods") :
mods=ThisService.Variables["Mods"]
ThisService.Variables["ServerMods"]=servermods.Replace(String.Format("@{0};", ModName), "")
ThisService.Variables["Mods"]=mods.Replace(String.Format("@{0};", ModName), "")
# Delete mod folder
modfolder=Path.Combine(ThisService.RootDirectory, String.Format("@{0}", ModName))
if Directory.Exists(modfolder) :
Directory.Delete(modfolder, True)
# Update command line
ThisService.Save()
ThisService.Configure()
Hope this helps guys! Thanks!