LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File update.sh of Package man-pages (Project openSUSE:Factory)

#
# USAGE: bash update.sh VERSION
#

function usage()
{
  echo "USAGE: bash update.sh VERSION"
}

function acquire_changes()
{
  CHANGES_FILE="$1"
  LINENUM=`grep -n "New and rewritten pages" $CHANGES_FILE | sed "s/:.*//"`
  LINESUM=`wc -l $CHANGES_FILE | sed "s:[ ].*::"`
  LINETAIL=$((LINESUM-LINENUM+1))
  tail -n $LINETAIL $CHANGES_FILE | egrep -v "^$" | grep -v "\----" | grep -v "^    [A-Z]" | sed "s:\(^[_a-zA-Z].*\.[0-9]\):      \1:" | sed "s:^\([A-Z].*\):  * \1:" > changes
}

VERSION="$1"
if [ -z $VERSION ]; then
  usage
  exit 1
fi

PACKNAME="man-pages"
UTARBALL="$PACKNAME-$VERSION.tar.gz"
OTARBALL="$PACKNAME-$VERSION.tar.bz2"
URL="http://www.kernel.org/pub/linux/docs/man-pages/$UTARBALL"

# get tarball
wget $URL
if [ $? -ne 0 ]; then
  echo $URL not found.
  exit 1
fi
tar xvzf $UTARBALL
rm -f $PACKNAME*.tar.{bz2,gz}
tar cvjf $OTARBALL $PACKNAME-$VERSION
# write down changes
acquire_changes "$PACKNAME-$VERSION/Changes"
{
  LANG=en_US date_output=`date`
  echo "-------------------------------------------------------------------"
  echo "$date_output - pgajdos@suse.cz"
  echo ""
  echo "- update to version $VERSION"
  cat changes
  echo ""
} > man-pages.changes.new
cat man-pages.changes >> man-pages.changes.new
rm man-pages.changes
mv man-pages.changes.new man-pages.changes
rm changes
# modify spec
sed -i "s/\(Version:[ \t]*\)[0-9].*/\1$VERSION/" $PACKNAME.spec
rm -r man-pages-$VERSION