Added cleaning up and exiting on error

This commit is contained in:
Nico Schottelius 2005-11-10 12:55:32 +01:00
parent 776d37c241
commit a1ad5cd344

View file

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# Nico Schottelius # Nico Schottelius
# Date: Mit Nov 9 12:57:04 CET 2005 # Date: Mit Nov 9 12:57:04 CET 2005
# Last Modified: - # Last Modified: Thu Nov 10 12:53:00 CET 2005
# #
# Install latest git and cogito to $INSTALL_PREFIX/$name and # Install latest git and cogito to $INSTALL_PREFIX/$name and
# link the binaries to $BINDIR # link the binaries to $BINDIR
@ -13,6 +13,13 @@ BUILDDIR=/home/nico/build
INSTALL_PREFIX=/usr/packages INSTALL_PREFIX=/usr/packages
BINDIR=/usr/local/bin BINDIR=/usr/local/bin
error_in()
{
echo "[failed] $1"
echo "Exiting now."
exit 1
}
for project in $PROJECTS; do for project in $PROJECTS; do
realname=$(echo $project | sed -e 's,.*/,,' -e 's/\.git$//') realname=$(echo $project | sed -e 's,.*/,,' -e 's/\.git$//')
@ -23,7 +30,7 @@ for project in $PROJECTS; do
cg-clone "${BASE_GET}${project}" "$BUILDDIR/$realname" cg-clone "${BASE_GET}${project}" "$BUILDDIR/$realname"
else else
echo "Updating $realname from \"origin\"" echo "Updating $realname from \"origin\""
cd "$BUILDDIR/$realname" || exit 1 cd "$BUILDDIR/$realname" || error_in "$BUILDDIR/$realname"
cg-update origin cg-update origin
fi fi
@ -31,11 +38,12 @@ for project in $PROJECTS; do
version=$(cg-object-id) version=$(cg-object-id)
echo "Installing $realname (Version: $version)" echo "Installing $realname (Version: $version)"
DDIR=$INSTALL_PREFIX/$realname-$version DDIR=$INSTALL_PREFIX/$realname-$version
make "prefix=$DDIR" all make clean || error_in "Cleaning $realname"
make "prefix=$DDIR" install make "prefix=$DDIR" all || error_in "Building $realname"
make "prefix=$DDIR" install || error_in "Installing $realname"
echo "Linking files to $BINDIR ..." echo "Linking files to $BINDIR ..."
for file in "$DDIR/bin/"*; do for file in "$DDIR/bin/"*; do
ln -sf $file "$BINDIR" ln -sf $file "$BINDIR" || error_in "Linking $file"
done done
done done