diff options
Diffstat (limited to 'pki/base/osutil/setup_package')
-rwxr-xr-x | pki/base/osutil/setup_package | 234 |
1 files changed, 234 insertions, 0 deletions
diff --git a/pki/base/osutil/setup_package b/pki/base/osutil/setup_package new file mode 100755 index 000000000..d8e7cf9db --- /dev/null +++ b/pki/base/osutil/setup_package @@ -0,0 +1,234 @@ +#!/bin/bash + +############################################################################### +## (1) Check command line arguments to see how many were passed in. ## +############################################################################### + +if [ $# -eq 5 ] +then + OSUTIL_BUILD_PREFIX=$1 + VERSION=$2 + RELEASE=$3 + ARCHITECTURE=$4 + OSUTIL_STAGING_PATH=$5 +else + echo + echo "Usage: $0 OSUTIL_build_prefix version release architecture" + echo " OSUTIL_staging_path" + echo + + exit 255 +fi + + +############################################################################### +## (2) Specify variables used by this script. ## +############################################################################### + +# specify generic helper functions +usage() { + if [ $# -gt 0 ] ; then + echo + echo "$1" + fi + echo + echo "Usage: $0 OSUTIL_build_prefix version release architecture" + echo " OSUTIL_staging_path" + echo + echo " where architecture MUST be 'intel'," + echo " 'sparc', or" + echo " 'sparcv9'." + echo + echo " NOTE: For 'intel' architectures, only the 'i386' and" + echo " the 'x86_64' architectures are currently supported." + echo +} + +# specify generic helper variables +if [ ${ARCHITECTURE} = "intel" ] ; then + # Since "rpmbuild" fails to process "%ifarch" macros inside the + # "%install" section of a spec file, the actual hardware + # architecture will be determined at this point in time. + ARCHITECTURE=`uname -i` + DLL_SUFFIX="so" + if [ ${ARCHITECTURE} = "i386" ] ; then + LIB_DIR="lib" + elif [ ${ARCHITECTURE} = "x86_64" ] ; then + LIB_DIR="lib64" + else + usage "ERROR: Unsupported intel architecture '${ARCHITECTURE}'!" + exit 255 + fi +elif [ ${ARCHITECTURE} = "sparc" ] ; then + # Note that "pkgbuild" successfully processes "%ifarch" macros + # inside the "%install" section of a spec file. + LIB_DIR="lib" + DLL_SUFFIX="so" +elif [ ${ARCHITECTURE} = "sparcv9" ] ; then + # Note that "pkgbuild" successfully processes "%ifarch" macros + # inside the "%install" section of a spec file. + LIB_DIR="lib/sparcv9" + DLL_SUFFIX="so" +else + usage "ERROR: Unsupported architecture '${ARCHITECTURE}'!" + exit 255 +fi + +# break the VERSION number into its various components +MAJOR_VERSION=`echo ${VERSION} | awk -F. '{ print $1 }'` +MINOR_VERSION=`echo ${VERSION} | awk -F. '{ print $2 }'` +PATCH_VERSION=`echo ${VERSION} | awk -F. '{ print $3 }'` + +PRODUCT_VERSION=${MAJOR_VERSION}.${MINOR_VERSION} + + +# comply with standard FHS 2.3 binary locations (executables) + +# comply with standard FHS 2.3 library locations +OSUTIL_LIB_DIR=${OSUTIL_BUILD_PREFIX}/usr/${LIB_DIR} + +# comply with standard JPackage 1.6.0 jar locations +OSUTIL_JAR_DIR=${OSUTIL_BUILD_PREFIX}/usr/lib/java + +# comply with standard FHS 2.3 binary locations (wrappers) + +# comply with standard FHS 2.3 shared data locations (templates) + +# comply with standard FHS 2.3 start/stop script locations + +# comply with standard FHS 2.3 configuration file locations + +# comply with standard FHS 2.3 documentation locations +OSUTIL_DOCUMENTATION=${OSUTIL_BUILD_PREFIX}/usr/share/doc/osutil-${VERSION} + +# comply with standard FHS 2.3 log file locations + +# comply with default FHS 2.3 instance locations + + +############################################################################### +## (3) Create the appropriate subdirectories. ## +############################################################################### + +## +## System: +## + +mkdir -p ${OSUTIL_DOCUMENTATION} +mkdir -p ${OSUTIL_LIB_DIR} +mkdir -p ${OSUTIL_JAR_DIR} + + +## +## Product +## + + +## +## Subsystem +## + + +## +## Initial Instance +## + + +############################################################################### +## (4) Unpack the package contents to the appropriate subdirectories. ## +############################################################################### + +## +## Executables +## + + +## +## Libraries +## + +cp -p ${OSUTIL_STAGING_PATH}/${LIB_DIR}/libosutil.${DLL_SUFFIX} ${OSUTIL_LIB_DIR} + + +## +## Jars +## + +cp -p ${OSUTIL_STAGING_PATH}/jars/osutil.jar ${OSUTIL_JAR_DIR} + + +## +## Wrappers +## + + +## +## Shared Data +## + +cp -rp ${OSUTIL_STAGING_PATH}/doc/LICENSE ${OSUTIL_DOCUMENTATION} + + +############################################################################### +## (5) Unpack the package contents to the initial instance directories. ## +############################################################################### + +## +## Start/Stop Script +## + + +## +## Configuration +## + + +## +## Logs +## + + +## +## Default Instance +## + + +############################################################################### +## (6) Rename the extracted contents following appropriate naming rules. ## +############################################################################### + +# comply with standard Linux/UNIX shared library naming conventions +cd ${OSUTIL_LIB_DIR} ; mv libosutil.${DLL_SUFFIX} libosutil.${DLL_SUFFIX}.${VERSION} + +# comply with standard JPackage 1.6.0 jar naming conventions +cd ${OSUTIL_JAR_DIR} ; mv osutil.jar osutil-${VERSION}.jar + + +############################################################################### +## (7) Create a command wrapper for each specified command. ## +############################################################################### + + + +############################################################################### +## (8) Create useful symbolic links as appropriate. ## +############################################################################### + +# create shared library sans version "linker-name" to protect this namespace +cd ${OSUTIL_LIB_DIR} ; +ln -s libosutil.${DLL_SUFFIX}.${VERSION} libosutil.${DLL_SUFFIX}.${PRODUCT_VERSION} ; +ln -s libosutil.${DLL_SUFFIX}.${PRODUCT_VERSION} libosutil.${DLL_SUFFIX}.${MAJOR_VERSION} ; +ln -s libosutil.${DLL_SUFFIX}.${MAJOR_VERSION} libosutil.${DLL_SUFFIX} + +# create jar sans version to be used by classpath +cd ${OSUTIL_JAR_DIR} ; ln -s osutil-${VERSION}.jar osutil.jar + +# create assorted symbolic links to various file dependencies (Tomcat) + + +############################################################################### +## (9) Successfully exit from this setup script. ## +############################################################################### + +exit 0 + |