summaryrefslogtreecommitdiff
path: root/linux
diff options
context:
space:
mode:
Diffstat (limited to 'linux')
-rw-r--r--linux/deb/02-fs-spring-boot-kamal/README15
-rwxr-xr-xlinux/deb/02-fs-spring-boot-kamal/create-new-project.sh37
2 files changed, 37 insertions, 15 deletions
diff --git a/linux/deb/02-fs-spring-boot-kamal/README b/linux/deb/02-fs-spring-boot-kamal/README
index 0dd79a9..b23bf99 100644
--- a/linux/deb/02-fs-spring-boot-kamal/README
+++ b/linux/deb/02-fs-spring-boot-kamal/README
@@ -1,20 +1,31 @@
This directory contains everything to build a deb package that bundles a Spring Boot app that starts a web server.
- build.sh - This script builds the deb package.
+####
+
+Executable scripts:
+
create-new-project.sh - This script can be used to create a new deb package project similar to this project that uses a different name (than fs-spring-boot-kamal). Output will be placed inside 'out' directory.
+ build.sh - This script builds the deb package. If the above script is used, go to the corresponding directory inside out directory to find a copy of this build.sh script.
+
+####
+
To create a new deb package project that uses 'mycompany-myapp' as the name, run the following command:
- ./create-new-project.sh mycompany-myapp
+ ./create-new-project.sh mycompany mycompany-myapp
The newly generated project files will be found inside the out directory.
+####
+
To build, run the following command:
./build.sh
Note that the Spring Boot application has not been bundled with this. You need to build it seperately and put it in the correct directory (run build.sh for further details).
+####
+
To install the build deb package run the following commands replacing the package.deb with the correct name of the deb file.
cp package.deb /tmp
diff --git a/linux/deb/02-fs-spring-boot-kamal/create-new-project.sh b/linux/deb/02-fs-spring-boot-kamal/create-new-project.sh
index 7136ce9..25f4239 100755
--- a/linux/deb/02-fs-spring-boot-kamal/create-new-project.sh
+++ b/linux/deb/02-fs-spring-boot-kamal/create-new-project.sh
@@ -7,35 +7,46 @@
# The generated output will be placed inside the out directory.
#
# How to run this script:
-# ./create-new-project.sh name-of-new-deb-package
+# ./create-new-project.sh company-name package-name
#
# Example:
-# ./create-new-project.sh mycompany-webapp
+# ./create-new-project.sh mycompany mycompany-mywebapp
errcho() {
echo "$@" 1>&2;
}
if [ "$1" = "" ]; then
- errcho "ERROR: Specify the package name as an argument to this script."
+ errcho "ERROR: Specify the company name as the first argument to this script."
exit 1
fi
-if [ -d out/$1 ]; then
- errcho "ERROR: out/$1 already exists. Delete it first to regenerate."
+if [ "$2" = "" ]; then
+ errcho "ERROR: Specify the package name as the second argument to this script."
exit 1
fi
-mkdir -p out/$1
+if [ -d out/$2 ]; then
+ errcho "ERROR: out/$2 already exists. Delete it first to regenerate."
+ exit 1
+fi
-cp -a build.sh package README out/$1
+mkdir -p out/$2
-# Change all string occurences of fs-spring-boot-kamal in files.
-find out/$i -type f -exec sed -i "s/fs-spring-boot-kamal/$1/g" {} +
+cp -a build.sh package README out/$2
# Rename all files and directories that use the name fs-spring-boot-kamal
-mv out/$1/package/etc/fs-spring-boot-kamal out/$1/package/etc/$1
-mv out/$1/package/etc/systemd/system/fs-spring-boot-kamal.service out/$1/package/etc/systemd/system/$1.service
-mv out/$1/package/opt/mycompany/fs-spring-boot-kamal out/$1/package/opt/mycompany/$1
+mv out/$2/package/etc/fs-spring-boot-kamal out/$2/package/etc/$2
+mv out/$2/package/etc/systemd/system/fs-spring-boot-kamal.service out/$2/package/etc/systemd/system/$2.service
+mv out/$2/package/opt/mycompany/fs-spring-boot-kamal out/$2/package/opt/mycompany/$2
+
+# Rename company named directory inside /opt/
+mv out/$2/package/opt/mycompany out/$2/package/opt/$1
+
+# Change all string occurences of fs-spring-boot-kamal in files.
+find out/$2 -type f -exec sed -i "s/fs-spring-boot-kamal/$2/g" {} +
+
+# Change all string occurences of opt/mycompany in files.
+find out/$2 -type f -exec sed -i "s/opt\/mycompany/opt\/$1/g" {} +
-echo "New project created inside out/$1."
+echo "New project created inside out/$2."