]> git.donarmstrong.com Git - debhelper.git/blob - dh_movefiles
r92: 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                 # The filelist is used, so even very weird filenames can be
35                 # moved.
36                 doit "rm -f movelist"
37                 for i in `(cd debian/tmp ; echo \`cat $files\`)`; do
38                         complex_doit "(cd debian/tmp ; find $i ! -type d -and ! -type l -print) >> movelist"
39                 done
40                 for i in `(cd debian/tmp ; echo \`cat $files\`)`; do
41                         complex_doit "(cd debian/tmp ; find $i ! -type d -and -type l -print) >> movelist"
42                 done
43                 complex_doit "(cd debian/tmp;tar --create --remove-files --files-from=../../movelist --file -) | (cd $TMP;tar xpf -)"
44                 doit "rm -f movelist"
45         fi
46 done