Files
secondo/CM-Scripts/makepublicsecondo
2026-01-23 17:03:45 +08:00

87 lines
1.9 KiB
Bash

#!/bin/bash
if [ "$1" = "--win" ]; then
createWin=true;
shift
fi
if [ -n "$1" ]; then
REV=" -r $1 "
VERSION=$1
else
REV=" -D now "
VERSION=current
fi
echo "Create public version from revision number " $VERSION
if [ -d secondo ] ; then
echo "directory secondo exists"
exit 1
fi
cvs -q export $REV secondo >/dev/null
if [ $? != "0" ] ; then
echo "problems with cvs export"
exit 1
fi
echo "Secondo successfully read from server"
secondo/CM-Scripts/mkpublic.sh secondo/nonpublic.filelist publicsecondo_filelist >/dev/null
if [ -f "secpub.tar" ] ; then
echo secpub.tar exists
exit 1
fi
echo "create tar file, this can take some time"
cat publicsecondo_filelist | sed "s/.*/tar -rf secondo-$VERSION-LAT1.tar \"&\"/g" | sh
echo "tar file created, do some os specific stuff"
if [ "$SECONDO_PLATFORM" = "win32" ]; then
echo "create windows version"
rm -r secondo
tar -xf secondo-$VERSION-LAT1.tar
rm secondo-$VERSION-LAT1.tar
zip -r secondo-$VERSION-CP1252.zip secondo
rm -rf secondo
elif [ -n "$createWin" ]; then
echo "Create windows archive on linux system"
# remove complete secondo stuff
rm -rf secondo
# unpack public secondo stuff
tar -xf secondo-$VERSION-LAT1.tar
# remove tared secondo stuff
rm secondo-$VERSION-LAT1.tar
echo "public secondo unpacked, recode to windows now"
# recode all text files from source encoding to windows encoding
find secondo -type f -size +1 -exec file --mime-encoding {} \; | grep -v "binary$" | grep -v "unknown-8bit$" | sed "s/\([^:]*\)\(:.\)\(.*\)/recode \3..windows-1252 \1 ; unix2dos -q \1/" >recode.sh
sh recode.sh
# rm -f recode.sh
echo "files recoded, pack them into a zip file"
# pack to zip
zip -q -r secondo-$VERSION-CP1252.zip secondo
# remove public secondo directory
rm -rf secondo
else
echo "create linux version"
gzip secondo-$VERSION-LAT1.tar
rm -r secondo
fi
echo "archive created"