blob: bd2fc955a6dbf80df50e670ed1dee89b607b17ef (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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/fs-spring-boot-kamal/app/fs-spring-boot-kamal.jar ]; then
errcho "[ERROR] Jar file missing: $DIR/package/opt/fs-spring-boot-kamal/app/fs-spring-boot-kamal.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. Prompt the user before deleting.
if ls $DIR/*.deb 1> /dev/null 2>&1; then
rm -i $DIR/*.deb
fi
# Build the deb package
fakeroot dpkg-deb --build $DIR/package $DIR
|