autobuild.sh — a autobuilder script for DDLC mods that no one wished for

This is probably the worst mistake I made, but I’m glad it was a mistake that actually has a purpose.

autobuild.sh is a project I hastily made for Doki Doki Literature Club Mods, specifically for Open Source mods, pretty much like my quickstart-oss repository, except this can work on any mod that isn’t in GitHub and for local build creation.


How it all started

It was a sunny 12:00 noon in the school library. It’s just me with PC #1 and Cloud9 IDE opened. I was part of a Doki Doki Literature Club Mod called “Doki Doki: The Angel Returns” , and because it was a Open Source mod, I was responsible in improving the release delivery for it — since I’m the only one who knows how to configure Travis CI.

Then one thing came on my mind:

“ What if I could build my mod as easy as waiting for Travis to build it?”

Then, being the mad lad I am, I made a simple shell script that replicates exactly the Travis CI steps, and I released it on a seperate repository.

During its major release, I got some people using it, saying it was nice to use, then I knew I fulfilled a need. And it taught me shell scripting as well!


How does it work?

Let’s take a look at the source code:


if [[ -f "$DIRECTORY/build/renpy-6.99.12.4-sdk.tar.bz2" ]]; then
mkdir -p $DIRECTORY/build/mod
cp -vRf $DIRECTORY/* $DIRECTORY/build/mod
cd $DIRECTORY/build
tar xf renpy-6.99.12.4-sdk.tar.bz2
rm renpy-6.99.12.4-sdk.tar.bz2
mv renpy-6.99.12.4-sdk renpy
rm -rf renpy-6.99.12.4-sdk
cd $DIRECTORY/build && pull_ddlc_base;
cd $DIRECTORY/build/renpy
./renpy.sh "$DIRECTORY/build/mod/" lint && ./renpy.sh launcher distribute "$DIRECTORY/build/mod/"$1
cd ..
else
mkdir -p $DIRECTORY/build
mkdir -p $DIRECTORY/build/mod
cp -vRf $DIRECTORY/* $DIRECTORY/build/mod
cd $DIRECTORY
wget https://www.renpy.org/dl/6.99.12.4/renpy-6.99.12.4-sdk.tar.bz2
tar xf renpy-6.99.12.4-sdk.tar.bz2
rm renpy-6.99.12.4-sdk.tar.bz2
mv renpy-6.99.12.4-sdk renpy
rm -rf renpy-6.99.12.4-sdk
cd $DIRECTORY/build && pull_ddlc_base;
cd $DIRECTORY/build/renpy
./renpy.sh "$DIRECTORY/build/mod/" lint && ./renpy.sh launcher distribute "$DIRECTORY/build/mod/"$1
cd ..
fi

Here’s some lines from the repository, let’s do a quick rundown how it does the shell magic:

  • First, it downloads a specific version of Ren’Py SDK (6.99.12.4)
  • Then it unzips it and copies the project contents at build/ , the same directory the SDK was unzipped.
  • Then it downloads a ZIP containing DDLC vanilla .rpa s. It’s only meant to make the mod successfully.
  • Then we cd to renpy , and the Project is built.

All this was done in 100% Shell Script — without relying on a external script or interpreter. All you need is wget , unzip , and Linux/macOS.


How it looks like

From a first glance — it works like any other CLI app, it has a interactive mode, and has arguments just in case you hate interactive mode. And all of this done in 100% shell script goodness.

Making this was a whole lot of fun, and I’m glad I was able to make people’s lives easier with just a simple tool.

What do you think? If you can help me make it better, head over to the repository, and hack away!