This repository has been archived by the owner on Jun 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 87
/
makerpm.notused
executable file
·93 lines (81 loc) · 3.02 KB
/
makerpm.notused
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/sh
#
# Copyright (c) 2020 Seagate Technology LLC and/or its Affiliates
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# For any questions about this software or licensing,
# please email [email protected] or [email protected].
#
# Script to create rpm package for S3/Auth server.
# Usage: ./makerpm [--rpm-version=<version>] [--rebuild] [--help]
# Optional params as below:
# --rpm-version (-v): Version for rpm
# --rebuild (-r) : Rebuild S3/Auth before creating rpm
# --help (-h) : Display help
set -e
usage() {
printf "%s\n\t%s\n\t%s\n\t%s\n\t%s\n" \
"Usage: ./makerpm [--rpm-version=<version>] [--rebuild] [--help]" \
"Optional params as below:" \
"--rpm-version (-v): Version for rpm" \
"--rebuild (-r) : Rebuild S3/Auth before creating rpm" \
"--help (-h) : Display help"
}
# read the options
OPTS=`getopt -o v:rh --long rpm-version:,rebuild,help -n 'makerpm' -- "$@"`
eval set -- "$OPTS"
rebuild=0
user_rpm_version=0
# extract options and their arguments into variables.
while true; do
case "$1" in
-v|--rpm-version) user_rpm_version=1; S3_RPM_VERSION=$2; shift 2 ;;
-r|--rebuild) rebuild=1; shift ;;
-h|--help) usage; exit 0;;
--) shift; break ;;
*) echo "Internal error!" ; exit 1 ;;
esac
done
# rebuild if requested.
if [ $rebuild -eq 1 ]
then
./rebuildall.sh --no-thirdparty-build --no-install
fi
# if user didn't provide rpm-version, then use short commit-id (SHA) of the
# current git branch's HEAD as version.
if [ $user_rpm_version -eq 0 ]
then
S3_RPM_VERSION="git_"$(git rev-parse --verify --short HEAD)
fi
S3_RPM_PKG_NAME=s3server
S3_RPM_SANDBOX_DIR=rpmsandbox
rm -rf $S3_RPM_SANDBOX_DIR
rm -f $S3_RPM_PKG_NAME*.rpm
printf "Creating rpm package, it may take couple of minutes..."
# Copy files to rpmsandbox dir
./installhelper.sh $S3_RPM_SANDBOX_DIR
# Create rpm
fpm -s dir -t rpm -C $S3_RPM_SANDBOX_DIR \
--name $S3_RPM_PKG_NAME \
--config-files opt/seagate/cortx/s3/conf/s3config.yaml \
--config-files opt/seagate/cortx/s3/conf/s3stats-allowlist.yaml \
--config-files opt/seagate/cortx/s3/statsd/s3statsd-config.js \
--config-files opt/seagate/cortx/auth/resources/authserver.properties \
--config-files opt/seagate/cortx/auth/resources/static/saml-metadata.xml \
--directories opt/seagate/cortx/ \
--directories var/log/seagate/ \
--depends "cortx-motr" \
--version $S3_RPM_VERSION \
--description "Seagate S3 Server - Motr"
printf "%s\n" "Done!"