From 6657eb579ce0413689f2bfb0c2f912a930b3f179 Mon Sep 17 00:00:00 2001 From: Kamal Wickramanayake Date: Sat, 6 Jun 2026 16:40:15 +0530 Subject: Updated create-new-project.sh to create a new Debian packaging project with company name --- .../02-fs-spring-boot-kamal/create-new-project.sh | 37 ++++++++++++++-------- 1 file changed, 24 insertions(+), 13 deletions(-) (limited to 'linux/deb/02-fs-spring-boot-kamal/create-new-project.sh') 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." -- cgit v1.2.3