LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File debexport of Package xchroot (Project home:estellnb:elstel)

#!/bin/bash

msg() { echo -e "\e[1;34m$@\e[0m" >&2; }
err() { echo -e "\e[1;31m$@\e[0m" >&2; }

: ${DEBROOT:=/dst/debchroot}
NAME=xchroot
SOURCES="xchroot.8 xchroot-v2.3.3 xchroot-doc-2013-10-28.tar.gz";

{
if [ -z "$1" ]; then msg "$(basename $0)\e[0m destdirname ... ships to ${DEBROOT}/usr/src/destdirname\n"; exit 1; fi

destdir="${DEBROOT}/usr/src/$1"
# if [ -d "$destdir" ]; then err "destination dir '$1' already exists; choose another one for creation.\n"; exit 2; fi
[ -d "$destdir" ] && rm -r $destdir;
mkdir -p $destdir

entireVersion=$(sed -n 's#[Vv]ersion:\s*\(\S*\)\s*$#\1#p' <${NAME}.dsc)
version=$(sed -n 's#[Vv]ersion:\s*\(\S*\)\s*$#\1#p' <${NAME}.spec)
if [ "${entireVersion#$version}" = "${entireVersion}" ]; then err "$version is not a praefix of $entireVersion! stop."; exit 3; fi

newsources=$destdir/$NAME-$version
srctgzbase=${NAME}_${version}.orig.tar.gz
mkdir $newsources || { err "could not create directory $newsources"; exit 4; }
for i in $SOURCES; do cp $i $newsources/; done
pushd $destdir >&9 && {
 tar -cz $NAME-$version >$srctgzbase

 mv $NAME-$version SOURCES

 #mkdir BUILD
 cp -a SOURCES BUILD
 mkdir -p BUILD/debian/source
 echo "1.0" >BUILD/debian/source/format

popd >&9
}

srctgz="$destdir/$srctgzbase"

#cp ${NAME}.dsc $destdir/${NAME}_$entireVersion.dsc

sed '/^Files:\s*$/,$d' <${NAME}.dsc >$destdir/${NAME}_$entireVersion.dsc 

# not what we want:
#sed '/^Files:\s*$/,$d' <${NAME}.dsc | {
#  cat; echo "Files: "; echo " $(md5sum $srctgz| cut -f 1 -d " ") $(ls -l $srctgz| cut -f 5 -d " ") $srctgzbase";
#} >$destdir/${NAME}_$entireVersion.dsc 

for i in debian.*; do t=${i#debian.}; cp $i $destdir/BUILD/debian/$t; done
chmod +x $destdir/BUILD/debian/rules
# sed -i 's#^INST_DIR := $(CURDIR)/debian/tmp#INST_DIR := $(CURDIR)/debian/xchroot#' $destdir/BUILD/debian/rules

cat >$destdir/run <<EOQ
#!/bin/bash
pushd BUILD
dpkg-buildpackage -sa -kestellnb@elstel.org
popd
echo ------------------------------------
dpkg-deb -c ${NAME}_${entireVersion}_all.deb
EOQ
chmod +x $destdir/run







} 9>/dev/null