Skip to content

Commit 1f07376

Browse files
committed
Improve scripts with strict mode
1 parent 08c291a commit 1f07376

File tree

5 files changed

+9
-3
lines changed

5 files changed

+9
-3
lines changed

bedrock_helper.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
#!/bin/bash
2+
set -euo pipefail
23
echo "Manual Bedrock update required. Visit official Mojang page to download."

setup_bedrock.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Tested on Debian 11/12 and Ubuntu 24.04
55
# Author: TimInTech
66

7-
set -e # Exit on any error
7+
set -euo pipefail # Exit on error, unset variable, or failed pipeline
88

99
# Install required dependencies
1010
sudo apt update && sudo apt upgrade -y

setup_minecraft.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Tested on Debian 11/12 and Ubuntu 24.04
55
# Author: TimInTech
66

7-
set -e # Exit script on error
7+
set -euo pipefail # Exit script on error, undefined variable, or failed pipeline
88

99
# Install required dependencies
1010
sudo apt update && sudo apt upgrade -y

setup_minecraft_lxc.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
# Tested on Debian 11/12 and Ubuntu 24.04
55
# Author: TimInTech
66

7+
8+
set -euo pipefail
9+
710
# Update package lists and install required dependencies
811
apt update && apt upgrade -y
912
apt install -y screen wget curl jq unzip

update.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
#!/bin/bash
22

3+
set -euo pipefail
4+
35
cd /opt/minecraft || exit 1
46

57
LATEST_VERSION=$(curl -s https://api.papermc.io/v2/projects/paper | jq -r '.versions | last')
6-
LATEST_BUILD=$(curl -s https://api.papermc.io/v2/projects/paper/versions/$LATEST_VERSION | jq -r '.builds | last')
8+
LATEST_BUILD=$(curl -s https://api.papermc.io/v2/projects/paper/versions/"$LATEST_VERSION" | jq -r '.builds | last')
79

810
wget -O server.jar "https://api.papermc.io/v2/projects/paper/versions/$LATEST_VERSION/builds/$LATEST_BUILD/downloads/paper-$LATEST_VERSION-$LATEST_BUILD.jar"
911

0 commit comments

Comments
 (0)