]> git.donarmstrong.com Git - debhelper.git/blob - dh_movefiles
r86: Initial Import
[debhelper.git] / dh_movefiles
1 #!/bin/sh -e
2 #
3 # Move files out of debian/tmp, into subpackages.
4
5 PATH=debian:$PATH:/usr/lib/debhelper
6 . dh_lib
7
8 for PACKAGE in $DH_DOPACKAGES; do
9         TMP=`tmpdir $PACKAGE`
10         files=`pkgfile $PACKAGE files`
11
12         if [ ! -d "debian/tmp" ]; then
13                 error "debian/tmp does not exist"
14         fi
15
16         # debian/files has a different purpose, so ignore it.
17         if [ "$files" -a "$files" != "debian/files" ]; then
18                 if [ "$TMP" = "debian/tmp" ]; then
19                         error "I was asked to move some files from debian/tmp to debian/tmp."
20                 fi
21
22                 if [ ! -d "$TMP" ]; then
23                         doit "install -d $TMP"
24                 fi
25
26                 files=`pwd`/$files
27
28                 # Order the files. First all real files, then symlinks. 
29                 # Putting symlinks last is a nice thing to do for library 
30                 # packages and doesn't affect much of anything else.
31                 #
32                 # (The echo is in here to expand wildcards. Note that 'ls'
33                 # won't work properly.)
34                 tomove=""
35                 for i in `(cd debian/tmp ; echo \`cat $files\`)`; do
36                         tomove="`(cd debian/tmp ; \
37                                 find $i ! -type d -and ! -type l -print)` \
38                                 $tomove \
39                                 `(cd debian/tmp ; \
40                                 find $i ! -type d -and -type l -print)`"
41                 done
42
43                 complex_doit "(cd debian/tmp;tar --create --remove-files --file - "$tomove") | (cd $TMP;tar xpf -)"
44         fi
45 done