summaryrefslogtreecommitdiff
path: root/linux/deb/02-fs-spring-boot-kamal/create-new-project.sh
diff options
context:
space:
mode:
Diffstat (limited to 'linux/deb/02-fs-spring-boot-kamal/create-new-project.sh')
-rwxr-xr-xlinux/deb/02-fs-spring-boot-kamal/create-new-project.sh37
1 files changed, 24 insertions, 13 deletions
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."