+
+if [ ! -d "$BASE/lyx-patch/" ]; then
+ mkdir "$BASE/lyx-patch/" || exit 1;
+fi
+
+if [ ! -d $BASE/lyx-patch/lyx-$LAST ]; then
+ echo "Can't find directory for last version $LAST.";
+ echo "Will try to download from LyX site....";
+ read;
+ pushd $BASE/lyx-patch/;
+ wget ftp://ftp.lyx.org/pub/lyx/stable/${FIRST}x/lyx-$LAST.tar.gz;
+ tar -zxvf lyx-$LAST.tar.gz;
+ if [ ! -f lyx-$LAST.tar.gz ]; then
+ echo "Still unable to find directory for last version $LAST.";
+ exit 1;
+ fi
+ popd;
+fi
+
+echo -n "Ready to make patch against $LAST...";