ViitorMake/Scripts/makepackage
kueller d0126e908f V961 Tree Umbau
git-svn-id: svn://svn.compuextreme.de/Viitor/V961/ViitorMake@4277 504e572c-2e33-0410-9681-be2bf7408885
2008-05-03 16:58:54 +00:00

212 lines
4.9 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
DEPFILE=`echo $ARCHIVE|sed -e "s/tbz$/dep/"`
METAFILE=`echo $ARCHIVE|sed -e "s/tbz$/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" >>$DEPFILE
done
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
mkdir $TMPROOT/../$$
if [ ! `find . -type f|wc -l` == "0" ]; then
MakeMgtFiles bin
tar -cvf $TMPROOT/../$$/bin.tar .
fi
if [ -d $MANTMPROOT ]; then
cd $MANTMPROOT
MakeMgtFiles man
tar -cvf $TMPROOT/../$$/man.tar .
fi
if [ -d $DEVTMPROOT ]; then
cd $DEVTMPROOT
MakeMgtFiles dev
tar -cvf $TMPROOT/../$$/dev.tar .
fi
cd $TMPROOT/../$$
tar -jcvf $ARCHIVE .
echo "ModuleName: $SHORTNAME" >$METAFILE
echo "Module Version: $MODVERSION" >>$METAFILE
echo "Quellen: $MODSRC" >>$METAFILE
echo "Description:" >>$METAFILE
echo "$DESCRIPT" >>$METAFILE