#!/bin/sh dodiff=false havebase=false branch="stable" while test "x$1" != x; do case $1 in --package) shift package=$1 if test ! -e "$package"; then echo "$package does not exist" exit 1 fi ;; --base) shift; base=$1 havebase=true ;; --old) shift; old=$1 dodiff=true ;; --help) echo "Usage is: install-module [--unstable|--stable] [--package package-name] [--old previous-package]" exit 0 ;; --stable) branch="stable" ;; --unstable) branch="unstable" ;; *) echo "Unknown option: $1" exit 1 ;; esac shift done while test "x$package" = x; do echo -n "Enter package name to install: " read package if test ! -e "$package"; then package="" echo "File $package does not exist" fi done package_basename=`basename $package` package_base=`basename $package | sed 's/-[0-9].*//'` if $havebase ; then package_base="$base" fi echo Package base is: $package_base if test ! -d ~ftp/pub/GNOME/${branch}/sources/$package_base; then echo "Package base does not exist on the FTP site ($package_base)" exit 1 fi destdir=~ftp/pub/GNOME/${branch}/sources/$package_base if test -e $destdir/$package_basename; then echo "Package $package_basename already exists in $destdir" exit 1; fi if $dodiff; then if test ! -e $destdir/$old; then echo "Old package $old does not exist in $destdir" exit 1 fi fi cp $package $destdir/$package_basename uncom_name=`basename $package_basename .gz` echo bzipping the tarball zcat $package | bzip2 > $destdir/$uncom_name.bz2 vers=`basename $package_basename .tar.gz | sed "s/$package_base-//"` (cd $destdir; rm LATEST-IS-*; ln -s $package LATEST-IS-$vers) cd ~ftp/pub/GNOME/${branch}/latest/sources if test "x$old" != x; then rm $old fi ln -sf ../../sources/$package_base/$package_basename . if $dodiff; then diffdir=/tmp/diff$$ mkdir $diffdir trap "rm -rf $diffdir" 0 cd $diffdir mkdir old mkdir new echo Unpacking old package (cd old; tar xzvf $destdir/$old >& /dev/null) echo Unpacking new package (cd new; tar xzvf $destdir/$package_basename >& /dev/null) echo Diffing packages diff -ruN old/* new/* > diff gzip diff name_a=`basename $old .tar.gz | sed "s/$package_base-//"` name_b=`basename $package_basename .tar.gz | sed "s/$package_base-//"` mv diff.gz $destdir/$package_base-$name_a-$name_b.diff.gz fi