#!/bin/bash # # ctan_upload PACKAGENAME # # does package the subdirectories $CTANDIR and # $TDSDIR in a PACKAGENAME.zip file containing # the files in $CTANDIR and a PACKAGENAME.tds.zip # created with the files in $TDSDIR # (C) 2009 Josef Kleber License: LPPL # See http://latex.josef-kleber.de/ # for more information # VERSION="v1.2 (2009/11/03)" TDSDIR="TDS" CTANDIR="CTAN" ODIR=$(pwd) if [ -z "$1" -o "$1" == "-h" -o "$1" == "-help" -o "$1" == "--help" -o "$1" == "-?" ] then echo "Usage: ctan_upload PACKAGENAME" exit 1 fi typeset -i STEP=0 echo -e "\n\nctan_upload $1\n\n" ((STEP++)) echo -e "$STEP) Setting file (644) and directory (755) permissions\n" if [ -d $TDSDIR ] then find ./$TDSDIR -type d -exec chmod 755 '{}' \; find ./$TDSDIR -type f -exec chmod 644 '{}' \; fi if [ -d $CTANDIR ] then find ./$CTANDIR -type d -exec chmod 755 '{}' \; find ./$CTANDIR -type f -exec chmod 644 '{}' \; fi if [ -d $TDSDIR ] then ((STEP++)) echo -e "$STEP) Create $1.tds.zip\n" cd $ODIR/$TDSDIR zip -r -9 --quiet $1.tds.zip * chmod 644 $1.tds.zip ((STEP++)) echo -e "$STEP) Check integrity of $1.tds.zip\n" zip -T $1.tds.zip else echo -e "\n./$TDSDIR does not exist. $1.tds.zip not created!\n\n" fi cd $ODIR if [ -d $CTANDIR ] then if [ -d $TDSDIR ] then ((STEP++)) echo -e "\n$STEP) Move $1.tds.zip to ./$CTANDIR\n" cd $ODIR/$TDSDIR mv $1.tds.zip $ODIR/$CTANDIR fi ((STEP++)) echo -e "$STEP) Create $1.zip\n" cd $ODIR/$CTANDIR zip -r -9 --quiet $1.zip * chmod 644 $1.zip ((STEP++)) echo -e "$STEP) Check integrity of $1.zip\n" zip -T $1.zip ((STEP++)) echo -e "\n$STEP) Move $1.zip to $ODIR\n" mv $1.zip $ODIR else echo -e "\n./$CTANDIR does not exist. No files to zip!\n\n" fi exit 0