diff options
author | So Wieso | 2016-08-15 23:09:59 +0900 |
---|---|---|
committer | So Wieso | 2016-08-15 23:09:59 +0900 |
commit | bf621f359ed90d9fcf4521b45f90dc55d4ddf8e5 (patch) | |
tree | b0d55010c96bd86033b756daa858b5b4114d4515 | |
download | aur-bf621f359ed90d9fcf4521b45f90dc55d4ddf8e5.tar.gz |
initial commit
-rw-r--r-- | .SRCINFO | 22 | ||||
-rwxr-xr-x | PKGBUILD | 63 | ||||
-rwxr-xr-x | starbound | 33 | ||||
-rw-r--r-- | starbound-client-server-gog.install | 47 | ||||
-rw-r--r-- | starbound_server | 37 | ||||
-rw-r--r-- | starbound_server.service | 14 |
6 files changed, 216 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..764d5dea0956 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,22 @@ +pkgbase = starbound-client-server-gog + pkgdesc = Starbound, an extraterrestrial sandbox adventure game (client + server, GOG-Version) + pkgver = 1.0.5 + pkgrel = 1 + url = http://playstarbound.com/ + install = starbound-client-server-gog.install + arch = i686 + arch = x86_64 + license = custom + optdepends = sdl2: needed for client + options = !strip + source = gog://gog_starbound_2.5.0.6.sh + source = starbound + source = starbound_server + source = starbound_server.service + md5sums = e38aaceaa3247e2674e3ff5265663525 + md5sums = b1edfe9aec35bc36d7fc8eb010cfdb05 + md5sums = a4da1d6f3638765fec7fa8bfebac6086 + md5sums = 80ebdcf3780e0ca8c93feaf5ee8d4eec + +pkgname = starbound-client-server-gog + diff --git a/PKGBUILD b/PKGBUILD new file mode 100755 index 000000000000..aab618f04a69 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,63 @@ +# maintainer: so wieso <sowieso@dukun.de> +pkgname=starbound-client-server-gog +pkgver=1.0.5 +pkgrel=1 +pkgdesc="Starbound, an extraterrestrial sandbox adventure game (client + server, GOG-Version)" +url="http://playstarbound.com/" +license=('custom') +arch=('i686' 'x86_64') +depends=('') +optdepends=('sdl2: needed for client') +source=("gog://gog_starbound_2.5.0.6.sh" + "starbound" + "starbound_server" + "starbound_server.service" + ) + +md5sums=('e38aaceaa3247e2674e3ff5265663525' + 'b1edfe9aec35bc36d7fc8eb010cfdb05' + 'a4da1d6f3638765fec7fa8bfebac6086' + '80ebdcf3780e0ca8c93feaf5ee8d4eec') +install=$pkgname.install + +# Download the GoG install script manually and place it in next to PKGBUILD, or setup a dlagent +DLAGENTS+=("gog::/usr/bin/echo %u - This is is not a real URL, you need to download the GOG file manually to \"$PWD\" or setup a gog:// DLAGENT. Read the wiki for more information.") +options=('!strip') +# Prevent compressing final package +PKGEXT='.pkg.tar' + +package(){ + staticdir="$pkgdir/usr/share/starbound" + configdir="$pkgdir/etc/conf.d/starbound/" + mkdir -p "$staticdir" + mkdir -p "$configdir" + mkdir -p "$pkgdir/usr/share/licenses/starbound" + mkdir -p "$pkgdir/usr/bin" + mkdir -p "$pkgdir/usr/share/"{applications,pixmaps} + cp -r "$srcdir"/data/noarch/game/{assets,linux,tiled} "$staticdir" + cp -r "$srcdir"/data/noarch/game/{storage,mods} "$configdir" + ln -s /etc/conf.d/starbound/mods "$staticdir/" + ln -s /etc/conf.d/starbound/storage "$staticdir/" + cp "$srcdir/data/noarch/docs/End User License Agreement.txt" "$pkgdir/usr/share/licenses/starbound/" + cp starbound{,_server} "$pkgdir/usr/bin" + chmod +x "$pkgdir/usr/bin"/starbound{,_server} + + install -Dm644 starbound_server.service "${pkgdir}/usr/lib/systemd/system/starbound_server.service" + + cat > "$pkgdir/usr/share/applications/starbound.desktop" <<EODesktopfile +[Desktop Entry] +Encoding=UTF-8 +Value=1.0 +Type=Application +Name=Starbound +GenericName=Starbound +Comment=Starbound, an extraterrestrial sandbox adventure game +Icon=starbound.png +Exec=starbound +Categories=Game; +Path=/tmp +EODesktopfile + cp "$srcdir/data/noarch/support/icon.png" "$pkgdir/usr/share/pixmaps/starbound.png" + +} + diff --git a/starbound b/starbound new file mode 100755 index 000000000000..3a865355a6a9 --- /dev/null +++ b/starbound @@ -0,0 +1,33 @@ +#!/bin/bash + +install_path="/usr/share/starbound" +config_path="$HOME/.config/starbound" + +tmpdir=$(mktemp -d -p /tmp starbound-${USER}-XXXXXXXX) + +if [[ ! -d "$config_path" ]] +then + mkdir -p "$config_path" + cp -r "$install_path/"{storage,mods} "$config_path/" +fi + +cd "$tmpdir" + +ln -s "$install_path/"{assets,tiled} . +ln -s "$config_path/"{storage,mods} . + +mkdir linux +cd linux + +# if anyone as an idea how to make this efficient please tell me (sowieso@dukun.de) +# is there any way to make an executable aware of the symlink-path? +for file in "$install_path"/linux/* +do + cp "$file" . +done + +primusrun="" +if which primusrun &> /dev/null; then primusrun=$(which primusrun); fi +$primusrun ./run-client.sh + +rm -r $tmpdir diff --git a/starbound-client-server-gog.install b/starbound-client-server-gog.install new file mode 100644 index 000000000000..384a1504ce94 --- /dev/null +++ b/starbound-client-server-gog.install @@ -0,0 +1,47 @@ +# mostly copied from minecraft-server package + +_game="starbound" +_user="starbound" + +post_install() { + getent group "${_user}" &>/dev/null + if [ $? -ne 0 ]; then + echo -e "\e[34;1m==>\e[39;1m Adding ${_user} system group... \e[0m" + groupadd -r ${_user} 1>/dev/null + fi + + getent passwd "${_user}" &>/dev/null + if [ $? -ne 0 ]; then + echo -e "\e[34;1m==>\e[39;1m Adding ${_user} system user... \e[0m" + useradd -r -g ${_user} -d "/usr/share/starbound" ${_user} 1>/dev/null + fi + + chown -R ${_user}:${_user} "/etc/conf.d/starbound" + + echo -e "\e[34;1m==>\e[39;1m NOTE: The world data is stored under /etc/conf.d/starbound/storage\e[0m" + echo -e "\e[34;1m==>\e[39;1m and the server runs as ${_user} user to increase security. \e[0m" + echo -e "\e[34;1m==>\e[39;1m NOTE: Use the starbound_server systemd-unit to start or stop the server \e[0m" +} + +post_upgrade() { + chown -R ${_user}:${_user} "/etc/conf.d/starbound" +} + +pre_remove() { + echo -e "\e[34;1m==>\e[39;1m Stopping and disabling ${_game}_server... \e[0m" + systemctl stop starbound_server.service + systemctl disable starbound_server.service +} + +post_remove() { + # Notifying the user of kept dirs + [[ -d "/etc/conf.d/starbound" ]] && chown -R root:root "/etc/conf.d/starbound" && echo -e "\e[34;1m==>\e[39;1m NOTE: Game saves in /etc/conf.d/starbound were kept on your system.\e[0m" + + echo -e "\e[34;1m==>\e[39;1m Removing ${_user} system user and group... \e[0m" + if getent passwd ${_user} >/dev/null 2>&1; then + userdel ${_user} 2>/dev/null + fi + if getent group ${_user} >/dev/null 2>&1; then + groupdel ${_user} + fi +} diff --git a/starbound_server b/starbound_server new file mode 100644 index 000000000000..51b1082facab --- /dev/null +++ b/starbound_server @@ -0,0 +1,37 @@ +#!/bin/bash + +logfile=/var/log/starbound.log +pidfile=/run/starbound.pid + +function init_server { + echo $$ > $pidfile + + echo -e "\n[$(date)] starting starbound server" >> $logfile + chown starbound:starbound $logfile +} + +function start_server { + cd /usr/share/starbound/linux + ./starbound_server >> "$logfile" & +} + +function stop_server { + pid=$(cat /run/starbound.pid) + kill $pid + rm /run/starbound.pid + echo -e "[$(date)] stopped starbound server" >> $logfile +} + +case $1 in + init) + init_server + ;; + start) + start_server + ;; + stop) + stop_server + ;; +esac + +exit 0 diff --git a/starbound_server.service b/starbound_server.service new file mode 100644 index 000000000000..988430e8d0fc --- /dev/null +++ b/starbound_server.service @@ -0,0 +1,14 @@ +[Unit] +Description=Starbound Server +After=local-fs.target network.target + +[Service] +Type=forking +ExecStartPre=+/usr/bin/starbound_server init +ExecStart=/usr/bin/starbound_server start +ExecStop=+/usr/bin/starbound_server stop +User=starbound +Group=starbound + +[Install] +WantedBy=multi-user.target |