Fix potential buffer overflow.
[userinfo.git] / autogen.sh
blobb443c3c200df3b2aeb85103b74cd523959c88043
1 #!/bin/sh
3 # autogen.sh glue for hplip
5 # HPLIP used to have five or so different autotools trees. Upstream
6 # has reduced it to two. Still, this script is capable of cleaning
7 # just about any possible mess of autoconf files.
9 # BE CAREFUL with trees that are not completely automake-generated,
10 # this script deletes all Makefile.in files it can find.
12 # Requires: automake 1.9, autoconf 2.57+
13 # Conflicts: autoconf 2.13
14 set -e
16 cd "$(dirname "$0")"
18 # Refresh GNU autotools toolchain.
19 echo Cleaning autotools files...
20 find . -type d -name autom4te.cache -print0 | xargs -0 rm -rf \;
21 find . -type f \( -name missing -o -name install-sh -o -name mkinstalldirs \
22 -o -name depcomp -o -name ltmain.sh -o -name configure \
23 -o -name config.sub -o -name config.guess \
24 -o -name Makefile.in \) -print0 | xargs -0 rm -f
26 echo Running autoreconf...
27 mkdir -p m4
28 autoreconf --force --install
30 # For the Debian package build
31 test -d debian && {
32 # link these in Debian builds
33 rm -f config.sub config.guess
34 ln -s /usr/share/misc/config.sub .
35 ln -s /usr/share/misc/config.guess .
37 # refresh list of executable scripts, to avoid possible breakage if
38 # upstream tarball does not include the file or if it is mispackaged
39 # for whatever reason.
40 [ "$1" = "updateexec" ] && {
41 echo Generating list of executable files...
42 rm -f debian/executable.files
43 find -type f -perm +111 ! -name '.*' -fprint debian/executable.files
46 # Remove any files in upstream tarball that we don't have in the Debian
47 # package (because diff cannot remove files)
48 version=`dpkg-parsechangelog | awk '/Version:/ { print $2 }' | sed -e 's/-[^-]\+$//'`
49 source=`dpkg-parsechangelog | awk '/Source:/ { print $2 }' | tr -d ' '`
50 if test -r ../${source}_${version}.orig.tar.gz ; then
51 echo Generating list of files that should be removed...
52 rm -f debian/deletable.files
53 touch debian/deletable.files
54 [ -e debian/tmp ] && rm -rf debian/tmp
55 mkdir debian/tmp
56 ( cd debian/tmp ; tar -zxf ../../../${source}_${version}.orig.tar.gz )
57 find debian/tmp/ -type f ! -name '.*' -print0 | xargs -0 -ri echo '{}' | \
58 while read -r i ; do
59 if test -e "${i}" ; then
60 filename=$(echo "${i}" | sed -e 's#.*debian/tmp/[^/]\+/##')
61 test -e "${filename}" || echo "${filename}" >>debian/deletable.files
63 done
64 rm -fr debian/tmp
65 else
66 echo Emptying list of files that should be deleted...
67 rm -f debian/deletable.files
68 touch debian/deletable.files
72 exit 0