From 9148f4d319bc5437e82c0db505809d7dfd500bfc Mon Sep 17 00:00:00 2001
From: eroncero <eroncero@digitalstack.es>
Date: Sun, 2 Mar 2025 21:32:08 +0100
Subject: [PATCH] first commit

---
 2do.txt             |  2 ++
 app/build_otc.sh    |  8 ++++++++
 app/build_physfs.sh | 15 +++++++++++++++
 dockerfile          | 17 +++++++++++++++++
 4 files changed, 42 insertions(+)
 create mode 100644 2do.txt
 create mode 100755 app/build_otc.sh
 create mode 100755 app/build_physfs.sh
 create mode 100644 dockerfile

diff --git a/2do.txt b/2do.txt
new file mode 100644
index 0000000..557a5f0
--- /dev/null
+++ b/2do.txt
@@ -0,0 +1,2 @@
+# Compile as tibia user or chown.
+# Copy otclient ..
diff --git a/app/build_otc.sh b/app/build_otc.sh
new file mode 100755
index 0000000..40103ca
--- /dev/null
+++ b/app/build_otc.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+# Download and compile OTClient
+cd /home/tibia
+git clone "https://github.com/edubart/otclient.git"
+cd otclient && mkdir build && cd build
+cmake ..
+make -j $(nproc)
diff --git a/app/build_physfs.sh b/app/build_physfs.sh
new file mode 100755
index 0000000..a59d323
--- /dev/null
+++ b/app/build_physfs.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+# PHYSFS dependency
+cd /app
+git clone -b stable-3.0 "https://github.com/icculus/physfs.git"
+cd physfs && mkdir build && cd build
+cmake ..
+make -j $(nproc)
+sudo make install
+
+#sudo cp /usr/local/lib/libphysfs.a /usr/lib/x86_64-linux-gnu/.
+rm /usr/lib/x86_64-linux-gnu/libphysfs.a 
+sudo ln -s /usr/local/lib/libphysfs.a /usr/lib/x86_64-linux-gnu/libphysfs.a 
+
+cd ../..
diff --git a/dockerfile b/dockerfile
new file mode 100644
index 0000000..a8ce290
--- /dev/null
+++ b/dockerfile
@@ -0,0 +1,17 @@
+FROM debian:bullseye
+
+RUN apt-get update && apt-get full-upgrade -y && apt-get install -y git build-essential cmake libboost-all-dev libphysfs-dev libssl-dev liblua5.1-0-dev libglew-dev libvorbis-dev libopenal-dev zlib1g-dev sudo
+
+WORKDIR /app
+COPY app/build_physfs.sh /app
+
+RUN useradd -m -s /bin/bash tibia && echo "tibia:tibia" | chpasswd 
+RUN /app/build_physfs.sh && chown -R tibia:tibia /home/tibia
+
+COPY app/build_otc.sh /home/tibia
+
+RUN su - tibia -c /home/tibia/build_otc.sh
+
+USER tibia
+
+ENTRYPOINT ["/bin/bash"]