-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #56 from Comcast/migrate-to-centos7
Work on updating support Centos 7 and Systemd.
- Loading branch information
Showing
10 changed files
with
162 additions
and
281 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
* Sun Nov 12 2017 Weston Schmidt - 0.1.1 | ||
- update to support centos 7 / systemd | ||
* Tue Mar 28 2017 Weston Schmidt - 0.1.1 | ||
- initial creation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,41 @@ | |
|
||
NAME=caduceus | ||
|
||
RPM_BUILD_ROOT=/root | ||
SIGN=1 | ||
|
||
|
||
usage() | ||
{ | ||
echo "usage: build_rpm.sh [--rpm-build-root path] [--no-sign]" | ||
echo " --rpm-build-root - the path where /rpmbuild exists for your user" | ||
echo " --no-sign - don't try to sign the build" | ||
} | ||
|
||
while [ "$1" != "" ]; do | ||
case $1 in | ||
--rpm-build-root ) shift | ||
RPM_BUILD_ROOT=$1 | ||
;; | ||
|
||
--no-sign ) SIGN=0 | ||
;; | ||
|
||
--build-number ) shift | ||
BUILD_NUMBER=$1 | ||
;; | ||
|
||
-h | --help ) usage | ||
exit | ||
;; | ||
|
||
* ) usage | ||
exit 1 | ||
|
||
esac | ||
shift | ||
done | ||
|
||
echo "Adjusting build number..." | ||
|
||
taglist=`git tag -l` | ||
|
@@ -26,22 +61,30 @@ echo "Building the ${NAME} rpm..." | |
pushd .. | ||
cp -r ${NAME} ${NAME}-$release | ||
tar -czvf ${NAME}-$new_release.tar.gz ${NAME}-$release | ||
mv ${NAME}-$new_release.tar.gz /root/rpmbuild/SOURCES | ||
mv ${NAME}-$new_release.tar.gz ${RPM_BUILD_ROOT}/rpmbuild/SOURCES | ||
rm -rf ${NAME}-$release | ||
popd | ||
|
||
# Merge the changelog into the spec file so we're consistent | ||
cat ${NAME}.spec.in > ${NAME}.spec | ||
cat ChangeLog >> ${NAME}.spec | ||
|
||
yes "" | rpmbuild -ba --sign \ | ||
--define "_signature gpg" \ | ||
--define "_gpg_name Comcast Xmidt Team <[email protected]>" \ | ||
--define "_ver $release" \ | ||
--define "_releaseno ${BUILD_NUMBER}" \ | ||
--define "_fullver $new_release" \ | ||
${NAME}.spec | ||
if [ 0 eq $SIGN ]; then | ||
yes "" | rpmbuild -ba \ | ||
--define "_ver $release" \ | ||
--define "_releaseno ${BUILD_NUMBER}" \ | ||
--define "_fullver $new_release" \ | ||
${NAME}.spec | ||
else | ||
yes "" | rpmbuild -ba --sign \ | ||
--define "_signature gpg" \ | ||
--define "_gpg_name Comcast Xmidt Team <[email protected]>" \ | ||
--define "_ver $release" \ | ||
--define "_releaseno ${BUILD_NUMBER}" \ | ||
--define "_fullver $new_release" \ | ||
${NAME}.spec | ||
fi | ||
|
||
pushd .. | ||
echo "$new_release" > versionno.txt | ||
popd | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
%define debug_package %{nil} | ||
|
||
Name: caduceus | ||
Version: %{_ver} | ||
Release: %{_releaseno}%{?dist} | ||
Summary: The Xmidt event delivery server. | ||
|
||
Group: System Environment/Daemons | ||
License: ASL 2.0 | ||
URL: https://github.com/Comcast/%{name} | ||
Source0: %{name}-%{_fullver}.tar.gz | ||
|
||
BuildRequires: golang >= 1.8 | ||
BuildRequires: systemd | ||
Requires: systemd | ||
|
||
Provides: %{name} | ||
|
||
%description | ||
The Xmidt server for delivering events. | ||
|
||
%prep | ||
%setup -q | ||
|
||
|
||
%build | ||
export GOPATH=$(pwd) | ||
pushd src | ||
glide install --strip-vendor | ||
cd %{name} | ||
go build %{name} | ||
popd | ||
|
||
%install | ||
|
||
# Install Binary | ||
mkdir -p %{buildroot}%{_bindir} | ||
%{__install} -p src/%{name}/%{name} %{buildroot}%{_bindir} | ||
|
||
# Install Service | ||
mkdir -p %{buildroot}%{_unitdir}/ | ||
%{__install} -m644 etc/systemd/%{name}.service %{buildroot}%{_unitdir} | ||
|
||
# Install Configuration | ||
%{__install} -d %{buildroot}%{_sysconfdir}/%{name} | ||
%{__install} -p etc/%{name}/%{name}.json %{buildroot}%{_sysconfdir}/%{name}/%{name}.json | ||
|
||
# Create Logging Location | ||
%{__install} -d %{buildroot}%{_localstatedir}/log/%{name} | ||
|
||
%files | ||
%defattr(644, %{name}, %{name}, 755) | ||
|
||
# Binary | ||
%attr(755, %{name}, %{name}) %{_bindir}/%{name} | ||
|
||
# Systemd | ||
%attr(755, %{name}, %{name}) %{_unitdir}/%{name}.service | ||
|
||
# Configuration | ||
%dir %{_sysconfdir}/%{name} | ||
%config %attr(644, %{name}, %{name}) %{_sysconfdir}/%{name}/%{name}.json | ||
|
||
# Logging Location | ||
%dir %{_localstatedir}/log/%{name} | ||
|
||
%pre | ||
# If app user does not exist, create | ||
id %{name} >/dev/null 2>&1 | ||
if [ $? != 0 ]; then | ||
/usr/sbin/groupadd -r %{name} >/dev/null 2>&1 | ||
/usr/sbin/useradd -r -g %{name} %{name} >/dev/null 2>&1 | ||
fi | ||
|
||
|
||
%post | ||
%systemd_post %{name}.service | ||
|
||
%preun | ||
%systemd_preun %{name}.service | ||
|
||
%postun | ||
%systemd_postun_with_restart %{name}.service | ||
|
||
# Do not remove anything if this is not an uninstall | ||
if [ $1 = 0 ]; then | ||
/usr/sbin/userdel -r %{name} >/dev/null 2>&1 | ||
/usr/sbin/groupdel %{name} >/dev/null 2>&1 | ||
# Ignore errors from above | ||
true | ||
fi | ||
|
||
%changelog |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.