2 # The name is a deliberate echo of the "real" Debian dinstall; it moves
3 # packages into /usr/src/debian, removes any old versions of those packages
4 # there, and re-runs dpkg-myscan {packages,sources}.
7 echo "Usage: $0 package-name version-number" >&2
13 UPSTREAM=`echo $VERSION | sed -e 's/-[^-]*$//'`
15 echo -n "Dinstalling package $PACKAGE, "
16 echo -n "version $VERSION, "
17 echo "upstream version $UPSTREAM"
20 DEB=$PWD/${PACKAGE}_${VERSION}_${ARCH}.deb
21 ORIG=$PWD/${PACKAGE}_$UPSTREAM.orig.tar.gz
22 DIFF=$PWD/${PACKAGE}_${VERSION}.diff.gz
23 DSC=$PWD/${PACKAGE}_${VERSION}.dsc
24 CHANGES=$PWD/${PACKAGE}_${VERSION}_${ARCH}.changes
29 if [ ! -f $DEB ]; then echo $DEB 'not found' >&2; ERROR=1; fi
30 if [ ! -f $ORIG ]; then echo $ORIG 'not found' >&2; ERROR=1; fi
31 if [ ! -f $DIFF ]; then echo $DIFF 'not found' >&2; ERROR=1; fi
32 if [ ! -f $DSC ]; then echo $DSC 'not found' >&2; ERROR=1; fi
33 if [ ! -f $CHANGES ]; then echo $CHANGES 'not found' >&2; ERROR=1; fi
34 [ "$ERROR" ] && exit 1
36 SECTION=`dpkg -f $DEB Section`
37 if [ "$SECTION" ]; then
38 echo "Section: $SECTION"
40 echo "Section not found." >&2
44 if echo $SECTION | egrep -q '^(contrib|non-free)/'; then
45 BINARYDIR=`echo $SECTION | sed -e "s|/|/binary-$ARCH/|"`
46 SOURCEDIR=`echo $SECTION | sed -e "s|/|/source/|"`
47 elif echo $SECTION | egrep -q '^non-US/'; then
48 BINARYDIR=$SECTION/binary-$ARCH
49 SOURCEDIR=$SECTION/source
51 BINARYDIR=main/binary-$ARCH/$SECTION
52 SOURCEDIR=main/source/$SECTION
55 echo "Binaries in $BINARYDIR, sources in $SOURCEDIR"
57 cd /usr/src/debian/dists/unstable
60 if [ ! -d $BINARYDIR ]; then echo 'Binary dir not found.' >&2; ERROR=1; fi
61 if [ ! -d $SOURCEDIR ]; then echo 'Source dir not found.' >&2; ERROR=1; fi
62 [ "$ERROR" ] && exit 1
66 BINARIES=`echo $BINARYDIR/${PACKAGE}_*`
67 if [ "$BINARIES" ]; then
68 echo 'Binaries found in binary dir:'
69 echo $BINARIES | xargs -n1
70 read -n1 -esp 'Remove: (y/N) ' REMOVE
71 if [ "$REMOVE" == y ]; then
72 echo -n 'Removing ... '
73 echo $BINARIES | xargs rm
81 SOURCES=`echo $SOURCEDIR/${PACKAGE}_*`
82 if [ "$SOURCES" ]; then
83 echo 'Sources found in source dir:'
84 echo $SOURCES | xargs -n1
85 read -n1 -esp 'Remove: (y/N) ' REMOVE
86 if [ "$REMOVE" == y ]; then
87 echo -n 'Removing ... '
88 echo $SOURCES | xargs rm
96 echo "Moving $DEB to $BINARYDIR ..."
98 echo "Copying $ORIG to $SOURCEDIR ..."
99 cp -f $ORIG $SOURCEDIR
100 echo "Copying $DIFF to $SOURCEDIR ..."
101 cp -f $DIFF $SOURCEDIR
102 echo "Moving $DSC to $SOURCEDIR ..."
103 mv -f $DSC $SOURCEDIR
104 echo "Moving $CHANGES to $SOURCEDIR ..."
105 mv -f $CHANGES $SOURCEDIR
119 echo "Dinstallation of $PACKAGE-$VERSION complete."