update-git+cogito.sh 1.51 KB
Newer Older
Nico Schottelius's avatar
Nico Schottelius committed
1 2 3
#!/bin/sh
# Nico Schottelius
# Date: Mit Nov  9 12:57:04 CET 2005
4
# Last Modified: Thu Nov 10 12:53:00 CET 2005
Nico Schottelius's avatar
Nico Schottelius committed
5 6 7 8
# 
# Install latest git and cogito to $INSTALL_PREFIX/$name and
# link the binaries to $BINDIR
# Needs git and cogito to work!
9 10 11 12 13
# And:
# - libexpat-dev
# - libcurl3-dev
# - libssl-dev
# - libz-dev
Nico Schottelius's avatar
Nico Schottelius committed
14 15 16

BASE_GET=http://www.kernel.org/pub/scm/
PROJECTS="git/git.git cogito/cogito.git"
17
BUILDDIR=/home/user/nico/build
Nico Schottelius's avatar
Nico Schottelius committed
18 19 20
INSTALL_PREFIX=/usr/packages
BINDIR=/usr/local/bin

21 22 23 24 25 26 27
error_in()
{
   echo "[failed] $1"
   echo "Exiting now."
   exit 1
}

Nico Schottelius's avatar
Nico Schottelius committed
28 29 30 31 32 33 34 35 36 37
for project in $PROJECTS; do
   realname=$(echo $project | sed -e 's,.*/,,' -e 's/\.git$//')

   echo "Working on $realname (in $BUILDDIR/$realname) ... "

   if [ ! -d "$BUILDDIR/$realname" ]; then
      echo "Cloning $realname"
      cg-clone "${BASE_GET}${project}" "$BUILDDIR/$realname"
   else
      echo "Updating $realname from \"origin\""
38
      cd "$BUILDDIR/$realname" || error_in "$BUILDDIR/$realname"
Nico Schottelius's avatar
Nico Schottelius committed
39 40 41
      cg-update origin
   fi

42
   if [ $? -ne 0 ]; then
Nico Schottelius's avatar
Nico Schottelius committed
43
      echo "Pull or clone failed, ABORTING."
44 45 46
      exit 23
   fi

Nico Schottelius's avatar
Nico Schottelius committed
47 48 49 50
   cd "$BUILDDIR/$realname"
   version=$(cg-object-id)
   echo "Installing $realname (Version: $version)"
   DDIR=$INSTALL_PREFIX/$realname-$version
51 52 53
   make clean || error_in "Cleaning $realname"
   make "prefix=$DDIR" all || error_in "Building $realname"
   make "prefix=$DDIR" install || error_in "Installing $realname"
Nico Schottelius's avatar
Nico Schottelius committed
54 55 56

   echo "Linking files to $BINDIR ..."
   for file in "$DDIR/bin/"*; do
57
      ln -sf $file "$BINDIR" || error_in "Linking $file"
Nico Schottelius's avatar
Nico Schottelius committed
58 59
   done
done