summaryrefslogtreecommitdiff
path: root/microservices/03-resource-server/linux/deb/build.sh
diff options
context:
space:
mode:
authorKamal Wickramanayake <kamal@inbox.lk>2026-07-03 21:10:32 +0530
committerKamal Wickramanayake <kamal@inbox.lk>2026-07-03 21:10:32 +0530
commita0f3f5a069153c46ac3a85fa75c3ec50fea6ea99 (patch)
tree6e97c9b87c314a8a64a25d3ffe10e710db1740fc /microservices/03-resource-server/linux/deb/build.sh
parentaa122113ade36f02dc8fdbebdf1232b5c4b8742c (diff)
Added Linux deb file creation scripts and build-all.sh
Diffstat (limited to 'microservices/03-resource-server/linux/deb/build.sh')
-rwxr-xr-xmicroservices/03-resource-server/linux/deb/build.sh36
1 files changed, 36 insertions, 0 deletions
diff --git a/microservices/03-resource-server/linux/deb/build.sh b/microservices/03-resource-server/linux/deb/build.sh
new file mode 100755
index 0000000..a121d2e
--- /dev/null
+++ b/microservices/03-resource-server/linux/deb/build.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+# Define a function that sends messages to stderr.
+errcho() {
+ echo "$@" 1>&2;
+}
+
+# Check if fakeroot command is available
+if ! command -v fakeroot > /dev/null 2>&1; then
+ errcho "[ERROR] fakeroot command not found. Install the fakeroot package.";
+ exit 1
+fi
+
+# Check if dpkg-deb command is available
+if ! command -v dpkg-deb > /dev/null 2>&1; then
+ errcho "[ERROR] dpkg-deb command not found. dpkg package contains it. Are you not running this script on a Debian based system?";
+ exit 1
+fi
+
+# Get the directory of this script
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+
+# Check if the spring boot jar is in the correct location
+if [ ! -f $DIR/package/opt/ceit/ceit-fs-resource-server/app/ceit-fs-resource-server.jar ]; then
+ errcho "[ERROR] Jar file missing: package/opt/ceit/ceit-fs-resource-server/app/ceit-fs-resource-server.jar"
+ errcho "[ERROR] Run this build script only after placing the jar file in that location."
+ exit 1
+fi
+
+# Remove the deb files found inside DIR. Don't prompt the user before deleting.
+if ls $DIR/*.deb 1> /dev/null 2>&1; then
+ rm $DIR/*.deb
+fi
+
+# Build the deb package
+fakeroot dpkg-deb --build $DIR/package $DIR