Update.
[midnight-commander.git] / maint / mcsnap
blobbd41ddbfefeeef65462789cfbe01bb668bb01dbf
1 #! /bin/sh
3 # This script takes the compiled tarball, makes an RPM package and
4 # a patch against the latest released version, then uploads
5 # everything over ssh and removes old snapshots.
6 # Run this script in the directory where mc was built.
8 # TODO:
9 # upload to .in* files, then rename.
10 # build tarball, select level of testing
11 # (dist, distcheck, warning checks)
14 set -e
16 # Version to make patches against.
17 # Make sure to have it unpacked in /usr/src
18 BASE_VERSION="4.6.0-pre1"
20 # Location of the snapshot directory
21 SITE="login.ibiblio.org"
22 DIR="/public/ftp/pub/Linux/utils/file/managers/mc/snapshots"
24 MCVERSION=`ls mc*.tar.gz | sort | sed -n '$s/\.tar\.gz//p'`
25 MCNAME=mc-`date "+%Y-%m-%d-%H" --utc`.tar.gz
26 MCTARBALL="$MCVERSION.tar.gz"
28 if test -z "$MCVERSION" || test ! -f "$MCTARBALL"; then
29 echo "No tarball found!!!"
30 exit 1
33 rpm -tb "$MCTARBALL"
34 MC_RPM=`echo /usr/src/redhat/RPMS/i386/mc-*.i386.rpm`
35 if test ! -f $MC_RPM; then
36 echo "Failed to compile package!!!"
37 exit 1
40 # Make a patch against the latest released version
41 MC_PATCH="mc-$BASE_VERSION-current.diff.bz2"
42 if test ! -d /usr/src/mc-$BASE_VERSION; then
43 echo "Cannot find unpacked base version!!!"
44 exit 1
46 rm -f mc-$BASE_VERSION-current.diff mc-$BASE_VERSION-current.diff.bz2
48 # Don't bother to merge PO-files, we are skipping them in the patch
49 make distdir MSGMERGE=
51 # Sometimes GNU diff returns 1 for unclear reasons
52 diff -urN -x po /usr/src/mc-$BASE_VERSION mc-*/ >mc-$BASE_VERSION-current.diff || :
53 bzip2 mc-$BASE_VERSION-current.diff
55 echo "Copying $MCTARBALL to $SITE"
56 scp "$MCTARBALL" "$SITE:$DIR/$MCNAME"
58 # Remove old tarballs
59 MCFILES=`ssh $SITE ls $DIR | egrep '^mc.*\.tar\.gz' | sort | sed '$d'`
60 for i in $MCFILES; do
61 echo "Removing $i"
62 ssh $SITE rm -f "$DIR/$i"
63 done
65 echo "Copying $MC_RPM to $SITE"
66 scp "$MC_RPM" "$SITE:$DIR/"
68 # Remove old RPM packages
69 MCFILES=`ssh $SITE ls $DIR | egrep '^mc.*\.rpm' | sort | sed '$d'`
70 for i in $MCFILES; do
71 echo "Removing $i"
72 ssh $SITE rm -f "$DIR/$i"
73 done
75 echo "Copying $MC_PATCH to $SITE"
76 scp "$MC_PATCH" "$SITE:$DIR/"
78 # Remove old patches
79 MCFILES=`ssh $SITE ls $DIR | egrep '^mc.*\.diff\.bz2' | sort | sed '$d'`
80 for i in $MCFILES; do
81 echo "Removing $i"
82 ssh $SITE rm -f "$DIR/$i"
83 done
86 echo "Done"