Script get_kolab.sh

#!/bin/bash

export DEBIAN=8.0
export TARGETDIR=/mnt/kolab
export RELEASE=Winterfell
export SRCDIR=$TARGETDIR/kolab_${RELEASE}_src
export DEBDIR=$TARGETDIR/kolab_${RELEASE}_deb


compile() {
        echo `date`":"$1 >> ../compile_log/compile.log
        echo -e "\033kbuild-dep $1\033\0134"
        apt-get -y build-dep        -o Dir::Etc::sourcelist="sources.list.d/kolab.list" -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0" $1 2>&1 | tee    ../compile_log/$1.log 2>&1
        echo -e "\033kcompile $1\033\0134"
        apt-get -y --compile source -o Dir::Etc::sourcelist="sources.list.d/kolab.list" -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0" $1 2>&1 | tee -a ../compile_log/$1.log 2>&1
}


mkdir -p $SRCDIR $DEBDIR $TARGETDIR/compile_log

if [ ! "x$1" == "x" ]; then
        rm -Rf $TARGETDIR/compile_log/*
        echo -e "\033kUpdate sources.list\033\0134"
        echo "deb-src http://obs.kolabsys.com:82/Kolab:/$RELEASE/Debian_$DEBIAN/ ./" > /etc/apt/sources.list.d/kolab.list
 echo "deb file:$DEBDIR ./" > /etc/apt/sources.list.d/kolab_local.list

        echo "Package: *" >  /etc/apt/preferences.d/kolab
        echo "Pin: origin obs.kolabsys.com" >>  /etc/apt/preferences.d/kolab
        echo "Pin-Priority: 1001" >>  /etc/apt/preferences.d/kolab
        wget -qO - http://obs.kolabsys.com:82/Kolab:/$RELEASE/Debian_$DEBIAN/Release.key | apt-key add -
 wget http://obs.kolabsys.com:82/Kolab:/$RELEASE/Debian_$DEBIAN/Sources -o /dev/null -O - > $SRCDIR/Sources

        #echo "deb-src http://obs.kolabsys.com:82/Kolab:/$RELEASE:/Updates/Debian_$DEBIAN/ ./" >> /etc/apt/sources.list.d/kolab.list
        #wget -qO - http://obs.kolabsys.com:82/Kolab:/$RELEASE:/Updates/Debian_$DEBIAN/Release.key | apt-key add -
 #wget http://obs.kolabsys.com:82/Kolab:/$RELEASE:/Updates/Debian_$DEBIAN/Sources -o /dev/null -O - >> $SRCDIR/Sources

        echo -e "\033kaptitude update\033\0134"
        apt-get update
 apt-get -y install build-essential autoconf autotools-dev cdbs cmake debhelper python-setuptools coreutils apt-file

 # determine binaries 
 grep "^Binary" $SRCDIR/Sources | cut -c9- | sed 's/,/\n/g'  | grep -v php5-krb | awk '{print $1}' | sort -u > binaries
 # determine build dependencies without binaries from kolab
 apt-get -y install `sed -n '/Build-Depends/,/^[a-zA-Z0-9]/p' $SRCDIR/Sources  | grep -vE "(^Directory|^Package|^Build-Con)" |sed 's/Build-Depends://g' | sed 's/[,|]/\n/g' | sed 's/([^)]*)//g' |sed 's/\[.*//g'| awk '{print $1}' | sort -u | grep -vE "(univention|tcl8.3-dev|libdb5.1-dev|gs-gpl|libsnmp9-dev|libkvm-dev|libkrb5-dev)" | grep -vf binaries`

 grep '^Package:' $SRCDIR/Sources | awk '{print $2}' > $SRCDIR/pakete
fi



cd $SRCDIR

rm -f skip.grep
touch skip.grep
ls -1 $TARGETDIR/compile_log/ | while read datei
do
        basename $datei .log >> skip.grep
done

# First some prerequesites
for package in composer libkolabxml-dev libcalendaring-dev libkolab-dev nodejs node-less
do
 compile $package
 dpkg -i $package*deb
done

ls -1 $TARGETDIR/compile_log/ | while read datei
do
        basename $datei .log >> skip.grep
done

sort -u pakete  | grep -vf skip.grep | while read paket
do
        compile $paket
done

echo -e "\033kCopy DEB files\033\0134"

cp -p *deb $DEBDIR

cd $DEBDIR
echo -e "\033kCreate Packages.gz\033\0134"
dpkg-scanpackages -m .  | gzip -c9 > Packages.gz

Keine Kommentare:

Kommentar veröffentlichen