To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit 12eaa5f0 authored by Bengt Giger's avatar Bengt Giger
Browse files

Initial commit

parent 25c395ae
Pipeline #80299 failed with stage
in 0 seconds
**/*~
**/#*
**/private_*
**/*.key
**/*.crt
image: registry.ethz.ch/bgiger/rpmbuilder:latest
before_script:
- eval $(ssh-agent -s)
- echo "$REPO_PRIVATE_KEY" | ssh-add -
- cp .rpmmacros $HOME/.rpmmacros
- rc="x";
gpg --list-keys | grep 8B9F02B2 || rc=$?
if [ "$rc" != "x" ]; then;
echo "$SIGNING_KEY" | gpg --import -;
fi
build:
script:
- export LANG=C
- export REMOTE_SERVER=w3_idinstallprd@idinstallprd
- export REMOTE_DIR=htdocs/repos/rpmbuilder/tomcat8
- VERSION=$(curl -s https://downloads.apache.org/tomcat/tomcat-8/| grep v8| cut -d '"' -f6 | tr -d "v/"|tail -n1 )
- sed s/__VERSION__/$VERSION/g tomcat8.spec.template >SPECS/tomcat8.spec
- rpmbuild --undefine=_disable_source_fetch -ba --clean --define "_topdir `pwd`" --define "buildroot `pwd`/BUILDROOT" --define "_rpmdir `pwd`/RPMS" --define "_source_filedigest_algorithm md5" --define "_binary_filedigest_algorithm md5" --define "_source_payload nil" --define "_binary_payload nil" --define "%_gpg_name ID-CD RPM Signing" SPECS/tomcat8.spec
- cd RPMS/x86_64
- for RPM in $(ls *.rpm); do export RPM; ../../rpm-sign.exp; done
- cd ..
- rsync -r . $REMOTE_SERVER:$REMOTE_DIR
- ssh $REMOTE_SERVER "createrepo $REMOTE_DIR"
tags:
- docker
[![pipeline status](https://gitlab.ethz.ch/id-cd-lnx/builders/tomcat8/badges/master/pipeline.svg)](https://gitlab.ethz.ch/id-cd-lnx/builders/tomcat8/-/commits/master)
# tomcat8
Determine latest version, fetch and build tomcat8 RPM. Packages avaiable here: https://idinstallprd.ethz.ch/repos/rpmbuilder/tomcat8/
JAVA_HOME=/usr/lib/jvm/jre
CATALINA_HOME=/usr/share/tomcat8
CATALINA_BASE=/usr/share/tomcat8
CATALINA_OPTS='-Xms512M -Xmx1024M -server -XX:+UseParallelGC'
JAVA_OPTS='-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom'
LD_LIBRARY_PATH='$LD_LIBRARY_PATH:/usr/lib64/tomcat8/lib'
/var/log/tomcat8/catalina.out {
copytruncate
weekly
rotate 52
compress
missingok
create 0644 tomcat8 tomcat8
}
[Unit]
Description=Apache Tomcat Web Application Container
After=syslog.target network.target
[Service]
EnvironmentFile=/etc/tomcat8/tomcat8.conf
ExecStart=/usr/libexec/tomcat8/catalina.sh run
ExecStop=/usr/libexec/tomcat8/catalina.sh stop
SuccessExitStatus=143
User=tomcat8
Group=tomcat8
SyslogIdentifier=tomcat8
[Install]
WantedBy=multi-user.target
#!/usr/bin/expect -f
### rpm-sign.exp -- Sign RPMs by sending the passphrase.
spawn rpm --addsign "$env(RPM)"
expect -exact "Enter pass phrase: "
send -- "\r"
expect eof
## end of rpm-sign.exp
%global homedir /usr/share/%{name}
Name: tomcat8
Version: __VERSION__
Release: el7.id_cd
Summary: Apache Servlet/JSP Engine, RI for Servlet 3.1/JSP 2.3 API
Group: System Environment/Daemons
License: ASL 2.0
URL: http://tomcat.apache.org/
Source0: https://www-us.apache.org/dist/tomcat/tomcat-8/v%{version}/bin/apache-tomcat-%{version}.tar.gz
Source1: tomcat8.conf
Source2: tomcat8.service
Source3: tomcat8.logrotate
BuildRequires: systemd-units
Provides: tomcat8
Requires: java >= 1:1.7.0
Requires: log4j
Requires(pre): shadow-utils
Requires(post): systemd-units
Requires(preun): systemd-units
Requires(postun): systemd-units
%description
Tomcat is the servlet container that is used in the official Reference
Implementation for the Java Servlet and JavaServer Pages technologies.
The Java Servlet and JavaServer Pages specifications are developed by
Sun under the Java Community Process.
Tomcat is developed in an open and participatory environment and
released under the Apache Software License version 2.0. Tomcat is intended
to be a collaboration of the best-of-breed developers from around the world.
%package admin-webapps
Group: Applications/System
Summary: The host-manager and manager web applications for Apache Tomcat 8
Requires: %{name} = %{version}-%{release}
%description admin-webapps
The host-manager and manager web applications for Apache Tomcat 8.
%package docs-webapp
Group: Applications/Text
Summary: The docs web application for Apache Tomcat 8
Requires: %{name} = %{version}-%{release}
%description docs-webapp
The docs web application for Apache Tomcat 8.
%package webapps
Group: Applications/Internet
Summary: The ROOT and examples web applications for Apache Tomcat 8
Requires: %{name} = %{version}-%{release}
%description webapps
The ROOT and examples web applications for Apache Tomcat 8.
%prep
%setup -qn apache-tomcat-%{version}
%install
rm -f bin/*.bat
sed -i -e '/^2localhost/d' -e '/\[\/localhost\]/d' \
-e '/^3manager/d' -e '/\[\/manager\]/d' \
-e '/^4host-manager/d' -e '/\[\/host-manager\]/d' \
-e 's/, *4host-manager.org.apache.juli.AsyncFileHandler//' \
-e 's/, *3manager.org.apache.juli.AsyncFileHandler//' \
conf/logging.properties
install -d -m 755 $RPM_BUILD_ROOT%{homedir}
install -d -m 755 $RPM_BUILD_ROOT%{_sysconfdir}
install -d -m 755 $RPM_BUILD_ROOT%{_unitdir}
install -d -m 755 $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d
install -d -m 755 $RPM_BUILD_ROOT%{_var}/log
install -d -m 755 $RPM_BUILD_ROOT%{_var}/cache
install -d -m 755 $RPM_BUILD_ROOT%{_var}/cache/%{name}
install -d -m 755 $RPM_BUILD_ROOT%{_var}/lib
install -d -m 755 $RPM_BUILD_ROOT%{_var}/lib/%{name}
install -d -m 755 $RPM_BUILD_ROOT%{_libexecdir}
mv bin $RPM_BUILD_ROOT%{_libexecdir}/%{name}
mv conf $RPM_BUILD_ROOT%{_sysconfdir}/%{name}
mv lib $RPM_BUILD_ROOT%{homedir}/lib
mv logs $RPM_BUILD_ROOT%{_var}/log/%{name}
mv temp $RPM_BUILD_ROOT%{_var}/cache/%{name}/temp
mv work $RPM_BUILD_ROOT%{_var}/cache/%{name}/work
mv webapps $RPM_BUILD_ROOT%{_var}/lib/%{name}/webapps
mv * $RPM_BUILD_ROOT%{homedir}/
install -m 644 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/%{name}.conf
install -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_unitdir}/%{name}.service
install -m 644 %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/%{name}
ln -s %{_libexecdir}/%{name} $RPM_BUILD_ROOT%{homedir}/bin
ln -s %{_sysconfdir}/%{name} $RPM_BUILD_ROOT%{homedir}/conf
ln -s %{_var}/log/%{name} $RPM_BUILD_ROOT%{homedir}/logs
ln -s %{_var}/cache/%{name}/temp $RPM_BUILD_ROOT%{homedir}/temp
ln -s %{_var}/lib/%{name}/webapps $RPM_BUILD_ROOT%{homedir}/webapps
ln -s %{_var}/cache/%{name}/work $RPM_BUILD_ROOT%{homedir}/work
%pre
getent group %{name} >/dev/null || groupadd -f -r %{name}
getent passwd %{name} >/dev/null || useradd -r -g %{name} -d %{homedir} -s /sbin/nologin -c "Tomcat8 user" %{name}
exit 0
%post
%systemd_post %{name}.service
%preun
%systemd_preun %{name}.service
%postun
%systemd_postun_with_restart %{name}.service
%files
%attr(-,root,tomcat8) %dir %{homedir}
%attr(-,root,tomcat8) %{_libexecdir}/%{name}
%attr(0770,root,tomcat8) %dir %{_sysconfdir}/%{name}
%config(noreplace) %attr(0740,root,tomcat8) %{_sysconfdir}/%{name}/*
%attr(-,root,tomcat8) %{homedir}/lib
%attr(-,tomcat8,tomcat8) %{_var}/log/%{name}
%attr(-,tomcat8,tomcat8) %{_var}/cache/%{name}/temp
%attr(-,tomcat8,tomcat8) %dir %{_var}/lib/%{name}/webapps
%attr(-,tomcat8,tomcat8) %{_var}/cache/%{name}/work
%{_unitdir}/%{name}.service
%{_sysconfdir}/logrotate.d/%{name}
%{homedir}/bin
%{homedir}/conf
%{homedir}/logs
%{homedir}/temp
%{homedir}/webapps
%{homedir}/work
%doc %{homedir}/LICENSE
%doc %{homedir}/NOTICE
%doc %{homedir}/RELEASE-NOTES
%doc %{homedir}/RUNNING.txt
%doc %{homedir}/BUILDING.txt
%doc %{homedir}/CONTRIBUTING.md
%doc %{homedir}/README.md
%files admin-webapps
%defattr(0664,root,tomcat8,0755)
%{_var}/lib/%{name}/webapps/host-manager
%{_var}/lib/%{name}/webapps/manager
%config(noreplace) %{_var}/lib/%{name}/webapps/host-manager/WEB-INF/web.xml
%config(noreplace) %{_var}/lib/%{name}/webapps/manager/WEB-INF/web.xml
%files docs-webapp
%defattr(-,root,root,-)
%{_var}/lib/%{name}/webapps/docs
%files webapps
%defattr(0644,tomcat8,tomcat8,0755)
%{_var}/lib/%{name}/webapps/ROOT
%{_var}/lib/%{name}/webapps/examples
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment