Skip to content

Commit

Permalink
Add a update build script that doesnt immediately upload too
Browse files Browse the repository at this point in the history
  • Loading branch information
SkySwimmer committed Sep 28, 2023
1 parent 244f8fd commit b6bb1ee
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 1 deletion.
78 changes: 78 additions & 0 deletions buildupdate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#!/bin/bash

function copyUpdateData() {
version="$1"
channel="$2"

# Create directory
mkdir -p "build/updatedata/emuferal.ddns.net/httpdocs/$channel" || exit 1

# Copy files
function copyData() {
for file in $1/* ; do
pref=$2
targetf="${file:${#pref}}"
if [ -f "$file" ]; then
dir="$(dirname "build/updatedata/emuferal.ddns.net/httpdocs/$channel/${version}/${targetf}")"
if [ ! -d "$dir" ]; then
mkdir -p "$dir" || exit 1
fi
cp -rfv "$file" "build/updatedata/emuferal.ddns.net/httpdocs/$channel/${version}/${targetf}"
fi
if [ "$?" != "0" ]; then
echo Build failure!
exit 1
fi
if [ -d "$file" ]; then
copyData "$file" "$2"
fi
done
}

copyData build/update build/update/
echo -n "$version" > "build/updatedata/emuferal.ddns.net/httpdocs/$channel/update.info"

source version.info
}

# Current channel
echo Preparing...
source version.info
rm -rf build/updatedata
rm -rf build/update
echo
echo
echo Centuria Update Builder
echo Version: $version
echo Version type: $channel
echo
echo
read -p "Are you sure you want to build this version's update files? [Y/n] " prompt

if [ "$prompt" != "y" ] && [ "$prompt" != "Y" ]; then
exit
fi

echo Building centuria...
./gradlew build updateData || exit $?
echo

echo Copying data...
copyUpdateData "$version" "$channel"

# Other channels
if [ "$channel" == "beta" ]; then
copyUpdateData "$version" alpha
fi
if [ "$channel" == "prerelease" ]; then
copyUpdateData "$version" alpha
copyUpdateData "$version" beta
fi
if [ "$channel" == "release" ]; then
copyUpdateData "$version" alpha
copyUpdateData "$version" beta
copyUpdateData "$version" prerelease
fi

echo
echo Build completed.
2 changes: 1 addition & 1 deletion uploadupdate.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function uploadToServers() {

# Current channel
source version.info
rm -rf build/Update
rm -rf build/update
read -rp "Server username: " username
read -rsp "Server upload password: " password
echo
Expand Down

0 comments on commit b6bb1ee

Please sign in to comment.