Skip to content

Commit

Permalink
Fixed metamod/sourcemod install bug which caused linux binaries to be…
Browse files Browse the repository at this point in the history
… installed on windows.

- if you had problems with sourcemod plugins on windows this will fix it
Upgraded Sourcemod to latest stable release 1.7 - build 5303
Sourcemod config page
- support for stock plugins + Franug-Weapon_Paints and Franug-Knifes
- add sourcemod admins (by steam id or ip)
- banprotection for running sourcemod plugins in lanonly mode
Automatically builds mapcycle.txt and maplist.txt
Now notifies you of csgosl updates
Now automatically upgrades metamod/sourcemod/plugins when csgosl is upgraded
New option to set IP the server should bind to (srcds command line option -ip)
- useful when running lanonly server over VLAN
- this option, if set, overrides the "-ip 0.0.0.0" fix for RCON on linux
  • Loading branch information
lenosisnickerboa committed May 9, 2016
1 parent 9313f71 commit 88ba1df
Show file tree
Hide file tree
Showing 25 changed files with 921 additions and 106 deletions.
12 changes: 8 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
OUT=out
CONTRIBOUT=contribs.txt
CONTRIBOUTTCL=src/contribs.tcl
ifndef CSGOSL_ROOT
$(error CSGOSL_ROOT is not set, source env.sh in root directory)
endif

OUT=$(CSGOSL_ROOT)/out
CONTRIBOUT=$(CSGOSL_ROOT)/contribs.txt
CONTRIBOUTTCL=$(CSGOSL_ROOT)/src/contribs.tcl

all: clean contribs windows linux

tag:
git tag -a v1.0.5 -m "Fixed autoupdateonstart bug"
git tag -a v1.1 -m "Sourcemod plugins page + updated sourcemod"

