Repository: cloudstack Updated Branches: refs/heads/feature/centos7-rpm 2b787a639 -> 80ff8f04a
More cleanup Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/c60078cb Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/c60078cb Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/c60078cb Branch: refs/heads/feature/centos7-rpm Commit: c60078cbcf6b0ca52e369edf25a155c56bf1517f Parents: 2b787a6 Author: Hugo Trippaers <[email protected]> Authored: Mon Nov 24 08:38:03 2014 +0100 Committer: Hugo Trippaers <[email protected]> Committed: Mon Nov 24 08:38:03 2014 +0100 ---------------------------------------------------------------------- packaging/centos63/cloud.spec | 42 ++--- packaging/centos63/default/macros.spec | 27 --- packaging/centos63/default/tomcat.sh | 18 -- packaging/centos63/package.sh | 168 ------------------- .../centos63/rhel7/cloud-management.service | 32 ---- packaging/centos63/rhel7/macros.spec | 27 --- packaging/centos63/rhel7/tomcat.sh | 18 -- packaging/centos7/cloud-management.rc | 115 ------------- packaging/centos7/package.sh | 143 ---------------- 9 files changed, 15 insertions(+), 575 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c60078cb/packaging/centos63/cloud.spec ---------------------------------------------------------------------- diff --git a/packaging/centos63/cloud.spec b/packaging/centos63/cloud.spec index 072a0b9..7d8ebcf 100644 --- a/packaging/centos63/cloud.spec +++ b/packaging/centos63/cloud.spec @@ -43,10 +43,8 @@ Group: System Environment/Libraries Source0: %{name}-%{_maventag}.tgz BuildRoot: %{_tmppath}/%{name}-%{_maventag}-%{release}-build -%include SPECS/%{_os}/macros.spec - BuildRequires: java-1.7.0-openjdk-devel -BuildRequires: %{_tomcatversion} +BuildRequires: tomcat6 BuildRequires: ws-commons-util BuildRequires: jpackage-utils BuildRequires: gcc @@ -61,8 +59,8 @@ intelligent IaaS cloud implementation. %package management Summary: CloudStack management server UI -Requires: %{_tomcatversion} -Requires: %{_javaversion} +Requires: tomcat6 +Requires: java7 Requires: python Requires: bash Requires: bzip2 @@ -82,11 +80,10 @@ Requires: /sbin/chkconfig Requires: /usr/bin/ssh-keygen Requires: mkisofs Requires: MySQL-python -%{_pythonparamiko} +Requires: python-paramiko Requires: ipmitool Requires: %{name}-common = %{_ver} Requires: %{name}-awsapi = %{_ver} -%{_iptablesservice} Obsoletes: cloud-client < 4.1.0 Obsoletes: cloud-client-ui < 4.1.0 Obsoletes: cloud-server < 4.1.0 @@ -116,14 +113,14 @@ The Apache CloudStack files shared between agent and management server %package agent Summary: CloudStack Agent for KVM hypervisors Requires: openssh-clients -Requires: %{_javaversion} +Requires: java7 Requires: %{name}-common = %{_ver} Requires: libvirt Requires: bridge-utils Requires: ebtables Requires: iptables Requires: ethtool -Requires: %{_vlanconfigtool} +Requires: vconfig Requires: ipset Requires: jsvc Requires: jakarta-commons-daemon @@ -154,7 +151,7 @@ The CloudStack baremetal agent %package usage Summary: CloudStack Usage calculation server -Requires: %{_javaversion} +Requires: java7 Requires: jsvc Requires: jakarta-commons-daemon Requires: jakarta-commons-daemon-jsvc @@ -185,7 +182,7 @@ Apache Cloudstack AWS API compatibility wrapper %package mysql-ha Summary: Apache CloudStack Balancing Strategy for MySQL Requires: mysql-connector-java -Requires: %{_tomcatversion} +Requires: tomcat6 Group: System Environmnet/Libraries %description mysql-ha Apache CloudStack Balancing Strategy for MySQL @@ -266,9 +263,9 @@ mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/management # Specific for tomcat mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/management/Catalina/localhost/client -ln -sf /usr/share/%{_tomcatpathname}/bin ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/bin +ln -sf /usr/share/tomcat6/bin ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/bin ln -sf /etc/%{name}/management ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/conf -ln -sf /usr/share/%{_tomcatpathname}/lib ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/lib +ln -sf /usr/share/tomcat6/lib ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/lib ln -sf /var/log/%{name}/management ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/logs ln -sf /var/cache/%{name}/management/temp ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/temp ln -sf /var/cache/%{name}/management/work ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/work @@ -292,19 +289,12 @@ cp -r client/target/cloud-client-ui-%{_maventag}/* ${RPM_BUILD_ROOT}%{_datadir}/ rm -rf ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/webapps/client/WEB-INF/classes/scripts rm -rf ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/webapps/client/WEB-INF/classes/vms -for name in db.properties log4j-cloud.xml tomcat6-nonssl.conf tomcat6-ssl.conf %{_serverxmlname}-ssl.xml %{_serverxmlname}-nonssl.xml \ +for name in db.properties log4j-cloud.xml tomcat6-nonssl.conf tomcat6-ssl.conf server-ssl.xml server-nonssl.xml \ catalina.policy catalina.properties classpath.conf tomcat-users.xml web.xml environment.properties ; do mv ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/webapps/client/WEB-INF/classes/$name \ ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/management/$name done -if [ -f "${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/management/server7-nonssl.xml" ]; then - mv ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/management/server7-nonssl.xml ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/management/server-nonssl.xml -fi -if [ -f "${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/management/server7-ssl.xml" ]; then - mv ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/management/server7-ssl.xml ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/management/server-ssl.xml -fi - ln -s %{_sysconfdir}/%{name}/management/log4j-cloud.xml \ ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/webapps/client/WEB-INF/classes/log4j-cloud.xml @@ -315,10 +305,9 @@ install python/bindir/cloud-external-ipallocator.py ${RPM_BUILD_ROOT}%{_bindir}/ install -D client/target/pythonlibs/jasypt-1.9.0.jar ${RPM_BUILD_ROOT}%{_datadir}/%{name}-common/lib/jasypt-1.9.0.jar install -D packaging/centos63/cloud-ipallocator.rc ${RPM_BUILD_ROOT}%{_initrddir}/%{name}-ipallocator -install -D packaging/centos63/cloud-management.rc ${RPM_BUILD_ROOT}%{_managementstartscriptpath}/%{name}-management +install -D packaging/centos63/cloud-management.rc ${RPM_BUILD_ROOT}%{_initrddir}/%{name}-management install -D packaging/centos63/cloud-management.sysconfig ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/%{name}-management -install -D packaging/centos63/%{_os}/tomcat.sh ${RPM_BUILD_ROOT}%{_managementstartscriptpath}/tomcat.sh -%{_managementservice} +install -D packaging/centos63/tomcat.sh ${RPM_BUILD_ROOT}%{_initrddir}/tomcat.sh chmod 770 ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/management/Catalina chmod 770 ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/management/Catalina/localhost @@ -610,9 +599,8 @@ fi %config(noreplace) %{_sysconfdir}/%{name}/management/cloud-bridge.properties %config(noreplace) %{_sysconfdir}/%{name}/management/commons-logging.properties %config(noreplace) %{_sysconfdir}/%{name}/management/ec2-service.properties -%attr(0755,root,root) %{_managementstartscriptpath}/%{name}-management -%attr(0755,root,root) %{_managementstartscriptpath}/tomcat.sh -%{_managementserviceattribute} +%attr(0755,root,root) %{_initrddir}/%{name}-management +%attr(0755,root,root) %{_initrddir}/tomcat.sh %attr(0755,root,root) %{_bindir}/%{name}-setup-management %attr(0755,root,root) %{_bindir}/%{name}-update-xenserver-licenses http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c60078cb/packaging/centos63/default/macros.spec ---------------------------------------------------------------------- diff --git a/packaging/centos63/default/macros.spec b/packaging/centos63/default/macros.spec deleted file mode 100644 index f3c937c..0000000 --- a/packaging/centos63/default/macros.spec +++ /dev/null @@ -1,27 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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. - -%define _pythonparamiko Requires: python-paramiko -%define _javaversion java7 -%define _tomcatversion tomcat6 -%define _vlanconfigtool vconfig -%define _tomcatpathname tomcat6 -%define _managementstartscriptpath %{_initrddir} -%define _managementservice %{nil} -%define _managementserviceattribute %{nil} -%define _iptablesservice %{nil} -%define _serverxmlname server \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c60078cb/packaging/centos63/default/tomcat.sh ---------------------------------------------------------------------- diff --git a/packaging/centos63/default/tomcat.sh b/packaging/centos63/default/tomcat.sh deleted file mode 100644 index 0908da4..0000000 --- a/packaging/centos63/default/tomcat.sh +++ /dev/null @@ -1,18 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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. - -. /etc/rc.d/init.d/tomcat6 start http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c60078cb/packaging/centos63/package.sh ---------------------------------------------------------------------- diff --git a/packaging/centos63/package.sh b/packaging/centos63/package.sh deleted file mode 100755 index 00c1947..0000000 --- a/packaging/centos63/package.sh +++ /dev/null @@ -1,168 +0,0 @@ -#!/bin/bash -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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. - -function usage() { - echo "" - echo "usage: ./package.sh [-p|--pack] [-h|--help] [-o|--operating-system] [ARGS]" - echo "" - echo "The commonly used Arguments are:" - echo "-p|--pack oss|OSS To package with only redistributable libraries (default)" - echo "-p|--pack noredist|NOREDIST To package with non-redistributable libraries" - echo "-o default|DEFAULT To build in default Operating System mode" - echo "-o rhel7|RHEL7 To build for rhel7" - echo "-s simulator|SIMULATOR To build for Simulator" - echo "" - echo "Examples: ./package.sh -p|--pack oss|OSS" - echo " ./package.sh -p|--pack noredist|NOREDIST" - echo " ./package.sh (Default OSS)" - exit 1 -} - -function packaging() { - CWD=`pwd` - RPMDIR=$CWD/../../dist/rpmbuild - PACK_PROJECT=cloudstack - if [ -n "$1" ] ;then - DOS="-D_os $1" - echo "$DOS" - fi - if [ -n "$2" ] ; then - DEFOSSNOSS="-D_ossnoss $2" - echo "$DEFOSSNOSS" - fi - if [ -n "$3" ] ; then - DEFSIM="-D_sim $3" - echo "$DEFSIM" - fi - - VERSION=`(cd ../../; mvn org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version) | grep --color=none '^[0-9]\.'` - if echo $VERSION | grep -q SNAPSHOT ; then - REALVER=`echo $VERSION | cut -d '-' -f 1` - DEFVER="-D_ver $REALVER" - DEFPRE="-D_prerelease 1" - DEFREL="-D_rel SNAPSHOT" - else - REALVER=`echo $VERSION` - DEFVER="-D_ver $REALVER" - DEFREL="-D_rel 1" - fi - - echo Preparing to package Apache CloudStack ${VERSION} - - mkdir -p $RPMDIR/SPECS - mkdir -p $RPMDIR/BUILD - mkdir -p $RPMDIR/RPMS - mkdir -p $RPMDIR/SRPMS - mkdir -p $RPMDIR/SOURCES/$PACK_PROJECT-$VERSION - - echo ". preparing source tarball" - (cd ../../; tar -c --exclude .git --exclude dist . | tar -C $RPMDIR/SOURCES/$PACK_PROJECT-$VERSION -x ) - (cd $RPMDIR/SOURCES/; tar -czf $PACK_PROJECT-$VERSION.tgz $PACK_PROJECT-$VERSION) - - echo ". executing rpmbuild" - cp cloud.spec $RPMDIR/SPECS - cp -rf default $RPMDIR/SPECS - cp -rf rhel7 $RPMDIR/SPECS - - (cd $RPMDIR; rpmbuild --define "_topdir $RPMDIR" "${DEFVER}" "${DEFREL}" ${DEFPRE+"${DEFPRE}"} ${DEFOSSNOSS+"$DEFOSSNOSS"} ${DEFSIM+"$DEFSIM"} "${DOS}" -bb SPECS/cloud.spec) - - if [ $? -ne 0 ]; then - echo "RPM Build Failed " - exit 1 - else - echo "RPM Build Done" - fi - exit - -} - -if [ $# -lt 1 ] ; then - packaging "default" -elif [ $# -gt 0 ] ; then - SHORTOPTS="hp:o:" - LONGOPTS="help,pack:,operating-system:,simulator:" - ARGS=$(getopt -s bash -u -a --options $SHORTOPTS --longoptions $LONGOPTS --name $0 -- "$@") - eval set -- "$ARGS" - echo "$ARGS" - while [ $# -gt 0 ] ; do - case "$1" in - -h | --help) - usage - exit 0 - ;; - -p | --pack) - echo "Doing CloudStack Packaging ....." - packageval=$2 - echo "$packageval" - if [ "$packageval" == "oss" -o "$packageval" == "OSS" ] ; then - packageval = "" - elif [ "$packageval" == "noredist" -o "$packageval" == "NOREDIST" ] ; then - packageval="noredist" - else - echo "Error: Incorrect value provided in package.sh script, Please see help ./package.sh --help|-h for more details." - exit 1 - fi - shift - ;; - -o | --operating-system) - os=$2 - echo "$os" - if [ "$os" == "default" -o "$os" == "DEFAULT" ] ; then - os = "default" - elif [ "$os" == "rhel7" -o "$os" == "RHEL7" ] ; then - os="rhel7" - else - echo "Error: Incorrect value provided in package.sh script for -o, Please see help ./package.sh --help|-h for more details." - exit 1 - fi - shift - ;; - -s | --simulator) - sim=$2 - echo "$sim" - if [ "$sim" == "default" -o "$sim" == "DEFAULT" ] ; then - sim = "false" - elif [ "$sim" == "simulator" -o "$sim" == "SIMULATOR" ] ; then - sim="simulator" - else - echo "Error: Incorrect value provided in package.sh script for -o, Please see help ./package.sh --help|-h for more details." - exit 1 - fi - shift - ;; - -) - echo "Unrecognized option..." - usage - exit 1 - ;; - *) - shift - ;; - esac - done - - if [ -z "${os+xxx}" ]; then - echo "Setting os to default" - os="default" - fi - echo "Passed OS = $os, packageval = $packageval and Simulator build = $sim" - packaging $os $packageval $sim -else - echo "Incorrect choice. Nothing to do." >&2 - echo "Please, execute ./package.sh --help for more help" -fi http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c60078cb/packaging/centos63/rhel7/cloud-management.service ---------------------------------------------------------------------- diff --git a/packaging/centos63/rhel7/cloud-management.service b/packaging/centos63/rhel7/cloud-management.service deleted file mode 100644 index 5d69885..0000000 --- a/packaging/centos63/rhel7/cloud-management.service +++ /dev/null @@ -1,32 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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. - -[Unit] -Description=Citrix Cloud Plaltform -After=syslog.target network.target - -[Service] -Type=forking -ExecStart=/usr/sbin/cloudstack-management start -ExecStop=/usr/sbin/cloudstack-management stop -SuccessExitStatus=143 -User=cloud -Group=cloud - - -[Install] -WantedBy=multi-user.target \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c60078cb/packaging/centos63/rhel7/macros.spec ---------------------------------------------------------------------- diff --git a/packaging/centos63/rhel7/macros.spec b/packaging/centos63/rhel7/macros.spec deleted file mode 100644 index 4b71092..0000000 --- a/packaging/centos63/rhel7/macros.spec +++ /dev/null @@ -1,27 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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. - -%define _pythonparamiko %{nil} -%define _javaversion java => 1.7.0 -%define _tomcatversion tomcat => 7.0 -%define _vlanconfigtool iproute -%define _tomcatpathname tomcat -%define _managementstartscriptpath %{_sbindir} -%define _managementservice install -D packaging/centos63/%{_os}/cloud-management.service ${RPM_BUILD_ROOT}%{_unitdir}/%{name}-management.service -%define _managementserviceattribute %attr(0755,root,root) %{_unitdir}/%{name}-management.service -%define _iptablesservice Requires: iptables-services -%define _serverxmlname server7 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c60078cb/packaging/centos63/rhel7/tomcat.sh ---------------------------------------------------------------------- diff --git a/packaging/centos63/rhel7/tomcat.sh b/packaging/centos63/rhel7/tomcat.sh deleted file mode 100644 index 03c6e7b..0000000 --- a/packaging/centos63/rhel7/tomcat.sh +++ /dev/null @@ -1,18 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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. - -. /usr/sbin/tomcat start http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c60078cb/packaging/centos7/cloud-management.rc ---------------------------------------------------------------------- diff --git a/packaging/centos7/cloud-management.rc b/packaging/centos7/cloud-management.rc deleted file mode 100755 index 6d28748..0000000 --- a/packaging/centos7/cloud-management.rc +++ /dev/null @@ -1,115 +0,0 @@ -#!/bin/bash -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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. -# -# cloudstack-management This shell script takes care of starting and stopping Tomcat -# -# chkconfig: - 80 20 -# -### BEGIN INIT INFO -# Provides: tomcat6 -# Required-Start: $network $syslog -# Required-Stop: $network $syslog -# Default-Start: -# Default-Stop: -# Description: Release implementation for Servlet 2.5 and JSP 2.1 -# Short-Description: start and stop tomcat -### END INIT INFO -# -# - originally written by Henri Gomez, Keith Irwin, and Nicolas Mailhot -# - heavily rewritten by Deepak Bhole and Jason Corley -# - -if [ -r /etc/rc.d/init.d/functions ]; then - . /etc/rc.d/init.d/functions -fi -if [ -r /lib/lsb/init-functions ]; then - . /lib/lsb/init-functions -fi - - -NAME="$(basename $0)" -export SERVICE_NAME="$NAME" -stop() { - SHUTDOWN_WAIT="30" - count="0" - if [ -f /var/run/${NAME}.pid ]; then - pid=`cat /var/run/${NAME}.pid` - kill $pid &>/dev/null - until [ "$(ps --pid $pid | grep -c $pid)" -eq "0" ] || \ - [ "$count" -gt "$SHUTDOWN_WAIT" ] - do - sleep 1 - let count="${count}+1" - done - if [ "$(ps --pid $pid | grep -c $pid)" -eq "0" ]; then - log_success_msg "Stopping ${NAME}:" - rm -f /var/run/${NAME}.pid - rm -f /var/lock/subsys/${NAME} - else - log_failure_msg "Stopping ${NAME}:" - fi - else - echo "Cannot find PID file of ${NAME}" - log_failure_msg "Stopping ${NAME}:" - fi -} - -set_ulimit() { - fd_limit=`ulimit -n` - if [ "$fd_limit" != "4096" ]; then - user=`whoami` - if [ $user == "root" ]; then - ulimit -n 4096 - fi - fi -} - -handle_pid_file() { - if [ "$1" -ne 0 ] && [ "$1" -ne 3 ]; then - echo "The pid file locates at /var/run/${NAME}.pid and lock file at /var/lock/subsys/${NAME}. - Starting ${NAME} will take care of them or you can manually clean up." - fi -} - -start() { - readpath=$(readlink -f $0) - source `dirname $readpath`/tomcat.sh -} - -# See how we were called. -case "$1" in - status) - status ${NAME} - RETVAL=$? - handle_pid_file $RETVAL - ;; - stop) - stop - ;; - restart) - stop - set start - set_ulimit - start - ;; - *) - set_ulimit - start -esac - -exit $RETVAL http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c60078cb/packaging/centos7/package.sh ---------------------------------------------------------------------- diff --git a/packaging/centos7/package.sh b/packaging/centos7/package.sh deleted file mode 100755 index ec4e562..0000000 --- a/packaging/centos7/package.sh +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/bash -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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. - -function usage() { - echo "" - echo "usage: ./package.sh [-p|--pack] [-h|--help] [-o|--operating-system] [ARGS]" - echo "" - echo "The commonly used Arguments are:" - echo "-p|--pack oss|OSS To package with only redistributable libraries (default)" - echo "-p|--pack noredist|NOREDIST To package with non-redistributable libraries" - echo "-o default|DEFAULT To build in default Operating System mode" - echo "-s simulator|SIMULATOR To build for Simulator" - echo "" - echo "Examples: ./package.sh -p|--pack oss|OSS" - echo " ./package.sh -p|--pack noredist|NOREDIST" - echo " ./package.sh (Default OSS)" - exit 1 -} - -function packaging() { - CWD=`pwd` - RPMDIR=$CWD/../../dist/rpmbuild - PACK_PROJECT=cloudstack - if [ -n "$2" ] ; then - DEFOSSNOSS="-D_ossnoss $2" - echo "$DEFOSSNOSS" - fi - if [ -n "$3" ] ; then - DEFSIM="-D_sim $3" - echo "$DEFSIM" - fi - - VERSION=`(cd ../../; mvn org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version) | grep --color=none '^[0-9]\.'` - if echo $VERSION | grep -q SNAPSHOT ; then - REALVER=`echo $VERSION | cut -d '-' -f 1` - DEFVER="-D_ver $REALVER" - DEFPRE="-D_prerelease 1" - DEFREL="-D_rel SNAPSHOT" - else - REALVER=`echo $VERSION` - DEFVER="-D_ver $REALVER" - DEFREL="-D_rel 1" - fi - - echo Preparing to package Apache CloudStack ${VERSION} - - mkdir -p $RPMDIR/SPECS - mkdir -p $RPMDIR/BUILD - mkdir -p $RPMDIR/RPMS - mkdir -p $RPMDIR/SRPMS - mkdir -p $RPMDIR/SOURCES/$PACK_PROJECT-$VERSION - - echo ". preparing source tarball" - (cd ../../; tar -c --exclude .git --exclude dist . | tar -C $RPMDIR/SOURCES/$PACK_PROJECT-$VERSION -x ) - (cd $RPMDIR/SOURCES/; tar -czf $PACK_PROJECT-$VERSION.tgz $PACK_PROJECT-$VERSION) - - echo ". executing rpmbuild" - cp cloud.spec $RPMDIR/SPECS - - (cd $RPMDIR; rpmbuild --define "_topdir $RPMDIR" "${DEFVER}" "${DEFREL}" ${DEFPRE+"${DEFPRE}"} ${DEFOSSNOSS+"$DEFOSSNOSS"} ${DEFSIM+"$DEFSIM"} -bb SPECS/cloud.spec) - - if [ $? -ne 0 ]; then - echo "RPM Build Failed " - exit 1 - else - echo "RPM Build Done" - fi - exit - -} - -if [ $# -lt 1 ] ; then - packaging "default" -elif [ $# -gt 0 ] ; then - SHORTOPTS="hp:" - LONGOPTS="help,pack:,simulator:" - ARGS=$(getopt -s bash -u -a --options $SHORTOPTS --longoptions $LONGOPTS --name $0 -- "$@") - eval set -- "$ARGS" - echo "$ARGS" - while [ $# -gt 0 ] ; do - case "$1" in - -h | --help) - usage - exit 0 - ;; - -p | --pack) - echo "Doing CloudStack Packaging ....." - packageval=$2 - echo "$packageval" - if [ "$packageval" == "oss" -o "$packageval" == "OSS" ] ; then - packageval = "" - elif [ "$packageval" == "noredist" -o "$packageval" == "NOREDIST" ] ; then - packageval="noredist" - else - echo "Error: Incorrect value provided in package.sh script, Please see help ./package.sh --help|-h for more details." - exit 1 - fi - shift - ;; - -s | --simulator) - sim=$2 - echo "$sim" - if [ "$sim" == "default" -o "$sim" == "DEFAULT" ] ; then - sim = "false" - elif [ "$sim" == "simulator" -o "$sim" == "SIMULATOR" ] ; then - sim="simulator" - else - echo "Error: Incorrect value provided in package.sh script for -o, Please see help ./package.sh --help|-h for more details." - exit 1 - fi - shift - ;; - -) - echo "Unrecognized option..." - usage - exit 1 - ;; - *) - shift - ;; - esac - done - - packaging $packageval $sim -else - echo "Incorrect choice. Nothing to do." >&2 - echo "Please, execute ./package.sh --help for more help" -fi
