-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprimesense-nite2-nonfree-make-deb
executable file
·72 lines (57 loc) · 1.67 KB
/
primesense-nite2-nonfree-make-deb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash -e
set -x
test -n "$1" || (echo "`basename $0` <tarbz2>" ; exit 1)
test -f "$1" || (echo "`basename $0` <tarbz2>" ; exit 1)
ZIPBALL="$1"
TARBALL=`unzip -lqq $ZIPBALL | awk '{print $4}'`
BASE=`unzip -p $ZIPBALL | tar tvj | head -1 | awk '{print $6}'`
ORIG_BASE="openni-modules-primesense-nite2-nonfree.orig"
DEB_BASE="openni-modules-primesense-nite2-nonfree"
TMPDIR="/tmp/primesense-nite2.$$"
CACHEDIR="/var/cache/primesense-nite2-nonfree"
function add_niReg()
{
TAG="#ADDREGISTRATION#"
SRC="debian/postinst"
DEST="`tempfile`"
sed "s%${TAG}%niReg -r $1 $2\\n\t${TAG}%g" < ${SRC} > ${DEST}
mv -f ${DEST} ${SRC}
}
function rm_niReg()
{
TAG="#RMREGISTRATION#"
SRC="debian/prerm"
DEST="`tempfile`"
sed "s%${TAG}%niReg -u $1 $2\\n\t${TAG}%g" < ${SRC} > ${DEST}
mv -f ${DEST} ${SRC}
}
CURDIR="`pwd`"
mkdir ${TMPDIR}
pushd ${TMPDIR}
# Rename the content of the passed tarball in a Debian compliant way
unzip -qq $ZIPBALL > /dev/null || (echo cannot unzip original package ; exit 1)
tar xjf ${TARBALL} > /dev/null || (echo cannot untarbz2 original package ; exit 1)
mv ${BASE} ${ORIG_BASE}
cp -a ${ORIG_BASE} ${DEB_BASE}
cp -a /usr/share/primesense-nite2-nonfree/nite2_debian_dir ${DEB_BASE}/debian
unset BASE
pushd ${DEB_BASE}
debuild --no-lintian -uc -us
echo Copying .deb into ${CACHEDIR}.
echo you can install the created package, as root with:
echo
echo -n "sudo dpkg -i "
for deb in ../*.deb; do
cp ${deb} ${CACHEDIR}
echo -n "${CACHEDIR}/`basename ${deb}`"
done
echo
popd > /dev/null # out of DEB_BASE
popd > /dev/null # out of TMPDIR
# clean up
if [ "$CLEAN" != "no" ];
then
echo "Package tree can be found at $TMPDIR"
else
test -d "${TMPDIR}" && rm -rf "${TMPDIR}"
fi