qse/ase/rel/rel.sh

104 lines
1.8 KiB
Bash
Raw Normal View History

2007-02-03 11:54:02 +00:00
#!/bin/sh
finalize ()
{
2007-02-04 13:01:26 +00:00
cur="$1"; dir="$2";
2007-02-03 11:54:02 +00:00
if [ "$dir" = "" ]
then
2007-02-04 13:01:26 +00:00
cd "$BASE"
2007-02-03 11:54:02 +00:00
else
2007-02-04 13:01:26 +00:00
cd "$BASE/$dir"
2007-02-03 11:54:02 +00:00
fi
for i in *
do
if [ "$i" = "*" ]; then continue; fi
if [ "$i" = "CVS" ]; then continue; fi
2007-02-04 12:37:46 +00:00
if [ "$i" = "stx" ]; then continue; fi
2007-02-04 13:30:35 +00:00
if [ "$i" = "web.out" ]; then continue; fi
2007-02-03 11:54:02 +00:00
if [ "$cur" = "" ]
then
file="$i"
2007-02-04 13:01:26 +00:00
full="$BASE/$i"
2007-02-03 11:54:02 +00:00
else
file="$cur/$i"
2007-02-04 13:01:26 +00:00
full="$BASE/$cur/$i"
2007-02-03 11:54:02 +00:00
fi
if [ -d "$full" ]
then
if [ "$dir" = "" ]
then
new="$i"
else
new="$dir/$i"
fi
2007-02-04 13:01:26 +00:00
finalize "$file" "$new"
cur="$1"; dir="$2";
2007-02-03 11:54:02 +00:00
elif [ -f "$full" ]
then
2007-02-04 13:30:35 +00:00
target="$SOURCE_ROOT/ase"
2007-02-03 11:54:02 +00:00
mkdir -p "$target/$cur"
2007-02-04 13:30:35 +00:00
case "$i" in
2007-02-03 11:54:02 +00:00
*.h|*.c|*.cc|*.cpp|*.java|*.awk|*.in)
2007-02-04 13:07:15 +00:00
"$AWK" -f "$BASE/rel/lic.awk" -a "$target/$file" "$full"
;;
*.man)
2007-02-04 13:30:35 +00:00
html=`echo $i | sed 's/.man$/.html/'`
"$AWK" -f "$BASE/rel/doc.awk" "$full" > "$SOURCE_ROOT/html/$html"
"$AWK" -f "$BASE/rel/doc.awk" "$full" > "$DEPLOY_ROOT/$html"
2007-02-04 13:07:15 +00:00
cp -f "$full" "$target/$file"
;;
*.css)
cp -f "$full" "$target/$file"
2007-02-04 13:30:35 +00:00
cp -f "$full" "$SOURCE_ROOT/html/$i"
cp -f "$full" "$DEPLOY_ROOT/$i"
2007-02-03 11:54:02 +00:00
;;
*)
cp -f "$full" "$target/$file"
;;
esac
fi
done
}
2007-02-04 12:37:46 +00:00
2007-02-04 13:33:56 +00:00
############################
# BEGINNING OF THE PROGRAM #
############################
2007-02-04 13:07:15 +00:00
2007-02-04 13:33:56 +00:00
AWK="$HOME/awk"
2007-02-04 12:41:21 +00:00
2007-02-04 13:33:56 +00:00
CURDIR=`pwd`
2007-02-03 11:54:02 +00:00
cd ".."
2007-02-04 13:01:26 +00:00
BASE=`pwd`
2007-02-04 13:33:56 +00:00
if [ ! -f "$BASE/CVS/Tag" ]
then
echo "Error: $BASE/CVS/Tag not found"
exit 1;
fi
VERSION=`cat "$BASE/CVS/Tag" | cut -c6- | tr '[A-Z]' '[a-z]' | sed 's/_/./g`
2007-02-04 13:30:35 +00:00
DEPLOY_ROOT="$BASE/web.out"
SOURCE_ROOT="$DEPLOY_ROOT/ase-$VERSION"
rm -rf "$DEPLOY_ROOT"
mkdir -p "$DEPLOY_ROOT"
mkdir -p "$SOURCE_ROOT"
mkdir -p "$SOURCE_ROOT/html"
2007-02-04 13:00:37 +00:00
2007-02-04 13:01:26 +00:00
finalize "" ""
2007-02-04 13:00:37 +00:00
2007-02-04 13:30:35 +00:00
cd "$DEPLOY_ROOT"
tar -cvf "ase-$VERSION.tar" "ase-$VERSION"
gzip "ase-$VERSION.tar"
rm -rf "ase-$VERSION"
2007-02-04 13:33:56 +00:00
cd "$CURDIR"
2007-02-03 11:54:02 +00:00
exit 0