fix apt prompting for user input
This commit is contained in:
parent
1f244b9953
commit
47546ee248
1 changed files with 6 additions and 6 deletions
12
automate.sh
12
automate.sh
|
@ -16,7 +16,7 @@ function versionprompt {
|
|||
# ask the user which version of minecraft they would like to install
|
||||
echo "which version of minecraft would you like to serve?"
|
||||
echo -n "version [$LATEST]:"
|
||||
if ! read -t 60 VERSION; then # have a timeout for user input handy for unattented installs
|
||||
if ! read -t 30 VERSION; then # have a timeout for user input handy for unattented installs
|
||||
VERSION=$LATEST
|
||||
echo "timed out, defaulting to $LATEST..."
|
||||
return 0
|
||||
|
@ -36,11 +36,11 @@ function versionprompt {
|
|||
versionprompt
|
||||
|
||||
# this has to be seperate from the first run of apt since java versions before 16 is deprecated for minecraft 1.17+ and java 16 is quite new
|
||||
echo "downloading java..."
|
||||
echo "installing java..."
|
||||
if printf '%s\n' 1.16.5 $VERSION | sort -VC; then # check if $VERSION is above 1.16.5
|
||||
apt install openjdk-16-jre-headless
|
||||
apt install -y openjdk-16-jre-headless
|
||||
else
|
||||
apt install default-jre-headless
|
||||
apt install -y default-jre-headless
|
||||
fi
|
||||
|
||||
# find the latest release of the requested version and download it
|
||||
|
@ -48,7 +48,7 @@ echo "downloading minecraft $VERSION..."
|
|||
RELEASE=`curl -s https://papermc.io/api/v2/projects/paper/versions/$VERSION/ | jq -r .builds[-1]`
|
||||
curl https://papermc.io/api/v2/projects/paper/versions/$VERSION/builds/$RELEASE/downloads/paper-$VERSION-$RELEASE.jar -o paperclip.jar
|
||||
|
||||
echo "preparing..." # making sure things are clean and have the right owners
|
||||
echo "preparing..." # making sure things have the right owners
|
||||
adduser --disabled-password --gecos "" mc
|
||||
chmod 755 systemd/mc-backup
|
||||
mkdir -p /srv/minecraft/
|
||||
|
@ -68,7 +68,7 @@ su mc -c \
|
|||
cp paperclip.jar /srv/minecraft/server/
|
||||
echo "eula=true" > /srv/minecraft/server/eula.txt"
|
||||
|
||||
# what they says on the tin
|
||||
# what they say on the tin
|
||||
echo "loading units..."
|
||||
systemctl daemon-reload
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue