summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilip Abernethy2015-07-14 11:21:53 +0200
committerPhilip Abernethy2015-07-14 11:21:53 +0200
commitb6053ccbf830452b15012860cbdcc98752077124 (patch)
tree640752cac32a21a006fe05707df2edb6481d452c
downloadaur-b6053ccbf830452b15012860cbdcc98752077124.tar.gz
Initial commit
-rw-r--r--.SRCINFO22
-rw-r--r--PKGBUILD38
-rw-r--r--tshock.install22
-rw-r--r--tshock.sh52
-rw-r--r--tshock@.service12
5 files changed, 146 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 00000000000..e401b108151
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,22 @@
+pkgbase = tshock
+ pkgdesc = A Terraria Server administration modification that runs on the open source TerrariaAPI.
+ pkgver = 4.3.5
+ pkgrel = 1
+ epoch = 1
+ url = http://tshock.co/xf/
+ install = tshock.install
+ arch = any
+ license = GPL
+ depends = tmux
+ depends = mono
+ source = https://github.com/NyxStudios/TShock/releases/download/v4.3.5/tshock_4.3.5-release.zip
+ source = tshock.sh
+ source = tshock.install
+ source = tshock@.service
+ sha512sums = b15c1518507a7bf7b700789fb55eb7c2ecc175d1da8585b4d12c118f6f64b8d82a2f72b048d4efc856e841ea48508a925b4717932d045caad5fdd93e3cd60904
+ sha512sums = bdf5a5a626f071b5a1a9aa60ffbc0f87078cf96a940af7ac6bb99798234a07021eaab61bef72bed0af7c5a821ffccb4eda5a50076e2133ae5643f2f2517e6265
+ sha512sums = fbc77767af27a998c42add8931f462365ac0cb21686262a6eea25b149daa8c9957bc5be70dd106038962a0bc0ba34a5ebadf6f8a13c4a92696eef916138d1986
+ sha512sums = 563ada981c2e08293462485fd85b2c4e0b190c55ed3bcea4139b955f931d970d97c2bd89fba5b190231e9f2adeddd2c385abd11781bf1a98b13b78b8951bf623
+
+pkgname = tshock
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 00000000000..b8bf06b778b
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,38 @@
+# Maintainer: Vincent Post <vincent.post@w1r3.net>
+
+pkgname=tshock
+pkgver=4.3.5
+# Because of tag 4.2200 is 4.2.2.1228 and tag 4.2202 is 4.2.2.0224 epoch must be 1
+epoch=1
+pkgrel=1
+pkgdesc="A Terraria Server administration modification that runs on the open source TerrariaAPI."
+arch=(any)
+url="http://tshock.co/xf/"
+license=("GPL")
+depends=('tmux'
+ 'mono')
+source=("https://github.com/NyxStudios/TShock/releases/download/v${pkgver}/${pkgname}_${pkgver}-release.zip"
+ 'tshock.sh'
+ 'tshock@.service')
+
+sha512sums=('b15c1518507a7bf7b700789fb55eb7c2ecc175d1da8585b4d12c118f6f64b8d82a2f72b048d4efc856e841ea48508a925b4717932d045caad5fdd93e3cd60904'
+ 'bdf5a5a626f071b5a1a9aa60ffbc0f87078cf96a940af7ac6bb99798234a07021eaab61bef72bed0af7c5a821ffccb4eda5a50076e2133ae5643f2f2517e6265'
+ '563ada981c2e08293462485fd85b2c4e0b190c55ed3bcea4139b955f931d970d97c2bd89fba5b190231e9f2adeddd2c385abd11781bf1a98b13b78b8951bf623')
+
+install=tshock.install
+
+package() {
+ install -d "${pkgdir}/srv/tshock/ServerPlugins/"
+ install -d "${pkgdir}/etc/conf.d/tshock/"
+ echo "BASEDIR=/srv/tshock
+PORT=7777
+WORLD=World1" > "${pkgdir}/etc/conf.d/tshock/default.conf"
+
+ install -Dm755 "${srcdir}/tshock.sh" "${pkgdir}/srv/tshock/"
+ install -Dm644 "${srcdir}/tshock@.service" "${pkgdir}/usr/lib/systemd/system/tshock@.service"
+
+ install -Dm644 "${srcdir}/ServerPlugins"/* "${pkgdir}/srv/tshock/ServerPlugins/"
+ install -Dm644 "${srcdir}/sqlite3.dll" "${pkgdir}/srv/tshock/"
+ install -Dm644 "${srcdir}/Newtonsoft.Json.dll" "${pkgdir}/srv/tshock/"
+ install -Dm644 "${srcdir}/TerrariaServer.exe" "${pkgdir}/srv/tshock/"
+}
diff --git a/tshock.install b/tshock.install
new file mode 100644
index 00000000000..c6250ba4f93
--- /dev/null
+++ b/tshock.install
@@ -0,0 +1,22 @@
+post_install() {
+ getent group tshock >/dev/null 2>&1 || groupadd tshock
+ getent passwd tshock >/dev/null 2>&1 || useradd -g tshock -d /srv/tshock/ -s /bin/bash tshock
+ chown -R tshock:tshock /srv/tshock/
+
+ echo ">>> Run \`sudo -u tshock /srv/tshock/tshock.sh install\` and create a world named World1
+ You can then start tshock@default.service"
+}
+
+post_upgrade() {
+ post_install $1
+}
+
+post_remove() {
+ if getent passwd tshock >/dev/null 2>&1; then
+ userdel tshock
+ fi
+ if getent group tshock >/dev/null 2>&1; then
+ groupdel tshock
+ fi
+}
+
diff --git a/tshock.sh b/tshock.sh
new file mode 100644
index 00000000000..ec3a49d2156
--- /dev/null
+++ b/tshock.sh
@@ -0,0 +1,52 @@
+#!/bin/bash
+
+CONFDIR='/etc/conf.d/tshock'
+
+if [ -n "$2" ]; then
+ INSTANCE=$2
+else
+ INSTANCE=default
+fi
+
+if [ -r ${CONFDIR}/${INSTANCE}.conf ]; then
+ source ${CONFDIR}/${INSTANCE}.conf
+else
+ echo "TShock could not be started because ${CONFDIR}/${INSTANCE}.conf could not be read."
+ exit 1
+fi
+
+TMUX_CONSOLE=tshock-console-${INSTANCE}
+
+case "$1" in
+ start)
+ if [ ! $(tmux has -t ${TMUX_CONSOLE}) ]; then
+ tmux new-session -d -s ${TMUX_CONSOLE} -d "cd ${BASEDIR}; mono TerrariaServer.exe -port ${PORT} -world My\ Games/Terraria/Worlds/${WORLD}.wld"
+ if [ $? -gt 0 ]; then
+ exit 1
+ fi
+ else
+ echo "Tshock already running"
+ exit 1
+ fi
+ ;;
+
+ stop)
+ tmux send-keys -t ${TMUX_CONSOLE} 'broadcast NOTICE: Server shutting down in 5 seconds!' C-m
+ sleep 5
+ tmux send-keys -t ${TMUX_CONSOLE} 'exit' C-m
+ sleep 10
+ ;;
+
+ console)
+ tmux attach -t ${TMUX_CONSOLE}
+ ;;
+
+ install)
+ bash -c "cd ${BASEDIR}; mono TerrariaServer.exe"
+ ;;
+
+ *)
+ echo "usage: $0 {start|backup|console|install} [instance]"
+esac
+
+exit 0
diff --git a/tshock@.service b/tshock@.service
new file mode 100644
index 00000000000..95f43e49960
--- /dev/null
+++ b/tshock@.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=A Terraria Server administration modification that runs on the open source TerrariaAPI.
+
+[Service]
+User=tshock
+Group=tshock
+ExecStart=/srv/tshock/tshock.sh start %i
+ExecStop=/srv/tshock/tshock.sh stop %i
+Type=forking
+
+[Install]
+WantedBy=multi-user.target