#!/bin/bash # $Id$ # # Usage: export-boinc -r 4.72 # or export-boinc -r 4.72 -d 20050724 # or export-boinc -r 4.72 -d 20050724 -s # or export-boinc -r 4.72 -s # or export-boinc -s # or export-boinc set -e GIT_ROOT="http://boinc.berkeley.edu/git/boinc-v2.git" # Define default values which can be overriden by command line options # and get the command line options. # SNAPSHOT=0 DIRS="tarfiles/boinc tarfiles tarballs/boinc tarballs" function showhelp () { cat < This script downloads from the developers' git repository a particular version of the BOINC (Berkeley Open Infrastructure for Network Computing) middleware for volunteer computing. It clones everything or performs a pull on ./boinc-v2 . Options: -r X.Y.Z retrieve particular release # -d YYYYMMDD retrieve version of particular day # no idea how to do this with git ATM -s retrieve snapshot -h print this usage description -t PATH specify directory at which to store tarfile These options can be combined. The retrieval of the very latest version (HEAD) is the default. This script can be executed from any directory. If executed from one that has any of the following as a subdirectory, it will place it in the first suitable one: EOHELP echo " $DIRS" echo echo " This script lives as 'export-boinc' in git+ssh://git.debian.org/git/pkg-boinc/scripts.git ." echo exit 0 } if [ "$1" == "--help" ]; then showhelp exit 0 fi if [ -d boinc-v2 ]; then if [ ! -d boinc-v2/.git ]; then echo "E: found directory 'boinc-v2' which is not a git repository where I meant to export the boinc source tree to. Please clean up." exit 1 fi fi if [ -f boinc-v2 ]; then echo "E: found file 'boinc-v2' where I meant to export the boinc source tree to. Please clean up." exit 1 fi while getopts "r:d:t:sh" FLAG do if [ "$FLAG" = "r" ]; then VERSION=$OPTARG elif [ "$FLAG" = "d" ]; then DATE=$OPTARG elif [ "$FLAG" = "s" ]; then SNAPSHOT=1 elif [ "$FLAG" = "t" ]; then DIRS=$OPTARG elif [ "$FLAG" = "h" ]; then showhelp exit 0 fi done # Parse/validate the given command line options to construct the # appropriate git command to download the upstream source code. # if [ -z "$VERSION" ]; then echo "W: version number was not specified, assuming 'HEAD'" VERSION="HEAD" fi if [ -z "$ORIG_SUFFIX" ]; then #ORIG_SUFFIX=".orig" ORIG_SUFFIX="" fi if [ -z "$DATE" ] && [ "$SNAPSHOT" -eq 0 ]; then DEBIAN_VERSION="$VERSION+dfsg" elif [ -n "$DATE" ] && [ "$SNAPSHOT" -eq 0 ]; then DEBIAN_VERSION="$VERSION+dfsg" ORIG_DIR="boinc-${DEBIAN_VERSION}${ORIG_SUFFIX}" elif [ -n "$DATE" ] && [ "$SNAPSHOT" -eq 1 ]; then DEBIAN_VERSION="$VERSION~snapshot.$DATE+dfsg" elif [ -z "$DATE" ] && [ "$SNAPSHOT" -eq 1 ]; then DATE=$(date +%Y%m%d) DEBIAN_VERSION="$VERSION~snapshot.$DATE+dfsg" fi # A few tests on tools needed for this script missing="" for i in xargs find do if [ ! -x /usr/bin/$i ]; then missing="$missing $i" fi done if [ -n "$missing" ]; then echo "Missing the following tools in /usr/bin: $missing" exit 1 fi if [ -d boinc-v2 ]; then echo "I: Updating BOINC source tree. This takes a bit of time." cd boinc-v2 git pull else echo "I: Cloning BOINC source tree. This takes a while, maybe five minutes." git clone $GIT_ROOT cd boinc-v2 fi # Remove non-free or unneeded sources or cruft from the upstream source # code before creating the tarball. cat > .gitattributes <