|
| 1 | +#!/bin/sh |
| 2 | +# Redistribute the files in the distribution to the linux file system |
| 3 | +CSV="$1" |
| 4 | +VERSION="$2" |
| 5 | +ARCH="$3" |
| 6 | +if test -z "${VERSION}"; then |
| 7 | + echo "Usage: mkdeb file.csv VERSION [ARCH]" |
| 8 | + exit 1 |
| 9 | +fi |
| 10 | +PACKAGE=`echo "${CSV}"|sed -e 's/^.*\///1' -e 's/\.csv//1'|tr '[:upper:]' '[:lower:]'` |
| 11 | +PACKAGEBASE=`echo "${CSV}"|sed -e 's/\.csv//1'` |
| 12 | +rm -Rf debian |
| 13 | +mkdir -p debian/DEBIAN |
| 14 | +#cat "${CSV}" | sed -e 's/\",\"/\" \"debian\//g' -e 's/"//g' -e 's/^/..\//1' -e 's/[^[:blank:]]* //1' | sort -u | xargs -l1 mkdir -p |
| 15 | +#cat "${CSV}" | sed -e 's/\",\"/\" \"debian\//g' -e 's/^/..\//1' | xargs -l1 cp || exit 1 |
| 16 | +cat "${CSV}" | sed -e 's/\",\"/\" \"debian\//g' -e 's/"//g' -e 's/[^[:blank:]]* //1' | sort -u | xargs -l1 mkdir -p |
| 17 | +cat "${CSV}" | sed -e 's/\",\"/\" \"debian\//g' | xargs -l1 cp || exit 1 |
| 18 | + |
| 19 | +# All files in the distribution should be readable by everyone |
| 20 | +chmod -R a+r debian |
| 21 | + |
| 22 | +# |
| 23 | +## Discover information for this distribution |
| 24 | +# |
| 25 | +distname="${PACKAGE}" |
| 26 | +version="${VERSION}" |
| 27 | +if test -z "${ARCH}"; then |
| 28 | + ARCH=$(uname -m | sed -e s/i686/i386/ -e s/x86_/amd/) |
| 29 | + echo "Architecture ${ARCH} detected." |
| 30 | +fi |
| 31 | +packagename=$(echo "$distname" | sed -e "s/_/-/g") |
| 32 | +#packageversion="$version"-$(date +%Y%m%d) |
| 33 | +packageversion="$version" |
| 34 | +deb_depends="Depends: "`cat "${PACKAGEBASE}.dep"|sed -e "s/(VERSION)/(=${VERSION})/g"` |
| 35 | +deb_provides="Provides: ${PACKAGE}" |
| 36 | +inst_size=`du debian|tail -1|sed -e 's/\([0-9]*\).*/\1/1'` |
| 37 | + |
| 38 | +cat <<EndOfControl | sed -e '/^[[:alnum:]]*:[[:blank:]]*$/ d'> debian/DEBIAN/control |
| 39 | +Package: $packagename |
| 40 | +Version: $packageversion |
| 41 | +Priority: optional |
| 42 | +Architecture: $ARCH |
| 43 | +$deb_depends |
| 44 | +$deb_provides |
| 45 | +Installed-Size: $inst_size |
| 46 | +EndOfControl |
| 47 | +cat "${PACKAGEBASE}.control" >> debian/DEBIAN/control |
| 48 | + |
| 49 | +test -e "${PACKAGEBASE}.conffiles" && cat "${PACKAGEBASE}.conffiles" > debian/DEBIAN/conffiles |
| 50 | + |
| 51 | +fakeroot=/usr/bin/fakeroot |
| 52 | +test -x $fakeroot || fakeroot="" |
| 53 | +$fakeroot dpkg-deb --build debian |
| 54 | +mv debian.deb "$packagename"_"$packageversion"_"${ARCH}".deb |
| 55 | +rm -Rf debian |
| 56 | + |
| 57 | +# Local Variables: |
| 58 | +# mode: shell-script |
| 59 | +# End: |
0 commit comments