e83474c3fe2898f18d94f8c9b6aaab9eb23e6428
[dorian] / pkg / maemo / autobuild-scratchbox.sh
1 #!/bin/bash
2
3 # Do preparations for maemo.org autobuilder: Create changes, dsc and tar.gz
4 # files in $AUTO_DIR. Assumes all source files are copied to $BUILD_DIR.
5
6 set -x
7
8 BUILD_DIR=/home/user/dorian-build
9 AUTO_DIR=/home/user/dorian-auto
10
11 [ `id -u` != "0" ] && { echo "Run as root"; exit 1; }
12 [ ! -d ${BUILD_DIR} ] && { echo "Missing $BUILD_DIR"; exit 1; }
13 [ ! -x /usr/bin/uuencode ] && { echo "Missing /usr/bin/uuencode"; exit 1; }
14
15 VERSION=`cat ${BUILD_DIR}/pkg/version.txt`
16 cd ${BUILD_DIR}
17 make distclean 2>/dev/null || true
18
19 rm -rf ${AUTO_DIR}
20 mkdir -p ${AUTO_DIR}
21 cp -Rf ${BUILD_DIR} ${AUTO_DIR}/dorian-${VERSION}
22 cd ${AUTO_DIR}/dorian-${VERSION}
23 mkdir debian
24 cp pkg/changelog pkg/maemo/control pkg/maemo/rules pkg/maemo/postinst \
25     pkg/maemo/optify debian
26 chmod a+rx debian/postinst
27 echo "Version: $VERSION" >> debian/control
28 echo "Installed-Size: "`du -c -k ${AUTO_DIR} | tail -1 | cut -f1` \
29     >> debian/control
30 echo "XB-Maemo-Icon-26:" >> debian/control
31 uuencode -m pkg/maemo/icon-48/dorian.png dorian.png | \
32     (read; cat) | grep -v '^====' | \
33     sed 's/^/ /' >> debian/control
34
35 chmod -R a+r ${AUTO_DIR}
36 find ${AUTO_DIR} -type d -exec chmod a+x {} \;
37
38 echo "----------------------"
39 cat debian/control
40 echo "----------------------"
41
42 dpkg-buildpackage -rfakeroot -sa -S
43
44 echo "Autobuilder input is ready in ${AUTO_DIR}"