* Add nice packing script I've been using.

svn path=/trunk/kdenonbeta/kdecvs-build/; revision=320179
wilder
Michael Pyne 22 years ago
parent 3e49efcfb1
commit ae14084edf
  1. 81
      make-package.sh

@ -0,0 +1,81 @@
#!/bin/bash
if [ $EUID -ne 0 ]; then
echo "You must run this script as root!"
exit 1
fi
if [ $# -ne 1 ]; then
echo "You must pass the program version on the command line!"
exit 1
fi
# Check that I didn't forget to alter the version in the script.
if [ "x`./kdecvs-build -v | grep $1`" == "x" ]; then
echo "kdecvs-build reports the wrong version, you must fix that first!"
exit 1
fi
VERSION="$1"
# User to run this script on behalf of
MY_USER="mpyne"
# Sed substitutions
REMOVE_MARKER='/REMOVE_FOR_INDEX/d'
VERSION_SUBST="s/\\\$VERSION/$VERSION/g"
# Other fun variables
WEB_PAGE_DIR="/var/www/localhost/htdocs/kdecvs-build"
FILE_LIST="HISTORY TODO AUTHORS COPYING doc.html \
kdecvs-build kdecvs-buildrc-sample"
FILE_NAME="kdecvs-build-$VERSION.tar.gz"
if [ -e $FILE_NAME ]; then
echo "$FILE_NAME already exists!!"
echo "This script won't overwrite it, remove it yourself!"
exit 2
fi
cp doc.html.in doc.html # Use this for now to approximate size
# Try to determine the size
TEMPNAME=`tempfile`
tar czf $TEMPNAME $FILE_LIST || { echo "Failed to create $TEMPNAME!"; exit 2; }
SIZE=$(du -h $TEMPNAME | cut -f 1);
SIZE_SUBST="s/\\\$SIZE/$SIZE/g" # Define sed substitution
rm -f $TEMPNAME
echo "Archive size around $SIZE"
# Now remove the old doc.html
rm doc.html
# First tag the CVS repository with the version name.
CVS_VERSION=$(echo VERSION.$VERSION | sed 's/\./_/g');
su $MY_USER -c "cvs tag $CVS_VERSION > /dev/null"
echo "CVS repository tagged"
# Generate doc.html now
su $MY_USER -c "sed '$VERSION_SUBST;$SIZE_SUBST' doc.html.in > doc.html"
echo "doc.html generated"
# Create tar file with the given packages.
su $MY_USER -c "mkdir kdecvs-build-$VERSION"
su $MY_USER -c "cp $FILE_LIST kdecvs-build-$VERSION"
su $MY_USER -c "tar czf $FILE_NAME kdecvs-build-$VERSION"
rm -r "kdecvs-build-$VERSION/"
echo "Archive $FILE_NAME created"
# Now copy the archive to the webpage dir, and the doc.html as the index.
install -m 0644 -g apache -o apache $FILE_NAME $WEB_PAGE_DIR
echo "Archive copied to web page"
# Now remove some of the comment markers from doc.html
sed "$REMOVE_MARKER" doc.html > "$WEB_PAGE_DIR/index.html"
rm doc.html
chown apache:apache "$WEB_PAGE_DIR/index.html"
echo "Home page index updated"
# Install the script for this computer.
install -m 0755 -g root -o root kdecvs-build /usr/bin
Loading…
Cancel
Save