summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorGordian Edenhofer2020-01-14 20:34:55 +0100
committerGordian Edenhofer2020-01-14 20:34:55 +0100
commitc7f3ffbfbfd2f2e607d3dc6585c3c3ceab4d9112 (patch)
tree17cab0be4ed826f5b95beeecd32674807ed738bd
parentbbcae98da5891919cb7c0f8e6f1a048f65e7c592 (diff)
downloadaur-c7f3ffbfbfd2f2e607d3dc6585c3c3ceab4d9112.tar.gz
upgpkg: minecraft-server 1.15.1-2
Introduce a new config flag called `BACKUP_FLAGS` for specifying additional flags which to pass to tar for compression. Additionally, replace `Type=forking` with `Type=oneshot` in the backup services as to not let the backup timeout. Furthermore, change some upper case variables to lower case ones. upgpkg: spigot 1.15.1+b107-1 upgpkg: cuberite 1.12b1065-1 upgpkg: papermc 1.15.1+b48-1
-rw-r--r--.SRCINFO4
-rwxr-xr-xPKGBUILD2
-rw-r--r--spigot-backup.service2
-rwxr-xr-xspigot.sh25
4 files changed, 17 insertions, 16 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 6ae7f4e50e6..429d96f03e5 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,6 +1,6 @@
pkgbase = spigot
pkgdesc = High performance Minecraft server implementation
- pkgver = 1.15.1+b105
+ pkgver = 1.15.1+b107
pkgrel = 1
url = https://www.spigotmc.org/
install = spigot.install
@@ -24,7 +24,7 @@ pkgbase = spigot
conflicts = craftbukkit
conflicts = spigot-patcher
backup = etc/conf.d/spigot
- source = BuildTools-1.15.1+b105.jar::https://hub.spigotmc.org/jenkins/job/BuildTools/105/artifact/target/BuildTools.jar
+ source = BuildTools-1.15.1+b107.jar::https://hub.spigotmc.org/jenkins/job/BuildTools/107/artifact/target/BuildTools.jar
source = spigot-backup.service
source = spigot-backup.timer
source = spigot.service
diff --git a/PKGBUILD b/PKGBUILD
index 62bedbad2f0..72ecc498062 100755
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -3,7 +3,7 @@
pkgname=spigot
_pkgver=1.15.1
-_build=105
+_build=107
pkgver="${_pkgver}+b${_build}"
pkgrel=1
pkgdesc="High performance Minecraft server implementation"
diff --git a/spigot-backup.service b/spigot-backup.service
index 9d64e48bf5c..5c497785bdc 100644
--- a/spigot-backup.service
+++ b/spigot-backup.service
@@ -3,7 +3,7 @@ Description=Spigot World Backup
After=local-fs.target
[Service]
-Type=forking
+Type=oneshot
ExecStart=/usr/bin/spigot backup
User=craftbukkit
Group=craftbukkit
diff --git a/spigot.sh b/spigot.sh
index c9dc3ed640d..7a5b1cf760b 100755
--- a/spigot.sh
+++ b/spigot.sh
@@ -12,6 +12,7 @@ declare -r game="spigot"
[[ -n "${SERVER_ROOT}" ]] && declare -r SERVER_ROOT=${SERVER_ROOT} || SERVER_ROOT="/srv/craftbukkit"
[[ -n "${BACKUP_DEST}" ]] && declare -r BACKUP_DEST=${BACKUP_DEST} || BACKUP_DEST="/srv/craftbukkit/backup"
[[ -n "${BACKUP_PATHS}" ]] && declare -r BACKUP_PATHS=${BACKUP_PATHS} || BACKUP_PATHS="world world_nether world_the_end"
+[[ -n "${BACKUP_FLAGS}" ]] && declare -r BACKUP_FLAGS=${BACKUP_FLAGS} || BACKUP_FLAGS="-z"
[[ -n "${KEEP_BACKUPS}" ]] && declare -r KEEP_BACKUPS=${KEEP_BACKUPS} || KEEP_BACKUPS="10"
[[ -n "${GAME_USER}" ]] && declare -r GAME_USER=${GAME_USER} || GAME_USER="craftbukkit"
[[ -n "${MAIN_EXECUTABLE}" ]] && declare -r MAIN_EXECUTABLE=${MAIN_EXECUTABLE} || MAIN_EXECUTABLE="spigot.jar"
@@ -301,26 +302,26 @@ backup_files() {
fi
echo "Starting backup..."
- FILE="$(date +%Y_%m_%d_%H.%M.%S).tar.gz"
+ fname="$(date +%Y_%m_%d_%H.%M.%S).tar.gz"
${SUDO_CMD} mkdir -p "${BACKUP_DEST}"
if ${SUDO_CMD} screen -S "${SESSION_NAME}" -Q select . > /dev/null; then
game_command save-off
game_command save-all
sync && wait
- ${SUDO_CMD} tar -C "${SERVER_ROOT}" -czf "${BACKUP_DEST}/${FILE}" --totals ${BACKUP_PATHS} 2>&1 | grep -v "tar: Removing leading "
+ ${SUDO_CMD} tar -C "${SERVER_ROOT}" -cf "${BACKUP_DEST}/${fname}" ${BACKUP_PATHS} --totals ${BACKUP_FLAGS} 2>&1 | grep -v "tar: Removing leading "
game_command save-on
else
- ${SUDO_CMD} tar -C "${SERVER_ROOT}" -czf "${BACKUP_DEST}/${FILE}" --totals ${BACKUP_PATHS} 2>&1 | grep -v "tar: Removing leading "
+ ${SUDO_CMD} tar -C "${SERVER_ROOT}" -cf "${BACKUP_DEST}/${fname}" ${BACKUP_PATHS} --totals ${BACKUP_FLAGS} 2>&1 | grep -v "tar: Removing leading "
fi
echo -e "\e[39;1mbackup completed\e[0m\n"
echo -n "Only keeping the last ${KEEP_BACKUPS} backups and removing the other ones..."
- BACKUP_COUNT=$(for f in "${BACKUP_DEST}"/[0-9_.]*; do echo "${f}"; done | wc -l)
- if [[ $(( BACKUP_COUNT - KEEP_BACKUPS )) -gt 0 ]]; then
- for old_backup in $(for f in "${BACKUP_DEST}"/[0-9_.]*; do echo "${f}"; done | head -n"$(( BACKUP_COUNT - KEEP_BACKUPS ))"); do
+ backup_count=$(for f in "${BACKUP_DEST}"/[0-9_.]*; do echo "${f}"; done | wc -l)
+ if [[ $(( backup_count - KEEP_BACKUPS )) -gt 0 ]]; then
+ for old_backup in $(for f in "${BACKUP_DEST}"/[0-9_.]*; do echo "${f}"; done | head -n"$(( backup_count - KEEP_BACKUPS ))"); do
${SUDO_CMD} rm "${old_backup}";
done
- echo -e "\e[39;1m done\e[0m ($(( BACKUP_COUNT - KEEP_BACKUPS)) backup(s) pruned)"
+ echo -e "\e[39;1m done\e[0m ($(( backup_count - KEEP_BACKUPS)) backup(s) pruned)"
else
echo -e "\e[39;1m done\e[0m (no backups pruned)"
fi
@@ -357,10 +358,10 @@ backup_restore() {
if [[ $user_choice =~ ^-?[0-9]+$ ]]; then
n=1
for f in "${BACKUP_DEST}"/[0-9_.]*; do
- [[ ${n} -eq $user_choice ]] && FILE="$f"
+ [[ ${n} -eq $user_choice ]] && fname="$f"
n=$(( n + 1 ))
done
- if [[ -z $FILE ]]; then
+ if [[ -z $fname ]]; then
>&2 echo -e "\e[39;1mFailed\e[0m to interpret your input. Please enter the digit of the presented options."
exit 5
fi
@@ -371,10 +372,10 @@ backup_restore() {
elif [[ $# -eq 1 ]]; then
# Check for the existance of the specified file
if [[ -f "$1" ]]; then
- FILE="$1"
+ fname="$1"
else
if [[ -f "${BACKUP_DEST}"/"$1" ]]; then
- FILE="${BACKUP_DEST}"/"$1"
+ fname="${BACKUP_DEST}"/"$1"
else
>&2 echo -e "Sorry, but '$1', is \e[39;1mnot a valid file\e[0m, neither in your current directory nor in the backup folder."
exit 4
@@ -387,7 +388,7 @@ backup_restore() {
fi
echo "Restoring backup..."
- if ${SUDO_CMD} tar -xf "${FILE}" -C "${SERVER_ROOT}" 2>&1; then
+ if ${SUDO_CMD} tar -xf "${fname}" -C "${SERVER_ROOT}" 2>&1; then
echo -e "\e[39;1mRestoration completed\e[0m"
else
echo -e "\e[39;1mFailed to restore backup.\e[0m"