diff options
author | Ashlee Young <ashlee@onosfw.com> | 2015-09-22 12:49:09 -0700 |
---|---|---|
committer | Ashlee Young <ashlee@onosfw.com> | 2015-09-22 12:49:09 -0700 |
commit | 81391595dca425ae58e2294898f09f11d9a32dbc (patch) | |
tree | f5d65c39a732150b2b29daa8de98a35d1236d3fb /framework/src/onos/tools/build/onos-package | |
parent | 0aa37e73dcb3a55b8d889b0c32ff74055551b1f3 (diff) |
bringing src to commit tag 65d551b50e782b0c1ea76c1a9ed1c5a801a5a7e4
Change-Id: Ib2da78962eaef856f418636c31b0f5c84286244f
Diffstat (limited to 'framework/src/onos/tools/build/onos-package')
-rwxr-xr-x | framework/src/onos/tools/build/onos-package | 102 |
1 files changed, 30 insertions, 72 deletions
diff --git a/framework/src/onos/tools/build/onos-package b/framework/src/onos/tools/build/onos-package index 8f6127da..32794457 100755 --- a/framework/src/onos/tools/build/onos-package +++ b/framework/src/onos/tools/build/onos-package @@ -30,7 +30,7 @@ function build_stage_dir() { # Stage the ONOS admin scripts and patch in Karaf service wrapper extras cp -r $ONOS_ROOT/tools/package/bin . - cp -r $ONOS_ROOT/tools/package/debian $ONOS_STAGE/debian + cp -r $ONOS_ROOT/tools/package/init $ONOS_STAGE/init cp -r $ONOS_ROOT/tools/package/etc/* $ONOS_STAGE/$KARAF_DIST/etc # Stage all builtin ONOS apps for factory install @@ -49,7 +49,7 @@ function build_stage_dir() { # Stage the ONOS bundles, but only those that match the version mkdir -p $ONOS_STAGE/$KARAF_DIST/system/org/onosproject find $M2_REPO/org/onosproject -type f -path "*/$ONOS_POM_VERSION/*" \ - -name '*.jar' -o -name '*.pom' -o -name '*-features.xml' \ + \( -name '*.jar' -o -name '*.pom' -o -name '*-features.xml' \) \ | grep -v -Ee '-tests.jar|-[0-9]{8}.[0-9]{6}-' \ | while read src; do dst=$ONOS_STAGE/$KARAF_DIST/system/${src#$M2_REPO/*} @@ -93,25 +93,19 @@ function build_compressed_package() { # Build a DEB package function build_deb() { - echo "You need to be root in order to generate a proper DEB package." + echo "This command may ask for your password to run commands as sudo," + echo " because you need to be root in order to generate a proper DEB package." sudo rm -fr $ONOS_DEB_ROOT mkdir -p $ONOS_DEB_ROOT/{DEBIAN,opt,etc/init} - { - echo "Package: ONOS" - echo "Architecture: all" - echo "Maintainer: ONOS Project" - echo "Depends: debconf (>= 0.5.00), default-jre-headless (>= 1.8) | openjdk-8-jre | oracle-java8-installer" - echo "Priority: optional" - echo "Version: $ONOS_POM_VERSION" - echo "Description: Open Network Operating System (ONOS) is an" - echo " opensource SDN controller." - } > $ONOS_DEB_ROOT/DEBIAN/control + # Copy the debian directory and fill in version + cp -r $ONOS_ROOT/tools/package/deb/* $ONOS_DEB_ROOT/DEBIAN/ + sed -i'' -E "s/@ONOS_POM_VERSION/$ONOS_POM_VERSION/" $ONOS_DEB_ROOT/DEBIAN/control cp -r $ONOS_STAGE $ONOS_DEB_ROOT/opt/onos - cp $ONOS_ROOT/tools/package/debian/onos.conf $ONOS_DEB_ROOT/etc/init/ + cp $ONOS_ROOT/tools/package/init/onos.conf $ONOS_DEB_ROOT/etc/init/ mkdir -p $ONOS_DEB_ROOT/opt/onos/var/ @@ -119,69 +113,33 @@ function build_deb() { sudo dpkg-deb --build $ONOS_DEB_ROOT > /dev/null && sudo mv $ONOS_STAGE_ROOT/deb.deb $ONOS_DEB && ls -l $ONOS_DEB + + #TODO run lintian on .deb } # Build an RPM package function build_rpm() { read -r -p "WARN: rpm-build utility and root priviledges are need to build the package. Do you want to continue? [Y/n] " response - case $response in - [nN][oO]) - exit 0 - ;; - *) - sudo rm -fr $ONOS_RPM_ROOT - - sudo yum -y install rpm-build - - mkdir -p $ONOS_RPM_ROOT/{BUILD,RPMS,SOURCES/ONOS-$ONOS_RPM_VERSION/{etc/init,opt},SPECS,SRPMS} - - cp -r $ONOS_STAGE $ONOS_RPM_ROOT/SOURCES/ONOS-$ONOS_RPM_VERSION/opt/onos - cp $ONOS_ROOT/tools/package/debian/onos.conf $ONOS_RPM_ROOT/SOURCES/ONOS-$ONOS_RPM_VERSION/etc/init/ - - cd $ONOS_RPM_ROOT/SOURCES - COPYFILE_DISABLE=1 tar zcf ONOS-$ONOS_RPM_VERSION.tar.gz ONOS-$ONOS_RPM_VERSION - - { - echo "Name: ONOS" - echo "Version: $ONOS_RPM_VERSION" - echo "Release: 1" - echo "Summary: Open Networking Operating System (ONOS)" - echo "Vendor: ONOS Project" - echo "Packager: ONOS Project" - echo "Group: Applications/Engineering" - echo "Requires: jre >= 1:8" - echo "License: Apache 2.0" - echo "URL: http://www.onosproject.org" - echo "Source0: ONOS-$ONOS_RPM_VERSION.tar.gz" - echo "BuildArch: noarch" - echo "BuildRoot: %{_tmppath}/%{name}-buildroot" - echo "%description" - echo "Open Network Operating System (ONOS) is an opensource SDN controller." - echo -e "\n" - echo "%prep" - echo "%setup -q" - echo -e "\n" - echo "%install" - echo "mkdir -p %{buildroot}" - echo "cp -R * %{buildroot}" - echo -e "\n" - echo "%clean" - echo "rm -rf %{buildroot}" - echo -e "\n" - echo "%files" - echo "%defattr(-,root,root,-)" - echo "/etc/init/onos.conf" - echo "/opt/onos/" - echo -e "\n" - echo "%post" - echo "echo ONOS successfully installed at /opt/onos" - } > $ONOS_RPM_ROOT/SPECS/onos.spec - - rpmbuild --define "_topdir $ONOS_RPM_ROOT" -bb $ONOS_RPM_ROOT/SPECS/onos.spec - - cp $ONOS_RPM_ROOT/RPMS/noarch/ONOS-$ONOS_RPM_VERSION-1.noarch.rpm $ONOS_STAGE_ROOT && ls -l $ONOS_STAGE_ROOT/ONOS-$ONOS_RPM_VERSION-1.noarch.rpm - ;; - esac + [[ "$response" =~ ^[Nn] ]] && exit 0 + + sudo rm -fr $ONOS_RPM_ROOT + + sudo yum -y install rpm-build + + mkdir -p $ONOS_RPM_ROOT/{BUILD,RPMS,SOURCES/onos-$ONOS_RPM_VERSION/{etc/init,opt},SPECS,SRPMS} + + cp -r $ONOS_STAGE $ONOS_RPM_ROOT/SOURCES/onos-$ONOS_RPM_VERSION/opt/onos + cp $ONOS_ROOT/tools/package/init/onos.conf $ONOS_RPM_ROOT/SOURCES/onos-$ONOS_RPM_VERSION/etc/init/ + + cd $ONOS_RPM_ROOT/SOURCES + COPYFILE_DISABLE=1 tar zcf onos-$ONOS_RPM_VERSION.tar.gz onos-$ONOS_RPM_VERSION + + cp $ONOS_ROOT/tools/package/rpm/onos.spec $ONOS_RPM_ROOT/SPECS/ + sed -i'' -E "s/@ONOS_RPM_VERSION/$ONOS_RPM_VERSION/g" $ONOS_RPM_ROOT/SPECS/onos.spec + + rpmbuild --define "_topdir $ONOS_RPM_ROOT" -bb $ONOS_RPM_ROOT/SPECS/onos.spec + + cp $ONOS_RPM_ROOT/RPMS/noarch/onos-$ONOS_RPM_VERSION-1.noarch.rpm $ONOS_STAGE_ROOT && ls -l $ONOS_STAGE_ROOT/onos-$ONOS_RPM_VERSION-1.noarch.rpm } # Script entry point |