#!/bin/bash # BuildSBO script # by Chess Griffin # # The BuildSBO script is intended to be used with the Slackbuilds.org # repository of Slackware build scripts. Suggested usage is to # first mirror the Slackbuilds.org repository with rsync or ftp and # then run the BuildSBO script in the top level directory of the local # Slackbuilds.org mirror. Simply calling the script with a slackbuild # name will do three things: download the source code, check the # md5sum, and then run the slackbuild script for that package. The # BuildSBO script must be run as root since it runs the Slackbuild # script and builds the package in /tmp. Once the package is built, # the user will need to install the package as root with installpkg. # # One can also use a -r switch to rsync with the slackbuilds.org # repository. # # Example 1: ./buildsbo -r foo # # This will first rsync with slackbuilds.org and then fetch and build # the foo package. Be sure to do this in a separate directory such as # /home/user/sbo. # # Example 2: ./buildsbo foo # # This will fetch and build the foo package. # # # Changelog: # v0.1 2006-06-22 Initial release # Version number VER=0.1 # Usage function usage { echo "BuildSBO v"$VER" Usage: $0 [options] packagename Options are: -r, --rsync Rsync with the Slackbuilds.org respository -h, --help Display this help message " } while [ "$1" != "" ]; do case $1 in -r|--rsync ) RSY=1 PKG=$2 ;; -h|--help ) usage exit ;; * ) PKG=$1 ;; esac shift done # Error check if [ -z "$RSY" -a -z "$PKG" ]; then echo "No options or package names given. Run $0 -h for usage. Exiting." exit fi # Do rsync if -r switch is used if [ -n "$RSY" ]; then echo "Rsyncing with Slackbuilds.org repository into current directory." /usr/bin/rsync -avz slackbuilds.org::slackbuilds . fi if [ -n "$RSY" -a -z "$PKG" ]; then echo "Done." exit fi # Search for package name if [ ! `find -name "$PKG"` ]; then echo "Packagename not found. Exiting." exit fi # Variables PKGPATH=`find -name $PKG` PKGNAME=`echo $PKG | sed 's/.*\///'` DNLD=`grep DOWNLOAD $PKGPATH/$PKG.info | sed -e s/DOWNLOAD=//` SRCNAME=`echo $DNLD | sed 's/.*\///'` MD5=`grep MD5SUM $PKGPATH/$PKG.info | sed -e s/MD5SUM=//` CWD=$(pwd) # Start fetching and building cd $PKGPATH if [ ! -e "$SRCNAME" ]; then echo "Downloading source code for "$SRCNAME"..." wget $DNLD || exit 1 fi echo "Checking MD5SUM for "$SRCNAME"..." MD5CHK=`md5sum $SRCNAME | sed -e 's/ .*$//'` if [ "$MD5CHK" == $MD5 ]; then echo "OK" else echo "MD5SUM check failed. Exiting." exit fi echo "Building Slackware package for "$SRCNAME"..." sh $PKG.SlackBuild cd $CWD echo "Done." exit