ViitorMake/Scripts/makepackage
kueller e4ea1f71fc Neue Version V963
git-svn-id: svn://svn.compuextreme.de/Viitor/V963/ViitorMake@5933 504e572c-2e33-0410-9681-be2bf7408885
2011-01-03 10:48:06 +00:00

268 lines
6.0 KiB
Bash
Executable File

#!/bin/bash
#Framework, welches ein komplettes Linux System aus den Sourcen erstellt
#dieses Framework wird im CVS Repository
#:pserver:cvs.tramp-bbs.de:/opt/cvs zur Verfügung gestellt
#
#Lage dieser Datei im Archiv: $HeadURL$
#
#(c) 2003 Harald Kueller, Germany
#This program is free software; you can redistribute it and/or
#modify ist under the terms of the GNU General Public License
#as published by the Free Software Foundation; either version
#2 of the License, or (at your option) any later version.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#See the GNU General Public License for more details.
#
#You should have received a copy of the GNU General Public License
#along with this program; if not write to the Free Software Foundation,
#Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
#Beschreibung:
#Script zur Erzeugung von Viitor Packages
#
#Aufrufparameter:
# -h gibt eine Hilfe aus
#
#Letzte Änderung von: $Author$
#Datum der letzten Änderung: $Date$
#Version der Datei: $Revision$
#
if [ ! -f $HOME/.ViitorMake ]; then
echo "Please run Scripts/initViitorMake"
echo "From ViitorMake Root Direktory"
echo "This will create a File $HOME/.ViitorMake"
echo "with necessary information for running"
echo "ViitorMake Scripts"
exit 10
fi
source $HOME/.ViitorMake
echo_help() {
echo "$0 -s <sourcepath>"
echo " -a <ArchivePath+name>"
echo " -n <ShortName>"
echo " -d <ShortDescription"
echo " -v <Version>"
echo " -q <Source URL>"
exit 1
}
while getopts :s:a::n:d:v:q: opt_char; do
case $opt_char in
s)
TMPROOT=$OPTARG
;;
a)
ARCHIVE=$OPTARG
;;
n)
SHORTNAME=$OPTARG
;;
d)
DESCRIPT=$OPTARG
;;
v)
MODVERSION=$OPTARG
;;
q)
MODSRC=$OPTARG
;;
*)
echo_help
;;
esac
done
if [ ! "$TMPROOT" ]; then
echo "source tree not set"
echo_help
fi
if [ ! "$ARCHIVE" ]; then
echo "Archive Name not set"
echo_help
fi
if [ ! "$SHORTNAME" ]; then
echo "Package Short name not set"
echo_help
fi
if [ ! "$DESCRIPT" ]; then
echo "Package Description not set"
echo_help
fi
if [ ! "$MODVERSION" ]; then
echo "Package Version not set"
echo_help
fi
if [ ! "$MODSRC" ]; then
echo "Package source URL not set"
echo_help
fi
if [ ! -d $TMPROOT/../$$ ]; then
mkdir -p $TMPROOT/../$$
fi
ARCHCONTENTS="bin.drg bin.cont bin.tar dev.drg dev.cont dev.tar man.drg man.cont man.tar"
DEPFILE=$TMPROOT/../$$/dep
METAFILE=$TMPROOT/../$$/meta
WDIR=`pwd`
source $VMAKEDIR/functions/functions
if [ ! "$TMPROOT" ]; then
echo "Syntax: $0 PKGSRCPATH ARCHIVEDESTPATH"
exit 10
fi
if [ ! "$ARCHIVE" ]; then
echo "Syntax: $0 PKGSRCPATH ARCHIVEDESTPATH"
exit 10
fi
if [ -d $TMPROOT/usr/man ]; then
mkdir -p $TMPROOT/usr/share
mv $TMPROOT/usr/man $TMPROOT/usr/share
fi
if [ -d $TMPROOT/usr/info ]; then
mkdir -p $TMPROOT/usr/share
mv $TMPROOT/usr/info $TMPROOT/usr/share
fi
if [ -d $TMPROOT/usr/doc ]; then
mkdir -p $TMPROOT/usr/share
mv $TMPROOT/usr/doc $TMPROOT/usr/share
fi
GenDependics $TMPROOT >/tmp/deps$$
if [ -f /tmp/deps$$ ]; then
for i in `cat /tmp/deps$$`; do
echo "WARN $i"
done |bzip2 -c >$DEPFILE
rm /tmp/deps$$
fi
cd $TMPROOT
MANTMPROOT=$TMPROOT.man
DEVTMPROOT=$TMPROOT.dev
for i in `find . -name "man" -type d`; do
if ls -d $i/man[0-9] 2>&1 >/dev/null; then
DIR=`dirname $i`
mkdir -p $MANTMPROOT/$DIR
mv $i $MANTMPROOT/$DIR
fi
done
for i in `find . -name "info" -type d`; do
if [ -f $i/dir ]; then
DIR=`dirname $i`
mkdir -p $MANTMPROOT/$DIR
mv $i $MANTMPROOT/$DIR
fi
done
for i in `find . -type d -name "doc"`; do
if [ ! -d $MANTMPROOT/usr/share/doc ]; then
mkdir -p $MANTMPROOT/usr/share/doc
fi
cd $i
tar -cf - .|tar -C $MANTMPROOT/usr/share/doc -xf -
cd -
rm -r $i
done
for i in `find . -name "*.[ah]"`; do
DIR=`dirname $i`
mkdir -p $DEVTMPROOT/$DIR
mv $i $DEVTMPROOT/$DIR
done
for i in `find . -name "*.hxx"`; do
DIR=`dirname $i`
mkdir -p $DEVTMPROOT/$DIR
mv $i $DEVTMPROOT/$DIR
done
for i in `find . -name "*.hpp"`; do
DIR=`dirname $i`
mkdir -p $DEVTMPROOT/$DIR
mv $i $DEVTMPROOT/$DIR
done
for i in `find . -name "*.la"`; do
DIR=`dirname $i`
mkdir -p $DEVTMPROOT/$DIR
mv $i $DEVTMPROOT/$DIR
done
cd $TMPROOT
PKGNAME=`basename $ARCHIVE`
MakeMgtFiles bin
tar -jcvf $TMPROOT/../$$/bin.tar .
if [ -d $MANTMPROOT ]; then
cd $MANTMPROOT
MakeMgtFiles man
tar -jcvf $TMPROOT/../$$/man.tar .
fi
if [ -d $DEVTMPROOT ]; then
cd $DEVTMPROOT
MakeMgtFiles dev
tar -jcvf $TMPROOT/../$$/dev.tar .
fi
#InitDispatch
#if [ ! `find . -type f|wc -l` == "0" ]; then
#DispatchCMD "cd $TMPROOT" \
#"MakeMgtFiles bin" \
#"tar -jcvf $TMPROOT/../$$/bin.tar ."
#fi
#if [ -d $MANTMPROOT ]; then
#DispatchCMD "cd $MANTMPROOT" \
#"MakeMgtFiles man" \
#"tar -jcvf $TMPROOT/../$$/man.tar ."
#fi
#if [ -d $DEVTMPROOT ]; then
#DispatchCMD "cd $DEVTMPROOT" \
#"MakeMgtFiles dev" \
#"tar -jcvf $TMPROOT/../$$/dev.tar ."
#fi
#EndDispatch
echo -e "ModuleName: $SHORTNAME\n" \
"Module Version: $MODVERSION\n" \
"Quellen: $MODSRC\n" \
"Description:\n" \
"$DESCRIPT" |\
bzip2 -c >$METAFILE
cd $TMPROOT/../$$
if [ -f $DEPFILE ]; then
LINE="`wc -c $DEPFILE|awk '{print $1}'` "
else
LINE="0 "
fi
if [ -f $METAFILE ]; then
LINE=$LINE"`wc -c $METAFILE|awk '{print $1}'` "
else
LINE=$LINE"0 "
fi
for i in *.cont *.drg; do
bzip2 $i
mv $i.bz2 $i
done
for i in $ARCHCONTENTS; do
if [ -f $i ]; then
LINE=$LINE"`wc -c $i|awk '{print $1}'` "
else
LINE=$LINE"0 "
fi
done
echo $LINE >$ARCHIVE
if [ -f $DEPFILE ]; then
cat $DEPFILE >>$ARCHIVE
fi
if [ -f $METAFILE ]; then
cat $METAFILE >>$ARCHIVE
fi
for i in $ARCHCONTENTS; do
if [ -f $i ]; then
cat $i >>$ARCHIVE
fi
done