summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorSefa Eyeoglu2020-01-02 00:04:57 +0100
committerSefa Eyeoglu2020-01-02 00:06:26 +0100
commit952aa70af4a60ee4e42b08fd8877938c563135ab (patch)
treec8e95aa029920788082523989ad53338061ac3cf
parentcfe5175c2b130a5a07ad44f31914e96d77dcc10f (diff)
downloadaur-952aa70af4a60ee4e42b08fd8877938c563135ab.tar.gz
Bring package to current standards
-rw-r--r--.SRCINFO35
-rw-r--r--PKGBUILD66
-rw-r--r--default.conf5
-rw-r--r--service12
-rw-r--r--sysusers1
-rw-r--r--tmpfiles1
-rw-r--r--tshock-bin.install3
-rw-r--r--tshock.install21
-rw-r--r--tshock.sh69
-rw-r--r--tshock@.service12
10 files changed, 119 insertions, 106 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 10cef5c1849..a18096f61ab 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,21 +1,30 @@
-pkgbase = tshock
+pkgbase = tshock-bin
pkgdesc = A Terraria Server administration modification that runs on the open source TerrariaAPI.
- pkgver = 4.3.25
+ pkgver = 4.3.26
pkgrel = 1
epoch = 1
- url = http://tshock.co/xf/
- install = tshock.install
+ url = http://tshock.co/xf
+ install = tshock-bin.install
arch = any
- license = GPL
- depends = tmux
+ license = GPL3
depends = mono
- backup = srv/tshock/tshock/config.json
- source = https://github.com/NyxStudios/TShock/releases/download/v4.3.25/tshock_4.3.25.zip
+ depends = tmux
+ provides = tshock
+ conflicts = tshock
+ noextract = tshock_4.3.26.zip
+ backup = etc/conf.d/tshock
+ source = tshock_4.3.26.zip::https://github.com/Pryaxis/TShock/releases/download/v4.3.26/tshock_4.3.26.zip
source = tshock.sh
- source = tshock@.service
- sha512sums = 9d405df99d9acf52c53e48d164ae5894c25a70e5022eca478c0981f0aafb2b217dfeff8f8274b6b9fc6f7b21d1e05e037cc3d7e4d4be406116bea4802d22bb91
- sha512sums = e73ca357516700bbd4ec5e6529320984b81fc7c6abc882181a9a9b3aad32f0d655b7686470fdbf7a953ce1935a79dbed983397aff0bf7ff26a1611dbcca391fb
- sha512sums = 563ada981c2e08293462485fd85b2c4e0b190c55ed3bcea4139b955f931d970d97c2bd89fba5b190231e9f2adeddd2c385abd11781bf1a98b13b78b8951bf623
+ source = default.conf
+ source = service
+ source = tmpfiles
+ source = sysusers
+ sha512sums = b61712988fb34324625bbba49779655c7b92e067a720b7d116c41583addec3592ae0a879a02e664fa172572512c0aad56038a4d1e5535f47e31108cb683e300c
+ sha512sums = f0958448b53ff9851c47876b89f1cef6d3e33ce1b8cbe13167c685ed1c9d89a8bf0f01929d47200e4f0f964c3e7796a2d9ca558e5d9f1269db3f2e4537a6c97a
+ sha512sums = d530a528ba84d57dfcb360e03ec62b1b38da6fa2383bef8cdb0cd039ba6466b053dd99a130a858c86405c8957ba86a0a080f2f56089843a7055662fa41cee102
+ sha512sums = 7c1788f21664f038c32da6c0cbe817404a83f81b7b8be07bb0483d5ffd35991a07b647b18d7aa316db369edd4e7eab21c1b81ab3b45aa2c3692c6c63673a3fdb
+ sha512sums = a04b458932bb3882b9d40f9b5a9074b681e60cb3284635d1efb7e54293f39df334e7ae526dabf50f633ecdde980f287a939d3ea6eb0d4098663fbda21af70a65
+ sha512sums = 5752f8453fbb4d973ebe71bba371ae7b0ddd2313ccd17de89b3942d024e295805324085640756e7118e4cc76abee675f5e253526261cb62cb76b0bc155aca317
-pkgname = tshock
+pkgname = tshock-bin
diff --git a/PKGBUILD b/PKGBUILD
index 66b2b63c4c5..0e25bb2e26f 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,42 +1,50 @@
# Maintainer: Philip Abernethy <chais.z3r0@gmail.com>
-pkgname=tshock
-pkgver=4.3.25
+_pkgname=tshock
+pkgname=${_pkgname}-bin
+pkgver=4.3.26
# 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}.zip"
+url="http://tshock.co/xf"
+license=("GPL3")
+depends=("mono" "tmux")
+provides=($_pkgname)
+conflicts=($_pkgname)
+install="${pkgname}.install"
+source=("${_pkgname}_${pkgver}.zip::https://github.com/Pryaxis/TShock/releases/download/v${pkgver}/${_pkgname}_${pkgver}.zip"
'tshock.sh'
- 'tshock@.service')
+ 'default.conf'
+ 'service'
+ "tmpfiles"
+ "sysusers")
+noextract=("${_pkgname}_${pkgver}.zip")
+sha512sums=('b61712988fb34324625bbba49779655c7b92e067a720b7d116c41583addec3592ae0a879a02e664fa172572512c0aad56038a4d1e5535f47e31108cb683e300c'
+ 'f0958448b53ff9851c47876b89f1cef6d3e33ce1b8cbe13167c685ed1c9d89a8bf0f01929d47200e4f0f964c3e7796a2d9ca558e5d9f1269db3f2e4537a6c97a'
+ 'd530a528ba84d57dfcb360e03ec62b1b38da6fa2383bef8cdb0cd039ba6466b053dd99a130a858c86405c8957ba86a0a080f2f56089843a7055662fa41cee102'
+ '7c1788f21664f038c32da6c0cbe817404a83f81b7b8be07bb0483d5ffd35991a07b647b18d7aa316db369edd4e7eab21c1b81ab3b45aa2c3692c6c63673a3fdb'
+ 'a04b458932bb3882b9d40f9b5a9074b681e60cb3284635d1efb7e54293f39df334e7ae526dabf50f633ecdde980f287a939d3ea6eb0d4098663fbda21af70a65'
+ '5752f8453fbb4d973ebe71bba371ae7b0ddd2313ccd17de89b3942d024e295805324085640756e7118e4cc76abee675f5e253526261cb62cb76b0bc155aca317')
-sha512sums=('9d405df99d9acf52c53e48d164ae5894c25a70e5022eca478c0981f0aafb2b217dfeff8f8274b6b9fc6f7b21d1e05e037cc3d7e4d4be406116bea4802d22bb91'
- 'e73ca357516700bbd4ec5e6529320984b81fc7c6abc882181a9a9b3aad32f0d655b7686470fdbf7a953ce1935a79dbed983397aff0bf7ff26a1611dbcca391fb'
- '563ada981c2e08293462485fd85b2c4e0b190c55ed3bcea4139b955f931d970d97c2bd89fba5b190231e9f2adeddd2c385abd11781bf1a98b13b78b8951bf623')
+backup=("etc/conf.d/${_pkgname}")
-install=tshock.install
+package() {
+ install -Dm755 "${srcdir}/tshock.sh" "${pkgdir}/usr/bin/tshock"
-backup=('srv/tshock/tshock/config.json')
+ install -Dm644 "${srcdir}/default.conf" "${pkgdir}/etc/conf.d/${_pkgname}/default.conf"
-package() {
- install -d "${pkgdir}/srv/tshock/ServerPlugins/"
- install -d "${pkgdir}/etc/conf.d/tshock/"
- echo "BASEDIR=/srv/tshock
-PORT=7777
-WORLDDIR=Terraria/Worlds
-WORLD=World1
-SIZE=2" > "${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/"
+ # Install sysusers
+ install -Dm644 "${srcdir}/sysusers" "$pkgdir/usr/lib/sysusers.d/${_pkgname}.conf"
+
+ # Install tmpfiles
+ install -Dm644 "${srcdir}/tmpfiles" "$pkgdir/usr/lib/tmpfiles.d/${_pkgname}.conf"
+
+ # Install service
+ install -Dm644 "${srcdir}/service" "${pkgdir}/usr/lib/systemd/system/tshock@.service"
+
+ # Unzip server files
+ install -d "${pkgdir}/srv/tshock"
+ bsdtar -x -f "${srcdir}/${_pkgname}_${pkgver}.zip" -C "${pkgdir}/srv/tshock"
}
diff --git a/default.conf b/default.conf
new file mode 100644
index 00000000000..d23962f4b02
--- /dev/null
+++ b/default.conf
@@ -0,0 +1,5 @@
+BASEDIR=/srv/tshock
+PORT=7777
+WORLDDIR=Terraria/Worlds
+WORLD=World1
+SIZE=2
diff --git a/service b/service
new file mode 100644
index 00000000000..42042b29894
--- /dev/null
+++ b/service
@@ -0,0 +1,12 @@
+[Unit]
+Description=TShock Terraria server.
+
+[Service]
+Type=forking
+User=terraria
+Group=terraria
+ExecStart=/usr/bin/tshock start %i
+ExecStop=/usr/bin/tshock stop %i
+
+[Install]
+WantedBy=multi-user.target
diff --git a/sysusers b/sysusers
new file mode 100644
index 00000000000..9d482978dd1
--- /dev/null
+++ b/sysusers
@@ -0,0 +1 @@
+u terraria - "Terraria Server user" /srv/tshock
diff --git a/tmpfiles b/tmpfiles
new file mode 100644
index 00000000000..bca124823bd
--- /dev/null
+++ b/tmpfiles
@@ -0,0 +1 @@
+d /srv/tshock 0755 terraria terraria -
diff --git a/tshock-bin.install b/tshock-bin.install
new file mode 100644
index 00000000000..609e681cec5
--- /dev/null
+++ b/tshock-bin.install
@@ -0,0 +1,3 @@
+post_install() {
+ echo ">>> You can start the server in a default configuration by starting tshock@default.service"
+}
diff --git a/tshock.install b/tshock.install
deleted file mode 100644
index ac4440157bb..00000000000
--- a/tshock.install
+++ /dev/null
@@ -1,21 +0,0 @@
-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 ">>> You can start the server in a default configuration by starting 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
index 989f5741851..4e3afbed47f 100644
--- a/tshock.sh
+++ b/tshock.sh
@@ -3,16 +3,16 @@
CONFDIR='/etc/conf.d/tshock'
if [ -n "$2" ]; then
- INSTANCE=$2
+ INSTANCE=$2
else
- INSTANCE=default
+ INSTANCE=default
fi
if [ -r ${CONFDIR}/${INSTANCE}.conf ]; then
- source ${CONFDIR}/${INSTANCE}.conf
+ source ${CONFDIR}/${INSTANCE}.conf
else
- echo "TShock could not be started because ${CONFDIR}/${INSTANCE}.conf could not be read."
- exit 1
+ echo "TShock could not be started because ${CONFDIR}/${INSTANCE}.conf could not be read."
+ exit 1
fi
TMUX_CONSOLE=tshock-console-${INSTANCE}
@@ -55,35 +55,42 @@ TMUX_CONSOLE=tshock-console-${INSTANCE}
## wiki use.
case "$1" in
- start)
- if [ ! $(tmux has -t ${TMUX_CONSOLE} &> /dev/null) ]; then
- tmux new-session -d -s ${TMUX_CONSOLE} -d "cd ${BASEDIR}; mono --server --gc=sgen -O=all TerrariaServer.exe -port ${PORT} -worldpath ${WORLDDIR} -world ${WORLDDIR}/${WORLD}.wld -autocreate ${SIZE}"
- if [ $? -gt 0 ]; then
- exit 1
- fi
- else
- echo "This TShock instance is already running"
- exit 1
- fi
- ;;
+ start)
+ if tmux has-session -t ${TMUX_CONSOLE} &> /dev/null ; then
+ echo "This TShock instance is already running"
+ exit 1
+ else
+ tmux new-session -d -s ${TMUX_CONSOLE} -d "cd ${BASEDIR}; mono --server --gc=sgen -O=all TerrariaServer.exe -port ${PORT} -worldpath ${WORLDDIR} -world ${WORLDDIR}/${WORLD}.wld -autocreate ${SIZE}"
+ if [ $? -gt 0 ]; then
+ echo "Could not start instance"
+ exit 1
+ fi
+ 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
- ;;
+ stop)
+ if tmux has-session -t ${TMUX_CONSOLE} &> /dev/null ; then
+ 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
+ else
+ echo "This TShock instance is not running"
+ exit 1
+ fi
+ ;;
- console)
- tmux attach -t ${TMUX_CONSOLE}
- ;;
+ console)
+ if tmux has-session -t ${TMUX_CONSOLE} &> /dev/null ; then
+ tmux attach -t ${TMUX_CONSOLE}
+ else
+ echo "This TShock instance is not running"
+ exit 1
+ fi
+ ;;
- install)
- bash -c "cd ${BASEDIR}; mono --server --gc=sgen -O=all TerrariaServer.exe -worldpath ${WORLDDIR}"
- ;;
-
- *)
- echo "usage: $0 {start|backup|console|install} [instance]"
+ *)
+ echo "usage: $0 {start|backup|console} [instance]"
esac
exit 0
diff --git a/tshock@.service b/tshock@.service
deleted file mode 100644
index 95f43e49960..00000000000
--- a/tshock@.service
+++ /dev/null
@@ -1,12 +0,0 @@
-[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