From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 13:46:59 +0900 Subject: Initial commit --- support/dktools/sl6-build-rpm.sh | 76 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100755 support/dktools/sl6-build-rpm.sh (limited to 'support/dktools/sl6-build-rpm.sh') diff --git a/support/dktools/sl6-build-rpm.sh b/support/dktools/sl6-build-rpm.sh new file mode 100755 index 0000000000..36dc0edffd --- /dev/null +++ b/support/dktools/sl6-build-rpm.sh @@ -0,0 +1,76 @@ +#! /bin/sh + +VERSION=`cat version.txt` + +# Check whether this script is run as unprivileged user +if [ "X$LOGNAME" = "Xroot" ] +then + echo 'ERROR: This script must not be run as root!' + exit 1 +fi + +# Check whether HOME environment variable is set +if [ "X$HOME" = "X" ] +then + echo 'ERROR: Environment variable HOME not set!' + exit 1 +fi + +# Check whether the version number was obtained +if [ "X$VERSION" = "X" ] +then + echo 'ERROR: Failed to find version number!' + echo 'Make sure to call this script in the correct directory!' + exit 1 +fi + +# Create HOME/rpmbuild directory if not yet present +if [ ! -d ${HOME}/rpmbuild ] +then + mkdir -p ${HOME}/rpmbuild + chmod 755 ${HOME}/rpmbuild +fi + +# Create subdirectories of HOME/rpmbuild if not yet present +for i in BUILD BUILDROOT RPMS SOURCES SPECS SRPMS +do + if [ ! -d ${HOME}/rpmbuild/${i} ] + then + mkdir -p ${HOME}/rpmbuild/${i} + chmod 755 ${HOME}/rpmbuild/${i} + fi +done + +# Copy source tarball to HOME/rpmbuild/SOURCES +if [ -f ../dktools-${VERSION}.tar.gz ] +then + cp ../dktools-${VERSION}.tar.gz ${HOME}/rpmbuild/SOURCES +else + echo 'ERROR: File' ../dktools-${VERSION}.ta.gz 'not found!' + exit 1 +fi + +# Copy *.spec file to HOME/rpmbuild/SPECS +if [ -f dktools-el6.spec ] +then + cp dktools-el6.spec ${HOME}/rpmbuild/SPECS/dktools-el6.spec + chmod 644 ${HOME}/rpmbuild/SPECS/dktools-el6.spec +else + echo 'ERROR: File dktools-el6.spec not found!' + exit 1 +fi + +# Build RPM file +cd ${HOME}/rpmbuild/SPECS +rpmbuild -ba dktools-el6.spec 2>&1 | tee errors + +# Some final notes +echo '' +ls ${HOME}/rpmbuild/RPMS/*/dktools-*${VERSION}*.rpm +echo '' +echo 'If the previous command succeeded, you find your *.rpm files' +echo "in a subdirectory of the the ${HOME}/rpmbuild/RPMS directory." +echo 'If the rpmbuild command showed errors, make sure to run the' +echo 'sl6-prepare.sh script as root before running this one.' +echo '' + -- cgit v1.2.3