mirror of
https://github.com/Cacti/spine.git
synced 2026-10-23 03:27:10 +09:00
Fixes #441 Updates copyright headers from 2004-2023/2024 to 2004-2026 across 12 source files. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
119 lines
4.5 KiB
Bash
Executable File
119 lines
4.5 KiB
Bash
Executable File
#!/bin/sh
|
|
<?php
|
|
# +-------------------------------------------------------------------------+
|
|
# | Copyright (C) 2004-2026 The Cacti Group |
|
|
# | |
|
|
# | This program is free software; you can redistribute it and/or |
|
|
# | modify it under the terms of the GNU General Public License |
|
|
# | as published by the Free Software Foundation; either version 2 |
|
|
# | of the License, or (at your option) any later version. |
|
|
# | |
|
|
# | This program is distributed in the hope that it will be useful, |
|
|
# | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
# | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
|
# | GNU General Public License for more details. |
|
|
# +-------------------------------------------------------------------------+
|
|
# | Cacti: The Complete RRDtool-based Graphing Solution |
|
|
# +-------------------------------------------------------------------------+
|
|
# | This code is designed, written, and maintained by the Cacti Group. See |
|
|
# | about.php and/or the AUTHORS file for specific developer information. |
|
|
# +-------------------------------------------------------------------------+
|
|
# | http://www.cacti.net/ |
|
|
# +-------------------------------------------------------------------------+
|
|
|
|
# Variable Declaration
|
|
TMP_DIR="/tmp"
|
|
|
|
# Help Display function
|
|
display_help () {
|
|
echo "----------------------------------------------------------------------------"
|
|
echo " Spine Package Script"
|
|
echo " Attempts to package spine from a repository checkout directory of"
|
|
echo " spine. If all goes well a tar.gz file will be created."
|
|
echo "----------------------------------------------------------------------------"
|
|
echo " Syntax:"
|
|
echo " ./`basename $0` <Version>"
|
|
echo ""
|
|
echo " <Version> - Designated version for build (required)"
|
|
echo ""
|
|
}
|
|
|
|
# Sanity checks
|
|
[ ! -e configure.ac ] && echo "ERROR: Your current working directory must be the SVN check out of Spine" && exit -1
|
|
|
|
if [ "${1}x" = "--helpx" -o "${1}x" = "-hx" ]; then
|
|
display_help
|
|
exit 0
|
|
fi
|
|
|
|
if [ -z "${1}" ]; then
|
|
echo ""
|
|
echo "ERROR: Invalid syntax, missing required argument"
|
|
echo ""
|
|
display_help
|
|
exit -1
|
|
fi
|
|
VERSION=${1}
|
|
|
|
# Perform packaging
|
|
echo ""
|
|
echo "----------------------------------------------------------------------------"
|
|
echo "Spine package builder"
|
|
echo " Version: ${VERSION}"
|
|
echo "----------------------------------------------------------------------------"
|
|
|
|
# Clean up previous builds
|
|
if [ -e ${TMP_DIR}/cacti-spine-${VERSION} ]; then
|
|
echo "INFO: Removing previous build ${TMP_DIR}/cacti-spine-${VERSION}..."
|
|
rm -Rf ${TMP_DIR}/cacti-spine-${VERSION} > /dev/null 2>&1
|
|
[ $? -gt 1 ] && echo "ERROR: Unable to remove directory: ${TMP_DIR}/cacti-spine-${VERSION}" && exit -1
|
|
fi
|
|
if [ -e ${TMP_DIR}/cacti-spine-${VERSION}.tar.gz ]; then
|
|
rm -Rf ${TMP_DIR}/cacti-spine-${VERSION}.tar.gz > /dev/null 2>&1
|
|
[ $? -gt 1 ] && echo "ERROR: Unable to remove file: ${TMP_DIR}/cacti-spine-${VERSION}.tar.gz" && exit -1
|
|
fi
|
|
|
|
# Copy repository
|
|
mkdir -p ${TMP_DIR}/cacti-spine-${VERSION} > /dev/null 2>&1
|
|
tar -cf - --exclude 'package' --exclude '.svn' --exclude '.travis.yml' * | (cd ${TMP_DIR}/cacti-spine-${VERSION}; tar -xf -)
|
|
[ $? -gt 0 ] && echo "ERROR: Unable to repository to ${TMP_DIR}/cacti-spine-${VERSION}" && exit -1
|
|
|
|
# Change working directory
|
|
pushd ${TMP_DIR}/cacti-spine-${VERSION} > /dev/null 2>&1
|
|
|
|
# Get version from source files, warn if different than defined for build
|
|
SRC_VERSION=`cat configure.ac | grep AC_INIT | awk -F, '{print $2}' | sed 's/ //g'`
|
|
if [ "${SRC_VERSION}" != "${VERSION}" ]; then
|
|
echo "WARNING: Build version and source version are not the same";
|
|
echo "WARNING: Build Version: ${VERSION}"
|
|
echo "WARNING: Source Version: ${SRC_VERSION}"
|
|
fi
|
|
|
|
# Call bootstrap
|
|
echo "INFO: call bootstrap..."
|
|
./bootstrap
|
|
|
|
# Check working directory
|
|
cd ${TMP_DIR}/
|
|
|
|
# Package it
|
|
echo "INFO: Packaging..."
|
|
tar -zcf cacti-spine-${VERSION}.tar.gz cacti-spine-${VERSION}
|
|
[ $? -gt 1 ] && echo "ERROR: Unable to package" && exit -1
|
|
|
|
# Change working directory
|
|
popd > /dev/null 2>&1
|
|
|
|
# Clean up
|
|
echo "INFO: Cleaning up build directory..."
|
|
rm -rf ${TMP_DIR}/cacti-spine-${VERSION} > /dev/null 2>&1
|
|
|
|
# Display file locations
|
|
echo "INFO: Completed..."
|
|
echo ""
|
|
echo "Package file: ${TMP_DIR}/cacti-spine-${VERSION}.tar.gz"
|
|
echo ""
|
|
|
|
exit 0
|
|
|