Skip to content

Commit 8e5ea8d

Browse files
authored
Add custom names for debian packege (#23)
* Add custom package names
1 parent ac62924 commit 8e5ea8d

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

scripts/build-deb.sh

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
# -v, --version <version> : Specify the version (required)
1616
# -h, --help : Display this help and exit
1717
# -n, --dry-run : Show what would be done, without making any changes
18+
# --custom-name : Custom package name
1819
#
1920
# Example:
2021
# ./build-deb.sh -v 1.5.5 # Build with version 1.5.5
@@ -34,16 +35,19 @@
3435
set -euo pipefail
3536

3637
# Default values
38+
PACKAGE="greenplum-db-6"
3739
VERSION=""
3840
RELEASE="1"
3941
DEBUG_BUILD=false
42+
CUSTOM_NAME=""
4043

4144
# Function to display usage information
4245
usage() {
4346
echo "Usage: $0 [-v <version>] [-h] [--dry-run]"
4447
echo " -v, --version <version> : Specify the version (optional)"
4548
echo " -h, --help : Display this help and exit"
4649
echo " -n, --dry-run : Show what would be done, without making any changes"
50+
echo " --custom-name : Custom package name"
4751
exit 1
4852
}
4953

@@ -60,7 +64,7 @@ check_commands() {
6064

6165
function print_changelog() {
6266
cat <<EOF
63-
greenplum-db-6 (${GPDB_PKG_VERSION}) stable; urgency=low
67+
${PACKAGE} (${GPDB_PKG_VERSION}) stable; urgency=low
6468
6569
* open-gpdb autobuild
6670
@@ -82,6 +86,10 @@ while [[ "$#" -gt 0 ]]; do
8286
DRY_RUN=true
8387
shift
8488
;;
89+
--custom-name)
90+
CUSTOM_NAME="$2"
91+
shift 2
92+
;;
8593
*)
8694
echo "Unknown option: ($1)"
8795
shift
@@ -122,6 +130,14 @@ if [ ! -f "$CONTROL_FILE" ]; then
122130
exit 1
123131
fi
124132

133+
# Change package name to custom
134+
if [ -n "$CUSTOM_NAME" ]; then
135+
PACKAGE="$CUSTOM_NAME"
136+
sed -i "s/^Source: .*/Source: $CUSTOM_NAME/" "$CONTROL_FILE"
137+
sed -i "s/^Package: .*/Package: $PACKAGE/" "$CONTROL_FILE"
138+
sed -i "s/^Description:/Conflicts: greenplum-db-6\nDescription:/" "$CONTROL_FILE"
139+
fi
140+
125141
# Build the rpmbuild command based on options
126142
DEBBUILD_CMD="dpkg-buildpackage -us -uc"
127143

0 commit comments

Comments
 (0)