blob: 25f423986f8f5135664ecf0ba99f04201a5b5ba5 (
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#!/bin/bash
# This script simply clones this project itself and changes the name of the deb package generated including other required adjustments.
#
# This is useful to create a new but similar debian package that can be used to package another Spring Boot application.
#
# The generated output will be placed inside the out directory.
#
# How to run this script:
# ./create-new-project.sh company-name package-name
#
# Example:
# ./create-new-project.sh mycompany mycompany-mywebapp
errcho() {
echo "$@" 1>&2;
}
if [ "$1" = "" ]; then
errcho "ERROR: Specify the company name as the first argument to this script."
exit 1
fi
if [ "$2" = "" ]; then
errcho "ERROR: Specify the package name as the second argument to this script."
exit 1
fi
if [ -d out/$2 ]; then
errcho "ERROR: out/$2 already exists. Delete it first to regenerate."
exit 1
fi
mkdir -p out/$2
cp -a build.sh package README out/$2
# Rename all files and directories that use the name fs-spring-boot-kamal
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/$2."
|