Skip to content

Commit

Permalink
buildmaster package script
Browse files Browse the repository at this point in the history
  • Loading branch information
white-rabbit-dfplex committed May 27, 2020
1 parent 37f0cbd commit b8d59e8
Show file tree
Hide file tree
Showing 6 changed files with 137 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
df.tar
df/
save*
release/
File renamed without changes.
2 changes: 1 addition & 1 deletion devel/df-assemble.sh
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ sed -i 's/BIRTH_CITIZEN:A_D:D_D:P:R/BIRTH_CITIZEN:A_D:D_D/g' $dfdir/data/init/an
sed -i 's/MOOD_BUILDING_CLAIMED:A_D:D_D:P:R/MOOD_BUILDING_CLAIMED:A_D:D_D/g' $dfdir/data/init/announcements.txt
sed -i 's/ARTIFACT_BEGUN:A_D:D_D:P:R/ARTIFACT_BEGUN:A_D:D_D/g' $dfdir/data/init/announcements.txt

dfplexinit="devel/dfhack.init-web"
dfplexinit="devel/dfhack.init"
if [ -f $dfplexinit ]
then
echo "copying in dfplex's dfhack.init"
Expand Down
1 change: 1 addition & 0 deletions devel/dfhack.init
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enable dfplex
1 change: 0 additions & 1 deletion devel/dfhack.init-web

This file was deleted.

134 changes: 134 additions & 0 deletions devel/package-buildmaster.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
if [ "$#" -ne 1 ]
then
echo "usage: $0 <buildNumber>"
exit
fi

buildnumber="$1"
url="https://buildmaster.lubar.me/artifacts/download?applicationId=48&releaseNumber=dfhack-0.47.04-r1&buildNumber=${1}&artifactName="
dst="release"
pre="dfplex-v0.2-"
assets="${pre}assets"
root=`pwd`

if [ ! -d "static" ]
then
echo "static/ folder not found -- is this the right directory?"
exit 1
fi

if [ -d "$dst" ]
then
echo "Removing previous..."
rm -r "$dst"
fi

############ create assets template #############
echo "Creating asset template..."
mkdir "$dst" && cd "$dst" && mkdir "$assets" && cd "$assets"

# dist/shared
for filename in $root/dist/shared/*
do
if [ -d "$filename" ]
then
cp -r "$filename" .
elif [ -f "$filename" ]
then
cp "$filename" .
fi
done

# static
cp -r "$root/static" "./hack/www"

# dfhack init
cp "$root/devel/dfhack.init" .

# license
cp "$root/LICENSE.rst" .

############ create target packages #############
for platform in "Windows32" "Windows64" "Linux32" "Linux64"
do
cd "$root/$dst"
echo "assembling ${platform}"
target="${pre}${platform}"
cp -r "${assets}" "${target}"
cd "${target}/hack"
if [ ! -d "plugins" ]
then
mkdir "plugins"
fi
cd "plugins"

# Download zip from build server
wget -O "artifact.zip" "${url}${platform}"
if [ $? -ne 0 ]
then
echo "Failed to download artifact for $platform".
exit 2
fi

# extract zip
7z e "artifact.zip"
if [ $? -ne 0 ]
then
echo "Failed to extract zip for $platform".
exit 3
fi

# remove zip to avoid name clash with next step.
rm "artifact.zip"

# extract zip
zip=`find . -name "*.zip"`
if [ -f "$zip" ]
then
7z e "$zip"
if [ $? -ne 0 ]
then
echo "Failed to extract archive for $platform".
exit 5
fi
fi

# extract tar.gz
targz=`find . -name "*.tar.gz"`
if [ -f "$targz" ]
then
tar -xf "$targz"
if [ $? -ne 0 ]
then
echo "Failed to extract archive for $platform".
exit 5
fi
fi

if find . | grep -q "dfplex.plug.*"
then
echo "Extracted binary for $platform successfully."
else
echo "failed to extract binary from archive for $platform. Contents are:"
find .
exit 4
fi

# clean up.
touch "a.zip"
touch "a.tar.gz"
rm *.zip
rm *.tar.gz

cd "$root/$dst"
echo "Creating $target.zip ..."
7z a "$target.zip" "$target"

if [ $? -ne 0 ]
then
echo "Failed to create archive for $platform, $target.zip".
exit 7
fi

echo ""
done

0 comments on commit b8d59e8

Please sign in to comment.