install:
$(MAKE) -C devtools/linux
Expand Down
10 changes: 7 additions & 3 deletions devtools/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,17 @@ TCLKIT=$ROOT/devtools/linux/tclkit
case $TARGET in
linux)
installdir $DEST/csgosl $DEST/bin $DEST/mods
install $DEST/mods "$ROOT"/mods/linux/mods.zip
install $DEST/mods "$ROOT"/mods/linux/mods.zip "$ROOT"/mods/linux/mods-risky.zip
install $DEST/bin "$ROOT"/src/*.tcl "$ROOT"/src/pics/*.jpg "$ROOT"/src/pics/*.png
install $DEST "$ROOT"/src/linux/csgosl.sh
install $DEST/bin "$ROOT"/src/linux/server.sh
touch $DEST/bin/needsupgrade
(cd "$DEST"/.. ; zip -r csgosl.zip csgosl) || error "Failed to zip"
(cd "$DEST"/.. ; mv csgosl.zip csgosl-linux.zip)
;;
windows)
installdir $DEST/csgosl.vfs $DEST/csgosl.vfs/lib $DEST/bin $DEST/mods
install $DEST/mods "$ROOT"/mods/linux/mods.zip
install $DEST/mods "$ROOT"/mods/windows/mods.zip "$ROOT"/mods/windows/mods-risky.zip
install $DEST/csgosl.vfs "$ROOT"/src/*.tcl "$ROOT"/src/pics/*.jpg "$ROOT"/src/pics/*.png
$TCLKIT $SDX unwrap "$ROOT"/devtools/windows/img.kit || error "Failed to unwrap img.kit"
install $DEST/csgosl.vfs/lib img.vfs/lib/Img/*
Expand All @@ -87,8 +88,11 @@ case $TARGET in
"$ROOT"/src/windows/server-status.bat \
"$ROOT"/src/windows/server-stop.bat \
"$ROOT"/src/windows/csgoslw.bat \
"$ROOT"/devtools/windows/unzip.exe $ROOT/devtools/windows/tclkit.exe
"$ROOT"/devtools/windows/unzip.exe \
"$ROOT"/devtools/windows/wget.exe \
$ROOT/devtools/windows/tclkit.exe
install $DEST "$ROOT"/src/windows/csgosl.vbs
touch $DEST/bin/needsupgrade
(cd "$DEST"/.. ; zip -r csgosl.zip csgosl) || error "Failed to zip"
(cd "$DEST"/.. ; mv csgosl.zip csgosl-windows.zip)
;;
Expand Down
12 changes: 11 additions & 1 deletion devtools/windows/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,18 @@ UNZIP_VERSION="6.00"
IMG_HOME_URL="http://www.tcl.tk/starkits/"
IMG_URL="http://www.tcl.tk/starkits/img.kit"
IMG_VERSION="1.3"
WGET_HOME_URL="https://www.gnu.org/software/wget"
WGET_URL="https://eternallybored.org/misc/wget/releases/wget-1.17.1-win32.zip"
WGET_VERSION="1.17.1-win32"

all: tclkit sdx img unzip
all: wget tclkit sdx img unzip

contribs:
@echo "$(TARGET) tclkit $(TCLKIT_VERSION) $(TCLKIT_HOME_URL) $(TCLKIT_URL)"
@echo "$(TARGET) sdx $(SDX_VERSION) $(SDX_HOME_URL) $(SDX_URL)"
@echo "$(TARGET) unzip $(UNZIP_VERSION) $(UNZIP_HOME_URL) $(UNZIP_URL)"
@echo "$(TARGET) img $(IMG_VERSION) $(IMG_HOME_URL) $(IMG_URL)"
@echo "$(TARGET) wget $(WGET_VERSION) $(WGET_HOME_URL) $(WGET_URL)"

tclkit:
wget $(TCLKIT_URL) -O tclkit.exe
Expand All @@ -38,6 +42,12 @@ unzip:
cp exclude_me/unzip.exe .
chmod +x unzip.exe

wget:
wget $(WGET_URL) -O wget.zip
unzip -o wget.zip -d exclude_me
cp exclude_me/wget.exe .
chmod +x wget.exe

clean:
\rm -f tclkit.exe sdx.kit img.kit unzip-self-extract.exe unzip.exe
\rm -rf exclude_me
3 changes: 3 additions & 0 deletions env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

export CSGOSL_ROOT=`pwd`
4 changes: 4 additions & 0 deletions mods/common.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
MODS_ROOT=$(CSGOSL_ROOT)/mods/$(TARGET)/mods
MODS_CONFIGS=$(MODS_ROOT)/addons/sourcemod/configs
MODS_PLUGINS=$(MODS_ROOT)/addons/sourcemod/plugins
MODS_TRANSLATIONS=$(MODS_ROOT)/addons/sourcemod/translations
36 changes: 23 additions & 13 deletions mods/linux/Makefile
Original file line number Diff line number Diff line change
@@ -1,33 +1,43 @@
#Linux
TARGET=linux
include ../common.mk
METAMOD_HOME_URL="http://www.metamodsource.net/"
METAMOD_URL="http://www.gsptalk.com/mirror/sourcemod/mmsource-1.10.6-linux.tar.gz"
METAMOD_VERSION="1.10.6"
SOURCEMOD_HOME_URL="http://www.sourcemod.net/"
SOURCEMOD_URL="http://www.sourcemod.net/smdrop/1.7/sourcemod-1.7.3-git5302-linux.tar.gz"
SOURCEMOD_VERSION="1.7.3-git5302"
SOURCEMOD_URL="http://www.sourcemod.net/smdrop/1.7/sourcemod-1.7.3-git5303-linux.tar.gz"
SOURCEMOD_VERSION="1.7.3-git5303"
export

all: mods

contribs:
@echo "$(TARGET) metamod $(METAMOD_VERSION) $(METAMOD_HOME_URL) $(METAMOD_URL)"
@echo "$(TARGET) sourcemod $(SOURCEMOD_VERSION) $(SOURCEMOD_HOME_URL) $(SOURCEMOD_URL)"
$(MAKE) -C ../mods/franug-knifes contrib
$(MAKE) -C ../mods/franug-weapon-paint contrib

metamod:
dl-metamod:
wget $(METAMOD_URL) -O metamod.tar.gz

sourcemod:
dl-sourcemod:
wget $(SOURCEMOD_URL) -O sourcemod.tar.gz

mods: metamod sourcemod
\rm -rf mods >/dev/null 2>&1
mkdir mods
(cd mods ; tar xzvpf ../metamod.tar.gz)
(cd mods ; tar xzvpf ../sourcemod.tar.gz)
cp ../metamod.vdf mods/addons/
(cd mods ; zip -r ../mods.zip *)
\rm -rf mods >/dev/null 2>&1
mods: dl-metamod dl-sourcemod
\rm -rf $(MODS_ROOT) mods*.zip >/dev/null 2>&1
mkdir -p $(MODS_ROOT)
(cd $(MODS_ROOT) ; tar xzvpf ../metamod.tar.gz)
(cd $(MODS_ROOT) ; tar xzvpf ../sourcemod.tar.gz)
(cd $(MODS_ROOT) ; zip -r ../mods.zip *)
\rm -rf $(MODS_ROOT) >/dev/null 2>&1
mkdir -p $(MODS_ROOT)
$(MAKE) -C ../mods/franug-knifes
$(MAKE) -C ../mods/franug-weapon-paint
(cd $(MODS_ROOT) ; zip -r ../mods-risky.zip *)
\rm -rf $(MODS_ROOT) >/dev/null 2>&1

clean:
\rm -f metamod.tar.gz sourcemod.tar.gz mods.zip
$(MAKE) -C ../mods/franug-knifes clean
$(MAKE) -C ../mods/franug-weapon-paint clean
\rm -f metamod.tar.gz sourcemod.tar.gz mods*.zip

4 changes: 0 additions & 4 deletions mods/metamod.vdf

This file was deleted.

21 changes: 21 additions & 0 deletions mods/mods/franug-knifes/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FRANUG_KNIFES_HOME_URL="https://github.com/Franc1sco/Franug-Knifes"
FRANUG_KNIFES_URL="https://github.com/Franc1sco/Franug-Knifes/archive/ff449c6.zip"
FRANUG_KNIFES_VERSION="sha-ff449c6-2016-05-05"

all: build

contrib:
@echo "$(TARGET) franug_knifes $(FRANUG_KNIFES_VERSION) $(FRANUG_KNIFES_HOME_URL) $(FRANUG_KNIFES_URL)"

dl:
wget $(FRANUG_KNIFES_URL) -O franug-knifes.zip

build: dl
unzip -o franug-knifes.zip
(cd Franug-Knifes-* ; mkdir -p $(MODS_CONFIGS) && cp -f csgo_knives.cfg $(MODS_CONFIGS)/)
(cd Franug-Knifes-* ; mkdir -p $(MODS_PLUGINS)/disabled && cp -f sm_franugknife.smx $(MODS_PLUGINS)/disabled/)
\rm -rf Franug-Knifes-*

clean:
\rm -f franug-knifes.zip
\rm -rf Franug-Knifes-*
23 changes: 23 additions & 0 deletions mods/mods/franug-weapon-paint/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FRANUG_WEAPON_PAINTS_HOME_URL="https://github.com/Franc1sco/Franug-Weapon_Paints"
FRANUG_WEAPON_PAINTS_URL="https://github.com/Franc1sco/Franug-Weapon_Paints/archive/fc7178d.zip"
FRANUG_WEAPON_PAINTS_VERSION="sha-fc7178d-2016-05-05"

all: build

contrib:
@echo "$(TARGET) franug_weapon_paints $(FRANUG_WEAPON_PAINTS_VERSION) $(FRANUG_WEAPON_PAINTS_HOME_URL) $(FRANUG_WEAPON_PAINTS_URL)"

dl:
wget $(FRANUG_WEAPON_PAINTS_URL) -O franug-weapon-paint.zip

build: dl
unzip -o franug-weapon-paint.zip
cp -f databases.cfg $(MODS_CONFIGS)/
(cd Franug-Weapon_Paints-* ; mkdir -p $(MODS_CONFIGS) && cp -f csgo_wpaints.cfg $(MODS_CONFIGS)/)
(cd Franug-Weapon_Paints-* ; mkdir -p $(MODS_PLUGINS)/disabled && cp -f franug_weaponpaints_public.smx $(MODS_PLUGINS)/disabled/)
(cd Franug-Weapon_Paints-* ; mkdir -p $(MODS_TRANSLATIONS) && cp -f franug_weaponpaints.phrases.txt $(MODS_TRANSLATIONS)/)
\rm -rf Franug-Weapon_Paints-*

clean:
\rm -f franug-weapon-paint.zip
\rm -rf Franug-Weapon_Paints-*
40 changes: 40 additions & 0 deletions mods/mods/franug-weapon-paint/databases.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
"Databases"
{
"driver_default" "mysql"

// When specifying "host", you may use an IP address, a hostname, or a socket file path

"default"
{
"driver" "default"
"host" "localhost"
"database" "sourcemod"
"user" "root"
"pass" ""
//"timeout" "0"
//"port" "0"
}

"storage-local"
{
"driver" "sqlite"
"database" "sourcemod-local"
}

"clientprefs"
{
"driver" "sqlite"
"host" "localhost"
"database" "clientprefs-sqlite"
"user" "root"
"pass" ""
//"timeout" "0"
//"port" "0"
}

"weaponpaints"
{
"driver" "sqlite"
"database" "weaponpaints"
}
}
36 changes: 23 additions & 13 deletions mods/windows/Makefile
Original file line number Diff line number Diff line change
@@ -1,32 +1,42 @@
#Windows
TARGET=windows
include ../common.mk
METAMOD_HOME_URL="http://www.metamodsource.net/"
METAMOD_URL="http://mirror.pointysoftware.net/alliedmodders/mmsource-1.10.6-windows.zip"
METAMOD_VERSION="1.10.6"
SOURCEMOD_HOME_URL="http://www.sourcemod.net/"
SOURCEMOD_URL="https://www.sourcemod.net/smdrop/1.7/sourcemod-1.7.3-git5302-windows.zip"
SOURCEMOD_VERSION="1.7.3-git5302"
SOURCEMOD_URL="https://www.sourcemod.net/smdrop/1.7/sourcemod-1.7.3-git5303-windows.zip"
SOURCEMOD_VERSION="1.7.3-git5303"
export

all: mods

contribs:
@echo "$(TARGET) metamod $(METAMOD_VERSION) $(METAMOD_HOME_URL) $(METAMOD_URL)"
@echo "$(TARGET) sourcemod $(SOURCEMOD_VERSION) $(SOURCEMOD_HOME_URL) $(SOURCEMOD_URL)"
$(MAKE) -C ../mods/franug-knifes contrib
$(MAKE) -C ../mods/franug-weapon-paint contrib

metamod:
dl-metamod:
wget $(METAMOD_URL) -O metamod.zip

sourcemod:
dl-sourcemod:
wget $(SOURCEMOD_URL) -O sourcemod.zip

mods: metamod sourcemod
\rm -rf mods >/dev/null 2>&1
mkdir mods
(cd mods ; unzip -o ../metamod.zip)
(cd mods ; unzip -o ../sourcemod.zip)
cp ../metamod.vdf mods/addons/
(cd mods ; zip -r ../mods.zip *)
\rm -rf mods >/dev/null 2>&1
mods: dl-metamod dl-sourcemod
\rm -rf $(MODS_ROOT) mods*.zip >/dev/null 2>&1
mkdir -p $(MODS_ROOT)
(cd $(MODS_ROOT) ; unzip -o ../metamod.zip)
(cd $(MODS_ROOT) ; unzip -o ../sourcemod.zip)
(cd $(MODS_ROOT) ; zip -r ../mods.zip *)
\rm -rf $(MODS_ROOT) >/dev/null 2>&1
mkdir -p $(MODS_ROOT)
$(MAKE) -C ../mods/franug-knifes
$(MAKE) -C ../mods/franug-weapon-paint
(cd $(MODS_ROOT) ; zip -r ../mods-risky.zip *)
\rm -rf $(MODS_ROOT) >/dev/null 2>&1

clean:
\rm -f metamod.zip sourcemod.zip mods.zip
$(MAKE) -C ../mods/franug-knifes clean
$(MAKE) -C ../mods/franug-weapon-paint clean
\rm -f metamod.zip sourcemod.zip mods*.zip
73 changes: 64 additions & 9 deletions src/config_file.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,55 @@ proc SaveMapGroupsMapper {filename} {
close $fileId
}

proc IsValidIp {ip} {
if {[scan $ip %d.%d.%d.%d a b c d] == 4
&& 0 <= $a && $a <= 255 && 0 <= $b && $b <= 255
&& 0 <= $c && $c <= 255 && 0 <= $d && $d <= 255} {
return true
} else {
return false
}
}

proc SaveSimpleAdminsFile {filename admins} {
set fp [open "$filename" "w"]
puts $fp "//Autogenerated by csgosl at [clock format [clock seconds]]"
puts $fp "//DON'T EDIT, WILL BE OVERWRITTEN NEXT TIME YOU SAVE!!!"
foreach admin $admins {
if { [IsValidIp $admin] } {
puts $fp "\"!$admin\" \"98:z\""
} else {
puts $fp "\"$admin\" \"98:z\""
}
}
close $fp
}

proc SaveMaps {filename maps} {
set fp [open "$filename" "w"]
puts $fp "//Autogenerated by csgosl at [clock format [clock seconds]]"
puts $fp "//DON'T EDIT, WILL BE OVERWRITTEN NEXT TIME YOU SAVE!!!"
foreach map $maps {
puts $fp $map
}
close $fp
}

proc SaveMapListTxt {filename} {
global allMaps
SaveMaps $filename $allMaps
}

proc SaveMapCycleTxt {filename selectedMapGroup} {
global mapGroupsMapper
if { [dict exists $mapGroupsMapper $selectedMapGroup] } {
SaveMaps $filename [dict get $mapGroupsMapper $selectedMapGroup]
} else {
global allMaps
SaveMaps $filename $allMaps
}
}

proc SaveConfigFile {configName} {
global $configName
set config [set $configName]
Expand All @@ -137,18 +186,21 @@ proc SaveConfigFile {configName} {
set values [dict get $config values]
set meta [dict get $config meta]

global ValueToSkip
set fileId [open $fileName "w"]
dict for {key value} $values {
set valueName [GetGlobalConfigVariableName $prefix $key]
global $valueName
set value [set $valueName]
set values [dict set values $key "$value"]
set metaItem [dict get $meta $key]
set type [dict get $metaItem type]
if {$type == "line"} {
puts $fileId $value
} else {
puts $fileId "$key \"$value\""
if { $value != $ValueToSkip } {
set values [dict set values $key "$value"]
set metaItem [dict get $meta $key]
set type [dict get $metaItem type]
if {$type == "line"} {
puts $fileId $value
} else {
puts $fileId "$key \"$value\""
}
}
}
set $configName [dict set config values $values]
Expand Down Expand Up @@ -208,8 +260,11 @@ proc SaveSourceModAdmins {configName} {
if {$makeMeAdmin != "1" || $steamUserName == "" || $steamId == ""} {
return 0
}
global serverFolder
set fileName $serverFolder/csgo/addons/sourcemod/configs/admins.cfg
global modsFolder
if { ! [file exists "$modsFolder/sourcemod"] } {
return 0
}
set fileName "$modsFolder/sourcemod/configs/admins.cfg"
set fileid [open "$fileName" "w"]
puts $fileid "//Autogenerated by csgosl at [clock format [clock seconds]]"
puts $fileid "//DON'T EDIT, WILL BE OVERWRITTEN NEXT TIME YOU SAVE!!!"
Expand Down
Loading

0 comments on commit 88ba1df

Please sign in to comment.